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