@@ -47,16 +47,20 @@ |
||
47 | 47 | // Provider. |
48 | 48 | if ( count( $name ) > 1 ) : |
49 | 49 | $provider = array_shift( $name ); |
50 | - else : |
|
50 | + else { |
|
51 | + : |
|
51 | 52 | $provider_name = explode( '(', $name[0] ); |
53 | + } |
|
52 | 54 | |
53 | 55 | $provider = array_shift( $provider_name ); |
54 | 56 | endif; |
55 | 57 | |
56 | 58 | if ( $current_provider === $integration->provider ) : |
57 | 59 | $provider = ''; |
58 | - else : |
|
60 | + else { |
|
61 | + : |
|
59 | 62 | $current_provider = $integration->provider; |
63 | + } |
|
60 | 64 | |
61 | 65 | $alternate = ! $alternate; |
62 | 66 | endif; |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | |
38 | 38 | foreach ( $pronamic_pay_providers as $provider ) : |
39 | 39 | |
40 | - if ( isset( $provider['integrations'] ) && is_array( $provider['integrations'] ) ) : |
|
40 | + if ( isset( $provider[ 'integrations' ] ) && is_array( $provider[ 'integrations' ] ) ) : |
|
41 | 41 | |
42 | - foreach ( $provider['integrations'] as $integration ) : |
|
42 | + foreach ( $provider[ 'integrations' ] as $integration ) : |
|
43 | 43 | $name = $integration->get_name(); |
44 | 44 | |
45 | 45 | $name = explode( ' - ', $name ); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if ( count( $name ) > 1 ) : |
49 | 49 | $provider = array_shift( $name ); |
50 | 50 | else : |
51 | - $provider_name = explode( '(', $name[0] ); |
|
51 | + $provider_name = explode( '(', $name[ 0 ] ); |
|
52 | 52 | |
53 | 53 | $provider = array_shift( $provider_name ); |
54 | 54 | endif; |
@@ -90,10 +90,13 @@ |
||
90 | 90 | </tr> |
91 | 91 | </table> |
92 | 92 | |
93 | -<?php else : ?> |
|
93 | +<?php else { |
|
94 | + : ?> |
|
94 | 95 | |
95 | 96 | <p> |
96 | - <?php esc_html_e( 'This payment is not related to a subscription.', 'pronamic_ideal' ); ?> |
|
97 | + <?php esc_html_e( 'This payment is not related to a subscription.', 'pronamic_ideal' ); |
|
98 | +} |
|
99 | +?> |
|
97 | 100 | </p> |
98 | 101 | |
99 | 102 | <?php endif; ?> |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | |
127 | 127 | $args = wp_parse_args( $args, $defaults ); |
128 | 128 | |
129 | - $id = $args['label_for']; |
|
129 | + $id = $args[ 'label_for' ]; |
|
130 | 130 | $value = get_option( $id ); |
131 | 131 | |
132 | 132 | $legend = sprintf( |
133 | 133 | '<legend class="screen-reader-text"><span>%s</span></legend>', |
134 | - esc_html( $args['label'] ) |
|
134 | + esc_html( $args[ 'label' ] ) |
|
135 | 135 | ); |
136 | 136 | |
137 | 137 | $input = sprintf( |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | '<label for="%s">%s %s</label>', |
148 | 148 | esc_attr( $id ), |
149 | 149 | $input, |
150 | - esc_html( $args['label'] ) |
|
150 | + esc_html( $args[ 'label' ] ) |
|
151 | 151 | ); |
152 | 152 | |
153 | 153 | printf( // WPCS: XSS ok. |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | $output = ''; |
188 | 188 | |
189 | 189 | // Dropdown. |
190 | - $id = $args['name']; |
|
191 | - $name = $args['name']; |
|
192 | - $selected = $args['selected']; |
|
190 | + $id = $args[ 'name' ]; |
|
191 | + $name = $args[ 'name' ]; |
|
192 | + $selected = $args[ 'selected' ]; |
|
193 | 193 | |
194 | 194 | if ( false === $selected ) { |
195 | 195 | $selected = get_option( $id ); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | esc_attr( $name ) |
202 | 202 | ); |
203 | 203 | |
204 | - $options = \Pronamic\WordPress\Pay\Plugin::get_config_select_options( $args['payment_method'] ); |
|
204 | + $options = \Pronamic\WordPress\Pay\Plugin::get_config_select_options( $args[ 'payment_method' ] ); |
|
205 | 205 | |
206 | 206 | foreach ( $options as $value => $name ) { |
207 | 207 | $output .= sprintf( |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $output .= sprintf( '</select>' ); |
216 | 216 | |
217 | 217 | // Return or echo. |
218 | - if ( $args['echo'] ) { |
|
218 | + if ( $args[ 'echo' ] ) { |
|
219 | 219 | echo $output; // WPCS: XSS ok. |
220 | 220 | } else { |
221 | 221 | return $output; |
@@ -231,33 +231,33 @@ discard block |
||
231 | 231 | private function create_pages( $pages, $parent = null ) { |
232 | 232 | foreach ( $pages as $page ) { |
233 | 233 | $post = array( |
234 | - 'post_title' => $page['post_title'], |
|
235 | - 'post_name' => $page['post_title'], |
|
236 | - 'post_content' => $page['post_content'], |
|
234 | + 'post_title' => $page[ 'post_title' ], |
|
235 | + 'post_name' => $page[ 'post_title' ], |
|
236 | + 'post_content' => $page[ 'post_content' ], |
|
237 | 237 | 'post_status' => 'publish', |
238 | 238 | 'post_type' => 'page', |
239 | 239 | 'comment_status' => 'closed', |
240 | 240 | ); |
241 | 241 | |
242 | 242 | if ( isset( $parent ) ) { |
243 | - $post['post_parent'] = $parent; |
|
243 | + $post[ 'post_parent' ] = $parent; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | $result = wp_insert_post( $post, true ); |
247 | 247 | |
248 | 248 | if ( ! is_wp_error( $result ) ) { |
249 | - if ( isset( $page['post_meta'] ) ) { |
|
250 | - foreach ( $page['post_meta'] as $key => $value ) { |
|
249 | + if ( isset( $page[ 'post_meta' ] ) ) { |
|
250 | + foreach ( $page[ 'post_meta' ] as $key => $value ) { |
|
251 | 251 | update_post_meta( $result, $key, $value ); |
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | - if ( isset( $page['option_name'] ) ) { |
|
256 | - update_option( $page['option_name'], $result ); |
|
255 | + if ( isset( $page[ 'option_name' ] ) ) { |
|
256 | + update_option( $page[ 'option_name' ], $result ); |
|
257 | 257 | } |
258 | 258 | |
259 | - if ( isset( $page['children'] ) ) { |
|
260 | - $this->create_pages( $page['children'], $result ); |
|
259 | + if ( isset( $page[ 'children' ] ) ) { |
|
260 | + $this->create_pages( $page[ 'children' ], $result ); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | } |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | |
529 | 529 | global $submenu; |
530 | 530 | |
531 | - if ( isset( $submenu['pronamic_ideal'] ) ) { |
|
532 | - $submenu['pronamic_ideal'][0][0] = __( 'Dashboard', 'pronamic_ideal' ); // WPCS: override ok. |
|
531 | + if ( isset( $submenu[ 'pronamic_ideal' ] ) ) { |
|
532 | + $submenu[ 'pronamic_ideal' ][ 0 ][ 0 ] = __( 'Dashboard', 'pronamic_ideal' ); // WPCS: override ok. |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 |
@@ -154,8 +154,8 @@ |
||
154 | 154 | // Payments. |
155 | 155 | $payment_capabilities = PaymentPostType::get_capabilities(); |
156 | 156 | |
157 | - unset( $payment_capabilities['publish_posts'] ); |
|
158 | - unset( $payment_capabilities['create_posts'] ); |
|
157 | + unset( $payment_capabilities[ 'publish_posts' ] ); |
|
158 | + unset( $payment_capabilities[ 'create_posts' ] ); |
|
159 | 159 | |
160 | 160 | foreach ( $payment_capabilities as $capability ) { |
161 | 161 | $roles->add_cap( 'administrator', $capability ); |
@@ -347,7 +347,7 @@ |
||
347 | 347 | $value = (float) $data[ $key ]->value; |
348 | 348 | } |
349 | 349 | |
350 | - $report[] = array( |
|
350 | + $report[ ] = array( |
|
351 | 351 | // Flot requires milliseconds so multiply with 1000. |
352 | 352 | $date->getTimestamp() * 1000, |
353 | 353 | $value, |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param array $args Arguments. |
168 | 168 | */ |
169 | 169 | public function settings_section( $args ) { |
170 | - switch ( $args['id'] ) { |
|
170 | + switch ( $args[ 'id' ] ) { |
|
171 | 171 | case 'pronamic_pay_pages': |
172 | 172 | echo '<p>'; |
173 | 173 | esc_html_e( 'The page an user will get redirected to after payment, based on the payment status.', 'pronamic_ideal' ); |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | |
213 | 213 | $args = wp_parse_args( $args, $defaults ); |
214 | 214 | |
215 | - $name = $args['label_for']; |
|
215 | + $name = $args[ 'label_for' ]; |
|
216 | 216 | $value = get_option( $name ); |
217 | 217 | |
218 | 218 | $atts = array( |
219 | 219 | 'name' => $name, |
220 | 220 | 'id' => $name, |
221 | - 'type' => $args['type'], |
|
222 | - 'class' => $args['classes'], |
|
221 | + 'type' => $args[ 'type' ], |
|
222 | + 'class' => $args[ 'classes' ], |
|
223 | 223 | 'value' => $value, |
224 | 224 | ); |
225 | 225 | |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | // @codingStandardsIgnoreEn |
231 | 231 | ); |
232 | 232 | |
233 | - if ( ! empty( $args['description'] ) ) { |
|
233 | + if ( ! empty( $args[ 'description' ] ) ) { |
|
234 | 234 | printf( |
235 | 235 | '<p class="description">%s</p>', |
236 | - esc_html( $args['description'] ) |
|
236 | + esc_html( $args[ 'description' ] ) |
|
237 | 237 | ); |
238 | 238 | } |
239 | 239 | } |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | * @param array $args Arguments. |
247 | 247 | */ |
248 | 248 | public function input_checkbox( $args ) { |
249 | - $id = $args['label_for']; |
|
250 | - $name = $args['label_for']; |
|
249 | + $id = $args[ 'label_for' ]; |
|
250 | + $name = $args[ 'label_for' ]; |
|
251 | 251 | $value = get_option( $name ); |
252 | - $legend = $args['legend']; |
|
252 | + $legend = $args[ 'legend' ]; |
|
253 | 253 | |
254 | 254 | echo '<fieldset>'; |
255 | 255 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | checked( $value, 1, false ) |
271 | 271 | ); |
272 | 272 | |
273 | - echo esc_html( $args['description'] ); |
|
273 | + echo esc_html( $args[ 'description' ] ); |
|
274 | 274 | |
275 | 275 | echo '</label>'; |
276 | 276 | |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | * @param array $args Arguments. |
301 | 301 | */ |
302 | 302 | public function input_page( $args ) { |
303 | - $name = $args['label_for']; |
|
303 | + $name = $args[ 'label_for' ]; |
|
304 | 304 | |
305 | 305 | wp_dropdown_pages( array( |
306 | 306 | 'name' => esc_attr( $name ), |
307 | - 'post_type' => esc_attr( isset( $args['post_type'] ) ? $args['post_type'] : 'page' ), |
|
307 | + 'post_type' => esc_attr( isset( $args[ 'post_type' ] ) ? $args[ 'post_type' ] : 'page' ), |
|
308 | 308 | 'selected' => esc_attr( get_option( $name, '' ) ), |
309 | - 'show_option_none' => esc_attr( isset( $args['show_option_none'] ) ? $args['show_option_none'] : __( '— Select a page —', 'pronamic_ideal' ) ), |
|
309 | + 'show_option_none' => esc_attr( isset( $args[ 'show_option_none' ] ) ? $args[ 'show_option_none' ] : __( '— Select a page —', 'pronamic_ideal' ) ), |
|
310 | 310 | 'class' => 'regular-text', |
311 | 311 | ) ); |
312 | 312 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | ), $atts, 'pronamic_payment_form' |
47 | 47 | ); |
48 | 48 | |
49 | - $id = $atts['id']; |
|
49 | + $id = $atts[ 'id' ]; |
|
50 | 50 | |
51 | 51 | return $this->forms_module->get_form_output( $id ); |
52 | 52 | } |
@@ -132,14 +132,14 @@ |
||
132 | 132 | $first_name = filter_input( INPUT_POST, 'pronamic_pay_first_name', FILTER_SANITIZE_STRING ); |
133 | 133 | |
134 | 134 | if ( empty( $first_name ) ) { |
135 | - $pronamic_pay_errors['first_name'] = __( 'Please enter your first name', 'pronamic_ideal' ); |
|
135 | + $pronamic_pay_errors[ 'first_name' ] = __( 'Please enter your first name', 'pronamic_ideal' ); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | // E-mail. |
139 | 139 | $email = filter_input( INPUT_POST, 'pronamic_pay_email', FILTER_VALIDATE_EMAIL ); |
140 | 140 | |
141 | 141 | if ( empty( $email ) ) { |
142 | - $pronamic_pay_errors['email'] = __( 'Please enter a valid email address', 'pronamic_ideal' ); |
|
142 | + $pronamic_pay_errors[ 'email' ] = __( 'Please enter a valid email address', 'pronamic_ideal' ); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | return empty( $pronamic_pay_errors ); |
@@ -307,15 +307,15 @@ |
||
307 | 307 | $data = filter_input_array( INPUT_POST, $definition ); |
308 | 308 | |
309 | 309 | // Convert amount choices to cents. |
310 | - if ( isset( $data['_pronamic_payment_form_amount_choices'] ) ) { |
|
311 | - foreach ( $data['_pronamic_payment_form_amount_choices'] as $i => $amount ) { |
|
310 | + if ( isset( $data[ '_pronamic_payment_form_amount_choices' ] ) ) { |
|
311 | + foreach ( $data[ '_pronamic_payment_form_amount_choices' ] as $i => $amount ) { |
|
312 | 312 | $amount = \Pronamic\WordPress\Pay\Core\Util::string_to_amount( $amount ); |
313 | 313 | |
314 | - $data['_pronamic_payment_form_amount_choices'][ $i ] = \Pronamic\WordPress\Pay\Core\Util::amount_to_cents( $amount ); |
|
314 | + $data[ '_pronamic_payment_form_amount_choices' ][ $i ] = \Pronamic\WordPress\Pay\Core\Util::amount_to_cents( $amount ); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | // Remove empty choices. |
318 | - $data['_pronamic_payment_form_amount_choices'] = array_filter( $data['_pronamic_payment_form_amount_choices'] ); |
|
318 | + $data[ '_pronamic_payment_form_amount_choices' ] = array_filter( $data[ '_pronamic_payment_form_amount_choices' ] ); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | // Update post meta data. |