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/helpers/FrmStylesPreviewHelper.php +0 -64 6.26.1 → 6.13 View file →
@@ -32,9 +32,8 @@
32 32 private $default_label_position_field_ids;
33 33
34 34 /**
35 35 * @param int|string $form_id
36 - *
37 36 * @return void
38 37 */
39 38 public function __construct( $form_id ) {
40 39 $this->form_id = (int) $form_id;
@@ -63,9 +62,8 @@
63 62 * Add a frm-default-label-position class to any field with a default label position.
64 63 * A field with a custom label position shouldn't ever change in the styler preview.
65 64 *
66 65 * @since 6.0.1
67 - *
68 66 * @return void
69 67 */
70 68 private function add_a_div_class_for_default_label_positions() {
71 69 // Only fields with no label position set hit this filter, so track those for the frm_field_div_classes filter.
@@ -73,9 +71,8 @@
73 71 'frm_html_label_position',
74 72 /**
75 73 * @param string $position
76 74 * @param array|object $field
77 - *
78 75 * @return string
79 76 */
80 77 function ( $position, $field ) {
81 78 if ( is_array( $field ) ) {
@@ -91,9 +88,8 @@
91 88 'frm_field_div_classes',
92 89 /**
93 90 * @param string $classes
94 91 * @param array|object $field
95 - *
96 92 * @return string
97 93 */
98 94 function ( $classes, $field ) {
99 95 if ( is_array( $field ) && in_array( (int) $field['id'], $this->default_label_position_field_ids, true ) ) {
@@ -119,9 +115,8 @@
119 115 /**
120 116 * @param bool $show
121 117 * @param string $field_type
122 118 * @param string $target_field_type
123 - *
124 119 * @return bool
125 120 */
126 121 function ( $show, $field_type ) {
127 122 if ( 'captcha' === $field_type ) {
@@ -148,9 +143,8 @@
148 143 'frm_form_object',
149 144 /**
150 145 * @param stdClass|null $form
151 146 * @param int $form_id
152 - *
153 147 * @return stdClass|null
154 148 */
155 149 function ( $form ) {
156 150 if ( is_object( $form ) && is_array( $form->options ) ) {
@@ -172,9 +166,8 @@
172 166
173 167 $target_form_preview_html = FrmFormsController::show_form( $this->form_id, '', 'auto', 'auto' );
174 168
175 169 $this->form_includes_captcha = wp_script_is( 'captcha-api', 'enqueued' );
176 -
177 170 if ( $this->form_includes_captcha ) {
178 171 // If a form includes a CAPTCHA field, don't try to load the CAPTCHA scripts for the visual styler preview.
179 172 wp_dequeue_script( 'captcha-api' );
180 173 }
@@ -196,15 +189,13 @@
196 189 public function get_notes_for_styler_preview() {
197 190 $notes = array();
198 191
199 192 $fallback_form_note = $this->get_fallback_form_note();
200 -
201 193 if ( is_string( $fallback_form_note ) ) {
202 194 $notes[] = $fallback_form_note;
203 195 }
204 196
205 197 $frm_settings = FrmAppHelper::get_settings();
206 -
207 198 if ( 'none' === $frm_settings->load_style ) {
208 199 $notes[] = function () {
209 200 printf(
210 201 // translators: %1$s: Anchor tag open, %2$s: Anchor tag close.
@@ -223,9 +214,8 @@
223 214 $notes = array_merge( $notes, FrmProStylesController::get_notes_for_styler_preview() );
224 215 }
225 216
226 217 $disabled_features_note = $this->get_disabled_features_note();
227 -
228 218 if ( is_string( $disabled_features_note ) ) {
229 219 $notes[] = $disabled_features_note;
230 220 }
231 221
@@ -260,9 +250,8 @@
260 250 *
261 251 * @param stdClass|WP_Post $style A new style is not a WP_Post object.
262 252 * @param WP_Post $default_style
263 253 * @param string $view Either 'list' or 'edit'.
264 - *
265 254 * @return array<string>
266 255 */
267 256 public function get_warnings_for_styler_preview( $style, $default_style, $view ) {
268 257 $warnings = array();
@@ -278,9 +267,8 @@
278 267 * @since 6.0
279 268 *
280 269 * @param int $style_id
281 270 * @param int $default_style_id
282 - *
283 271 * @return bool
284 272 */
285 273 private function should_show_multiple_forms_warning( $style_id, $default_style_id ) {
286 274 $is_default_style = $style_id === $default_style_id;
@@ -287,9 +275,8 @@
287 275
288 276 if ( ! $is_default_style ) {
289 277 // Also check for the conversational default.
290 278 $conversational_style_id = FrmDb::get_var( 'posts', array( 'post_name' => 'lines-no-boxes' ), 'ID' );
291 -
292 279 if ( $conversational_style_id && (int) $conversational_style_id === $style_id ) {
293 280 $is_default_style = true;
294 281 }
295 282 }
@@ -316,9 +303,8 @@
316 303 /**
317 304 * @since 6.0
318 305 *
319 306 * @param WP_Styles $styles
320 - *
321 307 * @return void
322 308 */
323 309 public static function disable_conflicting_wp_admin_css( $styles ) {
324 310 if ( ! is_callable( array( $styles, 'remove' ) ) || ! array_key_exists( 'wp-admin', $styles->registered ) ) {
@@ -328,9 +314,8 @@
328 314 $styles->remove( 'edit' );
329 315
330 316 $wp_admin_dependencies = $styles->registered['wp-admin']->deps;
331 317 $edit_key = array_search( 'edit', $wp_admin_dependencies );
332 -
333 318 if ( false === $edit_key ) {
334 319 return;
335 320 }
336 321
@@ -338,66 +323,17 @@
338 323 self::remove_wp_admin_dependency( $styles, 'edit' );
339 324 }
340 325
341 326 /**
342 - * Provides few fixes for style preview.
343 - * Fix the "Width" from Fields Settings to get reflected on each style preview ajax update.
344 - * Fix the Radio & Checkbox "Single Row" or "Multiple Row" to get reflected in style preview ajax update.
345 - *
346 - * @since 6.14
347 - *
348 - * @param array $settings The style options.
349 - * @param bool $is_preview
350 - *
351 - * @return void
352 - */
353 - public static function get_additional_preview_style( $settings, $is_preview = false ) {
354 - if ( ! $is_preview ) {
355 - return;
356 - }
357 -
358 - $radio_display_type = 'inline' === $settings['radio_align'] ? 'inline-block' : 'block';
359 - $check_display_type = 'inline' === $settings['check_align'] ? 'inline-block' : 'block';
360 -
361 - $style = '#frm_style_preview .with_frm_style input[type=text],
362 - #frm_style_preview .with_frm_style input[type=password],
363 - #frm_style_preview .with_frm_style input[type=email],
364 - #frm_style_preview .with_frm_style input[type=number],
365 - #frm_style_preview .with_frm_style input[type=url],
366 - #frm_style_preview .with_frm_style input[type=tel],
367 - #frm_style_preview .with_frm_style input[type=phone],
368 - #frm_style_preview .with_frm_style input[type=search],
369 - #frm_style_preview .with_frm_style textarea,
370 - #frm_style_preview .frm_form_fields_style,
371 - #frm_style_preview .with_frm_style .frm_scroll_box .frm_opt_container,
372 - #frm_style_preview .frm_form_fields_active_style,
373 - #frm_style_preview .frm_form_fields_error_style,
374 - #frm_style_preview .with_frm_style .frm-card-element.StripeElement,
375 - #frm_style_preview .with_frm_style .frm_slimselect.ss-main {
376 - width: var(--field-width);
377 - }
378 - #frm_style_preview .with_frm_style .frm_radio {
379 - display:' . $radio_display_type . ';
380 - }
381 - #frm_style_preview .with_frm_style .frm_checkbox {
382 - display:' . $check_display_type . ';
383 - }';
384 -
385 - echo esc_html( $style );
386 - }
387 -
388 - /**
389 327 * @since 6.0
390 328 *
391 329 * @param WP_Styles $styles
392 330 * @param string $key
393 - *
394 331 * @return void
395 332 */
396 333 private static function remove_wp_admin_dependency( $styles, $key ) {
397 334 $dependencies = $styles->registered['wp-admin']->deps;
398 335 $index = array_search( $key, $dependencies );
399 -
400 336 if ( false === $index ) {
401 337 return;
402 338 }
403 339