Skip to content

mokoconsulting-tech/MokoJoomTOS

MokoJoomTOS - Offline Access Plugin for Joomla

License: GPL v3 Joomla Enterprise Ready

A lightweight Joomla system plugin that allows your Terms of Service (or any other legal document) to remain accessible even when your site is in offline/maintenance mode.

Features

Simple & Lightweight - Just a single plugin, no component needed
Native Joomla Integration - Uses standard Joomla articles and menus
Slug-Based Access - Configure which menu slug remains accessible when offline
Zero Database Impact - No custom tables or migrations
Automatic Setup - Creates article, menu, and configuration automatically
Enterprise Ready - Secure, scalable, and compliant with best practices
Component View - Displays TOS without template chrome during offline mode

How It Works

  1. Install the plugin - Upload and install the ZIP file
  2. Automatic setup - Plugin creates article and Legal menu automatically
  3. Pre-configured - Terms of Service is ready at /terms-of-service
  4. Visitors can view legal documents even during site maintenance

Installation

From Release (Recommended)

  1. Download the latest plg_system_mokojoomtos-x.x.x.zip from Releases
  2. In Joomla admin, go to System → Install → Extensions
  3. Upload the ZIP file
  4. That's it! The plugin automatically:
    • ✅ Creates a Terms of Service article
    • ✅ Creates a "Legal" menu type
    • ✅ Creates a menu item with slug terms-of-service
    • ✅ Enables itself
    • ✅ Configures the slug automatically

Build from Source

Build scripts are being migrated to the scripts directory. For now, you can manually package the plugin:

  1. Copy files from src/ to a temporary directory
  2. Create a ZIP archive of the contents
  3. The ZIP should contain: mokojoomtos.php, mokojoomtos.xml, script.php, src/, language/, and administrator/

Alternatively, download pre-built releases from Releases.

Automatic vs Manual Setup

🚀 Automatic Setup (Default - Recommended for Enterprise)

The plugin automatically creates everything during installation:

  • ✅ Terms of Service article with sample content
  • ✅ "Legal" menu type for organization
  • ✅ Menu item with alias terms-of-service
  • ✅ Plugin enabled and configured

No manual steps required!

🔧 Manual Setup (Advanced Users)

If you prefer to create your own content:

Step 1: Create Your Terms Article

  • Go to Content → Articles → New
  • Title: "Terms of Service"
  • Add your terms content
  • Save

Step 2: Create Menu Item

  • Go to Menus → Legal → Add New Menu Item
  • Menu Item Type: Single Article
  • Select your Terms article
  • Menu Title: "Terms of Service"
  • Alias: terms-of-service (this is the slug!)
  • Save

Step 3: Configure Plugin

  • Go to System → Plugins → MokoJoomTOS
  • Terms of Service Menu Slug: terms-of-service
  • Status: Enabled
  • Save

Testing

  • Set site offline: System → Global Configuration → Site Offline = Yes
  • Visit yoursite.com/terms-of-service - accessible! ✅
  • Visit other pages - offline message appears ✅

Configuration

The plugin has just ONE configuration field:

Field Description Default
Terms of Service Menu Slug The menu item alias that should remain accessible when site is offline terms-of-service

Technical Details

Plugin Specs

  • Type: System Plugin
  • Event: onAfterRoute
  • Compatibility: Joomla 4.x, 5.x
  • PHP: 7.4+
  • Size: ~6.4 KB
  • Files: 7

How It Works Internally

User requests: /terms-of-service
              ↓
Plugin checks: Is site offline?
              ↓ YES
Plugin checks: Does URL match configured slug?
              ↓ YES
Plugin sets: offline = 0 (temporarily, for this request only)
Plugin sets: tmpl = component (no template chrome)
              ↓
Joomla displays article content only

Project Structure

