Improve Choose Update Source feature based on feedback
Some checks failed
ci/woodpecker/push/woodpecker Pipeline is pending
ci/woodpecker/tag/woodpecker Pipeline is pending
Plugin Asset Update / Push assets to WordPress.org (push) Has been cancelled
Build Release / Build and Create Release (push) Has been cancelled
Build Release / Deploy to WordPress.org (push) Has been cancelled

This commit is contained in:
2025-04-13 14:27:26 +01:00
parent 5e8da5d87b
commit eac794c54a
8 changed files with 71 additions and 32 deletions

View File

@ -0,0 +1,19 @@
# Local Development Environment Variables
This file contains important paths and URLs for local development.
## Repository Paths
- Local development repository: ~/Git/wp-fix-plugin-does-not-exist-notices
- LocalWP plugin testing site storage: ~/Local/plugin-testing/app/wp-fix-plugin-does-not-exist-notices
- LocalWP plugin testing site configuration: ~/Local/plugin-testing/conf/
## URLs
- LocalWP plugin testing URL: http://plugin-testing.local/
- PHP details: http://plugin-testing.local/local-phpinfo.php
- XDebug info: http://plugin-testing.local/local-xdebuginfo.php
- Adminer Evo: http://localhost:10010/?username=root&db=local
- Mailpit: http://localhost:10000/
## Build and Deploy Scripts
- Build script: ~/Git/wp-fix-plugin-does-not-exist-notices/build.sh
- Local deploy script: ~/Git/wp-fix-plugin-does-not-exist-notices/deploy-local.sh

View File

@ -1,6 +1,4 @@
# Changelog All notable changes to this project should be documented both here and in the main Readme files.
All notable changes to this project will be documented in this file.
#### [2.1.1] - 2025-04-13 #### [2.1.1] - 2025-04-13
#### Added #### Added

View File

