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