add custom url redirect for individual implementations
Cette révision appartient à :
Parent
6be788ff47
révision
468a5d33c4
@ -6,7 +6,7 @@ $finder = PhpCsFixer\Finder::create()
|
||||
|
||||
$config = new PhpCsFixer\Config();
|
||||
return $config->setRules([
|
||||
'@PHP70Migration' => true,
|
||||
'@PHP71Migration' => true,
|
||||
'@PSR12' => true
|
||||
])
|
||||
->setFinder($finder)
|
||||
|
@ -23,23 +23,41 @@ trait redirectControllerTrait
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function d3DoPRGRedirect(): void
|
||||
protected function d3DoPRGSelfRedirect(): void
|
||||
{
|
||||
if ($this->d3ShouldDoPRGredirect()) {
|
||||
if ($this->d3SelfRedirectIsConfigured()) {
|
||||
$this->d3DoPRGCustomRedirect($this->generatePageNavigationUrl());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
* @return void
|
||||
*/
|
||||
protected function d3DoPRGCustomRedirect(string $url): void
|
||||
{
|
||||
if ($this->d3IsPostRequest()) {
|
||||
/** @var Utils_PRGredirect $utils */
|
||||
$utils = Registry::getUtils();
|
||||
|
||||
$this->setFncName('');
|
||||
$utils->d3PrgRedirect($this->generatePageNavigationUrl());
|
||||
$utils->d3PrgRedirect($url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function d3ShouldDoPRGredirect(): bool
|
||||
protected function d3IsPostRequest(): bool
|
||||
{
|
||||
return strtoupper($_SERVER['REQUEST_METHOD']) === 'POST' &&
|
||||
Registry::getConfig()->getConfigParam('d3PRGredirect_'.$this->getClassKey()) === true;
|
||||
return strtoupper($_SERVER['REQUEST_METHOD']) === 'POST';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function d3SelfRedirectIsConfigured(): bool
|
||||
{
|
||||
return Registry::getConfig()->getConfigParam('d3PRGredirect_'.$this->getClassKey()) === true;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class ArticleListController_PRGredirect extends ArticleListController_PRGredirec
|
||||
{
|
||||
$template = parent::render();
|
||||
|
||||
$this->d3DoPRGRedirect();
|
||||
$this->d3DoPRGSelfRedirect();
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class ContactController_PRGredirect extends ContactController_PRGredirect_parent
|
||||
$template = parent::render();
|
||||
|
||||
if ($this->success !== false) {
|
||||
$this->d3DoPRGRedirect();
|
||||
$this->d3DoPRGSelfRedirect();
|
||||
}
|
||||
|
||||
return $template;
|
||||
|
@ -28,7 +28,7 @@ class ManufacturerListController_PRGredirect extends ManufacturerListController_
|
||||
{
|
||||
$template = parent::render();
|
||||
|
||||
$this->d3DoPRGRedirect();
|
||||
$this->d3DoPRGSelfRedirect();
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class SearchController_PRGredirect extends SearchController_PRGredirect_parent
|
||||
{
|
||||
$template = parent::render();
|
||||
|
||||
$this->d3DoPRGRedirect();
|
||||
$this->d3DoPRGSelfRedirect();
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class VendorListController_PRGredirect extends VendorListController_PRGredirect_
|
||||
{
|
||||
$template = parent::render();
|
||||
|
||||
$this->d3DoPRGRedirect();
|
||||
$this->d3DoPRGSelfRedirect();
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
"GPL-3.0-or-later"
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1",
|
||||
"oxid-esales/oxideshop-ce": "6.3 - 6.10"
|
||||
},
|
||||
"require-dev": {
|
||||
|
Chargement…
x
Référencer dans un nouveau ticket
Bloquer un utilisateur