Skip to content

Commit

Permalink
Merge branch '5.1-dev' into mod-version
Browse files Browse the repository at this point in the history
  • Loading branch information
LadySolveig committed Feb 25, 2024
2 parents 886c2a6 + 169218b commit f6e4f6c
Show file tree
Hide file tree
Showing 30 changed files with 721 additions and 84 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES
(0, 'plg_schemaorg_custom', 'plugin', 'custom', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES
(0, 'plg_schemaorg_custom', 'plugin', 'custom', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 0, 0);
10 changes: 10 additions & 0 deletions administrator/language/en-GB/plg_schemaorg_custom.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
; Joomla! Project
; (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

PLG_SCHEMAORG_CUSTOM="Schema.org - Custom"
PLG_SCHEMAORG_CUSTOM_XML_DESCRIPTION="Adds a custom field to add any schema type."
PLG_SCHEMAORG_CUSTOM_DESCRIPTION_LABEL="Use any JSON-LD code here to add currently unsupported schema types."
PLG_SCHEMAORG_CUSTOM_JSON_ERROR="The JSON code is not valid or @context or @type is missing."
PLG_SCHEMAORG_CUSTOM_JSON_FIELD_LABEL="JSON Code"
8 changes: 8 additions & 0 deletions administrator/language/en-GB/plg_schemaorg_custom.sys.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
; Joomla! Project
; (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>

; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

PLG_SCHEMAORG_CUSTOM="Schema.org - Custom"
PLG_SCHEMAORG_CUSTOM_XML_DESCRIPTION="Adds a custom field to add any schema type."
20 changes: 0 additions & 20 deletions administrator/modules/mod_title/mod_title.php

This file was deleted.

4 changes: 3 additions & 1 deletion administrator/modules/mod_title/mod_title.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>MOD_TITLE_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Module\Title</namespace>
<files>
<filename module="mod_title">mod_title.php</filename>
<folder module="mod_title">services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<languages>
Expand Down
39 changes: 39 additions & 0 deletions administrator/modules/mod_title/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_title
*
* @copyright (C) 2024 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\Service\Provider\Module;
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;

/**
* The title module service provider.
*
* @since __DEPLOY_VERSION__
*/
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function register(Container $container)
{
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Title'));

$container->registerServiceProvider(new Module());
}
};
44 changes: 44 additions & 0 deletions administrator/modules/mod_title/src/Dispatcher/Dispatcher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_title
*
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Module\Title\Administrator\Dispatcher;

use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* Dispatcher class for mod_title
*
* @since __DEPLOY_VERSION__
*/
class Dispatcher extends AbstractModuleDispatcher
{
/**
* Returns the layout data.
*
* @return array
*
* @since __DEPLOY_VERSION__
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();

// Get the component title div
if (isset($this->getApplication()->JComponentTitle)) {
$data['title'] = $this->getApplication()->JComponentTitle;
}

return $data;
}
}
1 change: 1 addition & 0 deletions installation/sql/mysql/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`,
(0, 'plg_schemaorg_organization', 'plugin', 'organization', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 6, 0),
(0, 'plg_schemaorg_person', 'plugin', 'person', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 7, 0),
(0, 'plg_schemaorg_recipe', 'plugin', 'recipe', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 8, 0),
(0, 'plg_schemaorg_custom', 'plugin', 'custom', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 9, 0),
(0, 'plg_system_accessibility', 'plugin', 'accessibility', 'system', 0, 0, 1, 0, 1, '', '{}', '', 1, 0),
(0, 'plg_system_actionlogs', 'plugin', 'actionlogs', 'system', 0, 1, 1, 0, 1, '', '{}', '', 2, 0),
(0, 'plg_system_cache', 'plugin', 'cache', 'system', 0, 0, 1, 0, 1, '', '{"browsercache":"0","cachetime":"15"}', '', 3, 0),
Expand Down
1 change: 1 addition & 0 deletions installation/sql/postgresql/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder",
(0, 'plg_schemaorg_organization', 'plugin', 'organization', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 6, 0),
(0, 'plg_schemaorg_person', 'plugin', 'person', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 7, 0),
(0, 'plg_schemaorg_recipe', 'plugin', 'recipe', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 8, 0),
(0, 'plg_schemaorg_custom', 'plugin', 'custom', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 9, 0),
(0, 'plg_system_accessibility', 'plugin', 'accessibility', 'system', 0, 0, 1, 0, 1, '', '{}', '', 1, 0),
(0, 'plg_system_actionlogs', 'plugin', 'actionlogs', 'system', 0, 1, 1, 0, 1, '', '{}', '', 2, 0),
(0, 'plg_system_cache', 'plugin', 'cache', 'system', 0, 0, 1, 0, 1, '', '{"browsercache":"0","cachetime":"15"}', '', 3, 0),
Expand Down
24 changes: 24 additions & 0 deletions libraries/src/Event/Router/AfterInitialiseRouterEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/**
* Joomla! Content Management System
*
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\CMS\Event\Router;

// phpcs:disable PSR1.Files.SideEffects

\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* Event class for AfterInitialiseRouter event
*
* @since __DEPLOY_VERSION__
*/
class AfterInitialiseRouterEvent extends RouterEvent
{
}
70 changes: 70 additions & 0 deletions libraries/src/Event/Router/RouterEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

/**
* Joomla! Content Management System
*
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\CMS\Event\Router;

use Joomla\CMS\Event\AbstractImmutableEvent;
use Joomla\CMS\Router\Router;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* Class for Application's Router events
*
* @since __DEPLOY_VERSION__
*/
abstract class RouterEvent extends AbstractImmutableEvent
{
/**
* Constructor.
*
* @param string $name The event name.
* @param array $arguments The event arguments.
*
* @throws \BadMethodCallException
*
* @since __DEPLOY_VERSION__
*/
public function __construct($name, array $arguments = [])
{
if (!\array_key_exists('router', $arguments)) {
throw new \BadMethodCallException("Argument 'router' of event {$name} is required but has not been provided");
}

parent::__construct($name, $arguments);
}

/**
* Setter for the router argument.
*
* @param Router $value The value to set
*
* @return Router
*
* @since __DEPLOY_VERSION__
*/
protected function onSetRouter(Router $value): Router
{
return $value;
}

/**
* Get the event's router object
*
* @return Router
*
* @since __DEPLOY_VERSION__
*/
public function getRouter(): Router
{
return $this->arguments['router'];
}
}
1 change: 1 addition & 0 deletions libraries/src/Extension/ExtensionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ class ExtensionHelper
['plugin', 'article', 'schemaorg', 0],
['plugin', 'blogposting', 'schemaorg', 0],
['plugin', 'book', 'schemaorg', 0],
['plugin', 'custom', 'schemaorg', 0],
['plugin', 'event', 'schemaorg', 0],
['plugin', 'jobposting', 'schemaorg', 0],
['plugin', 'organization', 'schemaorg', 0],
Expand Down
9 changes: 8 additions & 1 deletion libraries/src/Service/Provider/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@

use Joomla\CMS\Application\ApiApplication;
use Joomla\CMS\Application\SiteApplication;
use Joomla\CMS\Event\Router\AfterInitialiseRouterEvent;
use Joomla\CMS\Router\AdministratorRouter;
use Joomla\CMS\Router\ApiRouter;
use Joomla\CMS\Router\SiteRouter;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
Expand Down Expand Up @@ -44,7 +46,12 @@ public function register(Container $container)
->share(
SiteRouter::class,
function (Container $container) {
return new SiteRouter($container->get(SiteApplication::class));
$router = new SiteRouter($container->get(SiteApplication::class));
$container->get(DispatcherInterface::class)->dispatch(
'onAfterInitialiseRouter',
new AfterInitialiseRouterEvent('onAfterInitialiseRouter', ['router' => $router])
);
return $router;
},
true
);
Expand Down
20 changes: 0 additions & 20 deletions modules/mod_stats/mod_stats.php

This file was deleted.

2 changes: 1 addition & 1 deletion modules/mod_stats/mod_stats.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<description>MOD_STATS_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Module\Stats</namespace>
<files>
<filename module="mod_stats">mod_stats.php</filename>
<folder module="mod_stats">services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
Expand Down
41 changes: 41 additions & 0 deletions modules/mod_stats/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_stats
*
* @copyright (C) 2024 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\Service\Provider\HelperFactory;
use Joomla\CMS\Extension\Service\Provider\Module;
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;

/**
* The statistics module service provider.
*
* @since __DEPLOY_VERSION__
*/
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function register(Container $container)
{
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Stats'));
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Stats\\Site\\Helper'));

$container->registerServiceProvider(new Module());
}
};

0 comments on commit f6e4f6c

Please sign in to comment.