Add GU Branch Fix plugin to fix Git Updater branch issues
This commit is contained in:
@ -2,6 +2,15 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [2.0.11] - 2024-05-19
|
||||
### Added
|
||||
- Created separate "GU Branch Fix" plugin to fix Git Updater branch issues
|
||||
- Added deploy script for local testing
|
||||
|
||||
### Fixed
|
||||
- Git Updater branch issues with 'main' vs 'master' branch names
|
||||
- Improved compatibility with Git Updater plugin
|
||||
|
||||
## [2.0.10] - 2024-05-18
|
||||
### Fixed
|
||||
- Plugin details popup version display issue with Git Updater integration
|
||||
|
33
README-gu-branch-fix.md
Normal file
33
README-gu-branch-fix.md
Normal file
@ -0,0 +1,33 @@
|
||||
# GU Branch Fix
|
||||
|
||||
A simple WordPress plugin to fix Git Updater branch issues for plugins using 'main' instead of 'master'.
|
||||
|
||||
## Description
|
||||
|
||||
This small utility plugin addresses an issue with Git Updater where it defaults to using 'master' as the primary branch name, while many modern repositories use 'main' as their primary branch.
|
||||
|
||||
The plugin adds filters to:
|
||||
1. Change the branch from 'master' to 'main' for specific plugins
|
||||
2. Fix API URLs by replacing '/master/' with '/main/'
|
||||
3. Fix download links by replacing '/master.zip' with '/main.zip'
|
||||
|
||||
## Installation
|
||||
|
||||
1. Upload the plugin files to the `/wp-content/plugins/gu-branch-fix` directory, or install the plugin through the WordPress plugins screen directly.
|
||||
2. Activate the plugin through the 'Plugins' screen in WordPress.
|
||||
3. No configuration is needed - it works automatically.
|
||||
|
||||
## Usage
|
||||
|
||||
This plugin is specifically designed to work with the "Fix 'Plugin file does not exist' Notices" plugin, but can be easily modified to work with any plugin that uses 'main' as its primary branch.
|
||||
|
||||
To add support for other plugins, simply modify the conditional checks in the filter functions.
|
||||
|
||||
## Changelog
|
||||
|
||||
### 1.0.0
|
||||
* Initial release
|
||||
|
||||
## License
|
||||
|
||||
This plugin is licensed under the GPL v2 or later.
|
@ -1,4 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Simple wrapper to call the deploy-local script
|
||||
./scripts/deploy-local.sh
|
||||
# Deploy script for local testing
|
||||
# This script copies the plugins to the local WordPress plugins directory
|
||||
|
||||
# Set variables
|
||||
SOURCE_DIR="$(pwd)"
|
||||
TARGET_DIR="$HOME/Local/plugin-testing/app/public/wp-content/plugins"
|
||||
MAIN_PLUGIN_NAME="fix-plugin-file-does-not-exist-notices"
|
||||
BRANCH_FIX_PLUGIN_NAME="gu-branch-fix"
|
||||
|
||||
# Create target directories if they don't exist
|
||||
mkdir -p "$TARGET_DIR/$MAIN_PLUGIN_NAME"
|
||||
mkdir -p "$TARGET_DIR/$BRANCH_FIX_PLUGIN_NAME"
|
||||
|
||||
# Clean up target directories first
|
||||
echo "Cleaning up target directories..."
|
||||
rm -rf "$TARGET_DIR/$MAIN_PLUGIN_NAME"/*
|
||||
rm -rf "$TARGET_DIR/$BRANCH_FIX_PLUGIN_NAME"/*
|
||||
|
||||
# Copy main plugin files
|
||||
echo "Copying main plugin files..."
|
||||
cp "$SOURCE_DIR/wp-fix-plugin-does-not-exist-notices.php" "$TARGET_DIR/$MAIN_PLUGIN_NAME/fix-plugin-file-does-not-exist-notices.php"
|
||||
cp "$SOURCE_DIR/readme.txt" "$TARGET_DIR/$MAIN_PLUGIN_NAME/"
|
||||
|
||||
# Copy additional directories and files for the main plugin
|
||||
if [ -d "$SOURCE_DIR/admin" ]; then
|
||||
mkdir -p "$TARGET_DIR/$MAIN_PLUGIN_NAME/admin"
|
||||
cp -R "$SOURCE_DIR/admin"/* "$TARGET_DIR/$MAIN_PLUGIN_NAME/admin/"
|
||||
fi
|
||||
|
||||
if [ -d "$SOURCE_DIR/assets" ]; then
|
||||
mkdir -p "$TARGET_DIR/$MAIN_PLUGIN_NAME/assets"
|
||||
cp -R "$SOURCE_DIR/assets"/* "$TARGET_DIR/$MAIN_PLUGIN_NAME/assets/"
|
||||
fi
|
||||
|
||||
if [ -d "$SOURCE_DIR/includes" ]; then
|
||||
mkdir -p "$TARGET_DIR/$MAIN_PLUGIN_NAME/includes"
|
||||
cp -R "$SOURCE_DIR/includes"/* "$TARGET_DIR/$MAIN_PLUGIN_NAME/includes/"
|
||||
fi
|
||||
|
||||
if [ -d "$SOURCE_DIR/languages" ]; then
|
||||
mkdir -p "$TARGET_DIR/$MAIN_PLUGIN_NAME/languages"
|
||||
cp -R "$SOURCE_DIR/languages"/* "$TARGET_DIR/$MAIN_PLUGIN_NAME/languages/"
|
||||
fi
|
||||
|
||||
if [ -d "$SOURCE_DIR/vendor" ]; then
|
||||
mkdir -p "$TARGET_DIR/$MAIN_PLUGIN_NAME/vendor"
|
||||
cp -R "$SOURCE_DIR/vendor"/* "$TARGET_DIR/$MAIN_PLUGIN_NAME/vendor/"
|
||||
fi
|
||||
|
||||
# Copy branch fix plugin files
|
||||
echo "Copying branch fix plugin files..."
|
||||
cp "$SOURCE_DIR/gu-branch-fix.php" "$TARGET_DIR/$BRANCH_FIX_PLUGIN_NAME/"
|
||||
|
||||
echo "Deployment complete!"
|
||||
echo "Main plugin deployed to: $TARGET_DIR/$MAIN_PLUGIN_NAME"
|
||||
echo "Branch fix plugin deployed to: $TARGET_DIR/$BRANCH_FIX_PLUGIN_NAME"
|
||||
|
||||
echo "\nRemember to activate both plugins in WordPress:"
|
||||
echo "1. Fix 'Plugin file does not exist' Notices"
|
||||
echo "2. GU Branch Fix"
|
||||
echo "3. Git Updater"
|
||||
|
51
gu-branch-fix.php
Normal file
51
gu-branch-fix.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: GU Branch Fix
|
||||
* Plugin URI: https://www.wpallstars.com
|
||||
* Description: Fixes Git Updater branch issues for plugins using 'main' instead of 'master'
|
||||
* Version: 1.0.0
|
||||
* Author: Marcus Quinn & WP ALLSTARS
|
||||
* Author URI: https://www.wpallstars.com
|
||||
* License: GPL-2.0+
|
||||
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
*/
|
||||
|
||||
// If this file is called directly, abort.
|
||||
if (!defined('WPINC')) {
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix Git Updater branch issues
|
||||
*
|
||||
* This simple plugin adds a filter to change the branch from 'master' to 'main'
|
||||
* for the wp-fix-plugin-does-not-exist-notices plugin.
|
||||
*/
|
||||
add_filter('gu_get_repo_branch', function($branch, $git, $repo) {
|
||||
if (isset($repo->slug) &&
|
||||
(strpos($repo->slug, 'wp-fix-plugin-does-not-exist-notices') !== false ||
|
||||
strpos($repo->slug, 'fix-plugin-does-not-exist-notices') !== false)) {
|
||||
return 'main';
|
||||
}
|
||||
return $branch;
|
||||
}, 999, 3);
|
||||
|
||||
// Fix for Git Updater API URLs
|
||||
add_filter('gu_get_repo_api', function($api_url, $git, $repo) {
|
||||
if (isset($repo->slug) &&
|
||||
(strpos($repo->slug, 'wp-fix-plugin-does-not-exist-notices') !== false ||
|
||||
strpos($repo->slug, 'fix-plugin-does-not-exist-notices') !== false)) {
|
||||
return str_replace('/master/', '/main/', $api_url);
|
||||
}
|
||||
return $api_url;
|
||||
}, 999, 3);
|
||||
|
||||
// Fix for Git Updater download URLs
|
||||
add_filter('gu_download_link', function($download_link, $git, $repo) {
|
||||
if (isset($repo->slug) &&
|
||||
(strpos($repo->slug, 'wp-fix-plugin-does-not-exist-notices') !== false ||
|
||||
strpos($repo->slug, 'fix-plugin-does-not-exist-notices') !== false)) {
|
||||
return str_replace('/master.zip', '/main.zip', $download_link);
|
||||
}
|
||||
return $download_link;
|
||||
}, 999, 3);
|
@ -1,114 +1,59 @@
|
||||
# Copyright (C) 2025 Marcus Quinn & The WP ALLSTARS Team
|
||||
# Copyright (C) 2024 Marcus Quinn & WP ALLSTARS
|
||||
# This file is distributed under the GPL-2.0+.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Fix 'Plugin file does not exist.' Notices 2.0.10\n"
|
||||
"Project-Id-Version: Fix 'Plugin file does not exist' Notices 2.0.11\n"
|
||||
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-fix-plugin-does-not-exist-notices\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-18T12:00:00+00:00\n"
|
||||
"POT-Creation-Date: 2024-05-19T00:00:00+00:00\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"X-Generator: WP-CLI 2.8.1\n"
|
||||
"X-Generator: WP-CLI 2.9.0\n"
|
||||
"X-Domain: wp-fix-plugin-does-not-exist-notices\n"
|
||||
|
||||
#. Plugin Name of the plugin
|
||||
msgid "Fix 'Plugin file does not exist.' Notices"
|
||||
msgid "Fix 'Plugin file does not exist' Notices"
|
||||
msgstr ""
|
||||
|
||||
#. Plugin URI of the plugin
|
||||
msgid "https://wordpress.org/plugins/wp-fix-plugin-does-not-exist-notices/"
|
||||
msgid "https://www.wpallstars.com"
|
||||
msgstr ""
|
||||
|
||||
#. Description of the plugin
|
||||
msgid "Adds missing plugins to the plugins list with a \"Remove Reference\" link so you can permanently clean up invalid plugin entries and remove error notices."
|
||||
msgid "Adds missing plugins to your plugins list with a \"Remove Notice\" action link, allowing you to safely clean up invalid plugin references."
|
||||
msgstr ""
|
||||
|
||||
#. Author of the plugin
|
||||
msgid "Marcus Quinn & The WP ALLSTARS Team"
|
||||
msgid "Marcus Quinn & WP ALLSTARS"
|
||||
msgstr ""
|
||||
|
||||
#. Author URI of the plugin
|
||||
msgid "https://www.wpallstars.com"
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:127
|
||||
msgid "Click here to scroll to missing plugins"
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:128
|
||||
msgid "Plugin file missing"
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:129
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:205
|
||||
msgid "Remove Reference"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Path to wp-content/plugins
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:161
|
||||
msgid "This plugin is still marked as \"Active\" in your database — but its folder and files can't be found in %s. Click \"Remove Reference\" to permanently remove it from your active plugins list and eliminate the error notice."
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:164
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:168
|
||||
msgid "Missing"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Plugin file path
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:204
|
||||
msgid "Remove reference to missing plugin %s"
|
||||
msgid "This plugin is still marked as \"Active\" in your database — but its folder and files can't be found in %s. Click \"Remove Notice\" to permanently remove it from your active plugins list and eliminate the error notice."
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:227
|
||||
msgid "You do not have sufficient permissions to perform this action."
|
||||
msgid "Remove Notice"
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:233
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:264
|
||||
msgid "Invalid plugin specified."
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:308
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:318
|
||||
msgid "Plugin reference removed successfully."
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:316
|
||||
msgid "Failed to remove plugin reference. The plugin may already have been removed, or there was a database issue."
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:325
|
||||
msgid "Failed to remove plugin reference. Please try again."
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:331
|
||||
msgid "Fix Plugin Does Not Exist Notices"
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:333
|
||||
msgid "Missing plugin files detected:"
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:334
|
||||
msgid "The plugins listed below with a"
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:335
|
||||
msgid "File Missing"
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:336
|
||||
msgid "tag no longer exist but are still referenced in your database."
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:339
|
||||
msgid "How to fix:"
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:340
|
||||
msgid "Click the \"Remove Reference\" link next to each missing plugin to safely remove it from your active plugins list."
|
||||
msgstr ""
|
||||
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:342
|
||||
msgid "This will clean up your database and remove the error notifications."
|
||||
#: wp-fix-plugin-does-not-exist-notices.php:456
|
||||
msgid "This plugin is still marked as \"Active\" in your database — but its folder and files can't be found in %s. Use the \"Remove Notice\" link on the plugins page to permanently remove it from your active plugins list and eliminate the error notice."
|
||||
msgstr ""
|
||||
|
@ -5,7 +5,7 @@ Tags: plugins, missing plugins, cleanup, error fix, admin tools, plugin file doe
|
||||
Requires at least: 5.0
|
||||
Tested up to: 6.7.2
|
||||
Requires PHP: 7.0
|
||||
Stable tag: 2.0.10
|
||||
Stable tag: 2.0.11
|
||||
License: GPL-2.0+
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
@ -140,6 +140,12 @@ Manually editing the WordPress database is risky and requires technical knowledg
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 2.0.11 =
|
||||
* Added: Created separate "GU Branch Fix" plugin to fix Git Updater branch issues
|
||||
* Added: Deploy script for local testing
|
||||
* Fixed: Git Updater branch issues with 'main' vs 'master' branch names
|
||||
* Improved: Compatibility with Git Updater plugin
|
||||
|
||||
= 2.0.10 =
|
||||
* Fixed: Plugin details popup version display issue with Git Updater integration
|
||||
* Added: JavaScript-based solution to ensure correct version display in plugin details
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Plugin Name: Fix 'Plugin file does not exist' Notices
|
||||
* Plugin URI: https://www.wpallstars.com
|
||||
* Description: Adds missing plugins to your plugins list with a "Remove Notice" action link, allowing you to safely clean up invalid plugin references.
|
||||
* Version: 2.0.10
|
||||
* Version: 2.0.11
|
||||
* Author: Marcus Quinn & WP ALLSTARS
|
||||
* Author URI: https://www.wpallstars.com
|
||||
* License: GPL-2.0+
|
||||
@ -12,6 +12,9 @@
|
||||
* Domain Path: /languages
|
||||
* GitHub Plugin URI: wpallstars/wp-fix-plugin-does-not-exist-notices
|
||||
* GitHub Branch: main
|
||||
* Primary Branch: main
|
||||
* Release Branch: main
|
||||
* Release Asset: true
|
||||
* Update URI: https://github.com/wpallstars/wp-fix-plugin-does-not-exist-notices
|
||||
*
|
||||
* @package Fix_Plugin_Does_Not_Exist_Notices
|
||||
@ -23,10 +26,110 @@ if ( ! defined( 'WPINC' ) ) {
|
||||
}
|
||||
|
||||
// Define plugin constants.
|
||||
define( 'FPDEN_VERSION', '2.0.10' );
|
||||
define( 'FPDEN_VERSION', '2.0.11' );
|
||||
define( 'FPDEN_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'FPDEN_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||
|
||||
// Direct fix for Git Updater branch issue - added to main file to avoid loading issues
|
||||
add_action('plugins_loaded', 'fpden_init_git_updater_fixes');
|
||||
|
||||
/**
|
||||
* Initialize Git Updater fixes
|
||||
*
|
||||
* This function adds filters to fix Git Updater's handling of 'main' vs 'master' branches
|
||||
* It uses named functions instead of anonymous functions for better compatibility
|
||||
*/
|
||||
function fpden_init_git_updater_fixes() {
|
||||
// Fix for Git Updater looking for 'master' branch instead of 'main'
|
||||
add_filter('gu_get_repo_branch', 'fpden_override_branch', 999, 3);
|
||||
|
||||
// Fix for Git Updater API URLs
|
||||
add_filter('gu_get_repo_api', 'fpden_override_api_url', 999, 3);
|
||||
|
||||
// Fix for Git Updater download URLs
|
||||
add_filter('gu_download_link', 'fpden_override_download_link', 999, 3);
|
||||
|
||||
// Fix for Git Updater repository metadata
|
||||
add_filter('gu_get_repo_meta', 'fpden_override_repo_meta', 999, 2);
|
||||
|
||||
// Fix for Git Updater API responses
|
||||
add_filter('gu_api_repo_type_data', 'fpden_override_repo_type_data', 999, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the branch name for our plugin
|
||||
*/
|
||||
function fpden_override_branch($branch, $git, $repo) {
|
||||
if (isset($repo->slug) &&
|
||||
(strpos($repo->slug, 'wp-fix-plugin-does-not-exist-notices') !== false ||
|
||||
strpos($repo->slug, 'fix-plugin-does-not-exist-notices') !== false)) {
|
||||
return 'main';
|
||||
}
|
||||
return $branch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the API URL for our plugin
|
||||
*/
|
||||
function fpden_override_api_url($api_url, $git, $repo) {
|
||||
if (isset($repo->slug) &&
|
||||
(strpos($repo->slug, 'wp-fix-plugin-does-not-exist-notices') !== false ||
|
||||
strpos($repo->slug, 'fix-plugin-does-not-exist-notices') !== false)) {
|
||||
return str_replace('/master/', '/main/', $api_url);
|
||||
}
|
||||
return $api_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the download link for our plugin
|
||||
*/
|
||||
function fpden_override_download_link($download_link, $git, $repo) {
|
||||
if (isset($repo->slug) &&
|
||||
(strpos($repo->slug, 'wp-fix-plugin-does-not-exist-notices') !== false ||
|
||||
strpos($repo->slug, 'fix-plugin-does-not-exist-notices') !== false)) {
|
||||
return str_replace('/master.zip', '/main.zip', $download_link);
|
||||
}
|
||||
return $download_link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override repository metadata for our plugin
|
||||
*/
|
||||
function fpden_override_repo_meta($repo_meta, $repo) {
|
||||
if (isset($repo->slug) &&
|
||||
(strpos($repo->slug, 'wp-fix-plugin-does-not-exist-notices') !== false ||
|
||||
strpos($repo->slug, 'fix-plugin-does-not-exist-notices') !== false)) {
|
||||
|
||||
// Set the correct repository information
|
||||
$repo_meta['github_updater_repo'] = 'wp-fix-plugin-does-not-exist-notices';
|
||||
$repo_meta['github_updater_branch'] = 'main';
|
||||
$repo_meta['github_updater_api'] = 'https://api.github.com';
|
||||
$repo_meta['github_updater_raw'] = 'https://raw.githubusercontent.com/wpallstars/wp-fix-plugin-does-not-exist-notices/main';
|
||||
}
|
||||
return $repo_meta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override repository type data for our plugin
|
||||
*/
|
||||
function fpden_override_repo_type_data($data, $response, $repo) {
|
||||
if (isset($repo->slug) &&
|
||||
(strpos($repo->slug, 'wp-fix-plugin-does-not-exist-notices') !== false ||
|
||||
strpos($repo->slug, 'fix-plugin-does-not-exist-notices') !== false)) {
|
||||
|
||||
// Set the correct branch
|
||||
if (isset($data['branch'])) {
|
||||
$data['branch'] = 'main';
|
||||
}
|
||||
|
||||
// Set the correct version
|
||||
if (isset($data['version'])) {
|
||||
$data['version'] = FPDEN_VERSION;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main plugin class.
|
||||
*
|
||||
@ -88,12 +191,12 @@ class Fix_Plugin_Does_Not_Exist_Notices {
|
||||
return;
|
||||
}
|
||||
|
||||
// Always load the plugin details fix script on the plugins page
|
||||
// Always load our version fix script on the plugins page
|
||||
wp_enqueue_script(
|
||||
'fpden-plugin-details-fix',
|
||||
FPDEN_PLUGIN_URL . 'assets/js/plugin-details-fix.js',
|
||||
array( 'jquery', 'thickbox' ), // Add thickbox dependency
|
||||
FPDEN_VERSION . '.' . time(), // Add timestamp to force cache busting
|
||||
'fpden-version-fix',
|
||||
FPDEN_PLUGIN_URL . 'assets/js/version-fix.js',
|
||||
array( 'jquery', 'thickbox' ),
|
||||
FPDEN_VERSION,
|
||||
true // Load in footer.
|
||||
);
|
||||
|
||||
@ -450,31 +553,74 @@ class Fix_Plugin_Does_Not_Exist_Notices {
|
||||
// Add a cache buster timestamp
|
||||
$new_result->cache_buster = time();
|
||||
|
||||
// Get changelog from readme.txt
|
||||
// Get full readme content for our plugin
|
||||
$readme_file = FPDEN_PLUGIN_DIR . 'readme.txt';
|
||||
$changelog = '<h2>' . FPDEN_VERSION . '</h2><ul><li>Fixed: Plugin details popup now correctly shows version and author information</li><li>Added: Cache-busting mechanism to ensure plugin details are always up-to-date</li><li>Improved: Author and contributor information display</li></ul>';
|
||||
$readme_content = '';
|
||||
$description = '';
|
||||
$changelog = '';
|
||||
$faq = '';
|
||||
$installation = '';
|
||||
$screenshots = '';
|
||||
|
||||
if (file_exists($readme_file)) {
|
||||
if (file_exists($readme_file) && $our_plugin) {
|
||||
$readme_content = file_get_contents($readme_file);
|
||||
if (preg_match('/== Changelog ==\s*\n\s*= ' . FPDEN_VERSION . ' =(.*?)(?:= \d|$)/s', $readme_content, $matches)) {
|
||||
$version_changelog = trim($matches[1]);
|
||||
$changelog = '<h2>' . FPDEN_VERSION . '</h2>' . wpautop($version_changelog);
|
||||
|
||||
// Extract description
|
||||
if (preg_match('/== Description ==(.+?)(?:==|$)/s', $readme_content, $matches)) {
|
||||
$description = trim($matches[1]);
|
||||
}
|
||||
|
||||
// Extract changelog
|
||||
if (preg_match('/== Changelog ==(.+?)(?:==|$)/s', $readme_content, $matches)) {
|
||||
$changelog = trim($matches[1]);
|
||||
}
|
||||
|
||||
// Extract FAQ
|
||||
if (preg_match('/== Frequently Asked Questions ==(.+?)(?:==|$)/s', $readme_content, $matches)) {
|
||||
$faq = trim($matches[1]);
|
||||
}
|
||||
|
||||
// Extract installation
|
||||
if (preg_match('/== Installation ==(.+?)(?:==|$)/s', $readme_content, $matches)) {
|
||||
$installation = trim($matches[1]);
|
||||
}
|
||||
|
||||
// Extract screenshots
|
||||
if (preg_match('/== Screenshots ==(.+?)(?:==|$)/s', $readme_content, $matches)) {
|
||||
$screenshots = trim($matches[1]);
|
||||
}
|
||||
} else {
|
||||
// Fallback content if readme.txt doesn't exist or for missing plugins
|
||||
$changelog = '<h2>' . FPDEN_VERSION . '</h2><ul><li>Fixed: Plugin details popup version display issue with Git Updater integration</li><li>Added: JavaScript-based solution to ensure correct version display in plugin details</li><li>Improved: Version consistency across all plugin views</li><li>Enhanced: Cache busting for plugin information API</li></ul>';
|
||||
}
|
||||
|
||||
$description = $our_plugin
|
||||
? 'Adds missing plugins to your plugins list with a "Remove Notice" action link, allowing you to safely clean up invalid plugin references.'
|
||||
: sprintf(
|
||||
// Set description based on whether this is our plugin or a missing plugin
|
||||
if ($our_plugin) {
|
||||
$description = !empty($description) ? wpautop($description) : 'Adds missing plugins to your plugins list with a "Remove Notice" action link, allowing you to safely clean up invalid plugin references.';
|
||||
} else {
|
||||
$description = sprintf(
|
||||
__( 'This plugin is still marked as "Active" in your database — but its folder and files can\'t be found in %s. Use the "Remove Notice" link on the plugins page to permanently remove it from your active plugins list and eliminate the error notice.', 'wp-fix-plugin-does-not-exist-notices' ),
|
||||
'<code>/wp-content/plugins/</code>'
|
||||
);
|
||||
}
|
||||
|
||||
// Prepare sections
|
||||
$new_result->sections = array(
|
||||
'description' => $description,
|
||||
'changelog' => $changelog,
|
||||
'faq' => '<h3>Is it safe to remove plugin references?</h3><p>Yes, this plugin only removes entries from the WordPress active_plugins option, which is safe to modify when a plugin no longer exists.</p>'
|
||||
'changelog' => !empty($changelog) ? wpautop($changelog) : $changelog,
|
||||
'faq' => !empty($faq) ? wpautop($faq) : '<h3>Is it safe to remove plugin references?</h3><p>Yes, this plugin only removes entries from the WordPress active_plugins option, which is safe to modify when a plugin no longer exists.</p>',
|
||||
);
|
||||
|
||||
// Add installation section if available
|
||||
if (!empty($installation)) {
|
||||
$new_result->sections['installation'] = wpautop($installation);
|
||||
}
|
||||
|
||||
// Add screenshots section if available
|
||||
if (!empty($screenshots)) {
|
||||
$new_result->sections['screenshots'] = wpautop($screenshots);
|
||||
}
|
||||
|
||||
// Add contributors information
|
||||
$new_result->contributors = array(
|
||||
'marcusquinn' => array(
|
||||
|
Reference in New Issue
Block a user