From bed8c304ba7e6255cd7cde9badc3865211af9c92 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Thu, 23 Apr 2026 14:10:12 -0500 Subject: [PATCH] feat: extend MokoWaaS plugin capabilities Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitignore | 2 + src/Extension/MokoWaaS.php | 98 +++++++++++++++++++++- src/language/en-GB/plg_system_mokowaas.ini | 5 ++ src/language/en-US/plg_system_mokowaas.ini | 5 ++ src/mokowaas.xml | 11 +++ 5 files changed, 119 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e535d2dd..4229e703 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ TODO.md .env .env.local .env.*.local +.joomla-api-mcp.json +.mcp.json *.local.php *.secret.php configuration.php diff --git a/src/Extension/MokoWaaS.php b/src/Extension/MokoWaaS.php index 84575d41..e67eb2f5 100644 --- a/src/Extension/MokoWaaS.php +++ b/src/Extension/MokoWaaS.php @@ -80,6 +80,9 @@ class MokoWaaS extends CMSPlugin // Security: HTTPS redirect (runs for all clients) $this->enforceHttps(); + // Dev mode: disable caching + $this->enforceDevMode(); + // Admin-only WaaS controls if ($this->app->isClient('administrator')) { @@ -965,6 +968,27 @@ class MokoWaaS extends CMSPlugin * * @since 02.01.08 */ + /** + * Disable caching when development mode is active. + * + * Sets the Joomla caching config to 0 at runtime so no page + * or component cache is used. Does not modify configuration.php. + * + * @return void + * + * @since 02.01.15 + */ + protected function enforceDevMode() + { + if (!$this->params->get('dev_mode', 0)) + { + return; + } + + $config = Factory::getConfig(); + $config->set('caching', 0); + } + protected function enforceHttps() { if (!$this->params->get('force_https', 0)) @@ -1529,8 +1553,78 @@ class MokoWaaS extends CMSPlugin */ protected function injectColorScheme($doc) { - // Colors are applied via Atum template style params in - // enforceAtumBranding(). No additional CSS injection needed. + $primary = $this->params->get('color_primary', ''); + $brandIcon = $this->params->get('brand_icon', ''); + $css = ''; + + // Brand button colors derived from primary color + if (!empty($primary)) + { + $primary = htmlspecialchars($primary, ENT_QUOTES, 'UTF-8'); + + $css .= '.btn-primary,' + . '.btn-primary:not(:disabled):not(.disabled){' + . 'background-color:' . $primary . ';' + . 'border-color:' . $primary . ';' + . 'color:#000;' + . 'box-shadow:0 2px 4px rgba(0,0,0,.15);}' + . '.btn-primary:hover,.btn-primary:focus{' + . 'background-color:' . $primary . ';' + . 'border-color:' . $primary . ';' + . 'color:#000;' + . 'filter:brightness(0.85);' + . 'box-shadow:0 4px 8px rgba(0,0,0,.2);}' + . '.btn-primary:active,.btn-primary.active{' + . 'background-color:' . $primary . ';' + . 'border-color:' . $primary . ';' + . 'color:#000;' + . 'filter:brightness(0.75);}' + . '.btn-outline-primary{' + . 'color:' . $primary . ';' + . 'border-color:' . $primary . ';' + . 'border-width:2px;}' + . '.btn-outline-primary:hover,.btn-outline-primary:focus{' + . 'background-color:' . $primary . ';' + . 'border-color:' . $primary . ';' + . 'color:#000;}'; + } + + // Drawer toggle button: flat edge on the sidebar-facing side + // Close button in drawer: styled to match brand + $css .= '[dir="ltr"] .main-nav-container .menu-collapse,' + . '[dir="ltr"] .sidebar-toggle{' + . 'border-top-left-radius:0!important;' + . 'border-bottom-left-radius:0!important;}' + . '[dir="rtl"] .main-nav-container .menu-collapse,' + . '[dir="rtl"] .sidebar-toggle{' + . 'border-top-right-radius:0!important;' + . 'border-bottom-right-radius:0!important;}' + . '.sidebar-wrapper .btn-close,' + . '.sidebar-wrapper [data-bs-dismiss]{' + . 'opacity:1;' + . 'filter:none;' + . 'font-size:1.1rem;}'; + + // Brand icon override (FontAwesome unicode codepoint) + if (!empty($brandIcon)) + { + $brandIcon = preg_replace('/[^a-fA-F0-9]/', '', $brandIcon); + + if (!empty($brandIcon)) + { + $css .= '.icon-joomla::before,' + . '.icon-brands.fa-joomla::before{' + . 'font-family:"Font Awesome 6 Free"!important;' + . 'content:"\\' . $brandIcon . '"!important;' + . 'font-weight:900!important;}'; + } + } + + if (!empty(trim($css))) + { + $css = str_replace('', '', $css); + $doc->addStyleDeclaration($css); + } } /** diff --git a/src/language/en-GB/plg_system_mokowaas.ini b/src/language/en-GB/plg_system_mokowaas.ini index 9ab299cd..8ba246f9 100644 --- a/src/language/en-GB/plg_system_mokowaas.ini +++ b/src/language/en-GB/plg_system_mokowaas.ini @@ -55,6 +55,9 @@ PLG_SYSTEM_MOKOWAAS_ALLOWED_IPS_NOTE_DESC="Emergency access requires an IP white PLG_SYSTEM_MOKOWAAS_FIELDSET_MAINTENANCE_LABEL="Maintenance" PLG_SYSTEM_MOKOWAAS_FIELDSET_MAINTENANCE_DESC="One-time maintenance actions. Set to Yes and save to execute. Resets to No automatically after execution." +PLG_SYSTEM_MOKOWAAS_DEV_MODE_LABEL="Development Mode" +PLG_SYSTEM_MOKOWAAS_DEV_MODE_DESC="Disables all Joomla caching at runtime. Useful during development and testing. Does not modify configuration.php." + PLG_SYSTEM_MOKOWAAS_RESET_HITS_LABEL="Reset All Hits" PLG_SYSTEM_MOKOWAAS_RESET_HITS_DESC="Set all article hit counters to zero across the site. This action executes on save and resets to No." PLG_SYSTEM_MOKOWAAS_DELETE_VERSIONS_LABEL="Delete All Versions" @@ -74,6 +77,8 @@ PLG_SYSTEM_MOKOWAAS_COLOR_HEADER_LABEL="Header Color" PLG_SYSTEM_MOKOWAAS_COLOR_HEADER_DESC="Background color for the admin top header bar." PLG_SYSTEM_MOKOWAAS_COLOR_LINK_LABEL="Link Color" PLG_SYSTEM_MOKOWAAS_COLOR_LINK_DESC="Color for hyperlinks in the admin interface." +PLG_SYSTEM_MOKOWAAS_BRAND_ICON_LABEL="Brand Icon (FontAwesome)" +PLG_SYSTEM_MOKOWAAS_BRAND_ICON_DESC="FontAwesome unicode codepoint for the brand icon that replaces the Joomla logo icon. Enter the hex code only (e.g. f6d5 for fa-hat-cowboy). Find codes at fontawesome.com/icons." PLG_SYSTEM_MOKOWAAS_CUSTOM_CSS_LABEL="Custom CSS" PLG_SYSTEM_MOKOWAAS_CUSTOM_CSS_DESC="Additional CSS injected into admin pages. Use for fine-tuning visual presentation." diff --git a/src/language/en-US/plg_system_mokowaas.ini b/src/language/en-US/plg_system_mokowaas.ini index 9ab299cd..8ba246f9 100644 --- a/src/language/en-US/plg_system_mokowaas.ini +++ b/src/language/en-US/plg_system_mokowaas.ini @@ -55,6 +55,9 @@ PLG_SYSTEM_MOKOWAAS_ALLOWED_IPS_NOTE_DESC="Emergency access requires an IP white PLG_SYSTEM_MOKOWAAS_FIELDSET_MAINTENANCE_LABEL="Maintenance" PLG_SYSTEM_MOKOWAAS_FIELDSET_MAINTENANCE_DESC="One-time maintenance actions. Set to Yes and save to execute. Resets to No automatically after execution." +PLG_SYSTEM_MOKOWAAS_DEV_MODE_LABEL="Development Mode" +PLG_SYSTEM_MOKOWAAS_DEV_MODE_DESC="Disables all Joomla caching at runtime. Useful during development and testing. Does not modify configuration.php." + PLG_SYSTEM_MOKOWAAS_RESET_HITS_LABEL="Reset All Hits" PLG_SYSTEM_MOKOWAAS_RESET_HITS_DESC="Set all article hit counters to zero across the site. This action executes on save and resets to No." PLG_SYSTEM_MOKOWAAS_DELETE_VERSIONS_LABEL="Delete All Versions" @@ -74,6 +77,8 @@ PLG_SYSTEM_MOKOWAAS_COLOR_HEADER_LABEL="Header Color" PLG_SYSTEM_MOKOWAAS_COLOR_HEADER_DESC="Background color for the admin top header bar." PLG_SYSTEM_MOKOWAAS_COLOR_LINK_LABEL="Link Color" PLG_SYSTEM_MOKOWAAS_COLOR_LINK_DESC="Color for hyperlinks in the admin interface." +PLG_SYSTEM_MOKOWAAS_BRAND_ICON_LABEL="Brand Icon (FontAwesome)" +PLG_SYSTEM_MOKOWAAS_BRAND_ICON_DESC="FontAwesome unicode codepoint for the brand icon that replaces the Joomla logo icon. Enter the hex code only (e.g. f6d5 for fa-hat-cowboy). Find codes at fontawesome.com/icons." PLG_SYSTEM_MOKOWAAS_CUSTOM_CSS_LABEL="Custom CSS" PLG_SYSTEM_MOKOWAAS_CUSTOM_CSS_DESC="Additional CSS injected into admin pages. Use for fine-tuning visual presentation." diff --git a/src/mokowaas.xml b/src/mokowaas.xml index 65aceecf..784927b2 100644 --- a/src/mokowaas.xml +++ b/src/mokowaas.xml @@ -162,6 +162,13 @@ label="PLG_SYSTEM_MOKOWAAS_FIELDSET_MAINTENANCE_LABEL" description="PLG_SYSTEM_MOKOWAAS_FIELDSET_MAINTENANCE_DESC" > + + + + +