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