f2afe8e9d9
Admin: - LocationController (FormController for save/edit/cancel) - LocationsController (AdminController for publish/delete/ordering) - Location edit view with tabbed form and Leaflet coordinate picker - Component extension implements RouterServiceInterface Frontend: - Single location detail view with Schema.org JSON-LD - SEF URL router (locations list + location detail by alias) - Location detail template with map, contact info, directions - Locations list now links to detail pages with distance display Map module: - Full Leaflet.js rendering with OpenStreetMap tiles - MarkerCluster plugin for dense marker areas - DOM-based popup content (XSS-safe, no innerHTML) - Google Maps provider with clustering support - Auto-fit bounds to show all markers - "Get Directions" link in popups Package: - Post-install script enables bundled modules automatically - Fixed .gitignore to allow src/**/site/ paths Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
147 lines
3.0 KiB
PHP
147 lines
3.0 KiB
PHP
<?php
|
|
/**
|
|
* @package MokoJoomStoreLocator
|
|
* @subpackage pkg_mokojoomstorelocator
|
|
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
|
* @license GNU General Public License version 3 or later; see LICENSE
|
|
*/
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Factory;
|
|
use Joomla\CMS\Installer\InstallerAdapter;
|
|
use Joomla\CMS\Language\Text;
|
|
use Joomla\CMS\Log\Log;
|
|
|
|
/**
|
|
* Package installation script for MokoJoomStoreLocator.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
class Pkg_MokojoomstorelocatorInstallerScript
|
|
{
|
|
/**
|
|
* Minimum PHP version required.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
protected $minimumPhp = '8.1';
|
|
|
|
/**
|
|
* Minimum Joomla version required.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
protected $minimumJoomla = '4.4.0';
|
|
|
|
/**
|
|
* Called before any type of action.
|
|
*
|
|
* @param string $type Installation type (install, update, discover_install).
|
|
* @param InstallerAdapter $parent The parent installer object.
|
|
*
|
|
* @return boolean True on success.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function preflight($type, $parent)
|
|
{
|
|
if (version_compare(PHP_VERSION, $this->minimumPhp, '<'))
|
|
{
|
|
Log::add(
|
|
'MokoJoomStoreLocator requires PHP ' . $this->minimumPhp . ' or later.',
|
|
Log::WARNING,
|
|
'jerror'
|
|
);
|
|
|
|
return false;
|
|
}
|
|
|
|
if (version_compare(JVERSION, $this->minimumJoomla, '<'))
|
|
{
|
|
Log::add(
|
|
'MokoJoomStoreLocator requires Joomla ' . $this->minimumJoomla . ' or later.',
|
|
Log::WARNING,
|
|
'jerror'
|
|
);
|
|
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Called after installation.
|
|
*
|
|
* @param string $type Installation type.
|
|
* @param InstallerAdapter $parent The parent installer object.
|
|
*
|
|
* @return boolean True on success.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function postflight($type, $parent)
|
|
{
|
|
if ($type === 'install')
|
|
{
|
|
$this->enableModules();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Called on uninstallation.
|
|
*
|
|
* @param InstallerAdapter $parent The parent installer object.
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function uninstall($parent)
|
|
{
|
|
Log::add('MokoJoomStoreLocator package uninstalled.', Log::INFO, 'jerror');
|
|
}
|
|
|
|
/**
|
|
* Enable the bundled modules after first install.
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
private function enableModules(): void
|
|
{
|
|
$db = Factory::getContainer()->get(\Joomla\Database\DatabaseInterface::class);
|
|
|
|
$modules = [
|
|
'mod_mokojoomstorelocator_map',
|
|
'mod_mokojoomstorelocator_search',
|
|
];
|
|
|
|
foreach ($modules as $module)
|
|
{
|
|
$query = $db->getQuery(true)
|
|
->update($db->quoteName('#__extensions'))
|
|
->set($db->quoteName('enabled') . ' = 1')
|
|
->where($db->quoteName('element') . ' = :element')
|
|
->where($db->quoteName('type') . ' = ' . $db->quote('module'))
|
|
->bind(':element', $module);
|
|
$db->setQuery($query);
|
|
|
|
try
|
|
{
|
|
$db->execute();
|
|
}
|
|
catch (\Exception $e)
|
|
{
|
|
Log::add('Failed to enable ' . $module . ': ' . $e->getMessage(), Log::WARNING, 'jerror');
|
|
}
|
|
}
|
|
}
|
|
}
|