PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.2.02
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.2.02
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 +25 -110 6.55.2.02 View file →
@@ -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 /**
@@ -396,9 +379,8 @@
396 379 'after_html' => '',
397 380 'submit_html' => self::get_default_html( 'submit' ),
398 381 'show_title' => 0,
399 382 'show_description' => 0,
400 - 'ajax_submit' => 0,
401 383 );
402 384 }
403 385
404 386 /**
@@ -420,15 +402,13 @@
420 402 */
421 403 public static function get_default_html( $loc ) {
422 404 if ( $loc == 'submit' ) {
423 405 $draft_link = self::get_draft_link();
424 - $start_over = self::get_start_over_shortcode();
425 406 $default_html = <<<SUBMIT_HTML
426 407 <div class="frm_submit">
427 408 [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 409 <button class="frm_button_submit" type="submit" [button_action]>[button_label]</button>
429 410 $draft_link
430 -$start_over
431 411 </div>
432 412 SUBMIT_HTML;
433 413 } elseif ( $loc == 'before' ) {
434 414 $default_html = <<<BEFORE_HTML
@@ -448,19 +428,8 @@
448 428
449 429 return $link;
450 430 }
451 431
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 432 public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) {
464 433 $button = self::replace_shortcodes( $html, $form, $submit, $form_action, $values );
465 434 if ( ! strpos( $button, '[button_action]' ) ) {
466 435 echo FrmAppHelper::maybe_kses( $button ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
@@ -604,19 +573,19 @@
604 573 ?>
605 574 <li class="<?php echo esc_attr( $class ); ?>">
606 575 <a href="javascript:void(0)" class="frmids frm_insert_code"
607 576 data-code="<?php echo esc_attr( $args['id'] ); ?>">
577 + <span>[<?php echo esc_attr( isset( $args['id_label'] ) ? $args['id_label'] : $args['id'] ); ?>]</span>
608 578 <?php FrmAppHelper::icon_by_class( $field['icon'], array( 'aria-hidden' => 'true' ) ); ?>
609 579 <?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 580 </a>
612 581 <a href="javascript:void(0)" class="frmkeys frm_insert_code frm_hidden"
613 582 data-code="<?php echo esc_attr( $args['key'] ); ?>">
583 + <span>[<?php echo esc_attr( FrmAppHelper::truncate( isset( $args['key_label'] ) ? $args['key_label'] : $args['key'], 7 ) ); ?>]</span>
614 584 <?php if ( isset( $field['icon'] ) ) { ?>
615 585 <?php FrmAppHelper::icon_by_class( $field['icon'], array( 'aria-hidden' => 'true' ) ); ?>
616 586 <?php } ?>
617 587 <?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 588 </a>
620 589 </li>
621 590 <?php
622 591 }
@@ -640,12 +609,12 @@
640 609 <li class="<?php echo esc_attr( $args['class'] ); ?>">
641 610 <a href="javascript:void(0)" class="frm_insert_code <?php echo $has_tooltip ? 'frm_help' : ''; ?>"
642 611 <?php echo $has_tooltip ? 'title="' . esc_attr( $args['title'] ) . '"' : ''; ?>
643 612 data-code="<?php echo esc_attr( $args['code'] ); ?>">
644 - <?php echo esc_attr( FrmAppHelper::truncate( $args['label'], 60 ) ); ?>
645 613 <span>
646 614 [<?php echo esc_attr( FrmAppHelper::truncate( $args['code'], 10 ) ); ?>]
647 615 </span>
616 + <?php echo esc_attr( FrmAppHelper::truncate( $args['label'], 60 ) ); ?>
648 617 </a>
649 618 </li>
650 619 <?php
651 620 }
@@ -788,12 +757,8 @@
788 757 if ( strpos( $html, '[if save_draft]' ) ) {
789 758 $html = preg_replace( '/(\[if\s+save_draft\])(.*?)(\[\/if\s+save_draft\])/mis', '', $html );
790 759 }
791 760
792 - if ( strpos( $html, '[if start_over]' ) ) {
793 - $html = preg_replace( '/(\[if\s+start_over\])(.*?)(\[\/if\s+start_over\])/mis', '', $html );
794 - }
795 -
796 761 if ( apply_filters( 'frm_do_html_shortcodes', true ) ) {
797 762 $html = do_shortcode( $html );
798 763 }
799 764
@@ -1198,12 +1163,9 @@
1198 1163 'label' => __( 'Move Form to Trash', 'formidable' ),
1199 1164 'short' => __( 'Trash', 'formidable' ),
1200 1165 'url' => wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . absint( $id ) ),
1201 1166 '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 - ),
1167 + 'data' => array( 'frmverify' => __( 'Do you want to move this form to the trash?', 'formidable' ) ),
1206 1168 ),
1207 1169 'delete' => array(
1208 1170 'label' => __( 'Delete Permanently', 'formidable' ),
1209 1171 'short' => __( 'Delete', 'formidable' ),
@@ -1209,12 +1171,9 @@
1209 1171 'short' => __( 'Delete', 'formidable' ),
1210 1172 'url' => wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . absint( $id ) ),
1211 1173 'confirm' => __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ),
1212 1174 '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 - ),
1175 + '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 1176 ),
1218 1177 );
1219 1178 }
1220 1179
@@ -1300,24 +1259,9 @@
1300 1259
1301 1260 return $name;
1302 1261 }
1303 1262
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 -
1263 + public static function template_icon( $categories ) {
1320 1264 $ignore = self::ignore_template_categories();
1321 1265 $categories = array_diff( $categories, $ignore );
1322 1266
1323 1267 $icons = array(
@@ -1323,32 +1267,26 @@
1323 1267 $icons = array(
1324 1268 'WooCommerce' => array( 'woocommerce', 'var(--purple)' ),
1325 1269 'Post' => array( 'wordpress', 'rgb(0,160,210)' ),
1326 1270 'User Registration' => array( 'register', 'var(--pink)' ),
1327 - 'Registration and Signup' => array( 'register', 'var(--pink)' ),
1328 1271 'PayPal' => array( 'paypal' ),
1329 1272 'Stripe' => array( 'credit_card', 'var(--green)' ),
1330 - 'Twilio' => array( 'sms' ),
1331 - 'Payment' => array( 'credit_card' ),
1332 - 'Order Form' => array( 'product' ),
1333 - 'Finance' => array( 'total' ),
1273 + 'Twilio' => array( 'sms', 'rgb(0,160,210)' ),
1274 + 'Payment' => array( 'credit_card', 'var(--green)' ),
1334 1275 'Health and Wellness' => array( 'heart', 'var(--pink)' ),
1335 1276 'Event Planning' => array( 'calendar', 'var(--orange)' ),
1336 - 'Real Estate' => array( 'house' ),
1337 - 'Nonprofit' => array( 'heart_solid' ),
1277 + 'Real Estate' => array( 'house', 'var(--purple)' ),
1338 1278 'Calculator' => array( 'calculator', 'var(--purple)' ),
1339 - 'Quiz' => array( 'percent' ),
1340 1279 'Registrations' => array( 'address_card' ),
1341 - 'Customer Service' => array( 'users_solid' ),
1342 - 'Education' => array( 'pencil' ),
1343 - 'Marketing' => array( 'eye' ),
1344 - 'Feedback' => array( 'smile' ),
1280 + 'Customer Service' => array( 'users_solid', 'var(--pink)' ),
1281 + 'Education' => array( 'pencil', 'var(--primary-color)' ),
1282 + 'Marketing' => array( 'eye', 'rgb(0,160,210)' ),
1283 + 'Feedback' => array( 'smile', 'var(--green)' ),
1345 1284 'Business Operations' => array( 'case' ),
1346 1285 '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' ),
1286 + 'Survey' => array( 'comment', 'var(--primary-color)' ),
1287 + 'Application Form' => array( 'align_right', 'rgb(0,160,210)' ),
1288 + 'Quiz' => array( 'percent' ),
1351 1289 '' => array( 'align_right' ),
1352 1290 );
1353 1291
1354 1292 $icons[ __( 'My Templates', 'formidable' ) ] = array( 'user', 'var(--orange)' );
@@ -1366,29 +1304,18 @@
1366 1304 }
1367 1305 $icon = reset( $icons );
1368 1306 }
1369 1307
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 -
1308 + echo '<span class="frm-inner-circle" ' . ( isset( $icon[1] ) ? 'style="background-color:' . esc_attr( $icon[1] ) : '' ) . '">';
1380 1309 FrmAppHelper::icon_by_class( 'frmfont frm_' . $icon[0] . '_icon' );
1381 1310 echo '<span class="frm_hidden">';
1382 1311 FrmAppHelper::icon_by_class( 'frmfont frm_lock_icon' );
1383 1312 echo '</span>';
1384 - echo '</' . esc_attr( $atts['html'] ) . '>';
1313 + echo '</span>';
1385 1314 }
1386 1315
1387 1316 /**
1388 1317 * @since 4.03.01
1389 - *
1390 - * @return array<string>
1391 1318 */
1392 1319 public static function ignore_template_categories() {
1393 1320 return array( 'Business', 'Elite', 'Personal', 'Creator', 'Basic', 'free' );
1394 1321 }
@@ -1754,18 +1681,6 @@
1754 1681 return $url;
1755 1682 }
1756 1683
1757 1684 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 1685 }
1771 1686 }