@@ -25,28 +25,28 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @param Plugin $plugin Plugin. |
27 | 27 | */ |
28 | - public function __construct( Plugin $plugin ) { |
|
28 | + public function __construct(Plugin $plugin) { |
|
29 | 29 | $this->plugin = $plugin; |
30 | 30 | |
31 | - $this->install = new Install( $this ); |
|
31 | + $this->install = new Install($this); |
|
32 | 32 | |
33 | 33 | // Actions. |
34 | - add_action( 'admin_init', array( $this, 'admin_init' ) ); |
|
35 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
34 | + add_action('admin_init', array($this, 'admin_init')); |
|
35 | + add_action('admin_menu', array($this, 'admin_menu')); |
|
36 | 36 | |
37 | - add_action( 'load-post.php', array( $this, 'maybe_test_payment' ) ); |
|
37 | + add_action('load-post.php', array($this, 'maybe_test_payment')); |
|
38 | 38 | |
39 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
39 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
40 | 40 | |
41 | - add_filter( 'pronamic_pay_gateway_settings', array( $this, 'gateway_settings' ) ); |
|
41 | + add_filter('pronamic_pay_gateway_settings', array($this, 'gateway_settings')); |
|
42 | 42 | |
43 | 43 | // Modules. |
44 | - $this->settings = new AdminSettings( $plugin ); |
|
45 | - $this->about = new AdminAboutPage( $plugin, $this ); |
|
46 | - $this->dashboard = new AdminDashboard( $plugin ); |
|
47 | - $this->notices = new AdminNotices( $plugin ); |
|
48 | - $this->reports = new AdminReports( $plugin, $this ); |
|
49 | - $this->tour = new AdminTour( $plugin ); |
|
44 | + $this->settings = new AdminSettings($plugin); |
|
45 | + $this->about = new AdminAboutPage($plugin, $this); |
|
46 | + $this->dashboard = new AdminDashboard($plugin); |
|
47 | + $this->notices = new AdminNotices($plugin); |
|
48 | + $this->reports = new AdminReports($plugin, $this); |
|
49 | + $this->tour = new AdminTour($plugin); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | $this->maybe_redirect(); |
63 | 63 | |
64 | 64 | // Post types. |
65 | - new GatewayPostType( $this ); |
|
65 | + new GatewayPostType($this); |
|
66 | 66 | new PaymentPostType(); |
67 | 67 | new SubscriptionPostType(); |
68 | 68 | |
69 | 69 | // Gateway settings. |
70 | 70 | $this->gateway_settings = new GatewaySettings(); |
71 | 71 | |
72 | - if ( ! wp_next_scheduled( 'pronamic_pay_license_check' ) ) { |
|
73 | - wp_schedule_event( time(), 'daily', 'pronamic_pay_license_check' ); |
|
72 | + if ( ! wp_next_scheduled('pronamic_pay_license_check')) { |
|
73 | + wp_schedule_event(time(), 'daily', 'pronamic_pay_license_check'); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -81,33 +81,33 @@ discard block |
||
81 | 81 | * @see https://github.com/woothemes/woocommerce/blob/2.4.4/includes/admin/class-wc-admin.php#L96-L122 |
82 | 82 | */ |
83 | 83 | public function maybe_redirect() { |
84 | - $redirect = get_transient( 'pronamic_pay_admin_redirect' ); |
|
84 | + $redirect = get_transient('pronamic_pay_admin_redirect'); |
|
85 | 85 | |
86 | 86 | // Check. |
87 | 87 | if ( |
88 | 88 | false === $redirect |
89 | 89 | || |
90 | - defined( 'DOING_AJAX' ) && DOING_AJAX |
|
90 | + defined('DOING_AJAX') && DOING_AJAX |
|
91 | 91 | || |
92 | - defined( 'DOING_CRON' ) && DOING_CRON |
|
92 | + defined('DOING_CRON') && DOING_CRON |
|
93 | 93 | || |
94 | 94 | is_network_admin() |
95 | 95 | || |
96 | - filter_has_var( INPUT_GET, 'activate-multi' ) |
|
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 | } |
102 | 102 | |
103 | 103 | // Update. |
104 | - set_transient( 'pronamic_pay_admin_redirect', false ); |
|
104 | + set_transient('pronamic_pay_admin_redirect', false); |
|
105 | 105 | |
106 | 106 | // Delete. |
107 | - delete_transient( 'pronamic_pay_admin_redirect' ); |
|
107 | + delete_transient('pronamic_pay_admin_redirect'); |
|
108 | 108 | |
109 | 109 | // Redirect. |
110 | - wp_safe_redirect( $redirect ); |
|
110 | + wp_safe_redirect($redirect); |
|
111 | 111 | |
112 | 112 | exit; |
113 | 113 | } |
@@ -117,37 +117,37 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @param array $args Arguments. |
119 | 119 | */ |
120 | - public static function input_checkbox( $args ) { |
|
120 | + public static function input_checkbox($args) { |
|
121 | 121 | $defaults = array( |
122 | 122 | 'label_for' => '', |
123 | 123 | 'type' => 'text', |
124 | 124 | 'label' => '', |
125 | 125 | ); |
126 | 126 | |
127 | - $args = wp_parse_args( $args, $defaults ); |
|
127 | + $args = wp_parse_args($args, $defaults); |
|
128 | 128 | |
129 | 129 | $id = $args['label_for']; |
130 | - $value = get_option( $id ); |
|
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( |
138 | 138 | '<input name="%s" id="%s" type="%s" value="%s" %s />', |
139 | - esc_attr( $id ), |
|
140 | - esc_attr( $id ), |
|
141 | - esc_attr( 'checkbox' ), |
|
142 | - esc_attr( '1' ), |
|
143 | - checked( $value, true, false ) |
|
139 | + esc_attr($id), |
|
140 | + esc_attr($id), |
|
141 | + esc_attr('checkbox'), |
|
142 | + esc_attr('1'), |
|
143 | + checked($value, true, false) |
|
144 | 144 | ); |
145 | 145 | |
146 | 146 | $label = sprintf( |
147 | 147 | '<label for="%s">%s %s</label>', |
148 | - esc_attr( $id ), |
|
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. |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | * @param mixed $value Value. |
164 | 164 | * @return boolean |
165 | 165 | */ |
166 | - public static function sanitize_boolean( $value ) { |
|
167 | - return filter_var( $value, FILTER_VALIDATE_BOOLEAN ); |
|
166 | + public static function sanitize_boolean($value) { |
|
167 | + return filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param array $args Arguments. |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - public static function dropdown_configs( $args ) { |
|
176 | + public static function dropdown_configs($args) { |
|
177 | 177 | $defaults = array( |
178 | 178 | 'name' => 'pronamic_pay_config_id', |
179 | 179 | 'echo' => true, |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | 'payment_method' => null, |
182 | 182 | ); |
183 | 183 | |
184 | - $args = wp_parse_args( $args, $defaults ); |
|
184 | + $args = wp_parse_args($args, $defaults); |
|
185 | 185 | |
186 | 186 | // Output. |
187 | 187 | $output = ''; |
@@ -191,31 +191,31 @@ discard block |
||
191 | 191 | $name = $args['name']; |
192 | 192 | $selected = $args['selected']; |
193 | 193 | |
194 | - if ( false === $selected ) { |
|
195 | - $selected = get_option( $id ); |
|
194 | + if (false === $selected) { |
|
195 | + $selected = get_option($id); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | $output .= sprintf( |
199 | 199 | '<select id="%s" name="%s">', |
200 | - esc_attr( $id ), |
|
201 | - esc_attr( $name ) |
|
200 | + esc_attr($id), |
|
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 | - foreach ( $options as $value => $name ) { |
|
206 | + foreach ($options as $value => $name) { |
|
207 | 207 | $output .= sprintf( |
208 | 208 | '<option value="%s" %s>%s</option>', |
209 | - esc_attr( $value ), |
|
210 | - selected( $value, $selected, false ), |
|
211 | - esc_html( $name ) |
|
209 | + esc_attr($value), |
|
210 | + selected($value, $selected, false), |
|
211 | + esc_html($name) |
|
212 | 212 | ); |
213 | 213 | } |
214 | 214 | |
215 | - $output .= sprintf( '</select>' ); |
|
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; |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | * @param array $pages Page. |
229 | 229 | * @param string $parent Parent post ID. |
230 | 230 | */ |
231 | - private function create_pages( $pages, $parent = null ) { |
|
232 | - foreach ( $pages as $page ) { |
|
231 | + private function create_pages($pages, $parent = null) { |
|
232 | + foreach ($pages as $page) { |
|
233 | 233 | $post = array( |
234 | 234 | 'post_title' => $page['post_title'], |
235 | 235 | 'post_name' => $page['post_title'], |
@@ -239,25 +239,25 @@ discard block |
||
239 | 239 | 'comment_status' => 'closed', |
240 | 240 | ); |
241 | 241 | |
242 | - if ( isset( $parent ) ) { |
|
242 | + if (isset($parent)) { |
|
243 | 243 | $post['post_parent'] = $parent; |
244 | 244 | } |
245 | 245 | |
246 | - $result = wp_insert_post( $post, true ); |
|
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 ) { |
|
251 | - update_post_meta( $result, $key, $value ); |
|
248 | + if ( ! is_wp_error($result)) { |
|
249 | + if (isset($page['post_meta'])) { |
|
250 | + foreach ($page['post_meta'] as $key => $value) { |
|
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,63 +267,63 @@ 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 | |
278 | 278 | $pages = array( |
279 | 279 | array( |
280 | - 'post_title' => __( 'Payment Status', 'pronamic_ideal' ), |
|
281 | - 'post_name' => __( 'payment', 'pronamic_ideal' ), |
|
280 | + 'post_title' => __('Payment Status', 'pronamic_ideal'), |
|
281 | + 'post_name' => __('payment', 'pronamic_ideal'), |
|
282 | 282 | 'post_content' => '', |
283 | 283 | 'post_meta' => array( |
284 | 284 | '_yoast_wpseo_meta-robots-noindex' => true, |
285 | 285 | ), |
286 | 286 | 'children' => array( |
287 | 287 | 'completed' => array( |
288 | - 'post_title' => __( 'Payment completed', 'pronamic_ideal' ), |
|
289 | - 'post_name' => __( 'completed', 'pronamic_ideal' ), |
|
290 | - 'post_content' => __( '<p>The payment has been successfully completed.</p>', 'pronamic_ideal' ), |
|
288 | + 'post_title' => __('Payment completed', 'pronamic_ideal'), |
|
289 | + 'post_name' => __('completed', 'pronamic_ideal'), |
|
290 | + 'post_content' => __('<p>The payment has been successfully completed.</p>', 'pronamic_ideal'), |
|
291 | 291 | 'post_meta' => array( |
292 | 292 | '_yoast_wpseo_meta-robots-noindex' => true, |
293 | 293 | ), |
294 | 294 | 'option_name' => 'pronamic_pay_completed_page_id', |
295 | 295 | ), |
296 | 296 | 'cancel' => array( |
297 | - 'post_title' => __( 'Payment cancelled', 'pronamic_ideal' ), |
|
298 | - 'post_name' => __( 'cancelled', 'pronamic_ideal' ), |
|
299 | - 'post_content' => __( '<p>You have cancelled the payment.</p>', 'pronamic_ideal' ), |
|
297 | + 'post_title' => __('Payment cancelled', 'pronamic_ideal'), |
|
298 | + 'post_name' => __('cancelled', 'pronamic_ideal'), |
|
299 | + 'post_content' => __('<p>You have cancelled the payment.</p>', 'pronamic_ideal'), |
|
300 | 300 | 'post_meta' => array( |
301 | 301 | '_yoast_wpseo_meta-robots-noindex' => true, |
302 | 302 | ), |
303 | 303 | 'option_name' => 'pronamic_pay_cancel_page_id', |
304 | 304 | ), |
305 | 305 | 'expired' => array( |
306 | - 'post_title' => __( 'Payment expired', 'pronamic_ideal' ), |
|
307 | - 'post_name' => __( 'expired', 'pronamic_ideal' ), |
|
308 | - 'post_content' => __( '<p>Your payment session has expired.</p>', 'pronamic_ideal' ), |
|
306 | + 'post_title' => __('Payment expired', 'pronamic_ideal'), |
|
307 | + 'post_name' => __('expired', 'pronamic_ideal'), |
|
308 | + 'post_content' => __('<p>Your payment session has expired.</p>', 'pronamic_ideal'), |
|
309 | 309 | 'post_meta' => array( |
310 | 310 | '_yoast_wpseo_meta-robots-noindex' => true, |
311 | 311 | ), |
312 | 312 | 'option_name' => 'pronamic_pay_expired_page_id', |
313 | 313 | ), |
314 | 314 | 'error' => array( |
315 | - 'post_title' => __( 'Payment error', 'pronamic_ideal' ), |
|
316 | - 'post_name' => __( 'error', 'pronamic_ideal' ), |
|
317 | - 'post_content' => __( '<p>An error has occurred during payment.</p>', 'pronamic_ideal' ), |
|
315 | + 'post_title' => __('Payment error', 'pronamic_ideal'), |
|
316 | + 'post_name' => __('error', 'pronamic_ideal'), |
|
317 | + 'post_content' => __('<p>An error has occurred during payment.</p>', 'pronamic_ideal'), |
|
318 | 318 | 'post_meta' => array( |
319 | 319 | '_yoast_wpseo_meta-robots-noindex' => true, |
320 | 320 | ), |
321 | 321 | 'option_name' => 'pronamic_pay_error_page_id', |
322 | 322 | ), |
323 | 323 | 'unknown' => array( |
324 | - 'post_title' => __( 'Payment status unknown', 'pronamic_ideal' ), |
|
325 | - 'post_name' => __( 'unknown', 'pronamic_ideal' ), |
|
326 | - 'post_content' => __( '<p>The payment status is unknown.</p>', 'pronamic_ideal' ), |
|
324 | + 'post_title' => __('Payment status unknown', 'pronamic_ideal'), |
|
325 | + 'post_name' => __('unknown', 'pronamic_ideal'), |
|
326 | + 'post_content' => __('<p>The payment status is unknown.</p>', 'pronamic_ideal'), |
|
327 | 327 | 'post_meta' => array( |
328 | 328 | '_yoast_wpseo_meta-robots-noindex' => true, |
329 | 329 | ), |
@@ -333,16 +333,16 @@ discard block |
||
333 | 333 | ), |
334 | 334 | ); |
335 | 335 | |
336 | - $this->create_pages( $pages ); |
|
336 | + $this->create_pages($pages); |
|
337 | 337 | |
338 | 338 | $url = add_query_arg( |
339 | 339 | array( |
340 | 340 | 'page' => 'pronamic_pay_settings', |
341 | 341 | 'message' => 'pages-generated', |
342 | - ), admin_url( 'admin.php' ) |
|
342 | + ), admin_url('admin.php') |
|
343 | 343 | ); |
344 | 344 | |
345 | - wp_redirect( $url ); |
|
345 | + wp_redirect($url); |
|
346 | 346 | |
347 | 347 | exit; |
348 | 348 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @param string $hook Hook. |
354 | 354 | */ |
355 | - public function enqueue_scripts( $hook ) { |
|
355 | + public function enqueue_scripts($hook) { |
|
356 | 356 | $screen = get_current_screen(); |
357 | 357 | |
358 | 358 | $enqueue = false; |
@@ -366,17 +366,17 @@ discard block |
||
366 | 366 | ), true |
367 | 367 | ); |
368 | 368 | $enqueue |= 'dashboard' === $screen->id; |
369 | - $enqueue |= strpos( $hook, 'pronamic_pay' ) !== false; |
|
370 | - $enqueue |= strpos( $hook, 'pronamic_ideal' ) !== false; |
|
369 | + $enqueue |= strpos($hook, 'pronamic_pay') !== false; |
|
370 | + $enqueue |= strpos($hook, 'pronamic_ideal') !== false; |
|
371 | 371 | $enqueue |= 'toplevel_page_gf_edit_forms' === $screen->id; |
372 | 372 | |
373 | - if ( $enqueue ) { |
|
374 | - $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
373 | + if ($enqueue) { |
|
374 | + $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; |
|
375 | 375 | |
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', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
379 | + plugins_url('assets/tippy.js/tippy.all' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file), |
|
380 | 380 | array(), |
381 | 381 | '2.2.3', |
382 | 382 | true |
@@ -385,29 +385,29 @@ discard block |
||
385 | 385 | // Pronamic. |
386 | 386 | wp_register_style( |
387 | 387 | 'pronamic-pay-icons', |
388 | - plugins_url( 'fonts/pronamic-pay-icons.css', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
388 | + plugins_url('fonts/pronamic-pay-icons.css', \Pronamic\WordPress\Pay\Plugin::$file), |
|
389 | 389 | array(), |
390 | 390 | $this->plugin->get_version() |
391 | 391 | ); |
392 | 392 | |
393 | 393 | wp_register_style( |
394 | 394 | 'pronamic-pay-admin', |
395 | - plugins_url( 'css/admin' . $min . '.css', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
396 | - array( 'pronamic-pay-icons' ), |
|
395 | + plugins_url('css/admin' . $min . '.css', \Pronamic\WordPress\Pay\Plugin::$file), |
|
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', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
403 | - array( 'jquery', 'tippy.js' ), |
|
402 | + plugins_url('js/admin' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file), |
|
403 | + array('jquery', 'tippy.js'), |
|
404 | 404 | $this->plugin->get_version(), |
405 | 405 | true |
406 | 406 | ); |
407 | 407 | |
408 | 408 | // Enqueue. |
409 | - wp_enqueue_style( 'pronamic-pay-admin' ); |
|
410 | - wp_enqueue_script( 'pronamic-pay-admin' ); |
|
409 | + wp_enqueue_style('pronamic-pay-admin'); |
|
410 | + wp_enqueue_script('pronamic-pay-admin'); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | * Maybe test payment. |
416 | 416 | */ |
417 | 417 | public function maybe_test_payment() { |
418 | - if ( filter_has_var( INPUT_POST, 'test_pay_gateway' ) && check_admin_referer( 'test_pay_gateway', 'pronamic_pay_test_nonce' ) ) { |
|
419 | - $id = filter_input( INPUT_POST, 'post_ID', FILTER_SANITIZE_NUMBER_INT ); |
|
418 | + if (filter_has_var(INPUT_POST, 'test_pay_gateway') && check_admin_referer('test_pay_gateway', 'pronamic_pay_test_nonce')) { |
|
419 | + $id = filter_input(INPUT_POST, 'post_ID', FILTER_SANITIZE_NUMBER_INT); |
|
420 | 420 | |
421 | - $gateway = \Pronamic\WordPress\Pay\Plugin::get_gateway( $id ); |
|
421 | + $gateway = \Pronamic\WordPress\Pay\Plugin::get_gateway($id); |
|
422 | 422 | |
423 | - if ( $gateway ) { |
|
423 | + if ($gateway) { |
|
424 | 424 | $amount = filter_input( |
425 | 425 | INPUT_POST, 'test_amount', FILTER_VALIDATE_FLOAT, array( |
426 | 426 | 'flags' => FILTER_FLAG_ALLOW_THOUSAND, |
@@ -430,21 +430,21 @@ discard block |
||
430 | 430 | ) |
431 | 431 | ); |
432 | 432 | |
433 | - $data = new \Pronamic\WordPress\Pay\Payments\PaymentTestData( wp_get_current_user(), $amount ); |
|
433 | + $data = new \Pronamic\WordPress\Pay\Payments\PaymentTestData(wp_get_current_user(), $amount); |
|
434 | 434 | |
435 | - $payment_method = filter_input( INPUT_POST, 'pronamic_pay_test_payment_method', FILTER_SANITIZE_STRING ); |
|
435 | + $payment_method = filter_input(INPUT_POST, 'pronamic_pay_test_payment_method', FILTER_SANITIZE_STRING); |
|
436 | 436 | |
437 | - $payment = \Pronamic\WordPress\Pay\Plugin::start( $id, $gateway, $data, $payment_method ); |
|
437 | + $payment = \Pronamic\WordPress\Pay\Plugin::start($id, $gateway, $data, $payment_method); |
|
438 | 438 | |
439 | 439 | $error = $gateway->get_error(); |
440 | 440 | |
441 | - if ( is_wp_error( $error ) ) { |
|
442 | - \Pronamic\WordPress\Pay\Plugin::render_errors( $error ); |
|
441 | + if (is_wp_error($error)) { |
|
442 | + \Pronamic\WordPress\Pay\Plugin::render_errors($error); |
|
443 | 443 | |
444 | 444 | exit; |
445 | 445 | } |
446 | 446 | |
447 | - $gateway->redirect( $payment ); |
|
447 | + $gateway->redirect($payment); |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | } |
@@ -454,10 +454,10 @@ discard block |
||
454 | 454 | */ |
455 | 455 | public function admin_menu() { |
456 | 456 | // @see https://github.com/woothemes/woocommerce/blob/2.3.13/includes/admin/class-wc-admin-menus.php#L145 |
457 | - $counts = wp_count_posts( 'pronamic_payment' ); |
|
457 | + $counts = wp_count_posts('pronamic_payment'); |
|
458 | 458 | |
459 | 459 | $badge = ''; |
460 | - if ( isset( $counts, $counts->payment_pending ) && $counts->payment_pending > 0 ) { |
|
460 | + if (isset($counts, $counts->payment_pending) && $counts->payment_pending > 0) { |
|
461 | 461 | $badge = sprintf( |
462 | 462 | ' <span class="awaiting-mod update-plugins count-%s"><span class="processing-count">%s</span></span>', |
463 | 463 | $counts->payment_pending, |
@@ -466,70 +466,70 @@ discard block |
||
466 | 466 | } |
467 | 467 | |
468 | 468 | add_menu_page( |
469 | - __( 'Pronamic Pay', 'pronamic_ideal' ), |
|
470 | - __( 'Pay', 'pronamic_ideal' ) . $badge, |
|
469 | + __('Pronamic Pay', 'pronamic_ideal'), |
|
470 | + __('Pay', 'pronamic_ideal') . $badge, |
|
471 | 471 | 'edit_payments', |
472 | 472 | 'pronamic_ideal', |
473 | - array( $this, 'page_dashboard' ), |
|
473 | + array($this, 'page_dashboard'), |
|
474 | 474 | 'dashicons-money' |
475 | 475 | ); |
476 | 476 | |
477 | 477 | add_submenu_page( |
478 | 478 | 'pronamic_ideal', |
479 | - __( 'Payments', 'pronamic_ideal' ), |
|
480 | - __( 'Payments', 'pronamic_ideal' ) . $badge, |
|
479 | + __('Payments', 'pronamic_ideal'), |
|
480 | + __('Payments', 'pronamic_ideal') . $badge, |
|
481 | 481 | 'edit_payments', |
482 | 482 | 'edit.php?post_type=pronamic_payment' |
483 | 483 | ); |
484 | 484 | |
485 | 485 | add_submenu_page( |
486 | 486 | 'pronamic_ideal', |
487 | - __( 'Subscriptions', 'pronamic_ideal' ), |
|
488 | - __( 'Subscriptions', 'pronamic_ideal' ), |
|
487 | + __('Subscriptions', 'pronamic_ideal'), |
|
488 | + __('Subscriptions', 'pronamic_ideal'), |
|
489 | 489 | 'edit_payments', |
490 | 490 | 'edit.php?post_type=pronamic_pay_subscr' |
491 | 491 | ); |
492 | 492 | |
493 | - do_action( 'pronamic_pay_admin_menu' ); |
|
493 | + do_action('pronamic_pay_admin_menu'); |
|
494 | 494 | |
495 | 495 | add_submenu_page( |
496 | 496 | 'pronamic_ideal', |
497 | - __( 'Payment Forms', 'pronamic_ideal' ), |
|
498 | - __( 'Forms', 'pronamic_ideal' ), |
|
497 | + __('Payment Forms', 'pronamic_ideal'), |
|
498 | + __('Forms', 'pronamic_ideal'), |
|
499 | 499 | 'edit_forms', |
500 | 500 | 'edit.php?post_type=pronamic_pay_form' |
501 | 501 | ); |
502 | 502 | |
503 | 503 | add_submenu_page( |
504 | 504 | 'pronamic_ideal', |
505 | - __( 'Configurations', 'pronamic_ideal' ), |
|
506 | - __( 'Configurations', 'pronamic_ideal' ), |
|
505 | + __('Configurations', 'pronamic_ideal'), |
|
506 | + __('Configurations', 'pronamic_ideal'), |
|
507 | 507 | 'manage_options', |
508 | 508 | 'edit.php?post_type=pronamic_gateway' |
509 | 509 | ); |
510 | 510 | |
511 | 511 | add_submenu_page( |
512 | 512 | 'pronamic_ideal', |
513 | - __( 'Settings', 'pronamic_ideal' ), |
|
514 | - __( 'Settings', 'pronamic_ideal' ), |
|
513 | + __('Settings', 'pronamic_ideal'), |
|
514 | + __('Settings', 'pronamic_ideal'), |
|
515 | 515 | 'manage_options', |
516 | 516 | 'pronamic_pay_settings', |
517 | - array( $this, 'page_settings' ) |
|
517 | + array($this, 'page_settings') |
|
518 | 518 | ); |
519 | 519 | |
520 | 520 | add_submenu_page( |
521 | 521 | 'pronamic_ideal', |
522 | - __( 'Tools', 'pronamic_ideal' ), |
|
523 | - __( 'Tools', 'pronamic_ideal' ), |
|
522 | + __('Tools', 'pronamic_ideal'), |
|
523 | + __('Tools', 'pronamic_ideal'), |
|
524 | 524 | 'manage_options', |
525 | 525 | 'pronamic_pay_tools', |
526 | - array( $this, 'page_tools' ) |
|
526 | + array($this, 'page_tools') |
|
527 | 527 | ); |
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 | |
@@ -537,21 +537,21 @@ discard block |
||
537 | 537 | * Page dashboard. |
538 | 538 | */ |
539 | 539 | public function page_dashboard() { |
540 | - return $this->render_page( 'dashboard' ); |
|
540 | + return $this->render_page('dashboard'); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
544 | 544 | * Page settings. |
545 | 545 | */ |
546 | 546 | public function page_settings() { |
547 | - return $this->render_page( 'settings' ); |
|
547 | + return $this->render_page('settings'); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | /** |
551 | 551 | * Page tools. |
552 | 552 | */ |
553 | 553 | public function page_tools() { |
554 | - return $this->render_page( 'tools' ); |
|
554 | + return $this->render_page('tools'); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | /** |
@@ -560,12 +560,12 @@ discard block |
||
560 | 560 | * @param string $name Page identifier. |
561 | 561 | * @return boolean True if a page is rendered, false otherwise. |
562 | 562 | */ |
563 | - public function render_page( $name ) { |
|
563 | + public function render_page($name) { |
|
564 | 564 | $result = false; |
565 | 565 | |
566 | - $file = plugin_dir_path( \Pronamic\WordPress\Pay\Plugin::$file ) . 'admin/page-' . $name . '.php'; |
|
566 | + $file = plugin_dir_path(\Pronamic\WordPress\Pay\Plugin::$file) . 'admin/page-' . $name . '.php'; |
|
567 | 567 | |
568 | - if ( is_readable( $file ) ) { |
|
568 | + if (is_readable($file)) { |
|
569 | 569 | include $file; |
570 | 570 | |
571 | 571 | $result = true; |
@@ -579,20 +579,20 @@ discard block |
||
579 | 579 | * |
580 | 580 | * @param array $classes Classes. |
581 | 581 | */ |
582 | - public function gateway_settings( $classes ) { |
|
583 | - foreach ( $this->plugin->gateway_integrations as $integration ) { |
|
582 | + public function gateway_settings($classes) { |
|
583 | + foreach ($this->plugin->gateway_integrations as $integration) { |
|
584 | 584 | $class = $integration->get_settings_class(); |
585 | 585 | |
586 | - if ( null === $class ) { |
|
586 | + if (null === $class) { |
|
587 | 587 | continue; |
588 | 588 | } |
589 | 589 | |
590 | - if ( is_array( $class ) ) { |
|
591 | - foreach ( $class as $c ) { |
|
592 | - $classes[ $c ] = $c; |
|
590 | + if (is_array($class)) { |
|
591 | + foreach ($class as $c) { |
|
592 | + $classes[$c] = $c; |
|
593 | 593 | } |
594 | 594 | } else { |
595 | - $classes[ $class ] = $class; |
|
595 | + $classes[$class] = $class; |
|
596 | 596 | } |
597 | 597 | } |
598 | 598 | |
@@ -605,8 +605,8 @@ discard block |
||
605 | 605 | * @param string $post_status Post status. |
606 | 606 | * @return string |
607 | 607 | */ |
608 | - public static function get_post_status_icon_class( $post_status ) { |
|
609 | - switch ( $post_status ) { |
|
608 | + public static function get_post_status_icon_class($post_status) { |
|
609 | + switch ($post_status) { |
|
610 | 610 | case 'payment_pending': |
611 | 611 | case 'subscr_pending': |
612 | 612 | return 'pronamic-pay-icon-pending'; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * Constructs and initializes an admin payment bulk actions object. |
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | - add_action( 'load-edit.php', array( $this, 'load' ) ); |
|
26 | + add_action('load-edit.php', array($this, 'load')); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -31,24 +31,24 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function load() { |
33 | 33 | // Current user. |
34 | - if ( ! current_user_can( 'edit_payments' ) ) { |
|
34 | + if ( ! current_user_can('edit_payments')) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | // Screen. |
39 | 39 | $screen = get_current_screen(); |
40 | 40 | |
41 | - if ( 'edit-pronamic_payment' !== $screen->id ) { |
|
41 | + if ('edit-pronamic_payment' !== $screen->id) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Bulk actions. |
46 | - add_filter( 'bulk_actions-' . $screen->id, array( $this, 'bulk_actions' ) ); |
|
46 | + add_filter('bulk_actions-' . $screen->id, array($this, 'bulk_actions')); |
|
47 | 47 | |
48 | - add_filter( 'handle_bulk_actions-' . $screen->id, array( $this, 'handle_bulk_action' ), 10, 3 ); |
|
48 | + add_filter('handle_bulk_actions-' . $screen->id, array($this, 'handle_bulk_action'), 10, 3); |
|
49 | 49 | |
50 | 50 | // Admin notices. |
51 | - add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
|
51 | + add_action('admin_notices', array($this, 'admin_notices')); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | * @param array $bulk_actions Bulk actions. |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public function bulk_actions( $bulk_actions ) { |
|
62 | + public function bulk_actions($bulk_actions) { |
|
63 | 63 | // Don't allow edit in bulk. |
64 | - unset( $bulk_actions['edit'] ); |
|
64 | + unset($bulk_actions['edit']); |
|
65 | 65 | |
66 | 66 | // Bulk check payment status. |
67 | - $bulk_actions['pronamic_payment_check_status'] = __( 'Check Payment Status', 'pronamic_ideal' ); |
|
67 | + $bulk_actions['pronamic_payment_check_status'] = __('Check Payment Status', 'pronamic_ideal'); |
|
68 | 68 | |
69 | 69 | return $bulk_actions; |
70 | 70 | } |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * @param array $post_ids Post ID's to bulk edit. |
80 | 80 | * @return string |
81 | 81 | */ |
82 | - public function handle_bulk_action( $sendback, $doaction, $post_ids ) { |
|
83 | - if ( 'pronamic_payment_check_status' !== $doaction ) { |
|
82 | + public function handle_bulk_action($sendback, $doaction, $post_ids) { |
|
83 | + if ('pronamic_payment_check_status' !== $doaction) { |
|
84 | 84 | return $sendback; |
85 | 85 | } |
86 | 86 | |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | $unsupported_gateways = array(); |
90 | 90 | $gateways = array(); |
91 | 91 | |
92 | - foreach ( $post_ids as $post_id ) { |
|
93 | - $payment = get_pronamic_payment( $post_id ); |
|
92 | + foreach ($post_ids as $post_id) { |
|
93 | + $payment = get_pronamic_payment($post_id); |
|
94 | 94 | |
95 | 95 | // Only check status for pending payments. |
96 | - if ( \Pronamic\WordPress\Pay\Core\Statuses::OPEN !== $payment->status && '' !== $payment->status ) { |
|
96 | + if (\Pronamic\WordPress\Pay\Core\Statuses::OPEN !== $payment->status && '' !== $payment->status) { |
|
97 | 97 | $skipped_check++; |
98 | 98 | |
99 | 99 | continue; |
@@ -102,19 +102,19 @@ discard block |
||
102 | 102 | // Make sure gateway supports `payment_status_request` feature. |
103 | 103 | $config_id = $payment->config_id; |
104 | 104 | |
105 | - if ( ! isset( $gateways[ $config_id ] ) ) { |
|
106 | - $gateways[ $config_id ] = \Pronamic\WordPress\Pay\Plugin::get_gateway( $config_id ); |
|
105 | + if ( ! isset($gateways[$config_id])) { |
|
106 | + $gateways[$config_id] = \Pronamic\WordPress\Pay\Plugin::get_gateway($config_id); |
|
107 | 107 | |
108 | - if ( $gateways[ $config_id ] && ! $gateways[ $config_id ]->supports( 'payment_status_request' ) ) { |
|
108 | + if ($gateways[$config_id] && ! $gateways[$config_id]->supports('payment_status_request')) { |
|
109 | 109 | $unsupported_gateways[] = $config_id; |
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
113 | - if ( in_array( $config_id, $unsupported_gateways, true ) ) { |
|
113 | + if (in_array($config_id, $unsupported_gateways, true)) { |
|
114 | 114 | continue; |
115 | 115 | } |
116 | 116 | |
117 | - \Pronamic\WordPress\Pay\Plugin::update_payment( $payment, false ); |
|
117 | + \Pronamic\WordPress\Pay\Plugin::update_payment($payment, false); |
|
118 | 118 | |
119 | 119 | $status_updated++; |
120 | 120 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | array( |
124 | 124 | 'status_updated' => $status_updated, |
125 | 125 | 'skipped_check' => $skipped_check, |
126 | - 'unsupported_gateways' => implode( ',', $unsupported_gateways ), |
|
126 | + 'unsupported_gateways' => implode(',', $unsupported_gateways), |
|
127 | 127 | ), $sendback |
128 | 128 | ); |
129 | 129 | |
@@ -134,50 +134,50 @@ discard block |
||
134 | 134 | * Admin notices. |
135 | 135 | */ |
136 | 136 | public function admin_notices() { |
137 | - if ( filter_has_var( INPUT_GET, 'status_updated' ) ) { |
|
138 | - $updated = filter_input( INPUT_GET, 'status_updated', FILTER_VALIDATE_INT ); |
|
137 | + if (filter_has_var(INPUT_GET, 'status_updated')) { |
|
138 | + $updated = filter_input(INPUT_GET, 'status_updated', FILTER_VALIDATE_INT); |
|
139 | 139 | |
140 | - if ( $updated > 0 ) { |
|
141 | - $message = sprintf( _n( '%s payment updated.', '%s payments updated.', $updated, 'pronamic_ideal' ), number_format_i18n( $updated ) ); |
|
140 | + if ($updated > 0) { |
|
141 | + $message = sprintf(_n('%s payment updated.', '%s payments updated.', $updated, 'pronamic_ideal'), number_format_i18n($updated)); |
|
142 | 142 | |
143 | 143 | printf( |
144 | 144 | '<div class="notice notice-success"><p>%s</p></div>', |
145 | - esc_html( $message ) |
|
145 | + esc_html($message) |
|
146 | 146 | ); |
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | - if ( filter_has_var( INPUT_GET, 'skipped_check' ) ) { |
|
151 | - $updated = filter_input( INPUT_GET, 'skipped_check', FILTER_VALIDATE_INT ); |
|
150 | + if (filter_has_var(INPUT_GET, 'skipped_check')) { |
|
151 | + $updated = filter_input(INPUT_GET, 'skipped_check', FILTER_VALIDATE_INT); |
|
152 | 152 | |
153 | - if ( $updated > 0 ) { |
|
153 | + if ($updated > 0) { |
|
154 | 154 | $message = sprintf( |
155 | - _n( '%s payment is not updated because it already has a final payment status.', '%s payments are not updated because they already have a final payment status.', $updated, 'pronamic_ideal' ), |
|
156 | - number_format_i18n( $updated ) |
|
155 | + _n('%s payment is not updated because it already has a final payment status.', '%s payments are not updated because they already have a final payment status.', $updated, 'pronamic_ideal'), |
|
156 | + number_format_i18n($updated) |
|
157 | 157 | ); |
158 | 158 | |
159 | 159 | printf( |
160 | 160 | '<div class="notice notice-warning"><p>%s</p></div>', |
161 | - esc_html( $message ) |
|
161 | + esc_html($message) |
|
162 | 162 | ); |
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | - if ( filter_has_var( INPUT_GET, 'unsupported_gateways' ) ) { |
|
167 | - $unsupported = filter_input( INPUT_GET, 'unsupported_gateways', FILTER_SANITIZE_STRING ); |
|
166 | + if (filter_has_var(INPUT_GET, 'unsupported_gateways')) { |
|
167 | + $unsupported = filter_input(INPUT_GET, 'unsupported_gateways', FILTER_SANITIZE_STRING); |
|
168 | 168 | |
169 | - if ( '' !== $unsupported ) { |
|
170 | - $gateways = explode( ',', $unsupported ); |
|
169 | + if ('' !== $unsupported) { |
|
170 | + $gateways = explode(',', $unsupported); |
|
171 | 171 | |
172 | - foreach ( $gateways as $index => $config_id ) { |
|
173 | - $gateways[ $index ] = get_the_title( $config_id ); |
|
172 | + foreach ($gateways as $index => $config_id) { |
|
173 | + $gateways[$index] = get_the_title($config_id); |
|
174 | 174 | } |
175 | 175 | |
176 | - $message = sprintf( __( 'Requesting the current payment status is unsupported by %s.', 'pronamic_ideal' ), implode( ', ', $gateways ) ); |
|
176 | + $message = sprintf(__('Requesting the current payment status is unsupported by %s.', 'pronamic_ideal'), implode(', ', $gateways)); |
|
177 | 177 | |
178 | 178 | printf( |
179 | 179 | '<div class="notice notice-error"><p>%s</p></div>', |
180 | - esc_html( $message ) |
|
180 | + esc_html($message) |
|
181 | 181 | ); |
182 | 182 | } |
183 | 183 | } |
@@ -44,31 +44,31 @@ discard block |
||
44 | 44 | * @param Plugin $plugin Plugin. |
45 | 45 | * @param AdminModule $admin Admin. |
46 | 46 | */ |
47 | - public function __construct( Plugin $plugin, AdminModule $admin ) { |
|
47 | + public function __construct(Plugin $plugin, AdminModule $admin) { |
|
48 | 48 | $this->plugin = $plugin; |
49 | 49 | $this->admin = $admin; |
50 | 50 | |
51 | 51 | // Actions. |
52 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
53 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
52 | + add_action('admin_menu', array($this, 'admin_menu')); |
|
53 | + add_action('admin_head', array($this, 'admin_head')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Add admin menus/screens. |
58 | 58 | */ |
59 | 59 | public function admin_menu() { |
60 | - $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING ); |
|
60 | + $page = filter_input(INPUT_GET, 'page', FILTER_SANITIZE_STRING); |
|
61 | 61 | |
62 | - if ( 'pronamic-pay-about' === $page ) { |
|
62 | + if ('pronamic-pay-about' === $page) { |
|
63 | 63 | $hook_suffix = add_dashboard_page( |
64 | - __( 'About Pronamic Pay', 'pronamic_ideal' ), |
|
65 | - __( 'Welcome to Pronamic Pay', 'pronamic_ideal' ), |
|
64 | + __('About Pronamic Pay', 'pronamic_ideal'), |
|
65 | + __('Welcome to Pronamic Pay', 'pronamic_ideal'), |
|
66 | 66 | 'manage_options', |
67 | 67 | $page, |
68 | - array( $this, 'page_about' ) |
|
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 | |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | * Admin head. |
77 | 77 | */ |
78 | 78 | public function admin_head() { |
79 | - remove_submenu_page( 'index.php', 'pronamic-pay-about' ); |
|
79 | + remove_submenu_page('index.php', 'pronamic-pay-about'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Admin CSS. |
84 | 84 | */ |
85 | 85 | public function admin_css() { |
86 | - $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
86 | + $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; |
|
87 | 87 | |
88 | 88 | wp_enqueue_style( |
89 | 89 | 'proanmic-pay-admin-about', |
90 | - plugins_url( 'css/admin-about' . $min . '.css', Plugin::$file ), |
|
90 | + plugins_url('css/admin-about' . $min . '.css', Plugin::$file), |
|
91 | 91 | array(), |
92 | 92 | $this->plugin->get_version() |
93 | 93 | ); |
@@ -97,6 +97,6 @@ discard block |
||
97 | 97 | * Page about. |
98 | 98 | */ |
99 | 99 | public function page_about() { |
100 | - $this->admin->render_page( 'about' ); |
|
100 | + $this->admin->render_page('about'); |
|
101 | 101 | } |
102 | 102 | } |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | $this->settings = array(); |
33 | 33 | |
34 | 34 | // Classes. |
35 | - $classes = apply_filters( 'pronamic_pay_gateway_settings', array() ); |
|
35 | + $classes = apply_filters('pronamic_pay_gateway_settings', array()); |
|
36 | 36 | |
37 | - foreach ( $classes as $class ) { |
|
37 | + foreach ($classes as $class) { |
|
38 | 38 | $this->settings[] = new $class(); |
39 | 39 | } |
40 | 40 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'general' => array(), |
51 | 51 | ); |
52 | 52 | |
53 | - return apply_filters( 'pronamic_pay_gateway_sections', $sections ); |
|
53 | + return apply_filters('pronamic_pay_gateway_sections', $sections); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -67,19 +67,19 @@ discard block |
||
67 | 67 | 'meta_key' => '_pronamic_gateway_mode', |
68 | 68 | 'name' => 'mode', |
69 | 69 | 'id' => 'pronamic_ideal_mode', |
70 | - 'title' => __( 'Mode', 'pronamic_ideal' ), |
|
70 | + 'title' => __('Mode', 'pronamic_ideal'), |
|
71 | 71 | 'type' => 'select', |
72 | 72 | 'options' => array( |
73 | 73 | array( |
74 | 74 | 'options' => array( |
75 | - 'test' => __( 'Test', 'pronamic_ideal' ), |
|
76 | - 'live' => __( 'Live', 'pronamic_ideal' ), |
|
75 | + 'test' => __('Test', 'pronamic_ideal'), |
|
76 | + 'live' => __('Live', 'pronamic_ideal'), |
|
77 | 77 | ), |
78 | 78 | ), |
79 | 79 | ), |
80 | 80 | ), |
81 | 81 | ); |
82 | 82 | |
83 | - return apply_filters( 'pronamic_pay_gateway_fields', $fields ); |
|
83 | + return apply_filters('pronamic_pay_gateway_fields', $fields); |
|
84 | 84 | } |
85 | 85 | } |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param Plugin $plugin Plugin. |
29 | 29 | */ |
30 | - public function __construct( Plugin $plugin ) { |
|
30 | + public function __construct(Plugin $plugin) { |
|
31 | 31 | $this->plugin = $plugin; |
32 | 32 | |
33 | 33 | // Actions. |
34 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 11 ); |
|
34 | + add_action('admin_notices', array($this, 'admin_notices'), 11); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -43,31 +43,31 @@ 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 | |
50 | 50 | // Jetpack. |
51 | - if ( 'jetpack' === $screen->parent_base ) { |
|
51 | + if ('jetpack' === $screen->parent_base) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | 55 | // License notice. |
56 | - if ( 'valid' !== get_option( 'pronamic_pay_license_status' ) ) { |
|
56 | + if ('valid' !== get_option('pronamic_pay_license_status')) { |
|
57 | 57 | $class = \Pronamic\WordPress\Pay\Plugin::get_number_payments() > 20 ? 'error' : 'updated'; |
58 | 58 | |
59 | - $license = get_option( 'pronamic_pay_license_key' ); |
|
59 | + $license = get_option('pronamic_pay_license_key'); |
|
60 | 60 | |
61 | - if ( '' === $license ) { |
|
61 | + if ('' === $license) { |
|
62 | 62 | $notice = sprintf( |
63 | - __( '<strong>Pronamic Pay</strong> — You have not entered a valid <a href="%1$s">support license key</a>, please <a href="%2$s" target="_blank">get your key at pronamic.eu</a>.', 'pronamic_ideal' ), |
|
64 | - add_query_arg( 'page', 'pronamic_pay_settings', get_admin_url( null, 'admin.php' ) ), |
|
63 | + __('<strong>Pronamic Pay</strong> — You have not entered a valid <a href="%1$s">support license key</a>, please <a href="%2$s" target="_blank">get your key at pronamic.eu</a>.', 'pronamic_ideal'), |
|
64 | + add_query_arg('page', 'pronamic_pay_settings', get_admin_url(null, 'admin.php')), |
|
65 | 65 | 'https://www.pronamic.eu/plugins/pronamic-ideal/' |
66 | 66 | ); |
67 | 67 | } else { |
68 | 68 | $notice = sprintf( |
69 | - __( '<strong>Pronamic Pay</strong> — You have not entered a valid <a href="%1$s">support license key</a>. Please <a href="%2$s" target="_blank">get your key at pronamic.eu</a> or login to <a href="%3$s" target="_blank">check your license status</a>.', 'pronamic_ideal' ), |
|
70 | - add_query_arg( 'page', 'pronamic_pay_settings', get_admin_url( null, 'admin.php' ) ), |
|
69 | + __('<strong>Pronamic Pay</strong> — You have not entered a valid <a href="%1$s">support license key</a>. Please <a href="%2$s" target="_blank">get your key at pronamic.eu</a> or login to <a href="%3$s" target="_blank">check your license status</a>.', 'pronamic_ideal'), |
|
70 | + add_query_arg('page', 'pronamic_pay_settings', get_admin_url(null, 'admin.php')), |
|
71 | 71 | 'https://www.pronamic.eu/plugins/pronamic-ideal/', |
72 | 72 | 'https://www.pronamic.eu/account/' |
73 | 73 | ); |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | |
76 | 76 | printf( // WPCS: XSS ok. |
77 | 77 | '<div class="%s"><p>%s</p></div>', |
78 | - esc_attr( $class ), |
|
78 | + esc_attr($class), |
|
79 | 79 | $notice |
80 | 80 | ); |
81 | 81 | } |
82 | 82 | |
83 | 83 | // Stored notices. |
84 | - $notices = get_option( 'pronamic_pay_admin_notices', array() ); |
|
84 | + $notices = get_option('pronamic_pay_admin_notices', array()); |
|
85 | 85 | |
86 | - foreach ( $notices as $name ) { |
|
87 | - $file = plugin_dir_path( \Pronamic\WordPress\Pay\Plugin::$file ) . 'admin/notice-' . $name . '.php'; |
|
86 | + foreach ($notices as $name) { |
|
87 | + $file = plugin_dir_path(\Pronamic\WordPress\Pay\Plugin::$file) . 'admin/notice-' . $name . '.php'; |
|
88 | 88 | |
89 | - if ( is_readable( $file ) ) { |
|
89 | + if (is_readable($file)) { |
|
90 | 90 | include $file; |
91 | 91 | } |
92 | 92 | } |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @param string $name Name. |
99 | 99 | */ |
100 | - public function add_notice( $name ) { |
|
101 | - $notices = array_unique( array_merge( get_option( 'pronamic_pay_admin_notices', array() ), array( $name ) ) ); |
|
100 | + public function add_notice($name) { |
|
101 | + $notices = array_unique(array_merge(get_option('pronamic_pay_admin_notices', array()), array($name))); |
|
102 | 102 | |
103 | - update_option( 'pronamic_pay_admin_notices', $notices ); |
|
103 | + update_option('pronamic_pay_admin_notices', $notices); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @param string $name Name. |
110 | 110 | */ |
111 | - public static function remove_notice( $name ) { |
|
112 | - $notices = array_diff( get_option( 'pronamic_pay_admin_notices', array() ), array( $name ) ); |
|
111 | + public static function remove_notice($name) { |
|
112 | + $notices = array_diff(get_option('pronamic_pay_admin_notices', array()), array($name)); |
|
113 | 113 | |
114 | - update_option( 'pronamic_pay_admin_notices', $notices ); |
|
114 | + update_option('pronamic_pay_admin_notices', $notices); |
|
115 | 115 | } |
116 | 116 | } |
@@ -36,22 +36,22 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @param Plugin $plugin Plugin. |
38 | 38 | */ |
39 | - public function __construct( Plugin $plugin ) { |
|
39 | + public function __construct(Plugin $plugin) { |
|
40 | 40 | $this->plugin = $plugin; |
41 | 41 | |
42 | 42 | // Actions. |
43 | - add_action( 'wp_dashboard_setup', array( $this, 'setup' ) ); |
|
43 | + add_action('wp_dashboard_setup', array($this, 'setup')); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Setup. |
48 | 48 | */ |
49 | 49 | public function setup() { |
50 | - if ( current_user_can( 'manage_options' ) ) { |
|
50 | + if (current_user_can('manage_options')) { |
|
51 | 51 | wp_add_dashboard_widget( |
52 | 52 | 'pronamic_pay_dashboard_status', |
53 | - __( 'Pronamic Pay Status', 'pronamic_ideal' ), |
|
54 | - array( $this, 'status_widget' ) |
|
53 | + __('Pronamic Pay Status', 'pronamic_ideal'), |
|
54 | + array($this, 'status_widget') |
|
55 | 55 | ); |
56 | 56 | } |
57 | 57 | } |
@@ -60,20 +60,20 @@ discard block |
||
60 | 60 | * Status widget. |
61 | 61 | */ |
62 | 62 | public function status_widget() { |
63 | - $counts = wp_count_posts( 'pronamic_payment' ); |
|
63 | + $counts = wp_count_posts('pronamic_payment'); |
|
64 | 64 | |
65 | 65 | $states = array( |
66 | - 'payment_completed' => __( '%s completed', 'pronamic_ideal' ), |
|
67 | - 'payment_pending' => __( '%s pending', 'pronamic_ideal' ), |
|
68 | - 'payment_cancelled' => __( '%s cancelled', 'pronamic_ideal' ), |
|
69 | - 'payment_failed' => __( '%s failed', 'pronamic_ideal' ), |
|
70 | - 'payment_expired' => __( '%s expired', 'pronamic_ideal' ), |
|
66 | + 'payment_completed' => __('%s completed', 'pronamic_ideal'), |
|
67 | + 'payment_pending' => __('%s pending', 'pronamic_ideal'), |
|
68 | + 'payment_cancelled' => __('%s cancelled', 'pronamic_ideal'), |
|
69 | + 'payment_failed' => __('%s failed', 'pronamic_ideal'), |
|
70 | + 'payment_expired' => __('%s expired', 'pronamic_ideal'), |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | $url = add_query_arg( |
74 | 74 | array( |
75 | 75 | 'post_type' => 'pronamic_payment', |
76 | - ), admin_url( 'edit.php' ) |
|
76 | + ), admin_url('edit.php') |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/widget-payments-status-list.php'; |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param Plugin $plugin Plugin. |
34 | 34 | */ |
35 | - public function __construct( Plugin $plugin ) { |
|
35 | + public function __construct(Plugin $plugin) { |
|
36 | 36 | $this->plugin = $plugin; |
37 | 37 | |
38 | 38 | // Actions. |
39 | - add_action( 'admin_init', array( $this, 'admin_init' ) ); |
|
39 | + add_action('admin_init', array($this, 'admin_init')); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | // Settings - General. |
47 | 47 | add_settings_section( |
48 | 48 | 'pronamic_pay_general', |
49 | - __( 'General', 'pronamic_ideal' ), |
|
50 | - array( $this, 'settings_section' ), |
|
49 | + __('General', 'pronamic_ideal'), |
|
50 | + array($this, 'settings_section'), |
|
51 | 51 | 'pronamic_pay' |
52 | 52 | ); |
53 | 53 | |
54 | 54 | add_settings_field( |
55 | 55 | 'pronamic_pay_license_key', |
56 | - __( 'Support License Key', 'pronamic_ideal' ), |
|
57 | - array( $this, 'input_license_key' ), |
|
56 | + __('Support License Key', 'pronamic_ideal'), |
|
57 | + array($this, 'input_license_key'), |
|
58 | 58 | 'pronamic_pay', |
59 | 59 | 'pronamic_pay_general', |
60 | 60 | array( |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | // Default Config. |
67 | 67 | add_settings_field( |
68 | 68 | 'pronamic_pay_config_id', |
69 | - __( 'Default Gateway', 'pronamic_ideal' ), |
|
70 | - array( $this, 'input_page' ), |
|
69 | + __('Default Gateway', 'pronamic_ideal'), |
|
70 | + array($this, 'input_page'), |
|
71 | 71 | 'pronamic_pay', |
72 | 72 | 'pronamic_pay_general', |
73 | 73 | array( |
74 | 74 | 'post_type' => 'pronamic_gateway', |
75 | - 'show_option_none' => __( '— Select a gateway —', 'pronamic_ideal' ), |
|
75 | + 'show_option_none' => __('— Select a gateway —', 'pronamic_ideal'), |
|
76 | 76 | 'label_for' => 'pronamic_pay_config_id', |
77 | 77 | ) |
78 | 78 | ); |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | // Google Analytics property UA code. |
81 | 81 | add_settings_field( |
82 | 82 | 'pronamic_pay_google_analytics_property', |
83 | - __( 'Google Analytics Property ID', 'pronamic_ideal' ), |
|
84 | - array( $this, 'input_element' ), |
|
83 | + __('Google Analytics Property ID', 'pronamic_ideal'), |
|
84 | + array($this, 'input_element'), |
|
85 | 85 | 'pronamic_pay', |
86 | 86 | 'pronamic_pay_general', |
87 | 87 | array( |
88 | - 'description' => __( 'Set a Google Analytics Property UA code to track ecommerce revenue.', 'pronamic_ideal' ), |
|
88 | + 'description' => __('Set a Google Analytics Property UA code to track ecommerce revenue.', 'pronamic_ideal'), |
|
89 | 89 | 'label_for' => 'pronamic_pay_google_analytics_property', |
90 | 90 | 'classes' => 'regular-text code', |
91 | 91 | ) |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | // Remove data on uninstall. |
95 | 95 | add_settings_field( |
96 | 96 | 'pronamic_pay_uninstall_clear_data', |
97 | - __( 'Remove Data', 'pronamic_ideal' ), |
|
98 | - array( $this, 'input_checkbox' ), |
|
97 | + __('Remove Data', 'pronamic_ideal'), |
|
98 | + array($this, 'input_checkbox'), |
|
99 | 99 | 'pronamic_pay', |
100 | 100 | 'pronamic_pay_general', |
101 | 101 | array( |
102 | - 'legend' => __( 'Remove Data', 'pronamic_ideal' ), |
|
103 | - 'description' => __( 'Remove all plugin data on uninstall', 'pronamic_ideal' ), |
|
102 | + 'legend' => __('Remove Data', 'pronamic_ideal'), |
|
103 | + 'description' => __('Remove all plugin data on uninstall', 'pronamic_ideal'), |
|
104 | 104 | 'label_for' => 'pronamic_pay_uninstall_clear_data', |
105 | 105 | 'classes' => 'regular-text', |
106 | 106 | 'type' => 'checkbox', |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | // Settings - Pages. |
111 | 111 | add_settings_section( |
112 | 112 | 'pronamic_pay_pages', |
113 | - __( 'Payment Status Pages', 'pronamic_ideal' ), |
|
114 | - array( $this, 'settings_section' ), |
|
113 | + __('Payment Status Pages', 'pronamic_ideal'), |
|
114 | + array($this, 'settings_section'), |
|
115 | 115 | 'pronamic_pay' |
116 | 116 | ); |
117 | 117 | |
118 | - foreach ( $this->plugin->get_pages() as $id => $label ) { |
|
118 | + foreach ($this->plugin->get_pages() as $id => $label) { |
|
119 | 119 | add_settings_field( |
120 | 120 | $id, |
121 | 121 | $label, |
122 | - array( $this, 'input_page' ), |
|
122 | + array($this, 'input_page'), |
|
123 | 123 | 'pronamic_pay', |
124 | 124 | 'pronamic_pay_pages', |
125 | 125 | array( |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | // Settings - Currency. |
132 | 132 | add_settings_section( |
133 | 133 | 'pronamic_pay_currency', |
134 | - __( 'Currency', 'pronamic_ideal' ), |
|
135 | - array( $this, 'settings_section' ), |
|
134 | + __('Currency', 'pronamic_ideal'), |
|
135 | + array($this, 'settings_section'), |
|
136 | 136 | 'pronamic_pay' |
137 | 137 | ); |
138 | 138 | |
139 | 139 | add_settings_field( |
140 | 140 | 'pronamic_pay_thousands_sep', |
141 | - __( 'Thousands Seperator', 'pronamic_ideal' ), |
|
142 | - array( $this, 'input_element' ), |
|
141 | + __('Thousands Seperator', 'pronamic_ideal'), |
|
142 | + array($this, 'input_element'), |
|
143 | 143 | 'pronamic_pay', |
144 | 144 | 'pronamic_pay_currency', |
145 | 145 | array( |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | |
151 | 151 | add_settings_field( |
152 | 152 | 'pronamic_pay_decimal_sep', |
153 | - __( 'Decimal Seperator', 'pronamic_ideal' ), |
|
154 | - array( $this, 'input_element' ), |
|
153 | + __('Decimal Seperator', 'pronamic_ideal'), |
|
154 | + array($this, 'input_element'), |
|
155 | 155 | 'pronamic_pay', |
156 | 156 | 'pronamic_pay_currency', |
157 | 157 | array( |
@@ -166,28 +166,28 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @param array $args Arguments. |
168 | 168 | */ |
169 | - public function settings_section( $args ) { |
|
170 | - switch ( $args['id'] ) { |
|
169 | + public function settings_section($args) { |
|
170 | + switch ($args['id']) { |
|
171 | 171 | case 'pronamic_pay_pages': |
172 | 172 | echo '<p>'; |
173 | - esc_html_e( 'The page an user will get redirected to after payment, based on the payment status.', 'pronamic_ideal' ); |
|
173 | + esc_html_e('The page an user will get redirected to after payment, based on the payment status.', 'pronamic_ideal'); |
|
174 | 174 | echo '</p>'; |
175 | 175 | |
176 | - $pages = array( 'completed', 'cancel', 'expired', 'error', 'unknown' ); |
|
176 | + $pages = array('completed', 'cancel', 'expired', 'error', 'unknown'); |
|
177 | 177 | |
178 | - foreach ( $pages as $status ) { |
|
179 | - $option_name = sprintf( 'pronamic_pay_%s_page_id', $status ); |
|
178 | + foreach ($pages as $status) { |
|
179 | + $option_name = sprintf('pronamic_pay_%s_page_id', $status); |
|
180 | 180 | |
181 | - $option = get_option( $option_name ); |
|
181 | + $option = get_option($option_name); |
|
182 | 182 | |
183 | - if ( ! empty( $option ) ) { |
|
183 | + if ( ! empty($option)) { |
|
184 | 184 | $hide_button = true; |
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | - if ( ! isset( $hide_button ) ) { |
|
188 | + if ( ! isset($hide_button)) { |
|
189 | 189 | submit_button( |
190 | - __( 'Set default pages', 'pronamic_ideal' ), |
|
190 | + __('Set default pages', 'pronamic_ideal'), |
|
191 | 191 | '', |
192 | 192 | 'pronamic_pay_create_pages', |
193 | 193 | false |
@@ -203,17 +203,17 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @param array $args Arguments. |
205 | 205 | */ |
206 | - public function input_element( $args ) { |
|
206 | + public function input_element($args) { |
|
207 | 207 | $defaults = array( |
208 | 208 | 'type' => 'text', |
209 | 209 | 'classes' => 'regular-text', |
210 | 210 | 'description' => '', |
211 | 211 | ); |
212 | 212 | |
213 | - $args = wp_parse_args( $args, $defaults ); |
|
213 | + $args = wp_parse_args($args, $defaults); |
|
214 | 214 | |
215 | 215 | $name = $args['label_for']; |
216 | - $value = get_option( $name ); |
|
216 | + $value = get_option($name); |
|
217 | 217 | |
218 | 218 | $atts = array( |
219 | 219 | 'name' => $name, |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | printf( |
227 | 227 | '<input %s />', |
228 | 228 | // @codingStandardsIgnoreStart |
229 | - Util::array_to_html_attributes( $atts ) |
|
229 | + Util::array_to_html_attributes($atts) |
|
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 | } |
@@ -245,32 +245,32 @@ discard block |
||
245 | 245 | * @see https://github.com/WordPress/WordPress/blob/4.9.1/wp-admin/options-reading.php#L110-L141 |
246 | 246 | * @param array $args Arguments. |
247 | 247 | */ |
248 | - public function input_checkbox( $args ) { |
|
248 | + public function input_checkbox($args) { |
|
249 | 249 | $id = $args['label_for']; |
250 | 250 | $name = $args['label_for']; |
251 | - $value = get_option( $name ); |
|
251 | + $value = get_option($name); |
|
252 | 252 | $legend = $args['legend']; |
253 | 253 | |
254 | 254 | echo '<fieldset>'; |
255 | 255 | |
256 | 256 | printf( |
257 | 257 | '<legend class="screen-reader-text"><span>%s</span></legend>', |
258 | - esc_html( $legend ) |
|
258 | + esc_html($legend) |
|
259 | 259 | ); |
260 | 260 | |
261 | 261 | printf( |
262 | 262 | '<label for="%s">', |
263 | - esc_attr( $id ) |
|
263 | + esc_attr($id) |
|
264 | 264 | ); |
265 | 265 | |
266 | 266 | printf( |
267 | 267 | '<input name="%s" id="%s" type="checkbox" value="1" %s />', |
268 | - esc_attr( $name ), |
|
269 | - esc_attr( $id ), |
|
270 | - checked( $value, 1, false ) |
|
268 | + esc_attr($name), |
|
269 | + esc_attr($id), |
|
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 | |
@@ -282,16 +282,16 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @param array $args Arguments. |
284 | 284 | */ |
285 | - public function input_license_key( $args ) { |
|
286 | - do_action( 'pronamic_pay_license_check' ); |
|
285 | + public function input_license_key($args) { |
|
286 | + do_action('pronamic_pay_license_check'); |
|
287 | 287 | |
288 | - $this->input_element( $args ); |
|
288 | + $this->input_element($args); |
|
289 | 289 | |
290 | - $status = get_option( 'pronamic_pay_license_status' ); |
|
290 | + $status = get_option('pronamic_pay_license_status'); |
|
291 | 291 | |
292 | 292 | $icon = 'valid' === $status ? 'yes' : 'no'; |
293 | 293 | |
294 | - printf( '<span class="dashicons dashicons-%s" style="vertical-align: text-bottom;"></span>', esc_attr( $icon ) ); |
|
294 | + printf('<span class="dashicons dashicons-%s" style="vertical-align: text-bottom;"></span>', esc_attr($icon)); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -299,15 +299,15 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @param array $args Arguments. |
301 | 301 | */ |
302 | - public function input_page( $args ) { |
|
302 | + public function input_page($args) { |
|
303 | 303 | $name = $args['label_for']; |
304 | 304 | |
305 | - wp_dropdown_pages( array( |
|
306 | - 'name' => esc_attr( $name ), |
|
307 | - 'post_type' => esc_attr( isset( $args['post_type'] ) ? $args['post_type'] : 'page' ), |
|
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' ) ), |
|
305 | + wp_dropdown_pages(array( |
|
306 | + 'name' => esc_attr($name), |
|
307 | + 'post_type' => esc_attr(isset($args['post_type']) ? $args['post_type'] : 'page'), |
|
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')), |
|
310 | 310 | 'class' => 'regular-text', |
311 | - ) ); |
|
311 | + )); |
|
312 | 312 | } |
313 | 313 | } |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | * @param Plugin $plugin Plugin. |
41 | 41 | * @param AdminModule $admin Admin. |
42 | 42 | */ |
43 | - public function __construct( Plugin $plugin, AdminModule $admin ) { |
|
43 | + public function __construct(Plugin $plugin, AdminModule $admin) { |
|
44 | 44 | $this->plugin = $plugin; |
45 | 45 | $this->admin = $admin; |
46 | 46 | |
47 | 47 | // Actions. |
48 | - add_action( 'pronamic_pay_admin_menu', array( $this, 'admin_menu' ) ); |
|
48 | + add_action('pronamic_pay_admin_menu', array($this, 'admin_menu')); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -54,53 +54,53 @@ discard block |
||
54 | 54 | public function admin_menu() { |
55 | 55 | $hook_suffix = add_submenu_page( |
56 | 56 | 'pronamic_ideal', |
57 | - __( 'Reports', 'pronamic_ideal' ), |
|
58 | - __( 'Reports', 'pronamic_ideal' ), |
|
57 | + __('Reports', 'pronamic_ideal'), |
|
58 | + __('Reports', 'pronamic_ideal'), |
|
59 | 59 | 'edit_payments', |
60 | 60 | 'pronamic_pay_reports', |
61 | - array( $this, 'page_reports' ) |
|
61 | + array($this, 'page_reports') |
|
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 | /** |
69 | 69 | * Page reports. |
70 | 70 | */ |
71 | 71 | public function page_reports() { |
72 | - return $this->admin->render_page( 'reports' ); |
|
72 | + return $this->admin->render_page('reports'); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Enqueue admin scripts. |
77 | 77 | */ |
78 | 78 | public function admin_css() { |
79 | - $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
79 | + $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; |
|
80 | 80 | |
81 | 81 | // Flot - http://www.flotcharts.org/. |
82 | 82 | $flot_version = '0.8.0-alpha'; |
83 | 83 | |
84 | 84 | wp_register_script( |
85 | 85 | 'flot', |
86 | - plugins_url( 'assets/flot/jquery.flot' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
87 | - array( 'jquery' ), |
|
86 | + plugins_url('assets/flot/jquery.flot' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file), |
|
87 | + array('jquery'), |
|
88 | 88 | $flot_version, |
89 | 89 | true |
90 | 90 | ); |
91 | 91 | |
92 | 92 | wp_register_script( |
93 | 93 | 'flot-time', |
94 | - plugins_url( 'assets/flot/jquery.flot.time' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
95 | - array( 'flot' ), |
|
94 | + plugins_url('assets/flot/jquery.flot.time' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file), |
|
95 | + array('flot'), |
|
96 | 96 | $flot_version, |
97 | 97 | true |
98 | 98 | ); |
99 | 99 | |
100 | 100 | wp_register_script( |
101 | 101 | 'flot-resize', |
102 | - plugins_url( 'assets/flot/jquery.flot.resize' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
103 | - array( 'flot' ), |
|
102 | + plugins_url('assets/flot/jquery.flot.resize' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file), |
|
103 | + array('flot'), |
|
104 | 104 | $flot_version, |
105 | 105 | true |
106 | 106 | ); |
@@ -108,8 +108,8 @@ 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', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
112 | - array( 'jquery' ), |
|
111 | + plugins_url('assets/accounting/accounting' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file), |
|
112 | + array('jquery'), |
|
113 | 113 | '0.4.1', |
114 | 114 | true |
115 | 115 | ); |
@@ -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', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
120 | + plugins_url('js/admin-reports' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file), |
|
121 | 121 | array( |
122 | 122 | 'jquery', |
123 | 123 | 'flot', |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | 'pronamicPayAdminReports', |
137 | 137 | array( |
138 | 138 | 'data' => $this->get_reports(), |
139 | - 'monthNames' => array_values( $wp_locale->month_abbrev ), |
|
139 | + 'monthNames' => array_values($wp_locale->month_abbrev), |
|
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | |
143 | 143 | // Enqueue. |
144 | - wp_enqueue_script( 'proanmic-pay-admin-reports' ); |
|
144 | + wp_enqueue_script('proanmic-pay-admin-reports'); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | * @return array |
151 | 151 | */ |
152 | 152 | public function get_reports() { |
153 | - $start = new \DateTime( 'First day of January' ); |
|
154 | - $end = new \DateTime( 'Last day of December' ); |
|
153 | + $start = new \DateTime('First day of January'); |
|
154 | + $end = new \DateTime('Last day of December'); |
|
155 | 155 | |
156 | 156 | $data = array( |
157 | 157 | (object) array( |
158 | - 'label' => __( 'Number succesfull payments', 'pronamic_ideal' ), |
|
159 | - 'data' => $this->get_report( 'payment_completed', 'COUNT', $start, $end ), |
|
158 | + 'label' => __('Number succesfull payments', 'pronamic_ideal'), |
|
159 | + 'data' => $this->get_report('payment_completed', 'COUNT', $start, $end), |
|
160 | 160 | 'color' => '#dbe1e3', |
161 | 161 | 'bars' => (object) array( |
162 | 162 | 'fillColor' => '#dbe1e3', |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | 'class' => 'completed-count', |
172 | 172 | ), |
173 | 173 | (object) array( |
174 | - 'label' => __( 'Open payments', 'pronamic_ideal' ), |
|
175 | - 'data' => $this->get_report( 'payment_pending', 'SUM', $start, $end ), |
|
174 | + 'label' => __('Open payments', 'pronamic_ideal'), |
|
175 | + 'data' => $this->get_report('payment_pending', 'SUM', $start, $end), |
|
176 | 176 | 'yaxis' => 2, |
177 | 177 | 'color' => '#b1d4ea', |
178 | 178 | 'points' => (object) array( |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | 'class' => 'pending-sum', |
193 | 193 | ), |
194 | 194 | (object) array( |
195 | - 'label' => __( 'Succesfull payments', 'pronamic_ideal' ), |
|
196 | - 'data' => $this->get_report( 'payment_completed', 'SUM', $start, $end ), |
|
195 | + 'label' => __('Succesfull payments', 'pronamic_ideal'), |
|
196 | + 'data' => $this->get_report('payment_completed', 'SUM', $start, $end), |
|
197 | 197 | 'yaxis' => 2, |
198 | 198 | 'color' => '#3498db', |
199 | 199 | 'points' => (object) array( |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | 'class' => 'completed-sum', |
215 | 215 | ), |
216 | 216 | (object) array( |
217 | - 'label' => __( 'Cancelled payments', 'pronamic_ideal' ), |
|
218 | - 'data' => $this->get_report( 'payment_cancelled', 'SUM', $start, $end ), |
|
217 | + 'label' => __('Cancelled payments', 'pronamic_ideal'), |
|
218 | + 'data' => $this->get_report('payment_cancelled', 'SUM', $start, $end), |
|
219 | 219 | 'yaxis' => 2, |
220 | 220 | 'color' => '#F1C40F', |
221 | 221 | 'points' => (object) array( |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | 'class' => 'cancelled-sum', |
237 | 237 | ), |
238 | 238 | (object) array( |
239 | - 'label' => __( 'Expired payments', 'pronamic_ideal' ), |
|
240 | - 'data' => $this->get_report( 'payment_expired', 'SUM', $start, $end ), |
|
239 | + 'label' => __('Expired payments', 'pronamic_ideal'), |
|
240 | + 'data' => $this->get_report('payment_expired', 'SUM', $start, $end), |
|
241 | 241 | 'yaxis' => 2, |
242 | 242 | 'color' => '#DBE1E3', |
243 | 243 | 'points' => (object) array( |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | 'class' => 'expired-sum', |
259 | 259 | ), |
260 | 260 | (object) array( |
261 | - 'label' => __( 'Failed payments', 'pronamic_ideal' ), |
|
262 | - 'data' => $this->get_report( 'payment_failed', 'SUM', $start, $end ), |
|
261 | + 'label' => __('Failed payments', 'pronamic_ideal'), |
|
262 | + 'data' => $this->get_report('payment_failed', 'SUM', $start, $end), |
|
263 | 263 | 'yaxis' => 2, |
264 | 264 | 'color' => '#E74C3C', |
265 | 265 | 'points' => (object) array( |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | ), |
282 | 282 | ); |
283 | 283 | |
284 | - foreach ( $data as $serie ) { |
|
285 | - $serie->legendValue = array_sum( wp_list_pluck( $serie->data, 1 ) ); |
|
284 | + foreach ($data as $serie) { |
|
285 | + $serie->legendValue = array_sum(wp_list_pluck($serie->data, 1)); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | return $data; |
@@ -298,16 +298,16 @@ discard block |
||
298 | 298 | * @param \DateTime $start Start date. |
299 | 299 | * @param \DateTime $end End date. |
300 | 300 | */ |
301 | - private function get_report( $status, $function, $start, $end ) { |
|
301 | + private function get_report($status, $function, $start, $end) { |
|
302 | 302 | global $wpdb; |
303 | 303 | |
304 | - $interval = new \DateInterval( 'P1M' ); |
|
305 | - $period = new \DatePeriod( $start, $interval, $end ); |
|
304 | + $interval = new \DateInterval('P1M'); |
|
305 | + $period = new \DatePeriod($start, $interval, $end); |
|
306 | 306 | |
307 | 307 | $date_format = '%Y-%m'; |
308 | 308 | |
309 | 309 | // @codingStandardsIgnoreStart |
310 | - $query = $wpdb->prepare( " |
|
310 | + $query = $wpdb->prepare(" |
|
311 | 311 | SELECT |
312 | 312 | DATE_FORMAT( post.post_date, %s ) AS month, |
313 | 313 | $function( meta_amount.meta_value ) AS value |
@@ -329,22 +329,22 @@ discard block |
||
329 | 329 | ; |
330 | 330 | ", |
331 | 331 | $date_format, |
332 | - $start->format( 'Y-m-d' ), |
|
333 | - $end->format( 'Y-m-d' ), |
|
332 | + $start->format('Y-m-d'), |
|
333 | + $end->format('Y-m-d'), |
|
334 | 334 | $status |
335 | 335 | ); |
336 | 336 | // @codingStandardsIgnoreEnd |
337 | 337 | |
338 | - $data = $wpdb->get_results( $query, OBJECT_K ); // WPCS: unprepared SQL ok. |
|
338 | + $data = $wpdb->get_results($query, OBJECT_K); // WPCS: unprepared SQL ok. |
|
339 | 339 | |
340 | 340 | $report = array(); |
341 | 341 | |
342 | - foreach ( $period as $date ) { |
|
343 | - $key = $date->format( 'Y-m' ); |
|
342 | + foreach ($period as $date) { |
|
343 | + $key = $date->format('Y-m'); |
|
344 | 344 | |
345 | 345 | $value = 0; |
346 | - if ( isset( $data[ $key ] ) ) { |
|
347 | - $value = (float) $data[ $key ]->value; |
|
346 | + if (isset($data[$key])) { |
|
347 | + $value = (float) $data[$key]->value; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | $report[] = array( |
@@ -33,22 +33,22 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @param AdminModule $admin Admin Module. |
35 | 35 | */ |
36 | - public function __construct( AdminModule $admin ) { |
|
36 | + public function __construct(AdminModule $admin) { |
|
37 | 37 | $this->admin = $admin; |
38 | 38 | |
39 | - add_filter( 'manage_edit-' . self::POST_TYPE . '_columns', array( $this, 'edit_columns' ) ); |
|
39 | + add_filter('manage_edit-' . self::POST_TYPE . '_columns', array($this, 'edit_columns')); |
|
40 | 40 | |
41 | - add_action( 'manage_' . self::POST_TYPE . '_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 ); |
|
41 | + add_action('manage_' . self::POST_TYPE . '_posts_custom_column', array($this, 'custom_columns'), 10, 2); |
|
42 | 42 | |
43 | - add_action( 'post_edit_form_tag', array( $this, 'post_edit_form_tag' ) ); |
|
43 | + add_action('post_edit_form_tag', array($this, 'post_edit_form_tag')); |
|
44 | 44 | |
45 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); |
|
45 | + add_action('add_meta_boxes', array($this, 'add_meta_boxes')); |
|
46 | 46 | |
47 | - add_action( 'save_post_' . self::POST_TYPE, array( $this, 'save_post' ) ); |
|
47 | + add_action('save_post_' . self::POST_TYPE, array($this, 'save_post')); |
|
48 | 48 | |
49 | - add_action( 'display_post_states', array( $this, 'display_post_states' ), 10, 2 ); |
|
49 | + add_action('display_post_states', array($this, 'display_post_states'), 10, 2); |
|
50 | 50 | |
51 | - add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
|
51 | + add_filter('post_updated_messages', array($this, 'post_updated_messages')); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | * @param array $columns Columns. |
58 | 58 | * @return array |
59 | 59 | */ |
60 | - public function edit_columns( $columns ) { |
|
60 | + public function edit_columns($columns) { |
|
61 | 61 | $columns = array( |
62 | 62 | 'cb' => '<input type="checkbox" />', |
63 | - 'title' => __( 'Title', 'pronamic_ideal' ), |
|
64 | - 'pronamic_gateway_variant' => __( 'Variant', 'pronamic_ideal' ), |
|
65 | - 'pronamic_gateway_id' => __( 'ID', 'pronamic_ideal' ), |
|
66 | - 'pronamic_gateway_dashboard' => __( 'Dashboard', 'pronamic_ideal' ), |
|
67 | - 'date' => __( 'Date', 'pronamic_ideal' ), |
|
63 | + 'title' => __('Title', 'pronamic_ideal'), |
|
64 | + 'pronamic_gateway_variant' => __('Variant', 'pronamic_ideal'), |
|
65 | + 'pronamic_gateway_id' => __('ID', 'pronamic_ideal'), |
|
66 | + 'pronamic_gateway_dashboard' => __('Dashboard', 'pronamic_ideal'), |
|
67 | + 'date' => __('Date', 'pronamic_ideal'), |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | return $columns; |
@@ -76,80 +76,80 @@ discard block |
||
76 | 76 | * @param string $column Column. |
77 | 77 | * @param string $post_id Post ID. |
78 | 78 | */ |
79 | - public function custom_columns( $column, $post_id ) { |
|
80 | - $id = get_post_meta( $post_id, '_pronamic_gateway_id', true ); |
|
79 | + public function custom_columns($column, $post_id) { |
|
80 | + $id = get_post_meta($post_id, '_pronamic_gateway_id', true); |
|
81 | 81 | |
82 | 82 | $integrations = $this->admin->plugin->gateway_integrations; |
83 | 83 | |
84 | - if ( isset( $integrations[ $id ] ) ) { |
|
85 | - $integration = $integrations[ $id ]; |
|
84 | + if (isset($integrations[$id])) { |
|
85 | + $integration = $integrations[$id]; |
|
86 | 86 | } |
87 | 87 | |
88 | - switch ( $column ) { |
|
88 | + switch ($column) { |
|
89 | 89 | case 'pronamic_gateway_variant': |
90 | - if ( isset( $integration ) ) { |
|
91 | - echo esc_html( $integration->get_name() ); |
|
90 | + if (isset($integration)) { |
|
91 | + echo esc_html($integration->get_name()); |
|
92 | 92 | } else { |
93 | - echo esc_html( $id ); |
|
93 | + echo esc_html($id); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | break; |
97 | 97 | case 'pronamic_gateway_id': |
98 | 98 | $data = array_filter( |
99 | 99 | array( |
100 | - get_post_meta( $post_id, '_pronamic_gateway_ideal_merchant_id', true ), |
|
101 | - get_post_meta( $post_id, '_pronamic_gateway_omnikassa_merchant_id', true ), |
|
102 | - get_post_meta( $post_id, '_pronamic_gateway_buckaroo_website_key', true ), |
|
103 | - get_post_meta( $post_id, '_pronamic_gateway_icepay_merchant_id', true ), |
|
104 | - get_post_meta( $post_id, '_pronamic_gateway_mollie_partner_id', true ), |
|
105 | - get_post_meta( $post_id, '_pronamic_gateway_multisafepay_account_id', true ), |
|
106 | - get_post_meta( $post_id, '_pronamic_gateway_pay_nl_service_id', true ), |
|
107 | - get_post_meta( $post_id, '_pronamic_gateway_paydutch_username', true ), |
|
108 | - get_post_meta( $post_id, '_pronamic_gateway_sisow_merchant_id', true ), |
|
109 | - get_post_meta( $post_id, '_pronamic_gateway_targetpay_layoutcode', true ), |
|
110 | - get_post_meta( $post_id, '_pronamic_gateway_ogone_psp_id', true ), |
|
111 | - get_post_meta( $post_id, '_pronamic_gateway_ogone_user_id', true ), |
|
100 | + get_post_meta($post_id, '_pronamic_gateway_ideal_merchant_id', true), |
|
101 | + get_post_meta($post_id, '_pronamic_gateway_omnikassa_merchant_id', true), |
|
102 | + get_post_meta($post_id, '_pronamic_gateway_buckaroo_website_key', true), |
|
103 | + get_post_meta($post_id, '_pronamic_gateway_icepay_merchant_id', true), |
|
104 | + get_post_meta($post_id, '_pronamic_gateway_mollie_partner_id', true), |
|
105 | + get_post_meta($post_id, '_pronamic_gateway_multisafepay_account_id', true), |
|
106 | + get_post_meta($post_id, '_pronamic_gateway_pay_nl_service_id', true), |
|
107 | + get_post_meta($post_id, '_pronamic_gateway_paydutch_username', true), |
|
108 | + get_post_meta($post_id, '_pronamic_gateway_sisow_merchant_id', true), |
|
109 | + get_post_meta($post_id, '_pronamic_gateway_targetpay_layoutcode', true), |
|
110 | + get_post_meta($post_id, '_pronamic_gateway_ogone_psp_id', true), |
|
111 | + get_post_meta($post_id, '_pronamic_gateway_ogone_user_id', true), |
|
112 | 112 | ) |
113 | 113 | ); |
114 | 114 | |
115 | - echo esc_html( implode( ' ', $data ) ); |
|
115 | + echo esc_html(implode(' ', $data)); |
|
116 | 116 | |
117 | 117 | break; |
118 | 118 | case 'pronamic_gateway_secret': |
119 | 119 | $data = array_filter( |
120 | 120 | array( |
121 | - get_post_meta( $post_id, '_pronamic_gateway_ideal_basic_hash_key', true ), |
|
122 | - get_post_meta( $post_id, '_pronamic_gateway_omnikassa_secret_key', true ), |
|
123 | - get_post_meta( $post_id, '_pronamic_gateway_buckaroo_secret_key', true ), |
|
124 | - get_post_meta( $post_id, '_pronamic_gateway_icepay_secret_code', true ), |
|
125 | - get_post_meta( $post_id, '_pronamic_gateway_sisow_merchant_key', true ), |
|
126 | - get_post_meta( $post_id, '_pronamic_gateway_ogone_password', true ), |
|
121 | + get_post_meta($post_id, '_pronamic_gateway_ideal_basic_hash_key', true), |
|
122 | + get_post_meta($post_id, '_pronamic_gateway_omnikassa_secret_key', true), |
|
123 | + get_post_meta($post_id, '_pronamic_gateway_buckaroo_secret_key', true), |
|
124 | + get_post_meta($post_id, '_pronamic_gateway_icepay_secret_code', true), |
|
125 | + get_post_meta($post_id, '_pronamic_gateway_sisow_merchant_key', true), |
|
126 | + get_post_meta($post_id, '_pronamic_gateway_ogone_password', true), |
|
127 | 127 | ) |
128 | 128 | ); |
129 | 129 | |
130 | - echo esc_html( implode( ' ', $data ) ); |
|
130 | + echo esc_html(implode(' ', $data)); |
|
131 | 131 | |
132 | 132 | break; |
133 | 133 | case 'pronamic_gateway_dashboard': |
134 | - if ( isset( $integration ) ) { |
|
134 | + if (isset($integration)) { |
|
135 | 135 | $urls = $integration->get_dashboard_url(); |
136 | 136 | |
137 | 137 | // Output. |
138 | 138 | $content = array(); |
139 | 139 | |
140 | - foreach ( $urls as $name => $url ) { |
|
141 | - if ( empty( $name ) ) { |
|
142 | - $name = __( 'Dashboard', 'pronamic_ideal' ); |
|
140 | + foreach ($urls as $name => $url) { |
|
141 | + if (empty($name)) { |
|
142 | + $name = __('Dashboard', 'pronamic_ideal'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | $content[] = sprintf( |
146 | 146 | '<a href="%s" target="_blank">%s</a>', |
147 | - esc_attr( $url ), |
|
148 | - esc_html( ucfirst( $name ) ) |
|
147 | + esc_attr($url), |
|
148 | + esc_html(ucfirst($name)) |
|
149 | 149 | ); |
150 | 150 | } |
151 | 151 | |
152 | - echo implode( ' | ', $content ); // WPCS: XSS ok. |
|
152 | + echo implode(' | ', $content); // WPCS: XSS ok. |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | break; |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | * @param array $post_states Post states. |
163 | 163 | * @param \WP_Post $post Post. |
164 | 164 | */ |
165 | - public function display_post_states( $post_states, $post ) { |
|
166 | - if ( self::POST_TYPE !== get_post_type( $post ) ) { |
|
165 | + public function display_post_states($post_states, $post) { |
|
166 | + if (self::POST_TYPE !== get_post_type($post)) { |
|
167 | 167 | return $post_states; |
168 | 168 | } |
169 | 169 | |
170 | - if ( intval( get_option( 'pronamic_pay_config_id' ) ) === $post->ID ) { |
|
171 | - $post_states['pronamic_pay_config_default'] = __( 'Default', 'pronamic_ideal' ); |
|
170 | + if (intval(get_option('pronamic_pay_config_id')) === $post->ID) { |
|
171 | + $post_states['pronamic_pay_config_default'] = __('Default', 'pronamic_ideal'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | return $post_states; |
@@ -182,13 +182,13 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @param WP_Post $post Post (only available @since 3.5.2). |
184 | 184 | */ |
185 | - public function post_edit_form_tag( $post ) { |
|
186 | - if ( empty( $post ) ) { |
|
185 | + public function post_edit_form_tag($post) { |
|
186 | + if (empty($post)) { |
|
187 | 187 | global $post; |
188 | 188 | } |
189 | 189 | |
190 | - if ( $post ) { |
|
191 | - if ( self::POST_TYPE === $post->post_type ) { |
|
190 | + if ($post) { |
|
191 | + if (self::POST_TYPE === $post->post_type) { |
|
192 | 192 | echo ' enctype="multipart/form-data"'; |
193 | 193 | } |
194 | 194 | } |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @param string $post_type Post Type. |
201 | 201 | */ |
202 | - public function add_meta_boxes( $post_type ) { |
|
203 | - if ( self::POST_TYPE === $post_type ) { |
|
202 | + public function add_meta_boxes($post_type) { |
|
203 | + if (self::POST_TYPE === $post_type) { |
|
204 | 204 | add_meta_box( |
205 | 205 | 'pronamic_gateway_config', |
206 | - __( 'Configuration', 'pronamic_ideal' ), |
|
207 | - array( $this, 'meta_box_config' ), |
|
206 | + __('Configuration', 'pronamic_ideal'), |
|
207 | + array($this, 'meta_box_config'), |
|
208 | 208 | $post_type, |
209 | 209 | 'normal', |
210 | 210 | 'high' |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | |
213 | 213 | add_meta_box( |
214 | 214 | 'pronamic_gateway_test', |
215 | - __( 'Test', 'pronamic_ideal' ), |
|
216 | - array( $this, 'meta_box_test' ), |
|
215 | + __('Test', 'pronamic_ideal'), |
|
216 | + array($this, 'meta_box_test'), |
|
217 | 217 | $post_type, |
218 | 218 | 'normal', |
219 | 219 | 'high' |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @param WP_Post $post The object for the current post/page. |
228 | 228 | */ |
229 | - public function meta_box_config( $post ) { |
|
230 | - wp_nonce_field( 'pronamic_pay_save_gateway', 'pronamic_pay_nonce' ); |
|
229 | + public function meta_box_config($post) { |
|
230 | + wp_nonce_field('pronamic_pay_save_gateway', 'pronamic_pay_nonce'); |
|
231 | 231 | |
232 | 232 | include Plugin::$dirname . '/admin/meta-box-gateway-config.php'; |
233 | 233 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @param WP_Post $post The object for the current post/page. |
239 | 239 | */ |
240 | - public function meta_box_test( $post ) { |
|
240 | + public function meta_box_test($post) { |
|
241 | 241 | include Plugin::$dirname . '/admin/meta-box-gateway-test.php'; |
242 | 242 | } |
243 | 243 | |
@@ -246,16 +246,16 @@ discard block |
||
246 | 246 | * |
247 | 247 | * @param int $post_id The ID of the post being saved. |
248 | 248 | */ |
249 | - public function save_post( $post_id ) { |
|
249 | + public function save_post($post_id) { |
|
250 | 250 | // Nonce. |
251 | - if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_nonce' ) ) { |
|
251 | + if ( ! filter_has_var(INPUT_POST, 'pronamic_pay_nonce')) { |
|
252 | 252 | return $post_id; |
253 | 253 | } |
254 | 254 | |
255 | - check_admin_referer( 'pronamic_pay_save_gateway', 'pronamic_pay_nonce' ); |
|
255 | + check_admin_referer('pronamic_pay_save_gateway', 'pronamic_pay_nonce'); |
|
256 | 256 | |
257 | 257 | // If this is an autosave, our form has not been submitted, so we don't want to do anything. |
258 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
258 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
259 | 259 | return $post_id; |
260 | 260 | } |
261 | 261 | |
@@ -267,39 +267,39 @@ discard block |
||
267 | 267 | '_pronamic_gateway_id' => FILTER_SANITIZE_STRING, |
268 | 268 | ); |
269 | 269 | |
270 | - foreach ( $fields as $field ) { |
|
271 | - if ( isset( $field['meta_key'], $field['filter'] ) ) { |
|
270 | + foreach ($fields as $field) { |
|
271 | + if (isset($field['meta_key'], $field['filter'])) { |
|
272 | 272 | $name = $field['meta_key']; |
273 | 273 | $filter = $field['filter']; |
274 | 274 | |
275 | - $definition[ $name ] = $filter; |
|
275 | + $definition[$name] = $filter; |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
279 | - $data = filter_input_array( INPUT_POST, $definition ); |
|
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 | - if ( $integration ) { |
|
288 | + if ($integration) { |
|
289 | 289 | $settings = $integration->get_settings(); |
290 | 290 | |
291 | - foreach ( $fields as $field ) { |
|
292 | - if ( isset( $field['default'], $field['meta_key'], $data[ $field['meta_key'] ] ) ) { |
|
291 | + foreach ($fields as $field) { |
|
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 | - if ( empty( $clean_default ) ) { |
|
298 | - $meta_value = get_post_meta( $post_id, $field['meta_key'], true ); |
|
297 | + if (empty($clean_default)) { |
|
298 | + $meta_value = get_post_meta($post_id, $field['meta_key'], true); |
|
299 | 299 | |
300 | 300 | // Only remove value if not saved before. |
301 | - if ( empty( $meta_value ) ) { |
|
302 | - $data[ $field['meta_key'] ] = null; |
|
301 | + if (empty($meta_value)) { |
|
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'] ] ) ) { |
|
310 | + if (empty($data[$field['meta_key']])) { |
|
311 | 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 | } |
@@ -322,23 +322,23 @@ discard block |
||
322 | 322 | // Filter data through gateway integration settings. |
323 | 323 | $settings_classes = $integration->get_settings_class(); |
324 | 324 | |
325 | - if ( ! is_array( $settings_classes ) ) { |
|
326 | - $settings_classes = array( $settings_classes ); |
|
325 | + if ( ! is_array($settings_classes)) { |
|
326 | + $settings_classes = array($settings_classes); |
|
327 | 327 | } |
328 | 328 | |
329 | - foreach ( $settings_classes as $settings_class ) { |
|
329 | + foreach ($settings_classes as $settings_class) { |
|
330 | 330 | $gateway_settings = new $settings_class(); |
331 | 331 | |
332 | - $data = $gateway_settings->save_post( $data ); |
|
332 | + $data = $gateway_settings->save_post($data); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
337 | 337 | // Update post meta data. |
338 | - pronamic_pay_update_post_meta_data( $post_id, $data ); |
|
338 | + pronamic_pay_update_post_meta_data($post_id, $data); |
|
339 | 339 | |
340 | 340 | // Transient. |
341 | - delete_transient( 'pronamic_pay_issuers_' . $post_id ); |
|
341 | + delete_transient('pronamic_pay_issuers_' . $post_id); |
|
342 | 342 | |
343 | 343 | \Pronamic\WordPress\Pay\Core\PaymentMethods::update_active_payment_methods(); |
344 | 344 | } |
@@ -352,34 +352,34 @@ discard block |
||
352 | 352 | * @param array $messages Messages. |
353 | 353 | * @return array |
354 | 354 | */ |
355 | - public function post_updated_messages( $messages ) { |
|
355 | + public function post_updated_messages($messages) { |
|
356 | 356 | global $post; |
357 | 357 | |
358 | 358 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352797&filters[translation_id]=37948900 |
359 | - $scheduled_date = date_i18n( __( 'M j, Y @ H:i', 'pronamic_ideal' ), strtotime( $post->post_date ) ); |
|
359 | + $scheduled_date = date_i18n(__('M j, Y @ H:i', 'pronamic_ideal'), strtotime($post->post_date)); |
|
360 | 360 | |
361 | - $messages[ self::POST_TYPE ] = array( |
|
361 | + $messages[self::POST_TYPE] = array( |
|
362 | 362 | 0 => '', // Unused. Messages start at index 1. |
363 | - 1 => __( 'Configuration updated.', 'pronamic_ideal' ), |
|
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 | 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 | 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 | - 4 => __( 'Configuration updated.', 'pronamic_ideal' ), |
|
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 | - 6 => __( 'Configuration published.', 'pronamic_ideal' ), |
|
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 |
376 | - 7 => __( 'Configuration saved.', 'pronamic_ideal' ), |
|
376 | + 7 => __('Configuration saved.', 'pronamic_ideal'), |
|
377 | 377 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352804&filters[translation_id]=37949303 |
378 | - 8 => __( 'Configuration submitted.', 'pronamic_ideal' ), |
|
378 | + 8 => __('Configuration submitted.', 'pronamic_ideal'), |
|
379 | 379 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352805&filters[translation_id]=37949302 |
380 | - 9 => sprintf( __( 'Configuration scheduled for: %s.', 'pronamic_ideal' ), '<strong>' . $scheduled_date . '</strong>' ), |
|
380 | + 9 => sprintf(__('Configuration scheduled for: %s.', 'pronamic_ideal'), '<strong>' . $scheduled_date . '</strong>'), |
|
381 | 381 | // @https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352806&filters[translation_id]=37949301 |
382 | - 10 => __( 'Configuration draft updated.', 'pronamic_ideal' ), |
|
382 | + 10 => __('Configuration draft updated.', 'pronamic_ideal'), |
|
383 | 383 | ); |
384 | 384 | |
385 | 385 | return $messages; |