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