PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.5.3
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.5.3
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
formidable / classes / helpers / FrmTipsHelper.php

FrmTipsHelper.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.5.3, at classes/helpers/FrmTipsHelper.php

414 lines 11.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 class FrmTipsHelper {
7
8 /**
9 * @param string $callback
10 * @param string $html
11 *
12 * @return void
13 */
14 public static function pro_tip( $callback, $html = '' ) {
15 if ( FrmAppHelper::pro_is_installed() ) {
16 return;
17 }
18
19 $tips = self::$callback();
20 $tip = self::get_random_tip( $tips );
21
22 self::show_tip( $tip, $html );
23 }
24
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 * @param string $html
40 *
41 * @return void
42 */
43 public static function show_tip( $tip, $html = '' ) {
44 $defaults = array(
45 'page' => '',
46 'class' => 'frm-mt-0',
47 );
48 $tip = array_merge( $defaults, $tip );
49
50 if ( isset( $tip['link'] ) && ! isset( $tip['link']['medium'] ) ) {
51 $tip['link']['medium'] = 'tip';
52 }
53
54 if ( 'p' === $html ) {
55 echo '<p class="frmcenter ' . esc_attr( $tip['class'] ) . '">';
56 }
57
58 $link = empty( $tip['link'] ) ? $tip['page'] : FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] );
59 ?>
60 <a href="<?php echo esc_url( $link ); ?>" <?php echo empty( $tip['link'] ) ? '' : 'target="_blank"'; ?> class="frm_pro_tip">
61 <?php FrmAppHelper::icon_by_class( 'frmfont frm_lightning', array( 'aria-hidden' => 'true' ) ); ?>
62
63 <?php if ( isset( $tip['call'] ) ) { ?>
64 <span class="frm-tip-info">
65 <?php echo esc_html( $tip['tip'] ); ?>
66 </span>
67 <span class="frm-tip-cta">
68 <?php echo esc_html( $tip['call'] ); ?>
69 </span>
70 <?php } else { ?>
71 <span class="frm-tip-cta">
72 <?php echo esc_html( $tip['tip'] ); ?>
73 </span>
74 <?php } ?>
75 </a>
76 <?php
77
78 if ( 'p' === $html ) {
79 echo '</p>';
80 }
81 }
82
83 /**
84 * Use the correct label for the license.
85 *
86 * @since 6.5.1
87 *
88 * @return string
89 */
90 private static function cta_label() {
91 return FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro.', 'formidable' );
92 }
93
94 /**
95 * @return array
96 */
97 public static function get_builder_tip() {
98 $tips = array(
99 array(
100 'link' => array(
101 'content' => 'conditional-logic',
102 'param' => 'conditional-logic-wordpress-forms',
103 ),
104 'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ),
105 'call' => self::cta_label(),
106 ),
107 array(
108 'link' => array(
109 'content' => 'confirmation-fields',
110 'param' => 'confirmation-fields-wordpress-forms',
111 ),
112 'tip' => __( 'Want to stop losing leads from email typos?', 'formidable' ),
113 'call' => __( 'Add email confirmation fields.', 'formidable' ),
114 ),
115 array(
116 'link' => array(
117 'content' => 'page-breaks',
118 'param' => 'wordpress-multi-page-forms',
119 ),
120 'tip' => __( 'Use page breaks for easier forms.', 'formidable' ),
121 'call' => self::cta_label(),
122 ),
123 array(
124 'link' => array(
125 'content' => 'file-uploads',
126 'param' => 'wordpress-multi-file-upload-fields',
127 ),
128 'tip' => __( 'Cut down on back-and-forth with clients.', 'formidable' ),
129 'call' => __( 'Allow file uploads in your form.', 'formidable' ),
130 ),
131 array(
132 'link' => array(
133 'content' => 'calculations',
134 'param' => 'field-calculations-wordpress-form',
135 ),
136 'tip' => __( 'Need to calculate a total?', 'formidable' ),
137 'call' => self::cta_label(),
138 ),
139 array(
140 'link' => array(
141 'content' => 'prefill-fields',
142 'param' => 'auto-fill-forms',
143 ),
144 'tip' => __( 'Save time.', 'formidable' ),
145 'call' => __( 'Fill out forms automatically!', 'formidable' ),
146 ),
147 );
148
149 return $tips;
150 }
151
152 /**
153 * @return array
154 */
155 public static function get_form_settings_tip() {
156 $tips = array(
157 array(
158 'link' => array(
159 'content' => 'front-edit-b',
160 'param' => 'wordpress-front-end-editing',
161 ),
162 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
163 'call' => __( 'Add front-end editing.', 'formidable' ),
164 ),
165 array(
166 'link' => array(
167 'content' => 'save-drafts',
168 'param' => 'save-drafts-wordpress-form',
169 ),
170 'tip' => __( 'Have long forms?', 'formidable' ),
171 'call' => __( 'Let users save drafts and return later!', 'formidable' ),
172 ),
173 array(
174 'link' => array(
175 'content' => 'form-scheduling',
176 'param' => 'schedule-forms-wordpress',
177 ),
178 'tip' => __( 'Want your form open only for a certain time period?', 'formidable' ),
179 'call' => __( 'Add form scheduling.', 'formidable' ),
180 ),
181 );
182
183 return $tips;
184 }
185
186 /**
187 * @return array
188 */
189 public static function get_form_action_tip() {
190 $tips = array(
191 array(
192 'link' => array(
193 'content' => 'email-routing',
194 'param' => 'virtually-unlimited-emails',
195 ),
196 'tip' => __( 'Save time by sending the email to the right person automatically.', 'formidable' ),
197 'call' => __( 'Add email routing.', 'formidable' ),
198 ),
199 array(
200 'link' => array(
201 'content' => 'create-posts',
202 'param' => 'create-posts-pages-wordpress-forms',
203 ),
204 'tip' => __( 'Create blog posts or pages from the front-end.', 'formidable' ),
205 'call' => self::cta_label(),
206 ),
207 array(
208 'link' => array(
209 'content' => 'user-submit',
210 'param' => 'create-posts-pages-wordpress-forms',
211 ),
212 'tip' => __( 'Let your users submit posts on the front-end.', 'formidable' ),
213 'call' => self::cta_label(),
214 ),
215 array(
216 'link' => array(
217 'content' => 'mailchimp',
218 'page' => 'mailchimp-tip',
219 ),
220 'tip' => __( 'Grow your business with automated email follow-up.', 'formidable' ),
221 'call' => __( 'Send leads straight to Mailchimp.', 'formidable' ),
222 ),
223 array(
224 'link' => array(
225 'content' => 'paypal-revenue',
226 'page' => 'paypal-increase-revenue-tip',
227 ),
228 'tip' => __( 'Increase revenue.', 'formidable' ),
229 'call' => __( 'Use PayPal with this form.', 'formidable' ),
230 ),
231 array(
232 'link' => array(
233 'content' => 'paypal-fast',
234 'page' => 'paypal-save-time-tip',
235 ),
236 'tip' => __( 'Get paid instantly.', 'formidable' ),
237 'call' => __( 'Use Paypal with this form.', 'formidable' ),
238 ),
239 array(
240 'link' => array(
241 'content' => 'registration',
242 'page' => 'registration-tip',
243 ),
244 'tip' => __( 'Automatically create user accounts.', 'formidable' ),
245 'call' => __( 'Upgrade to boost your site membership.', 'formidable' ),
246 ),
247 array(
248 'link' => array(
249 'content' => 'profile',
250 'page' => 'registration-profile-editing-tip',
251 ),
252 'tip' => __( 'Need front-end profile editing?', 'formidable' ),
253 'call' => __( 'Add user registration.', 'formidable' ),
254 ),
255 array(
256 'link' => array(
257 'content' => 'twilio-payment',
258 'page' => 'twilio-tip',
259 ),
260 'tip' => __( 'Want an SMS notification when a form is submitted or a payment received?', 'formidable' ),
261 'call' => __( 'Get the Twilio integration.', 'formidable' ),
262 ),
263 array(
264 'link' => array(
265 'content' => 'twilio',
266 'page' => 'twilio-send-tip',
267 ),
268 'tip' => __( 'Send an SMS message when a form is submitted.', 'formidable' ),
269 'call' => __( 'Get the Twilio integration.', 'formidable' ),
270 ),
271 array(
272 'link' => array(
273 'content' => 'acf-tip',
274 'param' => 'acf-tip',
275 ),
276 'tip' => __( 'Fill Advanced Custom Fields from a form.', 'formidable' ),
277 'call' => __( 'Add ACF Integration', 'formidable' ),
278 ),
279 );
280
281 return $tips;
282 }
283
284 /**
285 * @return array
286 */
287 public static function get_styling_tip() {
288 $tips = array(
289 array(
290 'link' => array(
291 'content' => 'style',
292 'param' => 'wordpress-visual-form-styler',
293 ),
294 'tip' => __( 'Make your sidebar and footer forms stand out.', 'formidable' ),
295 'call' => __( 'Use multiple style templates.', 'formidable' ),
296 ),
297 array(
298 'link' => array(
299 'content' => 'style',
300 'param' => 'bg-image-style-settings',
301 ),
302 'tip' => __( 'Want to add a background image?', 'formidable' ),
303 'call' => self::cta_label(),
304 ),
305 array(
306 'link' => array(
307 'content' => 'style',
308 'param' => 'duplicate-style',
309 ),
310 'tip' => __( 'Want to duplicate a style?', 'formidable' ),
311 'call' => self::cta_label(),
312 ),
313 );
314
315 return $tips;
316 }
317
318 /**
319 * @return array
320 */
321 public static function get_entries_tip() {
322 $tips = array(
323 array(
324 'link' => array(
325 'content' => 'entries',
326 'param' => 'form-entry-management-wordpress',
327 ),
328 'tip' => __( 'Want to edit form submissions?', 'formidable' ),
329 'call' => __( 'Add entry management.', 'formidable' ),
330 ),
331 array(
332 'link' => array(
333 'content' => 'entries-search',
334 'param' => 'form-entry-management-wordpress',
335 ),
336 'tip' => __( 'Want to search submitted entries?', 'formidable' ),
337 'call' => self::cta_label(),
338 ),
339 array(
340 'link' => array(
341 'content' => 'views',
342 'param' => 'views-display-form-data',
343 ),
344 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
345 'call' => __( 'Display form data with Views.', 'formidable' ),
346 ),
347 );
348 $tips = array_merge( $tips, self::get_import_tip() );
349
350 return $tips;
351 }
352
353 /**
354 * @return array
355 */
356 public static function get_import_tip() {
357 $tips = array(
358 array(
359 'link' => array(
360 'content' => 'import',
361 'param' => 'importing-exporting-wordpress-forms',
362 ),
363 'tip' => __( 'Want to import entries into your forms?', 'formidable' ),
364 'call' => self::cta_label(),
365 ),
366 );
367
368 return $tips;
369 }
370
371 /**
372 * @return array
373 */
374 public static function get_banner_tip() {
375 $tips = array(
376 array(
377 'link' => array(
378 'medium' => 'banner',
379 'content' => 'professional-results',
380 ),
381 'tip' => __( 'Looking for more ways to get professional results?', 'formidable' ),
382 'call' => __( 'Take your forms to the next level.', 'formidable' ),
383 ),
384 array(
385 'link' => array(
386 'medium' => 'banner',
387 'content' => 'increase-conversions',
388 ),
389 'tip' => __( 'Increase conversions in long forms.', 'formidable' ),
390 'call' => __( 'Add conditional logic, page breaks, and section headings.', 'formidable' ),
391 ),
392 array(
393 'link' => array(
394 'medium' => 'banner',
395 'content' => 'automate',
396 ),
397 'tip' => __( 'Automate your business and increase revenue.', 'formidable' ),
398 'call' => __( 'Collect instant payments, and send leads to Mailchimp.', 'formidable' ),
399 ),
400 );
401 $random = rand( 0, count( $tips ) - 1 );
402 $tip = $tips[ $random ];
403 $tip['num'] = $random;
404
405 return $tip;
406 }
407
408 public static function get_random_tip( $tips ) {
409 $random = rand( 0, count( $tips ) - 1 );
410
411 return $tips[ $random ];
412 }
413 }
414