From eac794c54ad52414683655cf5a41208fc64cf23c Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Sun, 13 Apr 2025 14:27:26 +0100 Subject: [PATCH] Improve Choose Update Source feature based on feedback --- .ai-workflows/local-env-vars.md | 19 +++++++++++++++++++ CHANGELOG.md | 4 +--- README.md | 21 ++++++++++++++++----- assets/css/update-source-selector.css | 13 ++++++++++++- assets/js/update-source-selector.js | 13 +++++++++---- includes/Updater.php | 10 +++++----- readme.txt | 9 +++++---- wp-fix-plugin-does-not-exist-notices.php | 14 ++++---------- 8 files changed, 71 insertions(+), 32 deletions(-) create mode 100644 .ai-workflows/local-env-vars.md diff --git a/.ai-workflows/local-env-vars.md b/.ai-workflows/local-env-vars.md new file mode 100644 index 0000000..6ecbcba --- /dev/null +++ b/.ai-workflows/local-env-vars.md @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7573a87..3deee21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,4 @@ -# Changelog - -All notable changes to this project will be documented in this file. +All notable changes to this project should be documented both here and in the main Readme files. #### [2.1.1] - 2025-04-13 #### Added diff --git a/README.md b/README.md index 44482dd..a021ec3 100644 --- a/README.md +++ b/README.md @@ -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" 2. Click the "Choose Update Source" link next to the plugin 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 (may have delays due to approval process) - - **GitHub**: Updates directly from GitHub (usually has the latest version first) - - **Gitea**: Updates from Gitea (usually has the latest version first) + - **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) + - **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) + - **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) 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. ## Frequently Asked Questions @@ -165,7 +166,17 @@ Your experience and feedback helps others discover the plugin, and encourages co ### 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 2. Create your feature branch: `git checkout -b feature/amazing-feature` diff --git a/assets/css/update-source-selector.css b/assets/css/update-source-selector.css index 212483a..30b83e5 100644 --- a/assets/css/update-source-selector.css +++ b/assets/css/update-source-selector.css @@ -57,7 +57,18 @@ .fpden-update-source-toggle:hover { /* 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 */ diff --git a/assets/js/update-source-selector.js b/assets/js/update-source-selector.js index b59a9d9..f3ee1ec 100644 --- a/assets/js/update-source-selector.js +++ b/assets/js/update-source-selector.js @@ -48,7 +48,14 @@ jQuery(document).ready(function($) { }); // 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-modal-overlay').remove(); }); @@ -80,9 +87,7 @@ jQuery(document).ready(function($) { if (response.success) { // Update the badge var badgeText = source.charAt(0).toUpperCase() + source.slice(1); - if (source === 'auto') { - badgeText = 'Auto'; - } else if (source === 'wordpress.org') { + if (source === 'wordpress.org') { badgeText = 'WP.org'; } diff --git a/includes/Updater.php b/includes/Updater.php index 5ee2aee..9838b5c 100644 --- a/includes/Updater.php +++ b/includes/Updater.php @@ -62,15 +62,15 @@ class Updater { */ private function determine_installation_source() { // 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_preference !== 'auto') { + // If user has set a preference, use it + if (!empty($user_preference)) { return $user_preference; } - // Otherwise, auto-detect as before - $source = 'wordpress.org'; + // Otherwise, auto-detect the installation source + $source = 'wordpress.org'; // Default to WordPress.org if unidentifiable // Check if the plugin was installed from GitHub if ($this->is_github_installation()) { diff --git a/readme.txt b/readme.txt index b5be53a..f05b632 100644 --- a/readme.txt +++ b/readme.txt @@ -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" 2. Click the "Choose Update Source" link next to the plugin 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 (may have delays due to approval process) - * **GitHub**: Updates directly from GitHub (usually has the latest version first) - * **Gitea**: Updates from Gitea (usually has the latest version first) + * **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) + * **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) + * **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) 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. == Frequently Asked Questions == diff --git a/wp-fix-plugin-does-not-exist-notices.php b/wp-fix-plugin-does-not-exist-notices.php index 5732792..844d09b 100644 --- a/wp-fix-plugin-does-not-exist-notices.php +++ b/wp-fix-plugin-does-not-exist-notices.php @@ -966,16 +966,10 @@ function fpden_add_update_source_modal() {
Select where you want to receive plugin updates from: