@@ -84,21 +84,21 @@ discard block |
||
| 84 | 84 | $default_settings = $this->get_defaults(); |
| 85 | 85 | |
| 86 | 86 | foreach ( $default_settings as $setting => $default ) { |
| 87 | - if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
| 88 | - $new_instance['post_content'][ $setting ] = $default; |
|
| 87 | + if ( ! isset( $new_instance['post_content'][$setting] ) ) { |
|
| 88 | + $new_instance['post_content'][$setting] = $default; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if ( $this->is_color( $setting ) ) { |
| 92 | - $color_val = $new_instance['post_content'][ $setting ]; |
|
| 92 | + $color_val = $new_instance['post_content'][$setting]; |
|
| 93 | 93 | if ( $color_val !== '' && 0 === strpos( $color_val, 'rgb' ) ) { |
| 94 | 94 | // maybe sanitize if invalid rgba value is entered |
| 95 | 95 | $this->maybe_sanitize_rgba_value( $color_val ); |
| 96 | 96 | } |
| 97 | - $new_instance['post_content'][ $setting ] = str_replace( '#', '', $color_val ); |
|
| 98 | - } elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ), true ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
| 99 | - $new_instance['post_content'][ $setting ] = 0; |
|
| 97 | + $new_instance['post_content'][$setting] = str_replace( '#', '', $color_val ); |
|
| 98 | + } elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ), true ) && ! isset( $new_instance['post_content'][$setting] ) ) { |
|
| 99 | + $new_instance['post_content'][$setting] = 0; |
|
| 100 | 100 | } elseif ( $setting === 'font' ) { |
| 101 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
| 101 | + $new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] ); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
@@ -211,10 +211,10 @@ discard block |
||
| 211 | 211 | $valid_keys = array_keys( $defaults ); |
| 212 | 212 | $sanitized_settings = array(); |
| 213 | 213 | foreach ( $valid_keys as $key ) { |
| 214 | - if ( isset( $settings[ $key ] ) ) { |
|
| 215 | - $sanitized_settings[ $key ] = sanitize_textarea_field( $settings[ $key ] ); |
|
| 214 | + if ( isset( $settings[$key] ) ) { |
|
| 215 | + $sanitized_settings[$key] = sanitize_textarea_field( $settings[$key] ); |
|
| 216 | 216 | } else { |
| 217 | - $sanitized_settings[ $key ] = $defaults[ $key ]; |
|
| 217 | + $sanitized_settings[$key] = $defaults[$key]; |
|
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | return $sanitized_settings; |
@@ -381,13 +381,13 @@ discard block |
||
| 381 | 381 | $style->post_content = $this->override_defaults( $style->post_content ); |
| 382 | 382 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
| 383 | 383 | |
| 384 | - $styles[ $style->ID ] = $style; |
|
| 384 | + $styles[$style->ID] = $style; |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | if ( ! $default_style ) { |
| 388 | 388 | $default_style = reset( $styles ); |
| 389 | 389 | |
| 390 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
| 390 | + $styles[$default_style->ID]->menu_order = 1; |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | return $styles; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | '-' => 'down', |
| 136 | 136 | '+' => 'up', |
| 137 | 137 | ); |
| 138 | - $class = 'frm_arrow' . $arrow[ $icon ]; |
|
| 138 | + $class = 'frm_arrow' . $arrow[$icon]; |
|
| 139 | 139 | } else { |
| 140 | 140 | //frm_minus1_icon |
| 141 | 141 | $key = str_replace( 'p', '', $key ); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | '-' => 'minus', |
| 144 | 144 | '+' => 'plus', |
| 145 | 145 | ); |
| 146 | - $class = 'frm_' . $plus[ $icon ]; |
|
| 146 | + $class = 'frm_' . $plus[$icon]; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if ( $key ) { |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | ?> |
| 170 | 170 | <div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select"> |
| 171 | 171 | <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button"> |
| 172 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?> |
|
| 173 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?> |
|
| 172 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?> |
|
| 173 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?> |
|
| 174 | 174 | <b class="caret"></b> |
| 175 | 175 | </button> |
| 176 | 176 | <ul class="multiselect-container frm-dropdown-menu"> |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | <li <?php echo ( $style->post_content['collapse_icon'] == $key ) ? 'class="active"' : ''; ?>> |
| 179 | 179 | <a href="javascript:void(0);"> |
| 180 | 180 | <label> |
| 181 | - <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 ); ?> /> |
|
| 181 | + <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 ); ?> /> |
|
| 182 | 182 | <span> |
| 183 | 183 | <?php |
| 184 | 184 | FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) ); |
@@ -271,15 +271,15 @@ discard block |
||
| 271 | 271 | $vars = array_diff( $vars, $remove ); |
| 272 | 272 | |
| 273 | 273 | foreach ( $vars as $var ) { |
| 274 | - if ( ! isset( $settings[ $var ] ) ) { |
|
| 274 | + if ( ! isset( $settings[$var] ) ) { |
|
| 275 | 275 | continue; |
| 276 | 276 | } |
| 277 | - if ( ! isset( $defaults[ $var ] ) ) { |
|
| 278 | - $defaults[ $var ] = ''; |
|
| 277 | + if ( ! isset( $defaults[$var] ) ) { |
|
| 278 | + $defaults[$var] = ''; |
|
| 279 | 279 | } |
| 280 | - $show = empty( $defaults ) || ( $settings[ $var ] !== '' && $settings[ $var ] !== $defaults[ $var ] ); |
|
| 280 | + $show = empty( $defaults ) || ( $settings[$var] !== '' && $settings[$var] !== $defaults[$var] ); |
|
| 281 | 281 | if ( $show ) { |
| 282 | - echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[ $var ] ) : esc_html( $settings[ $var ] ) ) . ';'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 282 | + echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[$var] ) : esc_html( $settings[$var] ) ) . ';'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | $checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' ); |
| 330 | 330 | foreach ( $checkbox_opts as $opt ) { |
| 331 | - if ( ! isset( $settings[ $opt ] ) ) { |
|
| 332 | - $settings[ $opt ] = 0; |
|
| 331 | + if ( ! isset( $settings[$opt] ) ) { |
|
| 332 | + $settings[$opt] = 0; |
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | $css = ''; |
| 358 | 358 | } |
| 359 | 359 | foreach ( $opts as $opt ) { |
| 360 | - self::get_color_output( $css, $settings[ $opt ] ); |
|
| 360 | + self::get_color_output( $css, $settings[$opt] ); |
|
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | 363 | } |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | parse_str( $query, $parsed_query ); |
| 654 | - $form_id = ! empty( $parsed_query['form'] ) ? absint( $parsed_query['form'] ) : 0; |
|
| 654 | + $form_id = ! empty( $parsed_query['form'] ) ? absint( $parsed_query['form'] ) : 0; |
|
| 655 | 655 | |
| 656 | 656 | $style = new stdClass(); |
| 657 | 657 | $style->ID = end( $ids ); |
@@ -689,8 +689,8 @@ discard block |
||
| 689 | 689 | |
| 690 | 690 | $forms = FrmForm::get_published_forms(); |
| 691 | 691 | foreach ( $forms as $form ) { |
| 692 | - $new_style = ( isset( $_POST['style'] ) && isset( $_POST['style'][ $form->id ] ) ) ? sanitize_text_field( wp_unslash( $_POST['style'][ $form->id ] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 693 | - $previous_style = ( isset( $_POST['prev_style'] ) && isset( $_POST['prev_style'][ $form->id ] ) ) ? sanitize_text_field( wp_unslash( $_POST['prev_style'][ $form->id ] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 692 | + $new_style = ( isset( $_POST['style'] ) && isset( $_POST['style'][$form->id] ) ) ? sanitize_text_field( wp_unslash( $_POST['style'][$form->id] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 693 | + $previous_style = ( isset( $_POST['prev_style'] ) && isset( $_POST['prev_style'][$form->id] ) ) ? sanitize_text_field( wp_unslash( $_POST['prev_style'][$form->id] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 694 | 694 | if ( $new_style == $previous_style ) { |
| 695 | 695 | continue; |
| 696 | 696 | } |
@@ -1064,8 +1064,8 @@ discard block |
||
| 1064 | 1064 | */ |
| 1065 | 1065 | public static function get_style_val( $val, $form = 'default' ) { |
| 1066 | 1066 | $style = self::get_form_style( $form ); |
| 1067 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
| 1068 | - return $style->post_content[ $val ]; |
|
| 1067 | + if ( $style && isset( $style->post_content[$val] ) ) { |
|
| 1068 | + return $style->post_content[$val]; |
|
| 1069 | 1069 | } |
| 1070 | 1070 | } |
| 1071 | 1071 | |
@@ -1084,7 +1084,7 @@ discard block |
||
| 1084 | 1084 | } elseif ( 'alt_bg_color' == $name ) { |
| 1085 | 1085 | $setting = 'bg_color_active'; |
| 1086 | 1086 | } |
| 1087 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 1087 | + $default_styles[$name] = $style->post_content[$setting]; |
|
| 1088 | 1088 | unset( $name, $val ); |
| 1089 | 1089 | } |
| 1090 | 1090 | |
@@ -168,7 +168,7 @@ |
||
| 168 | 168 | return; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - unset( $dependencies[ $index ] ); |
|
| 171 | + unset( $dependencies[$index] ); |
|
| 172 | 172 | $dependencies = array_values( $dependencies ); |
| 173 | 173 | |
| 174 | 174 | $styles->registered['wp-admin']->deps = $dependencies; |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | continue; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - $value = $style->post_content[ $key ]; |
|
| 208 | + $value = $style->post_content[$key]; |
|
| 209 | 209 | |
| 210 | 210 | if ( in_array( $key, $color_settings, true ) && $value && '#' !== $value[0] && false === strpos( $value, 'rgb' ) ) { |
| 211 | 211 | $value = '#' . $value; |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | |
| 332 | 332 | $hidden = $count > ( self::PAGE_SIZE - 1 ); |
| 333 | 333 | if ( $this->echo_card_template( $style, $hidden ) ) { |
| 334 | - ++$count; |
|
| 334 | + ++ $count; |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | ); |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | function( $style ) use ( &$count ) { |
| 357 | 357 | $hidden = $count > ( self::PAGE_SIZE - 1 ); |
| 358 | 358 | $this->echo_style_card( $style, $hidden ); |
| 359 | - ++$count; |
|
| 359 | + ++ $count; |
|
| 360 | 360 | } |
| 361 | 361 | ); |
| 362 | 362 | |
@@ -511,11 +511,11 @@ discard block |
||
| 511 | 511 | ), |
| 512 | 512 | ); |
| 513 | 513 | |
| 514 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
| 514 | + if ( ! isset( $available_status[$status] ) ) { |
|
| 515 | 515 | return; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
| 518 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
| 519 | 519 | |
| 520 | 520 | $params = FrmForm::list_page_params(); |
| 521 | 521 | |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | check_admin_referer( $status . '_form_' . $params['id'] ); |
| 524 | 524 | |
| 525 | 525 | $count = 0; |
| 526 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
| 526 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
| 527 | 527 | $count ++; |
| 528 | 528 | } |
| 529 | 529 | |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
| 541 | 541 | $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>' ); |
| 542 | 542 | |
| 543 | - $message = $available_status[ $status ]['message']; |
|
| 543 | + $message = $available_status[$status]['message']; |
|
| 544 | 544 | |
| 545 | 545 | self::display_forms_list( $params, $message ); |
| 546 | 546 | } |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | 'type' => 'request', |
| 562 | 562 | ) |
| 563 | 563 | ); |
| 564 | - $message = sprintf( |
|
| 564 | + $message = sprintf( |
|
| 565 | 565 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
| 566 | 566 | _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' ), |
| 567 | 567 | $count, |
@@ -1000,11 +1000,11 @@ discard block |
||
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | foreach ( $template['categories'] as $category ) { |
| 1003 | - if ( ! isset( $templates_by_category[ $category ] ) ) { |
|
| 1004 | - $templates_by_category[ $category ] = array(); |
|
| 1003 | + if ( ! isset( $templates_by_category[$category] ) ) { |
|
| 1004 | + $templates_by_category[$category] = array(); |
|
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | - $templates_by_category[ $category ][] = $template; |
|
| 1007 | + $templates_by_category[$category][] = $template; |
|
| 1008 | 1008 | } |
| 1009 | 1009 | } |
| 1010 | 1010 | unset( $template ); |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | $forms = FrmForm::get_published_forms( $where ); |
| 1034 | 1034 | $view_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/'; |
| 1035 | 1035 | |
| 1036 | - $templates_by_category[ $my_templates_translation ] = $custom_templates; |
|
| 1036 | + $templates_by_category[$my_templates_translation] = $custom_templates; |
|
| 1037 | 1037 | |
| 1038 | 1038 | unset( $pricing, $license_type, $where ); |
| 1039 | 1039 | wp_enqueue_script( 'accordion' ); // register accordion for template groups |
@@ -1276,7 +1276,7 @@ discard block |
||
| 1276 | 1276 | |
| 1277 | 1277 | foreach ( array( 'landing', 'chat' ) as $feature ) { |
| 1278 | 1278 | if ( ! FrmAppHelper::show_new_feature( $feature ) ) { |
| 1279 | - unset( $sections[ $feature ] ); |
|
| 1279 | + unset( $sections[$feature] ); |
|
| 1280 | 1280 | } |
| 1281 | 1281 | } |
| 1282 | 1282 | |
@@ -1309,7 +1309,7 @@ discard block |
||
| 1309 | 1309 | $section['id'] = $section['anchor']; |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | - $sections[ $key ] = $section; |
|
| 1312 | + $sections[$key] = $section; |
|
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | 1315 | return $sections; |
@@ -1427,7 +1427,7 @@ discard block |
||
| 1427 | 1427 | if ( ! empty( $user_fields ) ) { |
| 1428 | 1428 | $user_helpers = array(); |
| 1429 | 1429 | foreach ( $user_fields as $uk => $uf ) { |
| 1430 | - $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf; |
|
| 1430 | + $user_helpers['|user_id| show="' . $uk . '"'] = $uf; |
|
| 1431 | 1431 | unset( $uk, $uf ); |
| 1432 | 1432 | } |
| 1433 | 1433 | |
@@ -1559,7 +1559,7 @@ discard block |
||
| 1559 | 1559 | if ( ! isset( $frm_vars['js_validate_forms'] ) ) { |
| 1560 | 1560 | $frm_vars['js_validate_forms'] = array(); |
| 1561 | 1561 | } |
| 1562 | - $frm_vars['js_validate_forms'][ $form->id ] = $form; |
|
| 1562 | + $frm_vars['js_validate_forms'][$form->id] = $form; |
|
| 1563 | 1563 | } |
| 1564 | 1564 | |
| 1565 | 1565 | public static function get_email_html() { |
@@ -1714,7 +1714,7 @@ discard block |
||
| 1714 | 1714 | add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
| 1715 | 1715 | } else { |
| 1716 | 1716 | $vars = FrmAppHelper::json_to_array( $json_vars ); |
| 1717 | - $action = $vars[ $action ]; |
|
| 1717 | + $action = $vars[$action]; |
|
| 1718 | 1718 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1719 | 1719 | $_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1720 | 1720 | $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1848,7 +1848,7 @@ discard block |
||
| 1848 | 1848 | $actions = array(); |
| 1849 | 1849 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
| 1850 | 1850 | if ( is_object( $form ) ) { |
| 1851 | - $actions[ $form->id ] = $form->name; |
|
| 1851 | + $actions[$form->id] = $form->name; |
|
| 1852 | 1852 | } |
| 1853 | 1853 | unset( $form ); |
| 1854 | 1854 | } |
@@ -2090,8 +2090,8 @@ discard block |
||
| 2090 | 2090 | private static function get_saved_errors( $form, $params ) { |
| 2091 | 2091 | global $frm_vars; |
| 2092 | 2092 | |
| 2093 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 2094 | - $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
|
| 2093 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 2094 | + $errors = $frm_vars['created_entries'][$form->id]['errors']; |
|
| 2095 | 2095 | } else { |
| 2096 | 2096 | $errors = array(); |
| 2097 | 2097 | } |
@@ -2113,7 +2113,7 @@ discard block |
||
| 2113 | 2113 | public static function just_created_entry( $form_id ) { |
| 2114 | 2114 | global $frm_vars; |
| 2115 | 2115 | |
| 2116 | - 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; |
|
| 2116 | + 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; |
|
| 2117 | 2117 | } |
| 2118 | 2118 | |
| 2119 | 2119 | /** |
@@ -2137,7 +2137,7 @@ discard block |
||
| 2137 | 2137 | } |
| 2138 | 2138 | |
| 2139 | 2139 | $opt = 'success_action'; |
| 2140 | - $method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message'; |
|
| 2140 | + $method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message'; |
|
| 2141 | 2141 | $method = apply_filters( 'frm_success_filter', $method, $atts['form'], 'create' ); |
| 2142 | 2142 | |
| 2143 | 2143 | if ( $method != 'message' && ( ! $atts['entry_id'] || ! is_numeric( $atts['entry_id'] ) ) ) { |
@@ -2150,7 +2150,7 @@ discard block |
||
| 2150 | 2150 | public static function maybe_trigger_redirect( $form, $params, $args ) { |
| 2151 | 2151 | if ( ! isset( $params['id'] ) ) { |
| 2152 | 2152 | global $frm_vars; |
| 2153 | - $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id']; |
|
| 2153 | + $params['id'] = $frm_vars['created_entries'][$form->id]['entry_id']; |
|
| 2154 | 2154 | } |
| 2155 | 2155 | |
| 2156 | 2156 | $conf_method = self::get_confirmation_method( |
@@ -2209,7 +2209,7 @@ discard block |
||
| 2209 | 2209 | $args['success_opt'] = $opt; |
| 2210 | 2210 | $args['ajax'] = ! empty( $frm_vars['ajax'] ); |
| 2211 | 2211 | |
| 2212 | - if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) { |
|
| 2212 | + if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) { |
|
| 2213 | 2213 | self::load_page_after_submit( $args ); |
| 2214 | 2214 | } elseif ( $args['conf_method'] === 'redirect' ) { |
| 2215 | 2215 | self::redirect_after_submit( $args ); |
@@ -2352,7 +2352,7 @@ discard block |
||
| 2352 | 2352 | |
| 2353 | 2353 | $opt = 'update' === $args['action'] ? 'edit_' : 'success_'; |
| 2354 | 2354 | |
| 2355 | - $new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ]; |
|
| 2355 | + $new_args['conf_method'] = $new_args['form']->options[$opt . 'action']; |
|
| 2356 | 2356 | |
| 2357 | 2357 | /** |
| 2358 | 2358 | * Filters the run success action args. |
@@ -2372,8 +2372,8 @@ discard block |
||
| 2372 | 2372 | private static function load_page_after_submit( $args ) { |
| 2373 | 2373 | global $post; |
| 2374 | 2374 | $opt = $args['success_opt']; |
| 2375 | - if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) { |
|
| 2376 | - $page = get_post( $args['form']->options[ $opt . '_page_id' ] ); |
|
| 2375 | + if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) { |
|
| 2376 | + $page = get_post( $args['form']->options[$opt . '_page_id'] ); |
|
| 2377 | 2377 | $old_post = $post; |
| 2378 | 2378 | $post = $page; |
| 2379 | 2379 | $content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] ); |
@@ -2390,7 +2390,7 @@ discard block |
||
| 2390 | 2390 | add_filter( 'frm_use_wpautop', '__return_false' ); |
| 2391 | 2391 | |
| 2392 | 2392 | $opt = $args['success_opt']; |
| 2393 | - $success_url = trim( $args['form']->options[ $opt . '_url' ] ); |
|
| 2393 | + $success_url = trim( $args['form']->options[$opt . '_url'] ); |
|
| 2394 | 2394 | $success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] ); |
| 2395 | 2395 | $success_url = do_shortcode( $success_url ); |
| 2396 | 2396 | |
@@ -2424,7 +2424,7 @@ discard block |
||
| 2424 | 2424 | * @param array $args See {@see FrmFormsController::run_success_action()}. |
| 2425 | 2425 | */ |
| 2426 | 2426 | private static function redirect_after_submit_using_js( $args ) { |
| 2427 | - $success_msg = isset( $args['form']->options[ $args['success_opt'] . '_msg' ] ) ? $args['form']->options[ $args['success_opt'] . '_msg' ] : __( 'Please wait while you are redirected.', 'formidable' ); |
|
| 2427 | + $success_msg = isset( $args['form']->options[$args['success_opt'] . '_msg'] ) ? $args['form']->options[$args['success_opt'] . '_msg'] : __( 'Please wait while you are redirected.', 'formidable' ); |
|
| 2428 | 2428 | $redirect_msg = self::get_redirect_message( $args['success_url'], $success_msg, $args ); |
| 2429 | 2429 | $delay_time = isset( $args['form']->options['time_to_read'] ) ? ( 1000 * $args['form']->options['time_to_read'] ) : 8000; // The old version delays for 8 seconds. |
| 2430 | 2430 | |
@@ -2554,7 +2554,7 @@ discard block |
||
| 2554 | 2554 | 'description' => false, |
| 2555 | 2555 | 'reset' => false, |
| 2556 | 2556 | ); |
| 2557 | - $args = wp_parse_args( $args, $defaults ); |
|
| 2557 | + $args = wp_parse_args( $args, $defaults ); |
|
| 2558 | 2558 | } |
| 2559 | 2559 | |
| 2560 | 2560 | /** |
@@ -2806,7 +2806,7 @@ discard block |
||
| 2806 | 2806 | |
| 2807 | 2807 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 2808 | 2808 | |
| 2809 | - $html = FrmAppHelper::clip( |
|
| 2809 | + $html = FrmAppHelper::clip( |
|
| 2810 | 2810 | function() { |
| 2811 | 2811 | FrmAppHelper::maybe_autocomplete_pages_options( |
| 2812 | 2812 | array( |
@@ -2877,28 +2877,28 @@ discard block |
||
| 2877 | 2877 | public static function populate_on_submit_data( &$form_options, $action = null, $event = 'create' ) { |
| 2878 | 2878 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
| 2879 | 2879 | if ( ! $action || ! is_object( $action ) ) { |
| 2880 | - $form_options[ $opt . 'action' ] = FrmOnSubmitHelper::get_default_action_type(); |
|
| 2881 | - $form_options[ $opt . 'msg' ] = FrmOnSubmitHelper::get_default_msg(); |
|
| 2880 | + $form_options[$opt . 'action'] = FrmOnSubmitHelper::get_default_action_type(); |
|
| 2881 | + $form_options[$opt . 'msg'] = FrmOnSubmitHelper::get_default_msg(); |
|
| 2882 | 2882 | return; |
| 2883 | 2883 | } |
| 2884 | 2884 | |
| 2885 | - $form_options[ $opt . 'action' ] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; |
|
| 2885 | + $form_options[$opt . 'action'] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; |
|
| 2886 | 2886 | |
| 2887 | - switch ( $form_options[ $opt . 'action' ] ) { |
|
| 2887 | + switch ( $form_options[$opt . 'action'] ) { |
|
| 2888 | 2888 | case 'redirect': |
| 2889 | - $form_options[ $opt . 'url' ] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; |
|
| 2889 | + $form_options[$opt . 'url'] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; |
|
| 2890 | 2890 | $form_options['redirect_msg'] = isset( $action->post_content['redirect_msg'] ) ? $action->post_content['redirect_msg'] : FrmOnSubmitHelper::get_default_redirect_msg(); |
| 2891 | - $form_options[ $opt . 'msg' ] = $form_options['redirect_msg']; |
|
| 2891 | + $form_options[$opt . 'msg'] = $form_options['redirect_msg']; |
|
| 2892 | 2892 | $form_options['time_to_read'] = isset( $action->post_content['time_to_read'] ) ? $action->post_content['time_to_read'] : 8; |
| 2893 | 2893 | break; |
| 2894 | 2894 | |
| 2895 | 2895 | case 'page': |
| 2896 | - $form_options[ $opt . 'page_id' ] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; |
|
| 2896 | + $form_options[$opt . 'page_id'] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; |
|
| 2897 | 2897 | break; |
| 2898 | 2898 | |
| 2899 | 2899 | default: |
| 2900 | - $form_options[ $opt . 'msg' ] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : FrmOnSubmitHelper::get_default_msg(); |
|
| 2901 | - $form_options['show_form'] = ! empty( $action->post_content['show_form'] ); |
|
| 2900 | + $form_options[$opt . 'msg'] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : FrmOnSubmitHelper::get_default_msg(); |
|
| 2901 | + $form_options['show_form'] = ! empty( $action->post_content['show_form'] ); |
|
| 2902 | 2902 | } |
| 2903 | 2903 | } |
| 2904 | 2904 | |
@@ -2976,21 +2976,21 @@ discard block |
||
| 2976 | 2976 | private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) { |
| 2977 | 2977 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
| 2978 | 2978 | $data = array( |
| 2979 | - 'success_action' => $form_options[ $opt . 'action' ], |
|
| 2979 | + 'success_action' => $form_options[$opt . 'action'], |
|
| 2980 | 2980 | ); |
| 2981 | 2981 | |
| 2982 | - switch ( $form_options[ $opt . 'action' ] ) { |
|
| 2982 | + switch ( $form_options[$opt . 'action'] ) { |
|
| 2983 | 2983 | case 'redirect': |
| 2984 | - $data['success_url'] = isset( $form_options[ $opt . 'url' ] ) ? $form_options[ $opt . 'url' ] : ''; |
|
| 2985 | - $data['redirect_msg'] = isset( $form_options[ $opt . 'msg' ] ) ? $form_options[ $opt . 'msg' ] : FrmOnSubmitHelper::get_default_redirect_msg(); |
|
| 2984 | + $data['success_url'] = isset( $form_options[$opt . 'url'] ) ? $form_options[$opt . 'url'] : ''; |
|
| 2985 | + $data['redirect_msg'] = isset( $form_options[$opt . 'msg'] ) ? $form_options[$opt . 'msg'] : FrmOnSubmitHelper::get_default_redirect_msg(); |
|
| 2986 | 2986 | break; |
| 2987 | 2987 | |
| 2988 | 2988 | case 'page': |
| 2989 | - $data['success_page_id'] = isset( $form_options[ $opt . 'page_id' ] ) ? $form_options[ $opt . 'page_id' ] : ''; |
|
| 2989 | + $data['success_page_id'] = isset( $form_options[$opt . 'page_id'] ) ? $form_options[$opt . 'page_id'] : ''; |
|
| 2990 | 2990 | break; |
| 2991 | 2991 | |
| 2992 | 2992 | default: |
| 2993 | - $data['success_msg'] = isset( $form_options[ $opt . 'msg' ] ) ? $form_options[ $opt . 'msg' ] : FrmOnSubmitHelper::get_default_msg(); |
|
| 2993 | + $data['success_msg'] = isset( $form_options[$opt . 'msg'] ) ? $form_options[$opt . 'msg'] : FrmOnSubmitHelper::get_default_msg(); |
|
| 2994 | 2994 | $data['show_form'] = ! empty( $form_options['show_form'] ); |
| 2995 | 2995 | } |
| 2996 | 2996 | |
@@ -3025,8 +3025,8 @@ discard block |
||
| 3025 | 3025 | } |
| 3026 | 3026 | |
| 3027 | 3027 | foreach ( $options as $name ) { |
| 3028 | - if ( isset( $form->options[ $name ] ) ) { |
|
| 3029 | - unset( $form->options[ $name ] ); |
|
| 3028 | + if ( isset( $form->options[$name] ) ) { |
|
| 3029 | + unset( $form->options[$name] ); |
|
| 3030 | 3030 | } |
| 3031 | 3031 | } |
| 3032 | 3032 | |