|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / setup / src / Magento / Setup / |
Filename | /home/dev2.destoffenstraat.com/setup/src/Magento/Setup/Module.php |
Size | 3.18 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 28-Jan-2025 06:45 |
Last accessed | 22-Aug-2025 19:42 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Setup;
use Laminas\EventManager\EventInterface;
use Laminas\EventManager\EventManager;
use Laminas\ModuleManager\Feature\BootstrapListenerInterface;
use Laminas\ModuleManager\Feature\ConfigProviderInterface;
use Laminas\Mvc\ModuleRouteListener;
use Laminas\Mvc\MvcEvent;
use Laminas\Stdlib\DispatchableInterface;
use Magento\Framework\App\Response\HeaderProvider\XssProtection;
use Magento\Setup\Mvc\View\Http\InjectTemplateListener;
/**
* Laminas module declaration
*/
class Module implements
BootstrapListenerInterface,
ConfigProviderInterface
{
/**
* @inheritDoc
*/
public function onBootstrap(EventInterface $e)
{
/** @var MvcEvent $e */
/** @var \Laminas\Mvc\Application $application */
$application = $e->getApplication();
/** @var EventManager $events */
$events = $application->getEventManager();
/** @var \Laminas\EventManager\SharedEventManager $sharedEvents */
$sharedEvents = $events->getSharedManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($events);
// Override Laminas\Mvc\View\Http\InjectTemplateListener
// to process templates by Vendor/Module
$injectTemplateListener = new InjectTemplateListener();
$sharedEvents->attach(
DispatchableInterface::class,
MvcEvent::EVENT_DISPATCH,
[$injectTemplateListener, 'injectTemplate'],
-89
);
$response = $e->getResponse();
if ($response instanceof \Laminas\Http\Response) {
$headers = $response->getHeaders();
if ($headers) {
$headers->addHeaderLine('Cache-Control', 'no-cache, no-store, must-revalidate');
$headers->addHeaderLine('Pragma', 'no-cache');
$headers->addHeaderLine('Expires', '1970-01-01');
$headers->addHeaderLine('X-Frame-Options: SAMEORIGIN');
$headers->addHeaderLine('X-Content-Type-Options: nosniff');
/** @var \Laminas\Http\Header\UserAgent $userAgentHeader */
$userAgentHeader = $e->getRequest()->getHeader('User-Agent');
$xssHeaderValue = $userAgentHeader && $userAgentHeader->getFieldValue()
&& strpos($userAgentHeader->getFieldValue(), XssProtection::IE_8_USER_AGENT) === false
? XssProtection::HEADER_ENABLED : XssProtection::HEADER_DISABLED;
$headers->addHeaderLine('X-XSS-Protection: ' . $xssHeaderValue);
}
}
}
/**
* @inheritDoc
*/
public function getConfig()
{
// phpcs:disable
$result = array_merge_recursive(
include __DIR__ . '/../../../config/module.config.php',
include __DIR__ . '/../../../config/router.config.php',
include __DIR__ . '/../../../config/di.config.php',
include __DIR__ . '/../../../config/states.install.config.php',
include __DIR__ . '/../../../config/languages.config.php',
);
// phpcs:enable
return $result;
}
}
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Setup;
use Laminas\EventManager\EventInterface;
use Laminas\EventManager\EventManager;
use Laminas\ModuleManager\Feature\BootstrapListenerInterface;
use Laminas\ModuleManager\Feature\ConfigProviderInterface;
use Laminas\Mvc\ModuleRouteListener;
use Laminas\Mvc\MvcEvent;
use Laminas\Stdlib\DispatchableInterface;
use Magento\Framework\App\Response\HeaderProvider\XssProtection;
use Magento\Setup\Mvc\View\Http\InjectTemplateListener;
/**
* Laminas module declaration
*/
class Module implements
BootstrapListenerInterface,
ConfigProviderInterface
{
/**
* @inheritDoc
*/
public function onBootstrap(EventInterface $e)
{
/** @var MvcEvent $e */
/** @var \Laminas\Mvc\Application $application */
$application = $e->getApplication();
/** @var EventManager $events */
$events = $application->getEventManager();
/** @var \Laminas\EventManager\SharedEventManager $sharedEvents */
$sharedEvents = $events->getSharedManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($events);
// Override Laminas\Mvc\View\Http\InjectTemplateListener
// to process templates by Vendor/Module
$injectTemplateListener = new InjectTemplateListener();
$sharedEvents->attach(
DispatchableInterface::class,
MvcEvent::EVENT_DISPATCH,
[$injectTemplateListener, 'injectTemplate'],
-89
);
$response = $e->getResponse();
if ($response instanceof \Laminas\Http\Response) {
$headers = $response->getHeaders();
if ($headers) {
$headers->addHeaderLine('Cache-Control', 'no-cache, no-store, must-revalidate');
$headers->addHeaderLine('Pragma', 'no-cache');
$headers->addHeaderLine('Expires', '1970-01-01');
$headers->addHeaderLine('X-Frame-Options: SAMEORIGIN');
$headers->addHeaderLine('X-Content-Type-Options: nosniff');
/** @var \Laminas\Http\Header\UserAgent $userAgentHeader */
$userAgentHeader = $e->getRequest()->getHeader('User-Agent');
$xssHeaderValue = $userAgentHeader && $userAgentHeader->getFieldValue()
&& strpos($userAgentHeader->getFieldValue(), XssProtection::IE_8_USER_AGENT) === false
? XssProtection::HEADER_ENABLED : XssProtection::HEADER_DISABLED;
$headers->addHeaderLine('X-XSS-Protection: ' . $xssHeaderValue);
}
}
}
/**
* @inheritDoc
*/
public function getConfig()
{
// phpcs:disable
$result = array_merge_recursive(
include __DIR__ . '/../../../config/module.config.php',
include __DIR__ . '/../../../config/router.config.php',
include __DIR__ . '/../../../config/di.config.php',
include __DIR__ . '/../../../config/states.install.config.php',
include __DIR__ . '/../../../config/languages.config.php',
);
// phpcs:enable
return $result;
}
}