@@ -30,7 +30,7 @@ |
||
| 30 | 30 | public static function get_default() { |
| 31 | 31 | $timezone_string = get_option( 'timezone_string' ); |
| 32 | 32 | |
| 33 | - if ( ! empty( $timezone_string ) ) { |
|
| 33 | + if ( !empty( $timezone_string ) ) { |
|
| 34 | 34 | return new DateTimeZone( $timezone_string ); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function test_construct() { |
| 26 | 26 | $subscription = new Subscription(); |
| 27 | 27 | |
| 28 | - $this->assertInstanceOf( __NAMESPACE__ . '\Subscription', $subscription ); |
|
| 28 | + $this->assertInstanceOf( __NAMESPACE__.'\Subscription', $subscription ); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public function get_and_set_provider() { |
| 45 | 45 | return array( |
| 46 | - array( 'set_id', 'get_id', uniqid() ), |
|
| 47 | - array( 'set_status', 'get_status', 'completed' ), |
|
| 48 | - array( 'set_transaction_id', 'get_transaction_id', uniqid() ), |
|
| 46 | + array( 'set_id', 'get_id', uniqid() ), |
|
| 47 | + array( 'set_status', 'get_status', 'completed' ), |
|
| 48 | + array( 'set_transaction_id', 'get_transaction_id', uniqid() ), |
|
| 49 | 49 | ); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | return array( |
| 67 | 67 | array( 'set_consumer_name', 'consumer_name', 'John Doe' ), |
| 68 | 68 | array( 'set_consumer_iban', 'consumer_iban', 'NL56 RABO 0108 6347 79' ), |
| 69 | - array( 'set_consumer_bic', 'consumer_bic', 'RABONL2U' ), |
|
| 69 | + array( 'set_consumer_bic', 'consumer_bic', 'RABONL2U' ), |
|
| 70 | 70 | ); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -85,15 +85,15 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | public function get_provider() { |
| 87 | 87 | return array( |
| 88 | - array( 'key', 'get_key', uniqid() ), |
|
| 89 | - array( 'source', 'get_source', 'woocommerce' ), |
|
| 90 | - array( 'source_id', 'get_source_id', '1234' ), |
|
| 91 | - array( 'frequency', 'get_frequency', 'daily' ), |
|
| 92 | - array( 'interval', 'get_interval', '1' ), |
|
| 93 | - array( 'interval_period', 'get_interval_period', 'Y' ), |
|
| 94 | - array( 'description', 'get_description', 'Lorem ipsum dolor sit amet, consectetur.' ), |
|
| 95 | - array( 'currency', 'get_currency', 'EUR' ), |
|
| 96 | - array( 'amount', 'get_amount', 89.95 ), |
|
| 88 | + array( 'key', 'get_key', uniqid() ), |
|
| 89 | + array( 'source', 'get_source', 'woocommerce' ), |
|
| 90 | + array( 'source_id', 'get_source_id', '1234' ), |
|
| 91 | + array( 'frequency', 'get_frequency', 'daily' ), |
|
| 92 | + array( 'interval', 'get_interval', '1' ), |
|
| 93 | + array( 'interval_period', 'get_interval_period', 'Y' ), |
|
| 94 | + array( 'description', 'get_description', 'Lorem ipsum dolor sit amet, consectetur.' ), |
|
| 95 | + array( 'currency', 'get_currency', 'EUR' ), |
|
| 96 | + array( 'amount', 'get_amount', 89.95 ), |
|
| 97 | 97 | ); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | // Gateway settings. |
| 70 | 70 | $this->gateway_settings = new GatewaySettings(); |
| 71 | 71 | |
| 72 | - if ( ! wp_next_scheduled( 'pronamic_pay_license_check' ) ) { |
|
| 72 | + if ( !wp_next_scheduled( 'pronamic_pay_license_check' ) ) { |
|
| 73 | 73 | wp_schedule_event( time(), 'daily', 'pronamic_pay_license_check' ); |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | || |
| 96 | 96 | filter_has_var( INPUT_GET, 'activate-multi' ) |
| 97 | 97 | || |
| 98 | - ! current_user_can( 'manage_options' ) |
|
| 98 | + !current_user_can( 'manage_options' ) |
|
| 99 | 99 | ) { |
| 100 | 100 | return; |
| 101 | 101 | } |
@@ -126,12 +126,12 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $args = wp_parse_args( $args, $defaults ); |
| 128 | 128 | |
| 129 | - $id = $args['label_for']; |
|
| 129 | + $id = $args[ 'label_for' ]; |
|
| 130 | 130 | $value = get_option( $id ); |
| 131 | 131 | |
| 132 | 132 | $legend = sprintf( |
| 133 | 133 | '<legend class="screen-reader-text"><span>%s</span></legend>', |
| 134 | - esc_html( $args['label'] ) |
|
| 134 | + esc_html( $args[ 'label' ] ) |
|
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | 137 | $input = sprintf( |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | '<label for="%s">%s %s</label>', |
| 148 | 148 | esc_attr( $id ), |
| 149 | 149 | $input, |
| 150 | - esc_html( $args['label'] ) |
|
| 150 | + esc_html( $args[ 'label' ] ) |
|
| 151 | 151 | ); |
| 152 | 152 | |
| 153 | 153 | printf( // WPCS: XSS ok. |
@@ -187,9 +187,9 @@ discard block |
||
| 187 | 187 | $output = ''; |
| 188 | 188 | |
| 189 | 189 | // Dropdown. |
| 190 | - $id = $args['name']; |
|
| 191 | - $name = $args['name']; |
|
| 192 | - $selected = $args['selected']; |
|
| 190 | + $id = $args[ 'name' ]; |
|
| 191 | + $name = $args[ 'name' ]; |
|
| 192 | + $selected = $args[ 'selected' ]; |
|
| 193 | 193 | |
| 194 | 194 | if ( false === $selected ) { |
| 195 | 195 | $selected = get_option( $id ); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | esc_attr( $name ) |
| 202 | 202 | ); |
| 203 | 203 | |
| 204 | - $options = \Pronamic\WordPress\Pay\Plugin::get_config_select_options( $args['payment_method'] ); |
|
| 204 | + $options = \Pronamic\WordPress\Pay\Plugin::get_config_select_options( $args[ 'payment_method' ] ); |
|
| 205 | 205 | |
| 206 | 206 | foreach ( $options as $value => $name ) { |
| 207 | 207 | $output .= sprintf( |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $output .= sprintf( '</select>' ); |
| 216 | 216 | |
| 217 | 217 | // Return or echo. |
| 218 | - if ( $args['echo'] ) { |
|
| 218 | + if ( $args[ 'echo' ] ) { |
|
| 219 | 219 | echo $output; // WPCS: XSS ok. |
| 220 | 220 | } else { |
| 221 | 221 | return $output; |
@@ -231,33 +231,33 @@ discard block |
||
| 231 | 231 | private function create_pages( $pages, $parent = null ) { |
| 232 | 232 | foreach ( $pages as $page ) { |
| 233 | 233 | $post = array( |
| 234 | - 'post_title' => $page['post_title'], |
|
| 235 | - 'post_name' => $page['post_title'], |
|
| 236 | - 'post_content' => $page['post_content'], |
|
| 234 | + 'post_title' => $page[ 'post_title' ], |
|
| 235 | + 'post_name' => $page[ 'post_title' ], |
|
| 236 | + 'post_content' => $page[ 'post_content' ], |
|
| 237 | 237 | 'post_status' => 'publish', |
| 238 | 238 | 'post_type' => 'page', |
| 239 | 239 | 'comment_status' => 'closed', |
| 240 | 240 | ); |
| 241 | 241 | |
| 242 | 242 | if ( isset( $parent ) ) { |
| 243 | - $post['post_parent'] = $parent; |
|
| 243 | + $post[ 'post_parent' ] = $parent; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | $result = wp_insert_post( $post, true ); |
| 247 | 247 | |
| 248 | - if ( ! is_wp_error( $result ) ) { |
|
| 249 | - if ( isset( $page['post_meta'] ) ) { |
|
| 250 | - foreach ( $page['post_meta'] as $key => $value ) { |
|
| 248 | + if ( !is_wp_error( $result ) ) { |
|
| 249 | + if ( isset( $page[ 'post_meta' ] ) ) { |
|
| 250 | + foreach ( $page[ 'post_meta' ] as $key => $value ) { |
|
| 251 | 251 | update_post_meta( $result, $key, $value ); |
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if ( isset( $page['option_name'] ) ) { |
|
| 256 | - update_option( $page['option_name'], $result ); |
|
| 255 | + if ( isset( $page[ 'option_name' ] ) ) { |
|
| 256 | + update_option( $page[ 'option_name' ], $result ); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if ( isset( $page['children'] ) ) { |
|
| 260 | - $this->create_pages( $page['children'], $result ); |
|
| 259 | + if ( isset( $page[ 'children' ] ) ) { |
|
| 260 | + $this->create_pages( $page[ 'children' ], $result ); |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -267,11 +267,11 @@ discard block |
||
| 267 | 267 | * Maybe create pages. |
| 268 | 268 | */ |
| 269 | 269 | public function maybe_create_pages() { |
| 270 | - if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_create_pages' ) ) { |
|
| 270 | + if ( !filter_has_var( INPUT_POST, 'pronamic_pay_create_pages' ) ) { |
|
| 271 | 271 | return; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if ( ! check_admin_referer( 'pronamic_pay_settings', 'pronamic_pay_nonce' ) ) { |
|
| 274 | + if ( !check_admin_referer( 'pronamic_pay_settings', 'pronamic_pay_nonce' ) ) { |
|
| 275 | 275 | return; |
| 276 | 276 | } |
| 277 | 277 | |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | // Tippy.js - https://atomiks.github.io/tippyjs/. |
| 377 | 377 | wp_register_script( |
| 378 | 378 | 'tippy.js', |
| 379 | - plugins_url( 'assets/tippy.js/tippy.all' . $min . '.js', \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.4.0', |
| 382 | 382 | true |
@@ -392,14 +392,14 @@ discard block |
||
| 392 | 392 | |
| 393 | 393 | wp_register_style( |
| 394 | 394 | 'pronamic-pay-admin', |
| 395 | - plugins_url( 'css/admin' . $min . '.css', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
| 395 | + plugins_url( 'css/admin'.$min.'.css', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
| 396 | 396 | array( 'pronamic-pay-icons' ), |
| 397 | 397 | $this->plugin->get_version() |
| 398 | 398 | ); |
| 399 | 399 | |
| 400 | 400 | wp_register_script( |
| 401 | 401 | 'pronamic-pay-admin', |
| 402 | - plugins_url( 'js/admin' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
| 402 | + plugins_url( 'js/admin'.$min.'.js', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
| 403 | 403 | array( 'jquery', 'tippy.js' ), |
| 404 | 404 | $this->plugin->get_version(), |
| 405 | 405 | true |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | |
| 468 | 468 | add_menu_page( |
| 469 | 469 | __( 'Pronamic Pay', 'pronamic_ideal' ), |
| 470 | - __( 'Pay', 'pronamic_ideal' ) . $badge, |
|
| 470 | + __( 'Pay', 'pronamic_ideal' ).$badge, |
|
| 471 | 471 | 'edit_payments', |
| 472 | 472 | 'pronamic_ideal', |
| 473 | 473 | array( $this, 'page_dashboard' ), |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | add_submenu_page( |
| 478 | 478 | 'pronamic_ideal', |
| 479 | 479 | __( 'Payments', 'pronamic_ideal' ), |
| 480 | - __( 'Payments', 'pronamic_ideal' ) . $badge, |
|
| 480 | + __( 'Payments', 'pronamic_ideal' ).$badge, |
|
| 481 | 481 | 'edit_payments', |
| 482 | 482 | 'edit.php?post_type=pronamic_payment' |
| 483 | 483 | ); |
@@ -528,8 +528,8 @@ discard block |
||
| 528 | 528 | |
| 529 | 529 | global $submenu; |
| 530 | 530 | |
| 531 | - if ( isset( $submenu['pronamic_ideal'] ) ) { |
|
| 532 | - $submenu['pronamic_ideal'][0][0] = __( 'Dashboard', 'pronamic_ideal' ); // WPCS: override ok. |
|
| 531 | + if ( isset( $submenu[ 'pronamic_ideal' ] ) ) { |
|
| 532 | + $submenu[ 'pronamic_ideal' ][ 0 ][ 0 ] = __( 'Dashboard', 'pronamic_ideal' ); // WPCS: override ok. |
|
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | 535 | |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | public function render_page( $name ) { |
| 564 | 564 | $result = false; |
| 565 | 565 | |
| 566 | - $file = plugin_dir_path( \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 | 568 | if ( is_readable( $file ) ) { |
| 569 | 569 | include $file; |
@@ -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 | /** |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | foreach ( $fields as $id => $field ) { |
| 23 | - $section = $field['section']; |
|
| 23 | + $section = $field[ 'section' ]; |
|
| 24 | 24 | |
| 25 | 25 | $sections_fields[ $section ][ $id ] = $field; |
| 26 | 26 | } |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | <?php |
| 51 | 51 | |
| 52 | 52 | foreach ( $pronamic_pay_providers as $provider ) { |
| 53 | - if ( isset( $provider['integrations'] ) && is_array( $provider['integrations'] ) ) { |
|
| 54 | - printf( '<optgroup label="%s">', esc_attr( $provider['name'] ) ); |
|
| 53 | + if ( isset( $provider[ 'integrations' ] ) && is_array( $provider[ 'integrations' ] ) ) { |
|
| 54 | + printf( '<optgroup label="%s">', esc_attr( $provider[ 'name' ] ) ); |
|
| 55 | 55 | |
| 56 | - foreach ( $provider['integrations'] as $integration ) { |
|
| 56 | + foreach ( $provider[ 'integrations' ] as $integration ) { |
|
| 57 | 57 | $id = $integration->get_id(); |
| 58 | 58 | $name = $integration->get_name(); |
| 59 | 59 | $classes = array(); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $links = array(); |
| 62 | 62 | |
| 63 | 63 | if ( isset( $integration->deprecated ) && $integration->deprecated ) { |
| 64 | - $classes[] = 'deprecated'; |
|
| 64 | + $classes[ ] = 'deprecated'; |
|
| 65 | 65 | |
| 66 | 66 | $name = sprintf( __( '%s (obsoleted)', 'pronamic_ideal' ), $name ); |
| 67 | 67 | |
@@ -74,23 +74,23 @@ discard block |
||
| 74 | 74 | $dashboards = $integration->get_dashboard_url(); |
| 75 | 75 | |
| 76 | 76 | if ( 1 === count( $dashboards ) ) { |
| 77 | - $links[] = sprintf( |
|
| 77 | + $links[ ] = sprintf( |
|
| 78 | 78 | '<a href="%s" title="%s">%2$s</a>', |
| 79 | - esc_attr( $dashboards[0] ), |
|
| 79 | + esc_attr( $dashboards[ 0 ] ), |
|
| 80 | 80 | __( 'Dashboard', 'pronamic_ideal' ) |
| 81 | 81 | ); |
| 82 | 82 | } elseif ( count( $dashboards ) > 1 ) { |
| 83 | 83 | $dashboard_urls = array(); |
| 84 | 84 | |
| 85 | 85 | foreach ( $dashboards as $dashboard_name => $dashboard_url ) { |
| 86 | - $dashboard_urls[] = sprintf( |
|
| 86 | + $dashboard_urls[ ] = sprintf( |
|
| 87 | 87 | '<a href="%s" title="%s">%2$s</a>', |
| 88 | 88 | esc_attr( $dashboard_url ), |
| 89 | 89 | esc_html( ucfirst( $dashboard_name ) ) |
| 90 | 90 | ); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $links[] = sprintf( |
|
| 93 | + $links[ ] = sprintf( |
|
| 94 | 94 | '%s: %s', |
| 95 | 95 | __( 'Dashboards', 'pronamic_ideal' ), |
| 96 | 96 | strtolower( implode( ', ', $dashboard_urls ) ) |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // Product link. |
| 101 | 101 | if ( $integration->get_product_url() ) { |
| 102 | - $links[] = sprintf( |
|
| 102 | + $links[ ] = sprintf( |
|
| 103 | 103 | '<a href="%s" target="_blank" title="%s">%2$s</a>', |
| 104 | 104 | $integration->get_product_url(), |
| 105 | 105 | __( 'Product information', 'pronamic_ideal' ) |
@@ -139,34 +139,34 @@ discard block |
||
| 139 | 139 | <?php |
| 140 | 140 | |
| 141 | 141 | $classes = array(); |
| 142 | - if ( isset( $section['methods'] ) ) { |
|
| 143 | - $classes[] = 'pronamic-pay-tab'; |
|
| 144 | - $classes[] = 'pronamic-pay-cloack'; |
|
| 145 | - $classes[] = 'extra-settings'; |
|
| 142 | + if ( isset( $section[ 'methods' ] ) ) { |
|
| 143 | + $classes[ ] = 'pronamic-pay-tab'; |
|
| 144 | + $classes[ ] = 'pronamic-pay-cloack'; |
|
| 145 | + $classes[ ] = 'extra-settings'; |
|
| 146 | 146 | |
| 147 | - foreach ( $section['methods'] as $method ) { |
|
| 148 | - $classes[] = 'setting-' . $method; |
|
| 147 | + foreach ( $section[ 'methods' ] as $method ) { |
|
| 148 | + $classes[ ] = 'setting-'.$method; |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | ?> |
| 153 | 153 | |
| 154 | 154 | <div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>"> |
| 155 | - <?php if ( ! empty( $section['title'] ) || ! empty( $section['description'] ) ) : ?> |
|
| 155 | + <?php if ( !empty( $section[ 'title' ] ) || !empty( $section[ 'description' ] ) ) : ?> |
|
| 156 | 156 | |
| 157 | 157 | <div class="pronamic-pay-tab-block gateway-config-section-header"> |
| 158 | - <?php if ( ! empty( $section['title'] ) ) : ?> |
|
| 158 | + <?php if ( !empty( $section[ 'title' ] ) ) : ?> |
|
| 159 | 159 | |
| 160 | - <h4 class="pronamic-pay-cloack"><?php echo esc_html( $section['title'] ); ?></h4> |
|
| 160 | + <h4 class="pronamic-pay-cloack"><?php echo esc_html( $section[ 'title' ] ); ?></h4> |
|
| 161 | 161 | |
| 162 | 162 | <?php endif; ?> |
| 163 | 163 | |
| 164 | - <?php if ( ! empty( $section['description'] ) ) : ?> |
|
| 164 | + <?php if ( !empty( $section[ 'description' ] ) ) : ?> |
|
| 165 | 165 | |
| 166 | 166 | <p> |
| 167 | 167 | <?php |
| 168 | 168 | |
| 169 | - echo $section['description']; // WPCS: XSS ok. |
|
| 169 | + echo $section[ 'description' ]; // WPCS: XSS ok. |
|
| 170 | 170 | |
| 171 | 171 | ?> |
| 172 | 172 | </p> |
@@ -183,23 +183,23 @@ discard block |
||
| 183 | 183 | foreach ( $sections_fields[ $id ] as $field ) : |
| 184 | 184 | |
| 185 | 185 | $classes = array(); |
| 186 | - if ( isset( $field['methods'] ) ) { |
|
| 187 | - $classes[] = 'pronamic-pay-cloack'; |
|
| 188 | - $classes[] = 'extra-settings'; |
|
| 186 | + if ( isset( $field[ 'methods' ] ) ) { |
|
| 187 | + $classes[ ] = 'pronamic-pay-cloack'; |
|
| 188 | + $classes[ ] = 'extra-settings'; |
|
| 189 | 189 | |
| 190 | - foreach ( $field['methods'] as $method ) { |
|
| 191 | - $classes[] = 'setting-' . $method; |
|
| 190 | + foreach ( $field[ 'methods' ] as $method ) { |
|
| 191 | + $classes[ ] = 'setting-'.$method; |
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if ( isset( $field['group'] ) ) { |
|
| 196 | - $classes[] = $field['group']; |
|
| 195 | + if ( isset( $field[ 'group' ] ) ) { |
|
| 196 | + $classes[ ] = $field[ 'group' ]; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if ( isset( $field['id'] ) ) { |
|
| 200 | - $id = $field['id']; |
|
| 201 | - } elseif ( isset( $field['meta_key'] ) ) { |
|
| 202 | - $id = $field['meta_key']; |
|
| 199 | + if ( isset( $field[ 'id' ] ) ) { |
|
| 200 | + $id = $field[ 'id' ]; |
|
| 201 | + } elseif ( isset( $field[ 'meta_key' ] ) ) { |
|
| 202 | + $id = $field[ 'meta_key' ]; |
|
| 203 | 203 | } else { |
| 204 | 204 | $id = uniqid(); |
| 205 | 205 | } |
@@ -207,19 +207,19 @@ discard block |
||
| 207 | 207 | ?> |
| 208 | 208 | <tr class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>"> |
| 209 | 209 | |
| 210 | - <?php if ( 'html' !== $field['type'] ) { ?> |
|
| 210 | + <?php if ( 'html' !== $field[ 'type' ] ) { ?> |
|
| 211 | 211 | |
| 212 | 212 | <th scope="row"> |
| 213 | 213 | <label for="<?php echo esc_attr( $id ); ?>"> |
| 214 | - <?php echo esc_html( $field['title'] ); ?> |
|
| 214 | + <?php echo esc_html( $field[ 'title' ] ); ?> |
|
| 215 | 215 | </label> |
| 216 | 216 | |
| 217 | 217 | <?php |
| 218 | 218 | |
| 219 | - if ( isset( $field['tooltip'] ) && ! empty( $field['tooltip'] ) ) { |
|
| 219 | + if ( isset( $field[ 'tooltip' ] ) && !empty( $field[ 'tooltip' ] ) ) { |
|
| 220 | 220 | printf( |
| 221 | 221 | '<span class="dashicons dashicons-editor-help pronamic-pay-tip" title="%s"></span>', |
| 222 | - esc_attr( $field['tooltip'] ) |
|
| 222 | + esc_attr( $field[ 'tooltip' ] ) |
|
| 223 | 223 | ); |
| 224 | 224 | } |
| 225 | 225 | |
@@ -228,59 +228,59 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | <?php } ?> |
| 230 | 230 | |
| 231 | - <td <?php if ( 'html' === $field['type'] ) : ?>colspan="2"<?php endif; ?>> |
|
| 231 | + <td <?php if ( 'html' === $field[ 'type' ] ) : ?>colspan="2"<?php endif; ?>> |
|
| 232 | 232 | <?php |
| 233 | 233 | |
| 234 | 234 | $attributes = array(); |
| 235 | - $attributes['id'] = $id; |
|
| 236 | - $attributes['name'] = $id; |
|
| 235 | + $attributes[ 'id' ] = $id; |
|
| 236 | + $attributes[ 'name' ] = $id; |
|
| 237 | 237 | |
| 238 | 238 | $classes = array(); |
| 239 | - if ( isset( $field['classes'] ) ) { |
|
| 240 | - $classes = $field['classes']; |
|
| 239 | + if ( isset( $field[ 'classes' ] ) ) { |
|
| 240 | + $classes = $field[ 'classes' ]; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - if ( isset( $field['readonly'] ) && $field['readonly'] ) { |
|
| 244 | - $attributes['readonly'] = 'readonly'; |
|
| 243 | + if ( isset( $field[ 'readonly' ] ) && $field[ 'readonly' ] ) { |
|
| 244 | + $attributes[ 'readonly' ] = 'readonly'; |
|
| 245 | 245 | |
| 246 | - $classes[] = 'readonly'; |
|
| 246 | + $classes[ ] = 'readonly'; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if ( isset( $field['size'] ) ) { |
|
| 250 | - $attributes['size'] = $field['size']; |
|
| 249 | + if ( isset( $field[ 'size' ] ) ) { |
|
| 250 | + $attributes[ 'size' ] = $field[ 'size' ]; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - if ( in_array( $field['type'], array( 'text', 'password', 'textarea', 'select' ), true ) ) { |
|
| 254 | - $classes[] = 'pronamic-pay-form-control'; |
|
| 253 | + if ( in_array( $field[ 'type' ], array( 'text', 'password', 'textarea', 'select' ), true ) ) { |
|
| 254 | + $classes[ ] = 'pronamic-pay-form-control'; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - if ( in_array( $field['type'], array( 'textarea' ), true ) ) { |
|
| 258 | - $classes[] = 'pronamic-pay-form-control-lg'; |
|
| 257 | + if ( in_array( $field[ 'type' ], array( 'textarea' ), true ) ) { |
|
| 258 | + $classes[ ] = 'pronamic-pay-form-control-lg'; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - if ( ! empty( $classes ) ) { |
|
| 262 | - $attributes['class'] = implode( ' ', $classes ); |
|
| 261 | + if ( !empty( $classes ) ) { |
|
| 262 | + $attributes[ 'class' ] = implode( ' ', $classes ); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | $value = ''; |
| 266 | - if ( isset( $field['meta_key'] ) ) { |
|
| 267 | - $attributes['name'] = $field['meta_key']; |
|
| 266 | + if ( isset( $field[ 'meta_key' ] ) ) { |
|
| 267 | + $attributes[ 'name' ] = $field[ 'meta_key' ]; |
|
| 268 | 268 | |
| 269 | - $value = get_post_meta( get_the_ID(), $field['meta_key'], true ); |
|
| 270 | - } elseif ( isset( $field['value'] ) ) { |
|
| 271 | - $value = $field['value']; |
|
| 269 | + $value = get_post_meta( get_the_ID(), $field[ 'meta_key' ], true ); |
|
| 270 | + } elseif ( isset( $field[ 'value' ] ) ) { |
|
| 271 | + $value = $field[ 'value' ]; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | // Set default. |
| 275 | - if ( empty( $value ) && isset( $field['default'] ) ) { |
|
| 276 | - $value = $field['default']; |
|
| 275 | + if ( empty( $value ) && isset( $field[ 'default' ] ) ) { |
|
| 276 | + $value = $field[ 'default' ]; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - switch ( $field['type'] ) { |
|
| 279 | + switch ( $field[ 'type' ] ) { |
|
| 280 | 280 | case 'text': |
| 281 | 281 | case 'password': |
| 282 | - $attributes['type'] = $field['type']; |
|
| 283 | - $attributes['value'] = $value; |
|
| 282 | + $attributes[ 'type' ] = $field[ 'type' ]; |
|
| 283 | + $attributes[ 'value' ] = $value; |
|
| 284 | 284 | |
| 285 | 285 | printf( |
| 286 | 286 | '<input %s />', |
@@ -291,8 +291,8 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | break; |
| 293 | 293 | case 'checkbox': |
| 294 | - $attributes['type'] = $field['type']; |
|
| 295 | - $attributes['value'] = '1'; |
|
| 294 | + $attributes[ 'type' ] = $field[ 'type' ]; |
|
| 295 | + $attributes[ 'value' ] = '1'; |
|
| 296 | 296 | |
| 297 | 297 | printf( |
| 298 | 298 | '<input %s %s />', |
@@ -306,14 +306,14 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | printf( |
| 308 | 308 | '<label for="%s">%s</label>', |
| 309 | - esc_attr( $attributes['id'] ), |
|
| 310 | - esc_html( $field['label'] ) |
|
| 309 | + esc_attr( $attributes[ 'id' ] ), |
|
| 310 | + esc_html( $field[ 'label' ] ) |
|
| 311 | 311 | ); |
| 312 | 312 | |
| 313 | 313 | break; |
| 314 | 314 | case 'textarea': |
| 315 | - $attributes['rows'] = 4; |
|
| 316 | - $attributes['cols'] = 65; |
|
| 315 | + $attributes[ 'rows' ] = 4; |
|
| 316 | + $attributes[ 'cols' ] = 65; |
|
| 317 | 317 | |
| 318 | 318 | printf( |
| 319 | 319 | '<textarea %s />%s</textarea>', |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | break; |
| 327 | 327 | case 'file': |
| 328 | - $attributes['type'] = 'file'; |
|
| 328 | + $attributes[ 'type' ] = 'file'; |
|
| 329 | 329 | |
| 330 | 330 | printf( |
| 331 | 331 | '<input %s />', |
@@ -340,22 +340,22 @@ discard block |
||
| 340 | 340 | '<select %s>%s</select>', |
| 341 | 341 | // @codingStandardsIgnoreStart |
| 342 | 342 | Util::array_to_html_attributes( $attributes ), |
| 343 | - Util::select_options_grouped( $field['options'], $value ) |
|
| 343 | + Util::select_options_grouped( $field[ 'options' ], $value ) |
|
| 344 | 344 | // @codingStandardsIgnoreEnd |
| 345 | 345 | ); |
| 346 | 346 | |
| 347 | 347 | break; |
| 348 | 348 | case 'optgroup': |
| 349 | 349 | printf( '<fieldset>' ); |
| 350 | - printf( '<legend class="screen-reader-text">%s</legend>', esc_html( $field['title'] ) ); |
|
| 350 | + printf( '<legend class="screen-reader-text">%s</legend>', esc_html( $field[ 'title' ] ) ); |
|
| 351 | 351 | |
| 352 | - foreach ( $field['options'] as $key => $label ) { |
|
| 352 | + foreach ( $field[ 'options' ] as $key => $label ) { |
|
| 353 | 353 | printf( |
| 354 | 354 | '<label>%s %s</label><br />', |
| 355 | 355 | sprintf( |
| 356 | 356 | '<input type="radio" value="%s" name="%s" %s />', |
| 357 | 357 | esc_attr( $key ), |
| 358 | - esc_attr( $attributes['name'] ), |
|
| 358 | + esc_attr( $attributes[ 'name' ] ), |
|
| 359 | 359 | checked( $value, $key, false ) |
| 360 | 360 | ), |
| 361 | 361 | esc_html( $label ) |
@@ -365,26 +365,26 @@ discard block |
||
| 365 | 365 | break; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - if ( isset( $field['html'] ) ) { |
|
| 369 | - if ( 'description' !== $field['type'] && isset( $field['title'] ) && ! empty( $field['title'] ) ) { |
|
| 368 | + if ( isset( $field[ 'html' ] ) ) { |
|
| 369 | + if ( 'description' !== $field[ 'type' ] && isset( $field[ 'title' ] ) && !empty( $field[ 'title' ] ) ) { |
|
| 370 | 370 | printf( |
| 371 | 371 | '<strong>%s</strong><br>', |
| 372 | - esc_html( $field['title'] ) |
|
| 372 | + esc_html( $field[ 'title' ] ) |
|
| 373 | 373 | ); |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - echo $field['html']; // WPCS: XSS ok. |
|
| 376 | + echo $field[ 'html' ]; // WPCS: XSS ok. |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if ( isset( $field['description'] ) ) { |
|
| 379 | + if ( isset( $field[ 'description' ] ) ) { |
|
| 380 | 380 | printf( // WPCS: XSS ok. |
| 381 | 381 | '<p class="pronamic-pay-description description">%s</p>', |
| 382 | - $field['description'] |
|
| 382 | + $field[ 'description' ] |
|
| 383 | 383 | ); |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - if ( isset( $field['callback'] ) ) { |
|
| 387 | - $callback = $field['callback']; |
|
| 386 | + if ( isset( $field[ 'callback' ] ) ) { |
|
| 387 | + $callback = $field[ 'callback' ]; |
|
| 388 | 388 | |
| 389 | 389 | call_user_func( $callback, $field ); |
| 390 | 390 | } |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | * @return array |
| 196 | 196 | */ |
| 197 | 197 | public function exclude_comment_notes( $clauses, $query ) { |
| 198 | - $type = $query->query_vars['type']; |
|
| 198 | + $type = $query->query_vars[ 'type' ]; |
|
| 199 | 199 | |
| 200 | 200 | // Ignore payment notes comments if it's not specifically requested. |
| 201 | 201 | if ( 'payment_note' !== $type ) { |
| 202 | - $clauses['where'] .= " AND comment_type != 'payment_note'"; |
|
| 202 | + $clauses[ 'where' ] .= " AND comment_type != 'payment_note'"; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | return $clauses; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | break; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if ( ! empty( $page_id ) ) { |
|
| 246 | + if ( !empty( $page_id ) ) { |
|
| 247 | 247 | $page_url = get_permalink( $page_id ); |
| 248 | 248 | |
| 249 | 249 | if ( false !== $page_url ) { |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * Handle returns. |
| 307 | 307 | */ |
| 308 | 308 | public function handle_returns() { |
| 309 | - if ( ! filter_has_var( INPUT_GET, 'payment' ) ) { |
|
| 309 | + if ( !filter_has_var( INPUT_GET, 'payment' ) ) { |
|
| 310 | 310 | return; |
| 311 | 311 | } |
| 312 | 312 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | $valid_key = ( $key === $payment->key ); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - if ( ! $valid_key ) { |
|
| 328 | + if ( !$valid_key ) { |
|
| 329 | 329 | wp_redirect( home_url() ); |
| 330 | 330 | |
| 331 | 331 | exit; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | * Maybe redirect. |
| 354 | 354 | */ |
| 355 | 355 | public function maybe_redirect() { |
| 356 | - if ( ! filter_has_var( INPUT_GET, 'payment_redirect' ) ) { |
|
| 356 | + if ( !filter_has_var( INPUT_GET, 'payment_redirect' ) ) { |
|
| 357 | 357 | return; |
| 358 | 358 | } |
| 359 | 359 | |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | // HTML Answer. |
| 365 | 365 | $html_answer = $payment->get_meta( 'ogone_directlink_html_answer' ); |
| 366 | 366 | |
| 367 | - if ( ! empty( $html_answer ) ) { |
|
| 367 | + if ( !empty( $html_answer ) ) { |
|
| 368 | 368 | echo $html_answer; // WPCS: XSS ok. |
| 369 | 369 | |
| 370 | 370 | exit; |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | |
| 373 | 373 | $redirect_message = $payment->get_meta( 'payment_redirect_message' ); |
| 374 | 374 | |
| 375 | - if ( ! empty( $redirect_message ) ) { |
|
| 375 | + if ( !empty( $redirect_message ) ) { |
|
| 376 | 376 | $key = filter_input( INPUT_GET, 'key', FILTER_SANITIZE_STRING ); |
| 377 | 377 | |
| 378 | 378 | if ( $key !== $payment->key ) { |
@@ -383,29 +383,29 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | // @see https://github.com/woothemes/woocommerce/blob/2.3.11/includes/class-wc-cache-helper.php |
| 385 | 385 | // @see https://www.w3-edge.com/products/w3-total-cache/ |
| 386 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
| 386 | + if ( !defined( 'DONOTCACHEPAGE' ) ) { |
|
| 387 | 387 | define( 'DONOTCACHEPAGE', true ); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
| 390 | + if ( !defined( 'DONOTCACHEDB' ) ) { |
|
| 391 | 391 | define( 'DONOTCACHEDB', true ); |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - if ( ! defined( 'DONOTMINIFY' ) ) { |
|
| 394 | + if ( !defined( 'DONOTMINIFY' ) ) { |
|
| 395 | 395 | define( 'DONOTMINIFY', true ); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - if ( ! defined( 'DONOTCDN' ) ) { |
|
| 398 | + if ( !defined( 'DONOTCDN' ) ) { |
|
| 399 | 399 | define( 'DONOTCDN', true ); |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - if ( ! defined( 'DONOTCACHEOBJECT' ) ) { |
|
| 402 | + if ( !defined( 'DONOTCACHEOBJECT' ) ) { |
|
| 403 | 403 | define( 'DONOTCACHEOBJECT', true ); |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | nocache_headers(); |
| 407 | 407 | |
| 408 | - include Plugin::$dirname . '/views/redirect-message.php'; |
|
| 408 | + include Plugin::$dirname.'/views/redirect-message.php'; |
|
| 409 | 409 | |
| 410 | 410 | exit; |
| 411 | 411 | } |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | } |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | - if ( ! empty( $payment->action_url ) ) { |
|
| 427 | + if ( !empty( $payment->action_url ) ) { |
|
| 428 | 428 | wp_redirect( $payment->action_url ); |
| 429 | 429 | |
| 430 | 430 | exit; |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | */ |
| 454 | 454 | public function plugins_loaded() { |
| 455 | 455 | // Load plugin text domain. |
| 456 | - $rel_path = dirname( plugin_basename( self::$file ) ) . '/languages/'; |
|
| 456 | + $rel_path = dirname( plugin_basename( self::$file ) ).'/languages/'; |
|
| 457 | 457 | |
| 458 | 458 | load_plugin_textdomain( 'pronamic_ideal', false, $rel_path ); |
| 459 | 459 | |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | break; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - $args['meta_query'] = array( |
|
| 683 | + $args[ 'meta_query' ] = array( |
|
| 684 | 684 | array( |
| 685 | 685 | 'key' => '_pronamic_gateway_id', |
| 686 | 686 | 'value' => $gateways, |
@@ -727,12 +727,12 @@ discard block |
||
| 727 | 727 | * @param array $errors An array with errors to render. |
| 728 | 728 | */ |
| 729 | 729 | public static function render_errors( $errors = array() ) { |
| 730 | - if ( ! is_array( $errors ) ) { |
|
| 730 | + if ( !is_array( $errors ) ) { |
|
| 731 | 731 | $errors = array( $errors ); |
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | foreach ( $errors as $error ) { |
| 735 | - include Plugin::$dirname . '/views/error.php'; |
|
| 735 | + include Plugin::$dirname.'/views/error.php'; |
|
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | |
@@ -892,9 +892,9 @@ discard block |
||
| 892 | 892 | $payment->subscription_id = $data->get_subscription_id(); |
| 893 | 893 | $payment->set_credit_card( $data->get_credit_card() ); |
| 894 | 894 | // User Agent (@see https://github.com/WordPress/WordPress/blob/4.9.4/wp-includes/comment.php#L1962-L1965) |
| 895 | - $payment->user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : null; |
|
| 895 | + $payment->user_agent = isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? $_SERVER[ 'HTTP_USER_AGENT' ] : null; |
|
| 896 | 896 | // IP (@see https://github.com/WordPress/WordPress/blob/4.9.4/wp-includes/comment.php#L1957-L1960) |
| 897 | - $payment->user_ip = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : null; |
|
| 897 | + $payment->user_ip = isset( $_SERVER[ 'REMOTE_ADDR' ] ) ? $_SERVER[ 'REMOTE_ADDR' ] : null; |
|
| 898 | 898 | |
| 899 | 899 | return self::start_payment( $payment, $gateway ); |
| 900 | 900 | } |
@@ -924,7 +924,7 @@ discard block |
||
| 924 | 924 | $subscription = $payment->get_subscription(); |
| 925 | 925 | |
| 926 | 926 | if ( $subscription ) { |
| 927 | - if ( ! $payment->get_recurring() ) { |
|
| 927 | + if ( !$payment->get_recurring() ) { |
|
| 928 | 928 | // First payment. |
| 929 | 929 | // Cancel subscription to prevent unwanted recurring payments in the future, |
| 930 | 930 | // when a valid customer ID might be set for the user. |
@@ -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 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $payment->start_date = $start_date; |
| 198 | 198 | $payment->end_date = $end_date; |
| 199 | 199 | $payment->recurring_type = 'recurring'; |
| 200 | - $payment->recurring = ! $renewal; |
|
| 200 | + $payment->recurring = !$renewal; |
|
| 201 | 201 | |
| 202 | 202 | // Start payment. |
| 203 | 203 | $payment = Plugin::start_payment( $payment, $gateway ); |
@@ -240,11 +240,11 @@ discard block |
||
| 240 | 240 | * @return array |
| 241 | 241 | */ |
| 242 | 242 | public function exclude_subscription_comment_notes( $clauses, $query ) { |
| 243 | - $type = $query->query_vars['type']; |
|
| 243 | + $type = $query->query_vars[ 'type' ]; |
|
| 244 | 244 | |
| 245 | 245 | // Ignore subscription notes comments if it's not specifically requested. |
| 246 | 246 | if ( 'subscription_note' !== $type ) { |
| 247 | - $clauses['where'] .= " AND comment_type != 'subscription_note'"; |
|
| 247 | + $clauses[ 'where' ] .= " AND comment_type != 'subscription_note'"; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | return $clauses; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | // Check if there is already subscription attached to the payment. |
| 271 | 271 | $subscription_id = $payment->get_subscription_id(); |
| 272 | 272 | |
| 273 | - if ( ! empty( $subscription_id ) ) { |
|
| 273 | + if ( !empty( $subscription_id ) ) { |
|
| 274 | 274 | // Subscription already created. |
| 275 | 275 | return; |
| 276 | 276 | } |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | delete_post_meta( $post->ID, '_pronamic_subscription_renewal_sent_1week' ); |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - do_action( 'pronamic_subscription_renewal_notice_' . $subscription->get_source(), $subscription ); |
|
| 476 | + do_action( 'pronamic_subscription_renewal_notice_'.$subscription->get_source(), $subscription ); |
|
| 477 | 477 | |
| 478 | 478 | update_post_meta( $post->ID, '_pronamic_subscription_renewal_sent_1week', $start_date->format( DateTime::MYSQL ) ); |
| 479 | 479 | } |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | // The status of canceled or completed subscriptions will not be changed automatically. |
| 521 | - if ( ! in_array( $status_before, array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
| 521 | + if ( !in_array( $status_before, array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
| 522 | 522 | $subscription->set_status( $status_update ); |
| 523 | 523 | |
| 524 | 524 | if ( $status_before !== $status_update ) { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $classes = apply_filters( 'pronamic_pay_gateway_settings', array() ); |
| 40 | 40 | |
| 41 | 41 | foreach ( $classes as $class ) { |
| 42 | - $this->settings[] = new $class(); |
|
| 42 | + $this->settings[ ] = new $class(); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $gateway_id = get_post_meta( $config_id, '_pronamic_gateway_id', true ); |
| 66 | 66 | |
| 67 | 67 | // Payment methods. |
| 68 | - $sections['payment_methods'] = array( |
|
| 68 | + $sections[ 'payment_methods' ] = array( |
|
| 69 | 69 | 'title' => __( 'Payment Methods', 'pronamic_ideal' ), |
| 70 | 70 | 'methods' => array( |
| 71 | 71 | $gateway_id, |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | 108 | // Payment methods. |
| 109 | - $fields[] = array( |
|
| 109 | + $fields[ ] = array( |
|
| 110 | 110 | 'section' => 'payment_methods', |
| 111 | 111 | 'type' => 'html', |
| 112 | 112 | 'callback' => array( $this, 'gateway_payment_methods' ), |
@@ -149,6 +149,6 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | array_multisort( $sort, $sort_flags, $payment_methods ); |
| 151 | 151 | |
| 152 | - require Plugin::$dirname . '/admin/meta-box-gateway-config-payment-methods.php'; |
|
| 152 | + require Plugin::$dirname.'/admin/meta-box-gateway-config-payment-methods.php'; |
|
| 153 | 153 | } |
| 154 | 154 | } |