PluginProbe
Code Snippets / 4.0.0-beta.2
Code Snippets v4.0.0-beta.2
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
← All changes | uninstall.php +9 -60 2.14.44.0.0-beta.2 View file →
@@ -1,72 +1,21 @@
1 1 <?php
2 -
3 2 /**
4 3 * Cleans up data created by this plugin
4 + *
5 5 * @package Code_Snippets
6 - * @since 2.0
6 + * @since 2.0.0
7 7 */
8 8
9 -/* Ensure this plugin is actually being uninstalled */
10 -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
11 - exit();
12 -}
9 +namespace Code_Snippets;
13 10
14 -/* Fetch the Complete Uninstall option from the database settings */
15 -$unified = false;
16 -if ( is_multisite() ) {
17 - $menu_perms = get_site_option( 'menu_items', array() );
18 - $unified = empty( $menu_perms['snippets_settings'] );
19 -}
11 +use Code_Snippets\Core\Uninstaller;
20 12
21 -$settings = $unified ? get_site_option( 'code_snippets_settings' ) : get_option( 'code_snippets_settings' );
22 -
23 -/* Short circuit the uninstall cleanup process if the option is not enabled */
24 -if ( ! isset( $settings['general']['complete_uninstall'] ) || ! $settings['general']['complete_uninstall'] ) {
13 +// Ensure this plugin is actually being uninstalled.
14 +if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) || ( defined( 'CODE_SNIPPETS_PRO' ) && CODE_SNIPPETS_PRO ) ) {
25 15 return;
26 16 }
27 17
28 -/**
29 - * Clean up data created by this plugin for a single site
30 - * @since 2.0
31 - */
32 -function code_snippets_uninstall_site() {
33 - global $wpdb;
18 +require_once __DIR__ . '/php/Core/Uninstaller.php';
34 19
35 - /* Remove snippets database table */
36 - $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}snippets" );
37 -
38 - /* Remove saved options */
39 - delete_option( 'code_snippets_version' );
40 - delete_option( 'recently_activated_snippets' );
41 - delete_option( 'code_snippets_settings' );
42 -}
43 -
44 -
45 -global $wpdb;
46 -
47 -/* Multisite uninstall */
48 -
49 -if ( is_multisite() ) {
50 -
51 - /* Loop through sites */
52 - $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
53 -
54 - if ( $blog_ids ) {
55 -
56 - foreach ( $blog_ids as $blog_id ) {
57 - switch_to_blog( $blog_id );
58 - code_snippets_uninstall_site();
59 - }
60 -
61 - restore_current_blog();
62 - }
63 -
64 - /* Remove multisite snippets database table */
65 - $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}ms_snippets" );
66 -
67 - /* Remove saved options */
68 - delete_site_option( 'code_snippets_version' );
69 - delete_site_option( 'recently_activated_snippets' );
70 -} else {
71 - code_snippets_uninstall_site();
72 -}
20 +$uninstaller = new Uninstaller();
21 +$uninstaller->uninstall_plugin();