| @@ -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'] ) . '">'; |
| @@ -56,11 +55,10 @@ | ||
| 56 | 55 | echo '<p class="frmcenter ' . esc_attr( $tip['class'] ) . '">'; |
| 57 | 56 | } |
| 58 | 57 | |
| 59 | 58 | $link = self::get_tip_link( $tip ); |
| 60 | - // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 61 | 59 | ?> |
| 62 | - <a href="<?php echo esc_url( $link ); ?>" <?php echo ! empty( $tip['link'] ) ? 'target="_blank"' : ''; ?> class="frm_pro_tip frm-gradient"> | |
| 60 | + <a href="<?php echo esc_url( $link ); ?>" <?php echo empty( $tip['link'] ) ? '' : 'target="_blank"'; ?> class="frm_pro_tip frm-gradient"> | |
| 63 | 61 | <span class="frm-tip-badge"><?php esc_html_e( 'PRO TIP', 'formidable' ); ?></span> |
| 64 | 62 | |
| 65 | 63 | <?php if ( isset( $tip['call'] ) ) { ?> |
| 66 | 64 | <span class="frm-tip-info"> |
| @@ -71,9 +69,8 @@ | ||
| 71 | 69 | <?php echo esc_html( $tip['call'] ? $tip['call'] : $tip['tip'] ); ?> |
| 72 | 70 | </span> |
| 73 | 71 | </a> |
| 74 | 72 | <?php |
| 75 | - // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 76 | 73 | |
| 77 | 74 | if ( 'p' === $html ) { |
| 78 | 75 | echo '</p>'; |
| 79 | 76 | } |
| @@ -82,9 +79,8 @@ | ||
| 82 | 79 | /** |
| 83 | 80 | * @since 6.21 |
| 84 | 81 | * |
| 85 | 82 | * @param array $tip |
| 86 | - * | |
| 87 | 83 | * @return string |
| 88 | 84 | */ |
| 89 | 85 | private static function get_tip_link( $tip ) { |
| 90 | 86 | if ( empty( $tip['tip'] ) ) { |
| @@ -91,14 +87,12 @@ | ||
| 91 | 87 | return $tip['page']; |
| 92 | 88 | } |
| 93 | 89 | |
| 94 | 90 | $cta_link = FrmSalesApi::get_best_sale_value( 'pro_tip_cta_link' ); |
| 95 | - | |
| 96 | 91 | if ( $cta_link ) { |
| 97 | 92 | if ( is_array( $tip['link'] ) ) { |
| 98 | - return FrmAppHelper::maybe_add_missing_utm( $cta_link, $tip['link'] ); | |
| 93 | + $cta_link = FrmAppHelper::maybe_add_missing_utm( $cta_link, $tip['link'] ); | |
| 99 | 94 | } |
| 100 | - | |
| 101 | 95 | return $cta_link; |
| 102 | 96 | } |
| 103 | 97 | |
| 104 | 98 | return FrmAppHelper::admin_upgrade_link( $tip['link'], $tip['page'] ); |
| @@ -112,13 +106,11 @@ | ||
| 112 | 106 | * @return string |
| 113 | 107 | */ |
| 114 | 108 | private static function cta_label() { |
| 115 | 109 | $cta_text = FrmSalesApi::get_best_sale_value( 'pro_tip_cta_text' ); |
| 116 | - | |
| 117 | 110 | if ( $cta_text ) { |
| 118 | 111 | return $cta_text; |
| 119 | 112 | } |
| 120 | - | |
| 121 | 113 | return FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro.', 'formidable' ); |
| 122 | 114 | } |
| 123 | 115 | |
| 124 | 116 | /** |
| @@ -124,9 +116,9 @@ | ||
| 124 | 116 | /** |
| 125 | 117 | * @return array |
| 126 | 118 | */ |
| 127 | 119 | public static function get_builder_tip() { |
| 128 | - return array( | |
| 120 | + $tips = array( | |
| 129 | 121 | array( |
| 130 | 122 | 'link' => array( |
| 131 | 123 | 'content' => 'conditional-logic', |
| 132 | 124 | 'param' => 'conditional-logic-wordpress-forms', |
| @@ -159,8 +151,16 @@ | ||
| 159 | 151 | 'call' => self::cta_label(), |
| 160 | 152 | ), |
| 161 | 153 | array( |
| 162 | 154 | 'link' => array( |
| 155 | + 'content' => 'calculations', | |
| 156 | + 'param' => 'field-calculations-wordpress-form', | |
| 157 | + ), | |
| 158 | + 'tip' => __( 'Need to calculate a total?', 'formidable' ), | |
| 159 | + 'call' => self::cta_label(), | |
| 160 | + ), | |
| 161 | + array( | |
| 162 | + 'link' => array( | |
| 163 | 163 | 'content' => 'prefill-fields', |
| 164 | 164 | 'param' => 'auto-fill-forms', |
| 165 | 165 | ), |
| 166 | 166 | 'tip' => __( 'Save time with autofill forms.', 'formidable' ), |
| @@ -166,8 +166,10 @@ | ||
| 166 | 166 | 'tip' => __( 'Save time with autofill forms.', 'formidable' ), |
| 167 | 167 | 'call' => self::cta_label(), |
| 168 | 168 | ), |
| 169 | 169 | ); |
| 170 | + | |
| 171 | + return $tips; | |
| 170 | 172 | } |
| 171 | 173 | |
| 172 | 174 | /** |
| 173 | 175 | * @return array |
| @@ -172,9 +174,9 @@ | ||
| 172 | 174 | /** |
| 173 | 175 | * @return array |
| 174 | 176 | */ |
| 175 | 177 | public static function get_form_settings_tip() { |
| 176 | - return array( | |
| 178 | + $tips = array( | |
| 177 | 179 | array( |
| 178 | 180 | 'link' => array( |
| 179 | 181 | 'content' => 'front-edit-b', |
| 180 | 182 | 'param' => 'wordpress-front-end-editing', |
| @@ -198,8 +200,10 @@ | ||
| 198 | 200 | 'tip' => __( 'Limit form access with built-in scheduling.', 'formidable' ), |
| 199 | 201 | 'call' => self::cta_label(), |
| 200 | 202 | ), |
| 201 | 203 | ); |
| 204 | + | |
| 205 | + return $tips; | |
| 202 | 206 | } |
| 203 | 207 | |
| 204 | 208 | /** |
| 205 | 209 | * @return array |
| @@ -204,9 +208,9 @@ | ||
| 204 | 208 | /** |
| 205 | 209 | * @return array |
| 206 | 210 | */ |
| 207 | 211 | public static function get_form_action_tip() { |
| 208 | - return array( | |
| 212 | + $tips = array( | |
| 209 | 213 | array( |
| 210 | 214 | 'link' => array( |
| 211 | 215 | 'content' => 'email-routing', |
| 212 | 216 | 'param' => 'virtually-unlimited-emails', |
| @@ -239,8 +243,24 @@ | ||
| 239 | 243 | 'call' => self::cta_label(), |
| 240 | 244 | ), |
| 241 | 245 | array( |
| 242 | 246 | 'link' => array( |
| 247 | + 'content' => 'paypal-revenue', | |
| 248 | + 'page' => 'paypal-increase-revenue-tip', | |
| 249 | + ), | |
| 250 | + 'tip' => __( 'Accept PayPal payments and grow your sales.', 'formidable' ), | |
| 251 | + 'call' => self::cta_label(), | |
| 252 | + ), | |
| 253 | + array( | |
| 254 | + 'link' => array( | |
| 255 | + 'content' => 'paypal-fast', | |
| 256 | + 'page' => 'paypal-save-time-tip', | |
| 257 | + ), | |
| 258 | + 'tip' => __( 'Accept payments now with PayPal integration.', 'formidable' ), | |
| 259 | + 'call' => self::cta_label(), | |
| 260 | + ), | |
| 261 | + array( | |
| 262 | + 'link' => array( | |
| 243 | 263 | 'content' => 'registration', |
| 244 | 264 | 'page' => 'registration-tip', |
| 245 | 265 | ), |
| 246 | 266 | 'tip' => __( 'Automatically create user accounts.', 'formidable' ), |
| @@ -278,8 +298,10 @@ | ||
| 278 | 298 | 'tip' => __( 'Fill Advanced Custom Fields automatically with form entries.', 'formidable' ), |
| 279 | 299 | 'call' => self::cta_label(), |
| 280 | 300 | ), |
| 281 | 301 | ); |
| 302 | + | |
| 303 | + return $tips; | |
| 282 | 304 | } |
| 283 | 305 | |
| 284 | 306 | /** |
| 285 | 307 | * @return array |
| @@ -284,9 +306,9 @@ | ||
| 284 | 306 | /** |
| 285 | 307 | * @return array |
| 286 | 308 | */ |
| 287 | 309 | public static function get_styling_tip() { |
| 288 | - return array( | |
| 310 | + $tips = array( | |
| 289 | 311 | array( |
| 290 | 312 | 'link' => array( |
| 291 | 313 | 'content' => 'style', |
| 292 | 314 | 'param' => 'wordpress-visual-form-styler', |
| @@ -310,8 +332,10 @@ | ||
| 310 | 332 | 'tip' => __( 'Want to duplicate a style?', 'formidable' ), |
| 311 | 333 | 'call' => self::cta_label(), |
| 312 | 334 | ), |
| 313 | 335 | ); |
| 336 | + | |
| 337 | + return $tips; | |
| 314 | 338 | } |
| 315 | 339 | |
| 316 | 340 | /** |
| 317 | 341 | * @return array |
| @@ -342,10 +366,11 @@ | ||
| 342 | 366 | 'tip' => __( 'Turn entries into dynamic content — no code needed.', 'formidable' ), |
| 343 | 367 | 'call' => self::cta_label(), |
| 344 | 368 | ), |
| 345 | 369 | ); |
| 370 | + $tips = array_merge( $tips, self::get_import_tip() ); | |
| 346 | 371 | |
| 347 | - return array_merge( $tips, self::get_import_tip() ); | |
| 372 | + return $tips; | |
| 348 | 373 | } |
| 349 | 374 | |
| 350 | 375 | /** |
| 351 | 376 | * @return array |
| @@ -350,9 +375,9 @@ | ||
| 350 | 375 | /** |
| 351 | 376 | * @return array |
| 352 | 377 | */ |
| 353 | 378 | public static function get_import_tip() { |
| 354 | - return array( | |
| 379 | + $tips = array( | |
| 355 | 380 | array( |
| 356 | 381 | 'link' => array( |
| 357 | 382 | 'content' => 'import', |
| 358 | 383 | 'param' => 'importing-exporting-wordpress-forms', |
| @@ -360,23 +385,15 @@ | ||
| 360 | 385 | 'tip' => __( 'Want to import entries into your forms?', 'formidable' ), |
| 361 | 386 | 'call' => self::cta_label(), |
| 362 | 387 | ), |
| 363 | 388 | ); |
| 389 | + | |
| 390 | + return $tips; | |
| 364 | 391 | } |
| 365 | 392 | |
| 366 | - /** | |
| 367 | - * @param array $tips | |
| 368 | - * | |
| 369 | - * @return array | |
| 370 | - */ | |
| 371 | 393 | public static function get_random_tip( $tips ) { |
| 372 | - $count = count( $tips ); | |
| 394 | + $random = rand( 0, count( $tips ) - 1 ); | |
| 373 | 395 | |
| 374 | - if ( $count === 0 ) { | |
| 375 | - return array(); | |
| 376 | - } | |
| 377 | - | |
| 378 | - $random = random_int( 0, $count - 1 ); | |
| 379 | 396 | return $tips[ $random ]; |
| 380 | 397 | } |
| 381 | 398 | |
| 382 | 399 | /** |