-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
37 lines (30 loc) · 1.18 KB
/
uninstall.php
File metadata and controls
37 lines (30 loc) · 1.18 KB
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
<?php
/**
* Picker uninstall
*
* Uninstalling Picker plugin cleanup cache and widget data
*
* @author Andrea Landonio
* @category Core
* @package Picker
*/
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) )
exit();
global $wpdb;
// Get cache cleanup value
$pkr_cache_cleanup = picker_get_option_value( 'pkr_cache_cleanup' , PKR_CACHE_CLEANUP );
// Check if cache cleanup is enabled
if ( $pkr_cache_cleanup ) {
// Get WordPress version
$wp_version = get_bloginfo( 'version' );
// Check WordPress version, apply deactivation rules only for WordPress or higher
if ( $wp_version >= 3.9 ) {
// Remove all picker widget transient data
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE '%s'", '_transient_widget_' . PKR_BASE . '%' ) );
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE '%s'", '_transient_timeout_widget_' . PKR_BASE . '%' ) );
// Remove all picker widget data
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name = '%s'", 'widget_picker' ) );
// Remove all picker admin page data
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name = '%s'", 'picker' ) );
}
}