PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.0
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 +94 -192 6.266.0 View file →
@@ -4,14 +4,8 @@
4 4 }
5 5
6 6 class FrmTipsHelper {
7 7
8 - /**
9 - * @param string $callback
10 - * @param string $html
11 - *
12 - * @return void
13 - */
14 8 public static function pro_tip( $callback, $html = '' ) {
15 9 if ( FrmAppHelper::pro_is_installed() ) {
16 10 return;
17 11 }
@@ -18,9 +12,9 @@
18 12
19 13 $tips = self::$callback();
20 14 $tip = self::get_random_tip( $tips );
21 15
22 - self::show_tip( $tip, $html );
16 + self::show_tip( $tip );
23 17 }
24 18
25 19 /**
26 20 * Shows tip.
@@ -26,10 +20,10 @@
26 20 * Shows tip.
27 21 *
28 22 * @since 6.0
29 23 *
30 - * @param array $tip {
31 - * Tip args.
24 + * @param array $tip {
25 + * Tip args
32 26 *
33 27 * @type array $link Tip link data. See the first parameter of {@see FrmAppHelper::admin_upgrade_link()} for more details.
34 28 * @type string $page The based link of the tip. If this is empty, `https://formidableforms.com/lite-upgrade/` will
35 29 * be used. Otherwise, `https://formidableforms.com/{$page}` will be used.
@@ -35,41 +29,38 @@
35 29 * be used. Otherwise, `https://formidableforms.com/{$page}` will be used.
36 30 * @type string $tip Tip text.
37 31 * @type string $call Call to action text.
38 32 * }
39 - *
40 - * @param string $html
41 - *
42 - * @return void
43 33 */
44 34 public static function show_tip( $tip, $html = '' ) {
45 - $defaults = array(
46 - 'page' => '',
47 - 'class' => 'frm-mt-0',
48 - );
49 - $tip = array_merge( $defaults, $tip );
50 -
35 + if ( ! isset( $tip['page'] ) ) {
36 + $tip['page'] = '';
37 + }
51 38 if ( isset( $tip['link'] ) && ! isset( $tip['link']['medium'] ) ) {
52 39 $tip['link']['medium'] = 'tip';
53 40 }
54 41
55 42 if ( 'p' === $html ) {
56 - echo '<p class="frmcenter ' . esc_attr( $tip['class'] ) . '">';
43 + echo '<p class="frmcenter frm-mt-0">';
57 44 }
58 45
59 - $link = self::get_tip_link( $tip );
46 + $link = empty( $tip['link'] ) ? $tip['page'] : FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] );
60 47 ?>
61 - <a href="<?php echo esc_url( $link ); ?>" <?php echo empty( $tip['link'] ) ? '' : 'target="_blank"'; ?> class="frm_pro_tip frm-gradient">
62 - <span class="frm-tip-badge"><?php esc_html_e( 'PRO TIP', 'formidable' ); ?></span>
48 + <a href="<?php echo esc_url( $link ); ?>" <?php echo empty( $tip['link'] ) ? '' : 'target="_blank"'; ?> class="frm_pro_tip">
49 + <?php FrmAppHelper::icon_by_class( 'frmfont frm_lightning', array( 'aria-hidden' => 'true' ) ); ?>
63 50
64 51 <?php if ( isset( $tip['call'] ) ) { ?>
65 52 <span class="frm-tip-info">
66 53 <?php echo esc_html( $tip['tip'] ); ?>
67 54 </span>
55 + <span class="frm-tip-cta">
56 + <?php echo esc_html( $tip['call'] ); ?>
57 + </span>
58 + <?php } else { ?>
59 + <span class="frm-tip-cta">
60 + <?php echo esc_html( $tip['tip'] ); ?>
61 + </span>
68 62 <?php } ?>
69 - <span class="frm-tip-cta">
70 - <?php echo esc_html( $tip['call'] ? $tip['call'] : $tip['tip'] ); ?>
71 - </span>
72 63 </a>
73 64 <?php
74 65
75 66 if ( 'p' === $html ) {
@@ -76,51 +67,8 @@
76 67 echo '</p>';
77 68 }
78 69 }
79 70
80 - /**
81 - * @since 6.21
82 - *
83 - * @param array $tip
84 - *
85 - * @return string
86 - */
87 - private static function get_tip_link( $tip ) {
88 - if ( empty( $tip['tip'] ) ) {
89 - return $tip['page'];
90 - }
91 -
92 - $cta_link = FrmSalesApi::get_best_sale_value( 'pro_tip_cta_link' );
93 -
94 - if ( $cta_link ) {
95 - if ( is_array( $tip['link'] ) ) {
96 - $cta_link = FrmAppHelper::maybe_add_missing_utm( $cta_link, $tip['link'] );
97 - }
98 - return $cta_link;
99 - }
100 -
101 - return FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] );
102 - }
103 -
104 - /**
105 - * Use the correct label for the license.
106 - *
107 - * @since 6.5.1
108 - *
109 - * @return string
110 - */
111 - private static function cta_label() {
112 - $cta_text = FrmSalesApi::get_best_sale_value( 'pro_tip_cta_text' );
113 -
114 - if ( $cta_text ) {
115 - return $cta_text;
116 - }
117 - return FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro.', 'formidable' );
118 - }
119 -
120 - /**
121 - * @return array
122 - */
123 71 public static function get_builder_tip() {
124 72 $tips = array(
125 73 array(
126 74 'link' => array(
@@ -127,9 +75,9 @@
127 75 'content' => 'conditional-logic',
128 76 'param' => 'conditional-logic-wordpress-forms',
129 77 ),
130 78 'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ),
131 - 'call' => self::cta_label(),
79 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
132 80 ),
133 81 array(
134 82 'link' => array(
135 83 'content' => 'confirmation-fields',
@@ -134,10 +82,10 @@
134 82 'link' => array(
135 83 'content' => 'confirmation-fields',
136 84 'param' => 'confirmation-fields-wordpress-forms',
137 85 ),
138 - 'tip' => __( 'Eliminate input errors with email confirmation fields.', 'formidable' ),
139 - 'call' => self::cta_label(),
86 + 'tip' => __( 'Want to stop losing leads from email typos?', 'formidable' ),
87 + 'call' => __( 'Add email confirmation fields.', 'formidable' ),
140 88 ),
141 89 array(
142 90 'link' => array(
143 91 'content' => 'page-breaks',
@@ -143,9 +91,9 @@
143 91 'content' => 'page-breaks',
144 92 'param' => 'wordpress-multi-page-forms',
145 93 ),
146 94 'tip' => __( 'Use page breaks for easier forms.', 'formidable' ),
147 - 'call' => self::cta_label(),
95 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
148 96 ),
149 97 array(
150 98 'link' => array(
151 99 'content' => 'file-uploads',
@@ -150,10 +98,10 @@
150 98 'link' => array(
151 99 'content' => 'file-uploads',
152 100 'param' => 'wordpress-multi-file-upload-fields',
153 101 ),
154 - 'tip' => __( 'Skip the follow-ups. Let users upload files.', 'formidable' ),
155 - 'call' => self::cta_label(),
102 + 'tip' => __( 'Cut down on back-and-forth with clients.', 'formidable' ),
103 + 'call' => __( 'Allow file uploads in your form.', 'formidable' ),
156 104 ),
157 105 array(
158 106 'link' => array(
159 107 'content' => 'calculations',
@@ -159,9 +107,9 @@
159 107 'content' => 'calculations',
160 108 'param' => 'field-calculations-wordpress-form',
161 109 ),
162 110 'tip' => __( 'Need to calculate a total?', 'formidable' ),
163 - 'call' => self::cta_label(),
111 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
164 112 ),
165 113 array(
166 114 'link' => array(
167 115 'content' => 'prefill-fields',
@@ -166,10 +114,10 @@
166 114 'link' => array(
167 115 'content' => 'prefill-fields',
168 116 'param' => 'auto-fill-forms',
169 117 ),
170 - 'tip' => __( 'Save time with autofill forms.', 'formidable' ),
171 - 'call' => self::cta_label(),
118 + 'tip' => __( 'Save time.', 'formidable' ),
119 + 'call' => __( 'Fill out forms automatically!', 'formidable' ),
172 120 ),
173 121 );
174 122
175 123 return $tips;
@@ -174,11 +122,8 @@
174 122
175 123 return $tips;
176 124 }
177 125
178 - /**
179 - * @return array
180 - */
181 126 public static function get_form_settings_tip() {
182 127 $tips = array(
183 128 array(
184 129 'link' => array(
@@ -184,10 +129,10 @@
184 129 'link' => array(
185 130 'content' => 'front-edit-b',
186 131 'param' => 'wordpress-front-end-editing',
187 132 ),
188 - 'tip' => __( 'Make your site dynamic. Enable front-end editing.', 'formidable' ),
189 - 'call' => self::cta_label(),
133 + 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
134 + 'call' => __( 'Add front-end editing.', 'formidable' ),
190 135 ),
191 136 array(
192 137 'link' => array(
193 138 'content' => 'save-drafts',
@@ -192,10 +137,10 @@
192 137 'link' => array(
193 138 'content' => 'save-drafts',
194 139 'param' => 'save-drafts-wordpress-form',
195 140 ),
196 - 'tip' => __( 'Long form? Let users save and finish later', 'formidable' ),
197 - 'call' => self::cta_label(),
141 + 'tip' => __( 'Have long forms?', 'formidable' ),
142 + 'call' => __( 'Let users save drafts and return later!', 'formidable' ),
198 143 ),
199 144 array(
200 145 'link' => array(
201 146 'content' => 'form-scheduling',
@@ -200,10 +145,10 @@
200 145 'link' => array(
201 146 'content' => 'form-scheduling',
202 147 'param' => 'schedule-forms-wordpress',
203 148 ),
204 - 'tip' => __( 'Limit form access with built-in scheduling.', 'formidable' ),
205 - 'call' => self::cta_label(),
149 + 'tip' => __( 'Want your form open only for a certain time period?', 'formidable' ),
150 + 'call' => __( 'Add form scheduling.', 'formidable' ),
206 151 ),
207 152 );
208 153
209 154 return $tips;
@@ -208,11 +153,8 @@
208 153
209 154 return $tips;
210 155 }
211 156
212 - /**
213 - * @return array
214 - */
215 157 public static function get_form_action_tip() {
216 158 $tips = array(
217 159 array(
218 160 'link' => array(
@@ -218,10 +160,10 @@
218 160 'link' => array(
219 161 'content' => 'email-routing',
220 162 'param' => 'virtually-unlimited-emails',
221 163 ),
222 - 'tip' => __( 'Save time — route emails to the right person automatically.', 'formidable' ),
223 - 'call' => self::cta_label(),
164 + 'tip' => __( 'Save time by sending the email to the right person automatically.', 'formidable' ),
165 + 'call' => __( 'Add email routing.', 'formidable' ),
224 166 ),
225 167 array(
226 168 'link' => array(
227 169 'content' => 'create-posts',
@@ -227,9 +169,9 @@
227 169 'content' => 'create-posts',
228 170 'param' => 'create-posts-pages-wordpress-forms',
229 171 ),
230 172 'tip' => __( 'Create blog posts or pages from the front-end.', 'formidable' ),
231 - 'call' => self::cta_label(),
173 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
232 174 ),
233 175 array(
234 176 'link' => array(
235 177 'content' => 'user-submit',
@@ -235,9 +177,9 @@
235 177 'content' => 'user-submit',
236 178 'param' => 'create-posts-pages-wordpress-forms',
237 179 ),
238 180 'tip' => __( 'Let your users submit posts on the front-end.', 'formidable' ),
239 - 'call' => self::cta_label(),
181 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
240 182 ),
241 183 array(
242 184 'link' => array(
243 185 'content' => 'mailchimp',
@@ -242,10 +184,10 @@
242 184 'link' => array(
243 185 'content' => 'mailchimp',
244 186 'page' => 'mailchimp-tip',
245 187 ),
246 - 'tip' => __( 'Send leads to Mailchimp for instant email follow-up.', 'formidable' ),
247 - 'call' => self::cta_label(),
188 + 'tip' => __( 'Grow your business with automated email follow-up.', 'formidable' ),
189 + 'call' => __( 'Send leads straight to Mailchimp.', 'formidable' ),
248 190 ),
249 191 array(
250 192 'link' => array(
251 193 'content' => 'paypal-revenue',
@@ -250,10 +192,10 @@
250 192 'link' => array(
251 193 'content' => 'paypal-revenue',
252 194 'page' => 'paypal-increase-revenue-tip',
253 195 ),
254 - 'tip' => __( 'Accept PayPal payments and grow your sales.', 'formidable' ),
255 - 'call' => self::cta_label(),
196 + 'tip' => __( 'Increase revenue.', 'formidable' ),
197 + 'call' => __( 'Use PayPal with this form.', 'formidable' ),
256 198 ),
257 199 array(
258 200 'link' => array(
259 201 'content' => 'paypal-fast',
@@ -258,10 +200,10 @@
258 200 'link' => array(
259 201 'content' => 'paypal-fast',
260 202 'page' => 'paypal-save-time-tip',
261 203 ),
262 - 'tip' => __( 'Accept payments now with PayPal integration.', 'formidable' ),
263 - 'call' => self::cta_label(),
204 + 'tip' => __( 'Get paid instantly.', 'formidable' ),
205 + 'call' => __( 'Use Paypal with this form.', 'formidable' ),
264 206 ),
265 207 array(
266 208 'link' => array(
267 209 'content' => 'registration',
@@ -274,10 +216,10 @@
274 216 'link' => array(
275 217 'content' => 'profile',
276 218 'page' => 'registration-profile-editing-tip',
277 219 ),
278 - 'tip' => __( 'Enable front-end profile editing with User Registration.', 'formidable' ),
279 - 'call' => self::cta_label(),
220 + 'tip' => __( 'Need front-end profile editing?', 'formidable' ),
221 + 'call' => __( 'Add user registration.', 'formidable' ),
280 222 ),
281 223 array(
282 224 'link' => array(
283 225 'content' => 'twilio-payment',
@@ -282,10 +224,10 @@
282 224 'link' => array(
283 225 'content' => 'twilio-payment',
284 226 'page' => 'twilio-tip',
285 227 ),
286 - 'tip' => __( 'Get SMS alerts for form submissions and payments—just add Twilio.', 'formidable' ),
287 - 'call' => self::cta_label(),
228 + 'tip' => __( 'Want an SMS notification when a form is submitted or a payment received?', 'formidable' ),
229 + 'call' => __( 'Get the Twilio integration.', 'formidable' ),
288 230 ),
289 231 array(
290 232 'link' => array(
291 233 'content' => 'twilio',
@@ -290,10 +232,10 @@
290 232 'link' => array(
291 233 'content' => 'twilio',
292 234 'page' => 'twilio-send-tip',
293 235 ),
294 - 'tip' => __( 'Use Twilio to send SMS when forms are submitted.', 'formidable' ),
295 - 'call' => self::cta_label(),
236 + 'tip' => __( 'Send an SMS message when a form is submitted.', 'formidable' ),
237 + 'call' => __( 'Get the Twilio integration.', 'formidable' ),
296 238 ),
297 239 array(
298 240 'link' => array(
299 241 'content' => 'acf-tip',
@@ -298,10 +240,10 @@
298 240 'link' => array(
299 241 'content' => 'acf-tip',
300 242 'param' => 'acf-tip',
301 243 ),
302 - 'tip' => __( 'Fill Advanced Custom Fields automatically with form entries.', 'formidable' ),
303 - 'call' => self::cta_label(),
244 + 'tip' => __( 'Fill Advanced Custom Fields from a form.', 'formidable' ),
245 + 'call' => __( 'Add ACF Integration', 'formidable' ),
304 246 ),
305 247 );
306 248
307 249 return $tips;
@@ -316,10 +258,10 @@
316 258 'link' => array(
317 259 'content' => 'style',
318 260 'param' => 'wordpress-visual-form-styler',
319 261 ),
320 - 'tip' => __( 'Make your forms stand out with multiple style templates.', 'formidable' ),
321 - 'call' => self::cta_label(),
262 + 'tip' => __( 'Make your sidebar and footer forms stand out.', 'formidable' ),
263 + 'call' => __( 'Use multiple style templates.', 'formidable' ),
322 264 ),
323 265 array(
324 266 'link' => array(
325 267 'content' => 'style',
@@ -325,9 +267,9 @@
325 267 'content' => 'style',
326 268 'param' => 'bg-image-style-settings',
327 269 ),
328 270 'tip' => __( 'Want to add a background image?', 'formidable' ),
329 - 'call' => self::cta_label(),
271 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
330 272 ),
331 273 array(
332 274 'link' => array(
333 275 'content' => 'style',
@@ -333,9 +275,9 @@
333 275 'content' => 'style',
334 276 'param' => 'duplicate-style',
335 277 ),
336 278 'tip' => __( 'Want to duplicate a style?', 'formidable' ),
337 - 'call' => self::cta_label(),
279 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
338 280 ),
339 281 );
340 282
341 283 return $tips;
@@ -340,11 +282,8 @@
340 282
341 283 return $tips;
342 284 }
343 285
344 - /**
345 - * @return array
346 - */
347 286 public static function get_entries_tip() {
348 287 $tips = array(
349 288 array(
350 289 'link' => array(
@@ -350,10 +289,10 @@
350 289 'link' => array(
351 290 'content' => 'entries',
352 291 'param' => 'form-entry-management-wordpress',
353 292 ),
354 - 'tip' => __( 'Edit form entries anytime with entry management.', 'formidable' ),
355 - 'call' => self::cta_label(),
293 + 'tip' => __( 'Want to edit form submissions?', 'formidable' ),
294 + 'call' => __( 'Add entry management.', 'formidable' ),
356 295 ),
357 296 array(
358 297 'link' => array(
359 298 'content' => 'entries-search',
@@ -359,9 +298,9 @@
359 298 'content' => 'entries-search',
360 299 'param' => 'form-entry-management-wordpress',
361 300 ),
362 301 'tip' => __( 'Want to search submitted entries?', 'formidable' ),
363 - 'call' => self::cta_label(),
302 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
364 303 ),
365 304 array(
366 305 'link' => array(
367 306 'content' => 'views',
@@ -366,10 +305,10 @@
366 305 'link' => array(
367 306 'content' => 'views',
368 307 'param' => 'views-display-form-data',
369 308 ),
370 - 'tip' => __( 'Turn entries into dynamic content — no code needed.', 'formidable' ),
371 - 'call' => self::cta_label(),
309 + 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
310 + 'call' => __( 'Display form data with Views.', 'formidable' ),
372 311 ),
373 312 );
374 313 $tips = array_merge( $tips, self::get_import_tip() );
375 314
@@ -375,11 +314,8 @@
375 314
376 315 return $tips;
377 316 }
378 317
379 - /**
380 - * @return array
381 - */
382 318 public static function get_import_tip() {
383 319 $tips = array(
384 320 array(
385 321 'link' => array(
@@ -386,9 +322,9 @@
386 322 'content' => 'import',
387 323 'param' => 'importing-exporting-wordpress-forms',
388 324 ),
389 325 'tip' => __( 'Want to import entries into your forms?', 'formidable' ),
390 - 'call' => self::cta_label(),
326 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
391 327 ),
392 328 );
393 329
394 330 return $tips;
@@ -393,78 +329,44 @@
393 329
394 330 return $tips;
395 331 }
396 332
397 - /**
398 - * @param array $tips
399 - *
400 - * @return array
401 - */
402 - public static function get_random_tip( $tips ) {
403 - $count = count( $tips );
333 + public static function get_banner_tip() {
334 + $tips = array(
335 + array(
336 + 'link' => array(
337 + 'medium' => 'banner',
338 + 'content' => 'professional-results',
339 + ),
340 + 'tip' => __( 'Looking for more ways to get professional results?', 'formidable' ),
341 + 'call' => __( 'Take your forms to the next level.', 'formidable' ),
342 + ),
343 + array(
344 + 'link' => array(
345 + 'medium' => 'banner',
346 + 'content' => 'increase-conversions',
347 + ),
348 + 'tip' => __( 'Increase conversions in long forms.', 'formidable' ),
349 + 'call' => __( 'Add conditional logic, page breaks, and section headings.', 'formidable' ),
350 + ),
351 + array(
352 + 'link' => array(
353 + 'medium' => 'banner',
354 + 'content' => 'automate',
355 + ),
356 + 'tip' => __( 'Automate your business and increase revenue.', 'formidable' ),
357 + 'call' => __( 'Collect instant payments, and send leads to Mailchimp.', 'formidable' ),
358 + ),
359 + );
360 + $random = rand( 0, count( $tips ) - 1 );
361 + $tip = $tips[ $random ];
362 + $tip['num'] = $random;
404 363
405 - if ( $count === 0 ) {
406 - return array();
407 - }
408 -
409 - $random = random_int( 0, $count - 1 );
410 - return $tips[ $random ];
364 + return $tip;
411 365 }
412 366
413 - /**
414 - * Displays a call-to-action section in the admin area.
415 - *
416 - * @since 6.7
417 - *
418 - * @param array $args {
419 - * An array of arguments to configure the call-to-action section.
420 - *
421 - * @type string $title The title of the section.
422 - * @type string $description The description of the section.
423 - * @type string $link_text The text for the link.
424 - * @type string $link_url The URL for the link.
425 - * @type string $role The required user role to view the section. Default 'administrator'.
426 - * }
427 - *
428 - * @return void
429 - */
430 - public static function show_admin_cta( $args ) {
431 - $role = ! empty( $args['role'] ) ? $args['role'] : 'administrator';
367 + public static function get_random_tip( $tips ) {
368 + $random = rand( 0, count( $tips ) - 1 );
432 369
433 - if ( ! current_user_can( $role ) ) {
434 - // Return early if the user doesn't have the required capability.
435 - return;
436 - }
437 -
438 - $defaults = array(
439 - 'title' => '',
440 - 'description' => '',
441 - 'link_text' => '',
442 - 'link_url' => '#',
443 - 'class' => '',
444 - 'id' => '',
445 - 'target' => '_blank',
446 - );
447 -
448 - $args = wp_parse_args( $args, $defaults );
449 -
450 - $attributes = array(
451 - 'class' => trim( 'frm-cta frm-flex frm-p-sm ' . $args['class'] ),
452 - );
453 -
454 - if ( $args['id'] ) {
455 - $attributes['id'] = $args['id'];
456 - }
457 -
458 - require FrmAppHelper::plugin_path() . '/classes/views/shared/admin-cta.php';
459 - }
460 -
461 - /**
462 - * @deprecated 6.21
463 - *
464 - * @return array
465 - */
466 - public static function get_banner_tip() {
467 - _deprecated_function( __METHOD__, '6.21' );
468 - return array();
370 + return $tips[ $random ];
469 371 }
470 372 }