Commit Graph

4 Commits

Author SHA1 Message Date
Ollama
eb264ad76d refactor: Address review comments - PSR-12 naming and plugin cleanup
- Rename Plugin_config to PluginConfig (PSR-12 class naming)
- Remove non-functioning CasposPlugin example
- Remove ExamplePlugin (MailchimpPlugin serves as example)
- Fix privacy issue: Don't log customer email in MailchimpPlugin
- Remove unnecessary PHPDocs
- Fix PSR-12 brace placement
2026-03-22 19:40:36 +00:00
Ollama
10a64e7af9 refactor: Remove redundant isEnabled() checks from callback methods
The PluginManager only registers events for enabled plugins, so
callbacks are never invoked for disabled plugins. This makes
$this->isEnabled() checks in callbacks redundant.

Changes:
- Remove redundant isEnabled() checks from all plugin callbacks
- Clarify in README that isEnabled() checks are not needed
- Use log_message() instead of log() in plugins (PSR-12)
- Fix PSR-12 brace placement in CasposPlugin
2026-03-20 19:48:27 +00:00
Ollama
6e99f05d63 refactor: Update MailchimpPlugin as proper example plugin
- Reword docblock to remove 'Example' - it's a functioning plugin
- Rename 'Mailchimp Integration' to 'Mailchimp' (context makes it clear)
- Use lang() method for translatable strings with self-contained language file
- Use log_message() instead of log() for PSR-12 consistency
- Add missing language strings: mailchimp_description, mailchimp_api_key_required
- Add getPluginDir() method for language helper
2026-03-20 18:32:42 +00:00
Ollama
a9669ddf19 feat(plugins): Implement modular plugin system with self-registering events
This implements a clean plugin architecture based on PR #4255 discussion:

Core Components:
- PluginInterface: Standard contract all plugins must implement
- BasePlugin: Abstract class with common functionality
- PluginManager: Discovers and loads plugins from app/Plugins/
- Plugin_config: Model for plugin settings storage

Architecture:
- Each plugin registers its own event listeners via registerEvents()
- No hardcoded plugin dependencies in core Events.php
- Generic event triggers (item_sale, item_change, etc.) remain in core code
- Plugins can be enabled/disabled via database settings
- Clean separation: plugin orchestrators vs MVC components

Example Implementations:
- ExamplePlugin: Simple plugin demonstrating event logging
- MailchimpPlugin: Integration with Mailchimp for customer sync

Admin UI:
- Plugin management controller at Controllers/Plugins/Manage.php
- Plugin management view at Views/plugins/manage.php

Database:
- ospos_plugin_config table for plugin settings (key-value store)
- Migration creates table with timestamps

Documentation:
- Comprehensive README with architecture patterns
- Simple vs complex plugin examples
- MVC directory structure guidance
2026-03-09 21:58:53 +01:00