@@ -1697,7 +1697,8 @@ discard block |
||
| 1697 | 1697 | $vars = array(); |
| 1698 | 1698 | FrmAppHelper::include_svg(); |
| 1699 | 1699 | |
| 1700 | - if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1700 | + if ( isset( $_POST['frm_compact_fields'] ) ) { |
|
| 1701 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1701 | 1702 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 1702 | 1703 | |
| 1703 | 1704 | // Javascript needs to be allowed in some field settings. |
@@ -2007,7 +2008,8 @@ discard block |
||
| 2007 | 2008 | private static function maybe_get_form_to_show( $id ) { |
| 2008 | 2009 | $form = false; |
| 2009 | 2010 | |
| 2010 | - if ( ! empty( $id ) ) { // form id or key is set |
|
| 2011 | + if ( ! empty( $id ) ) { |
|
| 2012 | +// form id or key is set |
|
| 2011 | 2013 | $form = FrmForm::getOne( $id ); |
| 2012 | 2014 | if ( ! $form || $form->parent_form_id || $form->status === 'trash' ) { |
| 2013 | 2015 | $form = false; |
@@ -2090,7 +2092,8 @@ discard block |
||
| 2090 | 2092 | private static function get_saved_errors( $form, $params ) { |
| 2091 | 2093 | global $frm_vars; |
| 2092 | 2094 | |
| 2093 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 2095 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { |
|
| 2096 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 2094 | 2097 | $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
| 2095 | 2098 | } else { |
| 2096 | 2099 | $errors = array(); |
@@ -2243,7 +2246,8 @@ discard block |
||
| 2243 | 2246 | } |
| 2244 | 2247 | |
| 2245 | 2248 | if ( 'redirect' === FrmOnSubmitHelper::get_action_type( $action ) ) { |
| 2246 | - if ( $has_redirect ) { // Do not process because we run the first redirect action only. |
|
| 2249 | + if ( $has_redirect ) { |
|
| 2250 | +// Do not process because we run the first redirect action only. |
|
| 2247 | 2251 | continue; |
| 2248 | 2252 | } |
| 2249 | 2253 | |
@@ -2402,12 +2406,14 @@ discard block |
||
| 2402 | 2406 | |
| 2403 | 2407 | $doing_ajax = FrmAppHelper::doing_ajax(); |
| 2404 | 2408 | |
| 2405 | - if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) { // Is AJAX submit and there is just one Redirect action runs. |
|
| 2409 | + if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) { |
|
| 2410 | +// Is AJAX submit and there is just one Redirect action runs. |
|
| 2406 | 2411 | echo json_encode( array( 'redirect' => $success_url ) ); |
| 2407 | 2412 | wp_die(); |
| 2408 | 2413 | } |
| 2409 | 2414 | |
| 2410 | - if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { // Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
|
| 2415 | + if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { |
|
| 2416 | +// Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
|
| 2411 | 2417 | wp_redirect( esc_url_raw( $success_url ) ); |
| 2412 | 2418 | die(); // do not use wp_die or redirect fails |
| 2413 | 2419 | } |
@@ -2432,7 +2438,8 @@ discard block |
||
| 2432 | 2438 | |
| 2433 | 2439 | echo FrmAppHelper::maybe_kses( $redirect_msg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 2434 | 2440 | echo '<script>'; |
| 2435 | - if ( empty( $args['doing_ajax'] ) ) { // Not AJAX submit, delay JS until window.load. |
|
| 2441 | + if ( empty( $args['doing_ajax'] ) ) { |
|
| 2442 | +// Not AJAX submit, delay JS until window.load. |
|
| 2436 | 2443 | echo 'window.onload=function(){'; |
| 2437 | 2444 | } |
| 2438 | 2445 | echo 'setTimeout(function(){window.location="' . esc_url_raw( $args['success_url'] ) . '";}, ' . intval( $delay_time ) . ');'; |
@@ -520,11 +520,11 @@ discard block |
||
| 520 | 520 | ), |
| 521 | 521 | ); |
| 522 | 522 | |
| 523 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
| 523 | + if ( ! isset( $available_status[$status] ) ) { |
|
| 524 | 524 | return; |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
| 527 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
| 528 | 528 | |
| 529 | 529 | $params = FrmForm::list_page_params(); |
| 530 | 530 | |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | check_admin_referer( $status . '_form_' . $params['id'] ); |
| 533 | 533 | |
| 534 | 534 | $count = 0; |
| 535 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
| 535 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
| 536 | 536 | $count ++; |
| 537 | 537 | } |
| 538 | 538 | |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
| 550 | 550 | $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>' ); |
| 551 | 551 | |
| 552 | - $message = $available_status[ $status ]['message']; |
|
| 552 | + $message = $available_status[$status]['message']; |
|
| 553 | 553 | |
| 554 | 554 | self::display_forms_list( $params, $message ); |
| 555 | 555 | } |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | 'type' => 'request', |
| 571 | 571 | ) |
| 572 | 572 | ); |
| 573 | - $message = sprintf( |
|
| 573 | + $message = sprintf( |
|
| 574 | 574 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
| 575 | 575 | _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' ), |
| 576 | 576 | $count, |
@@ -994,11 +994,11 @@ discard block |
||
| 994 | 994 | } |
| 995 | 995 | |
| 996 | 996 | foreach ( $template['categories'] as $category ) { |
| 997 | - if ( ! isset( $templates_by_category[ $category ] ) ) { |
|
| 998 | - $templates_by_category[ $category ] = array(); |
|
| 997 | + if ( ! isset( $templates_by_category[$category] ) ) { |
|
| 998 | + $templates_by_category[$category] = array(); |
|
| 999 | 999 | } |
| 1000 | 1000 | |
| 1001 | - $templates_by_category[ $category ][] = $template; |
|
| 1001 | + $templates_by_category[$category][] = $template; |
|
| 1002 | 1002 | } |
| 1003 | 1003 | } |
| 1004 | 1004 | unset( $template ); |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | $forms = FrmForm::get_published_forms( $where ); |
| 1028 | 1028 | $view_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/'; |
| 1029 | 1029 | |
| 1030 | - $templates_by_category[ $my_templates_translation ] = $custom_templates; |
|
| 1030 | + $templates_by_category[$my_templates_translation] = $custom_templates; |
|
| 1031 | 1031 | |
| 1032 | 1032 | unset( $pricing, $license_type, $where ); |
| 1033 | 1033 | wp_enqueue_script( 'accordion' ); // register accordion for template groups |
@@ -1270,7 +1270,7 @@ discard block |
||
| 1270 | 1270 | |
| 1271 | 1271 | foreach ( array( 'landing', 'chat' ) as $feature ) { |
| 1272 | 1272 | if ( ! FrmAppHelper::show_new_feature( $feature ) ) { |
| 1273 | - unset( $sections[ $feature ] ); |
|
| 1273 | + unset( $sections[$feature] ); |
|
| 1274 | 1274 | } |
| 1275 | 1275 | } |
| 1276 | 1276 | |
@@ -1303,7 +1303,7 @@ discard block |
||
| 1303 | 1303 | $section['id'] = $section['anchor']; |
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | - $sections[ $key ] = $section; |
|
| 1306 | + $sections[$key] = $section; |
|
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | 1309 | return $sections; |
@@ -1421,7 +1421,7 @@ discard block |
||
| 1421 | 1421 | if ( ! empty( $user_fields ) ) { |
| 1422 | 1422 | $user_helpers = array(); |
| 1423 | 1423 | foreach ( $user_fields as $uk => $uf ) { |
| 1424 | - $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf; |
|
| 1424 | + $user_helpers['|user_id| show="' . $uk . '"'] = $uf; |
|
| 1425 | 1425 | unset( $uk, $uf ); |
| 1426 | 1426 | } |
| 1427 | 1427 | |
@@ -1553,7 +1553,7 @@ discard block |
||
| 1553 | 1553 | if ( ! isset( $frm_vars['js_validate_forms'] ) ) { |
| 1554 | 1554 | $frm_vars['js_validate_forms'] = array(); |
| 1555 | 1555 | } |
| 1556 | - $frm_vars['js_validate_forms'][ $form->id ] = $form; |
|
| 1556 | + $frm_vars['js_validate_forms'][$form->id] = $form; |
|
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | 1559 | public static function get_email_html() { |
@@ -1708,7 +1708,7 @@ discard block |
||
| 1708 | 1708 | add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
| 1709 | 1709 | } else { |
| 1710 | 1710 | $vars = FrmAppHelper::json_to_array( $json_vars ); |
| 1711 | - $action = $vars[ $action ]; |
|
| 1711 | + $action = $vars[$action]; |
|
| 1712 | 1712 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1713 | 1713 | $_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1714 | 1714 | $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1842,7 +1842,7 @@ discard block |
||
| 1842 | 1842 | $actions = array(); |
| 1843 | 1843 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
| 1844 | 1844 | if ( is_object( $form ) ) { |
| 1845 | - $actions[ $form->id ] = $form->name; |
|
| 1845 | + $actions[$form->id] = $form->name; |
|
| 1846 | 1846 | } |
| 1847 | 1847 | unset( $form ); |
| 1848 | 1848 | } |
@@ -2083,8 +2083,8 @@ discard block |
||
| 2083 | 2083 | private static function get_saved_errors( $form, $params ) { |
| 2084 | 2084 | global $frm_vars; |
| 2085 | 2085 | |
| 2086 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 2087 | - $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
|
| 2086 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 2087 | + $errors = $frm_vars['created_entries'][$form->id]['errors']; |
|
| 2088 | 2088 | } else { |
| 2089 | 2089 | $errors = array(); |
| 2090 | 2090 | } |
@@ -2106,7 +2106,7 @@ discard block |
||
| 2106 | 2106 | public static function just_created_entry( $form_id ) { |
| 2107 | 2107 | global $frm_vars; |
| 2108 | 2108 | |
| 2109 | - 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; |
|
| 2109 | + 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; |
|
| 2110 | 2110 | } |
| 2111 | 2111 | |
| 2112 | 2112 | /** |
@@ -2125,7 +2125,7 @@ discard block |
||
| 2125 | 2125 | */ |
| 2126 | 2126 | private static function get_confirmation_method( $atts ) { |
| 2127 | 2127 | $opt = 'success_action'; |
| 2128 | - $method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message'; |
|
| 2128 | + $method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message'; |
|
| 2129 | 2129 | |
| 2130 | 2130 | if ( ! empty( $atts['entry_id'] ) && FrmOnSubmitHelper::form_has_migrated( $atts['form'] ) ) { |
| 2131 | 2131 | $met_actions = self::get_met_on_submit_actions( $atts ); |
@@ -2146,7 +2146,7 @@ discard block |
||
| 2146 | 2146 | public static function maybe_trigger_redirect( $form, $params, $args ) { |
| 2147 | 2147 | if ( ! isset( $params['id'] ) ) { |
| 2148 | 2148 | global $frm_vars; |
| 2149 | - $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id']; |
|
| 2149 | + $params['id'] = $frm_vars['created_entries'][$form->id]['entry_id']; |
|
| 2150 | 2150 | } |
| 2151 | 2151 | |
| 2152 | 2152 | $conf_method = self::get_confirmation_method( |
@@ -2226,7 +2226,7 @@ discard block |
||
| 2226 | 2226 | $args['success_opt'] = $opt; |
| 2227 | 2227 | $args['ajax'] = ! empty( $frm_vars['ajax'] ); |
| 2228 | 2228 | |
| 2229 | - if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) { |
|
| 2229 | + if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) { |
|
| 2230 | 2230 | self::load_page_after_submit( $args ); |
| 2231 | 2231 | } elseif ( $args['conf_method'] === 'redirect' ) { |
| 2232 | 2232 | self::redirect_after_submit( $args ); |
@@ -2380,7 +2380,7 @@ discard block |
||
| 2380 | 2380 | |
| 2381 | 2381 | $opt = 'update' === $args['action'] ? 'edit_' : 'success_'; |
| 2382 | 2382 | |
| 2383 | - $new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ]; |
|
| 2383 | + $new_args['conf_method'] = $new_args['form']->options[$opt . 'action']; |
|
| 2384 | 2384 | |
| 2385 | 2385 | /** |
| 2386 | 2386 | * Filters the run success action args. |
@@ -2400,8 +2400,8 @@ discard block |
||
| 2400 | 2400 | private static function load_page_after_submit( $args ) { |
| 2401 | 2401 | global $post; |
| 2402 | 2402 | $opt = $args['success_opt']; |
| 2403 | - if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) { |
|
| 2404 | - $page = get_post( $args['form']->options[ $opt . '_page_id' ] ); |
|
| 2403 | + if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) { |
|
| 2404 | + $page = get_post( $args['form']->options[$opt . '_page_id'] ); |
|
| 2405 | 2405 | $old_post = $post; |
| 2406 | 2406 | $post = $page; |
| 2407 | 2407 | $content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] ); |
@@ -2431,7 +2431,7 @@ discard block |
||
| 2431 | 2431 | add_filter( 'frm_use_wpautop', '__return_false' ); |
| 2432 | 2432 | |
| 2433 | 2433 | $opt = $args['success_opt']; |
| 2434 | - $success_url = trim( $args['form']->options[ $opt . '_url' ] ); |
|
| 2434 | + $success_url = trim( $args['form']->options[$opt . '_url'] ); |
|
| 2435 | 2435 | $success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] ); |
| 2436 | 2436 | $success_url = do_shortcode( $success_url ); |
| 2437 | 2437 | |
@@ -2603,7 +2603,7 @@ discard block |
||
| 2603 | 2603 | 'description' => false, |
| 2604 | 2604 | 'reset' => false, |
| 2605 | 2605 | ); |
| 2606 | - $args = wp_parse_args( $args, $defaults ); |
|
| 2606 | + $args = wp_parse_args( $args, $defaults ); |
|
| 2607 | 2607 | } |
| 2608 | 2608 | |
| 2609 | 2609 | /** |
@@ -2641,7 +2641,7 @@ discard block |
||
| 2641 | 2641 | $opt = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success'; |
| 2642 | 2642 | |
| 2643 | 2643 | if ( $entry_id && is_numeric( $entry_id ) ) { |
| 2644 | - $message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg; |
|
| 2644 | + $message = isset( $form->options[$opt . '_msg'] ) ? $form->options[$opt . '_msg'] : $frm_settings->success_msg; |
|
| 2645 | 2645 | $class = 'frm_message'; |
| 2646 | 2646 | } else { |
| 2647 | 2647 | $message = $frm_settings->failed_msg; |
@@ -2865,7 +2865,7 @@ discard block |
||
| 2865 | 2865 | |
| 2866 | 2866 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 2867 | 2867 | |
| 2868 | - $html = FrmAppHelper::clip( |
|
| 2868 | + $html = FrmAppHelper::clip( |
|
| 2869 | 2869 | function() { |
| 2870 | 2870 | FrmAppHelper::maybe_autocomplete_pages_options( |
| 2871 | 2871 | array( |
@@ -2902,7 +2902,7 @@ discard block |
||
| 2902 | 2902 | FrmAppHelper::unserialize_or_decode( $form->options ); |
| 2903 | 2903 | |
| 2904 | 2904 | $flag_key = 'on_submit_migrated'; |
| 2905 | - if ( ! empty( $form->options[ $flag_key ] ) ) { |
|
| 2905 | + if ( ! empty( $form->options[$flag_key] ) ) { |
|
| 2906 | 2906 | return; |
| 2907 | 2907 | } |
| 2908 | 2908 | |
@@ -2946,7 +2946,7 @@ discard block |
||
| 2946 | 2946 | $action['post_content'] = FrmAppHelper::prepare_and_encode( $action['post_content'] ); |
| 2947 | 2947 | FrmDb::save_json_post( $action ); |
| 2948 | 2948 | |
| 2949 | - $form->options[ $flag_key ] = 1; |
|
| 2949 | + $form->options[$flag_key] = 1; |
|
| 2950 | 2950 | FrmForm::update( $form->id, array( 'options' => $form->options ) ); |
| 2951 | 2951 | } |
| 2952 | 2952 | |
@@ -2962,20 +2962,20 @@ discard block |
||
| 2962 | 2962 | private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) { |
| 2963 | 2963 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
| 2964 | 2964 | $data = array( |
| 2965 | - 'success_action' => isset( $form_options[ $opt . 'action' ] ) ? $form_options[ $opt . 'action' ] : FrmOnSubmitHelper::get_default_action_type(), |
|
| 2965 | + 'success_action' => isset( $form_options[$opt . 'action'] ) ? $form_options[$opt . 'action'] : FrmOnSubmitHelper::get_default_action_type(), |
|
| 2966 | 2966 | ); |
| 2967 | 2967 | |
| 2968 | 2968 | switch ( $data['success_action'] ) { |
| 2969 | 2969 | case 'redirect': |
| 2970 | - $data['success_url'] = isset( $form_options[ $opt . 'url' ] ) ? $form_options[ $opt . 'url' ] : ''; |
|
| 2970 | + $data['success_url'] = isset( $form_options[$opt . 'url'] ) ? $form_options[$opt . 'url'] : ''; |
|
| 2971 | 2971 | break; |
| 2972 | 2972 | |
| 2973 | 2973 | case 'page': |
| 2974 | - $data['success_page_id'] = isset( $form_options[ $opt . 'page_id' ] ) ? $form_options[ $opt . 'page_id' ] : ''; |
|
| 2974 | + $data['success_page_id'] = isset( $form_options[$opt . 'page_id'] ) ? $form_options[$opt . 'page_id'] : ''; |
|
| 2975 | 2975 | break; |
| 2976 | 2976 | |
| 2977 | 2977 | default: |
| 2978 | - $data['success_msg'] = isset( $form_options[ $opt . 'msg' ] ) ? $form_options[ $opt . 'msg' ] : FrmOnSubmitHelper::get_default_msg(); |
|
| 2978 | + $data['success_msg'] = isset( $form_options[$opt . 'msg'] ) ? $form_options[$opt . 'msg'] : FrmOnSubmitHelper::get_default_msg(); |
|
| 2979 | 2979 | $data['show_form'] = ! empty( $form_options['show_form'] ); |
| 2980 | 2980 | } |
| 2981 | 2981 | |