feat: include children toggle, manifest fix, and bug fixes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
MokoJoomTOS
A Joomla system plugin that keeps your Terms of Service, Privacy Policy, or any legal page accessible to visitors -- even when the site is in offline (maintenance) mode.
| Field | Value |
|---|---|
| Author | Moko Consulting |
| License | GPL-3.0-or-later |
| Platform | Gitea |
| Version | 04.02.00 |
Why MokoJoomTOS?
When you put a Joomla site into offline mode for maintenance, every page returns the offline message -- including legal pages that may need to remain publicly accessible. Many jurisdictions require Terms of Service and Privacy Policy pages to be available at all times. MokoJoomTOS solves this by selectively bypassing offline mode for a single configured URL slug, rendering only the article content without any site template chrome.
Features
- Offline-mode bypass -- Keeps a designated page accessible while the rest of the site shows the offline message
- Component-only rendering -- Strips headers, footers, navigation, and modules for a minimal, secure view
- Single-parameter configuration -- Just one setting: the menu item slug to expose
- Child-path matching -- A slug of
legalalso matches/legal/privacy,/legal/terms, etc. - Zero database footprint -- No custom tables; uses native Joomla content and menu infrastructure
- Auto-provisioning installer -- On first install, automatically creates a sample article, "Legal" menu type, menu item, and enables the plugin
- Idempotent installation -- Safe to reinstall; checks for existing resources before creating duplicates
- Built-in update server -- Joomla automatically checks for new versions via the Gitea-hosted
updates.xml - Joomla 4+ namespaced architecture -- Uses
SubscriberInterfaceand proper PSR-4 namespacing - Multilingual support -- Language files included for en-GB and en-US (site and admin)
How It Works
The plugin subscribes to the onAfterRoute Joomla event. When a request comes in:
- Check scope -- Only acts on the site application (not admin)
- Check offline -- Only acts when the site is in offline mode
- Match slug -- Compares the URI path against the configured
tos_slugparameter - Bypass offline -- If matched, temporarily sets
offline = 0for this request only (not persisted to database) - Strip template -- Forces
tmpl=componentso only the article content renders (no header, footer, or modules)
If the URL does not match, the plugin does nothing and visitors see the normal offline page.
Visitor requests: /terms-of-service
|
v
Joomla routing resolves URL
|
v
onAfterRoute fires
|
v
Plugin checks: Is offline mode enabled?
| No --> return (do nothing)
| Yes v
Plugin compares: URI path vs configured slug
| No match --> return (show offline page)
| Match v
Plugin sets: $config->set('offline', 0) <-- temporary, this request only
Plugin sets: tmpl=component <-- no template chrome
|
v
Joomla renders article content only
Plugin Architecture
src/
+-- mokojoomtos.php # Legacy entry point (loads namespace)
+-- mokojoomtos.xml # Plugin manifest (params, files, update server)
+-- script.php # Installation script (auto-creates article + menu)
+-- src/
| +-- Extension/
| | +-- MokoJoomTOS.php # Main plugin class (event handler)
| +-- Field/
| +-- MenuslugField.php # Custom form field for slug selection
+-- language/ # Site-side translations (en-GB, en-US)
+-- administrator/
+-- language/ # Admin-side translations (en-GB, en-US)
Installation
From Release (Recommended)
- Download the latest
plg_system_mokojoomtos-x.x.x.zipfrom the Releases page - In Joomla admin, go to System > Install > Extensions
- Upload the ZIP file
- Done -- the plugin automatically:
- Creates a Terms of Service article with sample content
- Creates a "Legal" menu type
- Creates a menu item with alias
terms-of-service - Enables itself
- Configures the slug parameter
No manual configuration is needed after installation.
Build from Source
git clone https://git.mokoconsulting.tech/MokoConsulting/MokoJoomTOS.git
cd MokoJoomTOS/src
zip -r ../plg_system_mokojoomtos.zip \
mokojoomtos.php \
mokojoomtos.xml \
script.php \
src/ \
language/ \
administrator/
Then install the resulting ZIP through Joomla admin.
Configuration
Access the plugin settings at System > Plugins > MokoJoomTOS (search for "mokojoomtos"):
| Parameter | Type | Default | Description |
|---|---|---|---|
Terms of Service Menu Slug (tos_slug) |
Custom menuslug field |
terms-of-service |
The menu item alias that should remain accessible when the site is offline |
Changing the Slug
To protect a different page (e.g., a Privacy Policy):
- Create your article in Content > Articles
- Create a menu item with your desired alias (e.g.,
privacy-policy) - Go to System > Plugins > MokoJoomTOS
- Change the slug to match your menu item alias
- Save
Child paths are also matched -- if the slug is legal, then /legal/privacy and /legal/terms would also be accessible.
Limitations
- Only one slug can be configured at a time
- To expose multiple legal pages, either combine them into a single article or use a parent slug (e.g.,
legal) with all legal menu items as children
Requirements
| Requirement | Minimum |
|---|---|
| Joomla | 5.0 or later |
| PHP | 8.1 or later |
| Database | None required (uses native Joomla tables) |
Update Server
The plugin includes an update server configuration. Joomla will automatically check for new versions:
- Primary:
https://git.mokoconsulting.tech/MokoConsulting/MokoJoomTOS/raw/branch/main/updates.xml - Mirror:
https://raw.githubusercontent.com/mokoconsulting-tech/MokoJoomTOS/main/updates.xml
Updates can be applied through System > Update > Extensions in the Joomla admin.
Verify Installation
- Set your site offline: System > Global Configuration > Site Offline = Yes
- Open an incognito/private browser window
- Visit
yoursite.com/terms-of-service - The Terms of Service article should display (without full site template)
- Visit any other page -- the offline message should appear
Uninstallation
- Go to System > Manage > Extensions
- Search for "mokojoomtos"
- Select the plugin and click Uninstall
Note: Uninstalling the plugin does not remove the article or menu item it created. Remove those manually if desired.
Security
- JEXEC check: All PHP files verify
defined('_JEXEC') or dieto prevent direct access - Input handling: The plugin overwrites query parameters rather than reading user input
- SQL safety: The installation script uses Joomla's query builder with proper quoting
- Minimal scope: The plugin only acts when the site is offline and the URL matches -- zero overhead in normal operation
- No custom tables: Zero database footprint beyond the standard Joomla extension registration
Contributing
See CONTRIBUTING.md for development guidelines and contribution instructions.
Documentation
Full documentation is available on the Wiki:
| Page | Description |
|---|---|
| Installation | Step-by-step installation guide |
| Configuration | Plugin parameters and slug setup |
| How It Works | Technical architecture and event flow |
| Update Server | How updates.xml is automatically managed |
License
This project is licensed under the GNU General Public License v3.0 or later -- see the LICENSE file.