PluginProbe
Vision – Interactive Image Map with Hotspots Builder / trunk
Vision – Interactive Image Map with Hotspots Builder vtrunk
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 trunk, at includes/deactivator.php

47 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.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
12 $count = $wpdb->get_var( "SELECT COUNT(*) FROM {$table}" );
13 // phpcs:enable
14
15 if($count > 0) {
16 return;
17 }
18
19 // delete all if our tables are empty
20 $table = $wpdb->prefix . VISION_PLUGIN_NAME;
21
22 // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
23 $wpdb->query( "DROP TABLE IF EXISTS {$table}" );
24 // phpcs:enable
25
26 delete_option('vision_db_version');
27 delete_option('vision_activated');
28 delete_option('vision_settings');
29
30 $this->delete_files(VISION_PLUGIN_UPLOAD_DIR . '/');
31 }
32
33 private function delete_files($target) {
34 if(is_dir($target)) {
35 $files = glob($target . '*', GLOB_MARK); //GLOB_MARK adds a slash to directories returned
36 foreach($files as $file) {
37 $this->delete_files($file);
38 }
39 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_rmdir
40 rmdir($target);
41 } else if(is_file($target)) {
42 wp_delete_file($target);
43 }
44 }
45 }
46
47 endif;