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