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 -203 6.296.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,45 +29,40 @@
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 );
60 - // phpcs:disable Generic.WhiteSpace.ScopeIndent
46 + $link = empty( $tip['link'] ) ? $tip['page'] : FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] );
61 47 ?>
62 - <a href="<?php echo esc_url( $link ); ?>" <?php echo ! empty( $tip['link'] ) ? 'target="_blank"' : ''; ?> class="frm_pro_tip frm-gradient">
63 - <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' ) ); ?>
64 50
65 51 <?php if ( isset( $tip['call'] ) ) { ?>
66 52 <span class="frm-tip-info">
67 53 <?php echo esc_html( $tip['tip'] ); ?>
68 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>
69 62 <?php } ?>
70 - <span class="frm-tip-cta">
71 - <?php echo esc_html( $tip['call'] ? $tip['call'] : $tip['tip'] ); ?>
72 - </span>
73 63 </a>
74 64 <?php
75 - // phpcs:enable Generic.WhiteSpace.ScopeIndent
76 65
77 66 if ( 'p' === $html ) {
78 67 echo '</p>';
79 68 }
@@ -78,55 +67,10 @@
78 67 echo '</p>';
79 68 }
80 69 }
81 70
82 - /**
83 - * @since 6.21
84 - *
85 - * @param array $tip
86 - *
87 - * @return string
88 - */
89 - private static function get_tip_link( $tip ) {
90 - if ( empty( $tip['tip'] ) ) {
91 - return $tip['page'];
92 - }
93 -
94 - $cta_link = FrmSalesApi::get_best_sale_value( 'pro_tip_cta_link' );
95 -
96 - if ( $cta_link ) {
97 - if ( is_array( $tip['link'] ) ) {
98 - return FrmAppHelper::maybe_add_missing_utm( $cta_link, $tip['link'] );
99 - }
100 -
101 - return $cta_link;
102 - }
103 -
104 - return FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] );
105 - }
106 -
107 - /**
108 - * Use the correct label for the license.
109 - *
110 - * @since 6.5.1
111 - *
112 - * @return string
113 - */
114 - private static function cta_label() {
115 - $cta_text = FrmSalesApi::get_best_sale_value( 'pro_tip_cta_text' );
116 -
117 - if ( $cta_text ) {
118 - return $cta_text;
119 - }
120 -
121 - return FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro.', 'formidable' );
122 - }
123 -
124 - /**
125 - * @return array
126 - */
127 71 public static function get_builder_tip() {
128 - return array(
72 + $tips = array(
129 73 array(
130 74 'link' => array(
131 75 'content' => 'conditional-logic',
132 76 'param' => 'conditional-logic-wordpress-forms',
@@ -131,9 +75,9 @@
131 75 'content' => 'conditional-logic',
132 76 'param' => 'conditional-logic-wordpress-forms',
133 77 ),
134 78 'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ),
135 - 'call' => self::cta_label(),
79 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
136 80 ),
137 81 array(
138 82 'link' => array(
139 83 'content' => 'confirmation-fields',
@@ -138,10 +82,10 @@
138 82 'link' => array(
139 83 'content' => 'confirmation-fields',
140 84 'param' => 'confirmation-fields-wordpress-forms',
141 85 ),
142 - 'tip' => __( 'Eliminate input errors with email confirmation fields.', 'formidable' ),
143 - 'call' => self::cta_label(),
86 + 'tip' => __( 'Want to stop losing leads from email typos?', 'formidable' ),
87 + 'call' => __( 'Add email confirmation fields.', 'formidable' ),
144 88 ),
145 89 array(
146 90 'link' => array(
147 91 'content' => 'page-breaks',
@@ -147,9 +91,9 @@
147 91 'content' => 'page-breaks',
148 92 'param' => 'wordpress-multi-page-forms',
149 93 ),
150 94 'tip' => __( 'Use page breaks for easier forms.', 'formidable' ),
151 - 'call' => self::cta_label(),
95 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
152 96 ),
153 97 array(
154 98 'link' => array(
155 99 'content' => 'file-uploads',
@@ -154,10 +98,10 @@
154 98 'link' => array(
155 99 'content' => 'file-uploads',
156 100 'param' => 'wordpress-multi-file-upload-fields',
157 101 ),
158 - 'tip' => __( 'Skip the follow-ups. Let users upload files.', 'formidable' ),
159 - 'call' => self::cta_label(),
102 + 'tip' => __( 'Cut down on back-and-forth with clients.', 'formidable' ),
103 + 'call' => __( 'Allow file uploads in your form.', 'formidable' ),
160 104 ),
161 105 array(
162 106 'link' => array(
163 107 'content' => 'calculations',
@@ -163,9 +107,9 @@
163 107 'content' => 'calculations',
164 108 'param' => 'field-calculations-wordpress-form',
165 109 ),
166 110 'tip' => __( 'Need to calculate a total?', 'formidable' ),
167 - 'call' => self::cta_label(),
111 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
168 112 ),
169 113 array(
170 114 'link' => array(
171 115 'content' => 'prefill-fields',
@@ -170,26 +114,25 @@
170 114 'link' => array(
171 115 'content' => 'prefill-fields',
172 116 'param' => 'auto-fill-forms',
173 117 ),
174 - 'tip' => __( 'Save time with autofill forms.', 'formidable' ),
175 - 'call' => self::cta_label(),
118 + 'tip' => __( 'Save time.', 'formidable' ),
119 + 'call' => __( 'Fill out forms automatically!', 'formidable' ),
176 120 ),
177 121 );
122 +
123 + return $tips;
178 124 }
179 125
180 - /**
181 - * @return array
182 - */
183 126 public static function get_form_settings_tip() {
184 - return array(
127 + $tips = array(
185 128 array(
186 129 'link' => array(
187 130 'content' => 'front-edit-b',
188 131 'param' => 'wordpress-front-end-editing',
189 132 ),
190 - 'tip' => __( 'Make your site dynamic. Enable front-end editing.', 'formidable' ),
191 - 'call' => self::cta_label(),
133 + 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
134 + 'call' => __( 'Add front-end editing.', 'formidable' ),
192 135 ),
193 136 array(
194 137 'link' => array(
195 138 'content' => 'save-drafts',
@@ -194,10 +137,10 @@
194 137 'link' => array(
195 138 'content' => 'save-drafts',
196 139 'param' => 'save-drafts-wordpress-form',
197 140 ),
198 - 'tip' => __( 'Long form? Let users save and finish later', 'formidable' ),
199 - 'call' => self::cta_label(),
141 + 'tip' => __( 'Have long forms?', 'formidable' ),
142 + 'call' => __( 'Let users save drafts and return later!', 'formidable' ),
200 143 ),
201 144 array(
202 145 'link' => array(
203 146 'content' => 'form-scheduling',
@@ -202,26 +145,25 @@
202 145 'link' => array(
203 146 'content' => 'form-scheduling',
204 147 'param' => 'schedule-forms-wordpress',
205 148 ),
206 - 'tip' => __( 'Limit form access with built-in scheduling.', 'formidable' ),
207 - 'call' => self::cta_label(),
149 + 'tip' => __( 'Want your form open only for a certain time period?', 'formidable' ),
150 + 'call' => __( 'Add form scheduling.', 'formidable' ),
208 151 ),
209 152 );
153 +
154 + return $tips;
210 155 }
211 156
212 - /**
213 - * @return array
214 - */
215 157 public static function get_form_action_tip() {
216 - return array(
158 + $tips = array(
217 159 array(
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,12 +240,14 @@
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 );
248 +
249 + return $tips;
306 250 }
307 251
308 252 /**
309 253 * @return array
@@ -308,16 +252,16 @@
308 252 /**
309 253 * @return array
310 254 */
311 255 public static function get_styling_tip() {
312 - return array(
256 + $tips = array(
313 257 array(
314 258 'link' => array(
315 259 'content' => 'style',
316 260 'param' => 'wordpress-visual-form-styler',
317 261 ),
318 - 'tip' => __( 'Make your forms stand out with multiple style templates.', 'formidable' ),
319 - 'call' => self::cta_label(),
262 + 'tip' => __( 'Make your sidebar and footer forms stand out.', 'formidable' ),
263 + 'call' => __( 'Use multiple style templates.', 'formidable' ),
320 264 ),
321 265 array(
322 266 'link' => array(
323 267 'content' => 'style',
@@ -323,9 +267,9 @@
323 267 'content' => 'style',
324 268 'param' => 'bg-image-style-settings',
325 269 ),
326 270 'tip' => __( 'Want to add a background image?', 'formidable' ),
327 - 'call' => self::cta_label(),
271 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
328 272 ),
329 273 array(
330 274 'link' => array(
331 275 'content' => 'style',
@@ -331,16 +275,15 @@
331 275 'content' => 'style',
332 276 'param' => 'duplicate-style',
333 277 ),
334 278 'tip' => __( 'Want to duplicate a style?', 'formidable' ),
335 - 'call' => self::cta_label(),
279 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
336 280 ),
337 281 );
282 +
283 + return $tips;
338 284 }
339 285
340 - /**
341 - * @return array
342 - */
343 286 public static function get_entries_tip() {
344 287 $tips = array(
345 288 array(
346 289 'link' => array(
@@ -346,10 +289,10 @@
346 289 'link' => array(
347 290 'content' => 'entries',
348 291 'param' => 'form-entry-management-wordpress',
349 292 ),
350 - 'tip' => __( 'Edit form entries anytime with entry management.', 'formidable' ),
351 - 'call' => self::cta_label(),
293 + 'tip' => __( 'Want to edit form submissions?', 'formidable' ),
294 + 'call' => __( 'Add entry management.', 'formidable' ),
352 295 ),
353 296 array(
354 297 'link' => array(
355 298 'content' => 'entries-search',
@@ -355,9 +298,9 @@
355 298 'content' => 'entries-search',
356 299 'param' => 'form-entry-management-wordpress',
357 300 ),
358 301 'tip' => __( 'Want to search submitted entries?', 'formidable' ),
359 - 'call' => self::cta_label(),
302 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
360 303 ),
361 304 array(
362 305 'link' => array(
363 306 'content' => 'views',
@@ -362,21 +305,19 @@
362 305 'link' => array(
363 306 'content' => 'views',
364 307 'param' => 'views-display-form-data',
365 308 ),
366 - 'tip' => __( 'Turn entries into dynamic content — no code needed.', 'formidable' ),
367 - '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' ),
368 311 ),
369 312 );
313 + $tips = array_merge( $tips, self::get_import_tip() );
370 314
371 - return array_merge( $tips, self::get_import_tip() );
315 + return $tips;
372 316 }
373 317
374 - /**
375 - * @return array
376 - */
377 318 public static function get_import_tip() {
378 - return array(
319 + $tips = array(
379 320 array(
380 321 'link' => array(
381 322 'content' => 'import',
382 323 'param' => 'importing-exporting-wordpress-forms',
@@ -381,83 +322,51 @@
381 322 'content' => 'import',
382 323 'param' => 'importing-exporting-wordpress-forms',
383 324 ),
384 325 'tip' => __( 'Want to import entries into your forms?', 'formidable' ),
385 - 'call' => self::cta_label(),
326 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
386 327 ),
387 328 );
388 - }
389 329
390 - /**
391 - * @param array $tips
392 - *
393 - * @return array
394 - */
395 - public static function get_random_tip( $tips ) {
396 - $count = count( $tips );
397 -
398 - if ( $count === 0 ) {
399 - return array();
400 - }
401 -
402 - $random = random_int( 0, $count - 1 );
403 - return $tips[ $random ];
330 + return $tips;
404 331 }
405 332
406 - /**
407 - * Displays a call-to-action section in the admin area.
408 - *
409 - * @since 6.7
410 - *
411 - * @param array $args {
412 - * An array of arguments to configure the call-to-action section.
413 - *
414 - * @type string $title The title of the section.
415 - * @type string $description The description of the section.
416 - * @type string $link_text The text for the link.
417 - * @type string $link_url The URL for the link.
418 - * @type string $role The required user role to view the section. Default 'administrator'.
419 - * }
420 - *
421 - * @return void
422 - */
423 - public static function show_admin_cta( $args ) {
424 - $role = ! empty( $args['role'] ) ? $args['role'] : 'administrator';
425 -
426 - if ( ! current_user_can( $role ) ) {
427 - // Return early if the user doesn't have the required capability.
428 - return;
429 - }
430 -
431 - $defaults = array(
432 - 'title' => '',
433 - 'description' => '',
434 - 'link_text' => '',
435 - 'link_url' => '#',
436 - 'class' => '',
437 - 'id' => '',
438 - '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 + ),
439 359 );
360 + $random = rand( 0, count( $tips ) - 1 );
361 + $tip = $tips[ $random ];
362 + $tip['num'] = $random;
440 363
441 - $args = wp_parse_args( $args, $defaults );
364 + return $tip;
365 + }
442 366
443 - $attributes = array(
444 - 'class' => trim( 'frm-cta frm-flex frm-p-sm ' . $args['class'] ),
445 - );
367 + public static function get_random_tip( $tips ) {
368 + $random = rand( 0, count( $tips ) - 1 );
446 369
447 - if ( $args['id'] ) {
448 - $attributes['id'] = $args['id'];
449 - }
450 -
451 - require FrmAppHelper::plugin_path() . '/classes/views/shared/admin-cta.php';
452 - }
453 -
454 - /**
455 - * @deprecated 6.21
456 - *
457 - * @return array
458 - */
459 - public static function get_banner_tip() {
460 - _deprecated_function( __METHOD__, '6.21' );
461 - return array();
370 + return $tips[ $random ];
462 371 }
463 372 }