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="webservices" method="upgrade">
<name>plg_webservices_banners</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_BANNERS_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Banners</namespace>
<files>
<folder plugin="banners">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_banners.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_banners.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.banners
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Banners\Extension\Banners;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Banners(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'banners')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,86 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.banners
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Banners\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
use Joomla\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_banners.
*
* @since 4.0.0
*/
final class Banners extends CMSPlugin
{
/**
* Registers com_banners's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$router->createCRUDRoutes(
'v1/banners',
'banners',
['component' => 'com_banners']
);
$router->createCRUDRoutes(
'v1/banners/clients',
'clients',
['component' => 'com_banners']
);
$router->createCRUDRoutes(
'v1/banners/categories',
'categories',
['component' => 'com_categories', 'extension' => 'com_banners']
);
$this->createContentHistoryRoutes($router);
}
/**
* Create contenthistory routes
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
private function createContentHistoryRoutes(&$router)
{
$defaults = [
'component' => 'com_contenthistory',
'type_alias' => 'com_banners.banner',
'type_id' => 9,
];
$getDefaults = array_merge(['public' => false], $defaults);
$routes = [
new Route(['GET'], 'v1/banners/:id/contenthistory', 'history.displayList', ['id' => '(\d+)'], $getDefaults),
new Route(['PATCH'], 'v1/banners/:id/contenthistory/keep', 'history.keep', ['id' => '(\d+)'], $defaults),
new Route(['DELETE'], 'v1/banners/:id/contenthistory', 'history.delete', ['id' => '(\d+)'], $defaults),
];
$router->addRoutes($routes);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_config</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_CONFIG_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Config</namespace>
<files>
<folder plugin="config">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_config.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_config.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.config
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Config\Extension\Config;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Config(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'config')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,51 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.config
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Config\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
use Joomla\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_config.
*
* @since 4.0.0
*/
final class Config extends CMSPlugin
{
/**
* Registers com_config's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$defaults = ['component' => 'com_config'];
$getDefaults = array_merge(['public' => false], $defaults);
$routes = [
new Route(['GET'], 'v1/config/application', 'application.displayList', [], $getDefaults),
new Route(['PATCH'], 'v1/config/application', 'application.edit', [], $defaults),
new Route(['GET'], 'v1/config/:component_name', 'component.displayList', ['component_name' => '([A-Za-z_]+)'], $getDefaults),
new Route(['PATCH'], 'v1/config/:component_name', 'component.edit', ['component_name' => '([A-Za-z_]+)'], $defaults),
];
$router->addRoutes($routes);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_contact</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_CONTACT_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Contact</namespace>
<files>
<folder plugin="contact">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_contact.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_contact.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.contact
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Contact\Extension\Contact;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Contact(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'contact')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,140 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.contact
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Contact\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
use Joomla\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_contact.
*
* @since 4.0.0
*/
final class Contact extends CMSPlugin
{
/**
* Registers com_contact's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$route = new Route(
['POST'],
'v1/contacts/form/:id',
'contact.submitForm',
['id' => '(\d+)'],
['component' => 'com_contact']
);
$router->addRoute($route);
$router->createCRUDRoutes(
'v1/contacts',
'contact',
['component' => 'com_contact']
);
$router->createCRUDRoutes(
'v1/contacts/categories',
'categories',
['component' => 'com_categories', 'extension' => 'com_contact']
);
$this->createFieldsRoutes($router);
$this->createContentHistoryRoutes($router);
}
/**
* Create fields routes
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
private function createFieldsRoutes(&$router)
{
$router->createCRUDRoutes(
'v1/fields/contacts/contact',
'fields',
['component' => 'com_fields', 'context' => 'com_contact.contact']
);
$router->createCRUDRoutes(
'v1/fields/contacts/mail',
'fields',
['component' => 'com_fields', 'context' => 'com_contact.mail']
);
$router->createCRUDRoutes(
'v1/fields/contacts/categories',
'fields',
['component' => 'com_fields', 'context' => 'com_contact.categories']
);
$router->createCRUDRoutes(
'v1/fields/groups/contacts/contact',
'groups',
['component' => 'com_fields', 'context' => 'com_contact.contact']
);
$router->createCRUDRoutes(
'v1/fields/groups/contacts/mail',
'groups',
['component' => 'com_fields', 'context' => 'com_contact.mail']
);
$router->createCRUDRoutes(
'v1/fields/groups/contacts/categories',
'groups',
['component' => 'com_fields', 'context' => 'com_contact.categories']
);
}
/**
* Create contenthistory routes
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
private function createContentHistoryRoutes(&$router)
{
$defaults = [
'component' => 'com_contenthistory',
'type_alias' => 'com_contact.contact',
'type_id' => 2,
];
$getDefaults = array_merge(['public' => false], $defaults);
$routes = [
new Route(['GET'], 'v1/contacts/:id/contenthistory', 'history.displayList', ['id' => '(\d+)'], $getDefaults),
new Route(['PATCH'], 'v1/contacts/:id/contenthistory/keep', 'history.keep', ['id' => '(\d+)'], $defaults),
new Route(['DELETE'], 'v1/contacts/:id/contenthistory', 'history.delete', ['id' => '(\d+)'], $defaults),
];
$router->addRoutes($routes);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_content</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_CONTENT_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Content</namespace>
<files>
<folder plugin="content">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_content.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_content.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.content
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Content\Extension\Content;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Content(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'content')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,118 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.content
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Content\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
use Joomla\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_content.
*
* @since 4.0.0
*/
final class Content extends CMSPlugin
{
/**
* Registers com_content's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$router->createCRUDRoutes(
'v1/content/articles',
'articles',
['component' => 'com_content']
);
$router->createCRUDRoutes(
'v1/content/categories',
'categories',
['component' => 'com_categories', 'extension' => 'com_content']
);
$this->createFieldsRoutes($router);
$this->createContentHistoryRoutes($router);
}
/**
* Create fields routes
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
private function createFieldsRoutes(&$router)
{
$router->createCRUDRoutes(
'v1/fields/content/articles',
'fields',
['component' => 'com_fields', 'context' => 'com_content.article']
);
$router->createCRUDRoutes(
'v1/fields/content/categories',
'fields',
['component' => 'com_fields', 'context' => 'com_content.categories']
);
$router->createCRUDRoutes(
'v1/fields/groups/content/articles',
'groups',
['component' => 'com_fields', 'context' => 'com_content.article']
);
$router->createCRUDRoutes(
'v1/fields/groups/content/categories',
'groups',
['component' => 'com_fields', 'context' => 'com_content.categories']
);
}
/**
* Create contenthistory routes
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
private function createContentHistoryRoutes(&$router)
{
$defaults = [
'component' => 'com_contenthistory',
'type_alias' => 'com_content.article',
'type_id' => 1,
];
$getDefaults = array_merge(['public' => false], $defaults);
$routes = [
new Route(['GET'], 'v1/content/articles/:id/contenthistory', 'history.displayList', ['id' => '(\d+)'], $getDefaults),
new Route(['PATCH'], 'v1/content/articles/:id/contenthistory/keep', 'history.keep', ['id' => '(\d+)'], $defaults),
new Route(['DELETE'], 'v1/content/articles/:id/contenthistory', 'history.delete', ['id' => '(\d+)'], $defaults),
];
$router->addRoutes($routes);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_installer</name>
<author>Joomla! Project</author>
<creationDate>2020-06</creationDate>
<copyright>(C) 2020 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_WEBSERVICES_INSTALLER_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Installer</namespace>
<files>
<folder plugin="installer">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_installer.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_installer.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.installer
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Installer\Extension\Installer;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Installer(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'installer')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.installer
*
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Installer\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
use Joomla\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_installer.
*
* @since 4.0.0
*/
final class Installer extends CMSPlugin
{
/**
* Registers com_installer's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$defaults = ['component' => 'com_installer', 'public' => false];
$routes = [
new Route(['GET'], 'v1/extensions', 'manage.displayList', [], $defaults),
];
$router->addRoutes($routes);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_languages</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_LANGUAGES_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Languages</namespace>
<files>
<folder plugin="languages">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_languages.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_languages.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.languages
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Languages\Extension\Languages;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Languages(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'languages')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,127 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.languages
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Languages\Extension;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
use Joomla\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_languages.
*
* @since 4.0.0
*/
final class Languages extends CMSPlugin
{
/**
* Registers com_languages's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$router->createCRUDRoutes(
'v1/languages/content',
'languages',
['component' => 'com_languages']
);
$this->createLanguageOverridesRoutes($router);
$this->createLanguageInstallerRoutes($router);
}
/**
* Create language overrides routes
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
private function createLanguageOverridesRoutes(&$router)
{
$defaults = ['component' => 'com_languages'];
$routes = [
new Route(['POST'], 'v1/languages/overrides/search', 'strings.search', [], $defaults),
new Route(['POST'], 'v1/languages/overrides/search/cache/refresh', 'strings.refresh', [], $defaults),
];
$router->addRoutes($routes);
/** @var \Joomla\Component\Languages\Administrator\Model\LanguagesModel $model */
$model = Factory::getApplication()->bootComponent('com_languages')
->getMVCFactory()->createModel('Languages', 'Administrator', ['ignore_request' => true]);
foreach ($model->getItems() as $item) {
$baseName = 'v1/languages/overrides/site/' . $item->lang_code;
$controller = 'overrides';
$overridesDefaults = array_merge($defaults, ['lang_code' => $item->lang_code, 'app' => 'site']);
$getDefaults = array_merge(['public' => false], $overridesDefaults);
$routes = [
new Route(['GET'], $baseName, $controller . '.displayList', [], $getDefaults),
new Route(['GET'], $baseName . '/:id', $controller . '.displayItem', ['id' => '([A-Z0-9_]+)'], $getDefaults),
new Route(['POST'], $baseName, $controller . '.add', [], $overridesDefaults),
new Route(['PATCH'], $baseName . '/:id', $controller . '.edit', ['id' => '([A-Z0-9_]+)'], $overridesDefaults),
new Route(['DELETE'], $baseName . '/:id', $controller . '.delete', ['id' => '([A-Z0-9_]+)'], $overridesDefaults),
];
$router->addRoutes($routes);
$baseName = 'v1/languages/overrides/administrator/' . $item->lang_code;
$overridesDefaults = array_merge($defaults, ['lang_code' => $item->lang_code, 'app' => 'administrator']);
$getDefaults = array_merge(['public' => false], $overridesDefaults);
$routes = [
new Route(['GET'], $baseName, $controller . '.displayList', [], $getDefaults),
new Route(['GET'], $baseName . '/:id', $controller . '.displayItem', ['id' => '([A-Z0-9_]+)'], $getDefaults),
new Route(['POST'], $baseName, $controller . '.add', [], $overridesDefaults),
new Route(['PATCH'], $baseName . '/:id', $controller . '.edit', ['id' => '([A-Z0-9_]+)'], $overridesDefaults),
new Route(['DELETE'], $baseName . '/:id', $controller . '.delete', ['id' => '([A-Z0-9_]+)'], $overridesDefaults),
];
$router->addRoutes($routes);
}
}
/**
* Create language installer routes
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
private function createLanguageInstallerRoutes(&$router)
{
$defaults = ['component' => 'com_installer'];
$getDefaults = array_merge(['public' => false], $defaults);
$routes = [
new Route(['GET'], 'v1/languages', 'languages.displayList', [], $getDefaults),
new Route(['POST'], 'v1/languages', 'languages.install', [], $defaults),
];
$router->addRoutes($routes);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_media</name>
<author>Joomla! Project</author>
<creationDate>2021-05</creationDate>
<copyright>(C) 2021 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.1.0</version>
<description>PLG_WEBSERVICES_MEDIA_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Media</namespace>
<files>
<folder plugin="media">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_media.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_media.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.media
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Media\Extension\Media;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Media(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'media')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,107 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.media
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Media\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
use Joomla\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_media.
*
* @since 4.1.0
*/
final class Media extends CMSPlugin
{
/**
* Registers com_media's API's routes in the application.
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.1.0
*/
public function onBeforeApiRoute(&$router): void
{
$this->createAdapterReadRoutes(
$router,
'v1/media/adapters',
'adapters',
['component' => 'com_media']
);
$this->createMediaCRUDRoutes(
$router,
'v1/media/files',
'media',
['component' => 'com_media']
);
}
/**
* Creates adapter read routes.
*
* @param ApiRouter &$router The API Routing object
* @param string $baseName The base name of the component.
* @param string $controller The name of the controller that contains CRUD functions.
* @param array $defaults An array of default values that are used when the URL is matched.
* @param bool $publicGets Allow the public to make GET requests.
*
* @return void
*
* @since 4.1.0
*/
private function createAdapterReadRoutes(&$router, $baseName, $controller, $defaults = [], $publicGets = false): void
{
$getDefaults = array_merge(['public' => $publicGets], $defaults);
$routes = [
new Route(['GET'], $baseName, $controller . '.displayList', [], $getDefaults),
new Route(['GET'], $baseName . '/:id', $controller . '.displayItem', [], $getDefaults),
];
$router->addRoutes($routes);
}
/**
* Creates media CRUD routes.
*
* @param ApiRouter &$router The API Routing object
* @param string $baseName The base name of the component.
* @param string $controller The name of the controller that contains CRUD functions.
* @param array $defaults An array of default values that are used when the URL is matched.
* @param bool $publicGets Allow the public to make GET requests.
*
* @return void
*
* @since 4.1.0
*/
private function createMediaCRUDRoutes(&$router, $baseName, $controller, $defaults = [], $publicGets = false): void
{
$getDefaults = array_merge(['public' => $publicGets], $defaults);
$routes = [
new Route(['GET'], $baseName, $controller . '.displayList', [], $getDefaults),
// When the path ends with a backslash, then list the items
new Route(['GET'], $baseName . '/:path/', $controller . '.displayList', ['path' => '.*\/'], $getDefaults),
new Route(['GET'], $baseName . '/:path', $controller . '.displayItem', ['path' => '.*'], $getDefaults),
new Route(['POST'], $baseName, $controller . '.add', [], $defaults),
new Route(['PATCH'], $baseName . '/:path', $controller . '.edit', ['path' => '.*'], $defaults),
new Route(['DELETE'], $baseName . '/:path', $controller . '.delete', ['path' => '.*'], $defaults),
];
$router->addRoutes($routes);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_menus</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_MENUS_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Menus</namespace>
<files>
<folder plugin="menus">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_menus.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_menus.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.menus
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Menus\Extension\Menus;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Menus(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'menus')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,82 @@
<?php
/**
* @package Joomla.Menus
* @subpackage Webservices.menus
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Menus\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
use Joomla\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_menus.
*
* @since 4.0.0
*/
final class Menus extends CMSPlugin
{
/**
* Registers com_menus's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$router->createCRUDRoutes(
'v1/menus/site',
'menus',
['component' => 'com_menus', 'client_id' => 0]
);
$router->createCRUDRoutes(
'v1/menus/administrator',
'menus',
['component' => 'com_menus', 'client_id' => 1]
);
$router->createCRUDRoutes(
'v1/menus/site/items',
'items',
['component' => 'com_menus', 'client_id' => 0]
);
$router->createCRUDRoutes(
'v1/menus/administrator/items',
'items',
['component' => 'com_menus', 'client_id' => 1]
);
$routes = [
new Route(
['GET'],
'v1/menus/site/items/types',
'items.getTypes',
[],
['public' => false, 'component' => 'com_menus', 'client_id' => 0]
),
new Route(
['GET'],
'v1/menus/administrator/items/types',
'items.getTypes',
[],
['public' => false, 'component' => 'com_menus', 'client_id' => 1]
),
];
$router->addRoutes($routes);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_messages</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_MESSAGES_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Messages</namespace>
<files>
<folder plugin="messages">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_messages.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_messages.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.messages
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Messages\Extension\Messages;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Messages(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'messages')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,44 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.messages
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Messages\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_messages.
*
* @since 4.0.0
*/
final class Messages extends CMSPlugin
{
/**
* Registers com_messages's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$router->createCRUDRoutes(
'v1/messages',
'messages',
['component' => 'com_messages']
);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_modules</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_MODULES_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Modules</namespace>
<files>
<folder plugin="modules">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_modules.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_modules.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.modules
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Modules\Extension\Modules;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Modules(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'modules')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,70 @@
<?php
/**
* @package Joomla.Modules
* @subpackage Webservices.modules
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Modules\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
use Joomla\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_modules.
*
* @since 4.0.0
*/
final class Modules extends CMSPlugin
{
/**
* Registers com_modules's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$routes = [
new Route(
['GET'],
'v1/modules/types/site',
'modules.getTypes',
[],
['public' => false, 'component' => 'com_modules', 'client_id' => 0]
),
new Route(
['GET'],
'v1/modules/types/administrator',
'modules.getTypes',
[],
['public' => false, 'component' => 'com_modules', 'client_id' => 1]
),
];
$router->addRoutes($routes);
$router->createCRUDRoutes(
'v1/modules/site',
'modules',
['component' => 'com_modules', 'client_id' => 0]
);
$router->createCRUDRoutes(
'v1/modules/administrator',
'modules',
['component' => 'com_modules', 'client_id' => 1]
);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_newsfeeds</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_NEWSFEEDS_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Newsfeeds</namespace>
<files>
<folder plugin="newsfeeds">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_newsfeeds.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_newsfeeds.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.newsfeeds
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Newsfeeds\Extension\Newsfeeds;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Newsfeeds(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'newsfeeds')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,50 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.newsfeeds
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Newsfeeds\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_newsfeeds.
*
* @since 4.0.0
*/
final class Newsfeeds extends CMSPlugin
{
/**
* Registers com_newsfeeds's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$router->createCRUDRoutes(
'v1/newsfeeds/feeds',
'feeds',
['component' => 'com_newsfeeds']
);
$router->createCRUDRoutes(
'v1/newsfeeds/categories',
'categories',
['component' => 'com_categories', 'extension' => 'com_newsfeeds']
);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_plugins</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_PLUGINS_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Plugins</namespace>
<files>
<folder plugin="plugins">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_plugins.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_plugins.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.plugins
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Plugins\Extension\Plugins;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Plugins(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'plugins')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,50 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.plugins
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Plugins\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
use Joomla\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_plugins.
*
* @since 4.0.0
*/
final class Plugins extends CMSPlugin
{
/**
* Registers com_plugins's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$defaults = ['component' => 'com_plugins'];
$getDefaults = array_merge(['public' => false], $defaults);
$routes = [
new Route(['GET'], 'v1/plugins', 'plugins.displayList', [], $getDefaults),
new Route(['GET'], 'v1/plugins/:id', 'plugins.displayItem', ['id' => '(\d+)'], $getDefaults),
new Route(['PATCH'], 'v1/plugins/:id', 'plugins.edit', ['id' => '(\d+)'], $defaults),
];
$router->addRoutes($routes);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_privacy</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_PRIVACY_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Privacy</namespace>
<files>
<folder plugin="privacy">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_privacy.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_privacy.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.privacy
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Privacy\Extension\Privacy;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Privacy(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'privacy')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,58 @@
<?php
/**
* @package Joomla.Privacy
* @subpackage Webservices.privacy
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Privacy\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
use Joomla\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_privacy.
*
* @since 4.0.0
*/
final class Privacy extends CMSPlugin
{
/**
* Registers com_privacy's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$defaults = ['component' => 'com_privacy'];
$getDefaults = array_merge(['public' => false], $defaults);
$routes = [
new Route(['GET'], 'v1/privacy/requests', 'requests.displayList', [], $getDefaults),
new Route(['GET'], 'v1/privacy/requests/:id', 'requests.displayItem', ['id' => '(\d+)'], $getDefaults),
new Route(['GET'], 'v1/privacy/requests/export/:id', 'requests.export', ['id' => '(\d+)'], $getDefaults),
new Route(['POST'], 'v1/privacy/requests', 'requests.add', [], $defaults),
];
$router->addRoutes($routes);
$routes = [
new Route(['GET'], 'v1/privacy/consents', 'consents.displayList', [], $getDefaults),
new Route(['GET'], 'v1/privacy/consents/:id', 'consents.displayItem', ['id' => '(\d+)'], $getDefaults),
];
$router->addRoutes($routes);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_redirect</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_REDIRECT_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Redirect</namespace>
<files>
<folder plugin="redirect">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_redirect.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_redirect.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.redirect
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Redirect\Extension\Redirect;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Redirect(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'redirect')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,44 @@
<?php
/**
* @package Joomla.Redirect
* @subpackage Webservices.redirect
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Redirect\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_redirect.
*
* @since 4.0.0
*/
final class Redirect extends CMSPlugin
{
/**
* Registers com_redirect's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$router->createCRUDRoutes(
'v1/redirects',
'redirect',
['component' => 'com_redirect']
);
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.tags
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Tags\Extension\Tags;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Tags(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'tags')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,44 @@
<?php
/**
* @package Joomla.Tags
* @subpackage Webservices.tags
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Tags\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_tags.
*
* @since 4.0.0
*/
final class Tags extends CMSPlugin
{
/**
* Registers com_tags's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$router->createCRUDRoutes(
'v1/tags',
'tags',
['component' => 'com_tags']
);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_tags</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_TAGS_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Tags</namespace>
<files>
<folder plugin="tags">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_tags.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_tags.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.templates
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Templates\Extension\Templates;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Templates(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'templates')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,50 @@
<?php
/**
* @package Joomla.Templates
* @subpackage Webservices.templates
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Templates\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_templates.
*
* @since 4.0.0
*/
final class Templates extends CMSPlugin
{
/**
* Registers com_templates's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$router->createCRUDRoutes(
'v1/templates/styles/site',
'styles',
['component' => 'com_templates', 'client_id' => 0]
);
$router->createCRUDRoutes(
'v1/templates/styles/administrator',
'styles',
['component' => 'com_templates', 'client_id' => 1]
);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_templates</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_TEMPLATES_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Templates</namespace>
<files>
<folder plugin="templates">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_templates.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_templates.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.users
*
* @copyright (C) 2023 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\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\WebServices\Users\Extension\Users;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Users(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('webservices', 'users')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,82 @@
<?php
/**
* @package Joomla.Users
* @subpackage Webservices.users
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Users\Extension;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\ApiRouter;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_users.
*
* @since 4.0.0
*/
final class Users extends CMSPlugin
{
/**
* Registers com_users's API's routes in the application
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
public function onBeforeApiRoute(&$router)
{
$router->createCRUDRoutes(
'v1/users',
'users',
['component' => 'com_users']
);
$this->createFieldsRoutes($router);
$router->createCRUDRoutes(
'v1/users/groups',
'groups',
['component' => 'com_users']
);
$router->createCRUDRoutes(
'v1/users/levels',
'levels',
['component' => 'com_users']
);
}
/**
* Create fields routes
*
* @param ApiRouter &$router The API Routing object
*
* @return void
*
* @since 4.0.0
*/
private function createFieldsRoutes(&$router)
{
$router->createCRUDRoutes(
'v1/fields/users',
'fields',
['component' => 'com_fields', 'context' => 'com_users.user']
);
$router->createCRUDRoutes(
'v1/fields/groups/users',
'groups',
['component' => 'com_fields', 'context' => 'com_users.user']
);
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_users</name>
<author>Joomla! Project</author>
<creationDate>2019-09</creationDate>
<copyright>(C) 2019 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_WEBSERVICES_USERS_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Users</namespace>
<files>
<folder plugin="users">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_users.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_users.sys.ini</language>
</languages>
</extension>