| @@ -41,51 +41,8 @@ | ||
| 41 | 41 | $this->register_routes(); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * Get the Tracking modal that is displayed on all plugin pages. | |
| 46 | - * | |
| 47 | - * @return array | |
| 48 | - */ | |
| 49 | - public function get_tracking_modal(): array { | |
| 50 | - $title = esc_html__( 'Help Us Enhance Your Site\'s Security', 'defender-security' ); | |
| 51 | - | |
| 52 | - $current_user = wp_get_current_user(); | |
| 53 | - | |
| 54 | - $desc = sprintf( | |
| 55 | - /* translators: %s: user display name */ | |
| 56 | - esc_html__( | |
| 57 | - 'Hey there! %s, Defender is dedicated to protecting your WordPress website from hackers and malware. However, our mission is more effective with your collaboration. By opting in to share anonymous usage data, you help us refine and enhance our plugin for everyone\'s benefit.', | |
| 58 | - 'defender-security' | |
| 59 | - ), | |
| 60 | - '<strong>' . esc_html( $current_user->display_name ) . '</strong>' | |
| 61 | - ); | |
| 62 | - $desc .= '<br/><br/>'; | |
| 63 | - $desc .= sprintf( | |
| 64 | - /* translators: %s: Link. */ | |
| 65 | - esc_html__( | |
| 66 | - 'Your privacy is important to us. We guarantee that your data stays anonymous and your identity stays secure. Learn more about our usage tracking %s.', | |
| 67 | - 'defender-security' | |
| 68 | - ), | |
| 69 | - '<a href="' . Main_Setting::PRIVACY_LINK . '" target="_blank">' . esc_html__( 'here', 'defender-security' ) . '<a>' | |
| 70 | - ); | |
| 71 | - $result = $this->dump_routes_and_nonces(); | |
| 72 | - | |
| 73 | - return array( | |
| 74 | - 'title' => $title, | |
| 75 | - 'desc' => $desc, | |
| 76 | - 'banner_1x' => defender_asset_url( '/assets/img/modal/tracking-modal.png' ), | |
| 77 | - 'banner_2x' => defender_asset_url( '/assets/img/modal/[email protected]' ), | |
| 78 | - 'banner_alt' => esc_html__( 'Help us improve Defender', 'defender-security' ), | |
| 79 | - 'optin_button_title' => esc_html__( 'OPT IN', 'defender-security' ), | |
| 80 | - 'skip_button_title' => esc_html__( 'Skip for now', 'defender-security' ), | |
| 81 | - 'state_usage_tracking' => wd_di()->get( Main_Setting::class )->usage_tracking, | |
| 82 | - 'routes' => $result['routes'], | |
| 83 | - 'nonces' => $result['nonces'], | |
| 84 | - ); | |
| 85 | - } | |
| 86 | - | |
| 87 | - /** | |
| 88 | 45 | * Handles the closing of the tracking modal. |
| 89 | 46 | * |
| 90 | 47 | * @return Response Response object indicating success. |
| 91 | 48 | * @defender_route |
| @@ -97,9 +54,8 @@ | ||
| 97 | 54 | $model_settings->toggle_tracking( false ); |
| 98 | 55 | Config_Hub_Helper::set_clear_active_flag(); |
| 99 | 56 | $this->track_opt_toggle( false, 'Tracking modal' ); |
| 100 | 57 | } |
| 101 | - | |
| 102 | 58 | // Track. |
| 103 | 59 | $this->track_feature( 'def_tracking_modal', array( 'Modal Action' => 'closed' ) ); |
| 104 | 60 | self::dismiss_modal_key(); |
| 105 | 61 | |
| @@ -143,27 +99,8 @@ | ||
| 143 | 99 | * Deletes the site option that controls the visibility of the tracking modal. |
| 144 | 100 | */ |
| 145 | 101 | public static function delete_modal_key(): void { |
| 146 | 102 | delete_site_option( self::TRACKING_SLUG ); |
| 147 | - } | |
| 148 | - | |
| 149 | - /** | |
| 150 | - * Conditions of the Tracking modal: | |
| 151 | - * 1)show on all Defender pages. | |
| 152 | - * 2)show to users upgrading from older versions. | |
| 153 | - * 3)should have higher priority than a Welcome modal on the Defender > Dashboard page. | |
| 154 | - * 4)if user closes or clicks on the Save button on one plugin page, we don't itl on another plugin page. | |
| 155 | - * 5)no display after the updated Onboarding with Opt-in. | |
| 156 | - * 6)no display when Whitelabel > Documentation, Tutorials and What’s New Modal is set to “Hide” | |
| 157 | - * | |
| 158 | - * @return bool | |
| 159 | - */ | |
| 160 | - public function show_tracking_modal() { | |
| 161 | - $info = defender_white_label_status(); | |
| 162 | - | |
| 163 | - $white_label_is_hide = isset( $info['hide_doc_link'] ) && $info['hide_doc_link']; | |
| 164 | - | |
| 165 | - return (bool) get_site_option( self::TRACKING_SLUG ) && ! $white_label_is_hide; | |
| 166 | 103 | } |
| 167 | 104 | |
| 168 | 105 | /** |
| 169 | 106 | * Delete all the data & the cache. |