From fdf2860c10a61717339cd8c063fae51e85042e1b Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Mon, 14 Apr 2025 22:56:11 +0100 Subject: [PATCH] Version 2.2.3 - Improved folder structure and organization --- .ai-workflows/README.md | 1 + includes/Admin.php | 95 ----------------------- includes/Modal.php | 167 ---------------------------------------- includes/Plugin.php | 12 +-- 4 files changed, 7 insertions(+), 268 deletions(-) delete mode 100644 includes/Admin.php delete mode 100644 includes/Modal.php diff --git a/.ai-workflows/README.md b/.ai-workflows/README.md index b9a0ed0..2b16211 100644 --- a/.ai-workflows/README.md +++ b/.ai-workflows/README.md @@ -7,6 +7,7 @@ This directory contains workflow documentation for AI assistants working with th - **bug-fixing.md**: Guidelines for identifying and fixing bugs in the codebase - **code-review.md**: Standards and procedures for reviewing code changes - **feature-development.md**: Process for developing new features +- **folder-structure.md**: Documentation of the plugin's folder structure and naming conventions - **local-env-vars.md**: Local development environment paths and URLs - **release-process.md**: Steps for preparing and publishing new releases diff --git a/includes/Admin.php b/includes/Admin.php deleted file mode 100644 index 6a7678e..0000000 --- a/includes/Admin.php +++ /dev/null @@ -1,95 +0,0 @@ -core = $core; - - // Enqueue admin scripts and styles - add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_assets')); - } - - /** - * Enqueue scripts and styles needed for the admin area. - * - * @param string $hook_suffix The current admin page hook. - * @return void - */ - public function enqueue_admin_assets($hook_suffix) { - // Only load on the plugins page - if ('plugins.php' !== $hook_suffix) { - return; - } - - // Version fix script is no longer needed after refactoring - // Commented out for testing - /* - wp_enqueue_script( - 'fpden-version-fix', - FPDEN_PLUGIN_URL . 'admin/js/version-fix.js', - array('jquery', 'thickbox'), - FPDEN_VERSION, - true // Load in footer - ); - */ - - // Get invalid plugins to decide if other assets are needed - $invalid_plugins = $this->core->get_invalid_plugins(); - if (empty($invalid_plugins)) { - return; // No missing plugins, no need for the special notice JS/CSS - } - - wp_enqueue_style( - 'fpden-admin-styles', - FPDEN_PLUGIN_URL . 'admin/css/admin-styles.css', - array(), - FPDEN_VERSION - ); - - wp_enqueue_script( - 'fpden-admin-scripts', - FPDEN_PLUGIN_URL . 'admin/js/admin-scripts.js', - array('jquery'), // Add dependencies if needed, e.g., jQuery - FPDEN_VERSION, - true // Load in footer - ); - - // Add translation strings for JavaScript - wp_localize_script( - 'fpden-admin-scripts', - 'fpdenData', - array( - 'i18n' => array( - 'clickToScroll' => esc_html__('Click here to scroll to missing plugins', 'wp-fix-plugin-does-not-exist-notices'), - 'pluginMissing' => esc_html__('File Missing', 'wp-fix-plugin-does-not-exist-notices'), - 'removeNotice' => esc_html__('Remove Notice', 'wp-fix-plugin-does-not-exist-notices'), - ), - 'version' => FPDEN_VERSION, // Add version for the plugin details fix script - ) - ); - } -} diff --git a/includes/Modal.php b/includes/Modal.php deleted file mode 100644 index 33fd1ae..0000000 --- a/includes/Modal.php +++ /dev/null @@ -1,167 +0,0 @@ -Update Source ' . $badge_text . ''; - $links[] = $update_source_link; - - return $links; - } - - /** - * Add the update source modal to the admin footer - */ - public function add_update_source_modal() { - if (!is_admin() || !current_user_can('manage_options')) { - return; - } - - // Only show on plugins page - $screen = get_current_screen(); - if (!$screen || $screen->id !== 'plugins') { - return; - } - - // Get current source - $current_source = get_option('fpden_update_source', 'auto'); - - // Enqueue the CSS and JS - wp_enqueue_style( - 'fpden-update-source-selector', - FPDEN_PLUGIN_URL . 'admin/css/update-source-selector.css', - array(), - FPDEN_VERSION - ); - - wp_enqueue_script( - 'fpden-update-source-selector', - FPDEN_PLUGIN_URL . 'admin/js/update-source-selector.js', - array('jquery'), - FPDEN_VERSION, - true - ); - - // Add nonce to the existing fpdenData object or create it if it doesn't exist - $nonce = wp_create_nonce('fpden_update_source'); - wp_localize_script( - 'fpden-update-source-selector', - 'fpdenData', - array( - 'updateSourceNonce' => $nonce, - ) - ); - - // Modal HTML - ?> -
- × -

Choose Update Source

-

Select where you want to receive plugin updates from:

- -
- - - - - - -
- -
-
-
- plugin_dir . 'includes/Core.php'; - require_once $this->plugin_dir . 'includes/Admin.php'; - require_once $this->plugin_dir . 'includes/Modal.php'; + require_once $this->plugin_dir . 'includes/core.php'; + require_once $this->plugin_dir . 'admin/lib/admin.php'; + require_once $this->plugin_dir . 'admin/lib/modal.php'; } /** @@ -125,7 +125,7 @@ class Plugin { $this->core = new Core(); // Initialize admin functionality - $this->admin = new Admin($this->core); + $this->admin = new Admin\Admin($this->core); // Initialize Git Updater fixes $this->init_git_updater_fixes(); @@ -136,7 +136,7 @@ class Plugin { } // Initialize the modal for update source selection - new Modal(); + new Admin\Modal(); } /**