first commit

This commit is contained in:
2025-06-17 11:53:18 +02:00
commit 9f0f7ba12b
8804 changed files with 1369176 additions and 0 deletions

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="extension" method="upgrade">
<name>plg_extension_namespacemap</name>
<author>Joomla! Project</author>
<creationDate>2017-05</creationDate>
<copyright>(C) 2017 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>4.0.0</version>
<description>PLG_EXTENSION_NAMESPACEMAP_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Extension\NamespaceMap</namespace>
<files>
<folder plugin="namespacemap">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_extension_namespacemap.ini</language>
<language tag="en-GB">language/en-GB/plg_extension_namespacemap.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,45 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Extension.namespacemap
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
\defined('_JEXEC') or die;
use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Extension\NamespaceMap\Extension\NamespaceMap;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.3.0
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new NamespaceMap(
$container->get(DispatcherInterface::class),
new JNamespacePsr4Map(),
(array) PluginHelper::getPlugin('extension', 'namespacemap')
);
return $plugin;
}
);
}
};

View File

@ -0,0 +1,110 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Extension.namespacemap
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\Extension\NamespaceMap\Extension;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Event\DispatcherInterface;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Joomla! namespace map creator / updater.
*
* @since 4.0.0
*/
final class NamespaceMap extends CMSPlugin
{
/**
* The namespace map file creator
*
* @var \JNamespacePsr4Map
*/
private $fileCreator = null;
/**
* Constructor
*
* @param DispatcherInterface $subject The object to observe
* @param \JNamespacePsr4Map $map The namespace map creator
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'group', 'params', 'language'
* (this list is not meant to be comprehensive).
*
* @since 4.0.0
*/
public function __construct(DispatcherInterface $dispatcher, \JNamespacePsr4Map $map, array $config = [])
{
$this->fileCreator = $map;
parent::__construct($dispatcher, $config);
}
/**
* Update / Create map on extension install
*
* @param Installer $installer Installer instance
* @param integer $eid Extension id
*
* @return void
*
* @since 4.0.0
*/
public function onExtensionAfterInstall($installer, $eid)
{
// Check that we have a valid extension
if ($eid) {
// Update / Create new map
$this->fileCreator->create();
}
}
/**
* Update / Create map on extension uninstall
*
* @param Installer $installer Installer instance
* @param integer $eid Extension id
* @param boolean $removed Installation result
*
* @return void
*
* @since 4.0.0
*/
public function onExtensionAfterUninstall($installer, $eid, $removed)
{
// Check that we have a valid extension and that it has been removed
if ($eid && $removed) {
// Update / Create new map
$this->fileCreator->create();
}
}
/**
* Update map on extension update
*
* @param Installer $installer Installer instance
* @param integer $eid Extension id
*
* @return void
*
* @since 4.0.0
*/
public function onExtensionAfterUpdate($installer, $eid)
{
// Check that we have a valid extension
if ($eid) {
// Update / Create new map
$this->fileCreator->create();
}
}
}