@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | * email notifications so users can cancel or renew their subscription. |
83 | 83 | */ |
84 | 84 | public function handle_subscription() { |
85 | - if ( ! filter_has_var( INPUT_GET, 'subscription' ) ) { |
|
85 | + if ( !filter_has_var( INPUT_GET, 'subscription' ) ) { |
|
86 | 86 | return; |
87 | 87 | } |
88 | 88 | |
89 | - if ( ! filter_has_var( INPUT_GET, 'action' ) ) { |
|
89 | + if ( !filter_has_var( INPUT_GET, 'action' ) ) { |
|
90 | 90 | return; |
91 | 91 | } |
92 | 92 | |
93 | - if ( ! filter_has_var( INPUT_GET, 'key' ) ) { |
|
93 | + if ( !filter_has_var( INPUT_GET, 'key' ) ) { |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $key = filter_input( INPUT_GET, 'key', FILTER_SANITIZE_STRING ); |
103 | 103 | |
104 | 104 | // Check if subscription is valid. |
105 | - if ( ! $subscription ) { |
|
105 | + if ( !$subscription ) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | if ( Statuses::SUCCESS !== $subscription->get_status() ) { |
132 | 132 | $payment = $this->start_recurring( $subscription, $gateway, true ); |
133 | 133 | |
134 | - if ( ! $gateway->has_error() ) { |
|
134 | + if ( !$gateway->has_error() ) { |
|
135 | 135 | // Redirect. |
136 | 136 | $gateway->redirect( $payment ); |
137 | 137 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $payment->start_date = $start_date; |
201 | 201 | $payment->end_date = $end_date; |
202 | 202 | $payment->recurring_type = 'recurring'; |
203 | - $payment->recurring = ! $renewal; |
|
203 | + $payment->recurring = !$renewal; |
|
204 | 204 | |
205 | 205 | // Start payment. |
206 | 206 | $payment = Plugin::start_payment( $payment, $gateway ); |
@@ -243,11 +243,11 @@ discard block |
||
243 | 243 | * @return array |
244 | 244 | */ |
245 | 245 | public function exclude_subscription_comment_notes( $clauses, $query ) { |
246 | - $type = $query->query_vars['type']; |
|
246 | + $type = $query->query_vars[ 'type' ]; |
|
247 | 247 | |
248 | 248 | // Ignore subscription notes comments if it's not specifically requested. |
249 | 249 | if ( 'subscription_note' !== $type ) { |
250 | - $clauses['where'] .= " AND comment_type != 'subscription_note'"; |
|
250 | + $clauses[ 'where' ] .= " AND comment_type != 'subscription_note'"; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | return $clauses; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | // Check if there is already subscription attached to the payment. |
274 | 274 | $subscription_id = $payment->get_subscription_id(); |
275 | 275 | |
276 | - if ( ! empty( $subscription_id ) ) { |
|
276 | + if ( !empty( $subscription_id ) ) { |
|
277 | 277 | // Subscription already created. |
278 | 278 | return; |
279 | 279 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | delete_post_meta( $post->ID, '_pronamic_subscription_renewal_sent_1week' ); |
478 | 478 | } |
479 | 479 | |
480 | - do_action( 'pronamic_subscription_renewal_notice_' . $subscription->get_source(), $subscription ); |
|
480 | + do_action( 'pronamic_subscription_renewal_notice_'.$subscription->get_source(), $subscription ); |
|
481 | 481 | |
482 | 482 | update_post_meta( $post->ID, '_pronamic_subscription_renewal_sent_1week', $start_date->format( DateTime::MYSQL ) ); |
483 | 483 | } |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | } |
523 | 523 | |
524 | 524 | // The status of canceled or completed subscriptions will not be changed automatically. |
525 | - if ( ! in_array( $status_before, array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
525 | + if ( !in_array( $status_before, array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
526 | 526 | $subscription->set_status( $status_update ); |
527 | 527 | } |
528 | 528 |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * Handle returns. |
231 | 231 | */ |
232 | 232 | public function handle_returns() { |
233 | - if ( ! filter_has_var( INPUT_GET, 'payment' ) ) { |
|
233 | + if ( !filter_has_var( INPUT_GET, 'payment' ) ) { |
|
234 | 234 | return; |
235 | 235 | } |
236 | 236 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $valid_key = ( $key === $payment->key ); |
250 | 250 | } |
251 | 251 | |
252 | - if ( ! $valid_key ) { |
|
252 | + if ( !$valid_key ) { |
|
253 | 253 | wp_redirect( home_url() ); |
254 | 254 | |
255 | 255 | exit; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * Maybe redirect. |
278 | 278 | */ |
279 | 279 | public function maybe_redirect() { |
280 | - if ( ! filter_has_var( INPUT_GET, 'payment_redirect' ) ) { |
|
280 | + if ( !filter_has_var( INPUT_GET, 'payment_redirect' ) ) { |
|
281 | 281 | return; |
282 | 282 | } |
283 | 283 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | // HTML Answer. |
289 | 289 | $html_answer = $payment->get_meta( 'ogone_directlink_html_answer' ); |
290 | 290 | |
291 | - if ( ! empty( $html_answer ) ) { |
|
291 | + if ( !empty( $html_answer ) ) { |
|
292 | 292 | echo $html_answer; // WPCS: XSS ok. |
293 | 293 | |
294 | 294 | exit; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | $redirect_message = $payment->get_meta( 'payment_redirect_message' ); |
298 | 298 | |
299 | - if ( ! empty( $redirect_message ) ) { |
|
299 | + if ( !empty( $redirect_message ) ) { |
|
300 | 300 | $key = filter_input( INPUT_GET, 'key', FILTER_SANITIZE_STRING ); |
301 | 301 | |
302 | 302 | if ( $key !== $payment->key ) { |
@@ -307,29 +307,29 @@ discard block |
||
307 | 307 | |
308 | 308 | // @see https://github.com/woothemes/woocommerce/blob/2.3.11/includes/class-wc-cache-helper.php |
309 | 309 | // @see https://www.w3-edge.com/products/w3-total-cache/ |
310 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
310 | + if ( !defined( 'DONOTCACHEPAGE' ) ) { |
|
311 | 311 | define( 'DONOTCACHEPAGE', true ); |
312 | 312 | } |
313 | 313 | |
314 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
314 | + if ( !defined( 'DONOTCACHEDB' ) ) { |
|
315 | 315 | define( 'DONOTCACHEDB', true ); |
316 | 316 | } |
317 | 317 | |
318 | - if ( ! defined( 'DONOTMINIFY' ) ) { |
|
318 | + if ( !defined( 'DONOTMINIFY' ) ) { |
|
319 | 319 | define( 'DONOTMINIFY', true ); |
320 | 320 | } |
321 | 321 | |
322 | - if ( ! defined( 'DONOTCDN' ) ) { |
|
322 | + if ( !defined( 'DONOTCDN' ) ) { |
|
323 | 323 | define( 'DONOTCDN', true ); |
324 | 324 | } |
325 | 325 | |
326 | - if ( ! defined( 'DONOTCACHEOBJECT' ) ) { |
|
326 | + if ( !defined( 'DONOTCACHEOBJECT' ) ) { |
|
327 | 327 | define( 'DONOTCACHEOBJECT', true ); |
328 | 328 | } |
329 | 329 | |
330 | 330 | nocache_headers(); |
331 | 331 | |
332 | - include Plugin::$dirname . '/views/redirect-message.php'; |
|
332 | + include Plugin::$dirname.'/views/redirect-message.php'; |
|
333 | 333 | |
334 | 334 | exit; |
335 | 335 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | - if ( ! empty( $payment->action_url ) ) { |
|
351 | + if ( !empty( $payment->action_url ) ) { |
|
352 | 352 | wp_redirect( $payment->action_url ); |
353 | 353 | |
354 | 354 | exit; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | */ |
378 | 378 | public function plugins_loaded() { |
379 | 379 | // Load plugin text domain. |
380 | - $rel_path = dirname( plugin_basename( self::$file ) ) . '/languages/'; |
|
380 | + $rel_path = dirname( plugin_basename( self::$file ) ).'/languages/'; |
|
381 | 381 | |
382 | 382 | load_plugin_textdomain( 'pronamic_ideal', false, $rel_path ); |
383 | 383 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | ); |
472 | 472 | |
473 | 473 | if ( $payment_method ) { |
474 | - $args['post__in'] = PaymentMethods::get_config_ids( $payment_method ); |
|
474 | + $args[ 'post__in' ] = PaymentMethods::get_config_ids( $payment_method ); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | $query = new WP_Query( $args ); |
@@ -512,12 +512,12 @@ discard block |
||
512 | 512 | * @param array $errors An array with errors to render. |
513 | 513 | */ |
514 | 514 | public static function render_errors( $errors = array() ) { |
515 | - if ( ! is_array( $errors ) ) { |
|
515 | + if ( !is_array( $errors ) ) { |
|
516 | 516 | $errors = array( $errors ); |
517 | 517 | } |
518 | 518 | |
519 | 519 | foreach ( $errors as $error ) { |
520 | - include Plugin::$dirname . '/views/error.php'; |
|
520 | + include Plugin::$dirname.'/views/error.php'; |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
@@ -682,10 +682,10 @@ discard block |
||
682 | 682 | $payment->set_credit_card( $data->get_credit_card() ); |
683 | 683 | |
684 | 684 | // User Agent (@see https://github.com/WordPress/WordPress/blob/4.9.4/wp-includes/comment.php#L1962-L1965). |
685 | - $payment->user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : null; |
|
685 | + $payment->user_agent = isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? $_SERVER[ 'HTTP_USER_AGENT' ] : null; |
|
686 | 686 | |
687 | 687 | // IP (@see https://github.com/WordPress/WordPress/blob/4.9.4/wp-includes/comment.php#L1957-L1960). |
688 | - $payment->user_ip = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : null; |
|
688 | + $payment->user_ip = isset( $_SERVER[ 'REMOTE_ADDR' ] ) ? $_SERVER[ 'REMOTE_ADDR' ] : null; |
|
689 | 689 | |
690 | 690 | return self::start_payment( $payment, $gateway ); |
691 | 691 | } |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | $subscription = $payment->get_subscription(); |
716 | 716 | |
717 | 717 | if ( $subscription ) { |
718 | - if ( ! $payment->get_recurring() ) { |
|
718 | + if ( !$payment->get_recurring() ) { |
|
719 | 719 | // First payment. |
720 | 720 | // Cancel subscription to prevent unwanted recurring payments in the future, |
721 | 721 | // when a valid customer ID might be set for the user. |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | * @return array |
64 | 64 | */ |
65 | 65 | public function exclude_payment_comment_notes( $clauses, $query ) { |
66 | - $type = $query->query_vars['type']; |
|
66 | + $type = $query->query_vars[ 'type' ]; |
|
67 | 67 | |
68 | 68 | // Ignore payment notes comments if it's not specifically requested. |
69 | 69 | if ( 'payment_note' !== $type ) { |
70 | - $clauses['where'] .= " AND comment_type != 'payment_note'"; |
|
70 | + $clauses[ 'where' ] .= " AND comment_type != 'payment_note'"; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $clauses; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | break; |
112 | 112 | } |
113 | 113 | |
114 | - if ( ! empty( $page_id ) ) { |
|
114 | + if ( !empty( $page_id ) ) { |
|
115 | 115 | $page_url = get_permalink( $page_id ); |
116 | 116 | |
117 | 117 | if ( false !== $page_url ) { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | [](https://scrutinizer-ci.com/code-intelligence) |
21 | 21 | [](https://codecov.io/gh/pronamic/wp-pronamic-ideal) |
22 | 22 | |
23 | -<?php include __DIR__ . '/../general/description-short.php'; ?> |
|
23 | +<?php include __DIR__.'/../general/description-short.php'; ?> |
|
24 | 24 | |
25 | 25 | |
26 | 26 | ## Gateways |
@@ -43,4 +43,4 @@ discard block |
||
43 | 43 | |
44 | 44 | ## Links |
45 | 45 | |
46 | -<?php include __DIR__ . '/../general/links.php'; ?> |
|
46 | +<?php include __DIR__.'/../general/links.php'; ?> |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $timestamp = wp_next_scheduled( 'pronamic_pay_license_check' ); |
59 | 59 | |
60 | 60 | if ( false !== $timestamp ) { |
61 | - $date = new \Pronamic\WordPress\Pay\DateTime( '@' . $timestamp, new DateTimeZone( 'UTC' ) ); |
|
61 | + $date = new \Pronamic\WordPress\Pay\DateTime( '@'.$timestamp, new DateTimeZone( 'UTC' ) ); |
|
62 | 62 | |
63 | 63 | echo esc_html( $date->format_i18n() ); |
64 | 64 | } else { |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | $version = curl_version(); |
246 | 246 | // @codingStandardsIgnoreEnd |
247 | 247 | |
248 | - if ( isset( $version['version'] ) ) { |
|
249 | - echo esc_html( $version['version'] ); |
|
248 | + if ( isset( $version[ 'version' ] ) ) { |
|
249 | + echo esc_html( $version[ 'version' ] ); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | |
337 | 337 | $data = get_transient( 'pronamic_pay_ideal_issuers_status' ); |
338 | 338 | |
339 | -if ( ! $data ) { |
|
339 | +if ( !$data ) { |
|
340 | 340 | |
341 | 341 | $url = 'http://www.ideal-status.nl/static/issuers_current.json'; |
342 | 342 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | |
345 | 345 | $status_data = null; |
346 | 346 | |
347 | - if ( ! is_wp_error( $response ) ) { |
|
347 | + if ( !is_wp_error( $response ) ) { |
|
348 | 348 | if ( 200 === wp_remote_retrieve_response_code( $response ) ) { |
349 | 349 | $body = wp_remote_retrieve_body( $response ); |
350 | 350 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | |
410 | 410 | <?php foreach ( $data as $status ) : ?> |
411 | 411 | |
412 | - <?php $alternate = ! $alternate; ?> |
|
412 | + <?php $alternate = !$alternate; ?> |
|
413 | 413 | |
414 | 414 | <tr<?php if ( $alternate ) : ?> class="alternate"<?php endif; ?>> |
415 | 415 | <td> |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | |
115 | 115 | $post_status = $this->get_post_status( $payment->status ); |
116 | 116 | |
117 | - if ( ! empty( $post_status ) ) { |
|
118 | - $data['post_status'] = $post_status; |
|
117 | + if ( !empty( $post_status ) ) { |
|
118 | + $data[ 'post_status' ] = $post_status; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | wp_update_post( $data ); |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | |
286 | 286 | $can_redirect = false; |
287 | 287 | |
288 | - do_action( 'pronamic_payment_status_update_' . $payment->source . '_' . $old . '_to_' . $new, $payment, $can_redirect, $previous_status, $payment->status ); |
|
289 | - do_action( 'pronamic_payment_status_update_' . $payment->source, $payment, $can_redirect, $previous_status, $payment->status ); |
|
288 | + do_action( 'pronamic_payment_status_update_'.$payment->source.'_'.$old.'_to_'.$new, $payment, $can_redirect, $previous_status, $payment->status ); |
|
289 | + do_action( 'pronamic_payment_status_update_'.$payment->source, $payment, $can_redirect, $previous_status, $payment->status ); |
|
290 | 290 | do_action( 'pronamic_payment_status_update', $payment, $can_redirect, $previous_status, $payment->status ); |
291 | 291 | } |
292 | 292 | } |
@@ -223,7 +223,7 @@ |
||
223 | 223 | * @return string |
224 | 224 | */ |
225 | 225 | public function get_subscription_id() { |
226 | - if ( ! $this->get_subscription() ) { |
|
226 | + if ( !$this->get_subscription() ) { |
|
227 | 227 | return; |
228 | 228 | } |
229 | 229 |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | |
100 | 100 | $post_status = $this->get_post_status( $subscription->get_status() ); |
101 | 101 | |
102 | - if ( ! empty( $post_status ) ) { |
|
103 | - $data['post_status'] = $post_status; |
|
102 | + if ( !empty( $post_status ) ) { |
|
103 | + $data[ 'post_status' ] = $post_status; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | wp_update_post( $data ); |
@@ -294,8 +294,8 @@ discard block |
||
294 | 294 | |
295 | 295 | $can_redirect = false; |
296 | 296 | |
297 | - do_action( 'pronamic_subscription_status_update_' . $subscription->source . '_' . $old . '_to_' . $new, $subscription, $can_redirect, $previous_status, $subscription->status ); |
|
298 | - do_action( 'pronamic_subscription_status_update_' . $subscription->source, $subscription, $can_redirect, $previous_status, $subscription->status ); |
|
297 | + do_action( 'pronamic_subscription_status_update_'.$subscription->source.'_'.$old.'_to_'.$new, $subscription, $can_redirect, $previous_status, $subscription->status ); |
|
298 | + do_action( 'pronamic_subscription_status_update_'.$subscription->source, $subscription, $can_redirect, $previous_status, $subscription->status ); |
|
299 | 299 | do_action( 'pronamic_subscription_status_update', $subscription, $can_redirect, $previous_status, $subscription->status ); |
300 | 300 | } |
301 | 301 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | // Payment method input HTML. |
44 | 44 | $html = $gateway->get_input_html(); |
45 | 45 | |
46 | - if ( ! empty( $html ) ) { |
|
46 | + if ( !empty( $html ) ) { |
|
47 | 47 | $inputs[ $payment_method ] = array( |
48 | 48 | 'label' => $method_name, |
49 | 49 | 'html' => $html, |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | if ( $gateway->has_error() ) { |
55 | - $pronamic_ideal_errors[] = $gateway->get_error(); |
|
55 | + $pronamic_ideal_errors[ ] = $gateway->get_error(); |
|
56 | 56 | } |
57 | 57 | |
58 | -require Plugin::$dirname . '/views/errors.php'; |
|
58 | +require Plugin::$dirname.'/views/errors.php'; |
|
59 | 59 | |
60 | 60 | ?> |
61 | 61 | <table class="form-table"> |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | |
88 | 88 | <tr class="pronamic-pay-cloack pronamic-pay-test-payment-method <?php echo esc_attr( $method ); ?>"> |
89 | 89 | <th scope="row"> |
90 | - <?php echo esc_html( $input['label'] ); ?> |
|
90 | + <?php echo esc_html( $input[ 'label' ] ); ?> |
|
91 | 91 | </th> |
92 | 92 | <td> |
93 | 93 | <?php |
94 | 94 | |
95 | - echo $input['html']; // WPCS: XSS ok. |
|
95 | + echo $input[ 'html' ]; // WPCS: XSS ok. |
|
96 | 96 | |
97 | 97 | ?> |
98 | 98 | </td> |
@@ -304,5 +304,5 @@ discard block |
||
304 | 304 | <?php |
305 | 305 | |
306 | 306 | if ( $is_ideal || $gateway instanceof \Pronamic\WordPress\Pay\Gateways\OmniKassa2\Gateway ) { |
307 | - include Plugin::$dirname . '/views/ideal-test-cases.php'; |
|
307 | + include Plugin::$dirname.'/views/ideal-test-cases.php'; |
|
308 | 308 | } |