|
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 / a / home / dev2.destoffenstraat.com / app / code / Mageplaza / DailyDeal1 / Controller / |
Filename | /home/a/home/dev2.destoffenstraat.com/app/code/Mageplaza/DailyDeal1/Controller/Router.php |
Size | 5.1 kb |
Permission | rwxrwxrwx |
Owner | root : root |
Create time | 21-Aug-2025 12:26 |
Last modified | 06-Apr-2021 18:06 |
Last accessed | 22-Aug-2025 22:37 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_DailyDeal
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\DailyDeal\Controller;
use Magento\Framework\App\ActionFactory;
use Magento\Framework\App\ActionInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\App\RouterInterface;
use Magento\Framework\Url;
use Mageplaza\DailyDeal\Block\Pages\AllDeals;
use Mageplaza\DailyDeal\Block\Pages\BestsellerDeals;
use Mageplaza\DailyDeal\Block\Pages\FeaturedDeals;
use Mageplaza\DailyDeal\Block\Pages\NewDeals;
use Mageplaza\DailyDeal\Helper\Data as HelperData;
/**
* Class Router
* @package Mageplaza\DailyDeal\Controller
*/
class Router implements RouterInterface
{
/**
* @var ActionFactory
*/
protected $actionFactory;
/**
* @var HelperData
*/
protected $_helperData;
/**
* @var AllDeals
*/
protected $_allDeals;
/**
* @var NewDeals
*/
protected $_newDeals;
/**
* @var BestsellerDeals
*/
protected $_sellerDeals;
/**
* @var FeaturedDeals
*/
protected $_featuredDeals;
/**
* Router constructor.
*
* @param ActionFactory $actionFactory
* @param HelperData $helperData
* @param AllDeals $allDeals
* @param NewDeals $newDeals
* @param BestsellerDeals $sellerDeals
* @param FeaturedDeals $featureDeal
*/
public function __construct(
ActionFactory $actionFactory,
HelperData $helperData,
AllDeals $allDeals,
NewDeals $newDeals,
BestsellerDeals $sellerDeals,
FeaturedDeals $featureDeal
) {
$this->actionFactory = $actionFactory;
$this->_helperData = $helperData;
$this->_allDeals = $allDeals;
$this->_newDeals = $newDeals;
$this->_sellerDeals = $sellerDeals;
$this->_featuredDeals = $featureDeal;
}
/**
* @param RequestInterface $request
*
* @return ActionInterface|null
*/
public function match(RequestInterface $request)
{
$identifier = trim($request->getPathInfo(), '/');
$routePath = explode('/', $identifier);
$urlSuffix = $this->_helperData->getUrlSuffix();
if (!$this->_helperData->isEnabled() || (count($routePath) !== 1)) {
return null;
}
$route = $routePath[0];
if ($urlSuffix) {
if (strpos($route, $urlSuffix) !== false) {
$pos = strpos($route, $urlSuffix);
$route = substr($route, 0, $pos);
} else {
return null;
}
}
switch ($route) {
case $this->_allDeals->getRoute():
if (!$this->_allDeals->isEnable()) {
return null;
}
$request->setModuleName('dailydeal')
->setControllerName('pages')
->setAlias(Url::REWRITE_REQUEST_PATH_ALIAS, $identifier)
->setActionName('alldeals')->setPathInfo('/dailydeal/pages/alldeals');
break;
case $this->_newDeals->getRoute():
if (!$this->_newDeals->isEnable()) {
return null;
}
$request->setModuleName('dailydeal')
->setControllerName('pages')
->setAlias(Url::REWRITE_REQUEST_PATH_ALIAS, $identifier)
->setActionName('newdeals')->setPathInfo('/dailydeal/pages/newdeals');
break;
case $this->_sellerDeals->getRoute():
if (!$this->_sellerDeals->isEnable()) {
return null;
}
$request->setModuleName('dailydeal')
->setControllerName('pages')
->setAlias(Url::REWRITE_REQUEST_PATH_ALIAS, $identifier)
->setActionName('bestsellerdeals')->setPathInfo('/dailydeal/pages/bestsellerdeals');
break;
case $this->_featuredDeals->getRoute():
if (!$this->_featuredDeals->isEnable()) {
return null;
}
$request->setModuleName('dailydeal')
->setControllerName('pages')
->setAlias(Url::REWRITE_REQUEST_PATH_ALIAS, $identifier)
->setActionName('featureddeals')->setPathInfo('/dailydeal/pages/featureddeals');
break;
default:
return null;
}
return $this->actionFactory->create('Magento\Framework\App\Action\Forward');
}
}
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_DailyDeal
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\DailyDeal\Controller;
use Magento\Framework\App\ActionFactory;
use Magento\Framework\App\ActionInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\App\RouterInterface;
use Magento\Framework\Url;
use Mageplaza\DailyDeal\Block\Pages\AllDeals;
use Mageplaza\DailyDeal\Block\Pages\BestsellerDeals;
use Mageplaza\DailyDeal\Block\Pages\FeaturedDeals;
use Mageplaza\DailyDeal\Block\Pages\NewDeals;
use Mageplaza\DailyDeal\Helper\Data as HelperData;
/**
* Class Router
* @package Mageplaza\DailyDeal\Controller
*/
class Router implements RouterInterface
{
/**
* @var ActionFactory
*/
protected $actionFactory;
/**
* @var HelperData
*/
protected $_helperData;
/**
* @var AllDeals
*/
protected $_allDeals;
/**
* @var NewDeals
*/
protected $_newDeals;
/**
* @var BestsellerDeals
*/
protected $_sellerDeals;
/**
* @var FeaturedDeals
*/
protected $_featuredDeals;
/**
* Router constructor.
*
* @param ActionFactory $actionFactory
* @param HelperData $helperData
* @param AllDeals $allDeals
* @param NewDeals $newDeals
* @param BestsellerDeals $sellerDeals
* @param FeaturedDeals $featureDeal
*/
public function __construct(
ActionFactory $actionFactory,
HelperData $helperData,
AllDeals $allDeals,
NewDeals $newDeals,
BestsellerDeals $sellerDeals,
FeaturedDeals $featureDeal
) {
$this->actionFactory = $actionFactory;
$this->_helperData = $helperData;
$this->_allDeals = $allDeals;
$this->_newDeals = $newDeals;
$this->_sellerDeals = $sellerDeals;
$this->_featuredDeals = $featureDeal;
}
/**
* @param RequestInterface $request
*
* @return ActionInterface|null
*/
public function match(RequestInterface $request)
{
$identifier = trim($request->getPathInfo(), '/');
$routePath = explode('/', $identifier);
$urlSuffix = $this->_helperData->getUrlSuffix();
if (!$this->_helperData->isEnabled() || (count($routePath) !== 1)) {
return null;
}
$route = $routePath[0];
if ($urlSuffix) {
if (strpos($route, $urlSuffix) !== false) {
$pos = strpos($route, $urlSuffix);
$route = substr($route, 0, $pos);
} else {
return null;
}
}
switch ($route) {
case $this->_allDeals->getRoute():
if (!$this->_allDeals->isEnable()) {
return null;
}
$request->setModuleName('dailydeal')
->setControllerName('pages')
->setAlias(Url::REWRITE_REQUEST_PATH_ALIAS, $identifier)
->setActionName('alldeals')->setPathInfo('/dailydeal/pages/alldeals');
break;
case $this->_newDeals->getRoute():
if (!$this->_newDeals->isEnable()) {
return null;
}
$request->setModuleName('dailydeal')
->setControllerName('pages')
->setAlias(Url::REWRITE_REQUEST_PATH_ALIAS, $identifier)
->setActionName('newdeals')->setPathInfo('/dailydeal/pages/newdeals');
break;
case $this->_sellerDeals->getRoute():
if (!$this->_sellerDeals->isEnable()) {
return null;
}
$request->setModuleName('dailydeal')
->setControllerName('pages')
->setAlias(Url::REWRITE_REQUEST_PATH_ALIAS, $identifier)
->setActionName('bestsellerdeals')->setPathInfo('/dailydeal/pages/bestsellerdeals');
break;
case $this->_featuredDeals->getRoute():
if (!$this->_featuredDeals->isEnable()) {
return null;
}
$request->setModuleName('dailydeal')
->setControllerName('pages')
->setAlias(Url::REWRITE_REQUEST_PATH_ALIAS, $identifier)
->setActionName('featureddeals')->setPathInfo('/dailydeal/pages/featureddeals');
break;
default:
return null;
}
return $this->actionFactory->create('Magento\Framework\App\Action\Forward');
}
}