| @@ -26,10 +26,10 @@ | ||
| 26 | 26 | * Shows tip. |
| 27 | 27 | * |
| 28 | 28 | * @since 6.0 |
| 29 | 29 | * |
| 30 | - * @param array $tip { | |
| 31 | - * Tip args | |
| 30 | + * @param array $tip { | |
| 31 | + * Tip args. | |
| 32 | 32 | * |
| 33 | 33 | * @type array $link Tip link data. See the first parameter of {@see FrmAppHelper::admin_upgrade_link()} for more details. |
| 34 | 34 | * @type string $page The based link of the tip. If this is empty, `https://formidableforms.com/lite-upgrade/` will |
| 35 | 35 | * be used. Otherwise, `https://formidableforms.com/{$page}` will be used. |
| @@ -54,25 +54,21 @@ | ||
| 54 | 54 | if ( 'p' === $html ) { |
| 55 | 55 | echo '<p class="frmcenter ' . esc_attr( $tip['class'] ) . '">'; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $link = empty( $tip['link'] ) ? $tip['page'] : FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] ); | |
| 58 | + $link = self::get_tip_link( $tip ); | |
| 59 | 59 | ?> |
| 60 | - <a href="<?php echo esc_url( $link ); ?>" <?php echo empty( $tip['link'] ) ? '' : 'target="_blank"'; ?> class="frm_pro_tip"> | |
| 61 | - <?php FrmAppHelper::icon_by_class( 'frmfont frm_lightning', array( 'aria-hidden' => 'true' ) ); ?> | |
| 60 | + <a href="<?php echo esc_url( $link ); ?>" <?php echo empty( $tip['link'] ) ? '' : 'target="_blank"'; ?> class="frm_pro_tip frm-gradient"> | |
| 61 | + <span class="frm-tip-badge"><?php esc_html_e( 'PRO TIP', 'formidable' ); ?></span> | |
| 62 | 62 | |
| 63 | 63 | <?php if ( isset( $tip['call'] ) ) { ?> |
| 64 | 64 | <span class="frm-tip-info"> |
| 65 | 65 | <?php echo esc_html( $tip['tip'] ); ?> |
| 66 | 66 | </span> |
| 67 | - <span class="frm-tip-cta"> | |
| 68 | - <?php echo esc_html( $tip['call'] ); ?> | |
| 69 | - </span> | |
| 70 | - <?php } else { ?> | |
| 71 | - <span class="frm-tip-cta"> | |
| 72 | - <?php echo esc_html( $tip['tip'] ); ?> | |
| 73 | - </span> | |
| 74 | 67 | <?php } ?> |
| 68 | + <span class="frm-tip-cta"> | |
| 69 | + <?php echo esc_html( $tip['call'] ? $tip['call'] : $tip['tip'] ); ?> | |
| 70 | + </span> | |
| 75 | 71 | </a> |
| 76 | 72 | <?php |
| 77 | 73 | |
| 78 | 74 | if ( 'p' === $html ) { |
| @@ -80,8 +76,30 @@ | ||
| 80 | 76 | } |
| 81 | 77 | } |
| 82 | 78 | |
| 83 | 79 | /** |
| 80 | + * @since 6.21 | |
| 81 | + * | |
| 82 | + * @param array $tip | |
| 83 | + * @return string | |
| 84 | + */ | |
| 85 | + private static function get_tip_link( $tip ) { | |
| 86 | + if ( empty( $tip['tip'] ) ) { | |
| 87 | + return $tip['page']; | |
| 88 | + } | |
| 89 | + | |
| 90 | + $cta_link = FrmSalesApi::get_best_sale_value( 'pro_tip_cta_link' ); | |
| 91 | + if ( $cta_link ) { | |
| 92 | + if ( is_array( $tip['link'] ) ) { | |
| 93 | + $cta_link = FrmAppHelper::maybe_add_missing_utm( $cta_link, $tip['link'] ); | |
| 94 | + } | |
| 95 | + return $cta_link; | |
| 96 | + } | |
| 97 | + | |
| 98 | + return FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] ); | |
| 99 | + } | |
| 100 | + | |
| 101 | + /** | |
| 84 | 102 | * Use the correct label for the license. |
| 85 | 103 | * |
| 86 | 104 | * @since 6.5.1 |
| 87 | 105 | * |
| @@ -87,8 +105,12 @@ | ||
| 87 | 105 | * |
| 88 | 106 | * @return string |
| 89 | 107 | */ |
| 90 | 108 | private static function cta_label() { |
| 109 | + $cta_text = FrmSalesApi::get_best_sale_value( 'pro_tip_cta_text' ); | |
| 110 | + if ( $cta_text ) { | |
| 111 | + return $cta_text; | |
| 112 | + } | |
| 91 | 113 | return FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro.', 'formidable' ); |
| 92 | 114 | } |
| 93 | 115 | |
| 94 | 116 | /** |
| @@ -108,10 +130,10 @@ | ||
| 108 | 130 | 'link' => array( |
| 109 | 131 | 'content' => 'confirmation-fields', |
| 110 | 132 | 'param' => 'confirmation-fields-wordpress-forms', |
| 111 | 133 | ), |
| 112 | - 'tip' => __( 'Want to stop losing leads from email typos?', 'formidable' ), | |
| 113 | - 'call' => __( 'Add email confirmation fields.', 'formidable' ), | |
| 134 | + 'tip' => __( 'Eliminate input errors with email confirmation fields.', 'formidable' ), | |
| 135 | + 'call' => self::cta_label(), | |
| 114 | 136 | ), |
| 115 | 137 | array( |
| 116 | 138 | 'link' => array( |
| 117 | 139 | 'content' => 'page-breaks', |
| @@ -124,10 +146,10 @@ | ||
| 124 | 146 | 'link' => array( |
| 125 | 147 | 'content' => 'file-uploads', |
| 126 | 148 | 'param' => 'wordpress-multi-file-upload-fields', |
| 127 | 149 | ), |
| 128 | - 'tip' => __( 'Cut down on back-and-forth with clients.', 'formidable' ), | |
| 129 | - 'call' => __( 'Allow file uploads in your form.', 'formidable' ), | |
| 150 | + 'tip' => __( 'Skip the follow-ups. Let users upload files.', 'formidable' ), | |
| 151 | + 'call' => self::cta_label(), | |
| 130 | 152 | ), |
| 131 | 153 | array( |
| 132 | 154 | 'link' => array( |
| 133 | 155 | 'content' => 'calculations', |
| @@ -140,10 +162,10 @@ | ||
| 140 | 162 | 'link' => array( |
| 141 | 163 | 'content' => 'prefill-fields', |
| 142 | 164 | 'param' => 'auto-fill-forms', |
| 143 | 165 | ), |
| 144 | - 'tip' => __( 'Save time.', 'formidable' ), | |
| 145 | - 'call' => __( 'Fill out forms automatically!', 'formidable' ), | |
| 166 | + 'tip' => __( 'Save time with autofill forms.', 'formidable' ), | |
| 167 | + 'call' => self::cta_label(), | |
| 146 | 168 | ), |
| 147 | 169 | ); |
| 148 | 170 | |
| 149 | 171 | return $tips; |
| @@ -158,10 +180,10 @@ | ||
| 158 | 180 | 'link' => array( |
| 159 | 181 | 'content' => 'front-edit-b', |
| 160 | 182 | 'param' => 'wordpress-front-end-editing', |
| 161 | 183 | ), |
| 162 | - 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ), | |
| 163 | - 'call' => __( 'Add front-end editing.', 'formidable' ), | |
| 184 | + 'tip' => __( 'Make your site dynamic. Enable front-end editing.', 'formidable' ), | |
| 185 | + 'call' => self::cta_label(), | |
| 164 | 186 | ), |
| 165 | 187 | array( |
| 166 | 188 | 'link' => array( |
| 167 | 189 | 'content' => 'save-drafts', |
| @@ -166,10 +188,10 @@ | ||
| 166 | 188 | 'link' => array( |
| 167 | 189 | 'content' => 'save-drafts', |
| 168 | 190 | 'param' => 'save-drafts-wordpress-form', |
| 169 | 191 | ), |
| 170 | - 'tip' => __( 'Have long forms?', 'formidable' ), | |
| 171 | - 'call' => __( 'Let users save drafts and return later!', 'formidable' ), | |
| 192 | + 'tip' => __( 'Long form? Let users save and finish later', 'formidable' ), | |
| 193 | + 'call' => self::cta_label(), | |
| 172 | 194 | ), |
| 173 | 195 | array( |
| 174 | 196 | 'link' => array( |
| 175 | 197 | 'content' => 'form-scheduling', |
| @@ -174,10 +196,10 @@ | ||
| 174 | 196 | 'link' => array( |
| 175 | 197 | 'content' => 'form-scheduling', |
| 176 | 198 | 'param' => 'schedule-forms-wordpress', |
| 177 | 199 | ), |
| 178 | - 'tip' => __( 'Want your form open only for a certain time period?', 'formidable' ), | |
| 179 | - 'call' => __( 'Add form scheduling.', 'formidable' ), | |
| 200 | + 'tip' => __( 'Limit form access with built-in scheduling.', 'formidable' ), | |
| 201 | + 'call' => self::cta_label(), | |
| 180 | 202 | ), |
| 181 | 203 | ); |
| 182 | 204 | |
| 183 | 205 | return $tips; |
| @@ -192,10 +214,10 @@ | ||
| 192 | 214 | 'link' => array( |
| 193 | 215 | 'content' => 'email-routing', |
| 194 | 216 | 'param' => 'virtually-unlimited-emails', |
| 195 | 217 | ), |
| 196 | - 'tip' => __( 'Save time by sending the email to the right person automatically.', 'formidable' ), | |
| 197 | - 'call' => __( 'Add email routing.', 'formidable' ), | |
| 218 | + 'tip' => __( 'Save time — route emails to the right person automatically.', 'formidable' ), | |
| 219 | + 'call' => self::cta_label(), | |
| 198 | 220 | ), |
| 199 | 221 | array( |
| 200 | 222 | 'link' => array( |
| 201 | 223 | 'content' => 'create-posts', |
| @@ -216,10 +238,10 @@ | ||
| 216 | 238 | 'link' => array( |
| 217 | 239 | 'content' => 'mailchimp', |
| 218 | 240 | 'page' => 'mailchimp-tip', |
| 219 | 241 | ), |
| 220 | - 'tip' => __( 'Grow your business with automated email follow-up.', 'formidable' ), | |
| 221 | - 'call' => __( 'Send leads straight to Mailchimp.', 'formidable' ), | |
| 242 | + 'tip' => __( 'Send leads to Mailchimp for instant email follow-up.', 'formidable' ), | |
| 243 | + 'call' => self::cta_label(), | |
| 222 | 244 | ), |
| 223 | 245 | array( |
| 224 | 246 | 'link' => array( |
| 225 | 247 | 'content' => 'paypal-revenue', |
| @@ -224,10 +246,10 @@ | ||
| 224 | 246 | 'link' => array( |
| 225 | 247 | 'content' => 'paypal-revenue', |
| 226 | 248 | 'page' => 'paypal-increase-revenue-tip', |
| 227 | 249 | ), |
| 228 | - 'tip' => __( 'Increase revenue.', 'formidable' ), | |
| 229 | - 'call' => __( 'Use PayPal with this form.', 'formidable' ), | |
| 250 | + 'tip' => __( 'Accept PayPal payments and grow your sales.', 'formidable' ), | |
| 251 | + 'call' => self::cta_label(), | |
| 230 | 252 | ), |
| 231 | 253 | array( |
| 232 | 254 | 'link' => array( |
| 233 | 255 | 'content' => 'paypal-fast', |
| @@ -232,10 +254,10 @@ | ||
| 232 | 254 | 'link' => array( |
| 233 | 255 | 'content' => 'paypal-fast', |
| 234 | 256 | 'page' => 'paypal-save-time-tip', |
| 235 | 257 | ), |
| 236 | - 'tip' => __( 'Get paid instantly.', 'formidable' ), | |
| 237 | - 'call' => __( 'Use Paypal with this form.', 'formidable' ), | |
| 258 | + 'tip' => __( 'Accept payments now with PayPal integration.', 'formidable' ), | |
| 259 | + 'call' => self::cta_label(), | |
| 238 | 260 | ), |
| 239 | 261 | array( |
| 240 | 262 | 'link' => array( |
| 241 | 263 | 'content' => 'registration', |
| @@ -248,10 +270,10 @@ | ||
| 248 | 270 | 'link' => array( |
| 249 | 271 | 'content' => 'profile', |
| 250 | 272 | 'page' => 'registration-profile-editing-tip', |
| 251 | 273 | ), |
| 252 | - 'tip' => __( 'Need front-end profile editing?', 'formidable' ), | |
| 253 | - 'call' => __( 'Add user registration.', 'formidable' ), | |
| 274 | + 'tip' => __( 'Enable front-end profile editing with User Registration.', 'formidable' ), | |
| 275 | + 'call' => self::cta_label(), | |
| 254 | 276 | ), |
| 255 | 277 | array( |
| 256 | 278 | 'link' => array( |
| 257 | 279 | 'content' => 'twilio-payment', |
| @@ -256,10 +278,10 @@ | ||
| 256 | 278 | 'link' => array( |
| 257 | 279 | 'content' => 'twilio-payment', |
| 258 | 280 | 'page' => 'twilio-tip', |
| 259 | 281 | ), |
| 260 | - 'tip' => __( 'Want an SMS notification when a form is submitted or a payment received?', 'formidable' ), | |
| 261 | - 'call' => __( 'Get the Twilio integration.', 'formidable' ), | |
| 282 | + 'tip' => __( 'Get SMS alerts for form submissions and payments—just add Twilio.', 'formidable' ), | |
| 283 | + 'call' => self::cta_label(), | |
| 262 | 284 | ), |
| 263 | 285 | array( |
| 264 | 286 | 'link' => array( |
| 265 | 287 | 'content' => 'twilio', |
| @@ -264,10 +286,10 @@ | ||
| 264 | 286 | 'link' => array( |
| 265 | 287 | 'content' => 'twilio', |
| 266 | 288 | 'page' => 'twilio-send-tip', |
| 267 | 289 | ), |
| 268 | - 'tip' => __( 'Send an SMS message when a form is submitted.', 'formidable' ), | |
| 269 | - 'call' => __( 'Get the Twilio integration.', 'formidable' ), | |
| 290 | + 'tip' => __( 'Use Twilio to send SMS when forms are submitted.', 'formidable' ), | |
| 291 | + 'call' => self::cta_label(), | |
| 270 | 292 | ), |
| 271 | 293 | array( |
| 272 | 294 | 'link' => array( |
| 273 | 295 | 'content' => 'acf-tip', |
| @@ -272,10 +294,10 @@ | ||
| 272 | 294 | 'link' => array( |
| 273 | 295 | 'content' => 'acf-tip', |
| 274 | 296 | 'param' => 'acf-tip', |
| 275 | 297 | ), |
| 276 | - 'tip' => __( 'Fill Advanced Custom Fields from a form.', 'formidable' ), | |
| 277 | - 'call' => __( 'Add ACF Integration', 'formidable' ), | |
| 298 | + 'tip' => __( 'Fill Advanced Custom Fields automatically with form entries.', 'formidable' ), | |
| 299 | + 'call' => self::cta_label(), | |
| 278 | 300 | ), |
| 279 | 301 | ); |
| 280 | 302 | |
| 281 | 303 | return $tips; |
| @@ -290,10 +312,10 @@ | ||
| 290 | 312 | 'link' => array( |
| 291 | 313 | 'content' => 'style', |
| 292 | 314 | 'param' => 'wordpress-visual-form-styler', |
| 293 | 315 | ), |
| 294 | - 'tip' => __( 'Make your sidebar and footer forms stand out.', 'formidable' ), | |
| 295 | - 'call' => __( 'Use multiple style templates.', 'formidable' ), | |
| 316 | + 'tip' => __( 'Make your forms stand out with multiple style templates.', 'formidable' ), | |
| 317 | + 'call' => self::cta_label(), | |
| 296 | 318 | ), |
| 297 | 319 | array( |
| 298 | 320 | 'link' => array( |
| 299 | 321 | 'content' => 'style', |
| @@ -324,10 +346,10 @@ | ||
| 324 | 346 | 'link' => array( |
| 325 | 347 | 'content' => 'entries', |
| 326 | 348 | 'param' => 'form-entry-management-wordpress', |
| 327 | 349 | ), |
| 328 | - 'tip' => __( 'Want to edit form submissions?', 'formidable' ), | |
| 329 | - 'call' => __( 'Add entry management.', 'formidable' ), | |
| 350 | + 'tip' => __( 'Edit form entries anytime with entry management.', 'formidable' ), | |
| 351 | + 'call' => self::cta_label(), | |
| 330 | 352 | ), |
| 331 | 353 | array( |
| 332 | 354 | 'link' => array( |
| 333 | 355 | 'content' => 'entries-search', |
| @@ -340,10 +362,10 @@ | ||
| 340 | 362 | 'link' => array( |
| 341 | 363 | 'content' => 'views', |
| 342 | 364 | 'param' => 'views-display-form-data', |
| 343 | 365 | ), |
| 344 | - 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ), | |
| 345 | - 'call' => __( 'Display form data with Views.', 'formidable' ), | |
| 366 | + 'tip' => __( 'Turn entries into dynamic content — no code needed.', 'formidable' ), | |
| 367 | + 'call' => self::cta_label(), | |
| 346 | 368 | ), |
| 347 | 369 | ); |
| 348 | 370 | $tips = array_merge( $tips, self::get_import_tip() ); |
| 349 | 371 | |
| @@ -367,47 +389,68 @@ | ||
| 367 | 389 | |
| 368 | 390 | return $tips; |
| 369 | 391 | } |
| 370 | 392 | |
| 393 | + public static function get_random_tip( $tips ) { | |
| 394 | + $random = rand( 0, count( $tips ) - 1 ); | |
| 395 | + | |
| 396 | + return $tips[ $random ]; | |
| 397 | + } | |
| 398 | + | |
| 371 | 399 | /** |
| 372 | - * @return array | |
| 400 | + * Displays a call-to-action section in the admin area. | |
| 401 | + * | |
| 402 | + * @since 6.7 | |
| 403 | + * | |
| 404 | + * @param array $args { | |
| 405 | + * An array of arguments to configure the call-to-action section. | |
| 406 | + * | |
| 407 | + * @type string $title The title of the section. | |
| 408 | + * @type string $description The description of the section. | |
| 409 | + * @type string $link_text The text for the link. | |
| 410 | + * @type string $link_url The URL for the link. | |
| 411 | + * @type string $role The required user role to view the section. Default 'administrator'. | |
| 412 | + * } | |
| 413 | + * | |
| 414 | + * @return void | |
| 373 | 415 | */ |
| 374 | - public static function get_banner_tip() { | |
| 375 | - $tips = array( | |
| 376 | - array( | |
| 377 | - 'link' => array( | |
| 378 | - 'medium' => 'banner', | |
| 379 | - 'content' => 'professional-results', | |
| 380 | - ), | |
| 381 | - 'tip' => __( 'Looking for more ways to get professional results?', 'formidable' ), | |
| 382 | - 'call' => __( 'Take your forms to the next level.', 'formidable' ), | |
| 383 | - ), | |
| 384 | - array( | |
| 385 | - 'link' => array( | |
| 386 | - 'medium' => 'banner', | |
| 387 | - 'content' => 'increase-conversions', | |
| 388 | - ), | |
| 389 | - 'tip' => __( 'Increase conversions in long forms.', 'formidable' ), | |
| 390 | - 'call' => __( 'Add conditional logic, page breaks, and section headings.', 'formidable' ), | |
| 391 | - ), | |
| 392 | - array( | |
| 393 | - 'link' => array( | |
| 394 | - 'medium' => 'banner', | |
| 395 | - 'content' => 'automate', | |
| 396 | - ), | |
| 397 | - 'tip' => __( 'Automate your business and increase revenue.', 'formidable' ), | |
| 398 | - 'call' => __( 'Collect instant payments, and send leads to Mailchimp.', 'formidable' ), | |
| 399 | - ), | |
| 416 | + public static function show_admin_cta( $args ) { | |
| 417 | + $role = ! empty( $args['role'] ) ? $args['role'] : 'administrator'; | |
| 418 | + | |
| 419 | + if ( ! current_user_can( $role ) ) { | |
| 420 | + // Return early if the user doesn't have the required capability. | |
| 421 | + return; | |
| 422 | + } | |
| 423 | + | |
| 424 | + $defaults = array( | |
| 425 | + 'title' => '', | |
| 426 | + 'description' => '', | |
| 427 | + 'link_text' => '', | |
| 428 | + 'link_url' => '#', | |
| 429 | + 'class' => '', | |
| 430 | + 'id' => '', | |
| 431 | + 'target' => '_blank', | |
| 400 | 432 | ); |
| 401 | - $random = rand( 0, count( $tips ) - 1 ); | |
| 402 | - $tip = $tips[ $random ]; | |
| 403 | - $tip['num'] = $random; | |
| 404 | 433 | |
| 405 | - return $tip; | |
| 434 | + $args = wp_parse_args( $args, $defaults ); | |
| 435 | + | |
| 436 | + $attributes = array( | |
| 437 | + 'class' => trim( 'frm-cta frm-flex frm-p-sm ' . $args['class'] ), | |
| 438 | + ); | |
| 439 | + | |
| 440 | + if ( $args['id'] ) { | |
| 441 | + $attributes['id'] = $args['id']; | |
| 442 | + } | |
| 443 | + | |
| 444 | + require FrmAppHelper::plugin_path() . '/classes/views/shared/admin-cta.php'; | |
| 406 | 445 | } |
| 407 | 446 | |
| 408 | - public static function get_random_tip( $tips ) { | |
| 409 | - $random = rand( 0, count( $tips ) - 1 ); | |
| 410 | - | |
| 411 | - return $tips[ $random ]; | |
| 447 | + /** | |
| 448 | + * @deprecated 6.21 | |
| 449 | + * | |
| 450 | + * @return array | |
| 451 | + */ | |
| 452 | + public static function get_banner_tip() { | |
| 453 | + _deprecated_function( __METHOD__, '6.21' ); | |
| 454 | + return array(); | |
| 412 | 455 | } |
| 413 | 456 | } |