forked from WPPlugins/goodbye-captcha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.php
52 lines (37 loc) · 1.17 KB
/
uninstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
*
* @package WPBruiser
* @author Mihai Chelaru
* @license GPL-2.0+
* @link http://www.wpbruiser.com
* @copyright 2014 WPBruiser
*
*/
defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
class_exists('GoodByeCaptcha') || require_once 'goodbye-captcha.php';
class GoodByeCaptchaUninstaller
{
public function __construct()
{
if(!current_user_can( 'activate_plugins')){
exit;
}
if(is_callable(array('GoodByeCaptcha', 'isProVersion')) && GoodByeCaptcha::isProVersion() && is_plugin_active(plugin_basename(GoodByeCaptcha::getMainFilePath()))) {
return;
}
GdbcTaskScheduler::unScheduleGdbcTasks();
foreach(GdbcModulesController::getRegisteredModules() as $moduleName => $arrModuleInfo)
{
if( null === ($adminModuleInstance = GdbcModulesController::getAdminModuleInstance($moduleName)) )
continue;
$adminModuleInstance->deleteAllSettingOptions(false);
$adminModuleInstance->deleteAllSettingOptions(true);
}
$adminNotice = new GdbcAdminNotice(null, null);
$adminNotice->deleteAllNotices();
global $wpdb;
$wpdb->query("DROP TABLE IF EXISTS " . GdbcDbAccessController::getAttemptsTableName());
}
}
new GoodByeCaptchaUninstaller();