first commit
This commit is contained in:
46
plugins/installer/urlinstaller/services/provider.php
Normal file
46
plugins/installer/urlinstaller/services/provider.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Installer.urlinstaller
|
||||
*
|
||||
* @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\Installer\Url\Extension\UrlInstaller;
|
||||
|
||||
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)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$plugin = new UrlInstaller(
|
||||
$container->get(DispatcherInterface::class),
|
||||
(array) PluginHelper::getPlugin('installer', 'urlinstaller')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Installer.urlinstaller
|
||||
*
|
||||
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\Installer\Url\Extension;
|
||||
|
||||
use Joomla\CMS\Event\Installer\AddInstallationTabEvent;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* UrlFolderInstaller Plugin.
|
||||
*
|
||||
* @since 3.6.0
|
||||
*/
|
||||
final class UrlInstaller extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
/**
|
||||
* Application object.
|
||||
*
|
||||
* @var \Joomla\CMS\Application\CMSApplication
|
||||
* @since 4.0.0
|
||||
* @deprecated 6.0 Is needed for template overrides, use getApplication instead
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* Returns an array of events this subscriber will listen to.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return ['onInstallerAddInstallationTab' => 'onInstallerAddInstallationTab'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Installer add Installation Tab listener.
|
||||
*
|
||||
* @param AddInstallationTabEvent $event The event instance
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.6.0
|
||||
*/
|
||||
public function onInstallerAddInstallationTab(AddInstallationTabEvent $event)
|
||||
{
|
||||
// Load language files
|
||||
$this->loadLanguage();
|
||||
|
||||
$tab = [];
|
||||
$tab['name'] = 'url';
|
||||
$tab['label'] = $this->getApplication()->getLanguage()->_('PLG_INSTALLER_URLINSTALLER_TEXT');
|
||||
|
||||
// Render the input
|
||||
ob_start();
|
||||
include PluginHelper::getLayoutPath('installer', 'urlinstaller');
|
||||
$tab['content'] = ob_get_clean();
|
||||
|
||||
$event->addResult($tab);
|
||||
}
|
||||
}
|
||||
37
plugins/installer/urlinstaller/tmpl/default.php
Normal file
37
plugins/installer/urlinstaller/tmpl/default.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Installer.urlinstaller
|
||||
*
|
||||
* @copyright (C) 2016 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\Language\Text;
|
||||
use Joomla\Plugin\Installer\Url\Extension\UrlInstaller;
|
||||
|
||||
/** @var UrlInstaller $this */
|
||||
|
||||
$this->getApplication()->getDocument()->getWebAssetManager()
|
||||
->registerAndUseScript('plg_installer_urlinstaller.urlinstaller', 'plg_installer_urlinstaller/urlinstaller.js', [], ['defer' => true], ['core']);
|
||||
?>
|
||||
<legend><?php echo Text::_('PLG_INSTALLER_URLINSTALLER_TEXT'); ?></legend>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="install_url" class="control-label">
|
||||
<?php echo Text::_('PLG_INSTALLER_URLINSTALLER_TEXT'); ?>
|
||||
</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="install_url" name="install_url" class="form-control" placeholder="https://">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button type="button" class="btn btn-primary" id="installbutton_url" onclick="Joomla.submitbuttonurl()">
|
||||
<?php echo Text::_('PLG_INSTALLER_URLINSTALLER_BUTTON'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
22
plugins/installer/urlinstaller/urlinstaller.xml
Normal file
22
plugins/installer/urlinstaller/urlinstaller.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="installer">
|
||||
<name>plg_installer_urlinstaller</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2016-05</creationDate>
|
||||
<copyright>(C) 2016 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>3.6.0</version>
|
||||
<description>PLG_INSTALLER_URLINSTALLER_PLUGIN_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Installer\Url</namespace>
|
||||
<files>
|
||||
<folder plugin="urlinstaller">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_installer_urlinstaller.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_installer_urlinstaller.sys.ini</language>
|
||||
</languages>
|
||||
</extension>
|
||||
Reference in New Issue
Block a user