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