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 +115 -245 6.295.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,115 +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 );
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_star_full_icon', array( 'aria-hidden' => 'true' ) ); ?>
31 + <span class="pro-tip">
32 + <?php esc_html_e( 'Pro Tip:', 'formidable' ); ?>
33 + </span>
64 34
65 35 <?php if ( isset( $tip['call'] ) ) { ?>
66 - <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">
67 42 <?php echo esc_html( $tip['tip'] ); ?>
68 43 </span>
69 44 <?php } ?>
70 - <span class="frm-tip-cta">
71 - <?php echo esc_html( $tip['call'] ? $tip['call'] : $tip['tip'] ); ?>
72 - </span>
73 45 </a>
74 46 <?php
75 - // phpcs:enable Generic.WhiteSpace.ScopeIndent
76 -
77 47 if ( 'p' === $html ) {
78 48 echo '</p>';
79 49 }
80 50 }
81 51
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 52 public static function get_builder_tip() {
128 - return array(
53 + $tips = array(
129 54 array(
130 55 'link' => array(
131 56 'content' => 'conditional-logic',
132 57 'param' => 'conditional-logic-wordpress-forms',
@@ -131,9 +56,9 @@
131 56 'content' => 'conditional-logic',
132 57 'param' => 'conditional-logic-wordpress-forms',
133 58 ),
134 59 'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ),
135 - 'call' => self::cta_label(),
60 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
136 61 ),
137 62 array(
138 63 'link' => array(
139 64 'content' => 'confirmation-fields',
@@ -138,10 +63,10 @@
138 63 'link' => array(
139 64 'content' => 'confirmation-fields',
140 65 'param' => 'confirmation-fields-wordpress-forms',
141 66 ),
142 - 'tip' => __( 'Eliminate input errors with email confirmation fields.', 'formidable' ),
143 - 'call' => self::cta_label(),
67 + 'tip' => __( 'Want to stop losing leads from email typos?', 'formidable' ),
68 + 'call' => __( 'Add email confirmation fields.', 'formidable' ),
144 69 ),
145 70 array(
146 71 'link' => array(
147 72 'content' => 'page-breaks',
@@ -147,9 +72,9 @@
147 72 'content' => 'page-breaks',
148 73 'param' => 'wordpress-multi-page-forms',
149 74 ),
150 75 'tip' => __( 'Use page breaks for easier forms.', 'formidable' ),
151 - 'call' => self::cta_label(),
76 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
152 77 ),
153 78 array(
154 79 'link' => array(
155 80 'content' => 'file-uploads',
@@ -154,10 +79,10 @@
154 79 'link' => array(
155 80 'content' => 'file-uploads',
156 81 'param' => 'wordpress-multi-file-upload-fields',
157 82 ),
158 - 'tip' => __( 'Skip the follow-ups. Let users upload files.', 'formidable' ),
159 - 'call' => self::cta_label(),
83 + 'tip' => __( 'Cut down on back-and-forth with clients.', 'formidable' ),
84 + 'call' => __( 'Allow file uploads in your form.', 'formidable' ),
160 85 ),
161 86 array(
162 87 'link' => array(
163 88 'content' => 'calculations',
@@ -163,9 +88,9 @@
163 88 'content' => 'calculations',
164 89 'param' => 'field-calculations-wordpress-form',
165 90 ),
166 91 'tip' => __( 'Need to calculate a total?', 'formidable' ),
167 - 'call' => self::cta_label(),
92 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
168 93 ),
169 94 array(
170 95 'link' => array(
171 96 'content' => 'prefill-fields',
@@ -170,26 +95,25 @@
170 95 'link' => array(
171 96 'content' => 'prefill-fields',
172 97 'param' => 'auto-fill-forms',
173 98 ),
174 - 'tip' => __( 'Save time with autofill forms.', 'formidable' ),
175 - 'call' => self::cta_label(),
99 + 'tip' => __( 'Save time.', 'formidable' ),
100 + 'call' => __( 'Fill out forms automatically!', 'formidable' ),
176 101 ),
177 102 );
103 +
104 + return $tips;
178 105 }
179 106
180 - /**
181 - * @return array
182 - */
183 107 public static function get_form_settings_tip() {
184 - return array(
108 + $tips = array(
185 109 array(
186 110 'link' => array(
187 111 'content' => 'front-edit-b',
188 112 'param' => 'wordpress-front-end-editing',
189 113 ),
190 - 'tip' => __( 'Make your site dynamic. Enable front-end editing.', 'formidable' ),
191 - 'call' => self::cta_label(),
114 + 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
115 + 'call' => __( 'Add front-end editing.', 'formidable' ),
192 116 ),
193 117 array(
194 118 'link' => array(
195 119 'content' => 'save-drafts',
@@ -194,34 +118,40 @@
194 118 'link' => array(
195 119 'content' => 'save-drafts',
196 120 'param' => 'save-drafts-wordpress-form',
197 121 ),
198 - 'tip' => __( 'Long form? Let users save and finish later', 'formidable' ),
199 - 'call' => self::cta_label(),
122 + 'tip' => __( 'Have long forms?', 'formidable' ),
123 + 'call' => __( 'Let users save drafts and return later!', 'formidable' ),
200 124 ),
201 125 array(
202 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(
203 134 'content' => 'form-scheduling',
204 135 'param' => 'schedule-forms-wordpress',
205 136 ),
206 - 'tip' => __( 'Limit form access with built-in scheduling.', 'formidable' ),
207 - 'call' => self::cta_label(),
137 + 'tip' => __( 'Want your form open only for a certain time period?', 'formidable' ),
138 + 'call' => __( 'Add form scheduling.', 'formidable' ),
208 139 ),
209 140 );
141 +
142 + return $tips;
210 143 }
211 144
212 - /**
213 - * @return array
214 - */
215 145 public static function get_form_action_tip() {
216 - return array(
146 + $tips = array(
217 147 array(
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,57 +220,31 @@
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 );
228 +
229 + return $tips;
306 230 }
307 231
308 - /**
309 - * @return array
310 - */
311 232 public static function get_styling_tip() {
312 - return array(
233 + $tips = array(
313 234 array(
314 235 'link' => array(
315 236 'content' => 'style',
316 237 'param' => 'wordpress-visual-form-styler',
317 238 ),
318 - 'tip' => __( 'Make your forms stand out with multiple style templates.', 'formidable' ),
319 - 'call' => self::cta_label(),
239 + 'tip' => __( 'Make your sidebar and footer forms stand out.', 'formidable' ),
240 + 'call' => __( 'Use multiple style templates.', 'formidable' ),
320 241 ),
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 242 );
243 +
244 + return $tips;
338 245 }
339 246
340 - /**
341 - * @return array
342 - */
343 247 public static function get_entries_tip() {
344 248 $tips = array(
345 249 array(
346 250 'link' => array(
@@ -346,10 +250,10 @@
346 250 'link' => array(
347 251 'content' => 'entries',
348 252 'param' => 'form-entry-management-wordpress',
349 253 ),
350 - 'tip' => __( 'Edit form entries anytime with entry management.', 'formidable' ),
351 - 'call' => self::cta_label(),
254 + 'tip' => __( 'Want to edit form submissions?', 'formidable' ),
255 + 'call' => __( 'Add entry management.', 'formidable' ),
352 256 ),
353 257 array(
354 258 'link' => array(
355 259 'content' => 'entries-search',
@@ -355,9 +259,9 @@
355 259 'content' => 'entries-search',
356 260 'param' => 'form-entry-management-wordpress',
357 261 ),
358 262 'tip' => __( 'Want to search submitted entries?', 'formidable' ),
359 - 'call' => self::cta_label(),
263 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
360 264 ),
361 265 array(
362 266 'link' => array(
363 267 'content' => 'views',
@@ -362,21 +266,19 @@
362 266 'link' => array(
363 267 'content' => 'views',
364 268 'param' => 'views-display-form-data',
365 269 ),
366 - 'tip' => __( 'Turn entries into dynamic content — no code needed.', 'formidable' ),
367 - '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' ),
368 272 ),
369 273 );
274 + $tips = array_merge( $tips, self::get_import_tip() );
370 275
371 - return array_merge( $tips, self::get_import_tip() );
276 + return $tips;
372 277 }
373 278
374 - /**
375 - * @return array
376 - */
377 279 public static function get_import_tip() {
378 - return array(
280 + $tips = array(
379 281 array(
380 282 'link' => array(
381 283 'content' => 'import',
382 284 'param' => 'importing-exporting-wordpress-forms',
@@ -381,83 +283,51 @@
381 283 'content' => 'import',
382 284 'param' => 'importing-exporting-wordpress-forms',
383 285 ),
384 286 'tip' => __( 'Want to import entries into your forms?', 'formidable' ),
385 - 'call' => self::cta_label(),
287 + 'call' => __( 'Upgrade to Pro.', 'formidable' ),
386 288 ),
387 289 );
388 - }
389 290
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 ];
291 + return $tips;
404 292 }
405 293
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',
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 + ),
439 320 );
321 + $random = rand( 0, count( $tips ) - 1 );
322 + $tip = $tips[ $random ];
323 + $tip['num'] = $random;
440 324
441 - $args = wp_parse_args( $args, $defaults );
325 + return $tip;
326 + }
442 327
443 - $attributes = array(
444 - 'class' => trim( 'frm-cta frm-flex frm-p-sm ' . $args['class'] ),
445 - );
328 + public static function get_random_tip( $tips ) {
329 + $random = rand( 0, count( $tips ) - 1 );
446 330
447 - if ( $args['id'] ) {
448 - $attributes['id'] = $args['id'];
449 - }
450 -
451 - require FrmAppHelper::plugin_path() . '/classes/views/shared/admin-cta.php';
452 - }
453 -
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();
331 + return $tips[ $random ];
462 332 }
463 333 }