PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.14
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.14
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/FrmTipsHelper.php +54 -11 6.5.26.14 View file →
@@ -26,10 +26,10 @@
26 26 * Shows tip.
27 27 *
28 28 * @since 6.0
29 29 *
30 - * @param array $tip {
31 - * Tip args
30 + * @param array $tip {
31 + * Tip args.
32 32 *
33 33 * @type array $link Tip link data. See the first parameter of {@see FrmAppHelper::admin_upgrade_link()} for more details.
34 34 * @type string $page The based link of the tip. If this is empty, `https://formidableforms.com/lite-upgrade/` will
35 35 * be used. Otherwise, `https://formidableforms.com/{$page}` will be used.
@@ -56,9 +56,9 @@
56 56 }
57 57
58 58 $link = empty( $tip['link'] ) ? $tip['page'] : FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] );
59 59 ?>
60 - <a href="<?php echo esc_url( $link ); ?>" <?php echo empty( $tip['link'] ) ? '' : 'target="_blank"'; ?> class="frm_pro_tip">
60 + <span class="frm_pro_tip">
61 61 <?php FrmAppHelper::icon_by_class( 'frmfont frm_lightning', array( 'aria-hidden' => 'true' ) ); ?>
62 62
63 63 <?php if ( isset( $tip['call'] ) ) { ?>
64 64 <span class="frm-tip-info">
@@ -63,17 +63,13 @@
63 63 <?php if ( isset( $tip['call'] ) ) { ?>
64 64 <span class="frm-tip-info">
65 65 <?php echo esc_html( $tip['tip'] ); ?>
66 66 </span>
67 - <span class="frm-tip-cta">
68 - <?php echo esc_html( $tip['call'] ); ?>
69 - </span>
70 - <?php } else { ?>
71 - <span class="frm-tip-cta">
72 - <?php echo esc_html( $tip['tip'] ); ?>
73 - </span>
74 67 <?php } ?>
75 - </a>
68 + <a href="<?php echo esc_url( $link ); ?>" <?php echo empty( $tip['link'] ) ? '' : 'target="_blank"'; ?> class="frm-tip-cta">
69 + <?php echo esc_html( $tip['call'] ? $tip['call'] : $tip['tip'] ); ?>
70 + </a>
71 + </span>
76 72 <?php
77 73
78 74 if ( 'p' === $html ) {
79 75 echo '</p>';
@@ -408,6 +404,53 @@
408 404 public static function get_random_tip( $tips ) {
409 405 $random = rand( 0, count( $tips ) - 1 );
410 406
411 407 return $tips[ $random ];
408 + }
409 +
410 + /**
411 + * Displays a call-to-action section in the admin area.
412 + *
413 + * @since 6.7
414 + *
415 + * @param array $args {
416 + * An array of arguments to configure the call-to-action section.
417 + *
418 + * @type string $title The title of the section.
419 + * @type string $description The description of the section.
420 + * @type string $link_text The text for the link.
421 + * @type string $link_url The URL for the link.
422 + * @type string $role The required user role to view the section. Default 'administrator'.
423 + * }
424 + *
425 + * @return void
426 + */
427 + public static function show_admin_cta( $args ) {
428 + $role = ! empty( $args['role'] ) ? $args['role'] : 'administrator';
429 +
430 + if ( ! current_user_can( $role ) ) {
431 + // Return early if the user doesn't have the required capability.
432 + return;
433 + }
434 +
435 + $defaults = array(
436 + 'title' => '',
437 + 'description' => '',
438 + 'link_text' => '',
439 + 'link_url' => '#',
440 + 'class' => '',
441 + 'id' => '',
442 + );
443 +
444 + $args = wp_parse_args( $args, $defaults );
445 +
446 + $attributes = array(
447 + 'class' => trim( 'frm-cta frm-flex frm-p-sm ' . $args['class'] ),
448 + );
449 +
450 + if ( $args['id'] ) {
451 + $attributes['id'] = $args['id'];
452 + }
453 +
454 + require FrmAppHelper::plugin_path() . '/classes/views/shared/admin-cta.php';
412 455 }
413 456 }