-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjea.php
67 lines (58 loc) · 1.53 KB
/
jea.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* @package Joomla.Plugin
* @subpackage System.Jea
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Event\SubscriberInterface;
use Joomla\Application\ApplicationEvents;
use Joomla\CMS\Console\Loader\WritableLoaderInterface;
use Joomla\Plugin\System\Jea\Console\GatewaysExportCommand;
use Joomla\Plugin\System\Jea\Console\GatewaysImportCommand;
defined('_JEXEC') or die;
/**
* Joomla! Jea plugin.
*
*/
class PlgSystemJea extends CMSPlugin implements SubscriberInterface
{
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 4.1.3
*/
public static function getSubscribedEvents(): array
{
return [
ApplicationEvents::BEFORE_EXECUTE => 'registerCommands',
];
}
public function registerCommands(): void
{
$container = Factory::getContainer();
$writableLoader = $container->get(WritableLoaderInterface::class);
assert($writableLoader instanceof WritableLoaderInterface);
$container->share(
GatewaysExportCommand::class,
function () {
return new GatewaysExportCommand();
},
true,
);
$container->share(
GatewaysImportCommand::class,
function () {
return new GatewaysImportCommand();
},
true,
);
$writableLoader->add('jea:gateways:export', GatewaysExportCommand::class);
$writableLoader->add('jea:gateways:import', GatewaysImportCommand::class);
}
}