@@ -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 | /** |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | } else { |
| 210 | 210 | $api = new FrmFormApi( $this->license ); |
| 211 | 211 | $plugins = $api->get_api_info(); |
| 212 | - $_data = $plugins[ $item_id ]; |
|
| 212 | + $_data = $plugins[$item_id]; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $_data['sections'] = array( |
@@ -512,19 +512,19 @@ discard block |
||
| 512 | 512 | |
| 513 | 513 | if ( $this->is_current_version( $transient ) ) { |
| 514 | 514 | // Make sure it doesn't show there is an update if plugin is up-to-date. |
| 515 | - if ( isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
| 516 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
| 515 | + if ( isset( $transient->response[$this->plugin_folder] ) ) { |
|
| 516 | + unset( $transient->response[$this->plugin_folder] ); |
|
| 517 | 517 | } |
| 518 | - } elseif ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
| 519 | - $this->prepare_update_details( $transient->response[ $this->plugin_folder ] ); |
|
| 518 | + } elseif ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) { |
|
| 519 | + $this->prepare_update_details( $transient->response[$this->plugin_folder] ); |
|
| 520 | 520 | |
| 521 | 521 | // if the transient has expired, clear the update and trigger it again |
| 522 | - if ( $transient->response[ $this->plugin_folder ] === false ) { |
|
| 522 | + if ( $transient->response[$this->plugin_folder] === false ) { |
|
| 523 | 523 | if ( ! $this->has_been_cleared() ) { |
| 524 | 524 | $this->cleared_plugins(); |
| 525 | 525 | $this->manually_queue_update(); |
| 526 | 526 | } |
| 527 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
| 527 | + unset( $transient->response[$this->plugin_folder] ); |
|
| 528 | 528 | } |
| 529 | 529 | } |
| 530 | 530 | |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | * @return bool |
| 638 | 638 | */ |
| 639 | 639 | private function is_current_version( $transient ) { |
| 640 | - if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) { |
|
| 640 | + if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) { |
|
| 641 | 641 | return false; |
| 642 | 642 | } |
| 643 | 643 | |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | return true; |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | - return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] === $transient->response[ $this->plugin_folder ]->new_version; |
|
| 650 | + return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] === $transient->response[$this->plugin_folder]->new_version; |
|
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | /** |
@@ -815,8 +815,8 @@ discard block |
||
| 815 | 815 | } else { |
| 816 | 816 | $messages = $this->get_messages(); |
| 817 | 817 | |
| 818 | - if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) { |
|
| 819 | - $response['message'] = $messages[ $response['status'] ]; |
|
| 818 | + if ( is_string( $response['status'] ) && isset( $messages[$response['status']] ) ) { |
|
| 819 | + $response['message'] = $messages[$response['status']]; |
|
| 820 | 820 | } else { |
| 821 | 821 | $response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) ); |
| 822 | 822 | } |
@@ -999,7 +999,7 @@ discard block |
||
| 999 | 999 | 'user-agent' => $this->plugin_slug . '/' . $this->version . '; ' . get_bloginfo( 'url' ), |
| 1000 | 1000 | ); |
| 1001 | 1001 | |
| 1002 | - $resp = wp_remote_post( |
|
| 1002 | + $resp = wp_remote_post( |
|
| 1003 | 1003 | $this->store_url . '?l=' . urlencode( base64_encode( $this->license ) ), |
| 1004 | 1004 | $arg_array |
| 1005 | 1005 | ); |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | * |
| 788 | 788 | * @return string |
| 789 | 789 | */ |
| 790 | - function ( $src ) { |
|
| 790 | + function( $src ) { |
|
| 791 | 791 | if ( is_null( $src ) ) { |
| 792 | 792 | $src = ''; |
| 793 | 793 | } |
@@ -851,11 +851,11 @@ discard block |
||
| 851 | 851 | ), |
| 852 | 852 | ); |
| 853 | 853 | |
| 854 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
| 854 | + if ( ! isset( $available_status[$status] ) ) { |
|
| 855 | 855 | return; |
| 856 | 856 | } |
| 857 | 857 | |
| 858 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
| 858 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
| 859 | 859 | |
| 860 | 860 | $params = FrmForm::list_page_params(); |
| 861 | 861 | |
@@ -864,8 +864,8 @@ discard block |
||
| 864 | 864 | |
| 865 | 865 | $count = 0; |
| 866 | 866 | |
| 867 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
| 868 | - ++$count; |
|
| 867 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
| 868 | + ++ $count; |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | $form_type = FrmAppHelper::get_simple_request( |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
| 882 | 882 | $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>' ); |
| 883 | 883 | |
| 884 | - $message = $available_status[ $status ]['message']; |
|
| 884 | + $message = $available_status[$status]['message']; |
|
| 885 | 885 | |
| 886 | 886 | self::display_forms_list( $params, $message ); |
| 887 | 887 | } |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | |
| 899 | 899 | foreach ( $ids as $id ) { |
| 900 | 900 | if ( FrmForm::trash( $id ) ) { |
| 901 | - ++$count; |
|
| 901 | + ++ $count; |
|
| 902 | 902 | } |
| 903 | 903 | } |
| 904 | 904 | |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | $count = 0; |
| 934 | 934 | |
| 935 | 935 | if ( FrmForm::destroy( $params['id'] ) ) { |
| 936 | - ++$count; |
|
| 936 | + ++ $count; |
|
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | /* translators: %1$s: Number of forms */ |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | $d = FrmForm::destroy( $id ); |
| 957 | 957 | |
| 958 | 958 | if ( $d ) { |
| 959 | - ++$count; |
|
| 959 | + ++ $count; |
|
| 960 | 960 | } |
| 961 | 961 | } |
| 962 | 962 | |
@@ -1479,7 +1479,7 @@ discard block |
||
| 1479 | 1479 | |
| 1480 | 1480 | add_action( |
| 1481 | 1481 | 'wp_enqueue_editor', |
| 1482 | - function () { |
|
| 1482 | + function() { |
|
| 1483 | 1483 | wp_print_media_templates(); |
| 1484 | 1484 | } |
| 1485 | 1485 | ); |
@@ -1619,7 +1619,7 @@ discard block |
||
| 1619 | 1619 | $section['id'] = $section['anchor']; |
| 1620 | 1620 | } |
| 1621 | 1621 | |
| 1622 | - $sections[ $key ] = $section; |
|
| 1622 | + $sections[$key] = $section; |
|
| 1623 | 1623 | }//end foreach |
| 1624 | 1624 | |
| 1625 | 1625 | return $sections; |
@@ -1759,7 +1759,7 @@ discard block |
||
| 1759 | 1759 | $user_helpers = array(); |
| 1760 | 1760 | |
| 1761 | 1761 | foreach ( $user_fields as $uk => $uf ) { |
| 1762 | - $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf; |
|
| 1762 | + $user_helpers['|user_id| show="' . $uk . '"'] = $uf; |
|
| 1763 | 1763 | unset( $uk, $uf ); |
| 1764 | 1764 | } |
| 1765 | 1765 | |
@@ -1904,7 +1904,7 @@ discard block |
||
| 1904 | 1904 | if ( ! isset( $frm_vars['js_validate_forms'] ) ) { |
| 1905 | 1905 | $frm_vars['js_validate_forms'] = array(); |
| 1906 | 1906 | } |
| 1907 | - $frm_vars['js_validate_forms'][ $form->id ] = $form; |
|
| 1907 | + $frm_vars['js_validate_forms'][$form->id] = $form; |
|
| 1908 | 1908 | } |
| 1909 | 1909 | |
| 1910 | 1910 | public static function get_email_html() { |
@@ -2107,7 +2107,7 @@ discard block |
||
| 2107 | 2107 | add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
| 2108 | 2108 | } else { |
| 2109 | 2109 | $vars = FrmAppHelper::json_to_array( $json_vars ); |
| 2110 | - $action = $vars[ $action ]; |
|
| 2110 | + $action = $vars[$action]; |
|
| 2111 | 2111 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 2112 | 2112 | $_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 2113 | 2113 | $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -2306,7 +2306,7 @@ discard block |
||
| 2306 | 2306 | |
| 2307 | 2307 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
| 2308 | 2308 | if ( is_object( $form ) ) { |
| 2309 | - $actions[ $form->id ] = $form->name; |
|
| 2309 | + $actions[$form->id] = $form->name; |
|
| 2310 | 2310 | } |
| 2311 | 2311 | unset( $form ); |
| 2312 | 2312 | } |
@@ -2594,8 +2594,8 @@ discard block |
||
| 2594 | 2594 | global $frm_vars; |
| 2595 | 2595 | |
| 2596 | 2596 | // phpcs:ignore WordPress.Security.NonceVerification.Missing, Universal.Operators.StrictComparisons |
| 2597 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { |
|
| 2598 | - $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
|
| 2597 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { |
|
| 2598 | + $errors = $frm_vars['created_entries'][$form->id]['errors']; |
|
| 2599 | 2599 | } else { |
| 2600 | 2600 | $errors = array(); |
| 2601 | 2601 | } |
@@ -2620,7 +2620,7 @@ discard block |
||
| 2620 | 2620 | */ |
| 2621 | 2621 | public static function just_created_entry( $form_id ) { |
| 2622 | 2622 | global $frm_vars; |
| 2623 | - 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; |
|
| 2623 | + 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; |
|
| 2624 | 2624 | } |
| 2625 | 2625 | |
| 2626 | 2626 | /** |
@@ -2641,7 +2641,7 @@ discard block |
||
| 2641 | 2641 | private static function get_confirmation_method( $atts ) { |
| 2642 | 2642 | $action = FrmOnSubmitHelper::current_event( $atts ); |
| 2643 | 2643 | $opt = 'update' === $action ? 'edit_action' : 'success_action'; |
| 2644 | - $method = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message'; |
|
| 2644 | + $method = ! empty( $atts['form']->options[$opt] ) ? $atts['form']->options[$opt] : 'message'; |
|
| 2645 | 2645 | |
| 2646 | 2646 | if ( ! empty( $atts['entry_id'] ) ) { |
| 2647 | 2647 | $met_actions = self::get_met_on_submit_actions( $atts, $action ); |
@@ -2670,7 +2670,7 @@ discard block |
||
| 2670 | 2670 | public static function maybe_trigger_redirect( $form, $params, $args ) { |
| 2671 | 2671 | if ( ! isset( $params['id'] ) ) { |
| 2672 | 2672 | global $frm_vars; |
| 2673 | - $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id']; |
|
| 2673 | + $params['id'] = $frm_vars['created_entries'][$form->id]['entry_id']; |
|
| 2674 | 2674 | } |
| 2675 | 2675 | |
| 2676 | 2676 | $conf_method = self::get_confirmation_method( |
@@ -2759,7 +2759,7 @@ discard block |
||
| 2759 | 2759 | $args['success_opt'] = $opt; |
| 2760 | 2760 | $args['ajax'] = ! empty( $frm_vars['ajax'] ); |
| 2761 | 2761 | |
| 2762 | - if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) { |
|
| 2762 | + if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) { |
|
| 2763 | 2763 | self::load_page_after_submit( $args ); |
| 2764 | 2764 | } elseif ( $args['conf_method'] === 'redirect' ) { |
| 2765 | 2765 | self::redirect_after_submit( $args ); |
@@ -2784,7 +2784,7 @@ discard block |
||
| 2784 | 2784 | } |
| 2785 | 2785 | |
| 2786 | 2786 | // If a redirect action has already opened the URL in a new tab, we show the default message in the current tab. |
| 2787 | - if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) { |
|
| 2787 | + if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) { |
|
| 2788 | 2788 | return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) ); |
| 2789 | 2789 | } |
| 2790 | 2790 | |
@@ -2976,7 +2976,7 @@ discard block |
||
| 2976 | 2976 | FrmOnSubmitHelper::populate_on_submit_data( $new_args['form']->options, $action, $args['action'] ); |
| 2977 | 2977 | |
| 2978 | 2978 | $opt = 'update' === $args['action'] ? 'edit_' : 'success_'; |
| 2979 | - $new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ]; |
|
| 2979 | + $new_args['conf_method'] = $new_args['form']->options[$opt . 'action']; |
|
| 2980 | 2980 | |
| 2981 | 2981 | /** |
| 2982 | 2982 | * Filters the run success action args. |
@@ -3002,8 +3002,8 @@ discard block |
||
| 3002 | 3002 | $opt = $args['success_opt']; |
| 3003 | 3003 | |
| 3004 | 3004 | // phpcs:ignore Universal.Operators.StrictComparisons |
| 3005 | - if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) { |
|
| 3006 | - $page = get_post( $args['form']->options[ $opt . '_page_id' ] ); |
|
| 3005 | + if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) { |
|
| 3006 | + $page = get_post( $args['form']->options[$opt . '_page_id'] ); |
|
| 3007 | 3007 | $old_post = $post; |
| 3008 | 3008 | $post = $page; |
| 3009 | 3009 | $content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] ); |
@@ -3034,7 +3034,7 @@ discard block |
||
| 3034 | 3034 | add_filter( 'frm_use_wpautop', '__return_false' ); |
| 3035 | 3035 | |
| 3036 | 3036 | $opt = $args['success_opt']; |
| 3037 | - $success_url = trim( $args['form']->options[ $opt . '_url' ] ); |
|
| 3037 | + $success_url = trim( $args['form']->options[$opt . '_url'] ); |
|
| 3038 | 3038 | $success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] ); |
| 3039 | 3039 | $success_url = do_shortcode( $success_url ); |
| 3040 | 3040 | |
@@ -3055,7 +3055,7 @@ discard block |
||
| 3055 | 3055 | // Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
| 3056 | 3056 | if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) { |
| 3057 | 3057 | self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args ); |
| 3058 | - self::$redirected_in_new_tab[ $args['form']->id ] = 1; |
|
| 3058 | + self::$redirected_in_new_tab[$args['form']->id] = 1; |
|
| 3059 | 3059 | return; |
| 3060 | 3060 | } |
| 3061 | 3061 | |
@@ -3364,7 +3364,7 @@ discard block |
||
| 3364 | 3364 | 'description' => false, |
| 3365 | 3365 | 'reset' => false, |
| 3366 | 3366 | ); |
| 3367 | - $args = wp_parse_args( $args, $defaults ); |
|
| 3367 | + $args = wp_parse_args( $args, $defaults ); |
|
| 3368 | 3368 | } |
| 3369 | 3369 | |
| 3370 | 3370 | /** |
@@ -3406,7 +3406,7 @@ discard block |
||
| 3406 | 3406 | $opt = $args['success_opt'] ?? 'success'; |
| 3407 | 3407 | |
| 3408 | 3408 | if ( $entry_id && is_numeric( $entry_id ) ) { |
| 3409 | - $message = $form->options[ $opt . '_msg' ] ?? $frm_settings->success_msg; |
|
| 3409 | + $message = $form->options[$opt . '_msg'] ?? $frm_settings->success_msg; |
|
| 3410 | 3410 | $class = 'frm_message'; |
| 3411 | 3411 | } else { |
| 3412 | 3412 | $message = $frm_settings->failed_msg; |
@@ -3664,8 +3664,8 @@ discard block |
||
| 3664 | 3664 | |
| 3665 | 3665 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 3666 | 3666 | |
| 3667 | - $html = FrmAppHelper::clip( |
|
| 3668 | - function () { |
|
| 3667 | + $html = FrmAppHelper::clip( |
|
| 3668 | + function() { |
|
| 3669 | 3669 | FrmAppHelper::maybe_autocomplete_pages_options( |
| 3670 | 3670 | array( |
| 3671 | 3671 | 'field_name' => 'frm_page_dropdown', |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public static function get_current_action_from_global_var( $form_id ) { |
| 91 | 91 | global $frm_vars; |
| 92 | - return $frm_vars['form_params'][ $form_id ]['action'] ?? 'create'; |
|
| 92 | + return $frm_vars['form_params'][$form_id]['action'] ?? 'create'; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | public static function remove_submit_field_from_list( &$fields ) { |
| 188 | 188 | foreach ( $fields as $key => $field ) { |
| 189 | 189 | if ( self::FIELD_TYPE === FrmField::get_field_type( $field ) ) { |
| 190 | - unset( $fields[ $key ] ); |
|
| 190 | + unset( $fields[$key] ); |
|
| 191 | 191 | return; |
| 192 | 192 | } |
| 193 | 193 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | ); |
| 245 | 245 | |
| 246 | 246 | if ( false !== $updated ) { |
| 247 | - self::$last_row_fields_order[ $last_row_field_id ] = $new_order; |
|
| 247 | + self::$last_row_fields_order[$last_row_field_id] = $new_order; |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -152,10 +152,10 @@ discard block |
||
| 152 | 152 | $repeating = ! empty( $args['repeating'] ); |
| 153 | 153 | |
| 154 | 154 | if ( $repeating ) { |
| 155 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 155 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 156 | 156 | $value_is_posted = true; |
| 157 | 157 | } |
| 158 | - } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 158 | + } elseif ( isset( $_POST['item_meta'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 159 | 159 | $value_is_posted = true; |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -199,12 +199,12 @@ discard block |
||
| 199 | 199 | preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
| 200 | 200 | |
| 201 | 201 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 202 | - $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 202 | + $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 203 | 203 | $this_atts = ! empty( $add_atts ) ? array_merge( $atts, $add_atts ) : $atts; |
| 204 | 204 | $default = FrmEntriesController::show_entry_shortcode( $this_atts ); |
| 205 | 205 | |
| 206 | 206 | // Add the default message. |
| 207 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
| 207 | + $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | return $message; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @return string |
| 219 | 219 | */ |
| 220 | 220 | public static function prepare_display_value( $entry, $field, $atts ) { |
| 221 | - $field_value = $entry->metas[ $field->id ] ?? false; |
|
| 221 | + $field_value = $entry->metas[$field->id] ?? false; |
|
| 222 | 222 | |
| 223 | 223 | if ( FrmAppHelper::pro_is_installed() ) { |
| 224 | 224 | $empty = empty( $field_value ); |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ), '', '', true ); |
| 250 | 250 | } else { |
| 251 | 251 | // Get all values for this field. |
| 252 | - $child_values = $entry->metas[ $atts['embedded_field_id'] ] ?? false; |
|
| 252 | + $child_values = $entry->metas[$atts['embedded_field_id']] ?? false; |
|
| 253 | 253 | |
| 254 | 254 | if ( $child_values ) { |
| 255 | 255 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | if ( empty( $args['parent_field_id'] ) ) { |
| 385 | - $_POST['item_meta'][ $field->id ] = $value; |
|
| 385 | + $_POST['item_meta'][$field->id] = $value; |
|
| 386 | 386 | } else { |
| 387 | 387 | self::set_parent_field_posted_value( $field, $value, $args ); |
| 388 | 388 | } |
@@ -400,17 +400,17 @@ discard block |
||
| 400 | 400 | * @return void |
| 401 | 401 | */ |
| 402 | 402 | private static function set_parent_field_posted_value( $field, $value, $args ) { |
| 403 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 404 | - if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 405 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 403 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']] ) && is_array( $_POST['item_meta'][$args['parent_field_id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 404 | + if ( ! isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) || ! is_array( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 405 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 406 | 406 | } |
| 407 | 407 | } else { |
| 408 | 408 | // All of the section was probably removed. |
| 409 | - $_POST['item_meta'][ $args['parent_field_id'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 410 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 409 | + $_POST['item_meta'][$args['parent_field_id']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 410 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 413 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | /** |
@@ -457,9 +457,9 @@ discard block |
||
| 457 | 457 | private static function get_posted_meta( $field_id, $args ) { |
| 458 | 458 | if ( empty( $args['parent_field_id'] ) ) { |
| 459 | 459 | // Sanitizing is done next. |
| 460 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $field_id ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 460 | + $value = isset( $_POST['item_meta'][$field_id] ) ? wp_unslash( $_POST['item_meta'][$field_id] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 461 | 461 | } else { |
| 462 | - $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 462 | + $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 463 | 463 | } |
| 464 | 464 | return $value; |
| 465 | 465 | } |
@@ -493,14 +493,14 @@ discard block |
||
| 493 | 493 | self::set_other_repeating_vals( $field, $value, $args ); |
| 494 | 494 | |
| 495 | 495 | // Check if there are any posted "Other" values. |
| 496 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 496 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 497 | 497 | |
| 498 | 498 | // Save original value. |
| 499 | 499 | $args['temp_value'] = $value; |
| 500 | 500 | $args['other'] = true; |
| 501 | 501 | |
| 502 | 502 | // Sanitizing is done next. |
| 503 | - $other_vals = wp_unslash( $_POST['item_meta']['other'][ $field->id ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 503 | + $other_vals = wp_unslash( $_POST['item_meta']['other'][$field->id] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 504 | 504 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
| 505 | 505 | |
| 506 | 506 | // Set the validation value now |
@@ -525,11 +525,11 @@ discard block |
||
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | // Check if there are any other posted "other" values for this field. |
| 528 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 528 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 529 | 529 | // Save original value |
| 530 | 530 | $args['temp_value'] = $value; |
| 531 | 531 | $args['other'] = true; |
| 532 | - $other_vals = wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 532 | + $other_vals = wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 533 | 533 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
| 534 | 534 | |
| 535 | 535 | // Set the validation value now. |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | if ( is_array( $value ) && $field->type === 'checkbox' ) { |
| 559 | 559 | // Combine "Other" values with checked values. "Other" values will override checked box values. |
| 560 | 560 | foreach ( $other_vals as $k => $v ) { |
| 561 | - if ( isset( $value[ $k ] ) && trim( $v ) === '' ) { |
|
| 561 | + if ( isset( $value[$k] ) && trim( $v ) === '' ) { |
|
| 562 | 562 | // If the other box is checked, but doesn't have a value. |
| 563 | 563 | $value = ''; |
| 564 | 564 | break; |
@@ -576,26 +576,26 @@ discard block |
||
| 576 | 576 | // Multi-select dropdown. |
| 577 | 577 | if ( is_array( $value ) ) { |
| 578 | 578 | // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
| 579 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
| 579 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
| 580 | 580 | |
| 581 | 581 | if ( $o_key !== false ) { |
| 582 | 582 | // Modify the original value so other key will be preserved. |
| 583 | - $value[ $other_key ] = $value[ $o_key ]; |
|
| 583 | + $value[$other_key] = $value[$o_key]; |
|
| 584 | 584 | |
| 585 | 585 | // By default, the array keys will be numeric for multi-select dropdowns. |
| 586 | 586 | // If going backwards and forwards between pages, the array key will match the other key. |
| 587 | 587 | if ( $o_key !== $other_key ) { |
| 588 | - unset( $value[ $o_key ] ); |
|
| 588 | + unset( $value[$o_key] ); |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | $args['temp_value'] = $value; |
| 592 | - $value[ $other_key ] = reset( $other_vals ); |
|
| 592 | + $value[$other_key] = reset( $other_vals ); |
|
| 593 | 593 | |
| 594 | - if ( FrmAppHelper::is_empty_value( $value[ $other_key ] ) ) { |
|
| 595 | - unset( $value[ $other_key ] ); |
|
| 594 | + if ( FrmAppHelper::is_empty_value( $value[$other_key] ) ) { |
|
| 595 | + unset( $value[$other_key] ); |
|
| 596 | 596 | } |
| 597 | 597 | } |
| 598 | - } elseif ( $field->options[ $other_key ] == $value ) { // phpcs:ignore Universal.Operators.StrictComparisons |
|
| 598 | + } elseif ( $field->options[$other_key] == $value ) { // phpcs:ignore Universal.Operators.StrictComparisons |
|
| 599 | 599 | $value = $other_vals; |
| 600 | 600 | }//end if |
| 601 | 601 | }//end if |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | * @return void |
| 855 | 855 | */ |
| 856 | 856 | public static function maybe_render_captcha_score( $entry_id ) { |
| 857 | - $query = array( |
|
| 857 | + $query = array( |
|
| 858 | 858 | 'item_id' => (int) $entry_id, |
| 859 | 859 | 'field_id' => 0, |
| 860 | 860 | ); |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | */ |
| 909 | 909 | public static function get_entry_status_label( $status ) { |
| 910 | 910 | $statuses = self::get_entry_statuses(); |
| 911 | - return $statuses[ self::get_entry_status( $status ) ]; |
|
| 911 | + return $statuses[self::get_entry_status( $status )]; |
|
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | /** |
@@ -39,16 +39,16 @@ discard block |
||
| 39 | 39 | $tokens = $phpcsFile->getTokens(); |
| 40 | 40 | |
| 41 | 41 | // Make sure this function has a body. |
| 42 | - if ( ! isset( $tokens[ $stackPtr ]['scope_opener'] ) || ! isset( $tokens[ $stackPtr ]['scope_closer'] ) ) { |
|
| 42 | + if ( ! isset( $tokens[$stackPtr]['scope_opener'] ) || ! isset( $tokens[$stackPtr]['scope_closer'] ) ) { |
|
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - $openBrace = $tokens[ $stackPtr ]['scope_opener']; |
|
| 47 | - $closeBrace = $tokens[ $stackPtr ]['scope_closer']; |
|
| 46 | + $openBrace = $tokens[$stackPtr]['scope_opener']; |
|
| 47 | + $closeBrace = $tokens[$stackPtr]['scope_closer']; |
|
| 48 | 48 | |
| 49 | 49 | // Get the line numbers. |
| 50 | - $openLine = $tokens[ $openBrace ]['line']; |
|
| 51 | - $closeLine = $tokens[ $closeBrace ]['line']; |
|
| 50 | + $openLine = $tokens[$openBrace]['line']; |
|
| 51 | + $closeLine = $tokens[$closeBrace]['line']; |
|
| 52 | 52 | |
| 53 | 53 | // Calculate the number of lines in the function body. |
| 54 | 54 | // For a 3-line function with a blank line: |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | $statementCount = 0; |
| 69 | 69 | $semicolons = array(); |
| 70 | 70 | |
| 71 | - for ( $i = $openBrace + 1; $i < $closeBrace; $i++ ) { |
|
| 72 | - if ( $tokens[ $i ]['code'] === T_SEMICOLON ) { |
|
| 73 | - ++$statementCount; |
|
| 71 | + for ( $i = $openBrace + 1; $i < $closeBrace; $i ++ ) { |
|
| 72 | + if ( $tokens[$i]['code'] === T_SEMICOLON ) { |
|
| 73 | + ++ $statementCount; |
|
| 74 | 74 | $semicolons[] = $i; |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | return; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $firstLine = $tokens[ $firstSemicolon ]['line']; |
|
| 92 | - $secondLine = $tokens[ $secondStatement ]['line']; |
|
| 91 | + $firstLine = $tokens[$firstSemicolon]['line']; |
|
| 92 | + $secondLine = $tokens[$secondStatement]['line']; |
|
| 93 | 93 | |
| 94 | 94 | // If there's exactly one blank line between them (2 line difference). |
| 95 | 95 | if ( $secondLine - $firstLine !== 2 ) { |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | // Get the indentation from the token before the second statement. |
| 109 | 109 | $indent = ''; |
| 110 | 110 | |
| 111 | - if ( $tokens[ $secondStatement - 1 ]['code'] === T_WHITESPACE ) { |
|
| 112 | - $wsContent = $tokens[ $secondStatement - 1 ]['content']; |
|
| 111 | + if ( $tokens[$secondStatement - 1]['code'] === T_WHITESPACE ) { |
|
| 112 | + $wsContent = $tokens[$secondStatement - 1]['content']; |
|
| 113 | 113 | $lastNewline = strrpos( $wsContent, "\n" ); |
| 114 | 114 | |
| 115 | 115 | if ( false !== $lastNewline ) { |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | // Replace all whitespace tokens between semicolon and next statement. |
| 123 | 123 | $first = true; |
| 124 | 124 | |
| 125 | - for ( $i = $firstSemicolon + 1; $i < $secondStatement; $i++ ) { |
|
| 126 | - if ( $tokens[ $i ]['code'] === T_WHITESPACE ) { |
|
| 125 | + for ( $i = $firstSemicolon + 1; $i < $secondStatement; $i ++ ) { |
|
| 126 | + if ( $tokens[$i]['code'] === T_WHITESPACE ) { |
|
| 127 | 127 | if ( $first ) { |
| 128 | 128 | $phpcsFile->fixer->replaceToken( $i, "\n" . $indent ); |
| 129 | 129 | $first = false; |