| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | $this->bvinfo = new WPRInfo($settings); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function activate() { |
| 19 | - if (!isset($_REQUEST['blogvaultkey'])) { | |
| 19 | + if (!isset($_REQUEST['blogvaultkey'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 20 | 20 | ##BVKEYSLOCATE## |
| 21 | 21 | } |
| 22 | 22 | if (WPRAccount::isConfigured($this->settings)) { |
| 23 | 23 | /* This informs the server about the activation */ |
| @@ -32,16 +32,21 @@ | ||
| 32 | 32 | public function deactivate() { |
| 33 | 33 | $info = array(); |
| 34 | 34 | $this->siteinfo->basic($info); |
| 35 | 35 | ##DISABLECACHE## |
| 36 | + $this->process_deactivation_feedback($info); | |
| 37 | + | |
| 36 | 38 | $this->bvapi->pingbv('/bvapi/deactivate', $info); |
| 37 | 39 | } |
| 38 | 40 | |
| 39 | 41 | public static function uninstall() { |
| 40 | - do_action('clear_pt_config'); | |
| 41 | - do_action('clear_dynsync_config'); | |
| 42 | + do_action('wpr_clear_pt_config'); | |
| 43 | + do_action('wpr_clear_dynsync_config'); | |
| 42 | 44 | ##CLEARCACHECONFIG## |
| 43 | - do_action('clear_bv_services_config'); | |
| 45 | + do_action('wpr_clear_bv_services_config'); | |
| 46 | + do_action('wpr_clear_wp_2fa_config'); | |
| 47 | + do_action('wpr_remove_bv_preload_include'); | |
| 48 | + do_action('wpr_clear_php_error_config'); | |
| 44 | 49 | } |
| 45 | 50 | |
| 46 | 51 | public function clear_bv_services_config() { |
| 47 | 52 | $this->settings->deleteOption($this->bvinfo->services_option_name); |
| @@ -46,8 +51,18 @@ | ||
| 46 | 51 | public function clear_bv_services_config() { |
| 47 | 52 | $this->settings->deleteOption($this->bvinfo->services_option_name); |
| 48 | 53 | } |
| 49 | 54 | |
| 55 | + public function clear_wp_2fa_config() { | |
| 56 | + $meta_keys = array('wpr_2fa_enabled', 'wpr_2fa_secret', 'wpr_2fa_method', 'wpr_2fa_email_challenge', 'wpr_2fa_email_rate', 'wpr_2fa_attempts'); | |
| 57 | + foreach ($meta_keys as $meta_key) { | |
| 58 | + $this->settings->deleteMetaData('user', null, $meta_key, '', true); | |
| 59 | + } | |
| 60 | + | |
| 61 | + $this->settings->deleteOption(WPRWP2FA::$wp_2fa_option); | |
| 62 | + } | |
| 63 | + | |
| 64 | + | |
| 50 | 65 | ##SOUNINSTALLFUNCTION## |
| 51 | 66 | |
| 52 | 67 | public function footerHandler() { |
| 53 | 68 | $bvfooter = $this->settings->getOption($this->bvinfo->badgeinfo); |
| @@ -55,6 +70,23 @@ | ||
| 55 | 70 | echo '<div style="max-width:150px;min-height:70px;margin:0 auto;text-align:center;position:relative;"> |
| 56 | 71 | <a href='.esc_url($bvfooter['badgeurl']).' target="_blank" ><img src="'.esc_url(plugins_url($bvfooter['badgeimg'], __FILE__)).'" alt="'.esc_attr($bvfooter['badgealt']).'" /></a></div>'; |
| 57 | 72 | } |
| 58 | 73 | } |
| 74 | + | |
| 75 | + private function process_deactivation_feedback(&$info) { | |
| 76 | + //phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 77 | + if (!isset($_GET['bv_deactivation_assets']) || !is_string($_GET['bv_deactivation_assets'])) { | |
| 78 | + return; | |
| 79 | + } | |
| 80 | + | |
| 81 | + $deactivation_assets = wp_unslash($_GET['bv_deactivation_assets']); | |
| 82 | + $info['deactivation_feedback'] = base64_encode($deactivation_assets); | |
| 83 | + //phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 84 | + } | |
| 85 | + | |
| 86 | + public function removeBVPreload() { | |
| 87 | + $pattern = "@include '" . rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/bv-preload.php" . "';"; | |
| 88 | + WPRHelper::removePatternFromWpConfig($pattern); | |
| 89 | + } | |
| 90 | + | |
| 59 | 91 | } |
| 60 | 92 | endif; |