PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.1
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 +39 -130 6.55.1 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 /**
@@ -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,19 +423,8 @@
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 430 echo FrmAppHelper::maybe_kses( $button ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
@@ -604,19 +568,19 @@
604 568 ?>
605 569 <li class="<?php echo esc_attr( $class ); ?>">
606 570 <a href="javascript:void(0)" class="frmids frm_insert_code"
607 571 data-code="<?php echo esc_attr( $args['id'] ); ?>">
572 + <span>[<?php echo esc_attr( isset( $args['id_label'] ) ? $args['id_label'] : $args['id'] ); ?>]</span>
608 573 <?php FrmAppHelper::icon_by_class( $field['icon'], array( 'aria-hidden' => 'true' ) ); ?>
609 574 <?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 575 </a>
612 576 <a href="javascript:void(0)" class="frmkeys frm_insert_code frm_hidden"
613 577 data-code="<?php echo esc_attr( $args['key'] ); ?>">
578 + <span>[<?php echo esc_attr( FrmAppHelper::truncate( isset( $args['key_label'] ) ? $args['key_label'] : $args['key'], 7 ) ); ?>]</span>
614 579 <?php if ( isset( $field['icon'] ) ) { ?>
615 580 <?php FrmAppHelper::icon_by_class( $field['icon'], array( 'aria-hidden' => 'true' ) ); ?>
616 581 <?php } ?>
617 582 <?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 583 </a>
620 584 </li>
621 585 <?php
622 586 }
@@ -640,12 +604,12 @@
640 604 <li class="<?php echo esc_attr( $args['class'] ); ?>">
641 605 <a href="javascript:void(0)" class="frm_insert_code <?php echo $has_tooltip ? 'frm_help' : ''; ?>"
642 606 <?php echo $has_tooltip ? 'title="' . esc_attr( $args['title'] ) . '"' : ''; ?>
643 607 data-code="<?php echo esc_attr( $args['code'] ); ?>">
644 - <?php echo esc_attr( FrmAppHelper::truncate( $args['label'], 60 ) ); ?>
645 608 <span>
646 609 [<?php echo esc_attr( FrmAppHelper::truncate( $args['code'], 10 ) ); ?>]
647 610 </span>
611 + <?php echo esc_attr( FrmAppHelper::truncate( $args['label'], 60 ) ); ?>
648 612 </a>
649 613 </li>
650 614 <?php
651 615 }
@@ -788,12 +752,8 @@
788 752 if ( strpos( $html, '[if save_draft]' ) ) {
789 753 $html = preg_replace( '/(\[if\s+save_draft\])(.*?)(\[\/if\s+save_draft\])/mis', '', $html );
790 754 }
791 755
792 - if ( strpos( $html, '[if start_over]' ) ) {
793 - $html = preg_replace( '/(\[if\s+start_over\])(.*?)(\[\/if\s+start_over\])/mis', '', $html );
794 - }
795 -
796 756 if ( apply_filters( 'frm_do_html_shortcodes', true ) ) {
797 757 $html = do_shortcode( $html );
798 758 }
799 759
@@ -1198,12 +1158,9 @@
1198 1158 'label' => __( 'Move Form to Trash', 'formidable' ),
1199 1159 'short' => __( 'Trash', 'formidable' ),
1200 1160 'url' => wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . absint( $id ) ),
1201 1161 '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 - ),
1162 + 'data' => array( 'frmverify' => __( 'Do you want to move this form to the trash?', 'formidable' ) ),
1206 1163 ),
1207 1164 'delete' => array(
1208 1165 'label' => __( 'Delete Permanently', 'formidable' ),
1209 1166 'short' => __( 'Delete', 'formidable' ),
@@ -1209,12 +1166,9 @@
1209 1166 'short' => __( 'Delete', 'formidable' ),
1210 1167 'url' => wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . absint( $id ) ),
1211 1168 'confirm' => __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ),
1212 1169 '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 - ),
1170 + '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 1171 ),
1218 1172 );
1219 1173 }
1220 1174
@@ -1300,24 +1254,9 @@
1300 1254
1301 1255 return $name;
1302 1256 }
1303 1257
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 -
1258 + public static function template_icon( $categories ) {
1320 1259 $ignore = self::ignore_template_categories();
1321 1260 $categories = array_diff( $categories, $ignore );
1322 1261
1323 1262 $icons = array(
@@ -1323,32 +1262,25 @@
1323 1262 $icons = array(
1324 1263 'WooCommerce' => array( 'woocommerce', 'var(--purple)' ),
1325 1264 'Post' => array( 'wordpress', 'rgb(0,160,210)' ),
1326 1265 'User Registration' => array( 'register', 'var(--pink)' ),
1327 - 'Registration and Signup' => array( 'register', 'var(--pink)' ),
1328 1266 'PayPal' => array( 'paypal' ),
1329 1267 'Stripe' => array( 'credit_card', 'var(--green)' ),
1330 - 'Twilio' => array( 'sms' ),
1331 - 'Payment' => array( 'credit_card' ),
1332 - 'Order Form' => array( 'product' ),
1333 - 'Finance' => array( 'total' ),
1268 + 'Twilio' => array( 'sms', 'rgb(0,160,210)' ),
1269 + 'Payment' => array( 'credit_card', 'var(--green)' ),
1334 1270 'Health and Wellness' => array( 'heart', 'var(--pink)' ),
1335 1271 'Event Planning' => array( 'calendar', 'var(--orange)' ),
1336 - 'Real Estate' => array( 'house' ),
1337 - 'Nonprofit' => array( 'heart_solid' ),
1272 + 'Real Estate' => array( 'house', 'var(--purple)' ),
1338 1273 'Calculator' => array( 'calculator', 'var(--purple)' ),
1339 - 'Quiz' => array( 'percent' ),
1340 1274 'Registrations' => array( 'address_card' ),
1341 - 'Customer Service' => array( 'users_solid' ),
1342 - 'Education' => array( 'pencil' ),
1343 - 'Marketing' => array( 'eye' ),
1344 - 'Feedback' => array( 'smile' ),
1275 + 'Customer Service' => array( 'users_solid', 'var(--pink)' ),
1276 + 'Education' => array( 'pencil', 'var(--primary-color)' ),
1277 + 'Marketing' => array( 'eye', 'rgb(0,160,210)' ),
1278 + 'Feedback' => array( 'smile', 'var(--green)' ),
1345 1279 'Business Operations' => array( 'case' ),
1346 1280 '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' ),
1281 + 'Survey' => array( 'comment', 'var(--primary-color)' ),
1282 + 'Application Form' => array( 'align_right', 'rgb(0,160,210)' ),
1351 1283 '' => array( 'align_right' ),
1352 1284 );
1353 1285
1354 1286 $icons[ __( 'My Templates', 'formidable' ) ] = array( 'user', 'var(--orange)' );
@@ -1366,29 +1298,18 @@
1366 1298 }
1367 1299 $icon = reset( $icons );
1368 1300 }
1369 1301
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 -
1302 + echo '<span class="frm-inner-circle" ' . ( isset( $icon[1] ) ? 'style="background-color:' . esc_attr( $icon[1] ) : '' ) . '">';
1380 1303 FrmAppHelper::icon_by_class( 'frmfont frm_' . $icon[0] . '_icon' );
1381 1304 echo '<span class="frm_hidden">';
1382 1305 FrmAppHelper::icon_by_class( 'frmfont frm_lock_icon' );
1383 1306 echo '</span>';
1384 - echo '</' . esc_attr( $atts['html'] ) . '>';
1307 + echo '</span>';
1385 1308 }
1386 1309
1387 1310 /**
1388 1311 * @since 4.03.01
1389 - *
1390 - * @return array<string>
1391 1312 */
1392 1313 public static function ignore_template_categories() {
1393 1314 return array( 'Business', 'Elite', 'Personal', 'Creator', 'Basic', 'free' );
1394 1315 }
@@ -1754,18 +1675,6 @@
1754 1675 return $url;
1755 1676 }
1756 1677
1757 1678 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 1679 }
1771 1680 }