PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.19
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.19
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 +75 -20 6.56.19 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,23 +56,19 @@
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">
61 - <?php FrmAppHelper::icon_by_class( 'frmfont frm_lightning', array( 'aria-hidden' => 'true' ) ); ?>
60 + <a href="<?php echo esc_url( $link ); ?>" <?php echo empty( $tip['link'] ) ? '' : 'target="_blank"'; ?> class="frm_pro_tip frm-gradient">
61 + <span class="frm-tip-badge"><?php esc_html_e( 'PRO TIP', 'formidable' ); ?></span>
62 62
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 } ?>
68 + <span class="frm-tip-cta">
69 + <?php echo esc_html( $tip['call'] ? $tip['call'] : $tip['tip'] ); ?>
70 + </span>
75 71 </a>
76 72 <?php
77 73
78 74 if ( 'p' === $html ) {
@@ -80,8 +76,19 @@
80 76 }
81 77 }
82 78
83 79 /**
80 + * Use the correct label for the license.
81 + *
82 + * @since 6.5.1
83 + *
84 + * @return string
85 + */
86 + private static function cta_label() {
87 + return FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro.', 'formidable' );
88 + }
89 +
90 + /**
84 91 * @return array
85 92 */
86 93 public static function get_builder_tip() {
87 94 $tips = array(
@@ -90,9 +97,9 @@
90 97 'content' => 'conditional-logic',
91 98 'param' => 'conditional-logic-wordpress-forms',
92 99 ),
93 100 'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ),
94 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
101 + 'call' => self::cta_label(),
95 102 ),
96 103 array(
97 104 'link' => array(
98 105 'content' => 'confirmation-fields',
@@ -106,9 +113,9 @@
106 113 'content' => 'page-breaks',
107 114 'param' => 'wordpress-multi-page-forms',
108 115 ),
109 116 'tip' => __( 'Use page breaks for easier forms.', 'formidable' ),
110 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
117 + 'call' => self::cta_label(),
111 118 ),
112 119 array(
113 120 'link' => array(
114 121 'content' => 'file-uploads',
@@ -122,9 +129,9 @@
122 129 'content' => 'calculations',
123 130 'param' => 'field-calculations-wordpress-form',
124 131 ),
125 132 'tip' => __( 'Need to calculate a total?', 'formidable' ),
126 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
133 + 'call' => self::cta_label(),
127 134 ),
128 135 array(
129 136 'link' => array(
130 137 'content' => 'prefill-fields',
@@ -190,9 +197,9 @@
190 197 'content' => 'create-posts',
191 198 'param' => 'create-posts-pages-wordpress-forms',
192 199 ),
193 200 'tip' => __( 'Create blog posts or pages from the front-end.', 'formidable' ),
194 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
201 + 'call' => self::cta_label(),
195 202 ),
196 203 array(
197 204 'link' => array(
198 205 'content' => 'user-submit',
@@ -198,9 +205,9 @@
198 205 'content' => 'user-submit',
199 206 'param' => 'create-posts-pages-wordpress-forms',
200 207 ),
201 208 'tip' => __( 'Let your users submit posts on the front-end.', 'formidable' ),
202 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
209 + 'call' => self::cta_label(),
203 210 ),
204 211 array(
205 212 'link' => array(
206 213 'content' => 'mailchimp',
@@ -288,9 +295,9 @@
288 295 'content' => 'style',
289 296 'param' => 'bg-image-style-settings',
290 297 ),
291 298 'tip' => __( 'Want to add a background image?', 'formidable' ),
292 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
299 + 'call' => self::cta_label(),
293 300 ),
294 301 array(
295 302 'link' => array(
296 303 'content' => 'style',
@@ -296,9 +303,9 @@
296 303 'content' => 'style',
297 304 'param' => 'duplicate-style',
298 305 ),
299 306 'tip' => __( 'Want to duplicate a style?', 'formidable' ),
300 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
307 + 'call' => self::cta_label(),
301 308 ),
302 309 );
303 310
304 311 return $tips;
@@ -322,9 +329,9 @@
322 329 'content' => 'entries-search',
323 330 'param' => 'form-entry-management-wordpress',
324 331 ),
325 332 'tip' => __( 'Want to search submitted entries?', 'formidable' ),
326 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
333 + 'call' => self::cta_label(),
327 334 ),
328 335 array(
329 336 'link' => array(
330 337 'content' => 'views',
@@ -349,9 +356,9 @@
349 356 'content' => 'import',
350 357 'param' => 'importing-exporting-wordpress-forms',
351 358 ),
352 359 'tip' => __( 'Want to import entries into your forms?', 'formidable' ),
353 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
360 + 'call' => self::cta_label(),
354 361 ),
355 362 );
356 363
357 364 return $tips;
@@ -397,6 +404,54 @@
397 404 public static function get_random_tip( $tips ) {
398 405 $random = rand( 0, count( $tips ) - 1 );
399 406
400 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 + 'target' => '_blank',
443 + );
444 +
445 + $args = wp_parse_args( $args, $defaults );
446 +
447 + $attributes = array(
448 + 'class' => trim( 'frm-cta frm-flex frm-p-sm ' . $args['class'] ),
449 + );
450 +
451 + if ( $args['id'] ) {
452 + $attributes['id'] = $args['id'];
453 + }
454 +
455 + require FrmAppHelper::plugin_path() . '/classes/views/shared/admin-cta.php';
401 456 }
402 457 }