PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.13
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.13
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmStylesController.php +22 -42 6.256.13 View file →
@@ -95,9 +95,9 @@
95 95 *
96 96 * @return void
97 97 */
98 98 private static function disable_form_css() {
99 - add_filter( 'get_frm_stylesheet', '__return_empty_array' );
99 + add_filter( 'get_frm_stylesheet', '__return_false' );
100 100 }
101 101
102 102 /**
103 103 * Removing this action prevents front end JavaScript from loading.
@@ -119,12 +119,12 @@
119 119 if ( ! FrmAppHelper::is_style_editor_page() ) {
120 120 return;
121 121 }
122 122
123 - FrmStyleComponent::register_assets();
124 123 self::load_pro_hooks();
125 124
126 125 $version = FrmAppHelper::plugin_version();
126 + wp_enqueue_script( 'jquery-ui-datepicker' );
127 127
128 128 if ( FrmAppHelper::is_style_editor_page( 'edit' ) ) {
129 129 wp_enqueue_style( 'wp-color-picker' );
130 130 }
@@ -323,15 +323,9 @@
323 323 self::setup_styles_and_scripts_for_styler();
324 324
325 325 $style_id = self::get_style_id_for_styler();
326 326 if ( ! $style_id ) {
327 - $error_args = array(
328 - 'title' => __( 'No styles', 'formidable' ),
329 - 'body' => __( 'You must have a style to use the Visual Styler.', 'formidable' ),
330 - 'cancel_url' => admin_url( 'admin.php?page=formidable' ),
331 - );
332 - FrmAppController::show_error_modal( $error_args );
333 - return;
327 + wp_die( esc_html__( 'Invalid route', 'formidable' ), esc_html__( 'Invalid route', 'formidable' ), 400 );
334 328 }
335 329
336 330 $form_id = FrmAppHelper::simple_get( 'form', 'absint', 0 );
337 331 if ( ! $form_id ) {
@@ -338,17 +332,10 @@
338 332 $form_id = self::get_form_id_for_style( $style_id );
339 333 }
340 334
341 335 $form = FrmForm::getOne( $form_id );
342 -
343 336 if ( ! is_object( $form ) ) {
344 - $error_args = array(
345 - 'title' => __( 'No forms', 'formidable' ),
346 - 'body' => __( 'You must have a form to use the Visual Styler.', 'formidable' ),
347 - 'cancel_url' => admin_url( 'admin.php?page=formidable' ),
348 - );
349 - FrmAppController::show_error_modal( $error_args );
350 - return;
337 + wp_die( esc_html__( 'Invalid route', 'formidable' ), esc_html__( 'Invalid route', 'formidable' ), 400 );
351 338 }
352 339
353 340 $frm_style = new FrmStyle( $style_id );
354 341 $active_style = $frm_style->get_one();
@@ -358,9 +345,11 @@
358 345
359 346 /**
360 347 * @since 6.0
361 348 *
362 - * @param array{form:\stdClass} $data
349 + * @param array {
350 + * @type stdClass $form
351 + * }
363 352 */
364 353 do_action( 'frm_before_render_style_page', compact( 'form' ) );
365 354
366 355 self::render_style_page( $active_style, $form, $default_style );
@@ -539,9 +528,9 @@
539 528 $plugin_url = FrmAppHelper::plugin_url();
540 529 $version = FrmAppHelper::plugin_version();
541 530 $js_dependencies = array( 'wp-i18n', 'wp-hooks', 'formidable_dom' );
542 531
543 - if ( FrmAppHelper::pro_is_installed() && is_callable( 'FrmProAppHelper::use_jquery_datepicker' ) && FrmProAppHelper::use_jquery_datepicker() ) {
532 + if ( FrmAppHelper::pro_is_installed() ) {
544 533 $js_dependencies[] = 'jquery-ui-datepicker';
545 534 }
546 535
547 536 wp_register_script( 'formidable_style', $plugin_url . '/js/admin/style.js', $js_dependencies, $version );
@@ -743,9 +732,8 @@
743 732 public static function manage( $message = '', $forms = array() ) {
744 733 $frm_style = new FrmStyle();
745 734 $styles = $frm_style->get_all();
746 735 $default_style = $frm_style->get_default_style( $styles );
747 - $frm_settings = FrmAppHelper::get_settings();
748 736
749 737 if ( ! $forms ) {
750 738 $forms = FrmForm::get_published_forms();
751 739 }
@@ -763,14 +751,14 @@
763 751 global $wpdb;
764 752
765 753 $forms = FrmForm::get_published_forms();
766 754 foreach ( $forms as $form ) {
767 - if ( ! isset( $_POST['style'] ) || ! isset( $_POST['style'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
755 + $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
756 + $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
757 + if ( $new_style == $previous_style ) {
768 758 continue;
769 759 }
770 760
771 - $new_style = sanitize_text_field( wp_unslash( $_POST['style'][ $form->id ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
772 -
773 761 $form->options['custom_style'] = $new_style;
774 762 $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) );
775 763 unset( $form );
776 764 }
@@ -904,26 +892,23 @@
904 892 echo json_encode( $defaults );
905 893 wp_die();
906 894 }
907 895
908 - $frm_style = new FrmStyle();
909 - $default_template_style = $frm_style->get_default_template_style( $style_id );
910 - $where = array(
896 + $frm_style = new FrmStyle();
897 + $defaults = $frm_style->get_defaults();
898 + $default_post_content = FrmAppHelper::prepare_and_encode( $defaults );
899 + $where = array(
911 900 'ID' => $style_id,
912 901 'post_type' => self::$post_type,
913 902 );
914 -
915 - $style_object = $frm_style->get_new();
916 - $style_object->post_content = json_decode( $default_template_style, true );
917 -
918 903 global $wpdb;
919 - $wpdb->update( $wpdb->posts, array( 'post_content' => $default_template_style ), $where );
904 + $wpdb->update( $wpdb->posts, array( 'post_content' => $default_post_content ), $where );
920 905
921 906 // Save the settings after resetting to default or the old style will still appear.
922 907 $frm_style->save_settings();
923 908
924 909 $data = array(
925 - 'style' => FrmStylesCardHelper::get_style_param_for_card( $style_object ),
910 + 'style' => FrmStylesCardHelper::get_style_param_for_card( $frm_style->get_new() ),
926 911 );
927 912 wp_send_json_success( $data );
928 913 wp_die();
929 914 }
@@ -938,10 +923,9 @@
938 923 public static function change_styling() {
939 924 FrmAppHelper::permission_check( 'frm_change_settings' );
940 925 check_ajax_referer( 'frm_ajax', 'nonce' );
941 926
942 - $is_loaded_via_ajax = true;
943 - $frm_style = new FrmStyle();
927 + $frm_style = new FrmStyle();
944 928
945 929 // Intentionally avoid defaults here so nothing gets removed from our style.
946 930 $defaults = array();
947 931 $style = '';
@@ -1258,22 +1242,18 @@
1258 1242 if ( ! $first_open ) {
1259 1243 $first_open = true;
1260 1244 $open_class = 'open';
1261 1245 }
1262 -
1263 - $accordion_content_id = 'frm_style_section_' . $box['id'];
1264 1246 ?>
1265 1247 <li class="control-section accordion-section <?php echo esc_attr( $open_class ); ?> <?php echo esc_attr( $box['id'] ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>">
1266 - <h3 class="accordion-section-title hndle">
1248 + <h3 class="accordion-section-title hndle" tabindex="0">
1267 1249 <?php
1268 - FrmAppHelper::icon_by_class( 'frmfont ' . $icon_id . ' frm_svg24' );
1250 + FrmAppHelper::icon_by_class( 'frmfont ' . $icon_id );
1269 1251 echo esc_html( $box['title'] );
1252 + FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown8_icon' );
1270 1253 ?>
1271 - <button type="button" aria-expanded="<?php echo esc_attr( 'open' === $open_class ? 'true' : 'false' ); ?>" aria-controls="<?php echo esc_attr( $accordion_content_id ); ?>" aria-label="<?php echo esc_attr( $box['title'] ); ?>">
1272 - <?php FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown8_icon' ); ?>
1273 - </button>
1274 1254 </h3>
1275 - <div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>" id="<?php echo esc_attr( $accordion_content_id ); ?>">
1255 + <div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>">
1276 1256 <div class="inside">
1277 1257 <?php call_user_func( $box['callback'], $data_object, $box ); ?>
1278 1258 </div><!-- .inside -->
1279 1259 </div><!-- .accordion-section-content -->