PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.21
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.21
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 +22 -29 6.296.21 View file →
@@ -35,9 +35,8 @@
35 35 * be used. Otherwise, `https://formidableforms.com/{$page}` will be used.
36 36 * @type string $tip Tip text.
37 37 * @type string $call Call to action text.
38 38 * }
39 - *
40 39 * @param string $html
41 40 *
42 41 * @return void
43 42 */
@@ -47,10 +46,10 @@
47 46 'class' => 'frm-mt-0',
48 47 );
49 48 $tip = array_merge( $defaults, $tip );
50 49
51 - if ( isset( $tip['link'] ) && ! isset( $tip['link']['medium'] ) && ! isset( $tip['link']['campaign'] ) ) {
52 - $tip['link']['campaign'] = 'tip';
50 + if ( isset( $tip['link'] ) && ! isset( $tip['link']['medium'] ) ) {
51 + $tip['link']['medium'] = 'tip';
53 52 }
54 53
55 54 if ( 'p' === $html ) {
56 55 echo '<p class="frmcenter ' . esc_attr( $tip['class'] ) . '">';
@@ -56,11 +55,10 @@
56 55 echo '<p class="frmcenter ' . esc_attr( $tip['class'] ) . '">';
57 56 }
58 57
59 58 $link = self::get_tip_link( $tip );
60 - // phpcs:disable Generic.WhiteSpace.ScopeIndent
61 59 ?>
62 - <a href="<?php echo esc_url( $link ); ?>" <?php echo ! empty( $tip['link'] ) ? 'target="_blank"' : ''; ?> class="frm_pro_tip frm-gradient">
60 + <a href="<?php echo esc_url( $link ); ?>" <?php echo empty( $tip['link'] ) ? '' : 'target="_blank"'; ?> class="frm_pro_tip frm-gradient">
63 61 <span class="frm-tip-badge"><?php esc_html_e( 'PRO TIP', 'formidable' ); ?></span>
64 62
65 63 <?php if ( isset( $tip['call'] ) ) { ?>
66 64 <span class="frm-tip-info">
@@ -71,9 +69,8 @@
71 69 <?php echo esc_html( $tip['call'] ? $tip['call'] : $tip['tip'] ); ?>
72 70 </span>
73 71 </a>
74 72 <?php
75 - // phpcs:enable Generic.WhiteSpace.ScopeIndent
76 73
77 74 if ( 'p' === $html ) {
78 75 echo '</p>';
79 76 }
@@ -82,9 +79,8 @@
82 79 /**
83 80 * @since 6.21
84 81 *
85 82 * @param array $tip
86 - *
87 83 * @return string
88 84 */
89 85 private static function get_tip_link( $tip ) {
90 86 if ( empty( $tip['tip'] ) ) {
@@ -91,14 +87,12 @@
91 87 return $tip['page'];
92 88 }
93 89
94 90 $cta_link = FrmSalesApi::get_best_sale_value( 'pro_tip_cta_link' );
95 -
96 91 if ( $cta_link ) {
97 92 if ( is_array( $tip['link'] ) ) {
98 - return FrmAppHelper::maybe_add_missing_utm( $cta_link, $tip['link'] );
93 + $cta_link = FrmAppHelper::maybe_add_missing_utm( $cta_link, $tip['link'] );
99 94 }
100 -
101 95 return $cta_link;
102 96 }
103 97
104 98 return FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] );
@@ -112,13 +106,11 @@
112 106 * @return string
113 107 */
114 108 private static function cta_label() {
115 109 $cta_text = FrmSalesApi::get_best_sale_value( 'pro_tip_cta_text' );
116 -
117 110 if ( $cta_text ) {
118 111 return $cta_text;
119 112 }
120 -
121 113 return FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro.', 'formidable' );
122 114 }
123 115
124 116 /**
@@ -124,9 +116,9 @@
124 116 /**
125 117 * @return array
126 118 */
127 119 public static function get_builder_tip() {
128 - return array(
120 + $tips = array(
129 121 array(
130 122 'link' => array(
131 123 'content' => 'conditional-logic',
132 124 'param' => 'conditional-logic-wordpress-forms',
@@ -174,8 +166,10 @@
174 166 'tip' => __( 'Save time with autofill forms.', 'formidable' ),
175 167 'call' => self::cta_label(),
176 168 ),
177 169 );
170 +
171 + return $tips;
178 172 }
179 173
180 174 /**
181 175 * @return array
@@ -180,9 +174,9 @@
180 174 /**
181 175 * @return array
182 176 */
183 177 public static function get_form_settings_tip() {
184 - return array(
178 + $tips = array(
185 179 array(
186 180 'link' => array(
187 181 'content' => 'front-edit-b',
188 182 'param' => 'wordpress-front-end-editing',
@@ -206,8 +200,10 @@
206 200 'tip' => __( 'Limit form access with built-in scheduling.', 'formidable' ),
207 201 'call' => self::cta_label(),
208 202 ),
209 203 );
204 +
205 + return $tips;
210 206 }
211 207
212 208 /**
213 209 * @return array
@@ -212,9 +208,9 @@
212 208 /**
213 209 * @return array
214 210 */
215 211 public static function get_form_action_tip() {
216 - return array(
212 + $tips = array(
217 213 array(
218 214 'link' => array(
219 215 'content' => 'email-routing',
220 216 'param' => 'virtually-unlimited-emails',
@@ -302,8 +298,10 @@
302 298 'tip' => __( 'Fill Advanced Custom Fields automatically with form entries.', 'formidable' ),
303 299 'call' => self::cta_label(),
304 300 ),
305 301 );
302 +
303 + return $tips;
306 304 }
307 305
308 306 /**
309 307 * @return array
@@ -308,9 +306,9 @@
308 306 /**
309 307 * @return array
310 308 */
311 309 public static function get_styling_tip() {
312 - return array(
310 + $tips = array(
313 311 array(
314 312 'link' => array(
315 313 'content' => 'style',
316 314 'param' => 'wordpress-visual-form-styler',
@@ -334,8 +332,10 @@
334 332 'tip' => __( 'Want to duplicate a style?', 'formidable' ),
335 333 'call' => self::cta_label(),
336 334 ),
337 335 );
336 +
337 + return $tips;
338 338 }
339 339
340 340 /**
341 341 * @return array
@@ -366,10 +366,11 @@
366 366 'tip' => __( 'Turn entries into dynamic content — no code needed.', 'formidable' ),
367 367 'call' => self::cta_label(),
368 368 ),
369 369 );
370 + $tips = array_merge( $tips, self::get_import_tip() );
370 371
371 - return array_merge( $tips, self::get_import_tip() );
372 + return $tips;
372 373 }
373 374
374 375 /**
375 376 * @return array
@@ -374,9 +375,9 @@
374 375 /**
375 376 * @return array
376 377 */
377 378 public static function get_import_tip() {
378 - return array(
379 + $tips = array(
379 380 array(
380 381 'link' => array(
381 382 'content' => 'import',
382 383 'param' => 'importing-exporting-wordpress-forms',
@@ -384,23 +385,15 @@
384 385 'tip' => __( 'Want to import entries into your forms?', 'formidable' ),
385 386 'call' => self::cta_label(),
386 387 ),
387 388 );
389 +
390 + return $tips;
388 391 }
389 392
390 - /**
391 - * @param array $tips
392 - *
393 - * @return array
394 - */
395 393 public static function get_random_tip( $tips ) {
396 - $count = count( $tips );
394 + $random = rand( 0, count( $tips ) - 1 );
397 395
398 - if ( $count === 0 ) {
399 - return array();
400 - }
401 -
402 - $random = random_int( 0, $count - 1 );
403 396 return $tips[ $random ];
404 397 }
405 398
406 399 /**