| 1 |
<?php |
| 2 |
/** |
| 3 |
* Uninstall all Getwid data. |
| 4 |
* |
| 5 |
*/ |
| 6 |
|
| 7 |
defined( 'WP_UNINSTALL_PLUGIN' ) || exit; |
| 8 |
|
| 9 |
$options = array( |
| 10 |
'getwid_db_version', |
| 11 |
'getwid_db_version_history', |
| 12 |
|
| 13 |
'getwid_instagram_token', |
| 14 |
'getwid_instagram_cache_timeout', |
| 15 |
'getwid_instagram_token_cron_error_message', |
| 16 |
|
| 17 |
'getwid_google_api_key', |
| 18 |
|
| 19 |
'getwid_mailchimp_api_key', |
| 20 |
|
| 21 |
'getwid_recaptcha_v2_site_key', |
| 22 |
'getwid_recaptcha_v2_secret_key', |
| 23 |
|
| 24 |
'getwid_section_content_width', |
| 25 |
'getwid_smooth_animation', |
| 26 |
|
| 27 |
'getwid_autoptimize', |
| 28 |
'getwid_aggregate_css', |
| 29 |
|
| 30 |
'getwid_load_assets_on_demand', |
| 31 |
'getwid_move_css_to_head', |
| 32 |
|
| 33 |
/* |
| 34 |
* SELECT `option_name` FROM `wp_options` WHERE `option_name` LIKE '%getwid/%' LIMIT 100 |
| 35 |
*/ |
| 36 |
'getwid/accordion::disabled', |
| 37 |
'getwid/advanced-heading::disabled', |
| 38 |
'getwid/advanced-spacer::disabled', |
| 39 |
'getwid/anchor::disabled', |
| 40 |
'getwid/banner::disabled', |
| 41 |
'getwid/button-group::disabled', |
| 42 |
'getwid/circle-progress-bar::disabled', |
| 43 |
'getwid/contact-form::disabled', |
| 44 |
'getwid/content-timeline::disabled', |
| 45 |
'getwid/countdown::disabled', |
| 46 |
'getwid/counter::disabled', |
| 47 |
'getwid/custom-post-type::disabled', |
| 48 |
'getwid/icon-box::disabled', |
| 49 |
'getwid/icon::disabled', |
| 50 |
'getwid/image-box::disabled', |
| 51 |
'getwid/image-hotspot::disabled', |
| 52 |
'getwid/images-slider::disabled', |
| 53 |
'getwid/images-stack::disabled', |
| 54 |
'getwid/instagram::disabled', |
| 55 |
'getwid/mailchimp::disabled', |
| 56 |
'getwid/map::disabled', |
| 57 |
'getwid/media-text-slider::disabled', |
| 58 |
'getwid/person::disabled', |
| 59 |
'getwid/post-carousel::disabled', |
| 60 |
'getwid/post-slider::disabled', |
| 61 |
'getwid/price-box::disabled', |
| 62 |
'getwid/price-list::disabled', |
| 63 |
'getwid/progress-bar::disabled', |
| 64 |
'getwid/recent-posts::disabled', |
| 65 |
'getwid/section::disabled', |
| 66 |
'getwid/social-links::disabled', |
| 67 |
'getwid/table-of-contents::disabled', |
| 68 |
'getwid/table::disabled', |
| 69 |
'getwid/tabs::disabled', |
| 70 |
'getwid/template-library::disabled', |
| 71 |
'getwid/template-post-author::disabled', |
| 72 |
'getwid/template-post-button::disabled', |
| 73 |
'getwid/template-post-categories::disabled', |
| 74 |
'getwid/template-post-comments::disabled', |
| 75 |
'getwid/template-post-content::disabled', |
| 76 |
'getwid/template-post-custom-field::disabled', |
| 77 |
'getwid/template-post-date::disabled', |
| 78 |
'getwid/template-post-featured-background-image::disabled', |
| 79 |
'getwid/template-post-featured-image::disabled', |
| 80 |
'getwid/template-post-link::disabled', |
| 81 |
'getwid/template-post-meta::disabled', |
| 82 |
'getwid/template-post-tags::disabled', |
| 83 |
'getwid/template-post-title::disabled', |
| 84 |
'getwid/testimonial::disabled', |
| 85 |
'getwid/toggle::disabled', |
| 86 |
'getwid/video-popup::disabled', |
| 87 |
|
| 88 |
'getwid/template-acf-background-image::disabled', |
| 89 |
'getwid/template-acf-image::disabled', |
| 90 |
'getwid/template-acf-select::disabled', |
| 91 |
'getwid/template-acf-wysiwyg::disabled', |
| 92 |
); |
| 93 |
|
| 94 |
if ( ! is_multisite() ) { |
| 95 |
|
| 96 |
foreach ( $options as $option ) { |
| 97 |
delete_option( $option ); |
| 98 |
} |
| 99 |
|
| 100 |
// Remove scheduled events. |
| 101 |
foreach ( array( 'getwid_refresh_instagram_token' ) as $event ) { |
| 102 |
if ( wp_get_schedule( $event ) ) { |
| 103 |
wp_clear_scheduled_hook( $event ); |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
} else { |
| 108 |
|
| 109 |
global $wpdb; |
| 110 |
|
| 111 |
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
| 112 |
|
| 113 |
foreach ( $blog_ids as $blog_id ) { |
| 114 |
|
| 115 |
switch_to_blog( $blog_id ); |
| 116 |
|
| 117 |
foreach ( $options as $option ) { |
| 118 |
delete_option( $option ); |
| 119 |
} |
| 120 |
|
| 121 |
// Remove scheduled events. |
| 122 |
foreach ( array( 'getwid_refresh_instagram_token' ) as $event ) { |
| 123 |
if ( wp_get_schedule( $event ) ) { |
| 124 |
wp_clear_scheduled_hook( $event ); |
| 125 |
} |
| 126 |
} |
| 127 |
|
| 128 |
restore_current_blog(); |
| 129 |
} |
| 130 |
|
| 131 |
} |
| 132 |
|
| 133 |
// All done. |
| 134 |
|