MokoJoomTOS/
├── src/                          # Plugin source files
│   ├── mokojoomtos.php           # Plugin entry point
│   ├── mokojoomtos.xml           # Plugin manifest
│   ├── script.php                # Installation script
│   ├── src/
│   │   ├── Extension/            # Modern namespaced plugin class
│   │   │   └── MokoJoomTOS.php
│   │   └── Field/                # Custom form fields
│   │       └── MenuslugField.php
│   ├── language/                 # Site language files
│   │   ├── en-GB/
│   │   └── en-US/
│   └── administrator/            # Admin language files
│       └── language/
│           ├── en-GB/
│           └── en-US/
├── docs/                         # Documentation
├── scripts/                      # Build and utility scripts
├── README.md                     # This file
├── LICENSE                       # GPL-3.0 license
└── update.xml                    # Update server configuration

Use Cases

  • Legal Requirement - Display Terms of Service during site maintenance
  • Privacy Policy - Keep privacy policy accessible at all times
  • Legal Notices - Regulatory compliance documentation
  • Contact Information - Emergency contact during extended downtime
  • Accessibility Statement - Maintain accessibility information

Enterprise Features 🏢

Automatic Deployment

  • Zero-touch installation: Installs and configures automatically
  • Idempotent setup: Safe to run multiple times, checks for existing resources
  • Auto-enable: Plugin activates itself after installation
  • Legal menu organization: Creates dedicated "Legal" menu type for better structure

Security & Compliance

  • Component-only view: Displays TOS without template chrome during offline mode (minimizes attack surface)
  • SQL injection prevention: Uses Joomla's query builder with proper escaping
  • Input sanitization: Overwrites malicious query parameters
  • Access control ready: Supports Joomla ACL
  • GPL-3.0 licensed: Enterprise-friendly open source license

Performance & Scalability

  • Lightweight: ~9KB zipped package
  • Efficient event handling: Minimal overhead, early exit patterns
  • No database impact: Uses native Joomla tables only
  • High availability: No external dependencies

Monitoring & Support

  • Error logging: Uses Joomla's Log class
  • Clear feedback: Installation success messages and status indicators
  • Update server: Configured for automatic update notifications
  • Professional support: Available from Moko Consulting

FAQ

Q: Can I use it for Privacy Policy too?
A: The plugin supports one slug currently. You can create one article with both documents, or list both under a parent "legal" menu.

Q: Does it work with SEF URLs?
A: Yes! Works perfectly with Joomla's SEF (Search Engine Friendly) URLs.

Q: Can I use a different slug?
A: Absolutely! Any slug works - just match it with your menu item alias.

Q: Will it conflict with other plugins?
A: No, it's minimal and only acts during offline mode for the specific slug.

Q: Does it store content?
A: No! It uses your existing Joomla articles. No database tables needed.

Requirements

  • Joomla 4.0 or later
  • PHP 7.4 or later

Development

Building

Build scripts are being migrated to the scripts directory. For now, you can manually package the plugin:

  1. Copy files from src/ to a temporary directory
  2. Create a ZIP archive of the contents
  3. Name it plg_system_mokojoomtos-{version}.zip

The installable ZIP should contain: mokojoomtos.php, mokojoomtos.xml, script.php, src/, language/, and administrator/ directories.

Alternatively, download pre-built releases from Releases.

Testing

  1. Build the plugin using the method above
  2. Install in Joomla test instance
  3. Create test article and menu item with alias
  4. Configure plugin with that alias
  5. Set site offline in Global Configuration
  6. Test accessing the configured slug URL

License

GNU General Public License v3.0 or later

See LICENSE file for details.

Author

Moko Consulting

Contributing

Contributions are welcome! Please submit Pull Requests.

Support

File issues at: GitHub Issues

Changelog

Version 03.08.04 (2026-02-28)

  • ✅ Fixed template chrome loading issue
  • ✅ Component-only view now properly applied in offline mode
  • ✅ Event hook changed from onAfterInitialise to onAfterRoute

Version 1.0.0 (2026-02-27)

  • ✅ Initial release
  • ✅ Slug-based offline access
  • ✅ Single configuration field
  • ✅ Multi-language support (en-GB, en-US)
  • ✅ Joomla 4.x and 5.x compatibility

Made with ❤️ by Moko Consulting

About

A component to present a sites Term of Service and privacy policy even through offline.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors