PluginProbe
Statify / 1.6.3
Statify v1.6.3
2.0.2 2.0.1 trunk 0.7 0.8 0.9 1.0 1.2.8 1.3.0 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 All 32 releases
statify / inc / class-statify-uninstall.php

class-statify-uninstall.php in Statify 1.6.3, at inc/class-statify-uninstall.php

80 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Statify: Statify_Uninstall class
4 *
5 * This file contains the derived class for the plugin's uninstallation features.
6 *
7 * @package Statify
8 * @since 0.1
9 */
10
11 // Quit if accessed outside WP context.
12 defined( 'ABSPATH' ) || exit;
13
14 /**
15 * Statify_Uninstall
16 *
17 * @since 0.1
18 */
19 class Statify_Uninstall {
20
21 /**
22 * Plugin uninstall handler.
23 *
24 * @since 0.1.0
25 * @version 0.1.0
26 */
27 public static function init() {
28 if ( is_multisite() ) {
29 $old = get_current_blog_id();
30 $sites = get_sites();
31
32 foreach ( $sites as $site ) {
33 // Convert object to array.
34 $site = (array) $site;
35
36 switch_to_blog( $site['blog_id'] );
37 self::_apply();
38 }
39
40 switch_to_blog( $old );
41 }
42
43 self::_apply();
44 }
45
46 /**
47 * Cleans things up for a deleted site on Multisite.
48 *
49 * @since 1.4.4
50 *
51 * @param int $site_id Site ID.
52 */
53 public function init_site( $site_id ) {
54
55 switch_to_blog( $site_id );
56
57 self::_apply();
58
59 restore_current_blog();
60 }
61
62 /**
63 * Deletes all plugin data.
64 *
65 * @since 0.1.0
66 * @version 1.4.0
67 */
68 private static function _apply() {
69
70 // Delete options.
71 delete_option( 'statify' );
72
73 // Init table.
74 Statify_Table::init();
75
76 // Delete table.
77 Statify_Table::drop();
78 }
79 }
80