|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class FrmTipsHelper { |
|
4
|
|
|
|
|
5
|
|
|
public static function pro_tip( $callback, $html = '' ) { |
|
6
|
|
|
if ( FrmAppHelper::pro_is_installed() ) { |
|
7
|
|
|
return; |
|
8
|
|
|
} |
|
9
|
|
|
|
|
10
|
|
|
$tips = self::$callback(); |
|
11
|
|
|
$tip = self::get_random_tip( $tips ); |
|
12
|
|
|
|
|
13
|
|
|
if ( 'p' === $html ) { |
|
14
|
|
|
echo '<p>'; |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
|
|
if ( ! isset( $tip['page'] ) ) { |
|
18
|
|
|
$tip['page'] = ''; |
|
19
|
|
|
} |
|
20
|
|
|
if ( ! isset( $tip['link']['medium'] ) ) { |
|
21
|
|
|
$tip['link']['medium'] = 'tip'; |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
$link = FrmAppHelper::make_affiliate_url( FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] ) ); |
|
25
|
|
|
?> |
|
26
|
|
|
<a href="<?php echo esc_url( $link ); ?>" target="_blank" class="frm_pro_tip"> |
|
27
|
|
|
<span> |
|
28
|
|
|
<i class="frm_icon_font frm_check1_icon"></i> <?php esc_html_e( 'Pro Tip:', 'formidable' ); ?> |
|
29
|
|
|
</span> |
|
30
|
|
|
<?php echo esc_html( $tip['tip'] ) ?> |
|
31
|
|
|
<?php if ( isset( $tip['call'] ) ) { ?> |
|
32
|
|
|
<span><?php echo esc_html( $tip['call'] ) ?></span> |
|
33
|
|
|
<?php } ?> |
|
34
|
|
|
</a> |
|
35
|
|
|
<?php |
|
36
|
|
|
if ( 'p' === $html ) { |
|
37
|
|
|
echo '</p>'; |
|
38
|
|
|
} |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public static function get_builder_tip() { |
|
42
|
|
|
$tips = array( |
|
43
|
|
|
array( |
|
44
|
|
|
'link' => array( |
|
45
|
|
|
'content' => 'conditional-logic', |
|
46
|
|
|
'anchor' => 'feature-conditional-logic-wordpress-forms', |
|
47
|
|
|
), |
|
48
|
|
|
'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ), |
|
49
|
|
|
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
|
50
|
|
|
), |
|
51
|
|
|
array( |
|
52
|
|
|
'link' => array( |
|
53
|
|
|
'content' => 'page-breaks', |
|
54
|
|
|
'anchor' => 'feature-wordpress-multi-step-form', |
|
55
|
|
|
), |
|
56
|
|
|
'tip' => __( 'Stop intimidating users with long forms.', 'formidable' ), |
|
57
|
|
|
'call' => __( 'Use page breaks.', 'formidable' ), |
|
58
|
|
|
), |
|
59
|
|
|
array( |
|
60
|
|
|
'link' => array( |
|
61
|
|
|
'content' => 'file-uploads', |
|
62
|
|
|
'anchor' => 'feature-wordpress-multiple-file-upload-form', |
|
63
|
|
|
), |
|
64
|
|
|
'tip' => __( 'Cut down on back-and-forth with clients.', 'formidable' ), |
|
65
|
|
|
'call' => __( 'Allow file uploads in your form.', 'formidable' ), |
|
66
|
|
|
), |
|
67
|
|
|
array( |
|
68
|
|
|
'link' => array( |
|
69
|
|
|
'content' => 'calculations', |
|
70
|
|
|
'anchor' => 'feature-wordpress-calculated-fields-form', |
|
71
|
|
|
), |
|
72
|
|
|
'tip' => __( 'Need to calculate a total?', 'formidable' ), |
|
73
|
|
|
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
|
74
|
|
|
), |
|
75
|
|
|
array( |
|
76
|
|
|
'link' => array( |
|
77
|
|
|
'content' => 'prefill-fields', |
|
78
|
|
|
'anchor' => 'feature-fill-out-forms-automatically', |
|
79
|
|
|
), |
|
80
|
|
|
'tip' => __( 'Save time.', 'formidable' ), |
|
81
|
|
|
'call' => __( 'Prefill fields with user info.', 'formidable' ), |
|
82
|
|
|
), |
|
83
|
|
|
); |
|
84
|
|
|
|
|
85
|
|
|
return $tips; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public static function get_form_settings_tip() { |
|
89
|
|
|
$tips = array( |
|
90
|
|
|
array( |
|
91
|
|
|
'link' => array( |
|
92
|
|
|
'content' => 'front-edit', |
|
93
|
|
|
'anchor' => 'feature-front-end-editing-wordpress', |
|
94
|
|
|
), |
|
95
|
|
|
'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ), |
|
96
|
|
|
'call' => __( 'Add front-end editing.', 'formidable' ), |
|
97
|
|
|
), |
|
98
|
|
|
array( |
|
99
|
|
|
'link' => array( |
|
100
|
|
|
'content' => 'front-edit-b', |
|
101
|
|
|
'anchor' => 'feature-user-submitted-posts-wordpress-forms', |
|
102
|
|
|
), |
|
103
|
|
|
'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ), |
|
104
|
|
|
'call' => __( 'Add front-end editing.', 'formidable' ), |
|
105
|
|
|
), |
|
106
|
|
|
array( |
|
107
|
|
|
'link' => array( |
|
108
|
|
|
'content' => 'save-drafts', |
|
109
|
|
|
'anchor' => 'feature-user-submitted-posts-wordpress-forms', |
|
110
|
|
|
), |
|
111
|
|
|
'tip' => __( 'Have a long form that takes time to complete?', 'formidable' ), |
|
112
|
|
|
'call' => __( 'Let logged-in users save a draft and return later.', 'formidable' ), |
|
113
|
|
|
), |
|
114
|
|
|
array( |
|
115
|
|
|
'link' => array( |
|
116
|
|
|
'content' => 'ajax', |
|
117
|
|
|
), |
|
118
|
|
|
'tip' => __( 'Want to submit forms without reloading the page?', 'formidable' ), |
|
119
|
|
|
'call' => __( 'Get ajax form submit.', 'formidable' ), |
|
120
|
|
|
), |
|
121
|
|
|
); |
|
122
|
|
|
return $tips; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
public static function get_form_action_tip() { |
|
126
|
|
|
$tips = array( |
|
127
|
|
|
array( |
|
128
|
|
|
'link' => array( |
|
129
|
|
|
'content' => 'email-routing', |
|
130
|
|
|
'anchor' => 'feature-email-autoresponders-wordpress', |
|
131
|
|
|
), |
|
132
|
|
|
'tip' => __( 'Save time by sending the email to the right person automatically.', 'formidable' ), |
|
133
|
|
|
'call' => __( 'Add email routing.', 'formidable' ), |
|
134
|
|
|
), |
|
135
|
|
|
array( |
|
136
|
|
|
'link' => array( |
|
137
|
|
|
'content' => 'create-posts', |
|
138
|
|
|
'anchor' => 'feature-user-submitted-posts-wordpress-forms', |
|
139
|
|
|
), |
|
140
|
|
|
'tip' => __( 'Create blog posts or pages from the front-end.', 'formidable' ), |
|
141
|
|
|
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
|
142
|
|
|
), |
|
143
|
|
|
array( |
|
144
|
|
|
'link' => array( |
|
145
|
|
|
'content' => 'user-submit', |
|
146
|
|
|
'anchor' => 'feature-user-submitted-posts-wordpress-forms', |
|
147
|
|
|
), |
|
148
|
|
|
'tip' => __( 'Make front-end posting easy.', 'formidable' ), |
|
149
|
|
|
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
|
150
|
|
|
), |
|
151
|
|
|
array( |
|
152
|
|
|
'link' => array( |
|
153
|
|
|
'content' => 'mailchimp', |
|
154
|
|
|
'page' => 'mailchimp-tip', |
|
155
|
|
|
), |
|
156
|
|
|
'tip' => __( 'Grow your business with automated email follow-up.', 'formidable' ), |
|
157
|
|
|
'call' => __( 'Send leads straight to MailChimp.', 'formidable' ), |
|
158
|
|
|
), |
|
159
|
|
|
array( |
|
160
|
|
|
'link' => array( |
|
161
|
|
|
'content' => 'paypal', |
|
162
|
|
|
'page' => 'paypal-tip', |
|
163
|
|
|
), |
|
164
|
|
|
'tip' => __( 'Save hours and increase revenue by collecting payments with every submission.', 'formidable' ), |
|
165
|
|
|
'call' => __( 'Use PayPal with this form.', 'formidable' ), |
|
166
|
|
|
), |
|
167
|
|
|
array( |
|
168
|
|
|
'link' => array( |
|
169
|
|
|
'content' => 'paypal-revenue', |
|
170
|
|
|
'page' => 'paypal-increase-revenue-tip', |
|
171
|
|
|
), |
|
172
|
|
|
'tip' => __( 'Increase revenue.', 'formidable' ), |
|
173
|
|
|
'call' => __( 'Use PayPal with this form.', 'formidable' ), |
|
174
|
|
|
), |
|
175
|
|
|
array( |
|
176
|
|
|
'link' => array( |
|
177
|
|
|
'content' => 'paypal-fast', |
|
178
|
|
|
'page' => 'paypal-save-time-tip', |
|
179
|
|
|
), |
|
180
|
|
|
'tip' => __( 'Get paid more quickly.', 'formidable' ), |
|
181
|
|
|
'call' => __( 'Use Paypal with this form.', 'formidable' ), |
|
182
|
|
|
), |
|
183
|
|
|
array( |
|
184
|
|
|
'link' => array( |
|
185
|
|
|
'content' => 'registration', |
|
186
|
|
|
'page' => 'registration-tip', |
|
187
|
|
|
), |
|
188
|
|
|
'tip' => __( 'Boost your site membership.', 'formidable' ), |
|
189
|
|
|
'call' => __( 'Automatically create user accounts.', 'formidable' ), |
|
190
|
|
|
), |
|
191
|
|
|
array( |
|
192
|
|
|
'link' => array( |
|
193
|
|
|
'content' => 'profile', |
|
194
|
|
|
'page' => 'registration-profile-editing-tip', |
|
195
|
|
|
), |
|
196
|
|
|
'tip' => __( 'Make front-end profile editing possible.', 'formidable' ), |
|
197
|
|
|
'call' => __( 'Add user registration.', 'formidable' ), |
|
198
|
|
|
), |
|
199
|
|
|
array( |
|
200
|
|
|
'link' => array( |
|
201
|
|
|
'content' => 'twilio-payment', |
|
202
|
|
|
'page' => 'twilio-tip', |
|
203
|
|
|
), |
|
204
|
|
|
'tip' => __( 'Want a text when this form is submitted or when a payment is received?', 'formidable' ), |
|
205
|
|
|
'call' => __( 'Use Twilio with this form.', 'formidable' ), |
|
206
|
|
|
), |
|
207
|
|
|
array( |
|
208
|
|
|
'link' => array( |
|
209
|
|
|
'content' => 'twilio', |
|
210
|
|
|
'page' => 'twilio-send-tip', |
|
211
|
|
|
), |
|
212
|
|
|
'tip' => __( 'Send a text when this form is submitted.', 'formidable' ), |
|
213
|
|
|
'call' => __( 'Get Twilio.', 'formidable' ), |
|
214
|
|
|
), |
|
215
|
|
|
); |
|
216
|
|
|
|
|
217
|
|
|
return $tips; |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
View Code Duplication |
public static function get_styling_tip() { |
|
|
|
|
|
|
221
|
|
|
$tips = array( |
|
222
|
|
|
array( |
|
223
|
|
|
'link' => array( |
|
224
|
|
|
'content' => 'style', |
|
225
|
|
|
'anchor' => 'feature-wordpress-visual-form-styler', |
|
226
|
|
|
), |
|
227
|
|
|
'tip' => __( 'Make your sidebar or footer form stand out.', 'formidable' ), |
|
228
|
|
|
'call' => __( 'Use multiple style templates.', 'formidable' ), |
|
229
|
|
|
), |
|
230
|
|
|
); |
|
231
|
|
|
return $tips; |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
public static function get_entries_tip() { |
|
235
|
|
|
$tips = array( |
|
236
|
|
|
array( |
|
237
|
|
|
'link' => array( |
|
238
|
|
|
'content' => 'entries', |
|
239
|
|
|
'anchor' => 'feature-form-entry-management-wordpress', |
|
240
|
|
|
), |
|
241
|
|
|
'tip' => __( 'Want to edit or delete form submissions?', 'formidable' ), |
|
242
|
|
|
'call' => __( 'Add entry management.', 'formidable' ), |
|
243
|
|
|
), |
|
244
|
|
|
array( |
|
245
|
|
|
'link' => array( |
|
246
|
|
|
'content' => 'entries-search', |
|
247
|
|
|
'anchor' => 'feature-form-entry-management-wordpress', |
|
248
|
|
|
), |
|
249
|
|
|
'tip' => __( 'Want to search submitted entries?', 'formidable' ), |
|
250
|
|
|
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
|
251
|
|
|
), |
|
252
|
|
|
); |
|
253
|
|
|
$tips = array_merge( $tips, self::get_import_tip() ); |
|
254
|
|
|
return $tips; |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
View Code Duplication |
public static function get_import_tip() { |
|
|
|
|
|
|
258
|
|
|
$tips = array( |
|
259
|
|
|
array( |
|
260
|
|
|
'link' => array( |
|
261
|
|
|
'content' => 'import', |
|
262
|
|
|
'anchor' => 'feature-importing-exporting-wordpress-forms', |
|
263
|
|
|
), |
|
264
|
|
|
'tip' => __( 'Want to import entries into your forms?', 'formidable' ), |
|
265
|
|
|
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
|
266
|
|
|
), |
|
267
|
|
|
); |
|
268
|
|
|
return $tips; |
|
269
|
|
|
} |
|
270
|
|
|
|
|
271
|
|
|
public static function get_banner_tip() { |
|
272
|
|
|
$tips = array( |
|
273
|
|
|
array( |
|
274
|
|
|
'link' => array( |
|
275
|
|
|
'medium' => 'banner', |
|
276
|
|
|
'content' => 'professional-results', |
|
277
|
|
|
), |
|
278
|
|
|
'tip' => __( 'Looking for more ways to get professional results?', 'formidable' ), |
|
279
|
|
|
'call' => __( 'Take your forms to the next level.', 'formidable' ), |
|
280
|
|
|
), |
|
281
|
|
|
array( |
|
282
|
|
|
'link' => array( |
|
283
|
|
|
'medium' => 'banner', |
|
284
|
|
|
'content' => 'increase-conversions', |
|
285
|
|
|
), |
|
286
|
|
|
'tip' => __( 'Increase conversions in long forms.', 'formidable' ), |
|
287
|
|
|
'call' => __( 'Add conditional logic, page breaks, and section headings.', 'formidable' ), |
|
288
|
|
|
), |
|
289
|
|
|
array( |
|
290
|
|
|
'link' => array( |
|
291
|
|
|
'medium' => 'banner', |
|
292
|
|
|
'content' => 'automate', |
|
293
|
|
|
), |
|
294
|
|
|
'tip' => __( 'Automate your business and increase revenue.', 'formidable' ), |
|
295
|
|
|
'call' => __( 'Collect instant payments, and send leads to MailChimp.', 'formidable' ), |
|
296
|
|
|
), |
|
297
|
|
|
); |
|
298
|
|
|
$random = rand( 0, count( $tips ) - 1 ); |
|
299
|
|
|
$tip = $tips[ $random ]; |
|
300
|
|
|
$tip['num'] = $random; |
|
301
|
|
|
return $tip; |
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
public static function get_random_tip( $tips ) { |
|
305
|
|
|
$random = rand( 0, count( $tips ) - 1 ); |
|
306
|
|
|
return $tips[ $random ]; |
|
307
|
|
|
} |
|
308
|
|
|
} |
|
309
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.