@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return string |
70 | 70 | */ |
71 | 71 | public function get_form_output( $id ) { |
72 | - $file = plugin_dir_path( $this->plugin->get_file() ) . 'templates/form.php'; |
|
72 | + $file = plugin_dir_path( $this->plugin->get_file() ).'templates/form.php'; |
|
73 | 73 | |
74 | 74 | ob_start(); |
75 | 75 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @return string |
89 | 89 | */ |
90 | 90 | public function source_text( $text, Payment $payment ) { |
91 | - $text = __( 'Payment Form', 'pronamic_ideal' ) . '<br />'; |
|
91 | + $text = __( 'Payment Form', 'pronamic_ideal' ).'<br />'; |
|
92 | 92 | |
93 | 93 | $text .= sprintf( |
94 | 94 | '<a href="%s">%s</a>', |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | update_user_meta( get_current_user_id(), 'pronamic_pay_ignore_tour', $ignore ); |
47 | 47 | } |
48 | 48 | |
49 | - if ( ! get_user_meta( get_current_user_id(), 'pronamic_pay_ignore_tour', true ) ) { |
|
49 | + if ( !get_user_meta( get_current_user_id(), 'pronamic_pay_ignore_tour', true ) ) { |
|
50 | 50 | add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
51 | 51 | } |
52 | 52 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | // Pointers. |
61 | 61 | wp_register_style( |
62 | 62 | 'proanmic-pay-admin-tour', |
63 | - plugins_url( 'css/admin-tour' . $min . '.css', $this->plugin->get_file() ), |
|
63 | + plugins_url( 'css/admin-tour'.$min.'.css', $this->plugin->get_file() ), |
|
64 | 64 | array( |
65 | 65 | 'wp-pointer', |
66 | 66 | ), |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | wp_register_script( |
71 | 71 | 'proanmic-pay-admin-tour', |
72 | - plugins_url( 'js/admin-tour' . $min . '.js', $this->plugin->get_file() ), |
|
72 | + plugins_url( 'js/admin-tour'.$min.'.js', $this->plugin->get_file() ), |
|
73 | 73 | array( |
74 | 74 | 'jquery', |
75 | 75 | 'wp-pointer', |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | private function get_content( $file ) { |
101 | 101 | $content = ''; |
102 | 102 | |
103 | - $path = plugin_dir_path( $this->plugin->get_file() ) . 'admin/' . $file . '.php'; |
|
103 | + $path = plugin_dir_path( $this->plugin->get_file() ).'admin/'.$file.'.php'; |
|
104 | 104 | |
105 | 105 | if ( is_readable( $path ) ) { |
106 | 106 | ob_start(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $screen = get_current_screen(); |
44 | 44 | |
45 | 45 | // Show notices only to options managers (administrators). |
46 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
46 | + if ( !current_user_can( 'manage_options' ) ) { |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $notices = get_option( 'pronamic_pay_admin_notices', array() ); |
85 | 85 | |
86 | 86 | foreach ( $notices as $name ) { |
87 | - $file = plugin_dir_path( $this->plugin->get_file() ) . 'admin/notice-' . $name . '.php'; |
|
87 | + $file = plugin_dir_path( $this->plugin->get_file() ).'admin/notice-'.$name.'.php'; |
|
88 | 88 | |
89 | 89 | if ( is_readable( $file ) ) { |
90 | 90 | include $file; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ); |
63 | 63 | |
64 | 64 | // @see https://github.com/WordPress/WordPress/blob/4.2.4/wp-admin/admin-header.php#L82-L87. |
65 | - add_action( 'admin_print_styles-' . $hook_suffix, array( $this, 'admin_css' ) ); |
|
65 | + add_action( 'admin_print_styles-'.$hook_suffix, array( $this, 'admin_css' ) ); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | wp_register_script( |
85 | 85 | 'flot', |
86 | - plugins_url( 'assets/flot/jquery.flot' . $min . '.js', $this->plugin->get_file() ), |
|
86 | + plugins_url( 'assets/flot/jquery.flot'.$min.'.js', $this->plugin->get_file() ), |
|
87 | 87 | array( 'jquery' ), |
88 | 88 | $flot_version, |
89 | 89 | true |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | wp_register_script( |
93 | 93 | 'flot-time', |
94 | - plugins_url( 'assets/flot/jquery.flot.time' . $min . '.js', $this->plugin->get_file() ), |
|
94 | + plugins_url( 'assets/flot/jquery.flot.time'.$min.'.js', $this->plugin->get_file() ), |
|
95 | 95 | array( 'flot' ), |
96 | 96 | $flot_version, |
97 | 97 | true |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | wp_register_script( |
101 | 101 | 'flot-resize', |
102 | - plugins_url( 'assets/flot/jquery.flot.resize' . $min . '.js', $this->plugin->get_file() ), |
|
102 | + plugins_url( 'assets/flot/jquery.flot.resize'.$min.'.js', $this->plugin->get_file() ), |
|
103 | 103 | array( 'flot' ), |
104 | 104 | $flot_version, |
105 | 105 | true |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // Accounting.js - http://openexchangerates.github.io/accounting.js. |
109 | 109 | wp_register_script( |
110 | 110 | 'accounting', |
111 | - plugins_url( 'assets/accounting/accounting' . $min . '.js', $this->plugin->get_file() ), |
|
111 | + plugins_url( 'assets/accounting/accounting'.$min.'.js', $this->plugin->get_file() ), |
|
112 | 112 | array( 'jquery' ), |
113 | 113 | '0.4.1', |
114 | 114 | true |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | // Reports. |
118 | 118 | wp_register_script( |
119 | 119 | 'proanmic-pay-admin-reports', |
120 | - plugins_url( 'js/admin-reports' . $min . '.js', $this->plugin->get_file() ), |
|
120 | + plugins_url( 'js/admin-reports'.$min.'.js', $this->plugin->get_file() ), |
|
121 | 121 | array( |
122 | 122 | 'jquery', |
123 | 123 | 'flot', |
@@ -347,7 +347,7 @@ discard block |
||
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, |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | // Payments. |
153 | 153 | $payment_capabilities = PaymentPostType::get_capabilities(); |
154 | 154 | |
155 | - unset( $payment_capabilities['publish_posts'] ); |
|
156 | - unset( $payment_capabilities['create_posts'] ); |
|
155 | + unset( $payment_capabilities[ 'publish_posts' ] ); |
|
156 | + unset( $payment_capabilities[ 'create_posts' ] ); |
|
157 | 157 | |
158 | 158 | foreach ( $payment_capabilities as $capability ) { |
159 | 159 | $roles->add_cap( 'administrator', $capability ); |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | |
176 | 176 | if ( $current_db_version ) { |
177 | 177 | foreach ( $this->db_updates as $version ) { |
178 | - if ( ! version_compare( $current_db_version, $version, '<' ) ) { |
|
178 | + if ( !version_compare( $current_db_version, $version, '<' ) ) { |
|
179 | 179 | continue; |
180 | 180 | } |
181 | 181 | |
182 | - $file = plugin_dir_path( $this->plugin->get_file() ) . 'includes/updates/update-' . $version . '.php'; |
|
182 | + $file = plugin_dir_path( $this->plugin->get_file() ).'includes/updates/update-'.$version.'.php'; |
|
183 | 183 | |
184 | 184 | if ( is_readable( $file ) ) { |
185 | 185 | include $file; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | // Gateway settings. |
70 | 70 | $this->gateway_settings = new GatewaySettings(); |
71 | 71 | |
72 | - if ( ! wp_next_scheduled( 'pronamic_pay_license_check' ) ) { |
|
72 | + if ( !wp_next_scheduled( 'pronamic_pay_license_check' ) ) { |
|
73 | 73 | wp_schedule_event( time(), 'daily', 'pronamic_pay_license_check' ); |
74 | 74 | } |
75 | 75 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | || |
96 | 96 | filter_has_var( INPUT_GET, 'activate-multi' ) |
97 | 97 | || |
98 | - ! current_user_can( 'manage_options' ) |
|
98 | + !current_user_can( 'manage_options' ) |
|
99 | 99 | ) { |
100 | 100 | return; |
101 | 101 | } |
@@ -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 | - if ( ! is_wp_error( $result ) ) { |
|
249 | - if ( isset( $page['post_meta'] ) ) { |
|
250 | - foreach ( $page['post_meta'] as $key => $value ) { |
|
248 | + if ( !is_wp_error( $result ) ) { |
|
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 | } |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | * Maybe create pages. |
268 | 268 | */ |
269 | 269 | public function maybe_create_pages() { |
270 | - if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_create_pages' ) ) { |
|
270 | + if ( !filter_has_var( INPUT_POST, 'pronamic_pay_create_pages' ) ) { |
|
271 | 271 | return; |
272 | 272 | } |
273 | 273 | |
274 | - if ( ! check_admin_referer( 'pronamic_pay_settings', 'pronamic_pay_nonce' ) ) { |
|
274 | + if ( !check_admin_referer( 'pronamic_pay_settings', 'pronamic_pay_nonce' ) ) { |
|
275 | 275 | return; |
276 | 276 | } |
277 | 277 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | // Tippy.js - https://atomiks.github.io/tippyjs/. |
377 | 377 | wp_register_script( |
378 | 378 | 'tippy.js', |
379 | - plugins_url( 'assets/tippy.js/tippy.all' . $min . '.js', $this->plugin->get_file() ), |
|
379 | + plugins_url( 'assets/tippy.js/tippy.all'.$min.'.js', $this->plugin->get_file() ), |
|
380 | 380 | array(), |
381 | 381 | '2.5.0', |
382 | 382 | true |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | |
393 | 393 | wp_register_style( |
394 | 394 | 'pronamic-pay-admin', |
395 | - plugins_url( 'css/admin' . $min . '.css', $this->plugin->get_file() ), |
|
395 | + plugins_url( 'css/admin'.$min.'.css', $this->plugin->get_file() ), |
|
396 | 396 | array( 'pronamic-pay-icons' ), |
397 | 397 | $this->plugin->get_version() |
398 | 398 | ); |
399 | 399 | |
400 | 400 | wp_register_script( |
401 | 401 | 'pronamic-pay-admin', |
402 | - plugins_url( 'js/admin' . $min . '.js', $this->plugin->get_file() ), |
|
402 | + plugins_url( 'js/admin'.$min.'.js', $this->plugin->get_file() ), |
|
403 | 403 | array( 'jquery', 'tippy.js' ), |
404 | 404 | $this->plugin->get_version(), |
405 | 405 | true |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | |
468 | 468 | add_menu_page( |
469 | 469 | __( 'Pronamic Pay', 'pronamic_ideal' ), |
470 | - __( 'Pay', 'pronamic_ideal' ) . $badge, |
|
470 | + __( 'Pay', 'pronamic_ideal' ).$badge, |
|
471 | 471 | 'edit_payments', |
472 | 472 | 'pronamic_ideal', |
473 | 473 | array( $this, 'page_dashboard' ), |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | add_submenu_page( |
478 | 478 | 'pronamic_ideal', |
479 | 479 | __( 'Payments', 'pronamic_ideal' ), |
480 | - __( 'Payments', 'pronamic_ideal' ) . $badge, |
|
480 | + __( 'Payments', 'pronamic_ideal' ).$badge, |
|
481 | 481 | 'edit_payments', |
482 | 482 | 'edit.php?post_type=pronamic_payment' |
483 | 483 | ); |
@@ -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 | |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | public function render_page( $name ) { |
564 | 564 | $result = false; |
565 | 565 | |
566 | - $file = plugin_dir_path( $this->plugin->get_file() ) . 'admin/page-' . $name . '.php'; |
|
566 | + $file = plugin_dir_path( $this->plugin->get_file() ).'admin/page-'.$name.'.php'; |
|
567 | 567 | |
568 | 568 | if ( is_readable( $file ) ) { |
569 | 569 | include $file; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | array( $this, 'page_about' ) |
69 | 69 | ); |
70 | 70 | |
71 | - add_action( 'admin_print_styles-' . $hook_suffix, array( $this, 'admin_css' ) ); |
|
71 | + add_action( 'admin_print_styles-'.$hook_suffix, array( $this, 'admin_css' ) ); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | wp_enqueue_style( |
89 | 89 | 'proanmic-pay-admin-about', |
90 | - plugins_url( 'css/admin-about' . $min . '.css', $this->plugin->get_file() ), |
|
90 | + plugins_url( 'css/admin-about'.$min.'.css', $this->plugin->get_file() ), |
|
91 | 91 | array(), |
92 | 92 | $this->plugin->get_version() |
93 | 93 | ); |
@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | wp_register_style( |
49 | 49 | 'pronamic-pay-forms', |
50 | - plugins_url( 'css/forms' . $min . '.css', $this->plugin->get_file() ), |
|
50 | + plugins_url( 'css/forms'.$min.'.css', $this->plugin->get_file() ), |
|
51 | 51 | array(), |
52 | 52 | $this->plugin->get_version() |
53 | 53 | ); |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | $this->plugin = $plugin; |
47 | 47 | $this->admin = $admin; |
48 | 48 | |
49 | - add_filter( 'manage_edit-' . self::POST_TYPE . '_columns', array( $this, 'edit_columns' ) ); |
|
49 | + add_filter( 'manage_edit-'.self::POST_TYPE.'_columns', array( $this, 'edit_columns' ) ); |
|
50 | 50 | |
51 | - add_action( 'manage_' . self::POST_TYPE . '_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 ); |
|
51 | + add_action( 'manage_'.self::POST_TYPE.'_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 ); |
|
52 | 52 | |
53 | 53 | add_action( 'post_edit_form_tag', array( $this, 'post_edit_form_tag' ) ); |
54 | 54 | |
55 | 55 | add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); |
56 | 56 | |
57 | - add_action( 'save_post_' . self::POST_TYPE, array( $this, 'save_post' ) ); |
|
57 | + add_action( 'save_post_'.self::POST_TYPE, array( $this, 'save_post' ) ); |
|
58 | 58 | |
59 | 59 | add_action( 'display_post_states', array( $this, 'display_post_states' ), 10, 2 ); |
60 | 60 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $name = __( 'Dashboard', 'pronamic_ideal' ); |
153 | 153 | } |
154 | 154 | |
155 | - $content[] = sprintf( |
|
155 | + $content[ ] = sprintf( |
|
156 | 156 | '<a href="%s" target="_blank">%s</a>', |
157 | 157 | esc_attr( $url ), |
158 | 158 | esc_html( ucfirst( $name ) ) |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | if ( intval( get_option( 'pronamic_pay_config_id' ) ) === $post->ID ) { |
181 | - $post_states['pronamic_pay_config_default'] = __( 'Default', 'pronamic_ideal' ); |
|
181 | + $post_states[ 'pronamic_pay_config_default' ] = __( 'Default', 'pronamic_ideal' ); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | return $post_states; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | public function meta_box_config( $post ) { |
240 | 240 | wp_nonce_field( 'pronamic_pay_save_gateway', 'pronamic_pay_nonce' ); |
241 | 241 | |
242 | - include plugin_dir_path( $this->plugin->get_file() ) . 'admin/meta-box-gateway-config.php'; |
|
242 | + include plugin_dir_path( $this->plugin->get_file() ).'admin/meta-box-gateway-config.php'; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @param WP_Post $post The object for the current post/page. |
249 | 249 | */ |
250 | 250 | public function meta_box_test( $post ) { |
251 | - include plugin_dir_path( $this->plugin->get_file() ) . 'admin/meta-box-gateway-test.php'; |
|
251 | + include plugin_dir_path( $this->plugin->get_file() ).'admin/meta-box-gateway-test.php'; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function save_post( $post_id ) { |
260 | 260 | // Nonce. |
261 | - if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_nonce' ) ) { |
|
261 | + if ( !filter_has_var( INPUT_POST, 'pronamic_pay_nonce' ) ) { |
|
262 | 262 | return $post_id; |
263 | 263 | } |
264 | 264 | |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | ); |
279 | 279 | |
280 | 280 | foreach ( $fields as $field ) { |
281 | - if ( isset( $field['meta_key'], $field['filter'] ) ) { |
|
282 | - $name = $field['meta_key']; |
|
283 | - $filter = $field['filter']; |
|
281 | + if ( isset( $field[ 'meta_key' ], $field[ 'filter' ] ) ) { |
|
282 | + $name = $field[ 'meta_key' ]; |
|
283 | + $filter = $field[ 'filter' ]; |
|
284 | 284 | |
285 | 285 | $definition[ $name ] = $filter; |
286 | 286 | } |
@@ -288,28 +288,28 @@ discard block |
||
288 | 288 | |
289 | 289 | $data = filter_input_array( INPUT_POST, $definition ); |
290 | 290 | |
291 | - if ( ! empty( $data['_pronamic_gateway_id'] ) ) { |
|
291 | + if ( !empty( $data[ '_pronamic_gateway_id' ] ) ) { |
|
292 | 292 | $integrations = $this->admin->plugin->gateway_integrations; |
293 | 293 | |
294 | - if ( isset( $integrations[ $data['_pronamic_gateway_id'] ] ) ) { |
|
295 | - $integration = $integrations[ $data['_pronamic_gateway_id'] ]; |
|
294 | + if ( isset( $integrations[ $data[ '_pronamic_gateway_id' ] ] ) ) { |
|
295 | + $integration = $integrations[ $data[ '_pronamic_gateway_id' ] ]; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | if ( $integration ) { |
299 | 299 | $settings = $integration->get_settings(); |
300 | 300 | |
301 | 301 | foreach ( $fields as $field ) { |
302 | - if ( isset( $field['default'], $field['meta_key'], $data[ $field['meta_key'] ] ) ) { |
|
302 | + if ( isset( $field[ 'default' ], $field[ 'meta_key' ], $data[ $field[ 'meta_key' ] ] ) ) { |
|
303 | 303 | // Remove default value if not applicable to the selected gateway. |
304 | - if ( isset( $field['methods'] ) ) { |
|
305 | - $clean_default = array_intersect( $settings, $field['methods'] ); |
|
304 | + if ( isset( $field[ 'methods' ] ) ) { |
|
305 | + $clean_default = array_intersect( $settings, $field[ 'methods' ] ); |
|
306 | 306 | |
307 | 307 | if ( empty( $clean_default ) ) { |
308 | - $meta_value = get_post_meta( $post_id, $field['meta_key'], true ); |
|
308 | + $meta_value = get_post_meta( $post_id, $field[ 'meta_key' ], true ); |
|
309 | 309 | |
310 | 310 | // Only remove value if not saved before. |
311 | 311 | if ( empty( $meta_value ) ) { |
312 | - $data[ $field['meta_key'] ] = null; |
|
312 | + $data[ $field[ 'meta_key' ] ] = null; |
|
313 | 313 | |
314 | 314 | continue; |
315 | 315 | } |
@@ -317,13 +317,13 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | // Set the default value if empty. |
320 | - if ( empty( $data[ $field['meta_key'] ] ) ) { |
|
321 | - $default = $field['default']; |
|
320 | + if ( empty( $data[ $field[ 'meta_key' ] ] ) ) { |
|
321 | + $default = $field[ 'default' ]; |
|
322 | 322 | |
323 | - if ( is_array( $default ) && 2 === count( $default ) && Util::class_method_exists( $default[0], $default[1] ) ) { |
|
324 | - $data[ $field['meta_key'] ] = call_user_func( $default, $field ); |
|
323 | + if ( is_array( $default ) && 2 === count( $default ) && Util::class_method_exists( $default[ 0 ], $default[ 1 ] ) ) { |
|
324 | + $data[ $field[ 'meta_key' ] ] = call_user_func( $default, $field ); |
|
325 | 325 | } else { |
326 | - $data[ $field['meta_key'] ] = $default; |
|
326 | + $data[ $field[ 'meta_key' ] ] = $default; |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | // Filter data through gateway integration settings. |
333 | 333 | $settings_classes = $integration->get_settings_class(); |
334 | 334 | |
335 | - if ( ! is_array( $settings_classes ) ) { |
|
335 | + if ( !is_array( $settings_classes ) ) { |
|
336 | 336 | $settings_classes = array( $settings_classes ); |
337 | 337 | } |
338 | 338 | |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | pronamic_pay_update_post_meta_data( $post_id, $data ); |
349 | 349 | |
350 | 350 | // Transient. |
351 | - delete_transient( 'pronamic_pay_issuers_' . $post_id ); |
|
352 | - delete_transient( 'pronamic_gateway_payment_methods_' . $post_id ); |
|
351 | + delete_transient( 'pronamic_pay_issuers_'.$post_id ); |
|
352 | + delete_transient( 'pronamic_gateway_payment_methods_'.$post_id ); |
|
353 | 353 | |
354 | 354 | PaymentMethods::update_active_payment_methods(); |
355 | 355 | } |
@@ -373,14 +373,14 @@ discard block |
||
373 | 373 | 0 => '', // Unused. Messages start at index 1. |
374 | 374 | 1 => __( 'Configuration updated.', 'pronamic_ideal' ), |
375 | 375 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352799&filters[translation_id]=37947229 |
376 | - 2 => $messages['post'][2], |
|
376 | + 2 => $messages[ 'post' ][ 2 ], |
|
377 | 377 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352800&filters[translation_id]=37947870 |
378 | - 3 => $messages['post'][3], |
|
378 | + 3 => $messages[ 'post' ][ 3 ], |
|
379 | 379 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352798&filters[translation_id]=37947230 |
380 | 380 | 4 => __( 'Configuration updated.', 'pronamic_ideal' ), |
381 | 381 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352801&filters[translation_id]=37947231 |
382 | 382 | // translators: %s: date and time of the revision. |
383 | - 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. |
|
383 | + 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. |
|
384 | 384 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352802&filters[translation_id]=37949178 |
385 | 385 | 6 => __( 'Configuration published.', 'pronamic_ideal' ), |
386 | 386 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352803&filters[translation_id]=37947232 |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352804&filters[translation_id]=37949303 |
389 | 389 | 8 => __( 'Configuration submitted.', 'pronamic_ideal' ), |
390 | 390 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352805&filters[translation_id]=37949302 |
391 | - 9 => sprintf( __( 'Configuration scheduled for: %s.', 'pronamic_ideal' ), '<strong>' . $scheduled_date . '</strong>' ), |
|
391 | + 9 => sprintf( __( 'Configuration scheduled for: %s.', 'pronamic_ideal' ), '<strong>'.$scheduled_date.'</strong>' ), |
|
392 | 392 | // @https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352806&filters[translation_id]=37949301 |
393 | 393 | 10 => __( 'Configuration draft updated.', 'pronamic_ideal' ), |
394 | 394 | ); |