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

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

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