| @@ -26,21 +26,19 @@ | ||
| 26 | 26 | * @since 6.25 |
| 27 | 27 | */ |
| 28 | 28 | do_action( 'frm_test_mode_container' ); |
| 29 | 29 | |
| 30 | - if ( false !== strpos( $html, '<div class="frm_form_fields' ) ) { | |
| 31 | - $html = preg_replace( | |
| 30 | + if ( str_contains( $html, '<div class="frm_form_fields' ) ) { | |
| 31 | + return preg_replace( | |
| 32 | 32 | '/<div class="frm_form_fields/', |
| 33 | 33 | self::get_testing_mode_container() . '<div class="frm_form_fields', |
| 34 | 34 | $html, |
| 35 | 35 | 1 |
| 36 | 36 | ); |
| 37 | - } else { | |
| 38 | - // If there no form, add before an error message. | |
| 39 | - $html = '<div class="with_frm_style">' . self::get_testing_mode_container() . '</div>' . $html; | |
| 40 | 37 | } |
| 41 | 38 | |
| 42 | - return $html; | |
| 39 | + // If there no form, add before an error message. | |
| 40 | + return '<div class="with_frm_style">' . self::get_testing_mode_container() . '</div>' . $html; | |
| 43 | 41 | } |
| 44 | 42 | |
| 45 | 43 | /** |
| 46 | 44 | * @since 6.25 |
| @@ -97,8 +95,10 @@ | ||
| 97 | 95 | return; |
| 98 | 96 | } |
| 99 | 97 | |
| 100 | 98 | if ( ! empty( $form->options['chat'] ) ) { |
| 99 | + // Track view test mode with chat form. | |
| 100 | + FrmUsageController::update_flows_data( 'view_test_mode', 'chat_form' ); | |
| 101 | 101 | echo '<div class="frm_note_style">' . esc_html__( 'Test Mode is currently not supported for conversational forms.', 'formidable' ) . '</div>'; |
| 102 | 102 | return; |
| 103 | 103 | } |
| 104 | 104 | |
| @@ -144,8 +144,12 @@ | ||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | self::include_svg(); |
| 147 | 147 | |
| 148 | + if ( ! $enabled ) { | |
| 149 | + FrmUsageController::update_flows_data( 'view_test_mode', 'no_addon' ); | |
| 150 | + } | |
| 151 | + | |
| 148 | 152 | include FrmAppHelper::plugin_path() . '/classes/views/test-mode/container.php'; |
| 149 | 153 | } |
| 150 | 154 | |
| 151 | 155 | /** |
| @@ -224,9 +228,9 @@ | ||
| 224 | 228 | if ( self::test_mode_addon_exists() ) { |
| 225 | 229 | return false; |
| 226 | 230 | } |
| 227 | 231 | |
| 228 | - return ! in_array( FrmAddonsController::license_type(), array( 'plus', 'business', 'elite' ) ); | |
| 232 | + return ! in_array( FrmAddonsController::license_type(), array( 'plus', 'business', 'elite' ), true ); | |
| 229 | 233 | } |
| 230 | 234 | |
| 231 | 235 | /** |
| 232 | 236 | * Determine if the Test Mode add-on is installed and active. |