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