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

403 lines 10.9 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 * @return array
85 */
86 public static function get_builder_tip() {
87 $tips = array(
88 array(
89 'link' => array(
90 'content' => 'conditional-logic',
91 'param' => 'conditional-logic-wordpress-forms',
92 ),
93 'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ),
94 'call' => __( 'Upgrade to Pro.', 'formidable' ),
95 ),
96 array(
97 'link' => array(
98 'content' => 'confirmation-fields',
99 'param' => 'confirmation-fields-wordpress-forms',
100 ),
101 'tip' => __( 'Want to stop losing leads from email typos?', 'formidable' ),
102 'call' => __( 'Add email confirmation fields.', 'formidable' ),
103 ),
104 array(
105 'link' => array(
106 'content' => 'page-breaks',
107 'param' => 'wordpress-multi-page-forms',
108 ),
109 'tip' => __( 'Use page breaks for easier forms.', 'formidable' ),
110 'call' => __( 'Upgrade to Pro.', 'formidable' ),
111 ),
112 array(
113 'link' => array(
114 'content' => 'file-uploads',
115 'param' => 'wordpress-multi-file-upload-fields',
116 ),
117 'tip' => __( 'Cut down on back-and-forth with clients.', 'formidable' ),
118 'call' => __( 'Allow file uploads in your form.', 'formidable' ),
119 ),
120 array(
121 'link' => array(
122 'content' => 'calculations',
123 'param' => 'field-calculations-wordpress-form',
124 ),
125 'tip' => __( 'Need to calculate a total?', 'formidable' ),
126 'call' => __( 'Upgrade to Pro.', 'formidable' ),
127 ),
128 array(
129 'link' => array(
130 'content' => 'prefill-fields',
131 'param' => 'auto-fill-forms',
132 ),
133 'tip' => __( 'Save time.', 'formidable' ),
134 'call' => __( 'Fill out forms automatically!', 'formidable' ),
135 ),
136 );
137
138 return $tips;
139 }
140
141 /**
142 * @return array
143 */
144 public static function get_form_settings_tip() {
145 $tips = array(
146 array(
147 'link' => array(
148 'content' => 'front-edit-b',
149 'param' => 'wordpress-front-end-editing',
150 ),
151 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
152 'call' => __( 'Add front-end editing.', 'formidable' ),
153 ),
154 array(
155 'link' => array(
156 'content' => 'save-drafts',
157 'param' => 'save-drafts-wordpress-form',
158 ),
159 'tip' => __( 'Have long forms?', 'formidable' ),
160 'call' => __( 'Let users save drafts and return later!', 'formidable' ),
161 ),
162 array(
163 'link' => array(
164 'content' => 'form-scheduling',
165 'param' => 'schedule-forms-wordpress',
166 ),
167 'tip' => __( 'Want your form open only for a certain time period?', 'formidable' ),
168 'call' => __( 'Add form scheduling.', 'formidable' ),
169 ),
170 );
171
172 return $tips;
173 }
174
175 /**
176 * @return array
177 */
178 public static function get_form_action_tip() {
179 $tips = array(
180 array(
181 'link' => array(
182 'content' => 'email-routing',
183 'param' => 'virtually-unlimited-emails',
184 ),
185 'tip' => __( 'Save time by sending the email to the right person automatically.', 'formidable' ),
186 'call' => __( 'Add email routing.', 'formidable' ),
187 ),
188 array(
189 'link' => array(
190 'content' => 'create-posts',
191 'param' => 'create-posts-pages-wordpress-forms',
192 ),
193 'tip' => __( 'Create blog posts or pages from the front-end.', 'formidable' ),
194 'call' => __( 'Upgrade to Pro.', 'formidable' ),
195 ),
196 array(
197 'link' => array(
198 'content' => 'user-submit',
199 'param' => 'create-posts-pages-wordpress-forms',
200 ),
201 'tip' => __( 'Let your users submit posts on the front-end.', 'formidable' ),
202 'call' => __( 'Upgrade to Pro.', 'formidable' ),
203 ),
204 array(
205 'link' => array(
206 'content' => 'mailchimp',
207 'page' => 'mailchimp-tip',
208 ),
209 'tip' => __( 'Grow your business with automated email follow-up.', 'formidable' ),
210 'call' => __( 'Send leads straight to Mailchimp.', 'formidable' ),
211 ),
212 array(
213 'link' => array(
214 'content' => 'paypal-revenue',
215 'page' => 'paypal-increase-revenue-tip',
216 ),
217 'tip' => __( 'Increase revenue.', 'formidable' ),
218 'call' => __( 'Use PayPal with this form.', 'formidable' ),
219 ),
220 array(
221 'link' => array(
222 'content' => 'paypal-fast',
223 'page' => 'paypal-save-time-tip',
224 ),
225 'tip' => __( 'Get paid instantly.', 'formidable' ),
226 'call' => __( 'Use Paypal with this form.', 'formidable' ),
227 ),
228 array(
229 'link' => array(
230 'content' => 'registration',
231 'page' => 'registration-tip',
232 ),
233 'tip' => __( 'Automatically create user accounts.', 'formidable' ),
234 'call' => __( 'Upgrade to boost your site membership.', 'formidable' ),
235 ),
236 array(
237 'link' => array(
238 'content' => 'profile',
239 'page' => 'registration-profile-editing-tip',
240 ),
241 'tip' => __( 'Need front-end profile editing?', 'formidable' ),
242 'call' => __( 'Add user registration.', 'formidable' ),
243 ),
244 array(
245 'link' => array(
246 'content' => 'twilio-payment',
247 'page' => 'twilio-tip',
248 ),
249 'tip' => __( 'Want an SMS notification when a form is submitted or a payment received?', 'formidable' ),
250 'call' => __( 'Get the Twilio integration.', 'formidable' ),
251 ),
252 array(
253 'link' => array(
254 'content' => 'twilio',
255 'page' => 'twilio-send-tip',
256 ),
257 'tip' => __( 'Send an SMS message when a form is submitted.', 'formidable' ),
258 'call' => __( 'Get the Twilio integration.', 'formidable' ),
259 ),
260 array(
261 'link' => array(
262 'content' => 'acf-tip',
263 'param' => 'acf-tip',
264 ),
265 'tip' => __( 'Fill Advanced Custom Fields from a form.', 'formidable' ),
266 'call' => __( 'Add ACF Integration', 'formidable' ),
267 ),
268 );
269
270 return $tips;
271 }
272
273 /**
274 * @return array
275 */
276 public static function get_styling_tip() {
277 $tips = array(
278 array(
279 'link' => array(
280 'content' => 'style',
281 'param' => 'wordpress-visual-form-styler',
282 ),
283 'tip' => __( 'Make your sidebar and footer forms stand out.', 'formidable' ),
284 'call' => __( 'Use multiple style templates.', 'formidable' ),
285 ),
286 array(
287 'link' => array(
288 'content' => 'style',
289 'param' => 'bg-image-style-settings',
290 ),
291 'tip' => __( 'Want to add a background image?', 'formidable' ),
292 'call' => __( 'Upgrade to Pro.', 'formidable' ),
293 ),
294 array(
295 'link' => array(
296 'content' => 'style',
297 'param' => 'duplicate-style',
298 ),
299 'tip' => __( 'Want to duplicate a style?', 'formidable' ),
300 'call' => __( 'Upgrade to Pro.', 'formidable' ),
301 ),
302 );
303
304 return $tips;
305 }
306
307 /**
308 * @return array
309 */
310 public static function get_entries_tip() {
311 $tips = array(
312 array(
313 'link' => array(
314 'content' => 'entries',
315 'param' => 'form-entry-management-wordpress',
316 ),
317 'tip' => __( 'Want to edit form submissions?', 'formidable' ),
318 'call' => __( 'Add entry management.', 'formidable' ),
319 ),
320 array(
321 'link' => array(
322 'content' => 'entries-search',
323 'param' => 'form-entry-management-wordpress',
324 ),
325 'tip' => __( 'Want to search submitted entries?', 'formidable' ),
326 'call' => __( 'Upgrade to Pro.', 'formidable' ),
327 ),
328 array(
329 'link' => array(
330 'content' => 'views',
331 'param' => 'views-display-form-data',
332 ),
333 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
334 'call' => __( 'Display form data with Views.', 'formidable' ),
335 ),
336 );
337 $tips = array_merge( $tips, self::get_import_tip() );
338
339 return $tips;
340 }
341
342 /**
343 * @return array
344 */
345 public static function get_import_tip() {
346 $tips = array(
347 array(
348 'link' => array(
349 'content' => 'import',
350 'param' => 'importing-exporting-wordpress-forms',
351 ),
352 'tip' => __( 'Want to import entries into your forms?', 'formidable' ),
353 'call' => __( 'Upgrade to Pro.', 'formidable' ),
354 ),
355 );
356
357 return $tips;
358 }
359
360 /**
361 * @return array
362 */
363 public static function get_banner_tip() {
364 $tips = array(
365 array(
366 'link' => array(
367 'medium' => 'banner',
368 'content' => 'professional-results',
369 ),
370 'tip' => __( 'Looking for more ways to get professional results?', 'formidable' ),
371 'call' => __( 'Take your forms to the next level.', 'formidable' ),
372 ),
373 array(
374 'link' => array(
375 'medium' => 'banner',
376 'content' => 'increase-conversions',
377 ),
378 'tip' => __( 'Increase conversions in long forms.', 'formidable' ),
379 'call' => __( 'Add conditional logic, page breaks, and section headings.', 'formidable' ),
380 ),
381 array(
382 'link' => array(
383 'medium' => 'banner',
384 'content' => 'automate',
385 ),
386 'tip' => __( 'Automate your business and increase revenue.', 'formidable' ),
387 'call' => __( 'Collect instant payments, and send leads to Mailchimp.', 'formidable' ),
388 ),
389 );
390 $random = rand( 0, count( $tips ) - 1 );
391 $tip = $tips[ $random ];
392 $tip['num'] = $random;
393
394 return $tip;
395 }
396
397 public static function get_random_tip( $tips ) {
398 $random = rand( 0, count( $tips ) - 1 );
399
400 return $tips[ $random ];
401 }
402 }
403