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