|
@@ -485,11 +485,11 @@ discard block |
|
|
block discarded – undo |
|
485
|
485
|
), |
|
486
|
486
|
); |
|
487
|
487
|
|
|
488
|
|
- if ( ! isset( $available_status[ $status ] ) ) { |
|
|
488
|
+ if ( ! isset( $available_status[$status] ) ) { |
|
489
|
489
|
return; |
|
490
|
490
|
} |
|
491
|
491
|
|
|
492
|
|
- FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
|
492
|
+ FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
493
|
493
|
|
|
494
|
494
|
$params = FrmForm::list_page_params(); |
|
495
|
495
|
|
|
@@ -497,7 +497,7 @@ discard block |
|
|
block discarded – undo |
|
497
|
497
|
check_admin_referer( $status . '_form_' . $params['id'] ); |
|
498
|
498
|
|
|
499
|
499
|
$count = 0; |
|
500
|
|
- if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
|
500
|
+ if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
501
|
501
|
$count ++; |
|
502
|
502
|
} |
|
503
|
503
|
|
|
@@ -514,7 +514,7 @@ discard block |
|
|
block discarded – undo |
|
514
|
514
|
/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
|
515
|
515
|
$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>' ); |
|
516
|
516
|
|
|
517
|
|
- $message = $available_status[ $status ]['message']; |
|
|
517
|
+ $message = $available_status[$status]['message']; |
|
518
|
518
|
|
|
519
|
519
|
self::display_forms_list( $params, $message ); |
|
520
|
520
|
} |
|
@@ -535,7 +535,7 @@ discard block |
|
|
block discarded – undo |
|
535
|
535
|
'type' => 'request', |
|
536
|
536
|
) |
|
537
|
537
|
); |
|
538
|
|
- $message = sprintf( |
|
|
538
|
+ $message = sprintf( |
|
539
|
539
|
/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
|
540
|
540
|
_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' ), |
|
541
|
541
|
$count, |
|
@@ -975,11 +975,11 @@ discard block |
|
|
block discarded – undo |
|
975
|
975
|
} |
|
976
|
976
|
|
|
977
|
977
|
foreach ( $template['categories'] as $category ) { |
|
978
|
|
- if ( ! isset( $templates_by_category[ $category ] ) ) { |
|
979
|
|
- $templates_by_category[ $category ] = array(); |
|
|
978
|
+ if ( ! isset( $templates_by_category[$category] ) ) { |
|
|
979
|
+ $templates_by_category[$category] = array(); |
|
980
|
980
|
} |
|
981
|
981
|
|
|
982
|
|
- $templates_by_category[ $category ][] = $template; |
|
|
982
|
+ $templates_by_category[$category][] = $template; |
|
983
|
983
|
} |
|
984
|
984
|
} |
|
985
|
985
|
unset( $template ); |
|
@@ -1008,7 +1008,7 @@ discard block |
|
|
block discarded – undo |
|
1008
|
1008
|
$forms = FrmForm::get_published_forms( $where ); |
|
1009
|
1009
|
$view_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/'; |
|
1010
|
1010
|
|
|
1011
|
|
- $templates_by_category[ $my_templates_translation ] = $custom_templates; |
|
|
1011
|
+ $templates_by_category[$my_templates_translation] = $custom_templates; |
|
1012
|
1012
|
|
|
1013
|
1013
|
unset( $pricing, $license_type, $where ); |
|
1014
|
1014
|
wp_enqueue_script( 'accordion' ); // register accordion for template groups |
|
@@ -1251,7 +1251,7 @@ discard block |
|
|
block discarded – undo |
|
1251
|
1251
|
|
|
1252
|
1252
|
foreach ( array( 'landing', 'chat' ) as $feature ) { |
|
1253
|
1253
|
if ( ! FrmAppHelper::show_new_feature( $feature ) ) { |
|
1254
|
|
- unset( $sections[ $feature ] ); |
|
|
1254
|
+ unset( $sections[$feature] ); |
|
1255
|
1255
|
} |
|
1256
|
1256
|
} |
|
1257
|
1257
|
|
|
@@ -1284,7 +1284,7 @@ discard block |
|
|
block discarded – undo |
|
1284
|
1284
|
$section['id'] = $section['anchor']; |
|
1285
|
1285
|
} |
|
1286
|
1286
|
|
|
1287
|
|
- $sections[ $key ] = $section; |
|
|
1287
|
+ $sections[$key] = $section; |
|
1288
|
1288
|
} |
|
1289
|
1289
|
|
|
1290
|
1290
|
return $sections; |
|
@@ -1402,7 +1402,7 @@ discard block |
|
|
block discarded – undo |
|
1402
|
1402
|
if ( ! empty( $user_fields ) ) { |
|
1403
|
1403
|
$user_helpers = array(); |
|
1404
|
1404
|
foreach ( $user_fields as $uk => $uf ) { |
|
1405
|
|
- $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf; |
|
|
1405
|
+ $user_helpers['|user_id| show="' . $uk . '"'] = $uf; |
|
1406
|
1406
|
unset( $uk, $uf ); |
|
1407
|
1407
|
} |
|
1408
|
1408
|
|
|
@@ -1534,7 +1534,7 @@ discard block |
|
|
block discarded – undo |
|
1534
|
1534
|
if ( ! isset( $frm_vars['js_validate_forms'] ) ) { |
|
1535
|
1535
|
$frm_vars['js_validate_forms'] = array(); |
|
1536
|
1536
|
} |
|
1537
|
|
- $frm_vars['js_validate_forms'][ $form->id ] = $form; |
|
|
1537
|
+ $frm_vars['js_validate_forms'][$form->id] = $form; |
|
1538
|
1538
|
} |
|
1539
|
1539
|
|
|
1540
|
1540
|
public static function get_email_html() { |
|
@@ -1689,7 +1689,7 @@ discard block |
|
|
block discarded – undo |
|
1689
|
1689
|
add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
|
1690
|
1690
|
} else { |
|
1691
|
1691
|
$vars = FrmAppHelper::json_to_array( $json_vars ); |
|
1692
|
|
- $action = $vars[ $action ]; |
|
|
1692
|
+ $action = $vars[$action]; |
|
1693
|
1693
|
unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1694
|
1694
|
$_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1695
|
1695
|
$_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
@@ -1823,7 +1823,7 @@ discard block |
|
|
block discarded – undo |
|
1823
|
1823
|
$actions = array(); |
|
1824
|
1824
|
foreach ( $frm_vars['forms_loaded'] as $form ) { |
|
1825
|
1825
|
if ( is_object( $form ) ) { |
|
1826
|
|
- $actions[ $form->id ] = $form->name; |
|
|
1826
|
+ $actions[$form->id] = $form->name; |
|
1827
|
1827
|
} |
|
1828
|
1828
|
unset( $form ); |
|
1829
|
1829
|
} |
|
@@ -2065,8 +2065,8 @@ discard block |
|
|
block discarded – undo |
|
2065
|
2065
|
private static function get_saved_errors( $form, $params ) { |
|
2066
|
2066
|
global $frm_vars; |
|
2067
|
2067
|
|
|
2068
|
|
- if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2069
|
|
- $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
|
|
2068
|
+ if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
|
2069
|
+ $errors = $frm_vars['created_entries'][$form->id]['errors']; |
|
2070
|
2070
|
} else { |
|
2071
|
2071
|
$errors = array(); |
|
2072
|
2072
|
} |
|
@@ -2088,7 +2088,7 @@ discard block |
|
|
block discarded – undo |
|
2088
|
2088
|
public static function just_created_entry( $form_id ) { |
|
2089
|
2089
|
global $frm_vars; |
|
2090
|
2090
|
|
|
2091
|
|
- 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; |
|
|
2091
|
+ 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; |
|
2092
|
2092
|
} |
|
2093
|
2093
|
|
|
2094
|
2094
|
/** |
|
@@ -2112,7 +2112,7 @@ discard block |
|
|
block discarded – undo |
|
2112
|
2112
|
} |
|
2113
|
2113
|
|
|
2114
|
2114
|
$opt = 'success_action'; |
|
2115
|
|
- $method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message'; |
|
|
2115
|
+ $method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message'; |
|
2116
|
2116
|
$method = apply_filters( 'frm_success_filter', $method, $atts['form'], 'create' ); |
|
2117
|
2117
|
|
|
2118
|
2118
|
if ( $method != 'message' && ( ! $atts['entry_id'] || ! is_numeric( $atts['entry_id'] ) ) ) { |
|
@@ -2125,7 +2125,7 @@ discard block |
|
|
block discarded – undo |
|
2125
|
2125
|
public static function maybe_trigger_redirect( $form, $params, $args ) { |
|
2126
|
2126
|
if ( ! isset( $params['id'] ) ) { |
|
2127
|
2127
|
global $frm_vars; |
|
2128
|
|
- $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id']; |
|
|
2128
|
+ $params['id'] = $frm_vars['created_entries'][$form->id]['entry_id']; |
|
2129
|
2129
|
} |
|
2130
|
2130
|
|
|
2131
|
2131
|
$conf_method = self::get_confirmation_method( |
|
@@ -2184,7 +2184,7 @@ discard block |
|
|
block discarded – undo |
|
2184
|
2184
|
$args['success_opt'] = $opt; |
|
2185
|
2185
|
$args['ajax'] = ! empty( $frm_vars['ajax'] ); |
|
2186
|
2186
|
|
|
2187
|
|
- if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) { |
|
|
2187
|
+ if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) { |
|
2188
|
2188
|
self::load_page_after_submit( $args ); |
|
2189
|
2189
|
} elseif ( $args['conf_method'] === 'redirect' ) { |
|
2190
|
2190
|
self::redirect_after_submit( $args ); |
|
@@ -2329,7 +2329,7 @@ discard block |
|
|
block discarded – undo |
|
2329
|
2329
|
|
|
2330
|
2330
|
$opt = 'update' === $args['action'] ? 'edit_' : 'success_'; |
|
2331
|
2331
|
|
|
2332
|
|
- $new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ]; |
|
|
2332
|
+ $new_args['conf_method'] = $new_args['form']->options[$opt . 'action']; |
|
2333
|
2333
|
|
|
2334
|
2334
|
/** |
|
2335
|
2335
|
* Filters the run success action args. |
|
@@ -2349,8 +2349,8 @@ discard block |
|
|
block discarded – undo |
|
2349
|
2349
|
private static function load_page_after_submit( $args ) { |
|
2350
|
2350
|
global $post; |
|
2351
|
2351
|
$opt = $args['success_opt']; |
|
2352
|
|
- if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) { |
|
2353
|
|
- $page = get_post( $args['form']->options[ $opt . '_page_id' ] ); |
|
|
2352
|
+ if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) { |
|
|
2353
|
+ $page = get_post( $args['form']->options[$opt . '_page_id'] ); |
|
2354
|
2354
|
$old_post = $post; |
|
2355
|
2355
|
$post = $page; |
|
2356
|
2356
|
$content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] ); |
|
@@ -2366,7 +2366,7 @@ discard block |
|
|
block discarded – undo |
|
2366
|
2366
|
add_filter( 'frm_use_wpautop', '__return_false' ); |
|
2367
|
2367
|
|
|
2368
|
2368
|
$opt = $args['success_opt']; |
|
2369
|
|
- $success_url = trim( $args['form']->options[ $opt . '_url' ] ); |
|
|
2369
|
+ $success_url = trim( $args['form']->options[$opt . '_url'] ); |
|
2370
|
2370
|
$success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] ); |
|
2371
|
2371
|
$success_url = do_shortcode( $success_url ); |
|
2372
|
2372
|
|
|
@@ -2397,7 +2397,7 @@ discard block |
|
|
block discarded – undo |
|
2397
|
2397
|
* @param array $args See {@see FrmFormsController::redirect_after_submit()}. |
|
2398
|
2398
|
*/ |
|
2399
|
2399
|
private static function redirect_after_submit_using_js( $args ) { |
|
2400
|
|
- $success_msg = isset( $args['form']->options[ $args['success_opt'] . '_msg' ] ) ? $args['form']->options[ $args['success_opt'] . '_msg' ] : __( 'Please wait while you are redirected.', 'formidable' ); |
|
|
2400
|
+ $success_msg = isset( $args['form']->options[$args['success_opt'] . '_msg'] ) ? $args['form']->options[$args['success_opt'] . '_msg'] : __( 'Please wait while you are redirected.', 'formidable' ); |
|
2401
|
2401
|
$redirect_msg = self::get_redirect_message( $args['success_url'], $success_msg, $args ); |
|
2402
|
2402
|
$delay_time = isset( $args['force_delay_redirect'] ) ? ( 1000 * $args['force_delay_redirect'] ) : 8000; |
|
2403
|
2403
|
|
|
@@ -2527,7 +2527,7 @@ discard block |
|
|
block discarded – undo |
|
2527
|
2527
|
'description' => false, |
|
2528
|
2528
|
'reset' => false, |
|
2529
|
2529
|
); |
|
2530
|
|
- $args = wp_parse_args( $args, $defaults ); |
|
|
2530
|
+ $args = wp_parse_args( $args, $defaults ); |
|
2531
|
2531
|
} |
|
2532
|
2532
|
|
|
2533
|
2533
|
/** |
|
@@ -2779,7 +2779,7 @@ discard block |
|
|
block discarded – undo |
|
2779
|
2779
|
|
|
2780
|
2780
|
check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
2781
|
2781
|
|
|
2782
|
|
- $html = FrmAppHelper::clip( |
|
|
2782
|
+ $html = FrmAppHelper::clip( |
|
2783
|
2783
|
function() { |
|
2784
|
2784
|
FrmAppHelper::maybe_autocomplete_pages_options( |
|
2785
|
2785
|
array( |
|
@@ -2850,27 +2850,27 @@ discard block |
|
|
block discarded – undo |
|
2850
|
2850
|
public static function populate_on_submit_data( &$form_options, $action = null, $event = 'create' ) { |
|
2851
|
2851
|
$opt = 'update' === $event ? 'edit_' : 'success_'; |
|
2852
|
2852
|
if ( ! $action || ! is_object( $action ) ) { |
|
2853
|
|
- $form_options[ $opt . 'action' ] = FrmOnSubmitHelper::get_default_action_type(); |
|
2854
|
|
- $form_options[ $opt . 'msg' ] = FrmOnSubmitHelper::get_default_msg(); |
|
|
2853
|
+ $form_options[$opt . 'action'] = FrmOnSubmitHelper::get_default_action_type(); |
|
|
2854
|
+ $form_options[$opt . 'msg'] = FrmOnSubmitHelper::get_default_msg(); |
|
2855
|
2855
|
return; |
|
2856
|
2856
|
} |
|
2857
|
2857
|
|
|
2858
|
|
- $form_options[ $opt . 'action' ] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; |
|
|
2858
|
+ $form_options[$opt . 'action'] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; |
|
2859
|
2859
|
|
|
2860
|
|
- switch ( $form_options[ $opt . 'action' ] ) { |
|
|
2860
|
+ switch ( $form_options[$opt . 'action'] ) { |
|
2861
|
2861
|
case 'redirect': |
|
2862
|
|
- $form_options[ $opt . 'url' ] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; |
|
|
2862
|
+ $form_options[$opt . 'url'] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; |
|
2863
|
2863
|
$form_options['redirect_msg'] = isset( $action->post_content['redirect_msg'] ) ? $action->post_content['redirect_msg'] : FrmOnSubmitHelper::get_default_redirect_msg(); |
|
2864
|
|
- $form_options[ $opt . 'msg' ] = $form_options['redirect_msg']; |
|
|
2864
|
+ $form_options[$opt . 'msg'] = $form_options['redirect_msg']; |
|
2865
|
2865
|
break; |
|
2866
|
2866
|
|
|
2867
|
2867
|
case 'page': |
|
2868
|
|
- $form_options[ $opt . 'page_id' ] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; |
|
|
2868
|
+ $form_options[$opt . 'page_id'] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; |
|
2869
|
2869
|
break; |
|
2870
|
2870
|
|
|
2871
|
2871
|
default: |
|
2872
|
|
- $form_options[ $opt . 'msg' ] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : FrmOnSubmitHelper::get_default_msg(); |
|
2873
|
|
- $form_options['show_form'] = ! empty( $action->post_content['show_form'] ); |
|
|
2872
|
+ $form_options[$opt . 'msg'] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : FrmOnSubmitHelper::get_default_msg(); |
|
|
2873
|
+ $form_options['show_form'] = ! empty( $action->post_content['show_form'] ); |
|
2874
|
2874
|
} |
|
2875
|
2875
|
} |
|
2876
|
2876
|
|
|
@@ -2948,21 +2948,21 @@ discard block |
|
|
block discarded – undo |
|
2948
|
2948
|
private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) { |
|
2949
|
2949
|
$opt = 'update' === $event ? 'edit_' : 'success_'; |
|
2950
|
2950
|
$data = array( |
|
2951
|
|
- 'success_action' => $form_options[ $opt . 'action' ], |
|
|
2951
|
+ 'success_action' => $form_options[$opt . 'action'], |
|
2952
|
2952
|
); |
|
2953
|
2953
|
|
|
2954
|
|
- switch ( $form_options[ $opt . 'action' ] ) { |
|
|
2954
|
+ switch ( $form_options[$opt . 'action'] ) { |
|
2955
|
2955
|
case 'redirect': |
|
2956
|
|
- $data['success_url'] = isset( $form_options[ $opt . 'url' ] ) ? $form_options[ $opt . 'url' ] : ''; |
|
2957
|
|
- $data['redirect_msg'] = isset( $form_options[ $opt . 'msg' ] ) ? $form_options[ $opt . 'msg' ] : FrmOnSubmitHelper::get_default_redirect_msg(); |
|
|
2956
|
+ $data['success_url'] = isset( $form_options[$opt . 'url'] ) ? $form_options[$opt . 'url'] : ''; |
|
|
2957
|
+ $data['redirect_msg'] = isset( $form_options[$opt . 'msg'] ) ? $form_options[$opt . 'msg'] : FrmOnSubmitHelper::get_default_redirect_msg(); |
|
2958
|
2958
|
break; |
|
2959
|
2959
|
|
|
2960
|
2960
|
case 'page': |
|
2961
|
|
- $data['success_page_id'] = isset( $form_options[ $opt . 'page_id' ] ) ? $form_options[ $opt . 'page_id' ] : ''; |
|
|
2961
|
+ $data['success_page_id'] = isset( $form_options[$opt . 'page_id'] ) ? $form_options[$opt . 'page_id'] : ''; |
|
2962
|
2962
|
break; |
|
2963
|
2963
|
|
|
2964
|
2964
|
default: |
|
2965
|
|
- $data['success_msg'] = isset( $form_options[ $opt . 'msg' ] ) ? $form_options[ $opt . 'msg' ] : FrmOnSubmitHelper::get_default_msg(); |
|
|
2965
|
+ $data['success_msg'] = isset( $form_options[$opt . 'msg'] ) ? $form_options[$opt . 'msg'] : FrmOnSubmitHelper::get_default_msg(); |
|
2966
|
2966
|
$data['show_form'] = ! empty( $form_options['show_form'] ); |
|
2967
|
2967
|
} |
|
2968
|
2968
|
|
|
@@ -2997,8 +2997,8 @@ discard block |
|
|
block discarded – undo |
|
2997
|
2997
|
} |
|
2998
|
2998
|
|
|
2999
|
2999
|
foreach ( $options as $name ) { |
|
3000
|
|
- if ( isset( $form->options[ $name ] ) ) { |
|
3001
|
|
- unset( $form->options[ $name ] ); |
|
|
3000
|
+ if ( isset( $form->options[$name] ) ) { |
|
|
3001
|
+ unset( $form->options[$name] ); |
|
3002
|
3002
|
} |
|
3003
|
3003
|
} |
|
3004
|
3004
|
|