PluginProbe
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More / 2.0
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More v2.0
2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.7 2.6.8 2.6.5 2.6.4 2.6.3 2.6.2 2.6.0 2.5.5 2.5.4 2.5.3 2.5.2 trunk 1.0 1.0.1 1.0.2 1.0.3 1.1 1.1.1 1.1.2 1.2.0 All 37 releases
reviews-feed / uninstall.php
uninstall.php
71 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) {
3 exit; // Exit if accessed directly
4 }
5 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
6 exit();
7 }
8
9
10 $settings = get_option( 'sbr_settings', array() );
11
12 $preserve_settings = ! empty( $settings['preserve_settings'] ) && $settings['preserve_settings'];
13
14 if ( ! $preserve_settings ) {
15
16 // wp_options
17 $wp_options_keys = array(
18 'sbr_apikeys',
19 'sbr_apikeys_limit',
20 'sbr_business_cache',
21 'sbr_db_version',
22 'sbr_settings',
23 'sbr_statuses',
24 );
25 foreach ( $wp_options_keys as $key ) {
26 delete_option( $key );
27 }
28
29 // user roles
30 global $wp_roles;
31 $wp_roles->remove_cap( 'administrator', 'manage_reviews_feed_options' );
32
33 // cron events
34 $cron_keys = array(
35 'sbr_cron_additional_batch',
36 'sbr_feed_update',
37 );
38 foreach ( $cron_keys as $key ) {
39 wp_clear_scheduled_hook( $key );
40 }
41
42 // custom tables
43 global $wpdb;
44
45 $table_keys = array(
46 'sbr_feeds',
47 'sbr_feed_caches',
48 'sbr_feed_locator',
49 'sbr_posts',
50 'sbr_reviews_posts',
51 'sbr_sources',
52 );
53 foreach ( $table_keys as $key ) {
54 $table_name = $wpdb->prefix . $key;
55 $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
56 }
57
58 // custom image files
59 $upload = wp_upload_dir();
60 $folder = trailingslashit( $upload['basedir'] ) . trailingslashit( 'sbr-feed-images' );
61 $image_files = glob( $folder . '*' ); // get all file names
62 foreach ( $image_files as $file ) { // iterate files
63 if ( is_file( $file ) ) {
64 unlink( $file );
65 }
66 }
67
68 global $wp_filesystem;
69 $wp_filesystem->delete( $folder, true );
70 }
71