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

400 lines 10.8 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 );
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 if ( ! isset( $tip['page'] ) ) {
45 $tip['page'] = '';
46 }
47 if ( isset( $tip['link'] ) && ! isset( $tip['link']['medium'] ) ) {
48 $tip['link']['medium'] = 'tip';
49 }
50
51 if ( 'p' === $html ) {
52 echo '<p class="frmcenter frm-mt-0">';
53 }
54
55 $link = empty( $tip['link'] ) ? $tip['page'] : FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] );
56 ?>
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' ) ); ?>
59
60 <?php if ( isset( $tip['call'] ) ) { ?>
61 <span class="frm-tip-info">
62 <?php echo esc_html( $tip['tip'] ); ?>
63 </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 <?php } ?>
72 </a>
73 <?php
74
75 if ( 'p' === $html ) {
76 echo '</p>';
77 }
78 }
79
80 /**
81 * @return array
82 */
83 public static function get_builder_tip() {
84 $tips = array(
85 array(
86 'link' => array(
87 'content' => 'conditional-logic',
88 'param' => 'conditional-logic-wordpress-forms',
89 ),
90 'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ),
91 'call' => __( 'Upgrade to Pro.', 'formidable' ),
92 ),
93 array(
94 'link' => array(
95 'content' => 'confirmation-fields',
96 'param' => 'confirmation-fields-wordpress-forms',
97 ),
98 'tip' => __( 'Want to stop losing leads from email typos?', 'formidable' ),
99 'call' => __( 'Add email confirmation fields.', 'formidable' ),
100 ),
101 array(
102 'link' => array(
103 'content' => 'page-breaks',
104 'param' => 'wordpress-multi-page-forms',
105 ),
106 'tip' => __( 'Use page breaks for easier forms.', 'formidable' ),
107 'call' => __( 'Upgrade to Pro.', 'formidable' ),
108 ),
109 array(
110 'link' => array(
111 'content' => 'file-uploads',
112 'param' => 'wordpress-multi-file-upload-fields',
113 ),
114 'tip' => __( 'Cut down on back-and-forth with clients.', 'formidable' ),
115 'call' => __( 'Allow file uploads in your form.', 'formidable' ),
116 ),
117 array(
118 '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 'content' => 'prefill-fields',
128 'param' => 'auto-fill-forms',
129 ),
130 'tip' => __( 'Save time.', 'formidable' ),
131 'call' => __( 'Fill out forms automatically!', 'formidable' ),
132 ),
133 );
134
135 return $tips;
136 }
137
138 /**
139 * @return array
140 */
141 public static function get_form_settings_tip() {
142 $tips = array(
143 array(
144 'link' => array(
145 'content' => 'front-edit-b',
146 'param' => 'wordpress-front-end-editing',
147 ),
148 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
149 'call' => __( 'Add front-end editing.', 'formidable' ),
150 ),
151 array(
152 'link' => array(
153 'content' => 'save-drafts',
154 'param' => 'save-drafts-wordpress-form',
155 ),
156 'tip' => __( 'Have long forms?', 'formidable' ),
157 'call' => __( 'Let users save drafts and return later!', 'formidable' ),
158 ),
159 array(
160 'link' => array(
161 'content' => 'form-scheduling',
162 'param' => 'schedule-forms-wordpress',
163 ),
164 'tip' => __( 'Want your form open only for a certain time period?', 'formidable' ),
165 'call' => __( 'Add form scheduling.', 'formidable' ),
166 ),
167 );
168
169 return $tips;
170 }
171
172 /**
173 * @return array
174 */
175 public static function get_form_action_tip() {
176 $tips = array(
177 array(
178 'link' => array(
179 'content' => 'email-routing',
180 'param' => 'virtually-unlimited-emails',
181 ),
182 'tip' => __( 'Save time by sending the email to the right person automatically.', 'formidable' ),
183 'call' => __( 'Add email routing.', 'formidable' ),
184 ),
185 array(
186 'link' => array(
187 'content' => 'create-posts',
188 'param' => 'create-posts-pages-wordpress-forms',
189 ),
190 'tip' => __( 'Create blog posts or pages from the front-end.', 'formidable' ),
191 'call' => __( 'Upgrade to Pro.', 'formidable' ),
192 ),
193 array(
194 'link' => array(
195 'content' => 'user-submit',
196 'param' => 'create-posts-pages-wordpress-forms',
197 ),
198 'tip' => __( 'Let your users submit posts on the front-end.', 'formidable' ),
199 'call' => __( 'Upgrade to Pro.', 'formidable' ),
200 ),
201 array(
202 'link' => array(
203 'content' => 'mailchimp',
204 'page' => 'mailchimp-tip',
205 ),
206 'tip' => __( 'Grow your business with automated email follow-up.', 'formidable' ),
207 'call' => __( 'Send leads straight to Mailchimp.', 'formidable' ),
208 ),
209 array(
210 '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 'content' => 'registration',
228 'page' => 'registration-tip',
229 ),
230 'tip' => __( 'Automatically create user accounts.', 'formidable' ),
231 'call' => __( 'Upgrade to boost your site membership.', 'formidable' ),
232 ),
233 array(
234 'link' => array(
235 'content' => 'profile',
236 'page' => 'registration-profile-editing-tip',
237 ),
238 'tip' => __( 'Need front-end profile editing?', 'formidable' ),
239 'call' => __( 'Add user registration.', 'formidable' ),
240 ),
241 array(
242 'link' => array(
243 'content' => 'twilio-payment',
244 'page' => 'twilio-tip',
245 ),
246 'tip' => __( 'Want an SMS notification when a form is submitted or a payment received?', 'formidable' ),
247 'call' => __( 'Get the Twilio integration.', 'formidable' ),
248 ),
249 array(
250 'link' => array(
251 'content' => 'twilio',
252 'page' => 'twilio-send-tip',
253 ),
254 'tip' => __( 'Send an SMS message when a form is submitted.', 'formidable' ),
255 'call' => __( 'Get the Twilio integration.', 'formidable' ),
256 ),
257 array(
258 'link' => array(
259 'content' => 'acf-tip',
260 'param' => 'acf-tip',
261 ),
262 'tip' => __( 'Fill Advanced Custom Fields from a form.', 'formidable' ),
263 'call' => __( 'Add ACF Integration', 'formidable' ),
264 ),
265 );
266
267 return $tips;
268 }
269
270 /**
271 * @return array
272 */
273 public static function get_styling_tip() {
274 $tips = array(
275 array(
276 'link' => array(
277 'content' => 'style',
278 'param' => 'wordpress-visual-form-styler',
279 ),
280 'tip' => __( 'Make your sidebar and footer forms stand out.', 'formidable' ),
281 'call' => __( 'Use multiple style templates.', 'formidable' ),
282 ),
283 array(
284 'link' => array(
285 'content' => 'style',
286 'param' => 'bg-image-style-settings',
287 ),
288 'tip' => __( 'Want to add a background image?', 'formidable' ),
289 'call' => __( 'Upgrade to Pro.', 'formidable' ),
290 ),
291 array(
292 'link' => array(
293 'content' => 'style',
294 'param' => 'duplicate-style',
295 ),
296 'tip' => __( 'Want to duplicate a style?', 'formidable' ),
297 'call' => __( 'Upgrade to Pro.', 'formidable' ),
298 ),
299 );
300
301 return $tips;
302 }
303
304 /**
305 * @return array
306 */
307 public static function get_entries_tip() {
308 $tips = array(
309 array(
310 'link' => array(
311 'content' => 'entries',
312 'param' => 'form-entry-management-wordpress',
313 ),
314 'tip' => __( 'Want to edit form submissions?', 'formidable' ),
315 'call' => __( 'Add entry management.', 'formidable' ),
316 ),
317 array(
318 'link' => array(
319 'content' => 'entries-search',
320 'param' => 'form-entry-management-wordpress',
321 ),
322 'tip' => __( 'Want to search submitted entries?', 'formidable' ),
323 'call' => __( 'Upgrade to Pro.', 'formidable' ),
324 ),
325 array(
326 'link' => array(
327 'content' => 'views',
328 'param' => 'views-display-form-data',
329 ),
330 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ),
331 'call' => __( 'Display form data with Views.', 'formidable' ),
332 ),
333 );
334 $tips = array_merge( $tips, self::get_import_tip() );
335
336 return $tips;
337 }
338
339 /**
340 * @return array
341 */
342 public static function get_import_tip() {
343 $tips = array(
344 array(
345 'link' => array(
346 'content' => 'import',
347 'param' => 'importing-exporting-wordpress-forms',
348 ),
349 'tip' => __( 'Want to import entries into your forms?', 'formidable' ),
350 'call' => __( 'Upgrade to Pro.', 'formidable' ),
351 ),
352 );
353
354 return $tips;
355 }
356
357 /**
358 * @return array
359 */
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 ),
386 );
387 $random = rand( 0, count( $tips ) - 1 );
388 $tip = $tips[ $random ];
389 $tip['num'] = $random;
390
391 return $tip;
392 }
393
394 public static function get_random_tip( $tips ) {
395 $random = rand( 0, count( $tips ) - 1 );
396
397 return $tips[ $random ];
398 }
399 }
400