@@ -34,10 +34,10 @@ |
||
34 | 34 | * @return string[] An empty array is treated as automatic. |
35 | 35 | */ |
36 | 36 | public static function get_payment_method_types( $action ) { |
37 | - if ( ! isset( self::$types_by_action_id[ $action->ID ] ) ) { |
|
38 | - self::$types_by_action_id[ $action->ID ] = self::get_filtered_payment_method_types( $action ); |
|
37 | + if ( ! isset( self::$types_by_action_id[$action->ID] ) ) { |
|
38 | + self::$types_by_action_id[$action->ID] = self::get_filtered_payment_method_types( $action ); |
|
39 | 39 | } |
40 | - return self::$types_by_action_id[ $action->ID ]; |
|
40 | + return self::$types_by_action_id[$action->ID]; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -261,14 +261,14 @@ |
||
261 | 261 | private function fill_values( $values, &$new_values ) { |
262 | 262 | $defaults = $this->get_defaults(); |
263 | 263 | foreach ( $defaults as $val => $default ) { |
264 | - if ( isset( $values[ $val ] ) ) { |
|
264 | + if ( isset( $values[$val] ) ) { |
|
265 | 265 | if ( $default['sanitize'] === 'float' ) { |
266 | - $new_values[ $val ] = (float) $values[ $val ]; |
|
266 | + $new_values[$val] = (float) $values[$val]; |
|
267 | 267 | } elseif ( ! empty( $default['sanitize'] ) ) { |
268 | - $new_values[ $val ] = call_user_func( $default['sanitize'], $values[ $val ] ); |
|
268 | + $new_values[$val] = call_user_func( $default['sanitize'], $values[$val] ); |
|
269 | 269 | } |
270 | 270 | } elseif ( $values['action'] === 'create' ) { |
271 | - $new_values[ $val ] = $default['default']; |
|
271 | + $new_values[$val] = $default['default']; |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | } |
@@ -69,7 +69,7 @@ |
||
69 | 69 | 'canceled' => __( 'Canceled', 'formidable' ), |
70 | 70 | 'confirm' => __( 'Are you sure you want to cancel that subscription?', 'formidable' ), |
71 | 71 | ); |
72 | - $atts = array_merge( $defaults, $atts ); |
|
72 | + $atts = array_merge( $defaults, $atts ); |
|
73 | 73 | |
74 | 74 | if ( $sub->status === 'active' ) { |
75 | 75 | $link = admin_url( 'admin-ajax.php?action=frm_trans_cancel&sub=' . $sub->id . '&nonce=' . wp_create_nonce( 'frm_trans_ajax' ) ); |
@@ -16,10 +16,10 @@ |
||
16 | 16 | public static function get_currency( $currency ) { |
17 | 17 | $currency = strtoupper( $currency ); |
18 | 18 | $currencies = self::get_currencies(); |
19 | - if ( isset( $currencies[ $currency ] ) ) { |
|
20 | - $currency = $currencies[ $currency ]; |
|
21 | - } elseif ( isset( $currencies[ strtolower( $currency ) ] ) ) { |
|
22 | - $currency = $currencies[ strtolower( $currency ) ]; |
|
19 | + if ( isset( $currencies[$currency] ) ) { |
|
20 | + $currency = $currencies[$currency]; |
|
21 | + } elseif ( isset( $currencies[strtolower( $currency )] ) ) { |
|
22 | + $currency = $currencies[strtolower( $currency )]; |
|
23 | 23 | } else { |
24 | 24 | $currency = $currencies['USD']; |
25 | 25 | } |
@@ -126,11 +126,11 @@ |
||
126 | 126 | foreach ( $payments as $payment ) { |
127 | 127 | list( $amount, $currency ) = FrmTransLiteAppHelper::get_amount_and_currency_from_payment( $payment ); |
128 | 128 | |
129 | - if ( ! isset( $data[ $currency ] ) ) { |
|
130 | - $data[ $currency ] = 0; |
|
129 | + if ( ! isset( $data[$currency] ) ) { |
|
130 | + $data[$currency] = 0; |
|
131 | 131 | } |
132 | 132 | |
133 | - $data[ $currency ] += floatval( $amount ); |
|
133 | + $data[$currency] += floatval( $amount ); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | return $data; |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public static function get_last_sent_date( $type ) { |
238 | 238 | $options = self::get_options(); |
239 | - if ( empty( $options[ 'last_' . $type ] ) ) { |
|
239 | + if ( empty( $options['last_' . $type] ) ) { |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | |
243 | - return $options[ 'last_' . $type ]; |
|
243 | + return $options['last_' . $type]; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | public static function set_last_sent_date( $type, $value = null ) { |
253 | 253 | $options = self::get_options(); |
254 | 254 | |
255 | - $options[ 'last_' . $type ] = null === $value ? self::get_date_from_today() : ''; |
|
255 | + $options['last_' . $type] = null === $value ? self::get_date_from_today() : ''; |
|
256 | 256 | self::save_options( $options ); |
257 | 257 | } |
258 | 258 |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'user_id' => get_current_user_id(), |
109 | 109 | 'frm_strp_connect_mode' => $mode, |
110 | 110 | ); |
111 | - $data = self::post_to_connect_server( 'initialize', $additional_body ); |
|
111 | + $data = self::post_to_connect_server( 'initialize', $additional_body ); |
|
112 | 112 | |
113 | 113 | if ( is_string( $data ) ) { |
114 | 114 | return $data; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return object|string |
144 | 144 | */ |
145 | 145 | private static function post_to_connect_server( $action, $additional_body = array() ) { |
146 | - $body = array( |
|
146 | + $body = array( |
|
147 | 147 | 'frm_strp_connect_action' => $action, |
148 | 148 | 'frm_strp_connect_mode' => FrmStrpLiteAppHelper::active_mode(), |
149 | 149 | ); |
@@ -87,6 +87,6 @@ |
||
87 | 87 | |
88 | 88 | ?></div> |
89 | 89 | <?php |
90 | - ++$option_index; |
|
90 | + ++ $option_index; |
|
91 | 91 | }//end foreach |
92 | 92 | }//end if |
@@ -145,7 +145,8 @@ |
||
145 | 145 | |
146 | 146 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
147 | 147 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
148 | - } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
148 | + } elseif ( ! isset( $_POST['item_name'] ) ) { |
|
149 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
149 | 150 | self::maybe_add_item_name( $value, $posted_field ); |
150 | 151 | } |
151 | 152 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | return $errors; |
28 | 28 | } |
29 | 29 | |
30 | - if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) { |
|
30 | + if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) { |
|
31 | 31 | $frm_settings = FrmAppHelper::get_settings(); |
32 | 32 | $errors['form'] = $frm_settings->admin_permission; |
33 | 33 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $args = wp_parse_args( $args, $defaults ); |
131 | 131 | |
132 | 132 | if ( empty( $args['parent_field_id'] ) ) { |
133 | - $value = $values['item_meta'][ $args['id'] ] ?? ''; |
|
133 | + $value = $values['item_meta'][$args['id']] ?? ''; |
|
134 | 134 | } else { |
135 | 135 | // value is from a nested form |
136 | 136 | $value = $values; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
154 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
154 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
155 | 155 | } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
156 | 156 | self::maybe_add_item_name( $value, $posted_field ); |
157 | 157 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $option_is_valid = (bool) apply_filters( 'frm_option_is_valid', $option_is_valid, $value, $posted_field ); |
205 | 205 | |
206 | 206 | if ( ! $option_is_valid ) { |
207 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'invalid' ); |
|
207 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'invalid' ); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | FrmFieldsHelper::prepare_new_front_field( $values, $field_object ); |
329 | 329 | |
330 | 330 | $separate_value = FrmField::get_option( $field_object, 'separate_value' ); |
331 | - $map_callback = function ( $option ) use ( $separate_value ) { |
|
331 | + $map_callback = function( $option ) use ( $separate_value ) { |
|
332 | 332 | if ( is_array( $option ) ) { |
333 | 333 | $option_value = $separate_value ? $option['value'] : $option['label']; |
334 | 334 | } else { |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | $pattern = self::phone_format( $field ); |
403 | 403 | |
404 | 404 | if ( ! preg_match( $pattern, $value ) ) { |
405 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
405 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | } |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | */ |
525 | 525 | private static function form_is_in_progress( $values ) { |
526 | 526 | return FrmAppHelper::pro_is_installed() && |
527 | - ( isset( $values[ 'frm_page_order_' . $values['form_id'] ] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
527 | + ( isset( $values['frm_page_order_' . $values['form_id']] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
528 | 528 | FrmField::get_all_types_in_form( $values['form_id'], 'break' ); |
529 | 529 | } |
530 | 530 | |
@@ -734,9 +734,9 @@ discard block |
||
734 | 734 | foreach ( $datas['missing_keys'] as $key_index => $key ) { |
735 | 735 | $found = self::is_akismet_guest_info_value( $key, $value, $field_id, $datas['name_field_ids'], $values ); |
736 | 736 | if ( $found ) { |
737 | - $datas[ $key ] = $value; |
|
737 | + $datas[$key] = $value; |
|
738 | 738 | $datas['frm_duplicated'][] = $field_id; |
739 | - unset( $datas['missing_keys'][ $key_index ] ); |
|
739 | + unset( $datas['missing_keys'][$key_index] ); |
|
740 | 740 | } |
741 | 741 | } |
742 | 742 | }//end foreach |
@@ -779,11 +779,11 @@ discard block |
||
779 | 779 | if ( 'Name' !== $field->name ) { |
780 | 780 | continue; |
781 | 781 | } |
782 | - if ( isset( $fields[ $index + 1 ] ) && 'Last' === $fields[ $index + 1 ]->name ) { |
|
783 | - if ( empty( $values[ absint( $fields[ $index + 1 ]->id ) ] ) ) { |
|
782 | + if ( isset( $fields[$index + 1] ) && 'Last' === $fields[$index + 1]->name ) { |
|
783 | + if ( empty( $values[absint( $fields[$index + 1]->id )] ) ) { |
|
784 | 784 | continue; |
785 | 785 | } |
786 | - $value .= ' ' . $values[ $fields[ $index + 1 ]->id ]; |
|
786 | + $value .= ' ' . $values[$fields[$index + 1]->id]; |
|
787 | 787 | return true; |
788 | 788 | } |
789 | 789 | } |
@@ -802,13 +802,13 @@ discard block |
||
802 | 802 | */ |
803 | 803 | private static function get_name_text_fields( $form_id ) { |
804 | 804 | $name_text_fields_is_initialized = is_array( self::$name_text_fields ); |
805 | - if ( $name_text_fields_is_initialized && isset( self::$name_text_fields[ $form_id ] ) ) { |
|
806 | - return self::$name_text_fields[ $form_id ]; |
|
805 | + if ( $name_text_fields_is_initialized && isset( self::$name_text_fields[$form_id] ) ) { |
|
806 | + return self::$name_text_fields[$form_id]; |
|
807 | 807 | } |
808 | 808 | if ( ! $name_text_fields_is_initialized ) { |
809 | 809 | self::$name_text_fields = array(); |
810 | 810 | } |
811 | - self::$name_text_fields[ $form_id ] = FrmDb::get_results( |
|
811 | + self::$name_text_fields[$form_id] = FrmDb::get_results( |
|
812 | 812 | 'frm_fields', |
813 | 813 | array( |
814 | 814 | 'form_id' => $form_id, |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | array( 'order_by' => 'field_order ASC' ) |
820 | 820 | ); |
821 | 821 | |
822 | - return self::$name_text_fields[ $form_id ]; |
|
822 | + return self::$name_text_fields[$form_id]; |
|
823 | 823 | } |
824 | 824 | |
825 | 825 | private static function add_server_values_to_akismet( &$datas ) { |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | |
829 | 829 | // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. |
830 | 830 | if ( $include_value ) { |
831 | - $datas[ $key ] = $value; |
|
831 | + $datas[$key] = $value; |
|
832 | 832 | } |
833 | 833 | unset( $key, $value ); |
834 | 834 | } |
@@ -845,10 +845,10 @@ discard block |
||
845 | 845 | private static function add_comment_content_to_akismet( &$datas, $values ) { |
846 | 846 | if ( isset( $datas['frm_duplicated'] ) ) { |
847 | 847 | foreach ( $datas['frm_duplicated'] as $index ) { |
848 | - if ( isset( $values['item_meta'][ $index ] ) ) { |
|
849 | - unset( $values['item_meta'][ $index ] ); |
|
848 | + if ( isset( $values['item_meta'][$index] ) ) { |
|
849 | + unset( $values['item_meta'][$index] ); |
|
850 | 850 | } else { |
851 | - unset( $values[ $index ] ); |
|
851 | + unset( $values[$index] ); |
|
852 | 852 | } |
853 | 853 | } |
854 | 854 | unset( $datas['frm_duplicated'] ); |
@@ -867,14 +867,14 @@ discard block |
||
867 | 867 | private static function skip_adding_values_to_akismet( &$values ) { |
868 | 868 | $skipped_fields = self::get_akismet_skipped_field_ids( $values ); |
869 | 869 | foreach ( $skipped_fields as $skipped_field ) { |
870 | - if ( ! isset( $values['item_meta'][ $skipped_field->id ] ) ) { |
|
870 | + if ( ! isset( $values['item_meta'][$skipped_field->id] ) ) { |
|
871 | 871 | continue; |
872 | 872 | } |
873 | 873 | |
874 | 874 | if ( self::should_really_skip_field( $skipped_field, $values ) ) { |
875 | - unset( $values['item_meta'][ $skipped_field->id ] ); |
|
876 | - if ( isset( $values['item_meta']['other'][ $skipped_field->id ] ) ) { |
|
877 | - unset( $values['item_meta']['other'][ $skipped_field->id ] ); |
|
875 | + unset( $values['item_meta'][$skipped_field->id] ); |
|
876 | + if ( isset( $values['item_meta']['other'][$skipped_field->id] ) ) { |
|
877 | + unset( $values['item_meta']['other'][$skipped_field->id] ); |
|
878 | 878 | } |
879 | 879 | } |
880 | 880 | } |
@@ -910,14 +910,14 @@ discard block |
||
910 | 910 | } |
911 | 911 | |
912 | 912 | // If a choice field has Other option, but Other is not selected. |
913 | - if ( empty( $values['item_meta']['other'][ $field_data->id ] ) ) { |
|
913 | + if ( empty( $values['item_meta']['other'][$field_data->id] ) ) { |
|
914 | 914 | return true; |
915 | 915 | } |
916 | 916 | |
917 | 917 | // Check if submitted value is same as one of field option. |
918 | 918 | foreach ( $field_data->options as $option ) { |
919 | 919 | $option_value = ! is_array( $option ) ? $option : ( $option['value'] ?? '' ); |
920 | - if ( $values['item_meta']['other'][ $field_data->id ] === $option_value ) { |
|
920 | + if ( $values['item_meta']['other'][$field_data->id] === $option_value ) { |
|
921 | 921 | return true; |
922 | 922 | } |
923 | 923 | } |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | |
990 | 990 | // Convert name array to string. |
991 | 991 | if ( isset( $value['first'] ) && isset( $value['last'] ) ) { |
992 | - $values['item_meta'][ $field_id ] = trim( implode( ' ', $value ) ); |
|
992 | + $values['item_meta'][$field_id] = trim( implode( ' ', $value ) ); |
|
993 | 993 | $values['name_field_ids'][] = $field_id; |
994 | 994 | continue; |
995 | 995 | } |
@@ -1010,8 +1010,8 @@ discard block |
||
1010 | 1010 | continue; |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) { |
|
1014 | - $values['item_meta'][ $subsubindex ] = array(); |
|
1013 | + if ( ! isset( $values['item_meta'][$subsubindex] ) ) { |
|
1014 | + $values['item_meta'][$subsubindex] = array(); |
|
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | // Convert name array to string. |
@@ -1021,13 +1021,13 @@ discard block |
||
1021 | 1021 | $values['name_field_ids'][] = $subsubindex; |
1022 | 1022 | } |
1023 | 1023 | |
1024 | - if ( is_array( $values['item_meta'][ $subsubindex ] ) ) { |
|
1025 | - $values['item_meta'][ $subsubindex ][] = $subsubvalue; |
|
1024 | + if ( is_array( $values['item_meta'][$subsubindex] ) ) { |
|
1025 | + $values['item_meta'][$subsubindex][] = $subsubvalue; |
|
1026 | 1026 | } |
1027 | 1027 | } |
1028 | 1028 | }//end foreach |
1029 | 1029 | |
1030 | - unset( $values['item_meta'][ $field_id ] ); |
|
1030 | + unset( $values['item_meta'][$field_id] ); |
|
1031 | 1031 | }//end foreach |
1032 | 1032 | |
1033 | 1033 | return $form_ids; |