| @@ -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,45 @@ | ||
| 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 | + /** | |
| 102 | + * Use the correct label for the license. | |
| 103 | + * | |
| 104 | + * @since 6.5.1 | |
| 105 | + * | |
| 106 | + * @return string | |
| 107 | + */ | |
| 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 | + } | |
| 113 | + return FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro.', 'formidable' ); | |
| 114 | + } | |
| 115 | + | |
| 116 | + /** | |
| 84 | 117 | * @return array |
| 85 | 118 | */ |
| 86 | 119 | public static function get_builder_tip() { |
| 87 | 120 | $tips = array( |
| @@ -90,9 +123,9 @@ | ||
| 90 | 123 | 'content' => 'conditional-logic', |
| 91 | 124 | 'param' => 'conditional-logic-wordpress-forms', |
| 92 | 125 | ), |
| 93 | 126 | 'tip' => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ), |
| 94 | - 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 127 | + 'call' => self::cta_label(), | |
| 95 | 128 | ), |
| 96 | 129 | array( |
| 97 | 130 | 'link' => array( |
| 98 | 131 | 'content' => 'confirmation-fields', |
| @@ -97,10 +130,10 @@ | ||
| 97 | 130 | 'link' => array( |
| 98 | 131 | 'content' => 'confirmation-fields', |
| 99 | 132 | 'param' => 'confirmation-fields-wordpress-forms', |
| 100 | 133 | ), |
| 101 | - 'tip' => __( 'Want to stop losing leads from email typos?', 'formidable' ), | |
| 102 | - 'call' => __( 'Add email confirmation fields.', 'formidable' ), | |
| 134 | + 'tip' => __( 'Eliminate input errors with email confirmation fields.', 'formidable' ), | |
| 135 | + 'call' => self::cta_label(), | |
| 103 | 136 | ), |
| 104 | 137 | array( |
| 105 | 138 | 'link' => array( |
| 106 | 139 | 'content' => 'page-breaks', |
| @@ -106,9 +139,9 @@ | ||
| 106 | 139 | 'content' => 'page-breaks', |
| 107 | 140 | 'param' => 'wordpress-multi-page-forms', |
| 108 | 141 | ), |
| 109 | 142 | 'tip' => __( 'Use page breaks for easier forms.', 'formidable' ), |
| 110 | - 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 143 | + 'call' => self::cta_label(), | |
| 111 | 144 | ), |
| 112 | 145 | array( |
| 113 | 146 | 'link' => array( |
| 114 | 147 | 'content' => 'file-uploads', |
| @@ -113,10 +146,10 @@ | ||
| 113 | 146 | 'link' => array( |
| 114 | 147 | 'content' => 'file-uploads', |
| 115 | 148 | 'param' => 'wordpress-multi-file-upload-fields', |
| 116 | 149 | ), |
| 117 | - 'tip' => __( 'Cut down on back-and-forth with clients.', 'formidable' ), | |
| 118 | - 'call' => __( 'Allow file uploads in your form.', 'formidable' ), | |
| 150 | + 'tip' => __( 'Skip the follow-ups. Let users upload files.', 'formidable' ), | |
| 151 | + 'call' => self::cta_label(), | |
| 119 | 152 | ), |
| 120 | 153 | array( |
| 121 | 154 | 'link' => array( |
| 122 | 155 | 'content' => 'calculations', |
| @@ -122,9 +155,9 @@ | ||
| 122 | 155 | 'content' => 'calculations', |
| 123 | 156 | 'param' => 'field-calculations-wordpress-form', |
| 124 | 157 | ), |
| 125 | 158 | 'tip' => __( 'Need to calculate a total?', 'formidable' ), |
| 126 | - 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 159 | + 'call' => self::cta_label(), | |
| 127 | 160 | ), |
| 128 | 161 | array( |
| 129 | 162 | 'link' => array( |
| 130 | 163 | 'content' => 'prefill-fields', |
| @@ -129,10 +162,10 @@ | ||
| 129 | 162 | 'link' => array( |
| 130 | 163 | 'content' => 'prefill-fields', |
| 131 | 164 | 'param' => 'auto-fill-forms', |
| 132 | 165 | ), |
| 133 | - 'tip' => __( 'Save time.', 'formidable' ), | |
| 134 | - 'call' => __( 'Fill out forms automatically!', 'formidable' ), | |
| 166 | + 'tip' => __( 'Save time with autofill forms.', 'formidable' ), | |
| 167 | + 'call' => self::cta_label(), | |
| 135 | 168 | ), |
| 136 | 169 | ); |
| 137 | 170 | |
| 138 | 171 | return $tips; |
| @@ -147,10 +180,10 @@ | ||
| 147 | 180 | 'link' => array( |
| 148 | 181 | 'content' => 'front-edit-b', |
| 149 | 182 | 'param' => 'wordpress-front-end-editing', |
| 150 | 183 | ), |
| 151 | - 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ), | |
| 152 | - 'call' => __( 'Add front-end editing.', 'formidable' ), | |
| 184 | + 'tip' => __( 'Make your site dynamic. Enable front-end editing.', 'formidable' ), | |
| 185 | + 'call' => self::cta_label(), | |
| 153 | 186 | ), |
| 154 | 187 | array( |
| 155 | 188 | 'link' => array( |
| 156 | 189 | 'content' => 'save-drafts', |
| @@ -155,10 +188,10 @@ | ||
| 155 | 188 | 'link' => array( |
| 156 | 189 | 'content' => 'save-drafts', |
| 157 | 190 | 'param' => 'save-drafts-wordpress-form', |
| 158 | 191 | ), |
| 159 | - 'tip' => __( 'Have long forms?', 'formidable' ), | |
| 160 | - '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(), | |
| 161 | 194 | ), |
| 162 | 195 | array( |
| 163 | 196 | 'link' => array( |
| 164 | 197 | 'content' => 'form-scheduling', |
| @@ -163,10 +196,10 @@ | ||
| 163 | 196 | 'link' => array( |
| 164 | 197 | 'content' => 'form-scheduling', |
| 165 | 198 | 'param' => 'schedule-forms-wordpress', |
| 166 | 199 | ), |
| 167 | - 'tip' => __( 'Want your form open only for a certain time period?', 'formidable' ), | |
| 168 | - 'call' => __( 'Add form scheduling.', 'formidable' ), | |
| 200 | + 'tip' => __( 'Limit form access with built-in scheduling.', 'formidable' ), | |
| 201 | + 'call' => self::cta_label(), | |
| 169 | 202 | ), |
| 170 | 203 | ); |
| 171 | 204 | |
| 172 | 205 | return $tips; |
| @@ -181,10 +214,10 @@ | ||
| 181 | 214 | 'link' => array( |
| 182 | 215 | 'content' => 'email-routing', |
| 183 | 216 | 'param' => 'virtually-unlimited-emails', |
| 184 | 217 | ), |
| 185 | - 'tip' => __( 'Save time by sending the email to the right person automatically.', 'formidable' ), | |
| 186 | - 'call' => __( 'Add email routing.', 'formidable' ), | |
| 218 | + 'tip' => __( 'Save time — route emails to the right person automatically.', 'formidable' ), | |
| 219 | + 'call' => self::cta_label(), | |
| 187 | 220 | ), |
| 188 | 221 | array( |
| 189 | 222 | 'link' => array( |
| 190 | 223 | 'content' => 'create-posts', |
| @@ -190,9 +223,9 @@ | ||
| 190 | 223 | 'content' => 'create-posts', |
| 191 | 224 | 'param' => 'create-posts-pages-wordpress-forms', |
| 192 | 225 | ), |
| 193 | 226 | 'tip' => __( 'Create blog posts or pages from the front-end.', 'formidable' ), |
| 194 | - 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 227 | + 'call' => self::cta_label(), | |
| 195 | 228 | ), |
| 196 | 229 | array( |
| 197 | 230 | 'link' => array( |
| 198 | 231 | 'content' => 'user-submit', |
| @@ -198,9 +231,9 @@ | ||
| 198 | 231 | 'content' => 'user-submit', |
| 199 | 232 | 'param' => 'create-posts-pages-wordpress-forms', |
| 200 | 233 | ), |
| 201 | 234 | 'tip' => __( 'Let your users submit posts on the front-end.', 'formidable' ), |
| 202 | - 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 235 | + 'call' => self::cta_label(), | |
| 203 | 236 | ), |
| 204 | 237 | array( |
| 205 | 238 | 'link' => array( |
| 206 | 239 | 'content' => 'mailchimp', |
| @@ -205,10 +238,10 @@ | ||
| 205 | 238 | 'link' => array( |
| 206 | 239 | 'content' => 'mailchimp', |
| 207 | 240 | 'page' => 'mailchimp-tip', |
| 208 | 241 | ), |
| 209 | - 'tip' => __( 'Grow your business with automated email follow-up.', 'formidable' ), | |
| 210 | - 'call' => __( 'Send leads straight to Mailchimp.', 'formidable' ), | |
| 242 | + 'tip' => __( 'Send leads to Mailchimp for instant email follow-up.', 'formidable' ), | |
| 243 | + 'call' => self::cta_label(), | |
| 211 | 244 | ), |
| 212 | 245 | array( |
| 213 | 246 | 'link' => array( |
| 214 | 247 | 'content' => 'paypal-revenue', |
| @@ -213,10 +246,10 @@ | ||
| 213 | 246 | 'link' => array( |
| 214 | 247 | 'content' => 'paypal-revenue', |
| 215 | 248 | 'page' => 'paypal-increase-revenue-tip', |
| 216 | 249 | ), |
| 217 | - 'tip' => __( 'Increase revenue.', 'formidable' ), | |
| 218 | - 'call' => __( 'Use PayPal with this form.', 'formidable' ), | |
| 250 | + 'tip' => __( 'Accept PayPal payments and grow your sales.', 'formidable' ), | |
| 251 | + 'call' => self::cta_label(), | |
| 219 | 252 | ), |
| 220 | 253 | array( |
| 221 | 254 | 'link' => array( |
| 222 | 255 | 'content' => 'paypal-fast', |
| @@ -221,10 +254,10 @@ | ||
| 221 | 254 | 'link' => array( |
| 222 | 255 | 'content' => 'paypal-fast', |
| 223 | 256 | 'page' => 'paypal-save-time-tip', |
| 224 | 257 | ), |
| 225 | - 'tip' => __( 'Get paid instantly.', 'formidable' ), | |
| 226 | - 'call' => __( 'Use Paypal with this form.', 'formidable' ), | |
| 258 | + 'tip' => __( 'Accept payments now with PayPal integration.', 'formidable' ), | |
| 259 | + 'call' => self::cta_label(), | |
| 227 | 260 | ), |
| 228 | 261 | array( |
| 229 | 262 | 'link' => array( |
| 230 | 263 | 'content' => 'registration', |
| @@ -237,10 +270,10 @@ | ||
| 237 | 270 | 'link' => array( |
| 238 | 271 | 'content' => 'profile', |
| 239 | 272 | 'page' => 'registration-profile-editing-tip', |
| 240 | 273 | ), |
| 241 | - 'tip' => __( 'Need front-end profile editing?', 'formidable' ), | |
| 242 | - 'call' => __( 'Add user registration.', 'formidable' ), | |
| 274 | + 'tip' => __( 'Enable front-end profile editing with User Registration.', 'formidable' ), | |
| 275 | + 'call' => self::cta_label(), | |
| 243 | 276 | ), |
| 244 | 277 | array( |
| 245 | 278 | 'link' => array( |
| 246 | 279 | 'content' => 'twilio-payment', |
| @@ -245,10 +278,10 @@ | ||
| 245 | 278 | 'link' => array( |
| 246 | 279 | 'content' => 'twilio-payment', |
| 247 | 280 | 'page' => 'twilio-tip', |
| 248 | 281 | ), |
| 249 | - 'tip' => __( 'Want an SMS notification when a form is submitted or a payment received?', 'formidable' ), | |
| 250 | - '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(), | |
| 251 | 284 | ), |
| 252 | 285 | array( |
| 253 | 286 | 'link' => array( |
| 254 | 287 | 'content' => 'twilio', |
| @@ -253,10 +286,10 @@ | ||
| 253 | 286 | 'link' => array( |
| 254 | 287 | 'content' => 'twilio', |
| 255 | 288 | 'page' => 'twilio-send-tip', |
| 256 | 289 | ), |
| 257 | - 'tip' => __( 'Send an SMS message when a form is submitted.', 'formidable' ), | |
| 258 | - 'call' => __( 'Get the Twilio integration.', 'formidable' ), | |
| 290 | + 'tip' => __( 'Use Twilio to send SMS when forms are submitted.', 'formidable' ), | |
| 291 | + 'call' => self::cta_label(), | |
| 259 | 292 | ), |
| 260 | 293 | array( |
| 261 | 294 | 'link' => array( |
| 262 | 295 | 'content' => 'acf-tip', |
| @@ -261,10 +294,10 @@ | ||
| 261 | 294 | 'link' => array( |
| 262 | 295 | 'content' => 'acf-tip', |
| 263 | 296 | 'param' => 'acf-tip', |
| 264 | 297 | ), |
| 265 | - 'tip' => __( 'Fill Advanced Custom Fields from a form.', 'formidable' ), | |
| 266 | - 'call' => __( 'Add ACF Integration', 'formidable' ), | |
| 298 | + 'tip' => __( 'Fill Advanced Custom Fields automatically with form entries.', 'formidable' ), | |
| 299 | + 'call' => self::cta_label(), | |
| 267 | 300 | ), |
| 268 | 301 | ); |
| 269 | 302 | |
| 270 | 303 | return $tips; |
| @@ -279,10 +312,10 @@ | ||
| 279 | 312 | 'link' => array( |
| 280 | 313 | 'content' => 'style', |
| 281 | 314 | 'param' => 'wordpress-visual-form-styler', |
| 282 | 315 | ), |
| 283 | - 'tip' => __( 'Make your sidebar and footer forms stand out.', 'formidable' ), | |
| 284 | - 'call' => __( 'Use multiple style templates.', 'formidable' ), | |
| 316 | + 'tip' => __( 'Make your forms stand out with multiple style templates.', 'formidable' ), | |
| 317 | + 'call' => self::cta_label(), | |
| 285 | 318 | ), |
| 286 | 319 | array( |
| 287 | 320 | 'link' => array( |
| 288 | 321 | 'content' => 'style', |
| @@ -288,9 +321,9 @@ | ||
| 288 | 321 | 'content' => 'style', |
| 289 | 322 | 'param' => 'bg-image-style-settings', |
| 290 | 323 | ), |
| 291 | 324 | 'tip' => __( 'Want to add a background image?', 'formidable' ), |
| 292 | - 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 325 | + 'call' => self::cta_label(), | |
| 293 | 326 | ), |
| 294 | 327 | array( |
| 295 | 328 | 'link' => array( |
| 296 | 329 | 'content' => 'style', |
| @@ -296,9 +329,9 @@ | ||
| 296 | 329 | 'content' => 'style', |
| 297 | 330 | 'param' => 'duplicate-style', |
| 298 | 331 | ), |
| 299 | 332 | 'tip' => __( 'Want to duplicate a style?', 'formidable' ), |
| 300 | - 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 333 | + 'call' => self::cta_label(), | |
| 301 | 334 | ), |
| 302 | 335 | ); |
| 303 | 336 | |
| 304 | 337 | return $tips; |
| @@ -313,10 +346,10 @@ | ||
| 313 | 346 | 'link' => array( |
| 314 | 347 | 'content' => 'entries', |
| 315 | 348 | 'param' => 'form-entry-management-wordpress', |
| 316 | 349 | ), |
| 317 | - 'tip' => __( 'Want to edit form submissions?', 'formidable' ), | |
| 318 | - 'call' => __( 'Add entry management.', 'formidable' ), | |
| 350 | + 'tip' => __( 'Edit form entries anytime with entry management.', 'formidable' ), | |
| 351 | + 'call' => self::cta_label(), | |
| 319 | 352 | ), |
| 320 | 353 | array( |
| 321 | 354 | 'link' => array( |
| 322 | 355 | 'content' => 'entries-search', |
| @@ -322,9 +355,9 @@ | ||
| 322 | 355 | 'content' => 'entries-search', |
| 323 | 356 | 'param' => 'form-entry-management-wordpress', |
| 324 | 357 | ), |
| 325 | 358 | 'tip' => __( 'Want to search submitted entries?', 'formidable' ), |
| 326 | - 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 359 | + 'call' => self::cta_label(), | |
| 327 | 360 | ), |
| 328 | 361 | array( |
| 329 | 362 | 'link' => array( |
| 330 | 363 | 'content' => 'views', |
| @@ -329,10 +362,10 @@ | ||
| 329 | 362 | 'link' => array( |
| 330 | 363 | 'content' => 'views', |
| 331 | 364 | 'param' => 'views-display-form-data', |
| 332 | 365 | ), |
| 333 | - 'tip' => __( 'A site with dynamic, user-generated content is within reach.', 'formidable' ), | |
| 334 | - 'call' => __( 'Display form data with Views.', 'formidable' ), | |
| 366 | + 'tip' => __( 'Turn entries into dynamic content — no code needed.', 'formidable' ), | |
| 367 | + 'call' => self::cta_label(), | |
| 335 | 368 | ), |
| 336 | 369 | ); |
| 337 | 370 | $tips = array_merge( $tips, self::get_import_tip() ); |
| 338 | 371 | |
| @@ -349,9 +382,9 @@ | ||
| 349 | 382 | 'content' => 'import', |
| 350 | 383 | 'param' => 'importing-exporting-wordpress-forms', |
| 351 | 384 | ), |
| 352 | 385 | 'tip' => __( 'Want to import entries into your forms?', 'formidable' ), |
| 353 | - 'call' => __( 'Upgrade to Pro.', 'formidable' ), | |
| 386 | + 'call' => self::cta_label(), | |
| 354 | 387 | ), |
| 355 | 388 | ); |
| 356 | 389 | |
| 357 | 390 | return $tips; |
| @@ -356,47 +389,68 @@ | ||
| 356 | 389 | |
| 357 | 390 | return $tips; |
| 358 | 391 | } |
| 359 | 392 | |
| 393 | + public static function get_random_tip( $tips ) { | |
| 394 | + $random = rand( 0, count( $tips ) - 1 ); | |
| 395 | + | |
| 396 | + return $tips[ $random ]; | |
| 397 | + } | |
| 398 | + | |
| 360 | 399 | /** |
| 361 | - * @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 | |
| 362 | 415 | */ |
| 363 | - public static function get_banner_tip() { | |
| 364 | - $tips = array( | |
| 365 | - array( | |
| 366 | - 'link' => array( | |
| 367 | - 'medium' => 'banner', | |
| 368 | - 'content' => 'professional-results', | |
| 369 | - ), | |
| 370 | - 'tip' => __( 'Looking for more ways to get professional results?', 'formidable' ), | |
| 371 | - 'call' => __( 'Take your forms to the next level.', 'formidable' ), | |
| 372 | - ), | |
| 373 | - array( | |
| 374 | - 'link' => array( | |
| 375 | - 'medium' => 'banner', | |
| 376 | - 'content' => 'increase-conversions', | |
| 377 | - ), | |
| 378 | - 'tip' => __( 'Increase conversions in long forms.', 'formidable' ), | |
| 379 | - 'call' => __( 'Add conditional logic, page breaks, and section headings.', 'formidable' ), | |
| 380 | - ), | |
| 381 | - array( | |
| 382 | - 'link' => array( | |
| 383 | - 'medium' => 'banner', | |
| 384 | - 'content' => 'automate', | |
| 385 | - ), | |
| 386 | - 'tip' => __( 'Automate your business and increase revenue.', 'formidable' ), | |
| 387 | - 'call' => __( 'Collect instant payments, and send leads to Mailchimp.', 'formidable' ), | |
| 388 | - ), | |
| 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', | |
| 389 | 432 | ); |
| 390 | - $random = rand( 0, count( $tips ) - 1 ); | |
| 391 | - $tip = $tips[ $random ]; | |
| 392 | - $tip['num'] = $random; | |
| 393 | 433 | |
| 394 | - 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'; | |
| 395 | 445 | } |
| 396 | 446 | |
| 397 | - public static function get_random_tip( $tips ) { | |
| 398 | - $random = rand( 0, count( $tips ) - 1 ); | |
| 399 | - | |
| 400 | - 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(); | |
| 401 | 455 | } |
| 402 | 456 | } |