<?php
/**
* Shopware 5
* Copyright (c) shopware AG
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
* permission and of our proprietary license can be found at and
* in the LICENSE file you have received along with this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* "Shopware" is a registered trademark of shopware AG.
* The licensing of the program under the AGPLv3 does not imply a
* trademark license. Therefore any rights, title and interest in
* our trademarks remain entirely with us.
*/
namespace Shopware\Components;
use Shopware\Components\Console\Application;
use Shopware\Components\Plugin\Context\ActivateContext;
use Shopware\Components\Plugin\Context\DeactivateContext;
use Shopware\Components\Plugin\Context\InstallContext;
use Shopware\Components\Plugin\Context\UninstallContext;
use Shopware\Components\Plugin\Context\UpdateContext;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Enlight\Event\SubscriberInterface;
abstract class Plugin implements ContainerAwareInterface, SubscriberInterface
{
/**
* @var ContainerInterface
*/
protected $container;
/**
* @var string
*/
private $name;
/**
* @var string
*/
private $path;
/**
* @var bool
*/
private $isActive;
/**
* @inheritdoc
*/
public static function getSubscribedEvents()
{
return [];
}
/**
* @param bool $isActive
*/
final public function __construct($isActive)
{
$this->isActive = (bool)$isActive;
}
/**
* @return bool
*/
final public function isActive()
{
return $this->isActive;
}
/**
* Registers Commands.
*
* @param Application $application An Application instance
*/
public function registerCommands(Application $application)
{
}
/**
* This method can be overridden
* @param InstallContext $context
*/
public function install(InstallContext $context)
{
}
/**
* This method can be overridden
* @param UpdateContext $context
*/
public function update(UpdateContext $context)
{
$context->scheduleClearCache(InstallContext::CACHE_LIST_DEFAULT);
}
/**
* This method can be overridden
* @param ActivateContext $context
*/
public function activate(ActivateContext $context)
{
$context->scheduleClearCache(InstallContext::CACHE_LIST_DEFAULT);
}
/**
* This method can be overridden
* @param DeactivateContext $context
*/
public function deactivate(DeactivateContext $context)
{
$context->scheduleClearCache(InstallContext::CACHE_LIST_DEFAULT);
}
/**
* This method can be overridden
* @param UninstallContext $context
*/
public function uninstall(UninstallContext $context)
{
$context->scheduleClearCache(InstallContext::CACHE_LIST_DEFAULT);
}
/**
* Builds the Plugin.
*
* It is only ever called once when the cache is empty.
*
* This method can be overridden to register compilation passes,
* other extensions, ...
*
* @param ContainerBuilder $container A ContainerBuilder instance
*/
public function build(ContainerBuilder $container)
{
$this->loadFiles($container);
}
/**
* @param ContainerBuilder $container
*/
final protected function loadFiles(ContainerBuilder $container)
{
if (!is_file($this->getPath().'/Resources/services.xml')) {
return;
}
$loader = new XmlFileLoader(
$container,
new FileLocator()
);
$loader->load($this->getPath().'/Resources/services.xml');
}
/**
* Sets the container.
*
* @param ContainerInterface|null $container A ContainerInterface instance or null
*/
final public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
/**
* Returns the Plugin name (the class short name).
*
* @return string The Plugin name
*/
final public function getName()
{
if (null !== $this->name) {
return $this->name;
}
$name = get_class($this);
$pos = strrpos($name, '\\');
return $this->name = false === $pos ? $name : substr($name, $pos + 1);
}
/**
* Gets the Plugin directory path.
*
* @return string The Plugin absolute path
*/
final public function getPath()
{
if (null === $this->path) {
$reflected = new \ReflectionObject($this);
$this->path = dirname($reflected->getFileName());
}
return $this->path;
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| Api/ | 2016-11-07 16:02 | 287.29 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Auth/ | 2016-11-07 16:02 | 9.48 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Benchmark/ | 2016-11-07 15:59 | 2.97 KB | 76129f60960:kunden | dxwrx-rx-r | |
| CategoryHandling/ | 2016-11-07 15:59 | 6.7 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Check/ | 2016-11-07 16:02 | 137.23 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Compatibility/ | 2016-11-07 15:59 | 40.29 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Console/ | 2016-11-07 15:59 | 9.29 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Convert/ | 2016-11-07 15:59 | 21.31 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Cron/ | 2016-11-07 15:59 | 1.8 KB | 76129f60960:kunden | dxwrx-rx-r | |
| DependencyInjection/ | 2016-11-07 16:02 | 89.93 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Emotion/ | 2016-11-07 15:59 | 6.4 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Escaper/ | 2016-11-07 15:59 | 5.38 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Form/ | 2016-11-07 16:02 | 45.21 KB | 76129f60960:kunden | dxwrx-rx-r | |
| HttpCache/ | 2016-11-07 15:59 | 27.91 KB | 76129f60960:kunden | dxwrx-rx-r | |
| HttpClient/ | 2016-11-07 15:59 | 261.1 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Install/ | 2016-11-07 15:59 | 3.59 KB | 76129f60960:kunden | dxwrx-rx-r | |
| LegacyRequestWrapper/ | 2016-11-07 15:59 | 9.77 KB | 76129f60960:kunden | dxwrx-rx-r | |
| License/ | 2016-11-07 16:02 | 18.86 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Log/ | 2016-11-07 16:02 | 33.09 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Migrations/ | 2016-11-07 15:59 | 10.92 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Model/ | 2016-11-07 16:04 | 141.64 KB | 76129f60960:kunden | dxwrx-rx-r | |
| MultiEdit/ | 2016-11-07 16:02 | 98 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Password/ | 2016-11-07 16:02 | 18.5 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Plugin/ | 2016-11-07 16:02 | 119.2 KB | 76129f60960:kunden | dxwrx-rx-r | |
| ProductStream/ | 2016-11-07 15:59 | 19.08 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Routing/ | 2016-11-07 16:02 | 58.6 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Snippet/ | 2016-11-07 16:02 | 38.98 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Test/ | 2016-11-07 16:02 | 4.02 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Theme/ | 2016-11-07 16:02 | 130.93 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Thumbnail/ | 2016-11-07 16:02 | 21.71 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Validator/ | 2016-11-07 15:59 | 3.01 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Acl.php | 2016-11-07 15:58 | 6.65 KB | 76129f60960:kunden | -xw-x----- | |
| AttributeSubscriber.php | 2016-11-07 15:58 | 4.73 KB | 76129f60960:kunden | -xw-x----- | |
| Auth.php | 2016-11-07 15:58 | 5.26 KB | 76129f60960:kunden | -xw-x----- | |
| CSRFTokenValidationException.php | 2016-11-07 15:58 | 1.08 KB | 76129f60960:kunden | -xw-x----- | |
| CSRFTokenValidator.php | 2016-11-07 15:58 | 5.52 KB | 76129f60960:kunden | -xw-x----- | |
| CSRFWhitelistAware.php | 2016-11-07 15:58 | 1.23 KB | 76129f60960:kunden | -xw-x----- | |
| CacheManager.php | 2016-11-07 15:58 | 12.56 KB | 76129f60960:kunden | -xw-x----- | |
| Config.php | 2016-11-07 15:58 | 7.9 KB | 76129f60960:kunden | -xw-x----- | |
| ConfigLoader.php | 2016-11-07 15:58 | 5.01 KB | 76129f60960:kunden | -xw-x----- | |
| ConfigWriter.php | 2016-11-07 15:58 | 4.32 KB | 76129f60960:kunden | -xw-x----- | |
| ContainerAwareEventManager.php | 2016-11-07 15:58 | 6.61 KB | 76129f60960:kunden | -xw-x----- | |
| CsvIterator.php | 2016-11-07 15:58 | 6.91 KB | 76129f60960:kunden | -xw-x----- | |
| Document.php | 2016-11-07 15:58 | 22.91 KB | 76129f60960:kunden | -xw-x----- | |
| Form.php | 2016-11-07 15:58 | 1.43 KB | 76129f60960:kunden | -xw-x----- | |
| HolidayTableUpdater.php | 2016-11-07 15:58 | 4.42 KB | 76129f60960:kunden | -xw-x----- | |
| Licence.php | 2016-11-07 15:58 | 1.25 KB | 76129f60960:kunden | -xw-x----- | |
| LicenseInstaller.php | 2016-11-07 15:58 | 3.04 KB | 76129f60960:kunden | -xw-x----- | |
| Logger.php | 2016-11-07 15:58 | 1.59 KB | 76129f60960:kunden | -xw-x----- | |
| MemoryLimit.php | 2016-11-07 15:58 | 2.04 KB | 76129f60960:kunden | -xw-x----- | |
| Modules.php | 2016-11-07 15:58 | 4.94 KB | 76129f60960:kunden | -xw-x----- | |
| NumberRangeIncrementer.php | 2016-11-07 15:58 | 2.16 KB | 76129f60960:kunden | -xw-x----- | |
| NumberRangeIncrementerInterface.php | 2016-11-07 15:58 | 1.65 KB | 76129f60960:kunden | -xw-x----- | |
| OpenSSLVerifier.php | 2016-11-07 15:58 | 2.82 KB | 76129f60960:kunden | -xw-x----- | |
| Plugin.php | 2016-11-07 15:58 | 5.31 KB | 76129f60960:kunden | -xw-x----- | |
| QueryAliasMapper.php | 2016-11-07 15:58 | 4.62 KB | 76129f60960:kunden | -xw-x----- | |
| Random.php | 2016-11-07 15:58 | 5.7 KB | 76129f60960:kunden | -xw-x----- | |
| ReflectionHelper.php | 2016-11-07 15:58 | 2.11 KB | 76129f60960:kunden | -xw-x----- | |
| SitePageMenu.php | 2016-11-07 15:58 | 5.13 KB | 76129f60960:kunden | -xw-x----- | |
| SitemapXMLRepository.php | 2016-11-07 15:58 | 10.86 KB | 76129f60960:kunden | -xw-x----- | |
| StringCompiler.php | 2016-11-07 15:58 | 4.64 KB | 76129f60960:kunden | -xw-x----- | |
| TemplateMail.php | 2016-11-07 15:58 | 7.54 KB | 76129f60960:kunden | -xw-x----- | |
| Theme.php | 2016-11-07 15:58 | 13.07 KB | 76129f60960:kunden | -xw-x----- | |
| Translation.php | 2016-11-07 15:58 | 16.25 KB | 76129f60960:kunden | -xw-x----- | |