# AdminFly – Fast Navigator for WooCommerce - Plugin Structure

## Overview
Successfully refactored the AdminFly plugin with proper modular structure, renamed all prefixes from `qmw_` to `qmen_`, and updated the description to reflect WordPress-wide support.

## File Structure

```
quickmenu-for-woocommerce/
├── quickmenu-for-woocommerce.php    (Main plugin file - 30 lines)
├── readme.txt                        (Plugin readme file)
├── includes/
│   ├── helpers.php                   (Helper functions & utilities)
│   ├── admin-bar-menu.php            (Admin bar menu implementation)
│   ├── settings-page.php             (Settings page & configuration)
│   └── enqueue.php                   (Scripts & styles)
└── assets/
    └── qmen-admin.js                 (Admin bar JavaScript)
```

## Changes Made

### 1. Renamed All Prefixes (qmw_ → qmen_)
- Function names: `qmw_is_wc_active()` → `qmen_is_wc_active()`
- Option names: `qmw_enabled_branches` → `qmen_enabled_branches`
- Menu IDs: `qmw-root` → `qmen-root`
- Class names: `.qmw-wrap` → `.qmen-wrap`
- CSS IDs: `qmw-toolbar-styles` → `qmen-toolbar-styles`
- JavaScript variable: `QMW_EDIT_BY_ID` → `QMEN_EDIT_BY_ID`
- Script handles: `qmw-admin-js` → `qmen-admin-js`

### 2. Updated Plugin Header
```php
/**
 * Plugin Name:       AdminFly – Fast Navigator for WooCommerce
 * Description:       A fast, one-click admin navigator tailored for WooCommerce.
 * Version:           2.0.0
 * Author:            pranavmtn
 * License:           GPL-2.0-or-later
 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain:       adminfly-fast-navigator
 * Requires at least: 5.6
 * Requires PHP:      7.2
 * @package AdminFlyFastNavigator
 */
```

### 3. Modular File Organization

**quickmenu-for-woocommerce.php** (Main Entry Point)
- Defines plugin constants: `QMEN_PLUGIN_DIR`, `QMEN_PLUGIN_URL`
- Loads all module files via `require_once`
- Clean and minimal (only 30 lines)

**includes/helpers.php** (Utility Functions)
- `qmen_is_wc_active()` - Check WooCommerce status
- `qmen_default_enabled_branches()` - Default menu configuration
- `qmen_get_enabled_branches()` - Get user settings
- `qmen_is_enabled()` - Check if branch is enabled
- `qmen_wc_extension_available()` - Check WooCommerce extensions
- `qmen_admin_href()` - Build admin URLs safely
- `qmen_button()` - Render button links
- `qmen_button_url()` - Render external buttons
- `qmen_log_plugins_state()` - Debug logging
- `qmen_inline_styles()` - Get CSS styles

**includes/enqueue.php** (Scripts & Styles)
- `qmen_toolbar_styles()` - Admin bar styling (dark violet theme)
- Enqueue JavaScript for Edit by ID functionality
- Script localization with menu configuration

**includes/settings-page.php** (Settings Page)
- Plugin action links in Plugins screen
- Register submenu under Tools (WordPress native menu)
- Settings page rendering: `qmen_render_quickmenu_page()`
- Handles form submissions and settings updates
- Checkbox controls for enabling/disabling menu branches

**includes/admin-bar-menu.php** (Admin Bar Menu)
- Main function: `qmen_admin_bar_menu($admin_bar)`
- Modular submenu functions:
  - `qmen_add_wc_menu()` - WooCommerce hierarchy
  - `qmen_add_products_menu()` - Products with status
  - `qmen_add_orders_menu()` - Orders with status
  - `qmen_add_plugins_menu()` - Plugins with activation
  - `qmen_add_themes_menu()` - Themes with activation
  - `qmen_add_posts_menu()` - Posts with status
  - `qmen_add_pages_menu()` - Pages with status
  - `qmen_add_users_menu()` - Users with roles
- Each function is self-contained and testable

**assets/qmen-admin.js** (Frontend JavaScript)
- Handles Edit by ID prompts
- Secure URL building with `encodeURIComponent()`
- Opens items in new tabs with security flags
- Clean IIFE pattern (Immediately Invoked Function Expression)

### 4. README.txt
Professional WordPress plugin readme with:
- Plugin description and features
- Installation instructions
- Usage guide
- FAQ section
- Changelog
- Author attribution (pranavmtn)

## Key Improvements

1. **Modular Architecture**: Each file has a single responsibility
2. **Maintainability**: Easy to locate and update functionality
3. **Scalability**: New features can be added without bloating the main file
4. **Testing**: Modular functions are easier to unit test
5. **Documentation**: Better code organization with clear purpose
6. **Performance**: Only necessary functions are loaded per context
7. **Security**: Settings are under WordPress Tools menu (manage_options)
8. **Extensibility**: Hooks and filters can be easily added per module

## Version Info
- **Current Version**: 2.0.0
- **Author**: Pranav MT
- **License**: GPL-2.0-or-later
- **Requires WordPress**: 5.2+
- **Requires PHP**: 7.2+
- **Text Domain**: adminfly-fast-navigator

## No Parse Errors
✓ All files validated - No syntax errors found
