-
Notifications
You must be signed in to change notification settings - Fork 3
/
uninstall.php
60 lines (53 loc) · 1.77 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
53
54
55
56
57
58
59
60
<?php
/**
* Cleans up the plugin options.
*
* @package Fetch Tweets
* @copyright Copyright (c) 2013-2015, <Michael Uno>
* @author Michael Uno
* @authorurl http://michaeluno.jp
* @since 2.4.2
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
/*
* Plugin specific constant.
* We are going to load the main file to get the registry class. And in the main file,
* if this constant is set, it will return after declaring the registry class.
**/
if ( ! defined( 'DOING_UNINSTALL' ) ) {
define( 'DOING_UNINSTALL', true );
}
/**
* Set the main plugin file name here.
*/
$_sMaingPluginFileName = 'fetch-tweets.php';
if ( file_exists( dirname( __FILE__ ). '/' . $_sMaingPluginFileName ) ) {
include( $_sMaingPluginFileName );
}
if ( ! class_exists( 'FetchTweets_Commons' ) ) {
return;
}
// Delete the plugin option
$_oOption = FetchTweets_Option::getInstance();
if ( $_oOption->get( array( 'delete', 'delete_upon_uninstall' ) ) ) {
$_oOption->delete();
$_oTable = new FetchTweets_DatabaseTable_ft_http_requests;
$_oTable->uninstall();
// $_oTable = new FetchTweets_DatabaseTable_ft_tweets;
// $_oTable->uninstall();
}
// Delete transients
$_aPrefixes = array(
FetchTweets_Commons::TransientPrefix, // the plugin transients
'apf_', // the admin page framework transients
);
foreach( $_aPrefixes as $_sPrefix ) {
if ( ! $_sPrefix ) { continue; }
$GLOBALS['wpdb']->query( "DELETE FROM `" . $GLOBALS['table_prefix'] . "options` WHERE `option_name` LIKE ( '_transient_%{$_sPrefix}%' )" );
$GLOBALS['wpdb']->query( "DELETE FROM `" . $GLOBALS['table_prefix'] . "options` WHERE `option_name` LIKE ( '_transient_timeout_%{$_sPrefix}%' )" );
}