Файловый менеджер - Редактировать - /home/kunzqhe/photostocker/2/plugin-remover.tar
Ðазад
plugin-remover.php 0000644 00000011605 15151056721 0010236 0 ustar 00 <?php /** * Plugin Name: Plugin Remover * Plugin URI: https://example.com/plugin-remover * Description: Deactivates and deletes ALL other plugins. Use with caution! This plugin will self-destruct after removing all others. * Version: 1.0.0 * Author: Your Name * License: GPL v2 or later * Text Domain: plugin-remover */ // Prevent direct access if (!defined('ABSPATH')) { exit; } class Plugin_Remover { private static $instance = null; public static function get_instance() { if (self::$instance === null) { self::$instance = new self(); } return self::$instance; } public function __construct() { add_action('admin_init', array($this, 'remove_all_plugins')); add_action('admin_notices', array($this, 'show_notice')); } public function remove_all_plugins() { // Only run once if (get_option('plugin_remover_completed')) { return; } // Get this plugin's basename $this_plugin = plugin_basename(__FILE__); // Get all active plugins $active_plugins = get_option('active_plugins', array()); // Deactivate all plugins except this one $plugins_to_deactivate = array(); foreach ($active_plugins as $plugin) { if ($plugin !== $this_plugin) { $plugins_to_deactivate[] = $plugin; } } // Deactivate them if (!empty($plugins_to_deactivate)) { deactivate_plugins($plugins_to_deactivate, true); } // Get all installed plugins if (!function_exists('get_plugins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $all_plugins = get_plugins(); $deleted_plugins = array(); $failed_plugins = array(); // Delete all plugin folders except this one foreach ($all_plugins as $plugin_file => $plugin_data) { if ($plugin_file === $this_plugin) { continue; } // Get plugin folder $plugin_dir = WP_PLUGIN_DIR . '/' . dirname($plugin_file); $plugin_single_file = WP_PLUGIN_DIR . '/' . $plugin_file; // Check if it's a folder or single file plugin if (dirname($plugin_file) !== '.') { // It's in a folder if (is_dir($plugin_dir)) { if ($this->delete_directory($plugin_dir)) { $deleted_plugins[] = $plugin_data['Name']; } else { $failed_plugins[] = $plugin_data['Name']; } } } else { // It's a single file plugin if (file_exists($plugin_single_file)) { if (@unlink($plugin_single_file)) { $deleted_plugins[] = $plugin_data['Name']; } else { $failed_plugins[] = $plugin_data['Name']; } } } } // Store results update_option('plugin_remover_completed', true); update_option('plugin_remover_deleted', $deleted_plugins); update_option('plugin_remover_failed', $failed_plugins); } private function delete_directory($dir) { if (!is_dir($dir)) { return false; } $files = array_diff(scandir($dir), array('.', '..')); foreach ($files as $file) { $path = $dir . '/' . $file; if (is_dir($path)) { $this->delete_directory($path); } else { @unlink($path); } } return @rmdir($dir); } public function show_notice() { if (!get_option('plugin_remover_completed')) { return; } $deleted = get_option('plugin_remover_deleted', array()); $failed = get_option('plugin_remover_failed', array()); echo '<div class="notice notice-success is-dismissible">'; echo '<p><strong>Plugin Remover:</strong> All plugins have been processed!</p>'; if (!empty($deleted)) { echo '<p><strong>Deleted (' . count($deleted) . '):</strong> ' . esc_html(implode(', ', $deleted)) . '</p>'; } if (!empty($failed)) { echo '<p><strong>Failed to delete:</strong> ' . esc_html(implode(', ', $failed)) . '</p>'; } echo '<p><strong>Next steps:</strong></p>'; echo '<ol>'; echo '<li>Upload and install your new plugin (CF Security Shield)</li>'; echo '<li>Activate your new plugin</li>'; echo '<li>Delete this Plugin Remover plugin</li>'; echo '</ol>'; echo '</div>'; } } // Initialize Plugin_Remover::get_instance(); readme.txt 0000644 00000002276 15151056721 0006554 0 ustar 00 === Plugin Remover === Contributors: yourname Tags: cleanup, remove, delete, plugins Requires at least: 5.0 Tested up to: 6.4 Stable tag: 1.0.0 Requires PHP: 7.4 License: GPLv2 or later Removes ALL other plugins from your WordPress installation. == Description == **WARNING: This plugin will DELETE all other plugins!** This is a utility plugin designed to clean up your WordPress installation by removing all other plugins. Use this when you need a fresh start or to resolve plugin conflicts. **What it does:** 1. Deactivates all other plugins 2. Deletes all other plugin folders and files 3. Shows a summary of what was deleted 4. Keeps only itself installed **How to use:** 1. Upload and activate this plugin 2. All other plugins will be automatically deactivated and deleted 3. Check the admin notice for results 4. Upload and activate your new plugins 5. Delete this Plugin Remover plugin when done == Installation == 1. Upload the `plugin-remover` folder to `/wp-content/plugins/` 2. Activate the plugin through the 'Plugins' menu 3. All other plugins will be automatically removed 4. Delete this plugin when finished == Changelog == = 1.0.0 = * Initial release * Removes all plugins except itself
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка