@@ -491,7 +491,8 @@ |
||
| 491 | 491 | |
| 492 | 492 | public static function process_entry( $errors = '', $ajax = false ) { |
| 493 | 493 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
| 494 | - if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 494 | + if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { |
|
| 495 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 495 | 496 | return; |
| 496 | 497 | } |
| 497 | 498 | |
@@ -170,20 +170,20 @@ discard block |
||
| 170 | 170 | global $frm_vars; |
| 171 | 171 | $form_id = FrmForm::get_current_form_id(); |
| 172 | 172 | |
| 173 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
| 174 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 173 | + $columns[$form_id . '_id'] = 'ID'; |
|
| 174 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 175 | 175 | |
| 176 | 176 | if ( $form_id ) { |
| 177 | 177 | self::get_columns_for_form( $form_id, $columns ); |
| 178 | 178 | } else { |
| 179 | - $columns[ $form_id . '_form_id' ] = esc_html__( 'Form', 'formidable' ); |
|
| 180 | - $columns[ $form_id . '_name' ] = esc_html__( 'Entry Name', 'formidable' ); |
|
| 181 | - $columns[ $form_id . '_user_id' ] = esc_html__( 'Created By', 'formidable' ); |
|
| 179 | + $columns[$form_id . '_form_id'] = esc_html__( 'Form', 'formidable' ); |
|
| 180 | + $columns[$form_id . '_name'] = esc_html__( 'Entry Name', 'formidable' ); |
|
| 181 | + $columns[$form_id . '_user_id'] = esc_html__( 'Created By', 'formidable' ); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - $columns[ $form_id . '_is_draft' ] = esc_html__( 'Entry Status', 'formidable' ); |
|
| 185 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
| 186 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
| 184 | + $columns[$form_id . '_is_draft'] = esc_html__( 'Entry Status', 'formidable' ); |
|
| 185 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
| 186 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
| 187 | 187 | self::maybe_add_ip_col( $form_id, $columns ); |
| 188 | 188 | |
| 189 | 189 | $frm_vars['cols'] = $columns; |
@@ -256,10 +256,10 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
| 258 | 258 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
| 259 | - unset( $sub_form_cols[ $k ] ); |
|
| 259 | + unset( $sub_form_cols[$k] ); |
|
| 260 | 260 | continue; |
| 261 | 261 | } |
| 262 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 262 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 263 | 263 | unset( $sub_form_col ); |
| 264 | 264 | } |
| 265 | 265 | } |
@@ -285,10 +285,10 @@ discard block |
||
| 285 | 285 | $include_column_for_sep_val = $has_separate_value && ! $is_post_status; |
| 286 | 286 | |
| 287 | 287 | if ( $include_column_for_sep_val ) { |
| 288 | - $columns[ $form_id . '_frmsep_' . $col_id ] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val ); |
|
| 288 | + $columns[$form_id . '_frmsep_' . $col_id] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val ); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - $columns[ $form_id . '_' . $col_id ] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val, false ); |
|
| 291 | + $columns[$form_id . '_' . $col_id] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val, false ); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | /** |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | */ |
| 323 | 323 | private static function maybe_add_ip_col( $form_id, &$columns ) { |
| 324 | 324 | if ( FrmAppHelper::ips_saved() ) { |
| 325 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
| 325 | + $columns[$form_id . '_ip'] = 'IP'; |
|
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | foreach ( $meta_value as $mk => $mv ) { |
| 381 | 381 | // Remove blank values. |
| 382 | 382 | if ( empty( $mv ) ) { |
| 383 | - unset( $meta_value[ $mk ] ); |
|
| 383 | + unset( $meta_value[$mk] ); |
|
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | |
@@ -476,14 +476,14 @@ discard block |
||
| 476 | 476 | ); |
| 477 | 477 | |
| 478 | 478 | if ( ! $form_id ) { |
| 479 | - $columns[ $form_id . '_user_id' ] = 'user_id'; |
|
| 480 | - $columns[ $form_id . '_name' ] = 'name'; |
|
| 481 | - $columns[ $form_id . '_form_id' ] = 'form_id'; |
|
| 479 | + $columns[$form_id . '_user_id'] = 'user_id'; |
|
| 480 | + $columns[$form_id . '_name'] = 'name'; |
|
| 481 | + $columns[$form_id . '_form_id'] = 'form_id'; |
|
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | foreach ( $fields as $field ) { |
| 485 | 485 | if ( self::field_supports_sorting( $field ) ) { |
| 486 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
| 486 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | $atts['form_id'] . '_item_key' => '', |
| 581 | 581 | $atts['form_id'] . '_id' => '', |
| 582 | 582 | ); |
| 583 | - $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
| 583 | + $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
| 584 | 584 | |
| 585 | 585 | $i = $atts['i']; |
| 586 | 586 | |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | |
| 592 | 592 | if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) { |
| 593 | 593 | $result[] = $col_key; |
| 594 | - --$i; |
|
| 594 | + -- $i; |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | unset( $col_key, $col ); |
@@ -770,9 +770,9 @@ discard block |
||
| 770 | 770 | if ( ! isset( $frm_vars['form_params'] ) ) { |
| 771 | 771 | $frm_vars['form_params'] = array(); |
| 772 | 772 | } |
| 773 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
| 773 | + $frm_vars['form_params'][$form->id] = $params; |
|
| 774 | 774 | |
| 775 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
| 775 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
| 776 | 776 | return; |
| 777 | 777 | } |
| 778 | 778 | |
@@ -788,17 +788,17 @@ discard block |
||
| 788 | 788 | */ |
| 789 | 789 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
| 790 | 790 | |
| 791 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
| 791 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
| 792 | 792 | |
| 793 | 793 | if ( empty( $errors ) ) { |
| 794 | 794 | $_POST['frm_skip_cookie'] = 1; |
| 795 | 795 | $do_success = false; |
| 796 | 796 | |
| 797 | 797 | if ( $params['action'] === 'create' ) { |
| 798 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
| 799 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 798 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
| 799 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 800 | 800 | |
| 801 | - $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id']; |
|
| 801 | + $params['id'] = $frm_vars['created_entries'][$form_id]['entry_id']; |
|
| 802 | 802 | $do_success = true; |
| 803 | 803 | } |
| 804 | 804 | } |
@@ -336,7 +336,8 @@ |
||
| 336 | 336 | if ( self::previewing_style() ) { |
| 337 | 337 | |
| 338 | 338 | $frm_style = new FrmStyle(); |
| 339 | - if ( isset( $_POST['frm_style_setting'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 339 | + if ( isset( $_POST['frm_style_setting'] ) ) { |
|
| 340 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 340 | 341 | |
| 341 | 342 | // Sanitizing is done later. |
| 342 | 343 | $posted = wp_unslash( $_POST['frm_style_setting'] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
@@ -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 ) { |
@@ -198,8 +198,8 @@ discard block |
||
| 198 | 198 | ?> |
| 199 | 199 | <div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select"> |
| 200 | 200 | <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button"> |
| 201 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?> |
|
| 202 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?> |
|
| 201 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?> |
|
| 202 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?> |
|
| 203 | 203 | <b class="caret"></b> |
| 204 | 204 | </button> |
| 205 | 205 | <ul class="multiselect-container frm-dropdown-menu"> |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | <li <?php echo $style->post_content['collapse_icon'] == $key ? 'class="active"' : ''; ?>> |
| 208 | 208 | <a href="javascript:void(0);"> |
| 209 | 209 | <label> |
| 210 | - <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 ); ?> /> |
|
| 210 | + <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 ); ?> /> |
|
| 211 | 211 | <span> |
| 212 | 212 | <?php |
| 213 | 213 | FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) ); |
@@ -488,12 +488,12 @@ discard block |
||
| 488 | 488 | $vars = array_diff( $vars, $remove ); |
| 489 | 489 | |
| 490 | 490 | foreach ( $vars as $var ) { |
| 491 | - if ( ! isset( $settings[ $var ] ) || ! self::css_key_is_valid( $var ) ) { |
|
| 491 | + if ( ! isset( $settings[$var] ) || ! self::css_key_is_valid( $var ) ) { |
|
| 492 | 492 | continue; |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - if ( ! isset( $defaults[ $var ] ) ) { |
|
| 496 | - $defaults[ $var ] = ''; |
|
| 495 | + if ( ! isset( $defaults[$var] ) ) { |
|
| 496 | + $defaults[$var] = ''; |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | $prepared_value = ''; |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | return false; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - if ( $defaults && $defaults[ $var ] === $prepared_value ) { |
|
| 526 | + if ( $defaults && $defaults[$var] === $prepared_value ) { |
|
| 527 | 527 | return false; |
| 528 | 528 | } |
| 529 | 529 | |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | * @return string |
| 603 | 603 | */ |
| 604 | 604 | private static function css_var_prepare_value( $settings, $key ) { |
| 605 | - $value = $settings[ $key ]; |
|
| 605 | + $value = $settings[$key]; |
|
| 606 | 606 | |
| 607 | 607 | if ( ! is_string( $value ) && ! is_numeric( $value ) ) { |
| 608 | 608 | return ''; |
@@ -692,8 +692,8 @@ discard block |
||
| 692 | 692 | $checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' ); |
| 693 | 693 | |
| 694 | 694 | foreach ( $checkbox_opts as $opt ) { |
| 695 | - if ( ! isset( $settings[ $opt ] ) ) { |
|
| 696 | - $settings[ $opt ] = 0; |
|
| 695 | + if ( ! isset( $settings[$opt] ) ) { |
|
| 696 | + $settings[$opt] = 0; |
|
| 697 | 697 | } |
| 698 | 698 | } |
| 699 | 699 | |
@@ -743,9 +743,9 @@ discard block |
||
| 743 | 743 | ); |
| 744 | 744 | |
| 745 | 745 | array_map( |
| 746 | - function ( $key ) use ( $defaults, $font_size, $base_font_size, &$settings ) { |
|
| 747 | - if ( isset( $settings[ $key ] ) ) { |
|
| 748 | - $settings[ $key ] = round( self::get_base_font_size_scale( $key, $font_size, $defaults ) * $base_font_size ) . 'px'; |
|
| 746 | + function( $key ) use ( $defaults, $font_size, $base_font_size, &$settings ) { |
|
| 747 | + if ( isset( $settings[$key] ) ) { |
|
| 748 | + $settings[$key] = round( self::get_base_font_size_scale( $key, $font_size, $defaults ) * $base_font_size ) . 'px'; |
|
| 749 | 749 | } |
| 750 | 750 | }, |
| 751 | 751 | $font_sizes_to_update |
@@ -766,11 +766,11 @@ discard block |
||
| 766 | 766 | * @return float |
| 767 | 767 | */ |
| 768 | 768 | private static function get_base_font_size_scale( $key, $value, $defaults ) { |
| 769 | - if ( empty( $defaults[ $key ] ) || ! is_numeric( (int) $defaults[ $key ] ) || ! is_numeric( (int) $value ) || 0 === (int) $value ) { |
|
| 769 | + if ( empty( $defaults[$key] ) || ! is_numeric( (int) $defaults[$key] ) || ! is_numeric( (int) $value ) || 0 === (int) $value ) { |
|
| 770 | 770 | return 1; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | - return round( (int) $defaults[ $key ] / (int) $value, 2 ); |
|
| 773 | + return round( (int) $defaults[$key] / (int) $value, 2 ); |
|
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | /** |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | foreach ( $opts as $opt ) { |
| 793 | - self::get_color_output( $css, $settings[ $opt ] ); |
|
| 793 | + self::get_color_output( $css, $settings[$opt] ); |
|
| 794 | 794 | } |
| 795 | 795 | } |
| 796 | 796 | } |
@@ -1019,13 +1019,13 @@ discard block |
||
| 1019 | 1019 | */ |
| 1020 | 1020 | private static function get_default_style_count( $style_id, $conversational_style_id ) { |
| 1021 | 1021 | $substrings = array_map( |
| 1022 | - function ( $value ) { |
|
| 1022 | + function( $value ) { |
|
| 1023 | 1023 | $substring = serialize( array( 'custom_style' => $value ) ); |
| 1024 | 1024 | return substr( $substring, 5, -1 ); |
| 1025 | 1025 | }, |
| 1026 | 1026 | array( '1', 1 ) |
| 1027 | 1027 | ); |
| 1028 | - $where = array( |
|
| 1028 | + $where = array( |
|
| 1029 | 1029 | 'status' => 'published', |
| 1030 | 1030 | 0 => array( |
| 1031 | 1031 | 'options NOT LIKE' => 'custom_style', |
@@ -1616,7 +1616,8 @@ discard block |
||
| 1616 | 1616 | $vars = array(); |
| 1617 | 1617 | FrmAppHelper::include_svg(); |
| 1618 | 1618 | |
| 1619 | - if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1619 | + if ( isset( $_POST['frm_compact_fields'] ) ) { |
|
| 1620 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1620 | 1621 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 1621 | 1622 | |
| 1622 | 1623 | // Javascript needs to be allowed in some field settings. |
@@ -2046,7 +2047,8 @@ discard block |
||
| 2046 | 2047 | private static function get_saved_errors( $form, $params ) { |
| 2047 | 2048 | global $frm_vars; |
| 2048 | 2049 | |
| 2049 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 2050 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { |
|
| 2051 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 2050 | 2052 | $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
| 2051 | 2053 | } else { |
| 2052 | 2054 | $errors = array(); |
@@ -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 | } |
@@ -854,11 +854,11 @@ discard block |
||
| 854 | 854 | ), |
| 855 | 855 | ); |
| 856 | 856 | |
| 857 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
| 857 | + if ( ! isset( $available_status[$status] ) ) { |
|
| 858 | 858 | return; |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
| 861 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
| 862 | 862 | |
| 863 | 863 | $params = FrmForm::list_page_params(); |
| 864 | 864 | |
@@ -867,8 +867,8 @@ discard block |
||
| 867 | 867 | |
| 868 | 868 | $count = 0; |
| 869 | 869 | |
| 870 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
| 871 | - ++$count; |
|
| 870 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
| 871 | + ++ $count; |
|
| 872 | 872 | } |
| 873 | 873 | |
| 874 | 874 | $form_type = FrmAppHelper::get_simple_request( |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
| 885 | 885 | $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>' ); |
| 886 | 886 | |
| 887 | - $message = $available_status[ $status ]['message']; |
|
| 887 | + $message = $available_status[$status]['message']; |
|
| 888 | 888 | |
| 889 | 889 | self::display_forms_list( $params, $message ); |
| 890 | 890 | } |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | |
| 902 | 902 | foreach ( $ids as $id ) { |
| 903 | 903 | if ( FrmForm::trash( $id ) ) { |
| 904 | - ++$count; |
|
| 904 | + ++ $count; |
|
| 905 | 905 | } |
| 906 | 906 | } |
| 907 | 907 | |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | 'type' => 'request', |
| 916 | 916 | ) |
| 917 | 917 | ); |
| 918 | - $message = sprintf( |
|
| 918 | + $message = sprintf( |
|
| 919 | 919 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
| 920 | 920 | _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' ), |
| 921 | 921 | $count, |
@@ -937,7 +937,7 @@ discard block |
||
| 937 | 937 | $count = 0; |
| 938 | 938 | |
| 939 | 939 | if ( FrmForm::destroy( $params['id'] ) ) { |
| 940 | - ++$count; |
|
| 940 | + ++ $count; |
|
| 941 | 941 | } |
| 942 | 942 | |
| 943 | 943 | /* translators: %1$s: Number of forms */ |
@@ -960,7 +960,7 @@ discard block |
||
| 960 | 960 | $d = FrmForm::destroy( $id ); |
| 961 | 961 | |
| 962 | 962 | if ( $d ) { |
| 963 | - ++$count; |
|
| 963 | + ++ $count; |
|
| 964 | 964 | } |
| 965 | 965 | } |
| 966 | 966 | |
@@ -1488,7 +1488,7 @@ discard block |
||
| 1488 | 1488 | |
| 1489 | 1489 | add_action( |
| 1490 | 1490 | 'wp_enqueue_editor', |
| 1491 | - function () { |
|
| 1491 | + function() { |
|
| 1492 | 1492 | wp_print_media_templates(); |
| 1493 | 1493 | } |
| 1494 | 1494 | ); |
@@ -1628,7 +1628,7 @@ discard block |
||
| 1628 | 1628 | $section['id'] = $section['anchor']; |
| 1629 | 1629 | } |
| 1630 | 1630 | |
| 1631 | - $sections[ $key ] = $section; |
|
| 1631 | + $sections[$key] = $section; |
|
| 1632 | 1632 | }//end foreach |
| 1633 | 1633 | |
| 1634 | 1634 | return $sections; |
@@ -1763,7 +1763,7 @@ discard block |
||
| 1763 | 1763 | $user_helpers = array(); |
| 1764 | 1764 | |
| 1765 | 1765 | foreach ( $user_fields as $uk => $uf ) { |
| 1766 | - $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf; |
|
| 1766 | + $user_helpers['|user_id| show="' . $uk . '"'] = $uf; |
|
| 1767 | 1767 | unset( $uk, $uf ); |
| 1768 | 1768 | } |
| 1769 | 1769 | |
@@ -1911,7 +1911,7 @@ discard block |
||
| 1911 | 1911 | if ( ! isset( $frm_vars['js_validate_forms'] ) ) { |
| 1912 | 1912 | $frm_vars['js_validate_forms'] = array(); |
| 1913 | 1913 | } |
| 1914 | - $frm_vars['js_validate_forms'][ $form->id ] = $form; |
|
| 1914 | + $frm_vars['js_validate_forms'][$form->id] = $form; |
|
| 1915 | 1915 | } |
| 1916 | 1916 | |
| 1917 | 1917 | public static function get_email_html() { |
@@ -2114,7 +2114,7 @@ discard block |
||
| 2114 | 2114 | add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
| 2115 | 2115 | } else { |
| 2116 | 2116 | $vars = FrmAppHelper::json_to_array( $json_vars ); |
| 2117 | - $action = $vars[ $action ]; |
|
| 2117 | + $action = $vars[$action]; |
|
| 2118 | 2118 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 2119 | 2119 | $_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 2120 | 2120 | $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -2314,7 +2314,7 @@ discard block |
||
| 2314 | 2314 | |
| 2315 | 2315 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
| 2316 | 2316 | if ( is_object( $form ) ) { |
| 2317 | - $actions[ $form->id ] = $form->name; |
|
| 2317 | + $actions[$form->id] = $form->name; |
|
| 2318 | 2318 | } |
| 2319 | 2319 | unset( $form ); |
| 2320 | 2320 | } |
@@ -2601,8 +2601,8 @@ discard block |
||
| 2601 | 2601 | private static function get_saved_errors( $form, $params ) { |
| 2602 | 2602 | global $frm_vars; |
| 2603 | 2603 | |
| 2604 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 2605 | - $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
|
| 2604 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 2605 | + $errors = $frm_vars['created_entries'][$form->id]['errors']; |
|
| 2606 | 2606 | } else { |
| 2607 | 2607 | $errors = array(); |
| 2608 | 2608 | } |
@@ -2628,7 +2628,7 @@ discard block |
||
| 2628 | 2628 | public static function just_created_entry( $form_id ) { |
| 2629 | 2629 | global $frm_vars; |
| 2630 | 2630 | |
| 2631 | - 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; |
|
| 2631 | + 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; |
|
| 2632 | 2632 | } |
| 2633 | 2633 | |
| 2634 | 2634 | /** |
@@ -2649,7 +2649,7 @@ discard block |
||
| 2649 | 2649 | private static function get_confirmation_method( $atts ) { |
| 2650 | 2650 | $action = FrmOnSubmitHelper::current_event( $atts ); |
| 2651 | 2651 | $opt = 'update' === $action ? 'edit_action' : 'success_action'; |
| 2652 | - $method = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message'; |
|
| 2652 | + $method = ! empty( $atts['form']->options[$opt] ) ? $atts['form']->options[$opt] : 'message'; |
|
| 2653 | 2653 | |
| 2654 | 2654 | if ( ! empty( $atts['entry_id'] ) ) { |
| 2655 | 2655 | $met_actions = self::get_met_on_submit_actions( $atts, $action ); |
@@ -2678,7 +2678,7 @@ discard block |
||
| 2678 | 2678 | public static function maybe_trigger_redirect( $form, $params, $args ) { |
| 2679 | 2679 | if ( ! isset( $params['id'] ) ) { |
| 2680 | 2680 | global $frm_vars; |
| 2681 | - $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id']; |
|
| 2681 | + $params['id'] = $frm_vars['created_entries'][$form->id]['entry_id']; |
|
| 2682 | 2682 | } |
| 2683 | 2683 | |
| 2684 | 2684 | $conf_method = self::get_confirmation_method( |
@@ -2767,7 +2767,7 @@ discard block |
||
| 2767 | 2767 | $args['success_opt'] = $opt; |
| 2768 | 2768 | $args['ajax'] = ! empty( $frm_vars['ajax'] ); |
| 2769 | 2769 | |
| 2770 | - if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) { |
|
| 2770 | + if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) { |
|
| 2771 | 2771 | self::load_page_after_submit( $args ); |
| 2772 | 2772 | } elseif ( $args['conf_method'] === 'redirect' ) { |
| 2773 | 2773 | self::redirect_after_submit( $args ); |
@@ -2792,7 +2792,7 @@ discard block |
||
| 2792 | 2792 | } |
| 2793 | 2793 | |
| 2794 | 2794 | // If a redirect action has already opened the URL in a new tab, we show the default message in the current tab. |
| 2795 | - if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) { |
|
| 2795 | + if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) { |
|
| 2796 | 2796 | return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) ); |
| 2797 | 2797 | } |
| 2798 | 2798 | |
@@ -2985,7 +2985,7 @@ discard block |
||
| 2985 | 2985 | |
| 2986 | 2986 | $opt = 'update' === $args['action'] ? 'edit_' : 'success_'; |
| 2987 | 2987 | |
| 2988 | - $new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ]; |
|
| 2988 | + $new_args['conf_method'] = $new_args['form']->options[$opt . 'action']; |
|
| 2989 | 2989 | |
| 2990 | 2990 | /** |
| 2991 | 2991 | * Filters the run success action args. |
@@ -3010,8 +3010,8 @@ discard block |
||
| 3010 | 3010 | global $post; |
| 3011 | 3011 | $opt = $args['success_opt']; |
| 3012 | 3012 | |
| 3013 | - if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) { |
|
| 3014 | - $page = get_post( $args['form']->options[ $opt . '_page_id' ] ); |
|
| 3013 | + if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) { |
|
| 3014 | + $page = get_post( $args['form']->options[$opt . '_page_id'] ); |
|
| 3015 | 3015 | $old_post = $post; |
| 3016 | 3016 | $post = $page; |
| 3017 | 3017 | $content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] ); |
@@ -3042,7 +3042,7 @@ discard block |
||
| 3042 | 3042 | add_filter( 'frm_use_wpautop', '__return_false' ); |
| 3043 | 3043 | |
| 3044 | 3044 | $opt = $args['success_opt']; |
| 3045 | - $success_url = trim( $args['form']->options[ $opt . '_url' ] ); |
|
| 3045 | + $success_url = trim( $args['form']->options[$opt . '_url'] ); |
|
| 3046 | 3046 | $success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] ); |
| 3047 | 3047 | $success_url = do_shortcode( $success_url ); |
| 3048 | 3048 | |
@@ -3064,7 +3064,7 @@ discard block |
||
| 3064 | 3064 | // Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
| 3065 | 3065 | if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) { |
| 3066 | 3066 | self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args ); |
| 3067 | - self::$redirected_in_new_tab[ $args['form']->id ] = 1; |
|
| 3067 | + self::$redirected_in_new_tab[$args['form']->id] = 1; |
|
| 3068 | 3068 | return; |
| 3069 | 3069 | } |
| 3070 | 3070 | |
@@ -3374,7 +3374,7 @@ discard block |
||
| 3374 | 3374 | 'description' => false, |
| 3375 | 3375 | 'reset' => false, |
| 3376 | 3376 | ); |
| 3377 | - $args = wp_parse_args( $args, $defaults ); |
|
| 3377 | + $args = wp_parse_args( $args, $defaults ); |
|
| 3378 | 3378 | } |
| 3379 | 3379 | |
| 3380 | 3380 | /** |
@@ -3417,7 +3417,7 @@ discard block |
||
| 3417 | 3417 | $opt = $args['success_opt'] ?? 'success'; |
| 3418 | 3418 | |
| 3419 | 3419 | if ( $entry_id && is_numeric( $entry_id ) ) { |
| 3420 | - $message = $form->options[ $opt . '_msg' ] ?? $frm_settings->success_msg; |
|
| 3420 | + $message = $form->options[$opt . '_msg'] ?? $frm_settings->success_msg; |
|
| 3421 | 3421 | $class = 'frm_message'; |
| 3422 | 3422 | } else { |
| 3423 | 3423 | $message = $frm_settings->failed_msg; |
@@ -3675,8 +3675,8 @@ discard block |
||
| 3675 | 3675 | |
| 3676 | 3676 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 3677 | 3677 | |
| 3678 | - $html = FrmAppHelper::clip( |
|
| 3679 | - function () { |
|
| 3678 | + $html = FrmAppHelper::clip( |
|
| 3679 | + function() { |
|
| 3680 | 3680 | FrmAppHelper::maybe_autocomplete_pages_options( |
| 3681 | 3681 | array( |
| 3682 | 3682 | 'field_name' => 'frm_page_dropdown', |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $is_square = $gateway === 'square' || ( is_array( $gateway ) && in_array( 'square', $gateway, true ) ); |
| 84 | 84 | |
| 85 | 85 | if ( ! $is_square || empty( $payment_action->post_content['amount'] ) ) { |
| 86 | - unset( $payment_actions[ $k ] ); |
|
| 86 | + unset( $payment_actions[$k] ); |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | return $payment_actions; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | 'run_triggers' => false, |
| 106 | 106 | 'show_errors' => true, |
| 107 | 107 | ); |
| 108 | - $atts = compact( 'action', 'entry', 'form' ); |
|
| 108 | + $atts = compact( 'action', 'entry', 'form' ); |
|
| 109 | 109 | |
| 110 | 110 | $amount = self::prepare_amount( $action->post_content['amount'], $atts ); |
| 111 | 111 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | 'value' => $atts['action']->post_content['description'], |
| 160 | 160 | ) |
| 161 | 161 | ); |
| 162 | - $result = FrmSquareLiteConnectHelper::create_payment( $atts['amount'], $currency, $square_token, $verification_token, $description ); |
|
| 162 | + $result = FrmSquareLiteConnectHelper::create_payment( $atts['amount'], $currency, $square_token, $verification_token, $description ); |
|
| 163 | 163 | |
| 164 | 164 | if ( false === $result ) { |
| 165 | 165 | return FrmSquareLiteConnectHelper::get_latest_error_from_square_api(); |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | false |
| 548 | 548 | ); |
| 549 | 549 | |
| 550 | - $square_vars = array( |
|
| 550 | + $square_vars = array( |
|
| 551 | 551 | 'formId' => $form_id, |
| 552 | 552 | 'nonce' => wp_create_nonce( 'frm_square_ajax' ), |
| 553 | 553 | 'ajax' => esc_url_raw( FrmAppHelper::get_ajax_url() ), |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | |
| 688 | 688 | foreach ( $settings as $k => $s ) { |
| 689 | 689 | if ( is_string( $s ) ) { |
| 690 | - $settings[ $k ] = str_replace( $disallowed, '', $s ); |
|
| 690 | + $settings[$k] = str_replace( $disallowed, '', $s ); |
|
| 691 | 691 | } |
| 692 | 692 | } |
| 693 | 693 | |
@@ -715,12 +715,12 @@ discard block |
||
| 715 | 715 | |
| 716 | 716 | $field_id = $field->temp_id ?? $field->id; |
| 717 | 717 | |
| 718 | - if ( isset( $errors[ 'field' . $field_id . '-cc' ] ) ) { |
|
| 719 | - unset( $errors[ 'field' . $field_id . '-cc' ] ); |
|
| 718 | + if ( isset( $errors['field' . $field_id . '-cc'] ) ) { |
|
| 719 | + unset( $errors['field' . $field_id . '-cc'] ); |
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | - if ( isset( $errors[ 'field' . $field_id ] ) ) { |
|
| 723 | - unset( $errors[ 'field' . $field_id ] ); |
|
| 722 | + if ( isset( $errors['field' . $field_id] ) ) { |
|
| 723 | + unset( $errors['field' . $field_id] ); |
|
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | return $errors; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | return $errors; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - 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 | + 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' ) ) ) { |
|
| 32 | 32 | $frm_settings = FrmAppHelper::get_settings(); |
| 33 | 33 | $errors['form'] = $frm_settings->admin_permission; |
| 34 | 34 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $args = wp_parse_args( $args, $defaults ); |
| 151 | 151 | |
| 152 | 152 | if ( empty( $args['parent_field_id'] ) ) { |
| 153 | - $value = $values['item_meta'][ $args['id'] ] ?? ''; |
|
| 153 | + $value = $values['item_meta'][$args['id']] ?? ''; |
|
| 154 | 154 | } else { |
| 155 | 155 | // value is from a nested form |
| 156 | 156 | $value = $values; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 175 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 175 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 176 | 176 | } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 177 | 177 | self::maybe_add_item_name( $value, $posted_field ); |
| 178 | 178 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $option_is_valid = (bool) apply_filters( 'frm_option_is_valid', $option_is_valid, $value, $posted_field ); |
| 226 | 226 | |
| 227 | 227 | if ( ! $option_is_valid ) { |
| 228 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'invalid' ); |
|
| 228 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'invalid' ); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | FrmFieldsHelper::prepare_new_front_field( $values, $field_object ); |
| 363 | 363 | |
| 364 | 364 | $separate_value = FrmField::get_option( $field_object, 'separate_value' ); |
| 365 | - $map_callback = function ( $option ) use ( $separate_value ) { |
|
| 365 | + $map_callback = function( $option ) use ( $separate_value ) { |
|
| 366 | 366 | if ( is_array( $option ) ) { |
| 367 | 367 | $option_value = $separate_value ? $option['value'] : $option['label']; |
| 368 | 368 | } else { |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | $pattern = self::phone_format( $field ); |
| 461 | 461 | |
| 462 | 462 | if ( ! preg_match( $pattern, $value ) ) { |
| 463 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 463 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 464 | 464 | } |
| 465 | 465 | } |
| 466 | 466 | } |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | */ |
| 597 | 597 | private static function form_is_in_progress( $values ) { |
| 598 | 598 | return FrmAppHelper::pro_is_installed() && |
| 599 | - ( isset( $values[ 'frm_page_order_' . $values['form_id'] ] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
| 599 | + ( isset( $values['frm_page_order_' . $values['form_id']] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
| 600 | 600 | FrmField::get_all_types_in_form( $values['form_id'], 'break' ); |
| 601 | 601 | } |
| 602 | 602 | |
@@ -833,9 +833,9 @@ discard block |
||
| 833 | 833 | $found = self::is_akismet_guest_info_value( $key, $value, $field_id, $datas['name_field_ids'], $values ); |
| 834 | 834 | |
| 835 | 835 | if ( $found ) { |
| 836 | - $datas[ $key ] = $value; |
|
| 836 | + $datas[$key] = $value; |
|
| 837 | 837 | $datas['frm_duplicated'][] = $field_id; |
| 838 | - unset( $datas['missing_keys'][ $key_index ] ); |
|
| 838 | + unset( $datas['missing_keys'][$key_index] ); |
|
| 839 | 839 | } |
| 840 | 840 | } |
| 841 | 841 | }//end foreach |
@@ -880,12 +880,12 @@ discard block |
||
| 880 | 880 | continue; |
| 881 | 881 | } |
| 882 | 882 | |
| 883 | - if ( isset( $fields[ $index + 1 ] ) && 'Last' === $fields[ $index + 1 ]->name ) { |
|
| 884 | - if ( empty( $values[ absint( $fields[ $index + 1 ]->id ) ] ) ) { |
|
| 883 | + if ( isset( $fields[$index + 1] ) && 'Last' === $fields[$index + 1]->name ) { |
|
| 884 | + if ( empty( $values[absint( $fields[$index + 1]->id )] ) ) { |
|
| 885 | 885 | continue; |
| 886 | 886 | } |
| 887 | 887 | |
| 888 | - $value .= ' ' . $values[ $fields[ $index + 1 ]->id ]; |
|
| 888 | + $value .= ' ' . $values[$fields[$index + 1]->id]; |
|
| 889 | 889 | return true; |
| 890 | 890 | } |
| 891 | 891 | } |
@@ -906,14 +906,14 @@ discard block |
||
| 906 | 906 | private static function get_name_text_fields( $form_id ) { |
| 907 | 907 | $name_text_fields_is_initialized = is_array( self::$name_text_fields ); |
| 908 | 908 | |
| 909 | - if ( $name_text_fields_is_initialized && isset( self::$name_text_fields[ $form_id ] ) ) { |
|
| 910 | - return self::$name_text_fields[ $form_id ]; |
|
| 909 | + if ( $name_text_fields_is_initialized && isset( self::$name_text_fields[$form_id] ) ) { |
|
| 910 | + return self::$name_text_fields[$form_id]; |
|
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | if ( ! $name_text_fields_is_initialized ) { |
| 914 | 914 | self::$name_text_fields = array(); |
| 915 | 915 | } |
| 916 | - self::$name_text_fields[ $form_id ] = FrmDb::get_results( |
|
| 916 | + self::$name_text_fields[$form_id] = FrmDb::get_results( |
|
| 917 | 917 | 'frm_fields', |
| 918 | 918 | array( |
| 919 | 919 | 'form_id' => $form_id, |
@@ -924,7 +924,7 @@ discard block |
||
| 924 | 924 | array( 'order_by' => 'field_order ASC' ) |
| 925 | 925 | ); |
| 926 | 926 | |
| 927 | - return self::$name_text_fields[ $form_id ]; |
|
| 927 | + return self::$name_text_fields[$form_id]; |
|
| 928 | 928 | } |
| 929 | 929 | |
| 930 | 930 | /** |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | |
| 939 | 939 | // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. |
| 940 | 940 | if ( $include_value ) { |
| 941 | - $datas[ $key ] = $value; |
|
| 941 | + $datas[$key] = $value; |
|
| 942 | 942 | } |
| 943 | 943 | unset( $key, $value ); |
| 944 | 944 | } |
@@ -957,10 +957,10 @@ discard block |
||
| 957 | 957 | private static function add_comment_content_to_akismet( &$datas, $values ) { |
| 958 | 958 | if ( isset( $datas['frm_duplicated'] ) ) { |
| 959 | 959 | foreach ( $datas['frm_duplicated'] as $index ) { |
| 960 | - if ( isset( $values['item_meta'][ $index ] ) ) { |
|
| 961 | - unset( $values['item_meta'][ $index ] ); |
|
| 960 | + if ( isset( $values['item_meta'][$index] ) ) { |
|
| 961 | + unset( $values['item_meta'][$index] ); |
|
| 962 | 962 | } else { |
| 963 | - unset( $values[ $index ] ); |
|
| 963 | + unset( $values[$index] ); |
|
| 964 | 964 | } |
| 965 | 965 | } |
| 966 | 966 | unset( $datas['frm_duplicated'] ); |
@@ -982,15 +982,15 @@ discard block |
||
| 982 | 982 | $skipped_fields = self::get_akismet_skipped_field_ids( $values ); |
| 983 | 983 | |
| 984 | 984 | foreach ( $skipped_fields as $skipped_field ) { |
| 985 | - if ( ! isset( $values['item_meta'][ $skipped_field->id ] ) ) { |
|
| 985 | + if ( ! isset( $values['item_meta'][$skipped_field->id] ) ) { |
|
| 986 | 986 | continue; |
| 987 | 987 | } |
| 988 | 988 | |
| 989 | 989 | if ( self::should_really_skip_field( $skipped_field, $values ) ) { |
| 990 | - unset( $values['item_meta'][ $skipped_field->id ] ); |
|
| 990 | + unset( $values['item_meta'][$skipped_field->id] ); |
|
| 991 | 991 | |
| 992 | - if ( isset( $values['item_meta']['other'][ $skipped_field->id ] ) ) { |
|
| 993 | - unset( $values['item_meta']['other'][ $skipped_field->id ] ); |
|
| 992 | + if ( isset( $values['item_meta']['other'][$skipped_field->id] ) ) { |
|
| 993 | + unset( $values['item_meta']['other'][$skipped_field->id] ); |
|
| 994 | 994 | } |
| 995 | 995 | } |
| 996 | 996 | } |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | // If a choice field has Other option, but Other is not selected. |
| 1031 | - if ( empty( $values['item_meta']['other'][ $field_data->id ] ) ) { |
|
| 1031 | + if ( empty( $values['item_meta']['other'][$field_data->id] ) ) { |
|
| 1032 | 1032 | return true; |
| 1033 | 1033 | } |
| 1034 | 1034 | |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | foreach ( $field_data->options as $option ) { |
| 1037 | 1037 | $option_value = ! is_array( $option ) ? $option : ( $option['value'] ?? '' ); |
| 1038 | 1038 | |
| 1039 | - if ( $values['item_meta']['other'][ $field_data->id ] === $option_value ) { |
|
| 1039 | + if ( $values['item_meta']['other'][$field_data->id] === $option_value ) { |
|
| 1040 | 1040 | return true; |
| 1041 | 1041 | } |
| 1042 | 1042 | } |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | |
| 1114 | 1114 | // Convert name array to string. |
| 1115 | 1115 | if ( isset( $value['first'] ) && isset( $value['last'] ) ) { |
| 1116 | - $values['item_meta'][ $field_id ] = trim( implode( ' ', $value ) ); |
|
| 1116 | + $values['item_meta'][$field_id] = trim( implode( ' ', $value ) ); |
|
| 1117 | 1117 | $values['name_field_ids'][] = $field_id; |
| 1118 | 1118 | continue; |
| 1119 | 1119 | } |
@@ -1134,8 +1134,8 @@ discard block |
||
| 1134 | 1134 | continue; |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | - if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) { |
|
| 1138 | - $values['item_meta'][ $subsubindex ] = array(); |
|
| 1137 | + if ( ! isset( $values['item_meta'][$subsubindex] ) ) { |
|
| 1138 | + $values['item_meta'][$subsubindex] = array(); |
|
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | // Convert name array to string. |
@@ -1145,13 +1145,13 @@ discard block |
||
| 1145 | 1145 | $values['name_field_ids'][] = $subsubindex; |
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | - if ( is_array( $values['item_meta'][ $subsubindex ] ) ) { |
|
| 1149 | - $values['item_meta'][ $subsubindex ][] = $subsubvalue; |
|
| 1148 | + if ( is_array( $values['item_meta'][$subsubindex] ) ) { |
|
| 1149 | + $values['item_meta'][$subsubindex][] = $subsubvalue; |
|
| 1150 | 1150 | } |
| 1151 | 1151 | } |
| 1152 | 1152 | }//end foreach |
| 1153 | 1153 | |
| 1154 | - unset( $values['item_meta'][ $field_id ] ); |
|
| 1154 | + unset( $values['item_meta'][$field_id] ); |
|
| 1155 | 1155 | }//end foreach |
| 1156 | 1156 | |
| 1157 | 1157 | return $form_ids; |
@@ -355,8 +355,8 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | $where_is = strtolower( $where_is ); |
| 357 | 357 | |
| 358 | - if ( isset( $switch_to[ $where_is ] ) ) { |
|
| 359 | - return ' ' . $switch_to[ $where_is ]; |
|
| 358 | + if ( isset( $switch_to[$where_is] ) ) { |
|
| 359 | + return ' ' . $switch_to[$where_is]; |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | // > and < need a little more work since we don't want them switched to >= and <= |
@@ -436,14 +436,14 @@ discard block |
||
| 436 | 436 | |
| 437 | 437 | foreach ( $temp_args as $k => $v ) { |
| 438 | 438 | if ( $v == '' ) { |
| 439 | - unset( $args[ $k ] ); |
|
| 439 | + unset( $args[$k] ); |
|
| 440 | 440 | continue; |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | $db_name = strtoupper( str_replace( '_', ' ', $k ) ); |
| 444 | 444 | |
| 445 | 445 | if ( strpos( $v, $db_name ) === false ) { |
| 446 | - $args[ $k ] = $db_name . ' ' . $v; |
|
| 446 | + $args[$k] = $db_name . ' ' . $v; |
|
| 447 | 447 | } |
| 448 | 448 | } |
| 449 | 449 | |
@@ -514,13 +514,13 @@ discard block |
||
| 514 | 514 | private static function esc_query_args( &$args ) { |
| 515 | 515 | foreach ( $args as $param => $value ) { |
| 516 | 516 | if ( $param === 'order_by' ) { |
| 517 | - $args[ $param ] = self::esc_order( $value ); |
|
| 517 | + $args[$param] = self::esc_order( $value ); |
|
| 518 | 518 | } elseif ( $param === 'limit' ) { |
| 519 | - $args[ $param ] = self::esc_limit( $value ); |
|
| 519 | + $args[$param] = self::esc_limit( $value ); |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | - if ( $args[ $param ] == '' ) { |
|
| 523 | - unset( $args[ $param ] ); |
|
| 522 | + if ( $args[$param] == '' ) { |
|
| 523 | + unset( $args[$param] ); |
|
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | } |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | |
| 618 | 618 | foreach ( $limit as $k => $l ) { |
| 619 | 619 | if ( is_numeric( $l ) ) { |
| 620 | - $limit[ $k ] = $l; |
|
| 620 | + $limit[$k] = $l; |
|
| 621 | 621 | } |
| 622 | 622 | } |
| 623 | 623 | |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | */ |
| 796 | 796 | public static function add_key_to_group_cache( $key, $group ) { |
| 797 | 797 | $cached = self::get_group_cached_keys( $group ); |
| 798 | - $cached[ $key ] = $key; |
|
| 798 | + $cached[$key] = $key; |
|
| 799 | 799 | wp_cache_set( 'cached_keys', $cached, $group, 300 ); |
| 800 | 800 | } |
| 801 | 801 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | 133 | foreach ( $skipped_keys as $skipped_key ) { |
| 134 | - unset( $data[ $skipped_key ] ); |
|
| 134 | + unset( $data[$skipped_key] ); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | return $data; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | foreach ( $pass_settings as $setting ) { |
| 241 | 241 | if ( isset( $settings_list->$setting ) ) { |
| 242 | - $settings[ $setting ] = $this->maybe_json( $settings_list->$setting ); |
|
| 242 | + $settings[$setting] = $this->maybe_json( $settings_list->$setting ); |
|
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $message_settings = array(); |
| 278 | 278 | |
| 279 | 279 | foreach ( $messages as $message ) { |
| 280 | - $message_settings[ 'changed-' . $message ] = $settings_list->$message === $default[ $message ] ? 0 : 1; |
|
| 280 | + $message_settings['changed-' . $message] = $settings_list->$message === $default[$message] ? 0 : 1; |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | return $message_settings; |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
| 300 | 300 | if ( isset( $settings_list->$frm_role ) ) { |
| 301 | - $permissions[ $frm_role ] = $settings_list->$frm_role; |
|
| 301 | + $permissions[$frm_role] = $settings_list->$frm_role; |
|
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | |
@@ -371,9 +371,9 @@ discard block |
||
| 371 | 371 | ); |
| 372 | 372 | |
| 373 | 373 | foreach ( $settings as $setting ) { |
| 374 | - if ( isset( $form->options[ $setting ] ) ) { |
|
| 374 | + if ( isset( $form->options[$setting] ) ) { |
|
| 375 | 375 | if ( 'custom_style' === $setting ) { |
| 376 | - $style->id = $form->options[ $setting ]; |
|
| 376 | + $style->id = $form->options[$setting]; |
|
| 377 | 377 | |
| 378 | 378 | if ( ! $style->id ) { |
| 379 | 379 | $style_name = 0; |
@@ -384,9 +384,9 @@ discard block |
||
| 384 | 384 | $style_name = $style_post ? $style_post->post_name : 'formidable-style'; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - $new_form[ $setting ] = $style_name; |
|
| 387 | + $new_form[$setting] = $style_name; |
|
| 388 | 388 | } else { |
| 389 | - $new_form[ $setting ] = $this->maybe_json( $form->options[ $setting ] ); |
|
| 389 | + $new_form[$setting] = $this->maybe_json( $form->options[$setting] ); |
|
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | } |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | |
| 455 | 455 | foreach ( $fields as $k => $field ) { |
| 456 | 456 | FrmAppHelper::unserialize_or_decode( $field->field_options ); |
| 457 | - $fields[ $k ]->field_options = json_encode( $field->field_options ); |
|
| 457 | + $fields[$k]->field_options = json_encode( $field->field_options ); |
|
| 458 | 458 | } |
| 459 | 459 | return $fields; |
| 460 | 460 | } |
@@ -143,13 +143,13 @@ discard block |
||
| 143 | 143 | $cats = array_intersect( $this->skip_categories(), $addon['categories'] ); |
| 144 | 144 | |
| 145 | 145 | if ( ! empty( $cats ) ) { |
| 146 | - unset( $addons[ $k ] ); |
|
| 146 | + unset( $addons[$k] ); |
|
| 147 | 147 | continue; |
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if ( ! array_key_exists( 'is_new', $addon ) && array_key_exists( 'released', $addon ) ) { |
| 152 | - $addons[ $k ]['is_new'] = $this->is_new( $addon ); |
|
| 152 | + $addons[$k]['is_new'] = $this->is_new( $addon ); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
@@ -266,8 +266,8 @@ discard block |
||
| 266 | 266 | return $addon; |
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | - } elseif ( isset( $addons[ $download_id ] ) ) { |
|
| 270 | - $plugin = $addons[ $download_id ]; |
|
| 269 | + } elseif ( isset( $addons[$download_id] ) ) { |
|
| 270 | + $plugin = $addons[$download_id]; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | return $plugin; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * @var array |
| 40 | 40 | */ |
| 41 | - protected $fields_map = array(); |
|
| 41 | + protected $fields_map = array(); |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @var mixed |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * @var array |
| 50 | 50 | */ |
| 51 | - protected $current_section = array(); |
|
| 51 | + protected $current_section = array(); |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Define required properties. |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | // This may occasionally skip one level/order e.g. after adding a |
| 321 | 321 | // list field, as field_order would already be prepared to be used. |
| 322 | - ++$field_order; |
|
| 322 | + ++ $field_order; |
|
| 323 | 323 | |
| 324 | 324 | if ( ! empty( $new_field['fields'] ) && is_array( $new_field['fields'] ) ) { |
| 325 | 325 | // we have (inner) fields to merge |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $order = 0; |
| 372 | 372 | |
| 373 | 373 | foreach ( $fields as $field ) { |
| 374 | - ++$order; |
|
| 374 | + ++ $order; |
|
| 375 | 375 | $type = $this->get_field_type( $field ); |
| 376 | 376 | $new_type = $this->convert_field_type( $type, $field ); |
| 377 | 377 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $sub['name'] = __( 'Section Buttons', 'formidable' ); |
| 408 | 408 | $subs = array( $sub ); |
| 409 | 409 | $this->insert_fields_in_array( $subs, $order, 0, $fields ); |
| 410 | - ++$order; |
|
| 410 | + ++ $order; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | protected function create_fields( $form_id, &$form ) { |
| 522 | 522 | foreach ( $form['fields'] as $key => $new_field ) { |
| 523 | 523 | $new_field['form_id'] = $form_id; |
| 524 | - $form['fields'][ $key ]['id'] = FrmField::create( $new_field ); |
|
| 524 | + $form['fields'][$key]['id'] = FrmField::create( $new_field ); |
|
| 525 | 525 | } |
| 526 | 526 | } |
| 527 | 527 | |
@@ -564,9 +564,9 @@ discard block |
||
| 564 | 564 | } elseif ( $key === 'the_post_title' ) { |
| 565 | 565 | $new_action->post_content['post_title'] = $value; |
| 566 | 566 | } elseif ( is_string( $value ) ) { |
| 567 | - $new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 567 | + $new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 568 | 568 | } else { |
| 569 | - $new_action->post_content[ $key ] = $value; |
|
| 569 | + $new_action->post_content[$key] = $value; |
|
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | 572 | |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | |
| 588 | 588 | $imported = $this->get_tracked_import(); |
| 589 | 589 | |
| 590 | - $imported[ $this->slug ][ $new_form_id ] = $source_id; |
|
| 590 | + $imported[$this->slug][$new_form_id] = $source_id; |
|
| 591 | 591 | |
| 592 | 592 | update_option( $this->tracking, $imported, false ); |
| 593 | 593 | } |
@@ -608,11 +608,11 @@ discard block |
||
| 608 | 608 | $imported = $this->get_tracked_import(); |
| 609 | 609 | $new_form_id = 0; |
| 610 | 610 | |
| 611 | - if ( ! isset( $imported[ $this->slug ] ) || ! in_array( $source_id, $imported[ $this->slug ] ) ) { |
|
| 611 | + if ( ! isset( $imported[$this->slug] ) || ! in_array( $source_id, $imported[$this->slug] ) ) { |
|
| 612 | 612 | return $new_form_id; |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - $new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) ); |
|
| 615 | + $new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) ); |
|
| 616 | 616 | |
| 617 | 617 | if ( ! empty( $new_form_id ) && empty( FrmForm::get_key_by_id( $new_form_id ) ) ) { |
| 618 | 618 | // Allow reimport if the form was deleted. |