| 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 |
?> |
| 18 |
<a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( self::base_url() . $tip['link'] ) ) ?>" target="_blank" class="frm_pro_tip"> |
| 19 |
<span><i class="frm_icon_font frm_check1_icon"></i> Pro Tip:</span> |
| 20 |
<?php echo esc_html( $tip['tip'] ) ?> |
| 21 |
<?php if ( isset( $tip['call'] ) ) { ?> |
| 22 |
<span><?php echo esc_html( $tip['call'] ) ?></span> |
| 23 |
<?php } ?> |
| 24 |
</a> |
| 25 |
<?php |
| 26 |
if ( 'p' === $html ) { |
| 27 |
echo '</p>'; |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
private static function base_url() { |
| 32 |
return 'https://formidableforms.com/'; |
| 33 |
} |
| 34 |
|
| 35 |
public static function get_builder_tip() { |
| 36 |
$tips = array( |
| 37 |
array( |
| 38 |
'link' => 'section-tip', |
| 39 |
'tip' => __( 'Long forms can still be beautiful with sections.', 'formidable' ), |
| 40 |
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
| 41 |
), |
| 42 |
array( |
| 43 |
'link' => 'conditional-logic-tip', |
| 44 |
'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ), |
| 45 |
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
| 46 |
), |
| 47 |
array( |
| 48 |
'link' => 'page-break-tip', |
| 49 |
'tip' => __( 'Stop intimidating users with long forms.', 'formidable' ), |
| 50 |
'call' => __( 'Use page breaks.', 'formidable' ), |
| 51 |
), |
| 52 |
array( |
| 53 |
'link' => 'file-upload-tip', |
| 54 |
'tip' => __( 'Cut down on back-and-forth with clients.', 'formidable' ), |
| 55 |
'call' => __( 'Allow file uploads in your form.', 'formidable' ), |
| 56 |
), |
| 57 |
array( |
| 58 |
'link' => 'calculations-total-tip', |
| 59 |
'tip' => __( 'Need to calculate a total?', 'formidable' ), |
| 60 |
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
| 61 |
), |
| 62 |
array( |
| 63 |
'link' => 'prefill-fields', |
| 64 |
'tip' => __( 'Save time.', 'formidable' ), |
| 65 |
'call' => __( 'Prefill fields with user info.', 'formidable' ), |
| 66 |
), |
| 67 |
); |
| 68 |
$tips = array_merge( $tips, self::get_form_settings_tip(), self::get_form_action_tip(), self::get_entries_tip() ); |
| 69 |
|
| 70 |
return $tips; |
| 71 |
} |
| 72 |
|
| 73 |
public static function get_form_settings_tip() { |
| 74 |
$tips = array( |
| 75 |
array( |
| 76 |
'link' => 'front-end-editing-tip', |
| 77 |
'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ), |
| 78 |
'call' => __( 'Add front-end editing.', 'formidable' ), |
| 79 |
), |
| 80 |
array( |
| 81 |
'link' => 'front-end-editing-b-tip', |
| 82 |
'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ), |
| 83 |
'call' => __( 'Add front-end editing.', 'formidable' ), |
| 84 |
), |
| 85 |
array( |
| 86 |
'link' => 'save-drafts-tip', |
| 87 |
'tip' => __( 'Have a long form that takes time to complete?', 'formidable' ), |
| 88 |
'call' => __( 'Let logged-in users save a draft and return later.', 'formidable' ), |
| 89 |
), |
| 90 |
); |
| 91 |
return $tips; |
| 92 |
} |
| 93 |
|
| 94 |
public static function get_form_action_tip() { |
| 95 |
$tips = array( |
| 96 |
array( |
| 97 |
'link' => 'email-routing-tip', |
| 98 |
'tip' => __( 'Save time by sending the email to the right person automatically.', 'formidable' ), |
| 99 |
'call' => __( 'Add email routing.', 'formidable' ), |
| 100 |
), |
| 101 |
array( |
| 102 |
'link' => 'create-posts-tip', |
| 103 |
'tip' => __( 'Create blog posts or pages from the front-end.', 'formidable' ), |
| 104 |
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
| 105 |
), |
| 106 |
array( |
| 107 |
'link' => 'front-end-posting-tip', |
| 108 |
'tip' => __( 'Make front-end posting easy.', 'formidable' ), |
| 109 |
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
| 110 |
), |
| 111 |
array( |
| 112 |
'link' => 'mailchimp-tip', |
| 113 |
'tip' => __( 'Grow your business with automated email follow-up.', 'formidable' ), |
| 114 |
'call' => __( 'Send leads straight to MailChimp.', 'formidable' ), |
| 115 |
), |
| 116 |
array( |
| 117 |
'link' => 'paypal-tip', |
| 118 |
'tip' => __( 'Save hours and increase revenue by collecting payments with every submission.', 'formidable' ), |
| 119 |
'call' => __( 'Use PayPal with this form.', 'formidable' ), |
| 120 |
), |
| 121 |
array( |
| 122 |
'link' => 'paypal-increase-revenue-tip', |
| 123 |
'tip' => __( 'Increase revenue.', 'formidable' ), |
| 124 |
'call' => __( 'Use PayPal with this form.', 'formidable' ), |
| 125 |
), |
| 126 |
array( |
| 127 |
'link' => 'paypal-save-time-tip', |
| 128 |
'tip' => __( 'Get paid more quickly.', 'formidable' ), |
| 129 |
'call' => __( 'Use Paypal with this form.', 'formidable' ), |
| 130 |
), |
| 131 |
array( |
| 132 |
'link' => 'registration-tip', |
| 133 |
'tip' => __( 'Boost your site membership.', 'formidable' ), |
| 134 |
'call' => __( 'Automatically create user accounts.', 'formidable' ), |
| 135 |
), |
| 136 |
array( |
| 137 |
'link' => 'registration-profile-editing-tip', |
| 138 |
'tip' => __( 'Make front-end profile editing possible.', 'formidable' ), |
| 139 |
'call' => __( 'Add user registration.', 'formidable' ), |
| 140 |
), |
| 141 |
array( |
| 142 |
'link' => 'twilio-tip', |
| 143 |
'tip' => __( 'Want a text when this form is submitted or when a payment is received?', 'formidable' ), |
| 144 |
'call' => __( 'Use Twilio with this form.', 'formidable' ), |
| 145 |
), |
| 146 |
array( |
| 147 |
'link' => 'twilio-send-tip', |
| 148 |
'tip' => __( 'Send a text when this form is submitted.', 'formidable' ), |
| 149 |
'call' => __( 'Get Twilio.', 'formidable' ), |
| 150 |
), |
| 151 |
); |
| 152 |
|
| 153 |
return $tips; |
| 154 |
} |
| 155 |
|
| 156 |
public static function get_styling_tip() { |
| 157 |
$tips = array( |
| 158 |
array( |
| 159 |
'link' => 'visual-styling-tip', |
| 160 |
'tip' => __( 'Make your sidebar or footer form stand out.', 'formidable' ), |
| 161 |
'call' => __( 'Use multiple style templates.', 'formidable' ), |
| 162 |
), |
| 163 |
); |
| 164 |
return $tips; |
| 165 |
} |
| 166 |
|
| 167 |
public static function get_entries_tip() { |
| 168 |
$tips = array( |
| 169 |
array( |
| 170 |
'link' => 'manage-entries-tip', |
| 171 |
'tip' => __( 'Want to edit or delete form submissions?', 'formidable' ), |
| 172 |
'call' => __( 'Add entry management.', 'formidable' ), |
| 173 |
), |
| 174 |
array( |
| 175 |
'link' => 'search-entries-tip', |
| 176 |
'tip' => __( 'Want to search submitted entries?', 'formidable' ), |
| 177 |
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
| 178 |
), |
| 179 |
); |
| 180 |
$tips = array_merge( $tips, self::get_import_tip() ); |
| 181 |
return $tips; |
| 182 |
} |
| 183 |
|
| 184 |
public static function get_import_tip() { |
| 185 |
$tips = array( |
| 186 |
array( |
| 187 |
'link' => 'import-entries-tip/', |
| 188 |
'tip' => __( 'Want to import entries into your forms?', 'formidable' ), |
| 189 |
'call' => __( 'Upgrade to Pro.', 'formidable' ), |
| 190 |
), |
| 191 |
); |
| 192 |
return $tips; |
| 193 |
} |
| 194 |
|
| 195 |
public static function get_banner_tip() { |
| 196 |
$tips = array( |
| 197 |
array( |
| 198 |
'link' => '', |
| 199 |
'tip' => __( 'Looking for more options to get professional results?', 'formidable' ), |
| 200 |
'call' => __( 'Take your forms to the next level.', 'formidable' ), |
| 201 |
), |
| 202 |
array( |
| 203 |
'link' => '', |
| 204 |
'tip' => __( 'Increase conversions in your long forms.', 'formidable' ), |
| 205 |
'call' => __( 'Add conditional logic, page breaks, and section headings.', 'formidable' ), |
| 206 |
), |
| 207 |
array( |
| 208 |
'link' => '', |
| 209 |
'tip' => __( 'Automate your business and increase revenue.', 'formidable' ), |
| 210 |
'call' => __( 'Collect instant payments, and send leads to MailChimp.', 'formidable' ), |
| 211 |
), |
| 212 |
); |
| 213 |
$random = rand( 0, count( $tips ) - 1 ); |
| 214 |
$tip = $tips[ $random ]; |
| 215 |
$tip['num'] = $random; |
| 216 |
return $tip; |
| 217 |
} |
| 218 |
|
| 219 |
public static function get_random_tip( $tips ) { |
| 220 |
$random = rand( 0, count( $tips ) - 1 ); |
| 221 |
return $tips[ $random ]; |
| 222 |
} |
| 223 |
} |
| 224 |
|