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