| @@ -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'] ) . '">'; |
| @@ -80,9 +79,8 @@ | ||
| 80 | 79 | /** |
| 81 | 80 | * @since 6.21 |
| 82 | 81 | * |
| 83 | 82 | * @param array $tip |
| 84 | - * | |
| 85 | 83 | * @return string |
| 86 | 84 | */ |
| 87 | 85 | private static function get_tip_link( $tip ) { |
| 88 | 86 | if ( empty( $tip['tip'] ) ) { |
| @@ -89,14 +87,12 @@ | ||
| 89 | 87 | return $tip['page']; |
| 90 | 88 | } |
| 91 | 89 | |
| 92 | 90 | $cta_link = FrmSalesApi::get_best_sale_value( 'pro_tip_cta_link' ); |
| 93 | - | |
| 94 | 91 | if ( $cta_link ) { |
| 95 | 92 | if ( is_array( $tip['link'] ) ) { |
| 96 | 93 | $cta_link = FrmAppHelper::maybe_add_missing_utm( $cta_link, $tip['link'] ); |
| 97 | 94 | } |
| 98 | - | |
| 99 | 95 | return $cta_link; |
| 100 | 96 | } |
| 101 | 97 | |
| 102 | 98 | return FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] ); |
| @@ -110,13 +106,11 @@ | ||
| 110 | 106 | * @return string |
| 111 | 107 | */ |
| 112 | 108 | private static function cta_label() { |
| 113 | 109 | $cta_text = FrmSalesApi::get_best_sale_value( 'pro_tip_cta_text' ); |
| 114 | - | |
| 115 | 110 | if ( $cta_text ) { |
| 116 | 111 | return $cta_text; |
| 117 | 112 | } |
| 118 | - | |
| 119 | 113 | return FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro.', 'formidable' ); |
| 120 | 114 | } |
| 121 | 115 | |
| 122 | 116 | /** |
| @@ -122,9 +116,9 @@ | ||
| 122 | 116 | /** |
| 123 | 117 | * @return array |
| 124 | 118 | */ |
| 125 | 119 | public static function get_builder_tip() { |
| 126 | - return array( | |
| 120 | + $tips = array( | |
| 127 | 121 | array( |
| 128 | 122 | 'link' => array( |
| 129 | 123 | 'content' => 'conditional-logic', |
| 130 | 124 | 'param' => 'conditional-logic-wordpress-forms', |
| @@ -172,8 +166,10 @@ | ||
| 172 | 166 | 'tip' => __( 'Save time with autofill forms.', 'formidable' ), |
| 173 | 167 | 'call' => self::cta_label(), |
| 174 | 168 | ), |
| 175 | 169 | ); |
| 170 | + | |
| 171 | + return $tips; | |
| 176 | 172 | } |
| 177 | 173 | |
| 178 | 174 | /** |
| 179 | 175 | * @return array |
| @@ -178,9 +174,9 @@ | ||
| 178 | 174 | /** |
| 179 | 175 | * @return array |
| 180 | 176 | */ |
| 181 | 177 | public static function get_form_settings_tip() { |
| 182 | - return array( | |
| 178 | + $tips = array( | |
| 183 | 179 | array( |
| 184 | 180 | 'link' => array( |
| 185 | 181 | 'content' => 'front-edit-b', |
| 186 | 182 | 'param' => 'wordpress-front-end-editing', |
| @@ -204,8 +200,10 @@ | ||
| 204 | 200 | 'tip' => __( 'Limit form access with built-in scheduling.', 'formidable' ), |
| 205 | 201 | 'call' => self::cta_label(), |
| 206 | 202 | ), |
| 207 | 203 | ); |
| 204 | + | |
| 205 | + return $tips; | |
| 208 | 206 | } |
| 209 | 207 | |
| 210 | 208 | /** |
| 211 | 209 | * @return array |
| @@ -210,9 +208,9 @@ | ||
| 210 | 208 | /** |
| 211 | 209 | * @return array |
| 212 | 210 | */ |
| 213 | 211 | public static function get_form_action_tip() { |
| 214 | - return array( | |
| 212 | + $tips = array( | |
| 215 | 213 | array( |
| 216 | 214 | 'link' => array( |
| 217 | 215 | 'content' => 'email-routing', |
| 218 | 216 | 'param' => 'virtually-unlimited-emails', |
| @@ -300,8 +298,10 @@ | ||
| 300 | 298 | 'tip' => __( 'Fill Advanced Custom Fields automatically with form entries.', 'formidable' ), |
| 301 | 299 | 'call' => self::cta_label(), |
| 302 | 300 | ), |
| 303 | 301 | ); |
| 302 | + | |
| 303 | + return $tips; | |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | /** |
| 307 | 307 | * @return array |
| @@ -306,9 +306,9 @@ | ||
| 306 | 306 | /** |
| 307 | 307 | * @return array |
| 308 | 308 | */ |
| 309 | 309 | public static function get_styling_tip() { |
| 310 | - return array( | |
| 310 | + $tips = array( | |
| 311 | 311 | array( |
| 312 | 312 | 'link' => array( |
| 313 | 313 | 'content' => 'style', |
| 314 | 314 | 'param' => 'wordpress-visual-form-styler', |
| @@ -332,8 +332,10 @@ | ||
| 332 | 332 | 'tip' => __( 'Want to duplicate a style?', 'formidable' ), |
| 333 | 333 | 'call' => self::cta_label(), |
| 334 | 334 | ), |
| 335 | 335 | ); |
| 336 | + | |
| 337 | + return $tips; | |
| 336 | 338 | } |
| 337 | 339 | |
| 338 | 340 | /** |
| 339 | 341 | * @return array |
| @@ -364,10 +366,11 @@ | ||
| 364 | 366 | 'tip' => __( 'Turn entries into dynamic content — no code needed.', 'formidable' ), |
| 365 | 367 | 'call' => self::cta_label(), |
| 366 | 368 | ), |
| 367 | 369 | ); |
| 370 | + $tips = array_merge( $tips, self::get_import_tip() ); | |
| 368 | 371 | |
| 369 | - return array_merge( $tips, self::get_import_tip() ); | |
| 372 | + return $tips; | |
| 370 | 373 | } |
| 371 | 374 | |
| 372 | 375 | /** |
| 373 | 376 | * @return array |
| @@ -372,9 +375,9 @@ | ||
| 372 | 375 | /** |
| 373 | 376 | * @return array |
| 374 | 377 | */ |
| 375 | 378 | public static function get_import_tip() { |
| 376 | - return array( | |
| 379 | + $tips = array( | |
| 377 | 380 | array( |
| 378 | 381 | 'link' => array( |
| 379 | 382 | 'content' => 'import', |
| 380 | 383 | 'param' => 'importing-exporting-wordpress-forms', |
| @@ -382,23 +385,15 @@ | ||
| 382 | 385 | 'tip' => __( 'Want to import entries into your forms?', 'formidable' ), |
| 383 | 386 | 'call' => self::cta_label(), |
| 384 | 387 | ), |
| 385 | 388 | ); |
| 389 | + | |
| 390 | + return $tips; | |
| 386 | 391 | } |
| 387 | 392 | |
| 388 | - /** | |
| 389 | - * @param array $tips | |
| 390 | - * | |
| 391 | - * @return array | |
| 392 | - */ | |
| 393 | 393 | public static function get_random_tip( $tips ) { |
| 394 | - $count = count( $tips ); | |
| 394 | + $random = rand( 0, count( $tips ) - 1 ); | |
| 395 | 395 | |
| 396 | - if ( $count === 0 ) { | |
| 397 | - return array(); | |
| 398 | - } | |
| 399 | - | |
| 400 | - $random = random_int( 0, $count - 1 ); | |
| 401 | 396 | return $tips[ $random ]; |
| 402 | 397 | } |
| 403 | 398 | |
| 404 | 399 | /** |