custom-twitter-feeds
Last commit date
admin
3 weeks ago
assets
3 weeks ago
css
3 weeks ago
img
3 weeks ago
inc
3 weeks ago
js
3 weeks ago
languages
3 weeks ago
templates
3 weeks ago
vendor
3 weeks ago
views
3 weeks ago
README.md
3 weeks ago
README.txt
1 week ago
changelog.txt
3 weeks ago
custom-twitter-feed.php
3 weeks ago
uninstall.php
3 weeks ago
uninstall.php
98 lines
| 1 | <?php |
| 2 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 3 | exit(); |
| 4 | } |
| 5 | |
| 6 | //If the user is preserving the settings then don't delete them |
| 7 | $options = get_option( 'ctf_options' ); |
| 8 | $ctf_preserve_settings = isset( $options['preserve_settings'] ) ? $options['preserve_settings'] : false; |
| 9 | |
| 10 | // allow the user to preserve their settings in case they are upgrading |
| 11 | if ( ! $ctf_preserve_settings ) { |
| 12 | // clean up options from the database |
| 13 | delete_option( 'ctf_options' ); |
| 14 | delete_option( 'ctf_configure' ); |
| 15 | delete_option( 'ctf_customize' ); |
| 16 | delete_option( 'ctf_style' ); |
| 17 | delete_option( 'ctf_statuses' ); |
| 18 | |
| 19 | delete_option( 'ctf_rating_notice' ); |
| 20 | delete_option( 'ctf_notifications' ); |
| 21 | delete_option( 'ctf_local_avatars' ); |
| 22 | delete_option( 'ctf_cron_start_jitter' ); |
| 23 | |
| 24 | // delete tweet cache in transients |
| 25 | global $wpdb; |
| 26 | $table_name = $wpdb->prefix . "options"; |
| 27 | $wpdb->query( " |
| 28 | DELETE |
| 29 | FROM $table_name |
| 30 | WHERE `option_name` LIKE ('%\_transient\_ctf\_%') |
| 31 | " ); |
| 32 | $wpdb->query( " |
| 33 | DELETE |
| 34 | FROM $table_name |
| 35 | WHERE `option_name` LIKE ('%\_transient\_timeout\_ctf\_%') |
| 36 | " ); |
| 37 | |
| 38 | //Delete all persistent caches (start with ctf_!) |
| 39 | global $wpdb; |
| 40 | $table_name = $wpdb->prefix . "options"; |
| 41 | $result = $wpdb->query(" |
| 42 | DELETE |
| 43 | FROM $table_name |
| 44 | WHERE `option_name` LIKE ('%ctf\_\!%') |
| 45 | "); |
| 46 | delete_option( 'ctf_cache_list' ); |
| 47 | |
| 48 | // remove any scheduled cron jobs |
| 49 | wp_clear_scheduled_hook( 'ctf_cron_job' ); |
| 50 | |
| 51 | delete_option( 'ctf_usage_tracking_config' ); |
| 52 | // Usage-tracking consent, site token and telemetry are shared with the Pro plugin. Only remove |
| 53 | // them when Pro is not active, otherwise deleting the free plugin would reset Pro's consent. |
| 54 | $ctf_network_active = is_multisite() ? (array) get_site_option( 'active_sitewide_plugins', array() ) : array(); |
| 55 | $ctf_pro_active = in_array( 'custom-twitter-feeds-pro/custom-twitter-feed.php', (array) get_option( 'active_plugins', array() ), true ) |
| 56 | || isset( $ctf_network_active['custom-twitter-feeds-pro/custom-twitter-feed.php'] ); |
| 57 | if ( ! $ctf_pro_active ) { |
| 58 | delete_option( 'ctf_usage_tracking' ); |
| 59 | delete_option( 'ctf_smash_usage_tracking' ); |
| 60 | delete_option( 'ctf_smash_usage_tracking_site_token' ); |
| 61 | delete_option( 'ctf_smash_usage_tracking_schedule' ); |
| 62 | delete_option( 'ctf_smash_usage_events' ); |
| 63 | delete_option( 'ctf_smash_usage_active_dates' ); |
| 64 | delete_option( 'ctf_smash_usage_session_durations' ); |
| 65 | } |
| 66 | |
| 67 | wp_clear_scheduled_hook( 'ctf_usage_tracking_cron' ); |
| 68 | wp_clear_scheduled_hook( 'ctf_free_smash_usage_tracking_cron' ); |
| 69 | wp_clear_scheduled_hook( 'ctf_feed_update' ); |
| 70 | |
| 71 | delete_option( 'ctf_db_version' ); |
| 72 | delete_option( 'ctf_ver' ); |
| 73 | delete_option( 'ctf_welcome_seen' ); |
| 74 | delete_option( 'ctf_rating_notice' ); |
| 75 | delete_option( 'ctf_notifications' ); |
| 76 | delete_option( 'ctf_newuser_notifications' ); |
| 77 | delete_option( 'ctf_statuses' ); |
| 78 | delete_option( 'ctf_cron_report' ); |
| 79 | delete_option( 'ctf_legacy_feed_settings' ); |
| 80 | delete_option( 'ctf_check_license_api_when_expires' ); |
| 81 | delete_option( 'ctf_license_last_check_timestamp' ); |
| 82 | delete_option( 'ctf_license_data' ); |
| 83 | delete_option( 'ctf_license_key' ); |
| 84 | delete_option( 'ctf_license_status' ); |
| 85 | |
| 86 | global $wpdb; |
| 87 | |
| 88 | $locator_table_name = $wpdb->prefix . 'ctf_feed_locator'; |
| 89 | $wpdb->query( "DROP TABLE IF EXISTS $locator_table_name" ); |
| 90 | |
| 91 | $feed_caches_table_name = $wpdb->prefix . 'ctf_feed_caches'; |
| 92 | $wpdb->query( "DROP TABLE IF EXISTS $feed_caches_table_name" ); |
| 93 | |
| 94 | $feeds_table_name = $wpdb->prefix . 'ctf_feeds'; |
| 95 | $wpdb->query( "DROP TABLE IF EXISTS $feeds_table_name" ); |
| 96 | } |
| 97 | |
| 98 |