PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.32
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.32
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 +172 -132 6.36.32 View file →
@@ -18,9 +18,9 @@
18 18
19 19 $tips = self::$callback();
20 20 $tip = self::get_random_tip( $tips );
21 21
22 - self::show_tip( $tip );
22 + self::show_tip( $tip, $html );
23 23 }
24 24
25 25 /**
26 26 * Shows tip.
@@ -26,10 +26,10 @@
26 26 * Shows tip.
27 27 *
28 28 * @since 6.0
29 29 *
30 - * @param array $tip {
31 - * Tip args
30 + * @param array $tip {
31 + * Tip args.
32 32 *
33 33 * @type array $link Tip link data. See the first parameter of {@see FrmAppHelper::admin_upgrade_link()} for more details.
34 34 * @type string $page The based link of the tip. If this is empty, `https://formidableforms.com/lite-upgrade/` will
35 35 * be used. Otherwise, `https://formidableforms.com/{$page}` will be used.
@@ -35,43 +35,45 @@
35 35 * be used. Otherwise, `https://formidableforms.com/{$page}` will be used.
36 36 * @type string $tip Tip text.
37 37 * @type string $call Call to action text.
38 38 * }
39 + *
39 40 * @param string $html
40 41 *
41 42 * @return void
42 43 */
43 44 public static function show_tip( $tip, $html = '' ) {
44 - if ( ! isset( $tip['page'] ) ) {
45 - $tip['page'] = '';
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';
46 53 }
47 - if ( isset( $tip['link'] ) && ! isset( $tip['link']['medium'] ) ) {
48 - $tip['link']['medium'] = 'tip';
49 - }
50 54
51 55 if ( 'p' === $html ) {
52 - echo '<p class="frmcenter frm-mt-0">';
56 + echo '<p class="frmcenter ' . esc_attr( $tip['class'] ) . '">';
53 57 }
54 58
55 - $link = empty( $tip['link'] ) ? $tip['page'] : FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] );
59 + $link = self::get_tip_link( $tip );
60 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
56 61 ?>
57 - <a href="<?php echo esc_url( $link ); ?>" <?php echo empty( $tip['link'] ) ? '' : 'target="_blank"'; ?> class="frm_pro_tip">
58 - <?php FrmAppHelper::icon_by_class( 'frmfont frm_lightning', array( 'aria-hidden' => 'true' ) ); ?>
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>
59 64
60 65 <?php if ( isset( $tip['call'] ) ) { ?>
61 66 <span class="frm-tip-info">
62 67 <?php echo esc_html( $tip['tip'] ); ?>
63 68 </span>
64 - <span class="frm-tip-cta">
65 - <?php echo esc_html( $tip['call'] ); ?>
66 - </span>
67 - <?php } else { ?>
68 - <span class="frm-tip-cta">
69 - <?php echo esc_html( $tip['tip'] ); ?>
70 - </span>
71 69 <?php } ?>
70 + <span class="frm-tip-cta">
71 + <?php echo esc_html( $tip['call'] ? $tip['call'] : $tip['tip'] ); ?>
72 + </span>
72 73 </a>
73 74 <?php
75 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
74 76
75 77 if ( 'p' === $html ) {
76 78 echo '</p>';
77 79 }
@@ -77,12 +79,54 @@
77 79 }
78 80 }
79 81
80 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 + /**
81 125 * @return array
82 126 */
83 127 public static function get_builder_tip() {
84 - $tips = array(
128 + return array(
85 129 array(
86 130 'link' => array(
87 131 'content' => 'conditional-logic',
88 132 'param' => 'conditional-logic-wordpress-forms',
@@ -87,9 +131,9 @@
87 131 'content' => 'conditional-logic',
88 132 'param' => 'conditional-logic-wordpress-forms',
89 133 ),
90 134 'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ),
91 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
135 + 'call' => self::cta_label(),
92 136 ),
93 137 array(
94 138 'link' => array(
95 139 'content' => 'confirmation-fields',
@@ -94,10 +138,10 @@
94 138 'link' => array(
95 139 'content' => 'confirmation-fields',
96 140 'param' => 'confirmation-fields-wordpress-forms',
97 141 ),
98 - 'tip' => __( 'Want to stop losing leads from email typos?', 'formidable' ),
99 - 'call' => __( 'Add email confirmation fields.', 'formidable' ),
142 + 'tip' => __( 'Eliminate input errors with email confirmation fields.', 'formidable' ),
143 + 'call' => self::cta_label(),
100 144 ),
101 145 array(
102 146 'link' => array(
103 147 'content' => 'page-breaks',
@@ -103,9 +147,9 @@
103 147 'content' => 'page-breaks',
104 148 'param' => 'wordpress-multi-page-forms',
105 149 ),
106 150 'tip' => __( 'Use page breaks for easier forms.', 'formidable' ),
107 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
151 + 'call' => self::cta_label(),
108 152 ),
109 153 array(
110 154 'link' => array(
111 155 'content' => 'file-uploads',
@@ -110,30 +154,20 @@
110 154 'link' => array(
111 155 'content' => 'file-uploads',
112 156 'param' => 'wordpress-multi-file-upload-fields',
113 157 ),
114 - 'tip' => __( 'Cut down on back-and-forth with clients.', 'formidable' ),
115 - 'call' => __( 'Allow file uploads in your form.', 'formidable' ),
158 + 'tip' => __( 'Skip the follow-ups. Let users upload files.', 'formidable' ),
159 + 'call' => self::cta_label(),
116 160 ),
117 161 array(
118 162 'link' => array(
119 - 'content' => 'calculations',
120 - 'param' => 'field-calculations-wordpress-form',
121 - ),
122 - 'tip' => __( 'Need to calculate a total?', 'formidable' ),
123 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
124 - ),
125 - array(
126 - 'link' => array(
127 163 'content' => 'prefill-fields',
128 164 'param' => 'auto-fill-forms',
129 165 ),
130 - 'tip' => __( 'Save time.', 'formidable' ),
131 - 'call' => __( 'Fill out forms automatically!', 'formidable' ),
166 + 'tip' => __( 'Save time with autofill forms.', 'formidable' ),
167 + 'call' => self::cta_label(),
132 168 ),
133 169 );
134 -
135 - return $tips;
136 170 }
137 171
138 172 /**
139 173 * @return array
@@ -138,16 +172,16 @@
138 172 /**
139 173 * @return array
140 174 */
141 175 public static function get_form_settings_tip() {
142 - $tips = array(
176 + return array(
143 177 array(
144 178 'link' => array(
145 179 'content' => 'front-edit-b',
146 180 'param' => 'wordpress-front-end-editing',
147 181 ),
148 - 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
149 - 'call' => __( 'Add front-end editing.', 'formidable' ),
182 + 'tip' => __( 'Make your site dynamic. Enable front-end editing.', 'formidable' ),
183 + 'call' => self::cta_label(),
150 184 ),
151 185 array(
152 186 'link' => array(
153 187 'content' => 'save-drafts',
@@ -152,10 +186,10 @@
152 186 'link' => array(
153 187 'content' => 'save-drafts',
154 188 'param' => 'save-drafts-wordpress-form',
155 189 ),
156 - 'tip' => __( 'Have long forms?', 'formidable' ),
157 - 'call' => __( 'Let users save drafts and return later!', 'formidable' ),
190 + 'tip' => __( 'Long form? Let users save and finish later', 'formidable' ),
191 + 'call' => self::cta_label(),
158 192 ),
159 193 array(
160 194 'link' => array(
161 195 'content' => 'form-scheduling',
@@ -160,14 +194,12 @@
160 194 'link' => array(
161 195 'content' => 'form-scheduling',
162 196 'param' => 'schedule-forms-wordpress',
163 197 ),
164 - 'tip' => __( 'Want your form open only for a certain time period?', 'formidable' ),
165 - 'call' => __( 'Add form scheduling.', 'formidable' ),
198 + 'tip' => __( 'Limit form access with built-in scheduling.', 'formidable' ),
199 + 'call' => self::cta_label(),
166 200 ),
167 201 );
168 -
169 - return $tips;
170 202 }
171 203
172 204 /**
173 205 * @return array
@@ -172,16 +204,16 @@
172 204 /**
173 205 * @return array
174 206 */
175 207 public static function get_form_action_tip() {
176 - $tips = array(
208 + return array(
177 209 array(
178 210 'link' => array(
179 211 'content' => 'email-routing',
180 212 'param' => 'virtually-unlimited-emails',
181 213 ),
182 - 'tip' => __( 'Save time by sending the email to the right person automatically.', 'formidable' ),
183 - 'call' => __( 'Add email routing.', 'formidable' ),
214 + 'tip' => __( 'Save time — route emails to the right person automatically.', 'formidable' ),
215 + 'call' => self::cta_label(),
184 216 ),
185 217 array(
186 218 'link' => array(
187 219 'content' => 'create-posts',
@@ -187,9 +219,9 @@
187 219 'content' => 'create-posts',
188 220 'param' => 'create-posts-pages-wordpress-forms',
189 221 ),
190 222 'tip' => __( 'Create blog posts or pages from the front-end.', 'formidable' ),
191 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
223 + 'call' => self::cta_label(),
192 224 ),
193 225 array(
194 226 'link' => array(
195 227 'content' => 'user-submit',
@@ -195,9 +227,9 @@
195 227 'content' => 'user-submit',
196 228 'param' => 'create-posts-pages-wordpress-forms',
197 229 ),
198 230 'tip' => __( 'Let your users submit posts on the front-end.', 'formidable' ),
199 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
231 + 'call' => self::cta_label(),
200 232 ),
201 233 array(
202 234 'link' => array(
203 235 'content' => 'mailchimp',
@@ -202,29 +234,13 @@
202 234 'link' => array(
203 235 'content' => 'mailchimp',
204 236 'page' => 'mailchimp-tip',
205 237 ),
206 - 'tip' => __( 'Grow your business with automated email follow-up.', 'formidable' ),
207 - 'call' => __( 'Send leads straight to Mailchimp.', 'formidable' ),
238 + 'tip' => __( 'Send leads to Mailchimp for instant email follow-up.', 'formidable' ),
239 + 'call' => self::cta_label(),
208 240 ),
209 241 array(
210 242 'link' => array(
211 - 'content' => 'paypal-revenue',
212 - 'page' => 'paypal-increase-revenue-tip',
213 - ),
214 - 'tip' => __( 'Increase revenue.', 'formidable' ),
215 - 'call' => __( 'Use PayPal with this form.', 'formidable' ),
216 - ),
217 - array(
218 - 'link' => array(
219 - 'content' => 'paypal-fast',
220 - 'page' => 'paypal-save-time-tip',
221 - ),
222 - 'tip' => __( 'Get paid instantly.', 'formidable' ),
223 - 'call' => __( 'Use Paypal with this form.', 'formidable' ),
224 - ),
225 - array(
226 - 'link' => array(
227 243 'content' => 'registration',
228 244 'page' => 'registration-tip',
229 245 ),
230 246 'tip' => __( 'Automatically create user accounts.', 'formidable' ),
@@ -234,10 +250,10 @@
234 250 'link' => array(
235 251 'content' => 'profile',
236 252 'page' => 'registration-profile-editing-tip',
237 253 ),
238 - 'tip' => __( 'Need front-end profile editing?', 'formidable' ),
239 - 'call' => __( 'Add user registration.', 'formidable' ),
254 + 'tip' => __( 'Enable front-end profile editing with User Registration.', 'formidable' ),
255 + 'call' => self::cta_label(),
240 256 ),
241 257 array(
242 258 'link' => array(
243 259 'content' => 'twilio-payment',
@@ -242,10 +258,10 @@
242 258 'link' => array(
243 259 'content' => 'twilio-payment',
244 260 'page' => 'twilio-tip',
245 261 ),
246 - 'tip' => __( 'Want an SMS notification when a form is submitted or a payment received?', 'formidable' ),
247 - 'call' => __( 'Get the Twilio integration.', 'formidable' ),
262 + 'tip' => __( 'Get SMS alerts for form submissions and payments—just add Twilio.', 'formidable' ),
263 + 'call' => self::cta_label(),
248 264 ),
249 265 array(
250 266 'link' => array(
251 267 'content' => 'twilio',
@@ -250,10 +266,10 @@
250 266 'link' => array(
251 267 'content' => 'twilio',
252 268 'page' => 'twilio-send-tip',
253 269 ),
254 - 'tip' => __( 'Send an SMS message when a form is submitted.', 'formidable' ),
255 - 'call' => __( 'Get the Twilio integration.', 'formidable' ),
270 + 'tip' => __( 'Use Twilio to send SMS when forms are submitted.', 'formidable' ),
271 + 'call' => self::cta_label(),
256 272 ),
257 273 array(
258 274 'link' => array(
259 275 'content' => 'acf-tip',
@@ -258,14 +274,12 @@
258 274 'link' => array(
259 275 'content' => 'acf-tip',
260 276 'param' => 'acf-tip',
261 277 ),
262 - 'tip' => __( 'Fill Advanced Custom Fields from a form.', 'formidable' ),
263 - 'call' => __( 'Add ACF Integration', 'formidable' ),
278 + 'tip' => __( 'Fill Advanced Custom Fields automatically with form entries.', 'formidable' ),
279 + 'call' => self::cta_label(),
264 280 ),
265 281 );
266 -
267 - return $tips;
268 282 }
269 283
270 284 /**
271 285 * @return array
@@ -270,16 +284,16 @@
270 284 /**
271 285 * @return array
272 286 */
273 287 public static function get_styling_tip() {
274 - $tips = array(
288 + return array(
275 289 array(
276 290 'link' => array(
277 291 'content' => 'style',
278 292 'param' => 'wordpress-visual-form-styler',
279 293 ),
280 - 'tip' => __( 'Make your sidebar and footer forms stand out.', 'formidable' ),
281 - 'call' => __( 'Use multiple style templates.', 'formidable' ),
294 + 'tip' => __( 'Make your forms stand out with multiple style templates.', 'formidable' ),
295 + 'call' => self::cta_label(),
282 296 ),
283 297 array(
284 298 'link' => array(
285 299 'content' => 'style',
@@ -285,9 +299,9 @@
285 299 'content' => 'style',
286 300 'param' => 'bg-image-style-settings',
287 301 ),
288 302 'tip' => __( 'Want to add a background image?', 'formidable' ),
289 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
303 + 'call' => self::cta_label(),
290 304 ),
291 305 array(
292 306 'link' => array(
293 307 'content' => 'style',
@@ -293,13 +307,11 @@
293 307 'content' => 'style',
294 308 'param' => 'duplicate-style',
295 309 ),
296 310 'tip' => __( 'Want to duplicate a style?', 'formidable' ),
297 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
311 + 'call' => self::cta_label(),
298 312 ),
299 313 );
300 -
301 - return $tips;
302 314 }
303 315
304 316 /**
305 317 * @return array
@@ -310,10 +322,10 @@
310 322 'link' => array(
311 323 'content' => 'entries',
312 324 'param' => 'form-entry-management-wordpress',
313 325 ),
314 - 'tip' => __( 'Want to edit form submissions?', 'formidable' ),
315 - 'call' => __( 'Add entry management.', 'formidable' ),
326 + 'tip' => __( 'Edit form entries anytime with entry management.', 'formidable' ),
327 + 'call' => self::cta_label(),
316 328 ),
317 329 array(
318 330 'link' => array(
319 331 'content' => 'entries-search',
@@ -319,9 +331,9 @@
319 331 'content' => 'entries-search',
320 332 'param' => 'form-entry-management-wordpress',
321 333 ),
322 334 'tip' => __( 'Want to search submitted entries?', 'formidable' ),
323 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
335 + 'call' => self::cta_label(),
324 336 ),
325 337 array(
326 338 'link' => array(
327 339 'content' => 'views',
@@ -326,15 +338,14 @@
326 338 'link' => array(
327 339 'content' => 'views',
328 340 'param' => 'views-display-form-data',
329 341 ),
330 - 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
331 - 'call' => __( 'Display form data with Views.', 'formidable' ),
342 + 'tip' => __( 'Turn entries into dynamic content — no code needed.', 'formidable' ),
343 + 'call' => self::cta_label(),
332 344 ),
333 345 );
334 - $tips = array_merge( $tips, self::get_import_tip() );
335 346
336 - return $tips;
347 + return array_merge( $tips, self::get_import_tip() );
337 348 }
338 349
339 350 /**
340 351 * @return array
@@ -339,9 +350,9 @@
339 350 /**
340 351 * @return array
341 352 */
342 353 public static function get_import_tip() {
343 - $tips = array(
354 + return array(
344 355 array(
345 356 'link' => array(
346 357 'content' => 'import',
347 358 'param' => 'importing-exporting-wordpress-forms',
@@ -346,54 +357,83 @@
346 357 'content' => 'import',
347 358 'param' => 'importing-exporting-wordpress-forms',
348 359 ),
349 360 'tip' => __( 'Want to import entries into your forms?', 'formidable' ),
350 - 'call' => __( 'Upgrade to Pro.', 'formidable' ),
361 + 'call' => self::cta_label(),
351 362 ),
352 363 );
364 + }
353 365
354 - return $tips;
366 + /**
367 + * @param array $tips
368 + *
369 + * @return array
370 + */
371 + public static function get_random_tip( $tips ) {
372 + $count = count( $tips );
373 +
374 + if ( $count === 0 ) {
375 + return array();
376 + }
377 +
378 + $random = random_int( 0, $count - 1 );
379 + return $tips[ $random ];
355 380 }
356 381
357 382 /**
358 - * @return array
383 + * Displays a call-to-action section in the admin area.
384 + *
385 + * @since 6.7
386 + *
387 + * @param array $args {
388 + * An array of arguments to configure the call-to-action section.
389 + *
390 + * @type string $title The title of the section.
391 + * @type string $description The description of the section.
392 + * @type string $link_text The text for the link.
393 + * @type string $link_url The URL for the link.
394 + * @type string $role The required user role to view the section. Default 'administrator'.
395 + * }
396 + *
397 + * @return void
359 398 */
360 - public static function get_banner_tip() {
361 - $tips = array(
362 - array(
363 - 'link' => array(
364 - 'medium' => 'banner',
365 - 'content' => 'professional-results',
366 - ),
367 - 'tip' => __( 'Looking for more ways to get professional results?', 'formidable' ),
368 - 'call' => __( 'Take your forms to the next level.', 'formidable' ),
369 - ),
370 - array(
371 - 'link' => array(
372 - 'medium' => 'banner',
373 - 'content' => 'increase-conversions',
374 - ),
375 - 'tip' => __( 'Increase conversions in long forms.', 'formidable' ),
376 - 'call' => __( 'Add conditional logic, page breaks, and section headings.', 'formidable' ),
377 - ),
378 - array(
379 - 'link' => array(
380 - 'medium' => 'banner',
381 - 'content' => 'automate',
382 - ),
383 - 'tip' => __( 'Automate your business and increase revenue.', 'formidable' ),
384 - 'call' => __( 'Collect instant payments, and send leads to Mailchimp.', 'formidable' ),
385 - ),
399 + public static function show_admin_cta( $args ) {
400 + $role = ! empty( $args['role'] ) ? $args['role'] : 'administrator';
401 +
402 + if ( ! current_user_can( $role ) ) {
403 + // Return early if the user doesn't have the required capability.
404 + return;
405 + }
406 +
407 + $defaults = array(
408 + 'title' => '',
409 + 'description' => '',
410 + 'link_text' => '',
411 + 'link_url' => '#',
412 + 'class' => '',
413 + 'id' => '',
414 + 'target' => '_blank',
386 415 );
387 - $random = rand( 0, count( $tips ) - 1 );
388 - $tip = $tips[ $random ];
389 - $tip['num'] = $random;
390 416
391 - return $tip;
417 + $args = wp_parse_args( $args, $defaults );
418 +
419 + $attributes = array(
420 + 'class' => trim( 'frm-cta frm-flex frm-p-sm ' . $args['class'] ),
421 + );
422 +
423 + if ( $args['id'] ) {
424 + $attributes['id'] = $args['id'];
425 + }
426 +
427 + require FrmAppHelper::plugin_path() . '/classes/views/shared/admin-cta.php';
392 428 }
393 429
394 - public static function get_random_tip( $tips ) {
395 - $random = rand( 0, count( $tips ) - 1 );
396 -
397 - return $tips[ $random ];
430 + /**
431 + * @deprecated 6.21
432 + *
433 + * @return array
434 + */
435 + public static function get_banner_tip() {
436 + _deprecated_function( __METHOD__, '6.21' );
437 + return array();
398 438 }
399 439 }