| @@ -4,14 +4,8 @@ | ||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | class FrmTipsHelper { |
| 7 | 7 | |
| 8 | - /** | |
| 9 | - * @param string $callback | |
| 10 | - * @param string $html | |
| 11 | - * | |
| 12 | - * @return void | |
| 13 | - */ | |
| 14 | 8 | public static function pro_tip( $callback, $html = '' ) { |
| 15 | 9 | if ( FrmAppHelper::pro_is_installed() ) { |
| 16 | 10 | return; |
| 17 | 11 | } |
| @@ -18,47 +12,22 @@ | ||
| 18 | 12 | |
| 19 | 13 | $tips = self::$callback(); |
| 20 | 14 | $tip = self::get_random_tip( $tips ); |
| 21 | 15 | |
| 22 | - self::show_tip( $tip, $html ); | |
| 23 | - } | |
| 16 | + if ( 'p' === $html ) { | |
| 17 | + echo '<p class="frmcenter frm_no_top_margin">'; | |
| 18 | + } | |
| 24 | 19 | |
| 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 | - $defaults = array( | |
| 45 | - 'page' => '', | |
| 46 | - 'class' => 'frm-mt-0', | |
| 47 | - ); | |
| 48 | - $tip = array_merge( $defaults, $tip ); | |
| 49 | - | |
| 50 | - if ( isset( $tip['link'] ) && ! isset( $tip['link']['medium'] ) ) { | |
| 20 | + if ( ! isset( $tip['page'] ) ) { | |
| 21 | + $tip['page'] = ''; | |
| 22 | + } | |
| 23 | + if ( ! isset( $tip['link']['medium'] ) ) { | |
| 51 | 24 | $tip['link']['medium'] = 'tip'; |
| 52 | 25 | } |
| 53 | 26 | |
| 54 | - if ( 'p' === $html ) { | |
| 55 | - echo '<p class="frmcenter ' . esc_attr( $tip['class'] ) . '">'; | |
| 56 | - } | |
| 57 | - | |
| 58 | - $link = empty( $tip['link'] ) ? $tip['page'] : FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] ); | |
| 27 | + $link = FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] ); | |
| 59 | 28 | ?> |
| 60 | - <a href="<?php echo esc_url( $link ); ?>" <?php echo empty( $tip['link'] ) ? '' : 'target="_blank"'; ?> class="frm_pro_tip"> | |
| 29 | + <a href="<?php echo esc_url( $link ); ?>" target="_blank" class="frm_pro_tip"> | |
| 61 | 30 | <?php FrmAppHelper::icon_by_class( 'frmfont frm_lightning', array( 'aria-hidden' => 'true' ) ); ?> |
| 62 | 31 | |
| 63 | 32 | <?php if ( isset( $tip['call'] ) ) { ?> |
| 64 | 33 | <span class="frm-tip-info"> |
| @@ -73,28 +42,13 @@ | ||
| 73 | 42 | </span> |
| 74 | 43 | <?php } ?> |
| 75 | 44 | </a> |
| 76 | 45 | <?php |
| 77 | - | |
| 78 | 46 | if ( 'p' === $html ) { |
| 79 | 47 | echo '</p>'; |
| 80 | 48 | } |
| 81 | 49 | } |
| 82 | 50 | |
| 83 | - /** | |
| 84 | - * Use the correct label for the license. | |
| 85 | - * | |
| 86 | - * @since 6.5.1 | |
| 87 | - * | |
| 88 | - * @return string | |
| 89 | - */ | |
| 90 | - private static function cta_label() { | |
| 91 | - return FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro.', 'formidable' ); | |
| 92 | - } | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * @return array | |
| 96 | - */ | |
| 97 | 51 | public static function get_builder_tip() { |
| 98 | 52 | $tips = array( |
| 99 | 53 | array( |
| 100 | 54 | 'link' => array( |
| @@ -101,9 +55,9 @@ | ||
| 101 | 55 | 'content' => 'conditional-logic', |
| 102 | 56 | 'param' => 'conditional-logic-wordpress-forms', |
| 103 | 57 | ), |
| 104 | 58 | 'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ), |
| 105 | - 'call' => self::cta_label(), | |
| 59 | + 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 106 | 60 | ), |
| 107 | 61 | array( |
| 108 | 62 | 'link' => array( |
| 109 | 63 | 'content' => 'confirmation-fields', |
| @@ -117,9 +71,9 @@ | ||
| 117 | 71 | 'content' => 'page-breaks', |
| 118 | 72 | 'param' => 'wordpress-multi-page-forms', |
| 119 | 73 | ), |
| 120 | 74 | 'tip' => __( 'Use page breaks for easier forms.', 'formidable' ), |
| 121 | - 'call' => self::cta_label(), | |
| 75 | + 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 122 | 76 | ), |
| 123 | 77 | array( |
| 124 | 78 | 'link' => array( |
| 125 | 79 | 'content' => 'file-uploads', |
| @@ -133,9 +87,9 @@ | ||
| 133 | 87 | 'content' => 'calculations', |
| 134 | 88 | 'param' => 'field-calculations-wordpress-form', |
| 135 | 89 | ), |
| 136 | 90 | 'tip' => __( 'Need to calculate a total?', 'formidable' ), |
| 137 | - 'call' => self::cta_label(), | |
| 91 | + 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 138 | 92 | ), |
| 139 | 93 | array( |
| 140 | 94 | 'link' => array( |
| 141 | 95 | 'content' => 'prefill-fields', |
| @@ -148,11 +102,8 @@ | ||
| 148 | 102 | |
| 149 | 103 | return $tips; |
| 150 | 104 | } |
| 151 | 105 | |
| 152 | - /** | |
| 153 | - * @return array | |
| 154 | - */ | |
| 155 | 106 | public static function get_form_settings_tip() { |
| 156 | 107 | $tips = array( |
| 157 | 108 | array( |
| 158 | 109 | 'link' => array( |
| @@ -182,11 +133,8 @@ | ||
| 182 | 133 | |
| 183 | 134 | return $tips; |
| 184 | 135 | } |
| 185 | 136 | |
| 186 | - /** | |
| 187 | - * @return array | |
| 188 | - */ | |
| 189 | 137 | public static function get_form_action_tip() { |
| 190 | 138 | $tips = array( |
| 191 | 139 | array( |
| 192 | 140 | 'link' => array( |
| @@ -201,9 +149,9 @@ | ||
| 201 | 149 | 'content' => 'create-posts', |
| 202 | 150 | 'param' => 'create-posts-pages-wordpress-forms', |
| 203 | 151 | ), |
| 204 | 152 | 'tip' => __( 'Create blog posts or pages from the front-end.', 'formidable' ), |
| 205 | - 'call' => self::cta_label(), | |
| 153 | + 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 206 | 154 | ), |
| 207 | 155 | array( |
| 208 | 156 | 'link' => array( |
| 209 | 157 | 'content' => 'user-submit', |
| @@ -209,9 +157,9 @@ | ||
| 209 | 157 | 'content' => 'user-submit', |
| 210 | 158 | 'param' => 'create-posts-pages-wordpress-forms', |
| 211 | 159 | ), |
| 212 | 160 | 'tip' => __( 'Let your users submit posts on the front-end.', 'formidable' ), |
| 213 | - 'call' => self::cta_label(), | |
| 161 | + 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 214 | 162 | ), |
| 215 | 163 | array( |
| 216 | 164 | 'link' => array( |
| 217 | 165 | 'content' => 'mailchimp', |
| @@ -217,9 +165,9 @@ | ||
| 217 | 165 | 'content' => 'mailchimp', |
| 218 | 166 | 'page' => 'mailchimp-tip', |
| 219 | 167 | ), |
| 220 | 168 | 'tip' => __( 'Grow your business with automated email follow-up.', 'formidable' ), |
| 221 | - 'call' => __( 'Send leads straight to Mailchimp.', 'formidable' ), | |
| 169 | + 'call' => __( 'Send leads straight to MailChimp.', 'formidable' ), | |
| 222 | 170 | ), |
| 223 | 171 | array( |
| 224 | 172 | 'link' => array( |
| 225 | 173 | 'content' => 'paypal-revenue', |
| @@ -267,16 +215,8 @@ | ||
| 267 | 215 | ), |
| 268 | 216 | 'tip' => __( 'Send an SMS message when a form is submitted.', 'formidable' ), |
| 269 | 217 | 'call' => __( 'Get the Twilio integration.', 'formidable' ), |
| 270 | 218 | ), |
| 271 | - array( | |
| 272 | - 'link' => array( | |
| 273 | - 'content' => 'acf-tip', | |
| 274 | - 'param' => 'acf-tip', | |
| 275 | - ), | |
| 276 | - 'tip' => __( 'Fill Advanced Custom Fields from a form.', 'formidable' ), | |
| 277 | - 'call' => __( 'Add ACF Integration', 'formidable' ), | |
| 278 | - ), | |
| 279 | 219 | ); |
| 280 | 220 | |
| 281 | 221 | return $tips; |
| 282 | 222 | } |
| @@ -299,9 +239,9 @@ | ||
| 299 | 239 | 'content' => 'style', |
| 300 | 240 | 'param' => 'bg-image-style-settings', |
| 301 | 241 | ), |
| 302 | 242 | 'tip' => __( 'Want to add a background image?', 'formidable' ), |
| 303 | - 'call' => self::cta_label(), | |
| 243 | + 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 304 | 244 | ), |
| 305 | 245 | array( |
| 306 | 246 | 'link' => array( |
| 307 | 247 | 'content' => 'style', |
| @@ -307,9 +247,9 @@ | ||
| 307 | 247 | 'content' => 'style', |
| 308 | 248 | 'param' => 'duplicate-style', |
| 309 | 249 | ), |
| 310 | 250 | 'tip' => __( 'Want to duplicate a style?', 'formidable' ), |
| 311 | - 'call' => self::cta_label(), | |
| 251 | + 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 312 | 252 | ), |
| 313 | 253 | ); |
| 314 | 254 | |
| 315 | 255 | return $tips; |
| @@ -314,11 +254,8 @@ | ||
| 314 | 254 | |
| 315 | 255 | return $tips; |
| 316 | 256 | } |
| 317 | 257 | |
| 318 | - /** | |
| 319 | - * @return array | |
| 320 | - */ | |
| 321 | 258 | public static function get_entries_tip() { |
| 322 | 259 | $tips = array( |
| 323 | 260 | array( |
| 324 | 261 | 'link' => array( |
| @@ -333,9 +270,9 @@ | ||
| 333 | 270 | 'content' => 'entries-search', |
| 334 | 271 | 'param' => 'form-entry-management-wordpress', |
| 335 | 272 | ), |
| 336 | 273 | 'tip' => __( 'Want to search submitted entries?', 'formidable' ), |
| 337 | - 'call' => self::cta_label(), | |
| 274 | + 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 338 | 275 | ), |
| 339 | 276 | array( |
| 340 | 277 | 'link' => array( |
| 341 | 278 | 'content' => 'views', |
| @@ -349,11 +286,8 @@ | ||
| 349 | 286 | |
| 350 | 287 | return $tips; |
| 351 | 288 | } |
| 352 | 289 | |
| 353 | - /** | |
| 354 | - * @return array | |
| 355 | - */ | |
| 356 | 290 | public static function get_import_tip() { |
| 357 | 291 | $tips = array( |
| 358 | 292 | array( |
| 359 | 293 | 'link' => array( |
| @@ -360,9 +294,9 @@ | ||
| 360 | 294 | 'content' => 'import', |
| 361 | 295 | 'param' => 'importing-exporting-wordpress-forms', |
| 362 | 296 | ), |
| 363 | 297 | 'tip' => __( 'Want to import entries into your forms?', 'formidable' ), |
| 364 | - 'call' => self::cta_label(), | |
| 298 | + 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 365 | 299 | ), |
| 366 | 300 | ); |
| 367 | 301 | |
| 368 | 302 | return $tips; |
| @@ -367,11 +301,8 @@ | ||
| 367 | 301 | |
| 368 | 302 | return $tips; |
| 369 | 303 | } |
| 370 | 304 | |
| 371 | - /** | |
| 372 | - * @return array | |
| 373 | - */ | |
| 374 | 305 | public static function get_banner_tip() { |
| 375 | 306 | $tips = array( |
| 376 | 307 | array( |
| 377 | 308 | 'link' => array( |
| @@ -394,9 +325,9 @@ | ||
| 394 | 325 | 'medium' => 'banner', |
| 395 | 326 | 'content' => 'automate', |
| 396 | 327 | ), |
| 397 | 328 | 'tip' => __( 'Automate your business and increase revenue.', 'formidable' ), |
| 398 | - 'call' => __( 'Collect instant payments, and send leads to Mailchimp.', 'formidable' ), | |
| 329 | + 'call' => __( 'Collect instant payments, and send leads to MailChimp.', 'formidable' ), | |
| 399 | 330 | ), |
| 400 | 331 | ); |
| 401 | 332 | $random = rand( 0, count( $tips ) - 1 ); |
| 402 | 333 | $tip = $tips[ $random ]; |