How kiranpotphode/easy-charts works
• Plugin Core – Highlight the main plugin file (easy-charts.php) and related core files in the “includes” folder. This block contains the main classes:
– Activator/Deactivator (handle plugin lifecycle)
– Loader and I18n classes (plugin bootstrapping and language support)
– Integration with WordPress hooks.
• Admin Module – Represent everything under the “admin” directory. This area includes:
– Admin interface PHP files (e.g., class-easy-charts-admin.php and index.php).
– CSS and JavaScript assets (including custom stylesheets, Handsontable components for table-like interactions, and chart insertion functionalities).
– Partial views (metabox templates and settings displays).
• Public Module – Represent the “public” folder. This encapsulates:
– PHP files for rendering public views (class-easy-charts-public.php).
– Public CSS and JS files that control the front-end display and interactivity of the charts.
– Template partials for how charts appear to end users.
– Third-party JavaScript libraries (uvCharts, d3.js, canvg.js, canvas-toblob.js, filesaver.js).
– Additional assets like fonts and additional CSS for Handsontable and others which are used by the admin UI.
• WordPress Integration – Show the overall context where this plugin hooks into WordPress through shortcodes, admin pages, and front-end rendering.
Interactions and Data Flow
• From the Plugin Core, branch out to the Admin Module and Public Module to highlight that the core classes load the appropriate functionalities depending on whether the user is in the Admin dashboard or viewing the site contents.
• For the Public Module, illustrate how the chart display is achieved by using PHP partials which inject the necessary HTML, CSS, and JavaScript that interoperate with the external chart libraries.
Architectural Patterns and Design Principles
• Separation of Concerns – Clearly show how administrative functions are isolated from public display logic.
• Modular Component Design – Each major directory (admin, includes, public) represents a self-contained module with its own assets and responsibilities.
• Reusability – Point out the use of third-party libraries and the fact that configuration options allow the same data to be used across multiple chart types.
• Extensibility – Note that the plugin is designed to allow changes in chart type or style without altering the underlying data, which is a key architectural principle.