@ -83,12 +83,13 @@ This plugin allows you to choose where you want to receive updates from:
1. In the Plugins list, find "Fix 'Plugin file does not exist' Notices" 1. In the Plugins list, find "Fix 'Plugin file does not exist' Notices"
2. Click the "Choose Update Source" link next to the plugin 2. Click the "Choose Update Source" link next to the plugin
3. Select your preferred update source: 3. Select your preferred update source:
- **Auto-detect** (default): Automatically determines the source based on installation origin - **WordPress.org**: Updates from the official WordPress.org repository (has a version update delay due to the WP.org policy review and approval process, best for unmonitored auto-updates)
- **WordPress.org**: Updates from the official WordPress.org repository (may have delays due to approval process) - **GitHub**: Updates directly from the GitHub repo main branch for the latest stable release (requires Git Updater plugin, best for monitored updates where the latest features and fixes are needed immediately)
- **GitHub**: Updates directly from GitHub (usually has the latest version first) - **Gitea**: Updates directly from the Gitea repo main branch for the latest stable release (requires Git Updater plugin, best for monitored updates and independence from big-tech)
- **Gitea**: Updates from Gitea (usually has the latest version first)
4. Click "Save" to apply your preference 4. Click "Save" to apply your preference
> **Note:** If no preference is set, the plugin will automatically use the source it was installed from.
> **Note:** GitHub and Gitea options require the Git Updater plugin to be installed and activated. > **Note:** GitHub and Gitea options require the Git Updater plugin to be installed and activated.
## Frequently Asked Questions ## Frequently Asked Questions
@ -165,7 +166,17 @@ Your experience and feedback helps others discover the plugin, and encourages co
### Contributing ### Contributing
Contributions are welcome! Please feel free to submit a Pull Request. Contributions are welcome! Please follow these steps to set up a development environment:
1. Install [LocalWP](https://localwp.com/) and create a clean site called "Plugin Testing" using the "Preferred" setup option
2. Run "Site shell" once from the LocalWP page on the site's settings to ensure wp-cli is enabled
3. Run "Add Run Configurations to VS Code" to update site configuration files in: ~/Local/plugin-testing/conf/
4. Clone this repository to your local machine
5. Use the build.sh and deploy-local.sh scripts to build and deploy the plugin for testing
[AugmentCode.com](https://augmentcode.com/) is recommended as a good all-in-one AI IDE for plugin development and testing.
Please feel free to submit a Pull Request with your improvements.
1. Fork the repository 1. Fork the repository
2. Create your feature branch: `git checkout -b feature/amazing-feature` 2. Create your feature branch: `git checkout -b feature/amazing-feature`

View File

@ -57,7 +57,18 @@
.fpden-update-source-toggle:hover { .fpden-update-source-toggle:hover {
/* hover color is now inherited from theme */ /* hover color is now inherited from theme */
text-decoration: underline; }
/* Close button styles */
.fpden-close-modal {
position: absolute;
top: 10px;
right: 10px;
cursor: pointer;
font-size: 40px; /* Large size */
color: #666;
line-height: 30px;
text-decoration: none !important;
} }
/* Source badges */ /* Source badges */

View File

@ -48,7 +48,14 @@ jQuery(document).ready(function($) {
}); });
// Close modal when clicking overlay or close button // Close modal when clicking overlay or close button
$(document).on('click', '#fpden-modal-overlay, .fpden-close-modal', function() { $(document).on('click', '#fpden-modal-overlay', function() {
$('#fpden-update-source-modal').hide();
$('#fpden-modal-overlay').remove();
});
// Separate handler for close button to ensure it works
$(document).on('click', '.fpden-close-modal', function(e) {
e.preventDefault();
$('#fpden-update-source-modal').hide(); $('#fpden-update-source-modal').hide();
$('#fpden-modal-overlay').remove(); $('#fpden-modal-overlay').remove();
}); });
@ -80,9 +87,7 @@ jQuery(document).ready(function($) {
if (response.success) { if (response.success) {
// Update the badge // Update the badge
var badgeText = source.charAt(0).toUpperCase() + source.slice(1); var badgeText = source.charAt(0).toUpperCase() + source.slice(1);
if (source === 'auto') { if (source === 'wordpress.org') {
badgeText = 'Auto';
} else if (source === 'wordpress.org') {
badgeText = 'WP.org'; badgeText = 'WP.org';
} }

View File

@ -62,15 +62,15 @@ class Updater {
*/ */
private function determine_installation_source() { private function determine_installation_source() {
// Check for user preference first // Check for user preference first
$user_preference = \get_option('fpden_update_source', 'auto'); $user_preference = \get_option('fpden_update_source', '');
// If not set to auto, use the user preference // If user has set a preference, use it
if ($user_preference !== 'auto') { if (!empty($user_preference)) {
return $user_preference; return $user_preference;
} }
// Otherwise, auto-detect as before // Otherwise, auto-detect the installation source
$source = 'wordpress.org'; $source = 'wordpress.org'; // Default to WordPress.org if unidentifiable
// Check if the plugin was installed from GitHub // Check if the plugin was installed from GitHub
if ($this->is_github_installation()) { if ($this->is_github_installation()) {

View File

@ -100,12 +100,13 @@ This plugin allows you to choose where you want to receive updates from:
1. In the Plugins list, find "Fix 'Plugin file does not exist' Notices" 1. In the Plugins list, find "Fix 'Plugin file does not exist' Notices"
2. Click the "Choose Update Source" link next to the plugin 2. Click the "Choose Update Source" link next to the plugin
3. Select your preferred update source: 3. Select your preferred update source:
* **Auto-detect** (default): Automatically determines the source based on installation origin * **WordPress.org**: Updates from the official WordPress.org repository (has a version update delay due to the WP.org policy review and approval process, best for unmonitored auto-updates)
* **WordPress.org**: Updates from the official WordPress.org repository (may have delays due to approval process) * **GitHub**: Updates directly from the GitHub repo main branch for the latest stable release (requires Git Updater plugin, best for monitored updates where the latest features and fixes are needed immediately)
* **GitHub**: Updates directly from GitHub (usually has the latest version first) * **Gitea**: Updates directly from the Gitea repo main branch for the latest stable release (requires Git Updater plugin, best for monitored updates and independence from big-tech)
* **Gitea**: Updates from Gitea (usually has the latest version first)
4. Click "Save" to apply your preference 4. Click "Save" to apply your preference
If no preference is set, the plugin will automatically use the source it was installed from.
**Note:** GitHub and Gitea options require the Git Updater plugin to be installed and activated. **Note:** GitHub and Gitea options require the Git Updater plugin to be installed and activated.
== Frequently Asked Questions == == Frequently Asked Questions ==

View File

@ -966,16 +966,10 @@ function fpden_add_update_source_modal() {
<p>Select where you want to receive plugin updates from:</p> <p>Select where you want to receive plugin updates from:</p>
<form id="fpden-update-source-form"> <form id="fpden-update-source-form">
<label>
<input type="radio" name="update_source" value="auto" <?php checked($current_source, 'auto'); ?>>
Auto-detect (recommended)
<span class="fpden-source-description">Automatically determines the update source based on where the plugin was installed from.</span>
</label>
<label> <label>
<input type="radio" name="update_source" value="wordpress.org" <?php checked($current_source, 'wordpress.org'); ?>> <input type="radio" name="update_source" value="wordpress.org" <?php checked($current_source, 'wordpress.org'); ?>>
WordPress.org WordPress.org
<span class="fpden-source-description">Updates from the official WordPress.org plugin repository. Will have a version update delay due to allow for the WP.org policy review and approval process. Best for unmonitored auto-updates.</span> <span class="fpden-source-description">Updates from the official WordPress.org plugin repository. Has a version update delay, to allow for the WP.org policy review and approval process. Best for unmonitored auto-updates.</span>
</label> </label>
<label> <label>
@ -1011,12 +1005,12 @@ function fpden_save_update_source() {
} }
// Get and sanitize source // Get and sanitize source
$source = isset($_POST['source']) ? sanitize_text_field($_POST['source']) : 'auto'; $source = isset($_POST['source']) ? sanitize_text_field($_POST['source']) : '';
// Validate source // Validate source
$valid_sources = ['auto', 'wordpress.org', 'github', 'gitea']; $valid_sources = ['wordpress.org', 'github', 'gitea'];
if (!in_array($source, $valid_sources)) { if (!in_array($source, $valid_sources)) {
$source = 'auto'; $source = ''; // Empty means use auto-detection
} }
// Save option // Save option