diff --git a/CLAUDE.md b/CLAUDE.md index e65deda..eea75a2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,37 +4,29 @@ This file provides guidance to Claude Code when working with this repository. ## Project Overview -**MokoJoomStoreLocator** -- A Joomla 4/5 package providing a store locator listing component with coordinating map and search modules. +**MokoSuiteStoreLocator** -- A Joomla 5/6 package providing a store locator listing component with coordinating map and search modules. | Field | Value | |---|---| | **Platform** | joomla | | **Extension type** | package (component + modules) | -| **Element** | `pkg_mokojoomstorelocator` | +| **Element** | `pkg_mokosuitestorelocator` | | **Language** | PHP | | **Default branch** | main | | **License** | GPL-3.0-or-later | -| **Wiki** | [MokoJoomStoreLocator Wiki](https://git.mokoconsulting.tech/MokoConsulting/MokoJoomStoreLocator/wiki) | +| **Wiki** | [MokoSuiteStoreLocator Wiki](https://git.mokoconsulting.tech/MokoConsulting/MokoSuiteStoreLocator/wiki) | | **Standards** | [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home) | ## Package Contents | Extension | Type | Element | |---|---|---| -| Store Locator Component | component | `com_mokojoomstorelocator` | -| Store Locator Map | module (site) | `mod_mokojoomstorelocator_map` | -| Store Locator Search | module (site) | `mod_mokojoomstorelocator_search` | +| Store Locator Component | component | `com_mokosuitestorelocator` | +| Store Locator Map | module (site) | `mod_mokosuitestorelocator_map` | +| Store Locator Search | module (site) | `mod_mokosuitestorelocator_search` | ## Common Commands -```bash -make build # Build package ZIP containing all sub-extensions -make lint # Run PHP linter -make validate # Lint + validation checks -make release # Validate + build -make clean # Clean build artifacts -``` - ```bash composer install # Install PHP dev dependencies ``` @@ -43,19 +35,18 @@ composer install # Install PHP dev dependencies This is a Joomla package. Key layout: -- `src/pkg_mokojoomstorelocator.xml` -- package manifest -- `src/script.php` -- package install/upgrade/uninstall script -- `src/packages/com_mokojoomstorelocator/` -- main component +- `source/pkg_mokosuitestorelocator.xml` -- package manifest +- `source/script.php` -- package install/upgrade/uninstall script +- `source/packages/com_mokosuitestorelocator/` -- main component - `admin/` -- admin MVC (controllers, models, views, forms, tables, SQL) - `site/` -- frontend MVC (controllers, models, views, templates) - - `mokojoomstorelocator.xml` -- component manifest -- `src/packages/mod_mokojoomstorelocator_map/` -- map display module -- `src/packages/mod_mokojoomstorelocator_search/` -- search/filter module -- `updates.xml` -- Joomla update server manifest + - `mokosuitestorelocator.xml` -- component manifest +- `source/packages/mod_mokosuitestorelocator_map/` -- map display module +- `source/packages/mod_mokosuitestorelocator_search/` -- search/filter module ## Database Table -`#__mokojoomstorelocator_locations` -- stores location data including coordinates, address, contact info, and business hours. +`#__mokosuitestorelocator_locations` -- stores location data including coordinates, address, contact info, and business hours. ## Rules @@ -66,6 +57,7 @@ This is a Joomla package. Key layout: - **Branch strategy**: develop on `dev/`, merge to `main` for release - **Wiki**: documentation lives in the Gitea wiki, not in `docs/` files - **Standards**: this repo follows [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home) -- **PHP minimum**: 8.1 +- **PHP minimum**: 8.2 +- **Joomla minimum**: 5.0 - **Joomla table operations**: always use bind() -> check() -> store(), never save() -- **Namespace**: `Moko\Component\MokoJoomStoreLocator` for the component +- **Namespace**: `Moko\Component\MokoSuiteStoreLocator` for the component diff --git a/README.md b/README.md index 7f5ac08..89fefb4 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ A Joomla 4/5 package providing a store locator listing component with coordinati ## Requirements -- Joomla 4.4+ or 5.x -- PHP 8.1+ -- MySQL 5.7+ / MariaDB 10.3+ +- Joomla 5.x or 6.x +- PHP 8.2+ +- MySQL 8.0+ / MariaDB 10.4+ ## Installation diff --git a/source/packages/com_mokosuitestorelocator/admin/language/en-GB/com_mokosuitestorelocator.ini b/source/packages/com_mokosuitestorelocator/admin/language/en-GB/com_mokosuitestorelocator.ini index cf4ce03..3b64378 100644 --- a/source/packages/com_mokosuitestorelocator/admin/language/en-GB/com_mokosuitestorelocator.ini +++ b/source/packages/com_mokosuitestorelocator/admin/language/en-GB/com_mokosuitestorelocator.ini @@ -37,3 +37,7 @@ COM_MOKOJOOMSTORELOCATOR_LOCATION_SAVE_SUCCESS="Location saved successfully." COM_MOKOJOOMSTORELOCATOR_LOCATIONS_N_ITEMS_PUBLISHED="%d location(s) published." COM_MOKOJOOMSTORELOCATOR_LOCATIONS_N_ITEMS_UNPUBLISHED="%d location(s) unpublished." COM_MOKOJOOMSTORELOCATOR_LOCATIONS_N_ITEMS_DELETED="%d location(s) deleted." + +COM_MOKOJOOMSTORELOCATOR_ERROR_TITLE_REQUIRED="A location title is required." +COM_MOKOJOOMSTORELOCATOR_ERROR_LATITUDE_RANGE="Latitude must be between -90 and 90." +COM_MOKOJOOMSTORELOCATOR_ERROR_LONGITUDE_RANGE="Longitude must be between -180 and 180." diff --git a/source/packages/com_mokosuitestorelocator/admin/src/Table/LocationTable.php b/source/packages/com_mokosuitestorelocator/admin/src/Table/LocationTable.php index d875626..fb486cc 100644 --- a/source/packages/com_mokosuitestorelocator/admin/src/Table/LocationTable.php +++ b/source/packages/com_mokosuitestorelocator/admin/src/Table/LocationTable.php @@ -12,6 +12,7 @@ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\Filter\OutputFilter; +use Joomla\CMS\Language\Text; use Joomla\CMS\Table\Table; use Joomla\Database\DatabaseDriver; @@ -47,7 +48,7 @@ class LocationTable extends Table { if (trim($this->title) === '') { - $this->setError('A location title is required.'); + $this->setError(Text::_('COM_MOKOJOOMSTORELOCATOR_ERROR_TITLE_REQUIRED')); return false; } @@ -61,14 +62,14 @@ class LocationTable extends Table if ($this->latitude !== null && ($this->latitude < -90 || $this->latitude > 90)) { - $this->setError('Latitude must be between -90 and 90.'); + $this->setError(Text::_('COM_MOKOJOOMSTORELOCATOR_ERROR_LATITUDE_RANGE')); return false; } if ($this->longitude !== null && ($this->longitude < -180 || $this->longitude > 180)) { - $this->setError('Longitude must be between -180 and 180.'); + $this->setError(Text::_('COM_MOKOJOOMSTORELOCATOR_ERROR_LONGITUDE_RANGE')); return false; } diff --git a/source/packages/com_mokosuitestorelocator/admin/src/View/Locations/HtmlView.php b/source/packages/com_mokosuitestorelocator/admin/src/View/Locations/HtmlView.php index 36dee0d..eaf52f9 100644 --- a/source/packages/com_mokosuitestorelocator/admin/src/View/Locations/HtmlView.php +++ b/source/packages/com_mokosuitestorelocator/admin/src/View/Locations/HtmlView.php @@ -10,6 +10,7 @@ namespace Moko\Component\MokoSuiteStoreLocator\Administrator\View\Locations; defined('_JEXEC') or die; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Toolbar\ToolbarHelper; @@ -81,7 +82,7 @@ class HtmlView extends BaseHtmlView */ protected function addToolbar(): void { - ToolbarHelper::title('Store Locator: Locations'); + ToolbarHelper::title(Text::_('COM_MOKOJOOMSTORELOCATOR_LOCATIONS'), 'location'); ToolbarHelper::addNew('location.add'); ToolbarHelper::publish('locations.publish', 'JTOOLBAR_PUBLISH', true); ToolbarHelper::unpublish('locations.unpublish', 'JTOOLBAR_UNPUBLISH', true); diff --git a/source/packages/com_mokosuitestorelocator/mokosuitestorelocator.xml b/source/packages/com_mokosuitestorelocator/mokosuitestorelocator.xml index 13a1c7f..f882ef5 100644 --- a/source/packages/com_mokosuitestorelocator/mokosuitestorelocator.xml +++ b/source/packages/com_mokosuitestorelocator/mokosuitestorelocator.xml @@ -16,7 +16,7 @@ com_mokosuitestorelocator 1.0.0 - 2026-05-21 + 2026-06-23 Moko Consulting hello@mokoconsulting.tech https://mokoconsulting.tech diff --git a/source/packages/com_mokosuitestorelocator/site/tmpl/location/default.php b/source/packages/com_mokosuitestorelocator/site/tmpl/location/default.php index 46bbd04..9530029 100644 --- a/source/packages/com_mokosuitestorelocator/site/tmpl/location/default.php +++ b/source/packages/com_mokosuitestorelocator/site/tmpl/location/default.php @@ -8,6 +8,7 @@ defined('_JEXEC') or die; +use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; /** @var \Moko\Component\MokoSuiteStoreLocator\Site\View\Location\HtmlView $this */ @@ -27,7 +28,7 @@ $item = $this->item; description) : ?>
- description; ?> + description); ?>
diff --git a/source/packages/mod_mokosuitestorelocator_map/mod_mokosuitestorelocator_map.xml b/source/packages/mod_mokosuitestorelocator_map/mod_mokosuitestorelocator_map.xml index 4f63a9d..25a83c0 100644 --- a/source/packages/mod_mokosuitestorelocator_map/mod_mokosuitestorelocator_map.xml +++ b/source/packages/mod_mokosuitestorelocator_map/mod_mokosuitestorelocator_map.xml @@ -15,7 +15,7 @@ mod_mokosuitestorelocator_map 1.0.0 - 2026-05-21 + 2026-06-23 Moko Consulting hello@mokoconsulting.tech https://mokoconsulting.tech diff --git a/source/packages/mod_mokosuitestorelocator_map/tmpl/default.php b/source/packages/mod_mokosuitestorelocator_map/tmpl/default.php index 71d8073..d05fa24 100644 --- a/source/packages/mod_mokosuitestorelocator_map/tmpl/default.php +++ b/source/packages/mod_mokosuitestorelocator_map/tmpl/default.php @@ -62,11 +62,17 @@ document.addEventListener('DOMContentLoaded', function() { var bounds = L.latLngBounds(); + function esc(str) { + var d = document.createElement('div'); + d.appendChild(document.createTextNode(str || '')); + return d.innerHTML; + } + locations.forEach(function(loc) { var marker = L.marker([loc.lat, loc.lng]).addTo(map); - var popup = '' + loc.title + ''; - if (loc.address) popup += '
' + loc.address; - if (loc.phone) popup += '
' + loc.phone + ''; + var popup = '' + esc(loc.title) + ''; + if (loc.address) popup += '
' + esc(loc.address); + if (loc.phone) popup += '
' + esc(loc.phone) + ''; marker.bindPopup(popup); bounds.extend([loc.lat, loc.lng]); }); diff --git a/source/packages/mod_mokosuitestorelocator_search/mod_mokosuitestorelocator_search.xml b/source/packages/mod_mokosuitestorelocator_search/mod_mokosuitestorelocator_search.xml index cfa808f..5594d77 100644 --- a/source/packages/mod_mokosuitestorelocator_search/mod_mokosuitestorelocator_search.xml +++ b/source/packages/mod_mokosuitestorelocator_search/mod_mokosuitestorelocator_search.xml @@ -15,7 +15,7 @@ mod_mokosuitestorelocator_search 1.0.0 - 2026-05-21 + 2026-06-23 Moko Consulting hello@mokoconsulting.tech https://mokoconsulting.tech diff --git a/source/pkg_mokosuitestorelocator.xml b/source/pkg_mokosuitestorelocator.xml index c445264..a7d7569 100644 --- a/source/pkg_mokosuitestorelocator.xml +++ b/source/pkg_mokosuitestorelocator.xml @@ -19,7 +19,7 @@ pkg_mokosuitestorelocator mokosuitestorelocator 1.0.0 - 2026-05-21 + 2026-06-23 Moko Consulting hello@mokoconsulting.tech https://mokoconsulting.tech diff --git a/source/script.php b/source/script.php index 3061830..0a77084 100644 --- a/source/script.php +++ b/source/script.php @@ -9,6 +9,7 @@ defined('_JEXEC') or die; use Joomla\CMS\Installer\InstallerAdapter; +use Joomla\CMS\Installer\InstallerScriptInterface; use Joomla\CMS\Log\Log; /** @@ -16,7 +17,7 @@ use Joomla\CMS\Log\Log; * * @since 1.0.0 */ -class Pkg_MokosuitestorelocatorInstallerScript +class Pkg_MokosuitestorelocatorInstallerScript implements InstallerScriptInterface { /** * Minimum PHP version required. @@ -24,7 +25,7 @@ class Pkg_MokosuitestorelocatorInstallerScript * @var string * @since 1.0.0 */ - protected $minimumPhp = '8.1'; + protected string $minimumPhp = '8.2'; /** * Minimum Joomla version required. @@ -32,7 +33,7 @@ class Pkg_MokosuitestorelocatorInstallerScript * @var string * @since 1.0.0 */ - protected $minimumJoomla = '4.4.0'; + protected string $minimumJoomla = '5.0.0'; /** * Called before any type of action. @@ -44,7 +45,7 @@ class Pkg_MokosuitestorelocatorInstallerScript * * @since 1.0.0 */ - public function preflight($type, $parent) + public function preflight(string $type, InstallerAdapter $parent): bool { if (version_compare(PHP_VERSION, $this->minimumPhp, '<')) { @@ -72,16 +73,29 @@ class Pkg_MokosuitestorelocatorInstallerScript } /** - * Called after installation. + * Called on installation. * - * @param string $type Installation type. - * @param InstallerAdapter $parent The parent installer object. + * @param InstallerAdapter $parent The parent installer object. * * @return boolean True on success. * * @since 1.0.0 */ - public function postflight($type, $parent) + public function install(InstallerAdapter $parent): bool + { + return true; + } + + /** + * Called on update. + * + * @param InstallerAdapter $parent The parent installer object. + * + * @return boolean True on success. + * + * @since 1.0.0 + */ + public function update(InstallerAdapter $parent): bool { return true; } @@ -91,11 +105,27 @@ class Pkg_MokosuitestorelocatorInstallerScript * * @param InstallerAdapter $parent The parent installer object. * - * @return void + * @return boolean True on success. * * @since 1.0.0 */ - public function uninstall($parent) + public function uninstall(InstallerAdapter $parent): bool { + return true; + } + + /** + * Called after any type of action. + * + * @param string $type Installation type. + * @param InstallerAdapter $parent The parent installer object. + * + * @return boolean True on success. + * + * @since 1.0.0 + */ + public function postflight(string $type, InstallerAdapter $parent): bool + { + return true; } }