PluginProbe
WPVulnerability / 5.1.2
WPVulnerability v5.1.2
5.1.6 5.1.2 5.1.1 5.0.1 5.0.0 trunk 0.1 0.2 1.0 1.0.1 1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 All 57 releases
wpvulnerability / uninstall.php

uninstall.php in WPVulnerability 5.1.2, at uninstall.php

46 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin uninstall handler.
4 *
5 * WordPress runs this file when the plugin is deleted from the Plugins screen.
6 * Data is only deleted when the administrator has explicitly opted in by enabling
7 * the "Delete all plugin data on uninstall" option in the plugin settings.
8 * By default all data is preserved so that re-activating the plugin restores
9 * the previous state without any additional configuration.
10 *
11 * @package WPVulnerability
12 *
13 * @since 4.3.4
14 */
15
16 defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
17
18 // Resolve the opt-in preference.
19 $wpvulnerability_config = is_multisite()
20 ? get_site_option( 'wpvulnerability-config', array() )
21 : get_option( 'wpvulnerability-config', array() );
22
23 $wpvulnerability_delete_on_uninstall = is_array( $wpvulnerability_config ) && ! empty( $wpvulnerability_config['delete_on_uninstall'] );
24
25 if ( ! $wpvulnerability_delete_on_uninstall ) {
26 // User did not opt in — preserve all data (default behaviour).
27 return;
28 }
29
30 // User opted in: load the uninstall routine from the main plugin file.
31 // The main plugin file is not loaded during uninstall, so the constants that
32 // wpvulnerability-run.php references at the top level must be defined here first
33 // to avoid a fatal "Undefined constant" error (see wpvulnerability-run.php top-level add_filter).
34 if ( ! defined( 'WPVULNERABILITY_PLUGIN_PATH' ) ) {
35 define( 'WPVULNERABILITY_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
36 }
37 if ( ! defined( 'WPVULNERABILITY_PLUGIN_BASE' ) ) {
38 define( 'WPVULNERABILITY_PLUGIN_BASE', plugin_basename( WPVULNERABILITY_PLUGIN_PATH . 'wpvulnerability.php' ) );
39 }
40
41 require_once WPVULNERABILITY_PLUGIN_PATH . 'wpvulnerability-run.php';
42
43 if ( function_exists( 'wpvulnerability_uninstall' ) ) {
44 wpvulnerability_uninstall();
45 }
46