From c45621d896350dc4a0944ceae293e6e0ad575387 Mon Sep 17 00:00:00 2001 From: Marcus Quinn <6428977+marcusquinn@users.noreply.github.com> Date: Thu, 10 Apr 2025 01:13:49 +0100 Subject: [PATCH] Version 1.4.0: Rename plugin and update text domain --- CHANGELOG.md | 5 + README.md | 4 + build.sh | 4 +- fix-plugin-does-not-exist-notices.php | 10 +- plugin-reference-cleaner.php | 343 -------------------------- readme.txt | 6 +- rename-migration.md | 63 ----- 7 files changed, 21 insertions(+), 414 deletions(-) delete mode 100644 plugin-reference-cleaner.php delete mode 100644 rename-migration.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 46f3e0d..c929d60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. +## [1.4.0] - 2023-11-30 +### Changed +- Updated plugin name and text domain +- Repository rename from plugin-reference-cleaner to fix-plugin-does-not-exist-notices + ## [1.3.3] - 2023-10-05 ### Added - "Click here to scroll" button to automatically find missing plugins diff --git a/README.md b/README.md index d78405b..2ceda2c 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,10 @@ The plugin works by: ## Changelog +### 1.4.0 +- Updated plugin name and text domain +- Repository rename from plugin-reference-cleaner to fix-plugin-does-not-exist-notices + ### 1.3.3 * Improved notification placement next to WordPress error messages * Added "Click here to scroll" button that automatically locates missing plugins diff --git a/build.sh b/build.sh index a84cce2..3f21f78 100755 --- a/build.sh +++ b/build.sh @@ -10,7 +10,7 @@ if [ -z "$1" ]; then fi VERSION=$1 -PLUGIN_SLUG="plugin-reference-cleaner" +PLUGIN_SLUG="fix-plugin-does-not-exist-notices" BUILD_DIR="build/$PLUGIN_SLUG" ZIP_FILE="${PLUGIN_SLUG}-${VERSION}.zip" @@ -20,7 +20,7 @@ mkdir -p $BUILD_DIR # Copy required files echo "Copying plugin files..." -cp plugin-reference-cleaner.php $BUILD_DIR/ +cp fix-plugin-does-not-exist-notices.php $BUILD_DIR/ cp readme.txt $BUILD_DIR/ cp LICENSE $BUILD_DIR/ cp README.md $BUILD_DIR/ diff --git a/fix-plugin-does-not-exist-notices.php b/fix-plugin-does-not-exist-notices.php index cd577f4..b68ff96 100644 --- a/fix-plugin-does-not-exist-notices.php +++ b/fix-plugin-does-not-exist-notices.php @@ -10,7 +10,7 @@ * @wordpress-plugin * Plugin Name: Fix 'Plugin file does not exist.' Notices * Description: Adds missing plugins to the plugins list with a "Remove Reference" link so you can clean up invalid plugin entries. - * Version: 1.3.3 + * Version: 1.4.0 * Author: Marcus Quinn * Author URI: https://www.wpallstars.com * License: GPL-2.0+ @@ -103,7 +103,7 @@ class Fix_Plugin_Does_Not_Exist_Notices { // Add our action $nonce = wp_create_nonce('remove_plugin_reference_' . $plugin_file); $remove_url = admin_url('plugins.php?action=remove_reference&plugin=' . urlencode($plugin_file) . '&_wpnonce=' . $nonce); - $actions['remove_reference'] = 'Remove Reference'; + $actions['remove_reference'] = 'Remove Reference'; } return $actions; @@ -120,7 +120,7 @@ class Fix_Plugin_Does_Not_Exist_Notices { // Verify permissions if (!current_user_can('activate_plugins')) { - wp_die(__('You do not have sufficient permissions to perform this action.', 'plugin-reference-cleaner')); + wp_die(__('You do not have sufficient permissions to perform this action.', 'fix-plugin-does-not-exist-notices')); } // Get the plugin file @@ -231,7 +231,7 @@ class Fix_Plugin_Does_Not_Exist_Notices { ourNotice.className = 'prc-notice'; // Add content - ourNotice.innerHTML = '
To remove the above error notification, scroll down to find the plugin marked with "(File Missing)" and click its "Remove Reference" link.
' + 'This will permanently remove the missing plugin reference from your database.
' + 'Click here to scroll to the missing plugin
'; @@ -288,7 +288,7 @@ class Fix_Plugin_Does_Not_Exist_Notices { // Also display our standard info notice with more details echo 'Missing plugin files detected: The plugins listed below with (File Missing) tag no longer exist but are still referenced in your database.
'; echo 'How to fix: Click the "Remove Reference" link next to each missing plugin to safely remove it from your active plugins list.
'; echo 'This will clean up your database and remove the error notifications.
'; diff --git a/plugin-reference-cleaner.php b/plugin-reference-cleaner.php deleted file mode 100644 index 7621216..0000000 --- a/plugin-reference-cleaner.php +++ /dev/null @@ -1,343 +0,0 @@ -is_plugins_page()) { - return $plugins; - } - - // Get active plugins that don't exist - $invalid_plugins = $this->get_invalid_plugins(); - - // Add each invalid plugin to the plugin list - foreach ($invalid_plugins as $plugin_path) { - if (!isset($plugins[$plugin_path])) { - $plugin_name = basename($plugin_path); - $plugins[$plugin_path] = array( - 'Name' => $plugin_name . ' (File Missing)', - 'Description' => 'This plugin file does not exist. You can safely remove this reference.', - 'Version' => 'N/A', - 'Author' => '', - 'PluginURI' => '', - 'AuthorURI' => '', - 'Title' => $plugin_name . ' (Missing)', - 'AuthorName' => '' - ); - } - } - - return $plugins; - } - - /** - * Add the Remove Reference action link to invalid plugins - */ - public function add_remove_reference_action($actions, $plugin_file, $plugin_data, $context) { - // Only run on the plugins page - if (!$this->is_plugins_page()) { - return $actions; - } - - // Check if this is a missing plugin - if (isset($plugin_data['Name']) && strpos($plugin_data['Name'], '(File Missing)') !== false) { - // Clear existing actions - $actions = array(); - - // Add our action - $nonce = wp_create_nonce('remove_plugin_reference_' . $plugin_file); - $remove_url = admin_url('plugins.php?action=remove_reference&plugin=' . urlencode($plugin_file) . '&_wpnonce=' . $nonce); - $actions['remove_reference'] = 'Remove Reference'; - } - - return $actions; - } - - /** - * Handle the remove reference action - */ - public function handle_remove_reference() { - // Check if we're removing a reference - if (!isset($_GET['action']) || $_GET['action'] !== 'remove_reference' || !isset($_GET['plugin'])) { - return; - } - - // Verify permissions - if (!current_user_can('activate_plugins')) { - wp_die(__('You do not have sufficient permissions to perform this action.', 'plugin-reference-cleaner')); - } - - // Get the plugin file - $plugin_file = isset($_GET['plugin']) ? $_GET['plugin'] : ''; - - // Verify nonce - check_admin_referer('remove_plugin_reference_' . $plugin_file); - - // Remove the plugin reference - $success = $this->remove_plugin_reference($plugin_file); - - // Redirect back to plugins page with a message - $redirect = admin_url('plugins.php'); - $redirect = add_query_arg($success ? 'reference_removed' : 'reference_removal_failed', '1', $redirect); - wp_redirect($redirect); - exit; - } - - /** - * Remove a plugin reference from the active plugins - */ - public function remove_plugin_reference($plugin_file) { - $success = false; - - // Handle multisite network admin - if (is_multisite() && is_network_admin()) { - $active_plugins = get_site_option('active_sitewide_plugins', array()); - if (isset($active_plugins[$plugin_file])) { - unset($active_plugins[$plugin_file]); - $success = update_site_option('active_sitewide_plugins', $active_plugins); - } - } - // Handle single site or multisite subsite - else { - $active_plugins = get_option('active_plugins', array()); - $key = array_search($plugin_file, $active_plugins); - if ($key !== false) { - unset($active_plugins[$key]); - $active_plugins = array_values($active_plugins); // Re-index array - $success = update_option('active_plugins', $active_plugins); - } - } - - return $success; - } - - /** - * Display admin notices - */ - public function admin_notices() { - // Only run on the plugins page - if (!$this->is_plugins_page()) { - return; - } - - // Get invalid plugins - $invalid_plugins = $this->get_invalid_plugins(); - - // Create a highlighted notice immediately after WordPress error messages - if (!empty($invalid_plugins)) { - // Add a notice specifically targeting the WordPress error notification - // Use admin_head to ensure it runs early in the page load process - add_action('admin_head', function() use ($invalid_plugins) { - ?> - - - '; - echo 'Missing plugin files detected: The plugins listed below with (File Missing) tag no longer exist but are still referenced in your database.
'; - echo 'How to fix: Click the "Remove Reference" link next to each missing plugin to safely remove it from your active plugins list.
'; - echo 'This will clean up your database and remove the error notifications.
'; - echo 'Plugin reference removed successfully.
Failed to remove plugin reference. The plugin may already have been removed.