PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0
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/FrmFormsHelper.php +78 -247 6.55.0 View file →
@@ -47,9 +47,9 @@
47 47
48 48 ?>
49 49 <select name="<?php echo esc_attr( $field_name ); ?>"
50 50 id="<?php echo esc_attr( $args['field_id'] ); ?>"
51 - <?php echo wp_strip_all_tags( implode( ' ', $add_html ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
51 + <?php echo wp_strip_all_tags( implode( ' ', $add_html ) ); // WPCS: XSS ok. ?>>
52 52 <?php if ( $args['blank'] ) { ?>
53 53 <option value=""><?php echo ( $args['blank'] == 1 ) ? ' ' : '- ' . esc_attr( $args['blank'] ) . ' -'; ?></option>
54 54 <?php } ?>
55 55 <?php foreach ( $forms as $form ) { ?>
@@ -96,17 +96,8 @@
96 96 $args['frm_action'] = 'list';
97 97 $args['form'] = 0;
98 98 } elseif ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) {
99 99 $args['frm_action'] = 'edit';
100 - } elseif ( FrmAppHelper::is_style_editor_page() ) {
101 - unset( $args['id'] ); // Avoid passing style into form switcher on style page.
102 - $query_args = array(
103 - 'page' => 'formidable-styles',
104 - );
105 - if ( $frm_action ) {
106 - $query_args['frm_action'] = $frm_action;
107 - }
108 - $base = add_query_arg( $query_args, admin_url( 'admin.php' ) );
109 100 } elseif ( isset( $_GET['post'] ) ) {
110 101 $args['form'] = 0;
111 102 $base = admin_url( 'edit.php?post_type=frm_display' );
112 103 }
@@ -133,15 +124,15 @@
133 124 <?php
134 125 return;
135 126 }
136 127 ?>
137 - <div id="frm_bs_dropdown" class="dropdown <?php echo esc_attr( is_rtl() ? 'dropdown-menu-right' : 'dropdown-menu-left' ); ?>">
128 + <div id="frm_bs_dropdown" class="dropdown <?php echo esc_attr( is_rtl() ? 'pull-right' : 'pull-left' ); ?>">
138 129 <a href="#" id="frm-navbarDrop" class="frm-dropdown-toggle" data-toggle="dropdown">
139 130 <h1>
140 131 <span class="frm_bstooltip" title="<?php echo esc_attr( $truncated_name === $name ? '' : $name ); ?>" data-placement="right">
141 132 <?php echo esc_html( $name ); ?>
142 133 </span>
143 - <?php FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) ); ?>
134 + <?php FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown4_icon', array( 'aria-hidden' => 'true' ) ); ?>
144 135 </h1>
145 136 </a>
146 137 <ul class="frm-dropdown-menu frm-on-top frm-inline-modal frm_code_list frm-full-hover" role="menu" aria-labelledby="frm-navbarDrop">
147 138 <?php if ( count( $forms ) > 8 ) { ?>
@@ -174,11 +165,10 @@
174 165 $url = isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args );
175 166 $form_name = empty( $form->name ) ? __( '(no title)', 'formidable' ) : $form->name;
176 167 ?>
177 168 <li class="frm-dropdown-form">
178 - <a href="<?php echo esc_url( $url ); ?>" tabindex="-1" class="frm-justify-between">
179 - <?php echo esc_html( $form_name ); ?>
180 - <span>
169 + <a href="<?php echo esc_url( $url ); ?>" tabindex="-1">
170 + <span class="frm-sub-label">
181 171 <?php
182 172 printf(
183 173 /* translators: %d: Form ID */
184 174 esc_html__( '(ID %d)', 'formidable' ),
@@ -185,8 +175,9 @@
185 175 esc_attr( $form->id )
186 176 );
187 177 ?>
188 178 </span>
179 + <?php echo esc_html( $form_name ); ?>
189 180 <span class="frm_hidden"><?php echo esc_html( $form->form_key ); ?></span>
190 181 </a>
191 182 </li>
192 183 <?php
@@ -209,9 +200,9 @@
209 200 }
210 201
211 202 public static function get_sortable_classes( $col, $sort_col, $sort_dir ) {
212 203 echo ( $sort_col == $col ) ? 'sorted' : 'sortable';
213 - echo ( $sort_col == $col && $sort_dir === 'desc' ) ? ' asc' : ' desc';
204 + echo ( $sort_col == $col && $sort_dir == 'desc' ) ? ' asc' : ' desc';
214 205 }
215 206
216 207 /**
217 208 * @since 3.0
@@ -258,21 +249,13 @@
258 249 $invalid_msg = do_shortcode( $frm_settings->invalid_msg );
259 250 return apply_filters( 'frm_invalid_error_message', $invalid_msg, $args );
260 251 }
261 252
262 - /**
263 - * @param array $atts {
264 - * @type string $message
265 - * @type stdClass $form
266 - * @type int $entry_id
267 - * @type string $class
268 - * }
269 - * @return string
270 - */
271 253 public static function get_success_message( $atts ) {
272 254 $message = apply_filters( 'frm_content', $atts['message'], $atts['form'], $atts['entry_id'] );
273 255 $message = do_shortcode( FrmAppHelper::use_wpautop( $message ) );
274 256 $message = '<div class="' . esc_attr( $atts['class'] ) . '" role="status">' . $message . '</div>';
257 +
275 258 return $message;
276 259 }
277 260
278 261 /**
@@ -284,9 +267,9 @@
284 267 if ( ! empty( $values ) ) {
285 268 $post_values = $values;
286 269 } else {
287 270 $values = array();
288 - $post_values = isset( $_POST ) ? $_POST : array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing
271 + $post_values = isset( $_POST ) ? $_POST : array();
289 272 }
290 273
291 274 $defaults = array(
292 275 'name' => '',
@@ -329,9 +312,9 @@
329 312 * Used when editing a form
330 313 */
331 314 public static function setup_edit_vars( $values, $record, $post_values = array() ) {
332 315 if ( empty( $post_values ) ) {
333 - $post_values = wp_unslash( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
316 + $post_values = wp_unslash( $_POST );
334 317 }
335 318
336 319 $values['form_key'] = isset( $post_values['form_key'] ) ? $post_values['form_key'] : $record->form_key;
337 320 $values['is_template'] = isset( $post_values['is_template'] ) ? $post_values['is_template'] : $record->is_template;
@@ -372,33 +355,27 @@
372 355
373 356 return $values;
374 357 }
375 358
376 - /**
377 - * @return array
378 - */
379 359 public static function get_default_opts() {
380 360 $frm_settings = FrmAppHelper::get_settings();
381 361
382 362 return array(
383 - 'submit_value' => $frm_settings->submit_value,
384 - 'success_action' => 'message',
385 - 'success_msg' => $frm_settings->success_msg,
386 - 'show_form' => 0,
387 - 'akismet' => '',
388 - 'honeypot' => 'basic',
389 - 'antispam' => 0,
390 - 'no_save' => 0,
391 - 'ajax_load' => 0,
392 - 'js_validate' => 0,
393 - 'form_class' => '',
394 - 'custom_style' => 1,
395 - 'before_html' => self::get_default_html( 'before' ),
396 - 'after_html' => '',
397 - 'submit_html' => self::get_default_html( 'submit' ),
398 - 'show_title' => 0,
399 - 'show_description' => 0,
400 - 'ajax_submit' => 0,
363 + 'submit_value' => $frm_settings->submit_value,
364 + 'success_action' => 'message',
365 + 'success_msg' => $frm_settings->success_msg,
366 + 'show_form' => 0,
367 + 'akismet' => '',
368 + 'honeypot' => 'basic',
369 + 'antispam' => 0,
370 + 'no_save' => 0,
371 + 'ajax_load' => 0,
372 + 'js_validate' => 0,
373 + 'form_class' => '',
374 + 'custom_style' => 1,
375 + 'before_html' => self::get_default_html( 'before' ),
376 + 'after_html' => '',
377 + 'submit_html' => self::get_default_html( 'submit' ),
401 378 );
402 379 }
403 380
404 381 /**
@@ -420,15 +397,13 @@
420 397 */
421 398 public static function get_default_html( $loc ) {
422 399 if ( $loc == 'submit' ) {
423 400 $draft_link = self::get_draft_link();
424 - $start_over = self::get_start_over_shortcode();
425 401 $default_html = <<<SUBMIT_HTML
426 402 <div class="frm_submit">
427 403 [if back_button]<button type="submit" name="frm_prev_page" formnovalidate="formnovalidate" class="frm_prev_page" [back_hook]>[back_label]</button>[/if back_button]
428 404 <button class="frm_button_submit" type="submit" [button_action]>[button_label]</button>
429 405 $draft_link
430 -$start_over
431 406 </div>
432 407 SUBMIT_HTML;
433 408 } elseif ( $loc == 'before' ) {
434 409 $default_html = <<<BEFORE_HTML
@@ -448,33 +423,16 @@
448 423
449 424 return $link;
450 425 }
451 426
452 - /**
453 - * Gets start over button shortcode.
454 - *
455 - * @since 5.4
456 - *
457 - * @return string
458 - */
459 - public static function get_start_over_shortcode() {
460 - return '[if start_over]<a href="#" tabindex="0" class="frm_start_over" [start_over_hook]>[start_over_label]</a>[/if start_over]';
461 - }
462 -
463 427 public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) {
464 428 $button = self::replace_shortcodes( $html, $form, $submit, $form_action, $values );
465 429 if ( ! strpos( $button, '[button_action]' ) ) {
466 - echo FrmAppHelper::maybe_kses( $button ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
430 + echo $button; // WPCS: XSS ok.
431 +
467 432 return;
468 433 }
469 434
470 - /**
471 - * @since 5.0.06
472 - */
473 - $button = apply_filters( 'frm_submit_button_html', $button, compact( 'form' ) );
474 - if ( FrmAppHelper::should_never_allow_unfiltered_html() ) {
475 - $button = FrmAppHelper::kses_submit_button( $button );
476 - }
477 435 $button_parts = explode( '[button_action]', $button );
478 436
479 437 $classes = apply_filters( 'frm_submit_button_class', array(), $form );
480 438 if ( ! empty( $classes ) ) {
@@ -486,11 +444,11 @@
486 444 $button_parts[0] .= ' class="' . esc_attr( $classes ) . '"';
487 445 }
488 446 }
489 447
490 - echo $button_parts[0]; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
448 + echo $button_parts[0]; // WPCS: XSS ok.
491 449 do_action( 'frm_submit_button_action', $form, $form_action );
492 - echo $button_parts[1]; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
450 + echo $button_parts[1]; // WPCS: XSS ok.
493 451 }
494 452
495 453 /**
496 454 * @since 4.0
@@ -596,27 +554,23 @@
596 554 $possible_email_field = FrmFieldFactory::field_has_property( $args['type'], 'holds_email_values' );
597 555 if ( $possible_email_field ) {
598 556 $class .= ' show_frm_not_email_to';
599 557 }
600 -
601 - if ( 'url' === $args['type'] ) {
602 - $class .= ' frm_insert_url';
603 - }
604 558 ?>
605 559 <li class="<?php echo esc_attr( $class ); ?>">
606 560 <a href="javascript:void(0)" class="frmids frm_insert_code"
607 561 data-code="<?php echo esc_attr( $args['id'] ); ?>">
562 + <span>[<?php echo esc_attr( isset( $args['id_label'] ) ? $args['id_label'] : $args['id'] ); ?>]</span>
608 563 <?php FrmAppHelper::icon_by_class( $field['icon'], array( 'aria-hidden' => 'true' ) ); ?>
609 564 <?php echo esc_attr( FrmAppHelper::truncate( $args['name'], 60 ) ); ?>
610 - <span>[<?php echo esc_attr( isset( $args['id_label'] ) ? $args['id_label'] : $args['id'] ); ?>]</span>
611 565 </a>
612 566 <a href="javascript:void(0)" class="frmkeys frm_insert_code frm_hidden"
613 567 data-code="<?php echo esc_attr( $args['key'] ); ?>">
568 + <span>[<?php echo esc_attr( FrmAppHelper::truncate( isset( $args['key_label'] ) ? $args['key_label'] : $args['key'], 7 ) ); ?>]</span>
614 569 <?php if ( isset( $field['icon'] ) ) { ?>
615 570 <?php FrmAppHelper::icon_by_class( $field['icon'], array( 'aria-hidden' => 'true' ) ); ?>
616 571 <?php } ?>
617 572 <?php echo esc_attr( FrmAppHelper::truncate( $args['name'], 60 ) ); ?>
618 - <span>[<?php echo esc_attr( FrmAppHelper::truncate( isset( $args['key_label'] ) ? $args['key_label'] : $args['key'], 7 ) ); ?>]</span>
619 573 </a>
620 574 </li>
621 575 <?php
622 576 }
@@ -640,12 +594,12 @@
640 594 <li class="<?php echo esc_attr( $args['class'] ); ?>">
641 595 <a href="javascript:void(0)" class="frm_insert_code <?php echo $has_tooltip ? 'frm_help' : ''; ?>"
642 596 <?php echo $has_tooltip ? 'title="' . esc_attr( $args['title'] ) . '"' : ''; ?>
643 597 data-code="<?php echo esc_attr( $args['code'] ); ?>">
644 - <?php echo esc_attr( FrmAppHelper::truncate( $args['label'], 60 ) ); ?>
645 598 <span>
646 599 [<?php echo esc_attr( FrmAppHelper::truncate( $args['code'], 10 ) ); ?>]
647 600 </span>
601 + <?php echo esc_attr( FrmAppHelper::truncate( $args['label'], 60 ) ); ?>
648 602 </a>
649 603 </li>
650 604 <?php
651 605 }
@@ -752,13 +706,13 @@
752 706 'form_description' => $description,
753 707 'entry_key' => true,
754 708 );
755 709 foreach ( $codes as $code => $show ) {
756 - if ( $code === 'form_name' ) {
710 + if ( $code == 'form_name' ) {
757 711 $replace_with = $form->name;
758 - } elseif ( $code === 'form_description' ) {
712 + } elseif ( $code == 'form_description' ) {
759 713 $replace_with = FrmAppHelper::use_wpautop( $form->description );
760 - } elseif ( $code === 'entry_key' && isset( $_GET ) && isset( $_GET['entry'] ) ) {
714 + } elseif ( $code == 'entry_key' && isset( $_GET ) && isset( $_GET['entry'] ) ) {
761 715 $replace_with = FrmAppHelper::simple_get( 'entry' );
762 716 } else {
763 717 $replace_with = '';
764 718 }
@@ -788,12 +742,8 @@
788 742 if ( strpos( $html, '[if save_draft]' ) ) {
789 743 $html = preg_replace( '/(\[if\s+save_draft\])(.*?)(\[\/if\s+save_draft\])/mis', '', $html );
790 744 }
791 745
792 - if ( strpos( $html, '[if start_over]' ) ) {
793 - $html = preg_replace( '/(\[if\s+start_over\])(.*?)(\[\/if\s+start_over\])/mis', '', $html );
794 - }
795 -
796 746 if ( apply_filters( 'frm_do_html_shortcodes', true ) ) {
797 747 $html = do_shortcode( $html );
798 748 }
799 749
@@ -840,15 +790,9 @@
840 790 if ( is_object( $form ) ) {
841 791 $form = $form->options;
842 792 }
843 793
844 - if ( ! empty( $form['submit_align'] ) ) {
845 - $submit_align = $form['submit_align'];
846 - } elseif ( self::form_should_be_inline_and_missing_class( $form ) ) {
847 - $submit_align = 'inline';
848 - } else {
849 - $submit_align = '';
850 - }
794 + $submit_align = isset( $form['submit_align'] ) ? $form['submit_align'] : '';
851 795
852 796 if ( 'inline' === $submit_align ) {
853 797 $class .= ' frm_inline_form';
854 798 $class .= self::maybe_align_fields_top( $form );
@@ -855,30 +799,14 @@
855 799 } elseif ( 'center' === $submit_align ) {
856 800 $class .= ' frm_center_submit';
857 801 }
858 802
859 - $class = apply_filters( 'frm_add_form_style_class', $class, $style, compact( 'form' ) );
803 + $class = apply_filters( 'frm_add_form_style_class', $class, $style );
860 804
861 805 return $class;
862 806 }
863 807
864 808 /**
865 - * In order for frm_inline_submit to inline the submit button the form must also have the frm_inline_form that adds the grid-column style rules required for it to work.
866 - *
867 - * @since 5.0.12
868 - *
869 - * @param array $form
870 - * @return bool
871 - */
872 - private static function form_should_be_inline_and_missing_class( $form ) {
873 - if ( isset( $form['form_class'] ) && false !== strpos( ' ' . $form['form_class'] . ' ', ' frm_inline_form ' ) ) {
874 - // not missing class, avoid adding it twice.
875 - return false;
876 - }
877 - return ! empty( $form['submit_html'] ) && false !== strpos( $form['submit_html'], 'frm_inline_submit' );
878 - }
879 -
880 - /**
881 809 * Returns appropriate class if form has top labels
882 810 *
883 811 * @param $form
884 812 *
@@ -1198,12 +1126,9 @@
1198 1126 'label' => __( 'Move Form to Trash', 'formidable' ),
1199 1127 'short' => __( 'Trash', 'formidable' ),
1200 1128 'url' => wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . absint( $id ) ),
1201 1129 'icon' => 'frm_icon_font frm_delete_icon',
1202 - 'data' => array(
1203 - 'frmverify' => __( 'Do you want to move this form to the trash?', 'formidable' ),
1204 - 'frmverify-btn' => 'frm-button-red',
1205 - ),
1130 + 'data' => array( 'frmverify' => __( 'Do you want to move this form to the trash?', 'formidable' ) ),
1206 1131 ),
1207 1132 'delete' => array(
1208 1133 'label' => __( 'Delete Permanently', 'formidable' ),
1209 1134 'short' => __( 'Delete', 'formidable' ),
@@ -1209,12 +1134,9 @@
1209 1134 'short' => __( 'Delete', 'formidable' ),
1210 1135 'url' => wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . absint( $id ) ),
1211 1136 'confirm' => __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ),
1212 1137 'icon' => 'frm_icon_font frm_delete_icon',
1213 - 'data' => array(
1214 - 'frmverify' => __( 'This will permanently delete the form and all its entries. This is irreversible. Are you sure you want to continue?', 'formidable' ),
1215 - 'frmverify-btn' => 'frm-button-red',
1216 - ),
1138 + 'data' => array( 'frmverify' => __( 'This will permanently delete the form and all its entries. This is irreversible. Are you sure you want to continue?', 'formidable' ) ),
1217 1139 ),
1218 1140 );
1219 1141 }
1220 1142
@@ -1256,18 +1178,35 @@
1256 1178 return apply_filters( 'frm_layout_classes', $classes );
1257 1179 }
1258 1180
1259 1181 public static function grid_classes() {
1260 - return array(
1261 - 'frm_half' => '1/2',
1262 - 'frm_third' => '1/3',
1263 - 'frm_two_thirds' => '2/3',
1182 + $base = array(
1183 + 'frm_half' => '1/2',
1184 +
1185 + 'frm_third' => '1/3',
1186 + 'frm_two_thirds' => '2/3',
1187 +
1264 1188 'frm_fourth' => '1/4',
1265 1189 'frm_three_fourths' => '3/4',
1266 - 'frm_sixth' => '1/6',
1267 - 'frm10' => '5/6',
1268 - 'frm12' => '100%',
1269 1190 );
1191 +
1192 + $frm_settings = FrmAppHelper::get_settings();
1193 + if ( $frm_settings->old_css ) {
1194 + $classes = array(
1195 + 'frm_sixth' => '1/6',
1196 + 'frm10' => '5/6',
1197 +
1198 + 'frm_full' => '100%',
1199 + );
1200 + } else {
1201 + $classes = array(
1202 + 'frm_sixth' => '1/6',
1203 + 'frm10' => '5/6',
1204 + 'frm12' => '100%',
1205 + );
1206 + }
1207 +
1208 + return array_merge( $base, $classes );
1270 1209 }
1271 1210
1272 1211 /**
1273 1212 * @since 3.0
@@ -1300,24 +1239,9 @@
1300 1239
1301 1240 return $name;
1302 1241 }
1303 1242
1304 - /**
1305 - * @param array $categories
1306 - * @param array $atts {
1307 - * @type string $html 'span' or 'div'.
1308 - * @type boolean $bg Whether to add a bg color or not.
1309 - * }
1310 - *
1311 - * @return void
1312 - */
1313 - public static function template_icon( $categories, $atts = array() ) {
1314 - $defaults = array(
1315 - 'html' => 'span',
1316 - 'bg' => false,
1317 - );
1318 - $atts = array_merge( $defaults, $atts );
1319 -
1243 + public static function template_icon( $categories ) {
1320 1244 $ignore = self::ignore_template_categories();
1321 1245 $categories = array_diff( $categories, $ignore );
1322 1246
1323 1247 $icons = array(
@@ -1323,32 +1247,25 @@
1323 1247 $icons = array(
1324 1248 'WooCommerce' => array( 'woocommerce', 'var(--purple)' ),
1325 1249 'Post' => array( 'wordpress', 'rgb(0,160,210)' ),
1326 1250 'User Registration' => array( 'register', 'var(--pink)' ),
1327 - 'Registration and Signup' => array( 'register', 'var(--pink)' ),
1328 1251 'PayPal' => array( 'paypal' ),
1329 1252 'Stripe' => array( 'credit_card', 'var(--green)' ),
1330 - 'Twilio' => array( 'sms' ),
1331 - 'Payment' => array( 'credit_card' ),
1332 - 'Order Form' => array( 'product' ),
1333 - 'Finance' => array( 'total' ),
1253 + 'Twilio' => array( 'sms', 'rgb(0,160,210)' ),
1254 + 'Payment' => array( 'credit_card', 'var(--green)' ),
1334 1255 'Health and Wellness' => array( 'heart', 'var(--pink)' ),
1335 1256 'Event Planning' => array( 'calendar', 'var(--orange)' ),
1336 - 'Real Estate' => array( 'house' ),
1337 - 'Nonprofit' => array( 'heart_solid' ),
1257 + 'Real Estate' => array( 'house', 'var(--purple)' ),
1338 1258 'Calculator' => array( 'calculator', 'var(--purple)' ),
1339 - 'Quiz' => array( 'percent' ),
1340 1259 'Registrations' => array( 'address_card' ),
1341 - 'Customer Service' => array( 'users_solid' ),
1342 - 'Education' => array( 'pencil' ),
1343 - 'Marketing' => array( 'eye' ),
1344 - 'Feedback' => array( 'smile' ),
1260 + 'Customer Service' => array( 'users_solid', 'var(--pink)' ),
1261 + 'Education' => array( 'pencil', 'var(--primary-color)' ),
1262 + 'Marketing' => array( 'eye', 'rgb(0,160,210)' ),
1263 + 'Feedback' => array( 'smile', 'var(--green)' ),
1345 1264 'Business Operations' => array( 'case' ),
1346 1265 'Contact Form' => array( 'email' ),
1347 - 'Conversational Forms' => array( 'chat_forms' ),
1348 - 'Survey' => array( 'chat_forms', 'var(--orange)' ),
1349 - 'Application' => array( 'align_right' ),
1350 - 'Signature' => array( 'signature' ),
1266 + 'Survey' => array( 'comment', 'var(--primary-color)' ),
1267 + 'Application Form' => array( 'align_right', 'rgb(0,160,210)' ),
1351 1268 '' => array( 'align_right' ),
1352 1269 );
1353 1270
1354 1271 $icons[ __( 'My Templates', 'formidable' ) ] = array( 'user', 'var(--orange)' );
@@ -1366,29 +1283,18 @@
1366 1283 }
1367 1284 $icon = reset( $icons );
1368 1285 }
1369 1286
1370 - $bg = isset( $icon[1] ) ? $icon[1] : '';
1371 -
1372 - if ( $atts['html'] === 'div' ) {
1373 - echo '<div class="frm-category-icon frm-icon-wrapper" role="button"';
1374 - } else {
1375 - echo '<span class="frm-inner-circle"';
1376 - }
1377 - echo empty( $bg ) || empty( $atts['bg'] ) ? '' : ' style="background-color:' . esc_attr( $bg ) . '"';
1378 - echo '>';
1379 -
1287 + echo '<span class="frm-inner-circle" ' . ( isset( $icon[1] ) ? 'style="background-color:' . esc_attr( $icon[1] ) : '' ) . '">';
1380 1288 FrmAppHelper::icon_by_class( 'frmfont frm_' . $icon[0] . '_icon' );
1381 1289 echo '<span class="frm_hidden">';
1382 1290 FrmAppHelper::icon_by_class( 'frmfont frm_lock_icon' );
1383 1291 echo '</span>';
1384 - echo '</' . esc_attr( $atts['html'] ) . '>';
1292 + echo '</span>';
1385 1293 }
1386 1294
1387 1295 /**
1388 1296 * @since 4.03.01
1389 - *
1390 - * @return array<string>
1391 1297 */
1392 1298 public static function ignore_template_categories() {
1393 1299 return array( 'Business', 'Elite', 'Personal', 'Creator', 'Basic', 'free' );
1394 1300 }
@@ -1487,24 +1393,21 @@
1487 1393 }
1488 1394
1489 1395 /**
1490 1396 * @since 4.0
1491 - *
1492 - * @param array $item
1493 - * @return string|false
1494 1397 */
1495 1398 public static function get_plan_required( &$item ) {
1496 - if ( ! isset( $item['categories'] ) || ! is_array( $item['categories'] ) || ! empty( $item['url'] ) ) {
1399 + if ( ! isset( $item['categories'] ) || ! empty( $item['url'] ) ) {
1497 1400 return false;
1498 1401 }
1499 1402
1500 - $plans = array( 'free', 'Basic', 'Personal', 'Plus', 'Creator', 'Business', 'Elite' );
1403 + $plans = array( 'free', 'Basic', 'Personal', 'Business', 'Elite' );
1501 1404
1502 1405 foreach ( $item['categories'] as $k => $category ) {
1503 1406 if ( in_array( $category, $plans, true ) ) {
1504 1407 unset( $item['categories'][ $k ] );
1505 1408
1506 - if ( in_array( $category, array( 'Creator', 'Personal' ), true ) ) {
1409 + if ( $category === 'Personal' ) {
1507 1410 // Show the current package name.
1508 1411 $category = 'Plus';
1509 1412 }
1510 1413
@@ -1694,78 +1597,6 @@
1694 1597 return $total;
1695 1598 },
1696 1599 0
1697 1600 );
1698 - }
1699 -
1700 - /**
1701 - * Make sure the field shortcodes in a url always add the sanitize_url=1 option if nothing is defined.
1702 - * This is to prevent some field characters like ', @, and | from being stripped from the redirect URL.
1703 - *
1704 - * @since 5.0.16
1705 - *
1706 - * @param string $url
1707 - * @param int $form_id
1708 - * @return string
1709 - */
1710 - public static function maybe_add_sanitize_url_attr( $url, $form_id ) {
1711 - if ( false === strpos( $url, '[' ) ) {
1712 - // Do nothing if no shortcodes are detected.
1713 - return $url;
1714 - }
1715 -
1716 - $parsed = wp_parse_url( $url );
1717 - if ( empty( $parsed['query'] ) ) {
1718 - // Do nothing if no query can be detected in the url string.
1719 - return $url;
1720 - }
1721 -
1722 - $original_query = $parsed['query'];
1723 - $query = $parsed['query'];
1724 -
1725 - $shortcodes = FrmFieldsHelper::get_shortcodes( $query, $form_id );
1726 - if ( empty( $shortcodes[0] ) ) {
1727 - // No shortcodes found, do nothing.
1728 - return $url;
1729 - }
1730 -
1731 - foreach ( $shortcodes[0] as $key => $shortcode ) {
1732 - $options = trim( $shortcodes[3][ $key ] );
1733 -
1734 - if ( in_array( $shortcodes[1][ $key ], array( 'if ' ), true ) ) {
1735 - // Skip if shortcodes.
1736 - continue;
1737 - }
1738 -
1739 - if ( false !== strpos( $options, 'sanitize_url=' ) || false !== strpos( $options, 'sanitize=' ) ) {
1740 - // A sanitize option is already set so leave it alone.
1741 - continue;
1742 - }
1743 -
1744 - $new_shortcode = '[' . $shortcodes[2][ $key ];
1745 - if ( $options ) {
1746 - $new_shortcode .= ' ' . $options;
1747 - }
1748 - $new_shortcode .= ' sanitize_url=1]';
1749 -
1750 - $query = str_replace( $shortcode, $new_shortcode, $query );
1751 - }
1752 -
1753 - if ( $query === $original_query ) {
1754 - return $url;
1755 - }
1756 -
1757 - return str_replace( $original_query, $query, $url );
1758 - }
1759 -
1760 - /**
1761 - * Check if Pro isn't up to date yet.
1762 - * If Pro is active but using a version earlier than v6.2 fallback to Pro for AJAX submit (so things don't all happen twice).
1763 - *
1764 - * @since 6.2
1765 - *
1766 - * @return bool
1767 - */
1768 - public static function should_use_pro_for_ajax_submit() {
1769 - return is_callable( 'FrmProForm::is_ajax_on' ) && ! is_callable( 'FrmProFormsHelper::lite_supports_ajax_submit' );
1770 1601 }
1771 1602 }