first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace External\ZNZBundle\EventSubscriber;
use KupShop\KupShopBundle\Event\NotFoundEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
class NotFoundSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
NotFoundEvent::class => [
['checkForFilterInUrl', 255],
],
];
}
/** Redirects URLs with filter to base URL */
public function checkForFilterInUrl(NotFoundEvent $event): void
{
$uri = $event->getRequest()->getRequestUri();
if (str_contains($uri, '/filter/') && !str_ends_with($uri, '/filter/')) {
$parts = explode('/filter/', $uri);
if (!empty($parts[0])) {
$event->setResponse(
new RedirectResponse(rtrim($parts[0], '/').'.html')
);
}
}
}
}