first commit
This commit is contained in:
22
plugins/installer/folderinstaller/folderinstaller.xml
Normal file
22
plugins/installer/folderinstaller/folderinstaller.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="installer">
|
||||
<name>plg_installer_folderinstaller</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_FOLDERINSTALLER_PLUGIN_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Installer\Folder</namespace>
|
||||
<files>
|
||||
<folder plugin="folderinstaller">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_installer_folderinstaller.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_installer_folderinstaller.sys.ini</language>
|
||||
</languages>
|
||||
</extension>
|
||||
46
plugins/installer/folderinstaller/services/provider.php
Normal file
46
plugins/installer/folderinstaller/services/provider.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Installer.folderinstaller
|
||||
*
|
||||
* @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\Folder\Extension\FolderInstaller;
|
||||
|
||||
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 FolderInstaller(
|
||||
$container->get(DispatcherInterface::class),
|
||||
(array) PluginHelper::getPlugin('installer', 'folderinstaller')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Installer.folderinstaller
|
||||
*
|
||||
* @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\Folder\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
|
||||
|
||||
/**
|
||||
* FolderInstaller Plugin.
|
||||
*
|
||||
* @since 3.6.0
|
||||
*/
|
||||
final class FolderInstaller 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'] = 'folder';
|
||||
$tab['label'] = $this->getApplication()->getLanguage()->_('PLG_INSTALLER_FOLDERINSTALLER_TEXT');
|
||||
|
||||
// Render the input
|
||||
ob_start();
|
||||
include PluginHelper::getLayoutPath('installer', 'folderinstaller');
|
||||
$tab['content'] = ob_get_clean();
|
||||
|
||||
$event->addResult($tab);
|
||||
}
|
||||
}
|
||||
46
plugins/installer/folderinstaller/tmpl/default.php
Normal file
46
plugins/installer/folderinstaller/tmpl/default.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Installer.folderinstaller
|
||||
*
|
||||
* @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;
|
||||
|
||||
/** @var PlgInstallerFolderInstaller $this */
|
||||
|
||||
Text::script('PLG_INSTALLER_FOLDERINSTALLER_NO_INSTALL_PATH');
|
||||
|
||||
$this->getApplication()->getDocument()->getWebAssetManager()
|
||||
->registerAndUseScript(
|
||||
'plg_installer_folderinstaller.folderinstaller',
|
||||
'plg_installer_folderinstaller/folderinstaller.js',
|
||||
[],
|
||||
['defer' => true],
|
||||
['core']
|
||||
);
|
||||
|
||||
?>
|
||||
<legend><?php echo Text::_('PLG_INSTALLER_FOLDERINSTALLER_TEXT'); ?></legend>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="install_directory" class="control-label">
|
||||
<?php echo Text::_('PLG_INSTALLER_FOLDERINSTALLER_TEXT'); ?>
|
||||
</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="install_directory" name="install_directory" class="form-control"
|
||||
value="<?php echo $this->getApplication()->getInput()->get('install_directory', $this->getApplication()->get('tmp_path')); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button type="button" class="btn btn-primary" id="installbutton_directory" onclick="Joomla.submitbuttonfolder()">
|
||||
<?php echo Text::_('PLG_INSTALLER_FOLDERINSTALLER_BUTTON'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user