feat: extend MokoWaaS plugin capabilities
Repo Health / Access control (push) Failing after 1s
Update Joomla Update Server XML Feed / Update updates.xml (push) Successful in 9s
Repo Health / Release configuration (push) Has been skipped
Repo Health / Scripts governance (push) Has been skipped
Repo Health / Repository health (push) Has been skipped
Repo Health / Access control (push) Failing after 1s
Update Joomla Update Server XML Feed / Update updates.xml (push) Successful in 9s
Repo Health / Release configuration (push) Has been skipped
Repo Health / Scripts governance (push) Has been skipped
Repo Health / Repository health (push) Has been skipped
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,8 @@ TODO.md
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
.joomla-api-mcp.json
|
||||
.mcp.json
|
||||
*.local.php
|
||||
*.secret.php
|
||||
configuration.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('</style>', '', $css);
|
||||
$doc->addStyleDeclaration($css);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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."
|
||||
|
||||
|
||||
@@ -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."
|
||||
|
||||
|
||||
@@ -162,6 +162,13 @@
|
||||
label="PLG_SYSTEM_MOKOWAAS_FIELDSET_MAINTENANCE_LABEL"
|
||||
description="PLG_SYSTEM_MOKOWAAS_FIELDSET_MAINTENANCE_DESC"
|
||||
>
|
||||
<field name="dev_mode" type="radio" default="0"
|
||||
label="PLG_SYSTEM_MOKOWAAS_DEV_MODE_LABEL"
|
||||
description="PLG_SYSTEM_MOKOWAAS_DEV_MODE_DESC"
|
||||
class="btn-group btn-group-yesno">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field
|
||||
name="reset_hits"
|
||||
type="radio"
|
||||
@@ -209,6 +216,10 @@
|
||||
label="PLG_SYSTEM_MOKOWAAS_COLOR_LINK_LABEL"
|
||||
description="PLG_SYSTEM_MOKOWAAS_COLOR_LINK_DESC"
|
||||
default="#0051ad" />
|
||||
<field name="brand_icon" type="text"
|
||||
label="PLG_SYSTEM_MOKOWAAS_BRAND_ICON_LABEL"
|
||||
description="PLG_SYSTEM_MOKOWAAS_BRAND_ICON_DESC"
|
||||
default="" hint="e.g. f6d5 (FontAwesome unicode)" />
|
||||
<field name="custom_css" type="textarea"
|
||||
label="PLG_SYSTEM_MOKOWAAS_CUSTOM_CSS_LABEL"
|
||||
description="PLG_SYSTEM_MOKOWAAS_CUSTOM_CSS_DESC"
|
||||
|
||||
Reference in New Issue
Block a user