@@ -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; |
@@ -22,13 +22,16 @@ |
||
22 | 22 | |
23 | 23 | <?php esc_html_e( 'No payments found.', 'pronamic_ideal' ); ?> |
24 | 24 | |
25 | -<?php else : ?> |
|
25 | +<?php else { |
|
26 | + : ?> |
|
26 | 27 | |
27 | 28 | <table class="pronamic-pay-table widefat"> |
28 | 29 | <thead> |
29 | 30 | <tr> |
30 | 31 | <th scope="col"> |
31 | - <span class="pronamic-pay-tip pronamic-pay-icon pronamic-pay-status" data-tip="<?php esc_attr_e( 'Status', 'pronamic_ideal' ); ?>"><?php esc_html_e( 'Status', 'pronamic_ideal' ); ?></span> |
|
32 | + <span class="pronamic-pay-tip pronamic-pay-icon pronamic-pay-status" data-tip="<?php esc_attr_e( 'Status', 'pronamic_ideal' ); |
|
33 | +} |
|
34 | +?>"><?php esc_html_e( 'Status', 'pronamic_ideal' ); ?></span> |
|
32 | 35 | </th> |
33 | 36 | <th scope="col"><?php esc_html_e( 'Payment', 'pronamic_ideal' ); ?></th> |
34 | 37 | <th scope="col"><?php esc_html_e( 'Transaction', 'pronamic_ideal' ); ?></th> |
@@ -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; ?> |
@@ -27,13 +27,15 @@ |
||
27 | 27 | </td> |
28 | 28 | </tr> |
29 | 29 | |
30 | - <?php else : ?> |
|
30 | + <?php else { |
|
31 | + : ?> |
|
31 | 32 | |
32 | 33 | <?php foreach ( $comments as $comment ) : ?> |
33 | 34 | |
34 | 35 | <?php |
35 | 36 | |
36 | 37 | $html_id = 'comment-' . $comment->comment_ID; |
38 | +} |
|
37 | 39 | $html_class = join( ' ', get_comment_class( wp_get_comment_status( $comment->comment_ID ) ) ); |
38 | 40 | |
39 | 41 | ?> |
@@ -27,13 +27,15 @@ |
||
27 | 27 | </td> |
28 | 28 | </tr> |
29 | 29 | |
30 | - <?php else : ?> |
|
30 | + <?php else { |
|
31 | + : ?> |
|
31 | 32 | |
32 | 33 | <?php foreach ( $comments as $comment ) : ?> |
33 | 34 | |
34 | 35 | <?php |
35 | 36 | |
36 | 37 | $html_id = 'comment-' . $comment->comment_ID; |
38 | +} |
|
37 | 39 | $html_class = join( ' ', get_comment_class( wp_get_comment_status( $comment->comment_ID ) ) ); |
38 | 40 | |
39 | 41 | ?> |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $classes = apply_filters( 'pronamic_pay_gateway_settings', array() ); |
36 | 36 | |
37 | 37 | foreach ( $classes as $class ) { |
38 | - $this->settings[] = new $class(); |
|
38 | + $this->settings[ ] = new $class(); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 |
@@ -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 |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $name = __( 'Dashboard', 'pronamic_ideal' ); |
143 | 143 | } |
144 | 144 | |
145 | - $content[] = sprintf( |
|
145 | + $content[ ] = sprintf( |
|
146 | 146 | '<a href="%s" target="_blank">%s</a>', |
147 | 147 | esc_attr( $url ), |
148 | 148 | esc_html( ucfirst( $name ) ) |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | if ( intval( get_option( 'pronamic_pay_config_id' ) ) === $post->ID ) { |
171 | - $post_states['pronamic_pay_config_default'] = __( 'Default', 'pronamic_ideal' ); |
|
171 | + $post_states[ 'pronamic_pay_config_default' ] = __( 'Default', 'pronamic_ideal' ); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | return $post_states; |
@@ -268,9 +268,9 @@ discard block |
||
268 | 268 | ); |
269 | 269 | |
270 | 270 | foreach ( $fields as $field ) { |
271 | - if ( isset( $field['meta_key'], $field['filter'] ) ) { |
|
272 | - $name = $field['meta_key']; |
|
273 | - $filter = $field['filter']; |
|
271 | + if ( isset( $field[ 'meta_key' ], $field[ 'filter' ] ) ) { |
|
272 | + $name = $field[ 'meta_key' ]; |
|
273 | + $filter = $field[ 'filter' ]; |
|
274 | 274 | |
275 | 275 | $definition[ $name ] = $filter; |
276 | 276 | } |
@@ -278,28 +278,28 @@ discard block |
||
278 | 278 | |
279 | 279 | $data = filter_input_array( INPUT_POST, $definition ); |
280 | 280 | |
281 | - if ( ! empty( $data['_pronamic_gateway_id'] ) ) { |
|
281 | + if ( ! empty( $data[ '_pronamic_gateway_id' ] ) ) { |
|
282 | 282 | $integrations = $this->admin->plugin->gateway_integrations; |
283 | 283 | |
284 | - if ( isset( $integrations[ $data['_pronamic_gateway_id'] ] ) ) { |
|
285 | - $integration = $integrations[ $data['_pronamic_gateway_id'] ]; |
|
284 | + if ( isset( $integrations[ $data[ '_pronamic_gateway_id' ] ] ) ) { |
|
285 | + $integration = $integrations[ $data[ '_pronamic_gateway_id' ] ]; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | if ( $integration ) { |
289 | 289 | $settings = $integration->get_settings(); |
290 | 290 | |
291 | 291 | foreach ( $fields as $field ) { |
292 | - if ( isset( $field['default'], $field['meta_key'], $data[ $field['meta_key'] ] ) ) { |
|
292 | + if ( isset( $field[ 'default' ], $field[ 'meta_key' ], $data[ $field[ 'meta_key' ] ] ) ) { |
|
293 | 293 | // Remove default value if not applicable to the selected gateway. |
294 | - if ( isset( $field['methods'] ) ) { |
|
295 | - $clean_default = array_intersect( $settings, $field['methods'] ); |
|
294 | + if ( isset( $field[ 'methods' ] ) ) { |
|
295 | + $clean_default = array_intersect( $settings, $field[ 'methods' ] ); |
|
296 | 296 | |
297 | 297 | if ( empty( $clean_default ) ) { |
298 | - $meta_value = get_post_meta( $post_id, $field['meta_key'], true ); |
|
298 | + $meta_value = get_post_meta( $post_id, $field[ 'meta_key' ], true ); |
|
299 | 299 | |
300 | 300 | // Only remove value if not saved before. |
301 | 301 | if ( empty( $meta_value ) ) { |
302 | - $data[ $field['meta_key'] ] = null; |
|
302 | + $data[ $field[ 'meta_key' ] ] = null; |
|
303 | 303 | |
304 | 304 | continue; |
305 | 305 | } |
@@ -307,13 +307,13 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | // Set the default value if empty. |
310 | - if ( empty( $data[ $field['meta_key'] ] ) ) { |
|
311 | - $default = $field['default']; |
|
310 | + if ( empty( $data[ $field[ 'meta_key' ] ] ) ) { |
|
311 | + $default = $field[ 'default' ]; |
|
312 | 312 | |
313 | - if ( is_array( $default ) && 2 === count( $default ) && Util::class_method_exists( $default[0], $default[1] ) ) { |
|
314 | - $data[ $field['meta_key'] ] = call_user_func( $default, $field ); |
|
313 | + if ( is_array( $default ) && 2 === count( $default ) && Util::class_method_exists( $default[ 0 ], $default[ 1 ] ) ) { |
|
314 | + $data[ $field[ 'meta_key' ] ] = call_user_func( $default, $field ); |
|
315 | 315 | } else { |
316 | - $data[ $field['meta_key'] ] = $default; |
|
316 | + $data[ $field[ 'meta_key' ] ] = $default; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | } |
@@ -362,14 +362,14 @@ discard block |
||
362 | 362 | 0 => '', // Unused. Messages start at index 1. |
363 | 363 | 1 => __( 'Configuration updated.', 'pronamic_ideal' ), |
364 | 364 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352799&filters[translation_id]=37947229 |
365 | - 2 => $messages['post'][2], |
|
365 | + 2 => $messages[ 'post' ][ 2 ], |
|
366 | 366 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352800&filters[translation_id]=37947870 |
367 | - 3 => $messages['post'][3], |
|
367 | + 3 => $messages[ 'post' ][ 3 ], |
|
368 | 368 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352798&filters[translation_id]=37947230 |
369 | 369 | 4 => __( 'Configuration updated.', 'pronamic_ideal' ), |
370 | 370 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352801&filters[translation_id]=37947231 |
371 | 371 | // translators: %s: date and time of the revision. |
372 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Configuration restored to revision from %s.', 'pronamic_ideal' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, // WPCS: CSRF ok. |
|
372 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'Configuration restored to revision from %s.', 'pronamic_ideal' ), wp_post_revision_title( (int) $_GET[ 'revision' ], false ) ) : false, // WPCS: CSRF ok. |
|
373 | 373 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352802&filters[translation_id]=37949178 |
374 | 374 | 6 => __( 'Configuration published.', 'pronamic_ideal' ), |
375 | 375 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352803&filters[translation_id]=37947232 |
@@ -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 ); |