@@ -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' ) ) ) { // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 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' ) ) ) { // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 31 | 31 | $frm_settings = FrmAppHelper::get_settings(); |
| 32 | 32 | $errors['form'] = $frm_settings->admin_permission; |
| 33 | 33 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | ); |
| 150 | 150 | $args = wp_parse_args( $args, $defaults ); |
| 151 | - $value = empty( $args['parent_field_id'] ) ? ( $values['item_meta'][ $args['id'] ] ?? '' ) : $values; |
|
| 151 | + $value = empty( $args['parent_field_id'] ) ? ( $values['item_meta'][$args['id']] ?? '' ) : $values; |
|
| 152 | 152 | |
| 153 | 153 | // Check for values in "Other" fields |
| 154 | 154 | FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args ); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | // phpcs:ignore Universal.Operators.StrictComparisons |
| 169 | 169 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 170 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 170 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 171 | 171 | } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 172 | 172 | self::maybe_add_item_name( $value, $posted_field ); |
| 173 | 173 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $option_is_valid = (bool) apply_filters( 'frm_option_is_valid', $option_is_valid, $value, $posted_field ); |
| 222 | 222 | |
| 223 | 223 | if ( ! $option_is_valid ) { |
| 224 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'invalid' ); |
|
| 224 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'invalid' ); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | FrmFieldsHelper::prepare_new_front_field( $values, $field_object ); |
| 360 | 360 | |
| 361 | 361 | $separate_value = FrmField::get_option( $field_object, 'separate_value' ); |
| 362 | - $map_callback = function ( $option ) use ( $separate_value ) { |
|
| 362 | + $map_callback = function( $option ) use ( $separate_value ) { |
|
| 363 | 363 | if ( is_array( $option ) ) { |
| 364 | 364 | $option_value = $separate_value ? $option['value'] : $option['label']; |
| 365 | 365 | } else { |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | $pattern = self::phone_format( $field ); |
| 456 | 456 | |
| 457 | 457 | if ( ! preg_match( $pattern, $value ) ) { |
| 458 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 458 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | } |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | */ |
| 588 | 588 | private static function form_is_in_progress( $values ) { |
| 589 | 589 | return FrmAppHelper::pro_is_installed() && |
| 590 | - ( isset( $values[ 'frm_page_order_' . $values['form_id'] ] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
| 590 | + ( isset( $values['frm_page_order_' . $values['form_id']] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
| 591 | 591 | FrmField::get_all_types_in_form( $values['form_id'], 'break' ); |
| 592 | 592 | } |
| 593 | 593 | |
@@ -821,9 +821,9 @@ discard block |
||
| 821 | 821 | $found = self::is_akismet_guest_info_value( $key, $value, $field_id, $datas['name_field_ids'], $values ); |
| 822 | 822 | |
| 823 | 823 | if ( $found ) { |
| 824 | - $datas[ $key ] = $value; |
|
| 824 | + $datas[$key] = $value; |
|
| 825 | 825 | $datas['frm_duplicated'][] = $field_id; |
| 826 | - unset( $datas['missing_keys'][ $key_index ] ); |
|
| 826 | + unset( $datas['missing_keys'][$key_index] ); |
|
| 827 | 827 | } |
| 828 | 828 | } |
| 829 | 829 | }//end foreach |
@@ -868,12 +868,12 @@ discard block |
||
| 868 | 868 | continue; |
| 869 | 869 | } |
| 870 | 870 | |
| 871 | - if ( isset( $fields[ $index + 1 ] ) && 'Last' === $fields[ $index + 1 ]->name ) { |
|
| 872 | - if ( empty( $values[ absint( $fields[ $index + 1 ]->id ) ] ) ) { |
|
| 871 | + if ( isset( $fields[$index + 1] ) && 'Last' === $fields[$index + 1]->name ) { |
|
| 872 | + if ( empty( $values[absint( $fields[$index + 1]->id )] ) ) { |
|
| 873 | 873 | continue; |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | - $value .= ' ' . $values[ $fields[ $index + 1 ]->id ]; |
|
| 876 | + $value .= ' ' . $values[$fields[$index + 1]->id]; |
|
| 877 | 877 | return true; |
| 878 | 878 | } |
| 879 | 879 | } |
@@ -894,14 +894,14 @@ discard block |
||
| 894 | 894 | private static function get_name_text_fields( $form_id ) { |
| 895 | 895 | $name_text_fields_is_initialized = is_array( self::$name_text_fields ); |
| 896 | 896 | |
| 897 | - if ( $name_text_fields_is_initialized && isset( self::$name_text_fields[ $form_id ] ) ) { |
|
| 898 | - return self::$name_text_fields[ $form_id ]; |
|
| 897 | + if ( $name_text_fields_is_initialized && isset( self::$name_text_fields[$form_id] ) ) { |
|
| 898 | + return self::$name_text_fields[$form_id]; |
|
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | if ( ! $name_text_fields_is_initialized ) { |
| 902 | 902 | self::$name_text_fields = array(); |
| 903 | 903 | } |
| 904 | - self::$name_text_fields[ $form_id ] = FrmDb::get_results( |
|
| 904 | + self::$name_text_fields[$form_id] = FrmDb::get_results( |
|
| 905 | 905 | 'frm_fields', |
| 906 | 906 | array( |
| 907 | 907 | 'form_id' => $form_id, |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | array( 'order_by' => 'field_order ASC' ) |
| 913 | 913 | ); |
| 914 | 914 | |
| 915 | - return self::$name_text_fields[ $form_id ]; |
|
| 915 | + return self::$name_text_fields[$form_id]; |
|
| 916 | 916 | } |
| 917 | 917 | |
| 918 | 918 | /** |
@@ -926,7 +926,7 @@ discard block |
||
| 926 | 926 | |
| 927 | 927 | // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. |
| 928 | 928 | if ( $include_value ) { |
| 929 | - $datas[ $key ] = $value; |
|
| 929 | + $datas[$key] = $value; |
|
| 930 | 930 | } |
| 931 | 931 | unset( $key, $value ); |
| 932 | 932 | } |
@@ -945,10 +945,10 @@ discard block |
||
| 945 | 945 | private static function add_comment_content_to_akismet( &$datas, $values ) { |
| 946 | 946 | if ( isset( $datas['frm_duplicated'] ) ) { |
| 947 | 947 | foreach ( $datas['frm_duplicated'] as $index ) { |
| 948 | - if ( isset( $values['item_meta'][ $index ] ) ) { |
|
| 949 | - unset( $values['item_meta'][ $index ] ); |
|
| 948 | + if ( isset( $values['item_meta'][$index] ) ) { |
|
| 949 | + unset( $values['item_meta'][$index] ); |
|
| 950 | 950 | } else { |
| 951 | - unset( $values[ $index ] ); |
|
| 951 | + unset( $values[$index] ); |
|
| 952 | 952 | } |
| 953 | 953 | } |
| 954 | 954 | unset( $datas['frm_duplicated'] ); |
@@ -970,15 +970,15 @@ discard block |
||
| 970 | 970 | $skipped_fields = self::get_akismet_skipped_field_ids( $values ); |
| 971 | 971 | |
| 972 | 972 | foreach ( $skipped_fields as $skipped_field ) { |
| 973 | - if ( ! isset( $values['item_meta'][ $skipped_field->id ] ) ) { |
|
| 973 | + if ( ! isset( $values['item_meta'][$skipped_field->id] ) ) { |
|
| 974 | 974 | continue; |
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | if ( self::should_really_skip_field( $skipped_field, $values ) ) { |
| 978 | - unset( $values['item_meta'][ $skipped_field->id ] ); |
|
| 978 | + unset( $values['item_meta'][$skipped_field->id] ); |
|
| 979 | 979 | |
| 980 | - if ( isset( $values['item_meta']['other'][ $skipped_field->id ] ) ) { |
|
| 981 | - unset( $values['item_meta']['other'][ $skipped_field->id ] ); |
|
| 980 | + if ( isset( $values['item_meta']['other'][$skipped_field->id] ) ) { |
|
| 981 | + unset( $values['item_meta']['other'][$skipped_field->id] ); |
|
| 982 | 982 | } |
| 983 | 983 | } |
| 984 | 984 | } |
@@ -1015,7 +1015,7 @@ discard block |
||
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | 1017 | // If a choice field has Other option, but Other is not selected. |
| 1018 | - if ( empty( $values['item_meta']['other'][ $field_data->id ] ) ) { |
|
| 1018 | + if ( empty( $values['item_meta']['other'][$field_data->id] ) ) { |
|
| 1019 | 1019 | return true; |
| 1020 | 1020 | } |
| 1021 | 1021 | |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | foreach ( $field_data->options as $option ) { |
| 1024 | 1024 | $option_value = ! is_array( $option ) ? $option : ( $option['value'] ?? '' ); |
| 1025 | 1025 | |
| 1026 | - if ( $values['item_meta']['other'][ $field_data->id ] === $option_value ) { |
|
| 1026 | + if ( $values['item_meta']['other'][$field_data->id] === $option_value ) { |
|
| 1027 | 1027 | return true; |
| 1028 | 1028 | } |
| 1029 | 1029 | } |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | |
| 1101 | 1101 | // Convert name array to string. |
| 1102 | 1102 | if ( isset( $value['first'] ) && isset( $value['last'] ) ) { |
| 1103 | - $values['item_meta'][ $field_id ] = trim( implode( ' ', $value ) ); |
|
| 1103 | + $values['item_meta'][$field_id] = trim( implode( ' ', $value ) ); |
|
| 1104 | 1104 | $values['name_field_ids'][] = $field_id; |
| 1105 | 1105 | continue; |
| 1106 | 1106 | } |
@@ -1121,8 +1121,8 @@ discard block |
||
| 1121 | 1121 | continue; |
| 1122 | 1122 | } |
| 1123 | 1123 | |
| 1124 | - if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) { |
|
| 1125 | - $values['item_meta'][ $subsubindex ] = array(); |
|
| 1124 | + if ( ! isset( $values['item_meta'][$subsubindex] ) ) { |
|
| 1125 | + $values['item_meta'][$subsubindex] = array(); |
|
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | 1128 | // Convert name array to string. |
@@ -1131,13 +1131,13 @@ discard block |
||
| 1131 | 1131 | $values['name_field_ids'][] = $subsubindex; |
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | - if ( is_array( $values['item_meta'][ $subsubindex ] ) ) { |
|
| 1135 | - $values['item_meta'][ $subsubindex ][] = $subsubvalue; |
|
| 1134 | + if ( is_array( $values['item_meta'][$subsubindex] ) ) { |
|
| 1135 | + $values['item_meta'][$subsubindex][] = $subsubvalue; |
|
| 1136 | 1136 | } |
| 1137 | 1137 | } |
| 1138 | 1138 | }//end foreach |
| 1139 | 1139 | |
| 1140 | - unset( $values['item_meta'][ $field_id ] ); |
|
| 1140 | + unset( $values['item_meta'][$field_id] ); |
|
| 1141 | 1141 | }//end foreach |
| 1142 | 1142 | |
| 1143 | 1143 | return $form_ids; |
@@ -27,7 +27,8 @@ 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' ) ) ) { // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 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 | +// phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 31 | 32 | $frm_settings = FrmAppHelper::get_settings(); |
| 32 | 33 | $errors['form'] = $frm_settings->admin_permission; |
| 33 | 34 | } |
@@ -168,7 +169,8 @@ discard block |
||
| 168 | 169 | // phpcs:ignore Universal.Operators.StrictComparisons |
| 169 | 170 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 170 | 171 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
| 171 | - } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 172 | + } elseif ( ! isset( $_POST['item_name'] ) ) { |
|
| 173 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 172 | 174 | self::maybe_add_item_name( $value, $posted_field ); |
| 173 | 175 | } |
| 174 | 176 | |
@@ -236,7 +238,8 @@ discard block |
||
| 236 | 238 | * |
| 237 | 239 | * @return bool |
| 238 | 240 | */ |
| 239 | - private static function option_is_valid( $field, $value, $options ) { // phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh |
|
| 241 | + private static function option_is_valid( $field, $value, $options ) { |
|
| 242 | +// phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh |
|
| 240 | 243 | if ( '' === $value ) { |
| 241 | 244 | return true; |
| 242 | 245 | } |
@@ -1086,7 +1089,8 @@ discard block |
||
| 1086 | 1089 | * |
| 1087 | 1090 | * @return array Form IDs. |
| 1088 | 1091 | */ |
| 1089 | - private static function get_all_form_ids_and_flatten_meta( &$values ) { // phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh |
|
| 1092 | + private static function get_all_form_ids_and_flatten_meta( &$values ) { |
|
| 1093 | +// phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh |
|
| 1090 | 1094 | $values['name_field_ids'] = array(); |
| 1091 | 1095 | |
| 1092 | 1096 | // Blacklist check for File field in the old version doesn't contain `form_id`. |
@@ -492,7 +492,8 @@ discard block |
||
| 492 | 492 | * |
| 493 | 493 | * @return void |
| 494 | 494 | */ |
| 495 | - private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) { // phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh, SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 495 | + private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) { |
|
| 496 | +// phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh, SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 496 | 497 | global $wpdb; |
| 497 | 498 | $query[] = 'SELECT'; |
| 498 | 499 | $defaults = array( |
@@ -566,7 +567,8 @@ discard block |
||
| 566 | 567 | |
| 567 | 568 | if ( ! $args['is_draft'] ) { |
| 568 | 569 | $draft_where = $wpdb->prepare( ' AND e.is_draft=%d', 0 ); |
| 569 | - } elseif ( $args['is_draft'] == 1 ) { // phpcs:ignore Universal.Operators.StrictComparisons |
|
| 570 | + } elseif ( $args['is_draft'] == 1 ) { |
|
| 571 | +// phpcs:ignore Universal.Operators.StrictComparisons |
|
| 570 | 572 | $draft_where = $wpdb->prepare( ' AND e.is_draft=%d', 1 ); |
| 571 | 573 | } |
| 572 | 574 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @return array |
| 139 | 139 | */ |
| 140 | 140 | public function insert_installed_addon( $plugins ) { |
| 141 | - $plugins[ $this->plugin_slug ] = $this; |
|
| 141 | + $plugins[$this->plugin_slug] = $this; |
|
| 142 | 142 | return $plugins; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public static function get_addon( $plugin_slug ) { |
| 151 | 151 | $plugins = apply_filters( 'frm_installed_addons', array() ); |
| 152 | - return $plugins[ $plugin_slug ] ?? false; |
|
| 152 | + return $plugins[$plugin_slug] ?? false; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } else { |
| 209 | 209 | $api = new FrmFormApi( $this->license ); |
| 210 | 210 | $plugins = $api->get_api_info(); |
| 211 | - $_data = $plugins[ $item_id ]; |
|
| 211 | + $_data = $plugins[$item_id]; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | $_data['sections'] = array( |
@@ -511,19 +511,19 @@ discard block |
||
| 511 | 511 | |
| 512 | 512 | if ( $this->is_current_version( $transient ) ) { |
| 513 | 513 | // Make sure it doesn't show there is an update if plugin is up-to-date. |
| 514 | - if ( isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
| 515 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
| 514 | + if ( isset( $transient->response[$this->plugin_folder] ) ) { |
|
| 515 | + unset( $transient->response[$this->plugin_folder] ); |
|
| 516 | 516 | } |
| 517 | - } elseif ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
| 518 | - $this->prepare_update_details( $transient->response[ $this->plugin_folder ] ); |
|
| 517 | + } elseif ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) { |
|
| 518 | + $this->prepare_update_details( $transient->response[$this->plugin_folder] ); |
|
| 519 | 519 | |
| 520 | 520 | // if the transient has expired, clear the update and trigger it again |
| 521 | - if ( $transient->response[ $this->plugin_folder ] === false ) { |
|
| 521 | + if ( $transient->response[$this->plugin_folder] === false ) { |
|
| 522 | 522 | if ( ! $this->has_been_cleared() ) { |
| 523 | 523 | $this->cleared_plugins(); |
| 524 | 524 | $this->manually_queue_update(); |
| 525 | 525 | } |
| 526 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
| 526 | + unset( $transient->response[$this->plugin_folder] ); |
|
| 527 | 527 | } |
| 528 | 528 | } |
| 529 | 529 | |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | * @return bool |
| 637 | 637 | */ |
| 638 | 638 | private function is_current_version( $transient ) { |
| 639 | - if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) { |
|
| 639 | + if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) { |
|
| 640 | 640 | return false; |
| 641 | 641 | } |
| 642 | 642 | |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | return true; |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | - return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] === $transient->response[ $this->plugin_folder ]->new_version; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 649 | + return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] === $transient->response[$this->plugin_folder]->new_version; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | /** |
@@ -814,8 +814,8 @@ discard block |
||
| 814 | 814 | } else { |
| 815 | 815 | $messages = $this->get_messages(); |
| 816 | 816 | |
| 817 | - if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) { |
|
| 818 | - $response['message'] = $messages[ $response['status'] ]; |
|
| 817 | + if ( is_string( $response['status'] ) && isset( $messages[$response['status']] ) ) { |
|
| 818 | + $response['message'] = $messages[$response['status']]; |
|
| 819 | 819 | } else { |
| 820 | 820 | $response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) ); |
| 821 | 821 | } |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | 'user-agent' => $this->plugin_slug . '/' . $this->version . '; ' . get_bloginfo( 'url' ), |
| 998 | 998 | ); |
| 999 | 999 | |
| 1000 | - $resp = wp_remote_post( |
|
| 1000 | + $resp = wp_remote_post( |
|
| 1001 | 1001 | $this->store_url . '?l=' . urlencode( base64_encode( $this->license ) ), |
| 1002 | 1002 | $arg_array |
| 1003 | 1003 | ); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | return; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if ( isset( self::$messages[ $message['key'] ] ) && ! isset( $message['force'] ) ) { |
|
| 120 | + if ( isset( self::$messages[$message['key']] ) && ! isset( $message['force'] ) ) { |
|
| 121 | 121 | // Don't replace messages unless required. |
| 122 | 122 | return; |
| 123 | 123 | } |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | return; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if ( isset( self::$messages[ $message['key'] ] ) ) { |
|
| 129 | + if ( isset( self::$messages[$message['key']] ) ) { |
|
| 130 | 130 | // Move up and mark as new. |
| 131 | - unset( self::$messages[ $message['key'] ] ); |
|
| 131 | + unset( self::$messages[$message['key']] ); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $this->fill_message( $message ); |
| 135 | - self::$messages[ $message['key'] ] = $message; |
|
| 135 | + self::$messages[$message['key']] = $message; |
|
| 136 | 136 | |
| 137 | 137 | $this->update_list(); |
| 138 | 138 | |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | $removed = false; |
| 171 | 171 | |
| 172 | 172 | foreach ( self::$messages as $t => $message ) { |
| 173 | - $read = ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' ); |
|
| 174 | - $dismissed = ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 173 | + $read = ! empty( $message['read'] ) && isset( $message['read'][get_current_user_id()] ) && $message['read'][get_current_user_id()] < strtotime( '-1 month' ); |
|
| 174 | + $dismissed = ! empty( $message['dismissed'] ) && isset( $message['dismissed'][get_current_user_id()] ) && $message['dismissed'][get_current_user_id()] < strtotime( '-1 week' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 175 | 175 | |
| 176 | 176 | if ( $read || $dismissed || ! $this->within_valid_timeframe( $message ) ) { |
| 177 | - unset( self::$messages[ $t ] ); |
|
| 177 | + unset( self::$messages[$t] ); |
|
| 178 | 178 | $removed = true; |
| 179 | 179 | } |
| 180 | 180 | } |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | $user_id = get_current_user_id(); |
| 195 | 195 | |
| 196 | 196 | foreach ( $messages as $k => $message ) { |
| 197 | - $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] ); |
|
| 197 | + $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][$user_id] ); |
|
| 198 | 198 | |
| 199 | 199 | if ( empty( $k ) || ! $this->within_valid_timeframe( $message ) || ( $type === 'dismissed' ) !== $dismissed ) { |
| 200 | - unset( $messages[ $k ] ); |
|
| 200 | + unset( $messages[$k] ); |
|
| 201 | 201 | } elseif ( ! $this->is_for_user( $message ) ) { |
| 202 | - unset( $messages[ $k ] ); |
|
| 202 | + unset( $messages[$k] ); |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | |
@@ -273,14 +273,14 @@ discard block |
||
| 273 | 273 | * @return void |
| 274 | 274 | */ |
| 275 | 275 | public function mark_read( $key ) { |
| 276 | - if ( ! $key || ! isset( self::$messages[ $key ] ) ) { |
|
| 276 | + if ( ! $key || ! isset( self::$messages[$key] ) ) { |
|
| 277 | 277 | return; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if ( ! isset( self::$messages[ $key ]['read'] ) ) { |
|
| 281 | - self::$messages[ $key ]['read'] = array(); |
|
| 280 | + if ( ! isset( self::$messages[$key]['read'] ) ) { |
|
| 281 | + self::$messages[$key]['read'] = array(); |
|
| 282 | 282 | } |
| 283 | - self::$messages[ $key ]['read'][ get_current_user_id() ] = time(); |
|
| 283 | + self::$messages[$key]['read'][get_current_user_id()] = time(); |
|
| 284 | 284 | |
| 285 | 285 | $this->update_list(); |
| 286 | 286 | } |
@@ -293,10 +293,10 @@ discard block |
||
| 293 | 293 | * @return void |
| 294 | 294 | */ |
| 295 | 295 | public function mark_unread( $key ) { |
| 296 | - $is_read = isset( self::$messages[ $key ] ) && isset( self::$messages[ $key ]['read'] ) && isset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 296 | + $is_read = isset( self::$messages[$key] ) && isset( self::$messages[$key]['read'] ) && isset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
| 297 | 297 | |
| 298 | 298 | if ( $is_read ) { |
| 299 | - unset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 299 | + unset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
| 300 | 300 | $this->update_list(); |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -312,14 +312,14 @@ discard block |
||
| 312 | 312 | return; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - if ( ! isset( self::$messages[ $key ] ) ) { |
|
| 315 | + if ( ! isset( self::$messages[$key] ) ) { |
|
| 316 | 316 | return; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - if ( ! isset( self::$messages[ $key ]['dismissed'] ) ) { |
|
| 320 | - self::$messages[ $key ]['dismissed'] = array(); |
|
| 319 | + if ( ! isset( self::$messages[$key]['dismissed'] ) ) { |
|
| 320 | + self::$messages[$key]['dismissed'] = array(); |
|
| 321 | 321 | } |
| 322 | - self::$messages[ $key ]['dismissed'][ get_current_user_id() ] = time(); |
|
| 322 | + self::$messages[$key]['dismissed'][get_current_user_id()] = time(); |
|
| 323 | 323 | |
| 324 | 324 | $this->update_list(); |
| 325 | 325 | } |
@@ -334,11 +334,11 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | foreach ( self::$messages as $key => $message ) { |
| 336 | 336 | if ( ! isset( $message['dismissed'] ) ) { |
| 337 | - self::$messages[ $key ]['dismissed'] = array(); |
|
| 337 | + self::$messages[$key]['dismissed'] = array(); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if ( ! isset( $message['dismissed'][ $user_id ] ) ) { |
|
| 341 | - self::$messages[ $key ]['dismissed'][ $user_id ] = time(); |
|
| 340 | + if ( ! isset( $message['dismissed'][$user_id] ) ) { |
|
| 341 | + self::$messages[$key]['dismissed'][$user_id] = time(); |
|
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | $this->update_list(); |
@@ -352,8 +352,8 @@ discard block |
||
| 352 | 352 | $user_id = get_current_user_id(); |
| 353 | 353 | |
| 354 | 354 | foreach ( $messages as $t => $message ) { |
| 355 | - if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) { |
|
| 356 | - unset( $messages[ $t ] ); |
|
| 355 | + if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) { |
|
| 356 | + unset( $messages[$t] ); |
|
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | |
@@ -396,8 +396,8 @@ discard block |
||
| 396 | 396 | * @return void |
| 397 | 397 | */ |
| 398 | 398 | public function remove( $key ) { |
| 399 | - if ( isset( self::$messages[ $key ] ) ) { |
|
| 400 | - unset( self::$messages[ $key ] ); |
|
| 399 | + if ( isset( self::$messages[$key] ) ) { |
|
| 400 | + unset( self::$messages[$key] ); |
|
| 401 | 401 | $this->update_list(); |
| 402 | 402 | } |
| 403 | 403 | } |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | * |
| 447 | 447 | * @return string |
| 448 | 448 | */ |
| 449 | - function ( $matches ) { |
|
| 449 | + function( $matches ) { |
|
| 450 | 450 | $url = $matches[2]; |
| 451 | 451 | $parts = parse_url( $url ); |
| 452 | 452 | |
@@ -513,8 +513,8 @@ discard block |
||
| 513 | 513 | $inbox = new self(); |
| 514 | 514 | return array_filter( |
| 515 | 515 | $inbox->get_messages( 'filter' ), |
| 516 | - function ( $message ) use ( $key ) { |
|
| 517 | - return ! empty( $message[ $key ] ); |
|
| 516 | + function( $message ) use ( $key ) { |
|
| 517 | + return ! empty( $message[$key] ); |
|
| 518 | 518 | } |
| 519 | 519 | ); |
| 520 | 520 | } |
@@ -561,8 +561,8 @@ discard block |
||
| 561 | 561 | |
| 562 | 562 | return array_reduce( |
| 563 | 563 | $keys_to_return, |
| 564 | - function ( $total, $key ) use ( $message ) { |
|
| 565 | - $total[ $key ] = $message[ $key ] ?? ''; |
|
| 564 | + function( $total, $key ) use ( $message ) { |
|
| 565 | + $total[$key] = $message[$key] ?? ''; |
|
| 566 | 566 | return $total; |
| 567 | 567 | }, |
| 568 | 568 | array() |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function add_settings( $sections ) { |
| 207 | 207 | wp_enqueue_style( 'formidable-pro-fields' ); |
| 208 | - $sections[ $this->plugin_slug ] = array( |
|
| 208 | + $sections[$this->plugin_slug] = array( |
|
| 209 | 209 | 'class' => $this, |
| 210 | 210 | 'function' => 'settings_page', |
| 211 | 211 | 'name' => $this->plugin_name(), |
@@ -377,9 +377,9 @@ discard block |
||
| 377 | 377 | // Set the current step. |
| 378 | 378 | if ( ! isset( $step['current'] ) ) { |
| 379 | 379 | if ( $step['complete'] ) { |
| 380 | - $steps[ $k ]['current'] = false; |
|
| 380 | + $steps[$k]['current'] = false; |
|
| 381 | 381 | } else { |
| 382 | - $steps[ $k ]['current'] = ! $has_current; |
|
| 382 | + $steps[$k]['current'] = ! $has_current; |
|
| 383 | 383 | $has_current = true; |
| 384 | 384 | } |
| 385 | 385 | } elseif ( $step['current'] ) { |
@@ -390,10 +390,10 @@ discard block |
||
| 390 | 390 | $class = $step['button_class'] ?? ''; |
| 391 | 391 | $class .= ' button-primary frm-button-primary'; |
| 392 | 392 | |
| 393 | - if ( ! $steps[ $k ]['current'] ) { |
|
| 393 | + if ( ! $steps[$k]['current'] ) { |
|
| 394 | 394 | $class .= ' frm_grey disabled'; |
| 395 | 395 | } |
| 396 | - $steps[ $k ]['button_class'] = $class; |
|
| 396 | + $steps[$k]['button_class'] = $class; |
|
| 397 | 397 | }//end foreach |
| 398 | 398 | |
| 399 | 399 | return $steps; |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | $api = new FrmFormApi(); |
| 564 | 564 | $addons = $api->get_api_info(); |
| 565 | 565 | $id = $this->download_id(); |
| 566 | - $has_file = isset( $addons[ $id ] ) && isset( $addons[ $id ]['beta'] ); |
|
| 566 | + $has_file = isset( $addons[$id] ) && isset( $addons[$id]['beta'] ); |
|
| 567 | 567 | |
| 568 | 568 | if ( ! $step['current'] ) { |
| 569 | 569 | ?> |
@@ -578,10 +578,10 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | if ( ! $has_file ) { |
| 580 | 580 | echo '<p class="frm_error_style">' . esc_html__( 'We didn\'t find anything to import. Please contact our team.', 'formidable' ) . '</p>'; |
| 581 | - } elseif ( ! isset( $addons[ $id ]['beta']['package'] ) ) { |
|
| 581 | + } elseif ( ! isset( $addons[$id]['beta']['package'] ) ) { |
|
| 582 | 582 | echo '<p class="frm_error_style">' . esc_html__( 'Looks like you may not have a current subscription for this solution. Please check your account.', 'formidable' ) . '</p>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
| 583 | 583 | } else { |
| 584 | - $xml = $addons[ $id ]['beta']['package']; |
|
| 584 | + $xml = $addons[$id]['beta']['package']; |
|
| 585 | 585 | |
| 586 | 586 | if ( is_array( $xml ) ) { |
| 587 | 587 | $xml = reset( $xml ); |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | foreach ( $options as $info ) { |
| 663 | 663 | // Count the number of options displayed for css. |
| 664 | 664 | if ( $count > 1 && ! isset( $info['img'] ) ) { |
| 665 | - --$count; |
|
| 665 | + -- $count; |
|
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | $was_imported = isset( $form['form'] ) ? FrmForm::get_id_by_key( $form['form'] ) : false; |
| 762 | 762 | |
| 763 | 763 | if ( $was_imported ) { |
| 764 | - $imported[ $form['form'] ] = $was_imported; |
|
| 764 | + $imported[$form['form']] = $was_imported; |
|
| 765 | 765 | } |
| 766 | 766 | } |
| 767 | 767 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | if ( $new_val !== $value ) { |
| 235 | - $new_values[ $key ] = $new_val; |
|
| 235 | + $new_values[$key] = $new_val; |
|
| 236 | 236 | } |
| 237 | 237 | }//end foreach |
| 238 | 238 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | foreach ( $values as $value_key => $value ) { |
| 270 | 270 | if ( $value_key && in_array( $value_key, $form_fields, true ) ) { |
| 271 | - $new_values[ $value_key ] = $value; |
|
| 271 | + $new_values[$value_key] = $value; |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
@@ -359,21 +359,21 @@ discard block |
||
| 359 | 359 | foreach ( $all_fields as $fid ) { |
| 360 | 360 | // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict, SlevomatCodingStandard.Files.LineLength.LineTooLong |
| 361 | 361 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 362 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 362 | + $values['item_meta'][$fid->id] = ''; |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - $field_array[ $fid->id ] = $fid; |
|
| 365 | + $field_array[$fid->id] = $fid; |
|
| 366 | 366 | } |
| 367 | 367 | unset( $all_fields ); |
| 368 | 368 | |
| 369 | 369 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 370 | - $field = $field_array[ $field_id ] ?? FrmField::getOne( $field_id ); |
|
| 370 | + $field = $field_array[$field_id] ?? FrmField::getOne( $field_id ); |
|
| 371 | 371 | |
| 372 | 372 | if ( ! $field ) { |
| 373 | 373 | continue; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - $is_settings_page = isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ); |
|
| 376 | + $is_settings_page = isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ); |
|
| 377 | 377 | |
| 378 | 378 | if ( $is_settings_page ) { |
| 379 | 379 | self::get_settings_page_html( $values, $field ); |
@@ -394,22 +394,22 @@ discard block |
||
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | foreach ( $update_options as $opt => $default ) { |
| 397 | - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default; |
|
| 398 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 397 | + $field->field_options[$opt] = $values['field_options'][$opt . '_' . $field_id] ?? $default; |
|
| 398 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 402 | 402 | |
| 403 | 403 | $new_field = array( |
| 404 | 404 | 'field_options' => $field->field_options, |
| 405 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 405 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 406 | 406 | ); |
| 407 | 407 | |
| 408 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 409 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 408 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 409 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 410 | 410 | if ( is_array( $option ) ) { |
| 411 | 411 | foreach ( $option as $key => $item ) { |
| 412 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 412 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | } |
@@ -440,15 +440,15 @@ discard block |
||
| 440 | 440 | */ |
| 441 | 441 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 442 | 442 | if ( $field->type === 'textarea' && |
| 443 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 444 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 443 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 444 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 445 | 445 | $new_field['field_options']['max'] = ''; |
| 446 | 446 | |
| 447 | 447 | /** |
| 448 | 448 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 449 | 449 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 450 | 450 | */ |
| 451 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 451 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | |
@@ -526,11 +526,11 @@ discard block |
||
| 526 | 526 | * @return void |
| 527 | 527 | */ |
| 528 | 528 | private static function get_settings_page_html( $values, &$field ) { |
| 529 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 529 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 530 | 530 | $prev_opts = array(); |
| 531 | 531 | $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type ); |
| 532 | 532 | |
| 533 | - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html; |
|
| 533 | + $field->field_options['custom_html'] = $values['field_options']['custom_html_' . $field->id] ?? $fallback_html; |
|
| 534 | 534 | } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) { |
| 535 | 535 | $prev_opts = $field->field_options; |
| 536 | 536 | } |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | |
| 566 | 566 | foreach ( $field_cols as $col => $default ) { |
| 567 | 567 | $default = $default === '' ? $field->{$col} : $default; |
| 568 | - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default; |
|
| 568 | + $new_field[$col] = $values['field_options'][$col . '_' . $field->id] ?? $default; |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) { |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | self::destroy( $form->id ); |
| 775 | 775 | |
| 776 | 776 | if ( empty( $form->parent_form_id ) ) { |
| 777 | - ++$count; |
|
| 777 | + ++ $count; |
|
| 778 | 778 | } |
| 779 | 779 | } |
| 780 | 780 | |
@@ -998,16 +998,16 @@ discard block |
||
| 998 | 998 | foreach ( $results as $row ) { |
| 999 | 999 | if ( 'trash' !== $row->status ) { |
| 1000 | 1000 | if ( $row->is_template ) { |
| 1001 | - ++$counts['template']; |
|
| 1001 | + ++ $counts['template']; |
|
| 1002 | 1002 | } else { |
| 1003 | - ++$counts['published']; |
|
| 1003 | + ++ $counts['published']; |
|
| 1004 | 1004 | } |
| 1005 | 1005 | } else { |
| 1006 | - ++$counts['trash']; |
|
| 1006 | + ++ $counts['trash']; |
|
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | if ( 'draft' === $row->status ) { |
| 1010 | - ++$counts['draft']; |
|
| 1010 | + ++ $counts['draft']; |
|
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | unset( $row ); |
@@ -1056,8 +1056,8 @@ discard block |
||
| 1056 | 1056 | self::maybe_get_form( $form ); |
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 1060 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 1059 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 1060 | + return $frm_vars['form_params'][$form->id]; |
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1088,15 +1088,15 @@ discard block |
||
| 1088 | 1088 | // If there are two forms on the same page, make sure not to submit both. |
| 1089 | 1089 | foreach ( $default_values as $var => $default ) { |
| 1090 | 1090 | if ( $var === 'action' ) { |
| 1091 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1091 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1092 | 1092 | } else { |
| 1093 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1093 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1094 | 1094 | } |
| 1095 | 1095 | unset( $var, $default ); |
| 1096 | 1096 | } |
| 1097 | 1097 | } else { |
| 1098 | 1098 | foreach ( $default_values as $var => $default ) { |
| 1099 | - $values[ $var ] = $default; |
|
| 1099 | + $values[$var] = $default; |
|
| 1100 | 1100 | unset( $var, $default ); |
| 1101 | 1101 | } |
| 1102 | 1102 | } |
@@ -1126,7 +1126,7 @@ discard block |
||
| 1126 | 1126 | ); |
| 1127 | 1127 | |
| 1128 | 1128 | foreach ( $defaults as $var => $default ) { |
| 1129 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1129 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1130 | 1130 | } |
| 1131 | 1131 | |
| 1132 | 1132 | return $values; |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | ); |
| 1162 | 1162 | |
| 1163 | 1163 | foreach ( $defaults as $var => $default ) { |
| 1164 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1164 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1165 | 1165 | } |
| 1166 | 1166 | |
| 1167 | 1167 | return $values; |
@@ -1304,7 +1304,7 @@ discard block |
||
| 1304 | 1304 | $form = $atts['form']; |
| 1305 | 1305 | $default = $atts['default'] ?? ''; |
| 1306 | 1306 | |
| 1307 | - return $form->options[ $atts['option'] ] ?? $default; |
|
| 1307 | + return $form->options[$atts['option']] ?? $default; |
|
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | 1310 | /** |
@@ -337,7 +337,8 @@ discard block |
||
| 337 | 337 | * |
| 338 | 338 | * @return array |
| 339 | 339 | */ |
| 340 | - public static function update_fields( $id, $values ) { // phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh |
|
| 340 | + public static function update_fields( $id, $values ) { |
|
| 341 | +// phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh |
|
| 341 | 342 | |
| 342 | 343 | if ( ! isset( $values['item_meta'] ) && ! isset( $values['field_options'] ) ) { |
| 343 | 344 | return $values; |
@@ -405,7 +406,8 @@ discard block |
||
| 405 | 406 | 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
| 406 | 407 | ); |
| 407 | 408 | |
| 408 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 409 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 410 | +// phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 409 | 411 | foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
| 410 | 412 | if ( is_array( $option ) ) { |
| 411 | 413 | foreach ( $option as $key => $item ) { |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | * |
| 789 | 789 | * @return string |
| 790 | 790 | */ |
| 791 | - function ( $src ) { |
|
| 791 | + function( $src ) { |
|
| 792 | 792 | if ( is_null( $src ) ) { |
| 793 | 793 | $src = ''; |
| 794 | 794 | } |
@@ -852,11 +852,11 @@ discard block |
||
| 852 | 852 | ), |
| 853 | 853 | ); |
| 854 | 854 | |
| 855 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
| 855 | + if ( ! isset( $available_status[$status] ) ) { |
|
| 856 | 856 | return; |
| 857 | 857 | } |
| 858 | 858 | |
| 859 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
| 859 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
| 860 | 860 | |
| 861 | 861 | $params = FrmForm::list_page_params(); |
| 862 | 862 | |
@@ -865,8 +865,8 @@ discard block |
||
| 865 | 865 | |
| 866 | 866 | $count = 0; |
| 867 | 867 | |
| 868 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
| 869 | - ++$count; |
|
| 868 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
| 869 | + ++ $count; |
|
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | $form_type = FrmAppHelper::get_simple_request( |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
| 883 | 883 | $available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . $form_type . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
| 884 | 884 | |
| 885 | - $message = $available_status[ $status ]['message']; |
|
| 885 | + $message = $available_status[$status]['message']; |
|
| 886 | 886 | |
| 887 | 887 | self::display_forms_list( $params, $message ); |
| 888 | 888 | } |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | |
| 900 | 900 | foreach ( $ids as $id ) { |
| 901 | 901 | if ( FrmForm::trash( $id ) ) { |
| 902 | - ++$count; |
|
| 902 | + ++ $count; |
|
| 903 | 903 | } |
| 904 | 904 | } |
| 905 | 905 | |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | $count = 0; |
| 935 | 935 | |
| 936 | 936 | if ( FrmForm::destroy( $params['id'] ) ) { |
| 937 | - ++$count; |
|
| 937 | + ++ $count; |
|
| 938 | 938 | } |
| 939 | 939 | |
| 940 | 940 | /* translators: %1$s: Number of forms */ |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | $d = FrmForm::destroy( $id ); |
| 958 | 958 | |
| 959 | 959 | if ( $d ) { |
| 960 | - ++$count; |
|
| 960 | + ++ $count; |
|
| 961 | 961 | } |
| 962 | 962 | } |
| 963 | 963 | |
@@ -1480,7 +1480,7 @@ discard block |
||
| 1480 | 1480 | |
| 1481 | 1481 | add_action( |
| 1482 | 1482 | 'wp_enqueue_editor', |
| 1483 | - function () { |
|
| 1483 | + function() { |
|
| 1484 | 1484 | wp_print_media_templates(); |
| 1485 | 1485 | } |
| 1486 | 1486 | ); |
@@ -1621,7 +1621,7 @@ discard block |
||
| 1621 | 1621 | $section['id'] = $section['anchor']; |
| 1622 | 1622 | } |
| 1623 | 1623 | |
| 1624 | - $sections[ $key ] = $section; |
|
| 1624 | + $sections[$key] = $section; |
|
| 1625 | 1625 | }//end foreach |
| 1626 | 1626 | |
| 1627 | 1627 | return $sections; |
@@ -1761,7 +1761,7 @@ discard block |
||
| 1761 | 1761 | $user_helpers = array(); |
| 1762 | 1762 | |
| 1763 | 1763 | foreach ( $user_fields as $uk => $uf ) { |
| 1764 | - $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf; |
|
| 1764 | + $user_helpers['|user_id| show="' . $uk . '"'] = $uf; |
|
| 1765 | 1765 | unset( $uk, $uf ); |
| 1766 | 1766 | } |
| 1767 | 1767 | |
@@ -1906,7 +1906,7 @@ discard block |
||
| 1906 | 1906 | if ( ! isset( $frm_vars['js_validate_forms'] ) ) { |
| 1907 | 1907 | $frm_vars['js_validate_forms'] = array(); |
| 1908 | 1908 | } |
| 1909 | - $frm_vars['js_validate_forms'][ $form->id ] = $form; |
|
| 1909 | + $frm_vars['js_validate_forms'][$form->id] = $form; |
|
| 1910 | 1910 | } |
| 1911 | 1911 | |
| 1912 | 1912 | public static function get_email_html() { |
@@ -2106,7 +2106,7 @@ discard block |
||
| 2106 | 2106 | add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
| 2107 | 2107 | } else { |
| 2108 | 2108 | $vars = FrmAppHelper::json_to_array( $json_vars ); |
| 2109 | - $action = $vars[ $action ]; |
|
| 2109 | + $action = $vars[$action]; |
|
| 2110 | 2110 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 2111 | 2111 | $_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 2112 | 2112 | $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -2305,7 +2305,7 @@ discard block |
||
| 2305 | 2305 | |
| 2306 | 2306 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
| 2307 | 2307 | if ( is_object( $form ) ) { |
| 2308 | - $actions[ $form->id ] = $form->name; |
|
| 2308 | + $actions[$form->id] = $form->name; |
|
| 2309 | 2309 | } |
| 2310 | 2310 | unset( $form ); |
| 2311 | 2311 | } |
@@ -2590,8 +2590,8 @@ discard block |
||
| 2590 | 2590 | global $frm_vars; |
| 2591 | 2591 | |
| 2592 | 2592 | // phpcs:ignore WordPress.Security.NonceVerification.Missing, Universal.Operators.StrictComparisons |
| 2593 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { |
|
| 2594 | - $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
|
| 2593 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { |
|
| 2594 | + $errors = $frm_vars['created_entries'][$form->id]['errors']; |
|
| 2595 | 2595 | } else { |
| 2596 | 2596 | $errors = array(); |
| 2597 | 2597 | } |
@@ -2616,7 +2616,7 @@ discard block |
||
| 2616 | 2616 | */ |
| 2617 | 2617 | public static function just_created_entry( $form_id ) { |
| 2618 | 2618 | global $frm_vars; |
| 2619 | - return isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form_id ] ) && isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ? $frm_vars['created_entries'][ $form_id ]['entry_id'] : 0; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 2619 | + return isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form_id] ) && isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ? $frm_vars['created_entries'][$form_id]['entry_id'] : 0; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 2620 | 2620 | } |
| 2621 | 2621 | |
| 2622 | 2622 | /** |
@@ -2637,7 +2637,7 @@ discard block |
||
| 2637 | 2637 | private static function get_confirmation_method( $atts ) { |
| 2638 | 2638 | $action = FrmOnSubmitHelper::current_event( $atts ); |
| 2639 | 2639 | $opt = 'update' === $action ? 'edit_action' : 'success_action'; |
| 2640 | - $method = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message'; |
|
| 2640 | + $method = ! empty( $atts['form']->options[$opt] ) ? $atts['form']->options[$opt] : 'message'; |
|
| 2641 | 2641 | |
| 2642 | 2642 | if ( ! empty( $atts['entry_id'] ) ) { |
| 2643 | 2643 | $met_actions = self::get_met_on_submit_actions( $atts, $action ); |
@@ -2666,7 +2666,7 @@ discard block |
||
| 2666 | 2666 | public static function maybe_trigger_redirect( $form, $params, $args ) { |
| 2667 | 2667 | if ( ! isset( $params['id'] ) ) { |
| 2668 | 2668 | global $frm_vars; |
| 2669 | - $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id']; |
|
| 2669 | + $params['id'] = $frm_vars['created_entries'][$form->id]['entry_id']; |
|
| 2670 | 2670 | } |
| 2671 | 2671 | |
| 2672 | 2672 | $conf_method = self::get_confirmation_method( |
@@ -2755,7 +2755,7 @@ discard block |
||
| 2755 | 2755 | $args['success_opt'] = $opt; |
| 2756 | 2756 | $args['ajax'] = ! empty( $frm_vars['ajax'] ); |
| 2757 | 2757 | |
| 2758 | - if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) { |
|
| 2758 | + if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) { |
|
| 2759 | 2759 | self::load_page_after_submit( $args ); |
| 2760 | 2760 | } elseif ( $args['conf_method'] === 'redirect' ) { |
| 2761 | 2761 | self::redirect_after_submit( $args ); |
@@ -2780,7 +2780,7 @@ discard block |
||
| 2780 | 2780 | } |
| 2781 | 2781 | |
| 2782 | 2782 | // If a redirect action has already opened the URL in a new tab, we show the default message in the current tab. |
| 2783 | - if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) { |
|
| 2783 | + if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) { |
|
| 2784 | 2784 | return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) ); |
| 2785 | 2785 | } |
| 2786 | 2786 | |
@@ -2972,7 +2972,7 @@ discard block |
||
| 2972 | 2972 | FrmOnSubmitHelper::populate_on_submit_data( $new_args['form']->options, $action, $args['action'] ); |
| 2973 | 2973 | |
| 2974 | 2974 | $opt = 'update' === $args['action'] ? 'edit_' : 'success_'; |
| 2975 | - $new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ]; |
|
| 2975 | + $new_args['conf_method'] = $new_args['form']->options[$opt . 'action']; |
|
| 2976 | 2976 | |
| 2977 | 2977 | /** |
| 2978 | 2978 | * Filters the run success action args. |
@@ -2998,8 +2998,8 @@ discard block |
||
| 2998 | 2998 | $opt = $args['success_opt']; |
| 2999 | 2999 | |
| 3000 | 3000 | // phpcs:ignore Universal.Operators.StrictComparisons |
| 3001 | - if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) { |
|
| 3002 | - $page = get_post( $args['form']->options[ $opt . '_page_id' ] ); |
|
| 3001 | + if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) { |
|
| 3002 | + $page = get_post( $args['form']->options[$opt . '_page_id'] ); |
|
| 3003 | 3003 | $old_post = $post; |
| 3004 | 3004 | $post = $page; |
| 3005 | 3005 | $content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] ); |
@@ -3030,7 +3030,7 @@ discard block |
||
| 3030 | 3030 | add_filter( 'frm_use_wpautop', '__return_false' ); |
| 3031 | 3031 | |
| 3032 | 3032 | $opt = $args['success_opt']; |
| 3033 | - $success_url = trim( $args['form']->options[ $opt . '_url' ] ); |
|
| 3033 | + $success_url = trim( $args['form']->options[$opt . '_url'] ); |
|
| 3034 | 3034 | $success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] ); |
| 3035 | 3035 | $success_url = do_shortcode( $success_url ); |
| 3036 | 3036 | |
@@ -3051,7 +3051,7 @@ discard block |
||
| 3051 | 3051 | // Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
| 3052 | 3052 | if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) { |
| 3053 | 3053 | self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args ); |
| 3054 | - self::$redirected_in_new_tab[ $args['form']->id ] = 1; |
|
| 3054 | + self::$redirected_in_new_tab[$args['form']->id] = 1; |
|
| 3055 | 3055 | return; |
| 3056 | 3056 | } |
| 3057 | 3057 | |
@@ -3360,7 +3360,7 @@ discard block |
||
| 3360 | 3360 | 'description' => false, |
| 3361 | 3361 | 'reset' => false, |
| 3362 | 3362 | ); |
| 3363 | - $args = wp_parse_args( $args, $defaults ); |
|
| 3363 | + $args = wp_parse_args( $args, $defaults ); |
|
| 3364 | 3364 | } |
| 3365 | 3365 | |
| 3366 | 3366 | /** |
@@ -3402,7 +3402,7 @@ discard block |
||
| 3402 | 3402 | $opt = $args['success_opt'] ?? 'success'; |
| 3403 | 3403 | |
| 3404 | 3404 | if ( $entry_id && is_numeric( $entry_id ) ) { |
| 3405 | - $message = $form->options[ $opt . '_msg' ] ?? $frm_settings->success_msg; |
|
| 3405 | + $message = $form->options[$opt . '_msg'] ?? $frm_settings->success_msg; |
|
| 3406 | 3406 | $class = 'frm_message'; |
| 3407 | 3407 | } else { |
| 3408 | 3408 | $message = $frm_settings->failed_msg; |
@@ -3661,8 +3661,8 @@ discard block |
||
| 3661 | 3661 | |
| 3662 | 3662 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 3663 | 3663 | |
| 3664 | - $html = FrmAppHelper::clip( |
|
| 3665 | - function () { |
|
| 3664 | + $html = FrmAppHelper::clip( |
|
| 3665 | + function() { |
|
| 3666 | 3666 | FrmAppHelper::maybe_autocomplete_pages_options( |
| 3667 | 3667 | array( |
| 3668 | 3668 | 'field_name' => 'frm_page_dropdown', |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $page = $this->get_pagenum(); |
| 33 | 33 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' ); |
| 34 | 34 | |
| 35 | - $mode = self::get_param( |
|
| 35 | + $mode = self::get_param( |
|
| 36 | 36 | array( |
| 37 | 37 | 'param' => 'mode', |
| 38 | 38 | 'default' => 'list', |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | 'default' => 'name', |
| 45 | 45 | ) |
| 46 | 46 | ); |
| 47 | - $order = self::get_param( |
|
| 47 | + $order = self::get_param( |
|
| 48 | 48 | array( |
| 49 | 49 | 'param' => 'order', |
| 50 | 50 | 'default' => 'ASC', |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $counts = FrmForm::get_count(); |
| 190 | 190 | $form_type = FrmAppHelper::simple_get( 'form_type', 'sanitize_title', 'published' ); |
| 191 | 191 | |
| 192 | - if ( isset( $statuses[ $form_type ] ) ) { |
|
| 192 | + if ( isset( $statuses[$form_type] ) ) { |
|
| 193 | 193 | $counts->$form_type = $this->total_items; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | if ( $counts->{$status} || 'draft' !== $status ) { |
| 207 | 207 | /* translators: %1$s: Status, %2$s: Number of items */ |
| 208 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 208 | + $links[$status] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | unset( $status, $name ); |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | $new_actions = FrmFormsHelper::get_action_links( $item->id, $item ); |
| 412 | 412 | |
| 413 | 413 | foreach ( $new_actions as $link => $action ) { |
| 414 | - $new_actions[ $link ] = FrmFormsHelper::format_link_html( $action, 'short' ); |
|
| 414 | + $new_actions[$link] = FrmFormsHelper::format_link_html( $action, 'short' ); |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | if ( 'trash' === $this->status ) { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | '-' => 'down', |
| 163 | 163 | '+' => 'up', |
| 164 | 164 | ); |
| 165 | - $class = 'frm_arrow' . $arrow[ $icon ]; |
|
| 165 | + $class = 'frm_arrow' . $arrow[$icon]; |
|
| 166 | 166 | } else { |
| 167 | 167 | // frm_minus1_icon. |
| 168 | 168 | $key = str_replace( 'p', '', $key ); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | '-' => 'minus', |
| 171 | 171 | '+' => 'plus', |
| 172 | 172 | ); |
| 173 | - $class = 'frm_' . $plus[ $icon ]; |
|
| 173 | + $class = 'frm_' . $plus[$icon]; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | if ( $key ) { |
@@ -196,8 +196,8 @@ discard block |
||
| 196 | 196 | ?> |
| 197 | 197 | <div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select"> |
| 198 | 198 | <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button"> |
| 199 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?> |
|
| 200 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?> |
|
| 199 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?> |
|
| 200 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?> |
|
| 201 | 201 | <b class="caret"></b> |
| 202 | 202 | </button> |
| 203 | 203 | <ul class="multiselect-container frm-dropdown-menu"> |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | <li <?php echo $style->post_content['collapse_icon'] == $key ? 'class="active"' : ''; // phpcs:ignore Universal.Operators.StrictComparisons ?>> |
| 206 | 206 | <a href="javascript:void(0);"> |
| 207 | 207 | <label> |
| 208 | - <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[ $name ], $key ); ?> /><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?> |
|
| 208 | + <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[$name], $key ); ?> /><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?> |
|
| 209 | 209 | <span> |
| 210 | 210 | <?php |
| 211 | 211 | FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) ); |
@@ -478,12 +478,12 @@ discard block |
||
| 478 | 478 | $vars = array_diff( $vars, self::get_style_keys_to_remove_from_output_vars() ); |
| 479 | 479 | |
| 480 | 480 | foreach ( $vars as $var ) { |
| 481 | - if ( ! isset( $settings[ $var ] ) || ! self::css_key_is_valid( $var ) ) { |
|
| 481 | + if ( ! isset( $settings[$var] ) || ! self::css_key_is_valid( $var ) ) { |
|
| 482 | 482 | continue; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - if ( ! isset( $defaults[ $var ] ) ) { |
|
| 486 | - $defaults[ $var ] = ''; |
|
| 485 | + if ( ! isset( $defaults[$var] ) ) { |
|
| 486 | + $defaults[$var] = ''; |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | $prepared_value = ''; |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | return false; |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | - if ( $defaults && $defaults[ $var ] === $prepared_value ) { |
|
| 547 | + if ( $defaults && $defaults[$var] === $prepared_value ) { |
|
| 548 | 548 | return false; |
| 549 | 549 | } |
| 550 | 550 | |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | * @return string |
| 624 | 624 | */ |
| 625 | 625 | private static function css_var_prepare_value( $settings, $key ) { |
| 626 | - $value = $settings[ $key ]; |
|
| 626 | + $value = $settings[$key]; |
|
| 627 | 627 | |
| 628 | 628 | if ( ! is_string( $value ) && ! is_numeric( $value ) ) { |
| 629 | 629 | return ''; |
@@ -713,8 +713,8 @@ discard block |
||
| 713 | 713 | $checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' ); |
| 714 | 714 | |
| 715 | 715 | foreach ( $checkbox_opts as $opt ) { |
| 716 | - if ( ! isset( $settings[ $opt ] ) ) { |
|
| 717 | - $settings[ $opt ] = 0; |
|
| 716 | + if ( ! isset( $settings[$opt] ) ) { |
|
| 717 | + $settings[$opt] = 0; |
|
| 718 | 718 | } |
| 719 | 719 | } |
| 720 | 720 | |
@@ -764,9 +764,9 @@ discard block |
||
| 764 | 764 | ); |
| 765 | 765 | |
| 766 | 766 | array_map( |
| 767 | - function ( $key ) use ( $defaults, $font_size, $base_font_size, &$settings ) { |
|
| 768 | - if ( isset( $settings[ $key ] ) ) { |
|
| 769 | - $settings[ $key ] = round( self::get_base_font_size_scale( $key, $font_size, $defaults ) * $base_font_size ) . 'px'; |
|
| 767 | + function( $key ) use ( $defaults, $font_size, $base_font_size, &$settings ) { |
|
| 768 | + if ( isset( $settings[$key] ) ) { |
|
| 769 | + $settings[$key] = round( self::get_base_font_size_scale( $key, $font_size, $defaults ) * $base_font_size ) . 'px'; |
|
| 770 | 770 | } |
| 771 | 771 | }, |
| 772 | 772 | $font_sizes_to_update |
@@ -787,11 +787,11 @@ discard block |
||
| 787 | 787 | * @return float |
| 788 | 788 | */ |
| 789 | 789 | private static function get_base_font_size_scale( $key, $value, $defaults ) { |
| 790 | - if ( empty( $defaults[ $key ] ) || ! is_numeric( (int) $defaults[ $key ] ) || ! is_numeric( (int) $value ) || 0 === (int) $value ) { |
|
| 790 | + if ( empty( $defaults[$key] ) || ! is_numeric( (int) $defaults[$key] ) || ! is_numeric( (int) $value ) || 0 === (int) $value ) { |
|
| 791 | 791 | return 1; |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | - return round( (int) $defaults[ $key ] / (int) $value, 2 ); |
|
| 794 | + return round( (int) $defaults[$key] / (int) $value, 2 ); |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | /** |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | foreach ( $opts as $opt ) { |
| 814 | - self::get_color_output( $css, $settings[ $opt ] ); |
|
| 814 | + self::get_color_output( $css, $settings[$opt] ); |
|
| 815 | 815 | } |
| 816 | 816 | } |
| 817 | 817 | } |
@@ -1039,13 +1039,13 @@ discard block |
||
| 1039 | 1039 | */ |
| 1040 | 1040 | private static function get_default_style_count( $style_id, $conversational_style_id ) { |
| 1041 | 1041 | $substrings = array_map( |
| 1042 | - function ( $value ) { |
|
| 1042 | + function( $value ) { |
|
| 1043 | 1043 | $substring = serialize( array( 'custom_style' => $value ) ); |
| 1044 | 1044 | return substr( $substring, 5, -1 ); |
| 1045 | 1045 | }, |
| 1046 | 1046 | array( '1', 1 ) |
| 1047 | 1047 | ); |
| 1048 | - $where = array( |
|
| 1048 | + $where = array( |
|
| 1049 | 1049 | 'status' => 'published', |
| 1050 | 1050 | 0 => array( |
| 1051 | 1051 | 'options NOT LIKE' => 'custom_style', |
@@ -674,7 +674,8 @@ |
||
| 674 | 674 | if ( self::previewing_style() ) { |
| 675 | 675 | $frm_style = new FrmStyle(); |
| 676 | 676 | |
| 677 | - if ( isset( $_POST['frm_style_setting'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 677 | + if ( isset( $_POST['frm_style_setting'] ) ) { |
|
| 678 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 678 | 679 | |
| 679 | 680 | // Sanitizing is done later. |
| 680 | 681 | //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |