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 +136 -276 6.293.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,228 +7,154 @@
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'] ) && ! isset( $tip['link']['campaign'] ) ) {
52 - $tip['link']['campaign'] = 'tip';
17 + if ( ! isset( $tip['page'] ) ) {
18 + $tip['page'] = '';
53 19 }
54 -
55 - if ( 'p' === $html ) {
56 - echo '<p class="frmcenter ' . esc_attr( $tip['class'] ) . '">';
20 + if ( ! isset( $tip['link']['medium'] ) ) {
21 + $tip['link']['medium'] = 'tip';
57 22 }
58 23
59 - $link = self::get_tip_link( $tip );
60 - // phpcs:disable Generic.WhiteSpace.ScopeIndent
24 + $link = FrmAppHelper::make_affiliate_url( FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] ) );
61 25 ?>
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>
64 -
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'] ) ?>
65 31 <?php if ( isset( $tip['call'] ) ) { ?>
66 - <span class="frm-tip-info">
67 - <?php echo esc_html( $tip['tip'] ); ?>
68 - </span>
32 + <span><?php echo esc_html( $tip['call'] ) ?></span>
69 33 <?php } ?>
70 - <span class="frm-tip-cta">
71 - <?php echo esc_html( $tip['call'] ? $tip['call'] : $tip['tip'] ); ?>
72 - </span>
73 34 </a>
74 35 <?php
75 - // phpcs:enable Generic.WhiteSpace.ScopeIndent
76 -
77 36 if ( 'p' === $html ) {
78 37 echo '</p>';
79 38 }
80 39 }
81 40
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 41 public static function get_builder_tip() {
128 - return array(
42 + $tips = array(
129 43 array(
130 44 'link' => array(
131 45 'content' => 'conditional-logic',
132 - 'param' => 'conditional-logic-wordpress-forms',
46 + 'anchor' => 'feature-conditional-logic-wordpress-forms',
133 47 ),
134 48 'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ),
135 - 'call' => self::cta_label(),
49 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
136 50 ),
137 51 array(
138 52 'link' => array(
139 53 'content' => 'confirmation-fields',
140 - 'param' => 'confirmation-fields-wordpress-forms',
54 + 'anchor' => 'feature-confirm-email-address-password-wordpress-form',
141 55 ),
142 - 'tip' => __( 'Eliminate input errors with email confirmation fields.', 'formidable' ),
143 - 'call' => self::cta_label(),
56 + 'tip' => __( 'Want to stop losing leads from email typos?', 'formidable' ),
57 + 'call' => __( 'Add email confirmation fields.', 'formidable' ),
144 58 ),
145 59 array(
146 60 'link' => array(
147 61 'content' => 'page-breaks',
148 - 'param' => 'wordpress-multi-page-forms',
62 + 'anchor' => 'feature-wordpress-multi-step-form',
149 63 ),
150 - 'tip' => __( 'Use page breaks for easier forms.', 'formidable' ),
151 - 'call' => self::cta_label(),
64 + 'tip' => __( 'Stop intimidating users with long forms.', 'formidable' ),
65 + 'call' => __( 'Use page breaks.', 'formidable' ),
152 66 ),
153 67 array(
154 68 'link' => array(
155 69 'content' => 'file-uploads',
156 - 'param' => 'wordpress-multi-file-upload-fields',
70 + 'anchor' => 'feature-wordpress-multiple-file-upload-form',
157 71 ),
158 - 'tip' => __( 'Skip the follow-ups. Let users upload files.', 'formidable' ),
159 - 'call' => self::cta_label(),
72 + 'tip' => __( 'Cut down on back-and-forth with clients.', 'formidable' ),
73 + 'call' => __( 'Allow file uploads in your form.', 'formidable' ),
160 74 ),
161 75 array(
162 76 'link' => array(
163 77 'content' => 'calculations',
164 - 'param' => 'field-calculations-wordpress-form',
78 + 'anchor' => 'feature-wordpress-calculated-fields-form',
165 79 ),
166 80 'tip' => __( 'Need to calculate a total?', 'formidable' ),
167 - 'call' => self::cta_label(),
81 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
168 82 ),
169 83 array(
170 84 'link' => array(
171 85 'content' => 'prefill-fields',
172 - 'param' => 'auto-fill-forms',
86 + 'anchor' => 'feature-fill-out-forms-automatically',
173 87 ),
174 - 'tip' => __( 'Save time with autofill forms.', 'formidable' ),
175 - 'call' => self::cta_label(),
88 + 'tip' => __( 'Save time.', 'formidable' ),
89 + 'call' => __( 'Prefill fields with user info.', 'formidable' ),
176 90 ),
177 91 );
92 +
93 + return $tips;
178 94 }
179 95
180 - /**
181 - * @return array
182 - */
183 96 public static function get_form_settings_tip() {
184 - return array(
97 + $tips = array(
185 98 array(
186 99 'link' => array(
187 100 'content' => 'front-edit-b',
188 - 'param' => 'wordpress-front-end-editing',
101 + 'anchor' => 'feature-user-submitted-posts-wordpress-forms',
189 102 ),
190 - 'tip' => __( 'Make your site dynamic. Enable front-end editing.', 'formidable' ),
191 - 'call' => self::cta_label(),
103 + 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
104 + 'call' => __( 'Add front-end editing.', 'formidable' ),
192 105 ),
193 106 array(
194 107 'link' => array(
195 108 'content' => 'save-drafts',
196 - 'param' => 'save-drafts-wordpress-form',
109 + 'anchor' => 'feature-user-submitted-posts-wordpress-forms',
197 110 ),
198 - 'tip' => __( 'Long form? Let users save and finish later', 'formidable' ),
199 - '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' ),
200 113 ),
201 114 array(
202 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(
203 123 'content' => 'form-scheduling',
204 - 'param' => 'schedule-forms-wordpress',
205 124 ),
206 - 'tip' => __( 'Limit form access with built-in scheduling.', 'formidable' ),
207 - 'call' => self::cta_label(),
125 + 'tip' => __( 'Need to open and close your form on specific days?', 'formidable' ),
126 + 'call' => __( 'Add form scheduling.', 'formidable' ),
208 127 ),
209 128 );
129 + return $tips;
210 130 }
211 131
212 - /**
213 - * @return array
214 - */
215 132 public static function get_form_action_tip() {
216 - return array(
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,174 +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 );
223 +
224 + return $tips;
306 225 }
307 226
308 - /**
309 - * @return array
310 - */
311 227 public static function get_styling_tip() {
312 - return array(
228 + $tips = array(
313 229 array(
314 230 'link' => array(
315 231 'content' => 'style',
316 - 'param' => 'wordpress-visual-form-styler',
232 + 'anchor' => 'feature-wordpress-visual-form-styler',
317 233 ),
318 - 'tip' => __( 'Make your forms stand out with multiple style templates.', 'formidable' ),
319 - 'call' => self::cta_label(),
234 + 'tip' => __( 'Make your sidebar or footer form stand out.', 'formidable' ),
235 + 'call' => __( 'Use multiple style templates.', 'formidable' ),
320 236 ),
321 - array(
322 - 'link' => array(
323 - 'content' => 'style',
324 - 'param' => 'bg-image-style-settings',
325 - ),
326 - 'tip' => __( 'Want to add a background image?', 'formidable' ),
327 - 'call' => self::cta_label(),
328 - ),
329 - array(
330 - 'link' => array(
331 - 'content' => 'style',
332 - 'param' => 'duplicate-style',
333 - ),
334 - 'tip' => __( 'Want to duplicate a style?', 'formidable' ),
335 - 'call' => self::cta_label(),
336 - ),
337 237 );
238 + return $tips;
338 239 }
339 240
340 - /**
341 - * @return array
342 - */
343 241 public static function get_entries_tip() {
344 242 $tips = array(
345 243 array(
346 244 'link' => array(
347 245 'content' => 'entries',
348 - 'param' => 'form-entry-management-wordpress',
246 + 'anchor' => 'feature-form-entry-management-wordpress',
349 247 ),
350 - 'tip' => __( 'Edit form entries anytime with entry management.', 'formidable' ),
351 - 'call' => self::cta_label(),
248 + 'tip' => __( 'Want to edit form submissions?', 'formidable' ),
249 + 'call' => __( 'Add entry management.', 'formidable' ),
352 250 ),
353 251 array(
354 252 'link' => array(
355 253 'content' => 'entries-search',
356 - 'param' => 'form-entry-management-wordpress',
254 + 'anchor' => 'feature-form-entry-management-wordpress',
357 255 ),
358 256 'tip' => __( 'Want to search submitted entries?', 'formidable' ),
359 - 'call' => self::cta_label(),
257 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
360 258 ),
361 259 array(
362 260 'link' => array(
363 261 'content' => 'views',
364 - 'param' => 'views-display-form-data',
262 + 'anchor' => 'feature-display-form-data-views',
365 263 ),
366 - 'tip' => __( 'Turn entries into dynamic content — no code needed.', 'formidable' ),
367 - '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' ),
368 266 ),
369 267 );
370 -
371 - return array_merge( $tips, self::get_import_tip() );
268 + $tips = array_merge( $tips, self::get_import_tip() );
269 + return $tips;
372 270 }
373 271
374 - /**
375 - * @return array
376 - */
377 272 public static function get_import_tip() {
378 - return array(
273 + $tips = array(
379 274 array(
380 275 'link' => array(
381 276 'content' => 'import',
382 - 'param' => 'importing-exporting-wordpress-forms',
277 + 'anchor' => 'feature-importing-exporting-wordpress-forms',
383 278 ),
384 279 'tip' => __( 'Want to import entries into your forms?', 'formidable' ),
385 - 'call' => self::cta_label(),
280 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
386 281 ),
387 282 );
283 + return $tips;
388 284 }
389 285
390 - /**
391 - * @param array $tips
392 - *
393 - * @return array
394 - */
395 - public static function get_random_tip( $tips ) {
396 - $count = count( $tips );
397 -
398 - if ( $count === 0 ) {
399 - return array();
400 - }
401 -
402 - $random = random_int( 0, $count - 1 );
403 - return $tips[ $random ];
404 - }
405 -
406 - /**
407 - * Displays a call-to-action section in the admin area.
408 - *
409 - * @since 6.7
410 - *
411 - * @param array $args {
412 - * An array of arguments to configure the call-to-action section.
413 - *
414 - * @type string $title The title of the section.
415 - * @type string $description The description of the section.
416 - * @type string $link_text The text for the link.
417 - * @type string $link_url The URL for the link.
418 - * @type string $role The required user role to view the section. Default 'administrator'.
419 - * }
420 - *
421 - * @return void
422 - */
423 - public static function show_admin_cta( $args ) {
424 - $role = ! empty( $args['role'] ) ? $args['role'] : 'administrator';
425 -
426 - if ( ! current_user_can( $role ) ) {
427 - // Return early if the user doesn't have the required capability.
428 - return;
429 - }
430 -
431 - $defaults = array(
432 - 'title' => '',
433 - 'description' => '',
434 - 'link_text' => '',
435 - 'link_url' => '#',
436 - 'class' => '',
437 - 'id' => '',
438 - '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 + ),
439 312 );
440 -
441 - $args = wp_parse_args( $args, $defaults );
442 -
443 - $attributes = array(
444 - 'class' => trim( 'frm-cta frm-flex frm-p-sm ' . $args['class'] ),
445 - );
446 -
447 - if ( $args['id'] ) {
448 - $attributes['id'] = $args['id'];
449 - }
450 -
451 - 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;
452 317 }
453 318
454 - /**
455 - * @deprecated 6.21
456 - *
457 - * @return array
458 - */
459 - public static function get_banner_tip() {
460 - _deprecated_function( __METHOD__, '6.21' );
461 - return array();
319 + public static function get_random_tip( $tips ) {
320 + $random = rand( 0, count( $tips ) - 1 );
321 + return $tips[ $random ];
462 322 }
463 323 }