How marufwp/plugeguard works
Project type and purpose
• This is a WordPress security plugin (PHP) that scans PHP files for hard-coded credentials and provides an admin UI for review and removal.
• It integrates with the WordPress admin dashboard under Tools > PlugeGuard Settings.
File structure
• plugeguard.php: the plugin bootstrap and core scanner logic; registers hooks, menus and handles AJAX calls.
• assets/css/plugeguard.css: styling for the admin pages.
• assets/js/plugeguard.js & plugeguard-editor.js: client-side code for triggering scans, handling results, and inline editing/removal.
• templates/modal-preloader.php: the HTML fragment used by JS to show a loading modal during scans.
• license.txt and readme.txt: documentation and open-source license metadata.
README for additional insights
• Describes features (deep scan, secure file viewing/removal).
• Gives installation steps (upload, activate, navigate to Tools > Settings).
a. Main components
• WordPress Core
• PlugeGuard Plugin
• Scanner Module (PHP code that reads files, applies regex/pattern matching)
• UI Module (admin page renderer, AJAX endpoints)
• Asset Module (CSS/JS files)
• Template Module (modal preloader, result lists)
• File System (all PHP files in wp-content and core)
• WordPress Database (stores plugin settings, scan history if any)
• Admin User (interacts via browser)
b. Relationships and interactions
• Admin User → Browser → WordPress Admin UI (with PlugeGuard menu)
• UI Module → AJAX request → Scanner Module
• Scanner Module → reads File System → detects credential patterns
• Scanner Module → returns scan results to UI Module
• UI Module → renders results, allows removal → sends removal requests back to Scanner Module
• Scanner Module → writes changes to File System
• Plugin reads/writes settings to the WP Database
c. Architectural patterns and design principles
• Hook-based architecture (leverages WP actions/filters)
• Separation of concerns:
• Core plugin logic (plugeguard.php)
• Presentation layer (templates + CSS/JS)
• Scanner engine (pattern matching, file I/O)
• Graceful fallbacks: only PHP 8.0+ required, but backward compatible to 5.6
d. Key technologies, frameworks, libraries
• PHP (WordPress plugin API)
• JavaScript (AJAX, DOM manipulation for scan UI)
• CSS (admin styling)
• WordPress hooks (add_menu_page, wp_ajax_*)
Essential details checklist
• All plugin modules (scanner, UI, assets, templates)
• WordPress hook integration points (menu registration, AJAX endpoints)
• Data flows: scan initiation, result delivery, file modification
• External dependencies: file system and database
• User interaction flow from browser to plugin and back