fix(plugin): correct event handler, language keys, and repo refs #11

Merged
jmiller-moko merged 2 commits from dev/03.08.04 into main 2026-03-24 21:12:09 +00:00
8 changed files with 72 additions and 43 deletions
+4
View File
@@ -193,6 +193,10 @@ The `manifest.xml` must reference it via:
- Must include `<files folder="site">` and `<administration>` sections.
- Joomla 4.x requires `<namespace path="src">Moko\{{EXTENSION_NAME}}</namespace>` for namespaced extensions.
1. **Template Rendering**
- Use `onAfterRoute` event (not `onAfterInitialise`) to set `tmpl=component`
- This is the correct point in Joomla's lifecycle (after routing, before template selection)
- Both the legacy `mokojoomtos.php` and modern `Extension/MokoJoomTOS.php` use `onAfterRoute`
---
## GitHub Actions — Token Usage
+25 -11
View File
@@ -19,9 +19,9 @@
(./LICENSE).
# FILE INFORMATION
DEFGROUP: MokoStandards.Templates.Joomla
INGROUP: MokoStandards
REPO: https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Component
DEFGROUP: MokoJoomTOS
INGROUP: plg_system_mokojoomtos
REPO: https://github.com/mokoconsulting-tech/MokoJoomTOS
VERSION: 03.08.04
PATH: ./CHANGELOG.md
BRIEF: Version history and release notes
@@ -40,10 +40,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- GitHub Actions CI/CD workflows
- Pre-commit hooks for code quality
- Example component implementation
- Component generator script
- Docker development environment
### Fixed
- Legacy `mokojoomtos.php` now uses `onAfterRoute` event instead of `onAfterInitialise`
- Legacy plugin entry point now sets `tmpl=component` for component-only view during offline mode
- Installation script language keys corrected to match actual INI file definitions
- Installation script `$extension` property corrected from `plg_system_mokojoomtos_offline` to `plg_system_mokojoomtos`
- README.md event reference corrected from `onAfterInitialise` to `onAfterRoute`
### Changed
- Updated all markdown FILE INFORMATION headers to reference MokoJoomTOS repository
- Updated CONTRIBUTING.md title, clone URLs, and links to reference MokoJoomTOS
- Updated CHANGELOG.md links to reference MokoJoomTOS repository
- Updated CLAUDE.md and copilot-instructions.md for accuracy
## [03.08.04] - 2026-02-28
### Changed
@@ -128,7 +141,7 @@ This template follows [Semantic Versioning](https://semver.org/):
### [1.0.0] Release Notes
This is the initial release of the MokoStandards Joomla Component Template. It provides a production-ready starting point for Joomla component development with:
This is the initial release of the MokoJoomTOS plugin. It provides a production-ready Joomla system plugin for offline TOS access with:
- **Complete build system** via comprehensive Makefile
- **MokoStandards compliance** out of the box
@@ -146,10 +159,11 @@ This template is ready for use in creating new Joomla components that follow org
## Links
- [Repository](https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Component)
- [Issues](https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Component/issues)
- [Pull Requests](https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Component/pulls)
- [Repository](https://github.com/mokoconsulting-tech/MokoJoomTOS)
- [Issues](https://github.com/mokoconsulting-tech/MokoJoomTOS/issues)
- [Pull Requests](https://github.com/mokoconsulting-tech/MokoJoomTOS/pulls)
- [MokoStandards](https://github.com/mokoconsulting-tech/MokoCodingDefaults)
[Unreleased]: https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Component/compare/v1.0.0...HEAD
[1.0.0]: https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Component/releases/tag/v1.0.0
[Unreleased]: https://github.com/mokoconsulting-tech/MokoJoomTOS/compare/v03.08.04...HEAD
[03.08.04]: https://github.com/mokoconsulting-tech/MokoJoomTOS/releases/tag/v03.08.04
[1.0.0]: https://github.com/mokoconsulting-tech/MokoJoomTOS/releases/tag/v1.0.0
+4 -4
View File
@@ -19,12 +19,12 @@
(./LICENSE).
# FILE INFORMATION
DEFGROUP: MokoStandards.Templates.Joomla
INGROUP: MokoStandards
REPO: https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Component
DEFGROUP: MokoJoomTOS
INGROUP: plg_system_mokojoomtos
REPO: https://github.com/mokoconsulting-tech/MokoJoomTOS
VERSION: 03.08.04
PATH: ./CODE_OF_CONDUCT.md
BRIEF: Code of Conduct for Joomla Component template contributions
BRIEF: Code of Conduct for MokoJoomTOS plugin contributions
-->
# Code of Conduct
+10 -10
View File
@@ -19,15 +19,15 @@
(./LICENSE).
# FILE INFORMATION
DEFGROUP: MokoStandards.Templates.Joomla
INGROUP: MokoStandards
REPO: https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Component
DEFGROUP: MokoJoomTOS
INGROUP: plg_system_mokojoomtos
REPO: https://github.com/mokoconsulting-tech/MokoJoomTOS
VERSION: 03.08.04
PATH: ./CONTRIBUTING.md
BRIEF: Contribution guidelines for Joomla Component template development
BRIEF: Contribution guidelines for MokoJoomTOS plugin development
-->
# Contributing to MokoStandards-Template-Joomla-Component
# Contributing to MokoJoomTOS
Thank you for your interest in contributing! This document provides guidelines for contributing to this template repository.
@@ -81,8 +81,8 @@ Signed-off-by: Your Name <your.email@example.com>
### 1. Clone and Install
```bash
git clone https://github.com/your-username/MokoStandards-Template-Joomla-Component.git
cd MokoStandards-Template-Joomla-Component
git clone https://github.com/your-username/MokoJoomTOS.git
cd MokoJoomTOS
make install-deps
```
@@ -269,8 +269,8 @@ Include:
## Getting Help
- **Documentation**: Check [docs/](docs/index.md)
- **Issues**: Search [existing issues](https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Component/issues)
- **Discussions**: Ask in [GitHub Discussions](https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Component/discussions)
- **Issues**: Search [existing issues](https://github.com/mokoconsulting-tech/MokoJoomTOS/issues)
- **Discussions**: Ask in [GitHub Discussions](https://github.com/mokoconsulting-tech/MokoJoomTOS/discussions)
- **Email**: hello@mokoconsulting.tech
## Recognition
@@ -281,7 +281,7 @@ Contributors are recognized in:
- Release notes
- Project documentation
Thank you for contributing to MokoStandards!
Thank you for contributing to MokoJoomTOS!
## License
+3 -2
View File
@@ -105,7 +105,7 @@ The plugin has just ONE configuration field:
### Plugin Specs
- **Type**: System Plugin
- **Event**: `onAfterInitialise`
- **Event**: `onAfterRoute`
- **Compatibility**: Joomla 4.x, 5.x
- **PHP**: 7.4+
- **Size**: ~6.4 KB
@@ -121,8 +121,9 @@ Plugin checks: Is site offline?
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 page normally
Joomla displays article content only
```
### Project Structure
+4 -4
View File
@@ -19,9 +19,9 @@
(./LICENSE).
# FILE INFORMATION
DEFGROUP: MokoStandards.Templates.Joomla
INGROUP: MokoStandards
REPO: https://github.com/mokoconsulting-tech/MokoStandards-Template-Joomla-Component
DEFGROUP: MokoJoomTOS
INGROUP: plg_system_mokojoomtos
REPO: https://github.com/mokoconsulting-tech/MokoJoomTOS
VERSION: 03.08.04
PATH: ./SECURITY.md
BRIEF: Security policy and vulnerability reporting procedures
@@ -62,7 +62,7 @@ If you discover a security vulnerability in **this template repository**, please
1. **DO NOT** create a public GitHub issue
2. **Email**: security@mokoconsulting.tech
3. **Subject**: `[SECURITY] MokoStandards-Template-Joomla-Component: Brief Description`
3. **Subject**: `[SECURITY] MokoJoomTOS: Brief Description`
### For Components Built from Template
+17 -7
View File
@@ -39,17 +39,20 @@ class PlgSystemMokojoomtos extends CMSPlugin
protected $app;
/**
* After initialise event handler
* After route event handler
*
* Checks if the current request is for the Terms of Service slug and if
* the site is in offline mode. If both conditions are met, temporarily
* disables offline mode for this request only.
* disables offline mode and sets component-only view for this request.
*
* This event fires after routing but before template selection, making it
* the correct place to set tmpl=component to prevent template chrome loading.
*
* @return void
*
* @since 1.0.0
* @since 03.08.04
*/
public function onAfterInitialise()
public function onAfterRoute()
{
// Only process for site application
if (!$this->app->isClient('site'))
@@ -59,7 +62,7 @@ class PlgSystemMokojoomtos extends CMSPlugin
// Get the global configuration
$config = $this->app->getConfig();
// Only proceed if site is offline
if (!$config->get('offline'))
{
@@ -68,7 +71,7 @@ class PlgSystemMokojoomtos extends CMSPlugin
// Get the configured Terms of Service slug
$tosSlug = trim($this->params->get('tos_slug', 'terms-of-service'));
if (empty($tosSlug))
{
return;
@@ -77,7 +80,7 @@ class PlgSystemMokojoomtos extends CMSPlugin
// Get the current URI path
$uri = Uri::getInstance();
$path = trim($uri->getPath(), '/');
// Remove the base path if present
$base = trim(Uri::base(true), '/');
if (!empty($base) && strpos($path, $base) === 0)
@@ -90,6 +93,13 @@ class PlgSystemMokojoomtos extends CMSPlugin
{
// Temporarily disable offline mode for this request
$config->set('offline', 0);
// Set component-only view (no template chrome)
$input = $this->app->input;
$input->set('tmpl', 'component');
// Also set in GET superglobal to ensure recognition
$_GET['tmpl'] = 'component';
}
}
}
+5 -5
View File
@@ -1,7 +1,7 @@
<?php
/**
* @package MokoJoomTOS
* @subpackage plg_system_mokojoomtos_offline
* @subpackage plg_system_mokojoomtos
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
*/
@@ -44,7 +44,7 @@ class PlgSystemMokojoomtosOfflineInstallerScript extends InstallerScript
* @var string
* @since 1.0.0
*/
protected $extension = 'plg_system_mokojoomtos_offline';
protected $extension = 'plg_system_mokojoomtos';
/**
* Function called before plugin installation/update/uninstall
@@ -77,7 +77,7 @@ class PlgSystemMokojoomtosOfflineInstallerScript extends InstallerScript
*/
public function install($parent)
{
echo '<p>' . Text::_('PLG_SYSTEM_MOKOJOOMTOS_OFFLINE_INSTALL_SUCCESS') . '</p>';
echo '<p>' . Text::_('PLG_SYSTEM_MOKOJOOMTOS_INSTALL_SUCCESS') . '</p>';
}
/**
@@ -91,7 +91,7 @@ class PlgSystemMokojoomtosOfflineInstallerScript extends InstallerScript
*/
public function update($parent)
{
echo '<p>' . Text::_('PLG_SYSTEM_MOKOJOOMTOS_OFFLINE_UPDATE_SUCCESS') . '</p>';
echo '<p>' . Text::_('PLG_SYSTEM_MOKOJOOMTOS_UPDATE_SUCCESS') . '</p>';
}
/**
@@ -105,7 +105,7 @@ class PlgSystemMokojoomtosOfflineInstallerScript extends InstallerScript
*/
public function uninstall($parent)
{
echo '<p>' . Text::_('PLG_SYSTEM_MOKOJOOMTOS_OFFLINE_UNINSTALL_SUCCESS') . '</p>';
echo '<p>' . Text::_('PLG_SYSTEM_MOKOJOOMTOS_UNINSTALL_SUCCESS') . '</p>';
}
/**