@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | public function __construct() { |
| 41 | 41 | add_filter( 'request', array( $this, 'request' ) ); |
| 42 | 42 | |
| 43 | - add_filter( 'manage_edit-' . self::POST_TYPE . '_columns', array( $this, 'columns' ) ); |
|
| 44 | - add_filter( 'manage_edit-' . self::POST_TYPE . '_sortable_columns', array( $this, 'sortable_columns' ) ); |
|
| 43 | + add_filter( 'manage_edit-'.self::POST_TYPE.'_columns', array( $this, 'columns' ) ); |
|
| 44 | + add_filter( 'manage_edit-'.self::POST_TYPE.'_sortable_columns', array( $this, 'sortable_columns' ) ); |
|
| 45 | 45 | |
| 46 | - add_action( 'manage_' . self::POST_TYPE . '_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 ); |
|
| 46 | + add_action( 'manage_'.self::POST_TYPE.'_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 ); |
|
| 47 | 47 | |
| 48 | 48 | add_action( 'load-post.php', array( $this, 'maybe_check_status' ) ); |
| 49 | 49 | |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | $screen = get_current_screen(); |
| 79 | 79 | |
| 80 | 80 | if ( self::POST_TYPE === $screen->post_type ) { |
| 81 | - if ( ! isset( $vars['post_status'] ) ) { |
|
| 82 | - $vars['post_status'] = array_keys( \Pronamic\WordPress\Pay\Plugin::get_payment_states() ); |
|
| 81 | + if ( !isset( $vars[ 'post_status' ] ) ) { |
|
| 82 | + $vars[ 'post_status' ] = array_keys( \Pronamic\WordPress\Pay\Plugin::get_payment_states() ); |
|
| 83 | 83 | |
| 84 | - $vars['post_status'][] = 'publish'; |
|
| 84 | + $vars[ 'post_status' ][ ] = 'publish'; |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -93,25 +93,25 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function maybe_check_status() { |
| 95 | 95 | // Current user. |
| 96 | - if ( ! current_user_can( 'edit_payments' ) ) { |
|
| 96 | + if ( !current_user_can( 'edit_payments' ) ) { |
|
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Screen. |
| 101 | 101 | $screen = get_current_screen(); |
| 102 | 102 | |
| 103 | - if ( ! ( 'post' === $screen->base && 'pronamic_payment' === $screen->post_type ) ) { |
|
| 103 | + if ( !( 'post' === $screen->base && 'pronamic_payment' === $screen->post_type ) ) { |
|
| 104 | 104 | return; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $post_id = filter_input( INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT ); |
| 108 | 108 | |
| 109 | - if ( filter_has_var( INPUT_GET, 'pronamic_pay_check_status' ) && check_admin_referer( 'pronamic_payment_check_status_' . $post_id ) ) { |
|
| 109 | + if ( filter_has_var( INPUT_GET, 'pronamic_pay_check_status' ) && check_admin_referer( 'pronamic_payment_check_status_'.$post_id ) ) { |
|
| 110 | 110 | $payment = get_pronamic_payment( $post_id ); |
| 111 | 111 | |
| 112 | 112 | \Pronamic\WordPress\Pay\Plugin::update_payment( $payment, false ); |
| 113 | 113 | |
| 114 | - $this->admin_notices[] = array( |
|
| 114 | + $this->admin_notices[ ] = array( |
|
| 115 | 115 | 'type' => 'info', |
| 116 | 116 | 'message' => __( 'Payment status updated.', 'pronamic_ideal' ), |
| 117 | 117 | ); |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | foreach ( $this->admin_notices as $notice ) { |
| 126 | 126 | printf( |
| 127 | 127 | '<div class="notice notice-%1$s"><p>%2$s</p></div>', |
| 128 | - esc_attr( $notice['type'] ), |
|
| 129 | - esc_html( $notice['message'] ) |
|
| 128 | + esc_attr( $notice[ 'type' ] ), |
|
| 129 | + esc_html( $notice[ 'message' ] ) |
|
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | * @return array |
| 182 | 182 | */ |
| 183 | 183 | public function default_hidden_columns( $hidden ) { |
| 184 | - $hidden[] = 'pronamic_payment_gateway'; |
|
| 185 | - $hidden[] = 'pronamic_payment_description'; |
|
| 184 | + $hidden[ ] = 'pronamic_payment_gateway'; |
|
| 185 | + $hidden[ ] = 'pronamic_payment_description'; |
|
| 186 | 186 | |
| 187 | 187 | return $hidden; |
| 188 | 188 | } |
@@ -194,9 +194,9 @@ discard block |
||
| 194 | 194 | * @return array |
| 195 | 195 | */ |
| 196 | 196 | public function sortable_columns( $sortable_columns ) { |
| 197 | - $sortable_columns['pronamic_payment_title'] = 'ID'; |
|
| 198 | - $sortable_columns['pronamic_payment_amount'] = 'pronamic_payment_amount'; |
|
| 199 | - $sortable_columns['pronamic_payment_date'] = 'date'; |
|
| 197 | + $sortable_columns[ 'pronamic_payment_title' ] = 'ID'; |
|
| 198 | + $sortable_columns[ 'pronamic_payment_amount' ] = 'pronamic_payment_amount'; |
|
| 199 | + $sortable_columns[ 'pronamic_payment_date' ] = 'date'; |
|
| 200 | 200 | |
| 201 | 201 | return $sortable_columns; |
| 202 | 202 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | $recurring = get_post_meta( $post_id, '_pronamic_payment_recurring', true ); |
| 245 | 245 | |
| 246 | - if ( ! $recurring ) { |
|
| 246 | + if ( !$recurring ) { |
|
| 247 | 247 | $label = __( 'First of recurring payment', 'pronamic_ideal' ); |
| 248 | 248 | $class = ' pronamic-pay-icon-recurring-first'; |
| 249 | 249 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $source_id = $payment->get_source_id(); |
| 263 | 263 | $source_description = $payment->get_source_description(); |
| 264 | 264 | |
| 265 | - $source_id_text = '#' . $source_id; |
|
| 265 | + $source_id_text = '#'.$source_id; |
|
| 266 | 266 | |
| 267 | 267 | $source_link = $payment->get_source_link(); |
| 268 | 268 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | case 'pronamic_payment_gateway': |
| 299 | 299 | $config_id = get_post_meta( $post_id, '_pronamic_payment_config_id', true ); |
| 300 | 300 | |
| 301 | - if ( ! empty( $config_id ) ) { |
|
| 301 | + if ( !empty( $config_id ) ) { |
|
| 302 | 302 | echo get_the_title( $config_id ); |
| 303 | 303 | } else { |
| 304 | 304 | echo '—'; |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | * @param WP_Post $post The object for the current post/page. |
| 412 | 412 | */ |
| 413 | 413 | public function meta_box_info( $post ) { |
| 414 | - include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-payment-info.php'; |
|
| 414 | + include \Pronamic\WordPress\Pay\Plugin::$dirname.'/admin/meta-box-payment-info.php'; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | /** |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | ) |
| 428 | 428 | ); |
| 429 | 429 | |
| 430 | - include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-notes.php'; |
|
| 430 | + include \Pronamic\WordPress\Pay\Plugin::$dirname.'/admin/meta-box-notes.php'; |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | /** |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | * @param WP_Post $post The object for the current post/page. |
| 437 | 437 | */ |
| 438 | 438 | public function meta_box_subscription( $post ) { |
| 439 | - include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-payment-subscription.php'; |
|
| 439 | + include \Pronamic\WordPress\Pay\Plugin::$dirname.'/admin/meta-box-payment-subscription.php'; |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | /** |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | public function meta_box_update( $post ) { |
| 448 | 448 | wp_nonce_field( 'pronamic_payment_update', 'pronamic_payment_update_nonce' ); |
| 449 | 449 | |
| 450 | - include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-payment-update.php'; |
|
| 450 | + include \Pronamic\WordPress\Pay\Plugin::$dirname.'/admin/meta-box-payment-update.php'; |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | /** |
@@ -535,14 +535,14 @@ discard block |
||
| 535 | 535 | 0 => '', // Unused. Messages start at index 1. |
| 536 | 536 | 1 => __( 'Payment updated.', 'pronamic_ideal' ), |
| 537 | 537 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352799&filters[translation_id]=37947229. |
| 538 | - 2 => $messages['post'][2], |
|
| 538 | + 2 => $messages[ 'post' ][ 2 ], |
|
| 539 | 539 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352800&filters[translation_id]=37947870. |
| 540 | - 3 => $messages['post'][3], |
|
| 540 | + 3 => $messages[ 'post' ][ 3 ], |
|
| 541 | 541 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352798&filters[translation_id]=37947230. |
| 542 | 542 | 4 => __( 'Payment updated.', 'pronamic_ideal' ), |
| 543 | 543 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352801&filters[translation_id]=37947231. |
| 544 | 544 | // translators: %s: date and time of the revision |
| 545 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Payment restored to revision from %s.', 'pronamic_ideal' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, // WPCS: CSRF ok. |
|
| 545 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'Payment restored to revision from %s.', 'pronamic_ideal' ), wp_post_revision_title( (int) $_GET[ 'revision' ], false ) ) : false, // WPCS: CSRF ok. |
|
| 546 | 546 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352802&filters[translation_id]=37949178. |
| 547 | 547 | 6 => __( 'Payment published.', 'pronamic_ideal' ), |
| 548 | 548 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352803&filters[translation_id]=37947232. |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352804&filters[translation_id]=37949303. |
| 551 | 551 | 8 => __( 'Payment submitted.', 'pronamic_ideal' ), |
| 552 | 552 | // @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352805&filters[translation_id]=37949302. |
| 553 | - 9 => sprintf( __( 'Payment scheduled for: %s.', 'pronamic_ideal' ), '<strong>' . $scheduled_date . '</strong>' ), |
|
| 553 | + 9 => sprintf( __( 'Payment scheduled for: %s.', 'pronamic_ideal' ), '<strong>'.$scheduled_date.'</strong>' ), |
|
| 554 | 554 | // @https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352806&filters[translation_id]=37949301. |
| 555 | 555 | 10 => __( 'Payment draft updated.', 'pronamic_ideal' ), |
| 556 | 556 | ); |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | public function __construct() { |
| 32 | 32 | add_filter( 'request', array( $this, 'request' ) ); |
| 33 | 33 | |
| 34 | - add_filter( 'manage_edit-' . self::POST_TYPE . '_columns', array( $this, 'columns' ) ); |
|
| 35 | - add_filter( 'manage_edit-' . self::POST_TYPE . '_sortable_columns', array( $this, 'sortable_columns' ) ); |
|
| 34 | + add_filter( 'manage_edit-'.self::POST_TYPE.'_columns', array( $this, 'columns' ) ); |
|
| 35 | + add_filter( 'manage_edit-'.self::POST_TYPE.'_sortable_columns', array( $this, 'sortable_columns' ) ); |
|
| 36 | 36 | |
| 37 | - add_action( 'manage_' . self::POST_TYPE . '_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 ); |
|
| 37 | + add_action( 'manage_'.self::POST_TYPE.'_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 ); |
|
| 38 | 38 | |
| 39 | 39 | add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); |
| 40 | 40 | |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | $screen = get_current_screen(); |
| 57 | 57 | |
| 58 | 58 | if ( self::POST_TYPE === $screen->post_type ) { |
| 59 | - if ( ! isset( $vars['post_status'] ) ) { |
|
| 60 | - $vars['post_status'] = array_keys( \Pronamic\WordPress\Pay\Plugin::get_subscription_states() ); |
|
| 59 | + if ( !isset( $vars[ 'post_status' ] ) ) { |
|
| 60 | + $vars[ 'post_status' ] = array_keys( \Pronamic\WordPress\Pay\Plugin::get_subscription_states() ); |
|
| 61 | 61 | |
| 62 | - $vars['post_status'][] = 'publish'; |
|
| 62 | + $vars[ 'post_status' ][ ] = 'publish'; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | * @return array |
| 98 | 98 | */ |
| 99 | 99 | public function sortable_columns( $sortable_columns ) { |
| 100 | - $sortable_columns['pronamic_subscription_title'] = 'ID'; |
|
| 101 | - $sortable_columns['pronamic_subscription_date'] = 'date'; |
|
| 100 | + $sortable_columns[ 'pronamic_subscription_title' ] = 'ID'; |
|
| 101 | + $sortable_columns[ 'pronamic_subscription_date' ] = 'date'; |
|
| 102 | 102 | |
| 103 | 103 | return $sortable_columns; |
| 104 | 104 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $source_id = $subscription->get_source_id(); |
| 142 | 142 | $source_description = $subscription->get_source_description(); |
| 143 | 143 | |
| 144 | - $source_id_text = '#' . $source_id; |
|
| 144 | + $source_id_text = '#'.$source_id; |
|
| 145 | 145 | |
| 146 | 146 | $source_link = $subscription->get_source_link(); |
| 147 | 147 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $config_id = get_post_meta( $payment->get_id(), '_pronamic_payment_config_id', true ); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if ( isset( $config_id ) && ! empty( $config_id ) ) { |
|
| 184 | + if ( isset( $config_id ) && !empty( $config_id ) ) { |
|
| 185 | 185 | echo get_the_title( $config_id ); |
| 186 | 186 | } else { |
| 187 | 187 | echo '—'; |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * @param WP_Post $post The object for the current post/page. |
| 304 | 304 | */ |
| 305 | 305 | public function meta_box_info( $post ) { |
| 306 | - include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-subscription-info.php'; |
|
| 306 | + include \Pronamic\WordPress\Pay\Plugin::$dirname.'/admin/meta-box-subscription-info.php'; |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | ) |
| 320 | 320 | ); |
| 321 | 321 | |
| 322 | - include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-notes.php'; |
|
| 322 | + include \Pronamic\WordPress\Pay\Plugin::$dirname.'/admin/meta-box-notes.php'; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | * @param WP_Post $post The object for the current post/page. |
| 329 | 329 | */ |
| 330 | 330 | public function meta_box_payments( $post ) { |
| 331 | - include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-subscription-payments.php'; |
|
| 331 | + include \Pronamic\WordPress\Pay\Plugin::$dirname.'/admin/meta-box-subscription-payments.php'; |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | /** |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | public function meta_box_update( $post ) { |
| 340 | 340 | wp_nonce_field( 'pronamic_subscription_update', 'pronamic_subscription_update_nonce' ); |
| 341 | 341 | |
| 342 | - include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-subscription-update.php'; |
|
| 342 | + include \Pronamic\WordPress\Pay\Plugin::$dirname.'/admin/meta-box-subscription-update.php'; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | /** |
@@ -79,15 +79,15 @@ discard block |
||
| 79 | 79 | * email notifications so users can cancel or renew their subscription. |
| 80 | 80 | */ |
| 81 | 81 | public function handle_subscription() { |
| 82 | - if ( ! filter_has_var( INPUT_GET, 'subscription' ) ) { |
|
| 82 | + if ( !filter_has_var( INPUT_GET, 'subscription' ) ) { |
|
| 83 | 83 | return; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if ( ! filter_has_var( INPUT_GET, 'action' ) ) { |
|
| 86 | + if ( !filter_has_var( INPUT_GET, 'action' ) ) { |
|
| 87 | 87 | return; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if ( ! filter_has_var( INPUT_GET, 'key' ) ) { |
|
| 90 | + if ( !filter_has_var( INPUT_GET, 'key' ) ) { |
|
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $key = filter_input( INPUT_GET, 'key', FILTER_SANITIZE_STRING ); |
| 100 | 100 | |
| 101 | 101 | // Check if subscription is valid. |
| 102 | - if ( ! $subscription ) { |
|
| 102 | + if ( !$subscription ) { |
|
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | if ( Statuses::SUCCESS !== $subscription->get_status() ) { |
| 129 | 129 | $payment = $this->start_recurring( $subscription, $gateway, true ); |
| 130 | 130 | |
| 131 | - if ( ! $gateway->has_error() ) { |
|
| 131 | + if ( !$gateway->has_error() ) { |
|
| 132 | 132 | // Redirect. |
| 133 | 133 | $gateway->redirect( $payment ); |
| 134 | 134 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | return; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - if ( ! empty( $subscription->end_date ) && $subscription->end_date <= $subscription->next_payment ) { |
|
| 160 | + if ( !empty( $subscription->end_date ) && $subscription->end_date <= $subscription->next_payment ) { |
|
| 161 | 161 | $subscription->next_payment = null; |
| 162 | 162 | $subscription->status = Statuses::COMPLETED; |
| 163 | 163 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $payment->start_date = $start_date; |
| 200 | 200 | $payment->end_date = $end_date; |
| 201 | 201 | $payment->recurring_type = 'recurring'; |
| 202 | - $payment->recurring = ! $renewal; |
|
| 202 | + $payment->recurring = !$renewal; |
|
| 203 | 203 | |
| 204 | 204 | // Start payment. |
| 205 | 205 | $payment = Plugin::start_payment( $payment, $gateway ); |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | * @return array |
| 243 | 243 | */ |
| 244 | 244 | public function exclude_subscription_comment_notes( $clauses, $query ) { |
| 245 | - $type = $query->query_vars['type']; |
|
| 245 | + $type = $query->query_vars[ 'type' ]; |
|
| 246 | 246 | |
| 247 | 247 | // Ignore subscription notes comments if it's not specifically requested. |
| 248 | 248 | if ( 'subscription_note' !== $type ) { |
| 249 | - $clauses['where'] .= " AND comment_type != 'subscription_note'"; |
|
| 249 | + $clauses[ 'where' ] .= " AND comment_type != 'subscription_note'"; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | return $clauses; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | // Check if there is already subscription attached to the payment. |
| 273 | 273 | $subscription_id = $payment->get_subscription_id(); |
| 274 | 274 | |
| 275 | - if ( ! empty( $subscription_id ) ) { |
|
| 275 | + if ( !empty( $subscription_id ) ) { |
|
| 276 | 276 | // Subscription already created. |
| 277 | 277 | return; |
| 278 | 278 | } |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | delete_post_meta( $post->ID, '_pronamic_subscription_renewal_sent_1week' ); |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | - do_action( 'pronamic_subscription_renewal_notice_' . $subscription->get_source(), $subscription ); |
|
| 478 | + do_action( 'pronamic_subscription_renewal_notice_'.$subscription->get_source(), $subscription ); |
|
| 479 | 479 | |
| 480 | 480 | update_post_meta( $post->ID, '_pronamic_subscription_renewal_sent_1week', $start_date->format( DateTime::MYSQL ) ); |
| 481 | 481 | } |