@@ -160,7 +160,7 @@ |
||
| 160 | 160 | * @return object|string |
| 161 | 161 | */ |
| 162 | 162 | private static function post_to_connect_server( $action, $additional_body = array() ) { |
| 163 | - $body = array( |
|
| 163 | + $body = array( |
|
| 164 | 164 | 'frm_square_api_action' => $action, |
| 165 | 165 | 'frm_square_api_mode' => FrmSquareLiteAppHelper::active_mode(), |
| 166 | 166 | ); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public static function show_status( $status ) { |
| 68 | 68 | $statuses = array_merge( self::get_payment_statuses(), self::get_subscription_statuses() ); |
| 69 | - return isset( $statuses[ $status ] ) ? $statuses[ $status ] : $status; |
|
| 69 | + return isset( $statuses[$status] ) ? $statuses[$status] : $status; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public static function get_action_setting( $option, $atts ) { |
| 154 | 154 | $settings = self::get_action_settings( $atts ); |
| 155 | - $value = isset( $settings[ $option ] ) ? $settings[ $option ] : ''; |
|
| 155 | + $value = isset( $settings[$option] ) ? $settings[$option] : ''; |
|
| 156 | 156 | return $value; |
| 157 | 157 | } |
| 158 | 158 | |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | public static function get_repeat_label_from_value( $value, $number ) { |
| 257 | 257 | $times = self::get_plural_repeat_times( $number ); |
| 258 | - if ( isset( $times[ $value ] ) ) { |
|
| 259 | - $value = $times[ $value ]; |
|
| 258 | + if ( isset( $times[$value] ) ) { |
|
| 259 | + $value = $times[$value]; |
|
| 260 | 260 | } |
| 261 | 261 | return $value; |
| 262 | 262 | } |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | $count = 0; |
| 505 | 505 | foreach ( $payments as $payment ) { |
| 506 | 506 | if ( $payment->status === 'complete' ) { |
| 507 | - $count++; |
|
| 507 | + $count ++; |
|
| 508 | 508 | } |
| 509 | 509 | } |
| 510 | 510 | |
@@ -526,8 +526,8 @@ discard block |
||
| 526 | 526 | if ( is_array( $gateway ) ) { |
| 527 | 527 | $gateway = reset( $gateway ); |
| 528 | 528 | } |
| 529 | - if ( isset( $gateways[ $gateway ] ) ) { |
|
| 530 | - $value = $gateways[ $gateway ][ $setting ]; |
|
| 529 | + if ( isset( $gateways[$gateway] ) ) { |
|
| 530 | + $value = $gateways[$gateway][$setting]; |
|
| 531 | 531 | } |
| 532 | 532 | return $value; |
| 533 | 533 | } |
@@ -29,10 +29,10 @@ |
||
| 29 | 29 | // This filter hides gateway fields from the entries list. |
| 30 | 30 | add_filter( |
| 31 | 31 | 'frm_fields_in_entries_list_table', |
| 32 | - function ( $form_cols ) { |
|
| 32 | + function( $form_cols ) { |
|
| 33 | 33 | return array_filter( |
| 34 | 34 | $form_cols, |
| 35 | - function ( $form_col ) { |
|
| 35 | + function( $form_col ) { |
|
| 36 | 36 | return 'gateway' !== $form_col->type; |
| 37 | 37 | } |
| 38 | 38 | ); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $gateway = $payment_action->post_content['gateway']; |
| 70 | 70 | $is_stripe = $gateway === 'stripe' || ( is_array( $gateway ) && in_array( 'stripe', $gateway, true ) ); |
| 71 | 71 | if ( ! $is_stripe || empty( $payment_action->post_content['amount'] ) ) { |
| 72 | - unset( $payment_actions[ $k ] ); |
|
| 72 | + unset( $payment_actions[$k] ); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | return $payment_actions; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | 'run_triggers' => false, |
| 107 | 107 | 'show_errors' => true, |
| 108 | 108 | ); |
| 109 | - $atts = compact( 'action', 'entry', 'form' ); |
|
| 109 | + $atts = compact( 'action', 'entry', 'form' ); |
|
| 110 | 110 | |
| 111 | 111 | $amount = self::prepare_amount( $action->post_content['amount'], $atts ); |
| 112 | 112 | if ( empty( $amount ) || $amount == 000 ) { |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | |
| 294 | 294 | // Gateway is a radio button but it should always be an array in the database for |
| 295 | 295 | // compatibility with the payments submodule where it is a checkbox. |
| 296 | - $settings['gateway'] = ! empty( $settings['gateway'] ) ? (array) $settings['gateway'] : array( 'stripe' ); |
|
| 296 | + $settings['gateway'] = ! empty( $settings['gateway'] ) ? (array) $settings['gateway'] : array( 'stripe' ); |
|
| 297 | 297 | |
| 298 | 298 | $is_stripe = in_array( 'stripe', $settings['gateway'], true ); |
| 299 | 299 | if ( ! $is_stripe ) { |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | $disallowed = array( ';', ':', '!important' ); |
| 506 | 506 | foreach ( $settings as $k => $s ) { |
| 507 | 507 | if ( is_string( $s ) ) { |
| 508 | - $settings[ $k ] = str_replace( $disallowed, '', $s ); |
|
| 508 | + $settings[$k] = str_replace( $disallowed, '', $s ); |
|
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | |
@@ -629,18 +629,18 @@ discard block |
||
| 629 | 629 | * @return array |
| 630 | 630 | */ |
| 631 | 631 | public static function remove_cc_validation( $errors, $field, $values ) { |
| 632 | - $has_processed = isset( $_POST[ 'frmintent' . $field->form_id ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 632 | + $has_processed = isset( $_POST['frmintent' . $field->form_id] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 633 | 633 | if ( ! $has_processed ) { |
| 634 | 634 | return $errors; |
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | $field_id = isset( $field->temp_id ) ? $field->temp_id : $field->id; |
| 638 | 638 | |
| 639 | - if ( isset( $errors[ 'field' . $field_id . '-cc' ] ) ) { |
|
| 640 | - unset( $errors[ 'field' . $field_id . '-cc' ] ); |
|
| 639 | + if ( isset( $errors['field' . $field_id . '-cc'] ) ) { |
|
| 640 | + unset( $errors['field' . $field_id . '-cc'] ); |
|
| 641 | 641 | } |
| 642 | - if ( isset( $errors[ 'field' . $field_id ] ) ) { |
|
| 643 | - unset( $errors[ 'field' . $field_id ] ); |
|
| 642 | + if ( isset( $errors['field' . $field_id] ) ) { |
|
| 643 | + unset( $errors['field' . $field_id] ); |
|
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | return $errors; |
@@ -82,12 +82,12 @@ |
||
| 82 | 82 | $settings = $this->default_options(); |
| 83 | 83 | |
| 84 | 84 | foreach ( $settings as $setting => $default ) { |
| 85 | - if ( isset( $params[ 'frm_' . $this->param() . '_' . $setting ] ) ) { |
|
| 86 | - $this->settings->{$setting} = trim( sanitize_text_field( $params[ 'frm_' . $this->param() . '_' . $setting ] ) ); |
|
| 85 | + if ( isset( $params['frm_' . $this->param() . '_' . $setting] ) ) { |
|
| 86 | + $this->settings->{$setting} = trim( sanitize_text_field( $params['frm_' . $this->param() . '_' . $setting] ) ); |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - $this->settings->test_mode = isset( $params[ 'frm_' . $this->param() . '_test_mode' ] ) ? absint( $params[ 'frm_' . $this->param() . '_test_mode' ] ) : 0; |
|
| 90 | + $this->settings->test_mode = isset( $params['frm_' . $this->param() . '_test_mode'] ) ? absint( $params['frm_' . $this->param() . '_test_mode'] ) : 0; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -123,9 +123,9 @@ discard block |
||
| 123 | 123 | $address_setting = $action->post_content['billing_address']; |
| 124 | 124 | |
| 125 | 125 | $entry = self::generate_false_entry(); |
| 126 | - $first_name = $first_name_setting && isset( $entry->metas[ $first_name_setting ] ) ? $entry->metas[ $first_name_setting ] : ''; |
|
| 127 | - $last_name = $last_name_setting && isset( $entry->metas[ $last_name_setting ] ) ? $entry->metas[ $last_name_setting ] : ''; |
|
| 128 | - $address = $address_setting && isset( $entry->metas[ $address_setting ] ) ? $entry->metas[ $address_setting ] : ''; |
|
| 126 | + $first_name = $first_name_setting && isset( $entry->metas[$first_name_setting] ) ? $entry->metas[$first_name_setting] : ''; |
|
| 127 | + $last_name = $last_name_setting && isset( $entry->metas[$last_name_setting] ) ? $entry->metas[$last_name_setting] : ''; |
|
| 128 | + $address = $address_setting && isset( $entry->metas[$address_setting] ) ? $entry->metas[$address_setting] : ''; |
|
| 129 | 129 | |
| 130 | 130 | if ( is_array( $first_name ) && isset( $first_name['first'] ) ) { |
| 131 | 131 | $first_name = $first_name['first']; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | 143 | if ( $email_setting ) { |
| 144 | - $shortcode_atts = array( |
|
| 144 | + $shortcode_atts = array( |
|
| 145 | 145 | 'entry' => $entry, |
| 146 | 146 | 'form' => $action->menu_order, |
| 147 | 147 | 'value' => $email_setting, |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | if ( is_array( $v ) ) { |
| 182 | 182 | foreach ( $v as $f => $value ) { |
| 183 | 183 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
| 184 | - $entry->metas[ absint( $f ) ] = $value; |
|
| 184 | + $entry->metas[absint( $f )] = $value; |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | } else { |
@@ -139,7 +139,8 @@ discard block |
||
| 139 | 139 | * @return string|true string on error, true on success. |
| 140 | 140 | */ |
| 141 | 141 | private static function trigger_one_time_payment( $atts ) { |
| 142 | - if ( empty( $_POST['square-token'] ) || empty( $_POST['square-verification-token'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 142 | + if ( empty( $_POST['square-token'] ) || empty( $_POST['square-verification-token'] ) ) { |
|
| 143 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 143 | 144 | return __( 'Please enter a valid credit card', 'formidable' ); |
| 144 | 145 | } |
| 145 | 146 | |
@@ -199,7 +200,8 @@ discard block |
||
| 199 | 200 | * @return bool|string True on success, error message on failure |
| 200 | 201 | */ |
| 201 | 202 | private static function trigger_recurring_payment( $atts ) { |
| 202 | - if ( empty( $_POST['square-token'] ) || empty( $_POST['square-verification-token'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 203 | + if ( empty( $_POST['square-token'] ) || empty( $_POST['square-verification-token'] ) ) { |
|
| 204 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 203 | 205 | return __( 'Please enter a valid credit card', 'formidable' ); |
| 204 | 206 | } |
| 205 | 207 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $gateway = $payment_action->post_content['gateway']; |
| 77 | 77 | $is_square = $gateway === 'square' || ( is_array( $gateway ) && in_array( 'square', $gateway, true ) ); |
| 78 | 78 | if ( ! $is_square || empty( $payment_action->post_content['amount'] ) ) { |
| 79 | - unset( $payment_actions[ $k ] ); |
|
| 79 | + unset( $payment_actions[$k] ); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | return $payment_actions; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | 'run_triggers' => false, |
| 98 | 98 | 'show_errors' => true, |
| 99 | 99 | ); |
| 100 | - $atts = compact( 'action', 'entry', 'form' ); |
|
| 100 | + $atts = compact( 'action', 'entry', 'form' ); |
|
| 101 | 101 | |
| 102 | 102 | $amount = self::prepare_amount( $action->post_content['amount'], $atts ); |
| 103 | 103 | if ( empty( $amount ) || $amount == 000 ) { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | 'value' => $atts['action']->post_content['description'], |
| 151 | 151 | ) |
| 152 | 152 | ); |
| 153 | - $result = FrmSquareLiteConnectHelper::create_payment( $atts['amount'], $currency, $square_token, $verification_token, $description ); |
|
| 153 | + $result = FrmSquareLiteConnectHelper::create_payment( $atts['amount'], $currency, $square_token, $verification_token, $description ); |
|
| 154 | 154 | |
| 155 | 155 | if ( false === $result ) { |
| 156 | 156 | return FrmSquareLiteConnectHelper::get_latest_error_from_square_api(); |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | false |
| 456 | 456 | ); |
| 457 | 457 | |
| 458 | - $square_vars = array( |
|
| 458 | + $square_vars = array( |
|
| 459 | 459 | 'formId' => $form_id, |
| 460 | 460 | 'nonce' => wp_create_nonce( 'frm_square_ajax' ), |
| 461 | 461 | 'ajax' => esc_url_raw( FrmAppHelper::get_ajax_url() ), |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | $disallowed = array( ';', ':', '!important' ); |
| 573 | 573 | foreach ( $settings as $k => $s ) { |
| 574 | 574 | if ( is_string( $s ) ) { |
| 575 | - $settings[ $k ] = str_replace( $disallowed, '', $s ); |
|
| 575 | + $settings[$k] = str_replace( $disallowed, '', $s ); |
|
| 576 | 576 | } |
| 577 | 577 | } |
| 578 | 578 | |
@@ -598,11 +598,11 @@ discard block |
||
| 598 | 598 | |
| 599 | 599 | $field_id = isset( $field->temp_id ) ? $field->temp_id : $field->id; |
| 600 | 600 | |
| 601 | - if ( isset( $errors[ 'field' . $field_id . '-cc' ] ) ) { |
|
| 602 | - unset( $errors[ 'field' . $field_id . '-cc' ] ); |
|
| 601 | + if ( isset( $errors['field' . $field_id . '-cc'] ) ) { |
|
| 602 | + unset( $errors['field' . $field_id . '-cc'] ); |
|
| 603 | 603 | } |
| 604 | - if ( isset( $errors[ 'field' . $field_id ] ) ) { |
|
| 605 | - unset( $errors[ 'field' . $field_id ] ); |
|
| 604 | + if ( isset( $errors['field' . $field_id] ) ) { |
|
| 605 | + unset( $errors['field' . $field_id] ); |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | return $errors; |
@@ -472,8 +472,8 @@ discard block |
||
| 472 | 472 | return $values; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - if ( is_array( $previous_entry->metas ) && isset( $previous_entry->metas[ $field->id ] ) ) { |
|
| 476 | - $values['value'] = $previous_entry->metas[ $field->id ]; |
|
| 475 | + if ( is_array( $previous_entry->metas ) && isset( $previous_entry->metas[$field->id] ) ) { |
|
| 476 | + $values['value'] = $previous_entry->metas[$field->id]; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | $frm_vars['trans_filled'] = true; |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | * @param Closure $destroy_callback |
| 509 | 509 | * @return void |
| 510 | 510 | */ |
| 511 | - function () use ( $entry_id, &$destroy_callback ) { |
|
| 511 | + function() use ( $entry_id, &$destroy_callback ) { |
|
| 512 | 512 | FrmEntry::destroy( $entry_id ); |
| 513 | 513 | // Only call this once. |
| 514 | 514 | remove_action( 'frm_entry_form', $destroy_callback ); |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | * @return array |
| 529 | 529 | */ |
| 530 | 530 | public static function before_save_settings( $settings, $action ) { |
| 531 | - $settings['gateway'] = ! empty( $settings['gateway'] ) ? (array) $settings['gateway'] : array( 'stripe' ); |
|
| 531 | + $settings['gateway'] = ! empty( $settings['gateway'] ) ? (array) $settings['gateway'] : array( 'stripe' ); |
|
| 532 | 532 | |
| 533 | 533 | if ( in_array( 'square', $settings['gateway'] ) ) { |
| 534 | 534 | $currency = FrmSquareLiteConnectHelper::get_merchant_currency(); |