2026-05-16 22:52:46 +00:00
2026-02-22 19:59:29 -06:00
2026-02-22 19:59:29 -06:00
2026-02-22 19:59:29 -06:00
2026-02-22 19:59:29 -06:00
2026-05-16 17:29:52 -05:00
2026-04-26 16:35:40 +00:00

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.

Joomla PHP License Version Type

Field Value
Author Moko Consulting
License GPL-3.0-or-later
Platform Gitea
Version 04.01.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 legal also 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 SubscriberInterface and 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:

  1. Check scope -- Only acts on the site application (not admin)
  2. Check offline -- Only acts when the site is in offline mode
  3. Match slug -- Compares the URI path against the configured tos_slug parameter
  4. Bypass offline -- If matched, temporarily sets offline = 0 for this request only (not persisted to database)
  5. Strip template -- Forces tmpl=component so 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

  1. Download the latest plg_system_mokojoomtos-x.x.x.zip from the Releases page
  2. In Joomla admin, go to System > Install > Extensions
  3. Upload the ZIP file
  4. 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):

  1. Create your article in Content > Articles
  2. Create a menu item with your desired alias (e.g., privacy-policy)
  3. Go to System > Plugins > MokoJoomTOS
  4. Change the slug to match your menu item alias
  5. 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

  1. Set your site offline: System > Global Configuration > Site Offline = Yes
  2. Open an incognito/private browser window
  3. Visit yoursite.com/terms-of-service
  4. The Terms of Service article should display (without full site template)
  5. Visit any other page -- the offline message should appear

Uninstallation

  1. Go to System > Manage > Extensions
  2. Search for "mokojoomtos"
  3. 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 die to 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.


Moko Consulting -- MokoStandards

S
Description
A component to present a sites Term of Service and privacy policy even through offline.
Readme GPL-3.0
1.9 MiB
2026-05-24 04:32:38 +00:00
Languages
Markdown 51.2%
PHP 18%
Makefile 8.9%
INI 8.4%
XML 7.3%
Other 6.2%