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