PluginProbe
Vision – Interactive Image Map with Hotspots Builder / 1.9.2
Vision – Interactive Image Map with Hotspots Builder v1.9.2
1.12.2 1.12.1 1.12.0 1.11.0 1.6.0 1.6.1 1.6.2 1.7.1 1.7.2 1.7.3 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.9.0 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 All 33 releases
vision / includes / deactivator.php

deactivator.php in Vision – Interactive Image Map with Hotspots Builder 1.9.2, at includes/deactivator.php

49 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined('ABSPATH') || exit;
3
4 if(!class_exists('Vision_Deactivator')) :
5
6 class Vision_Deactivator {
7 public function deactivate() {
8 global $wpdb;
9 $table = $wpdb->prefix . VISION_PLUGIN_NAME;
10
11 // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
12 $sql = "SELECT COUNT(*) FROM {$table}";
13 $count = $wpdb->get_var($sql);
14 // phpcs:enable
15
16 if($count > 0) {
17 return;
18 }
19
20 // delete all if our tables are empty
21 $table = $wpdb->prefix . VISION_PLUGIN_NAME;
22
23 // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
24 $sql = "DROP TABLE IF EXISTS {$table}";
25 $wpdb->query($sql);
26 // phpcs:enable
27
28 delete_option('vision_db_version');
29 delete_option('vision_activated');
30 delete_option('vision_settings');
31
32 $this->delete_files(VISION_PLUGIN_UPLOAD_DIR . '/');
33 }
34
35 private function delete_files($target) {
36 if(is_dir($target)) {
37 $files = glob($target . '*', GLOB_MARK); //GLOB_MARK adds a slash to directories returned
38 foreach($files as $file) {
39 $this->delete_files($file);
40 }
41 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_rmdir
42 rmdir($target);
43 } else if(is_file($target)) {
44 wp_delete_file($target);
45 }
46 }
47 }
48
49 endif;