PluginProbe ʕ •ᴥ•ʔ
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More / 2.10.0
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More v2.10.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 2.0 2.1.0 2.1.1 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5.0 2.5.1
reviews-feed / uninstall.php
reviews-feed Last commit date
assets 3 weeks ago class 3 weeks ago config 3 weeks ago languages 3 weeks ago public 3 weeks ago templates 3 weeks ago tests 3 weeks ago vendor 3 weeks ago bootstrap.php 3 weeks ago crowdin.yml 3 weeks ago gpl-2.0.txt 3 weeks ago readme.txt 3 weeks ago sb-reviews.php 3 weeks ago uninstall.php 3 weeks ago
uninstall.php
75 lines
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit; // Exit if accessed directly
5 }
6 if (! defined('WP_UNINSTALL_PLUGIN')) {
7 exit();
8 }
9
10
11 $settings = get_option('sbr_settings', array());
12 if (! is_array($settings)) {
13 $settings = array();
14 }
15
16 $preserve_settings = ! empty($settings['preserve_settings']) && $settings['preserve_settings'];
17
18 if (! $preserve_settings) {
19 // wp_options
20 $wp_options_keys = array(
21 'sbr_apikeys',
22 'sbr_apikeys_limit',
23 'sbr_business_cache',
24 'sbr_db_version',
25 'sbr_settings',
26 'sbr_statuses',
27 );
28 foreach ($wp_options_keys as $key) {
29 delete_option($key);
30 }
31
32 // user roles
33 global $wp_roles;
34 $wp_roles->remove_cap('administrator', 'manage_reviews_feed_options');
35
36 // cron events
37 $cron_keys = array(
38 'sbr_cron_additional_batch',
39 'sbr_feed_update',
40 );
41 foreach ($cron_keys as $key) {
42 wp_clear_scheduled_hook($key);
43 }
44
45 // custom tables
46 global $wpdb;
47
48 $table_keys = array(
49 'sbr_feeds',
50 'sbr_feed_caches',
51 'sbr_feed_locator',
52 'sbr_posts',
53 'sbr_reviews_posts',
54 'sbr_sources',
55 );
56 foreach ($table_keys as $key) {
57 $table_name = $wpdb->prefix . $key;
58 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is safely constructed from $wpdb->prefix
59 $wpdb->query("DROP TABLE IF EXISTS $table_name");
60 }
61
62 // custom image files
63 $upload = wp_upload_dir();
64 $folder = trailingslashit($upload['basedir']) . trailingslashit('sbr-feed-images');
65 $image_files = glob($folder . '*'); // get all file names
66 foreach ($image_files as $file) { // iterate files
67 if (is_file($file)) {
68 unlink($file);
69 }
70 }
71
72 global $wp_filesystem;
73 $wp_filesystem->delete($folder, true);
74 }
75