Commits vergleichen
13 Commits
Autor | SHA1 | Datum | |
---|---|---|---|
e7db5bdac4 | |||
3b572f94dc | |||
ede7bafca2 | |||
fc2c9a65be | |||
17dfdcb135 | |||
439bdfdc4f | |||
35f38817e0 | |||
e1ec9c0714 | |||
468a5d33c4 | |||
6be788ff47 | |||
17be971465 | |||
37c28d5b59 | |||
21fd6e14e7 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -0,0 +1 @@
|
||||
.php_cs.cache
|
@ -6,7 +6,7 @@ $finder = PhpCsFixer\Finder::create()
|
||||
|
||||
$config = new PhpCsFixer\Config();
|
||||
return $config->setRules([
|
||||
'@PHP70Migration' => true,
|
||||
'@PHP71Migration' => true,
|
||||
'@PSR12' => true
|
||||
])
|
||||
->setFinder($finder)
|
||||
|
@ -20,23 +20,44 @@ use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
trait redirectControllerTrait
|
||||
{
|
||||
protected function d3DoPRGRedirect()
|
||||
/**
|
||||
* @return 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(null);
|
||||
$utils->d3PrgRedirect($this->generatePageNavigationUrl());
|
||||
$this->setFncName('');
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
21
CHANGELOG.md
21
CHANGELOG.md
@ -1,10 +1,27 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## 1.0.0.0 (2022-07-25)
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased](https://git.d3data.de/D3Public/PRGredirect/compare/1.1.1.0...rel_1.x)
|
||||
|
||||
## [1.1.2.0](https://git.d3data.de/D3Public/PRGredirect/compare/1.1.0.0...1.1.1.0) - 2023-09-27
|
||||
### Fixed
|
||||
- incompatible type declarations on oxid-native-methods
|
||||
|
||||
## [1.1.1.0](https://git.d3data.de/D3Public/PRGredirect/compare/1.1.0.0...1.1.1.0) - 2023-09-27
|
||||
### Added
|
||||
- make installable in OXID 6.5 (CE 6.12 + 6.14)
|
||||
|
||||
## [1.1.0.0](https://git.d3data.de/D3Public/PRGredirect/compare/1.0.0.0...1.1.0.0) - 2022-07-26
|
||||
### Added
|
||||
- add custom url redirect for individual implementations
|
||||
|
||||
## [1.0.0.0](https://git.d3data.de/D3Public/PRGredirect/releases/tag/1.0.0.0) - 2022-07-25
|
||||
### Added
|
||||
- performs POST forwarding in the following controllers
|
||||
- Search
|
||||
- Article lists (categories, manufacturers, vendors)
|
||||
- Contact
|
||||
- no forwarding in case of errors in the contact form
|
||||
- no forwarding in case of errors in the contact form
|
@ -24,11 +24,11 @@ class ArticleListController_PRGredirect extends ArticleListController_PRGredirec
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render(): string
|
||||
public function render()
|
||||
{
|
||||
$template = parent::render();
|
||||
|
||||
$this->d3DoPRGRedirect();
|
||||
$this->d3DoPRGSelfRedirect();
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -36,12 +36,12 @@ class ContactController_PRGredirect extends ContactController_PRGredirect_parent
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render(): string
|
||||
public function render()
|
||||
{
|
||||
$template = parent::render();
|
||||
|
||||
if ($this->success !== false) {
|
||||
$this->d3DoPRGRedirect();
|
||||
$this->d3DoPRGSelfRedirect();
|
||||
}
|
||||
|
||||
return $template;
|
||||
|
@ -24,11 +24,11 @@ class ManufacturerListController_PRGredirect extends ManufacturerListController_
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render(): string
|
||||
public function render()
|
||||
{
|
||||
$template = parent::render();
|
||||
|
||||
$this->d3DoPRGRedirect();
|
||||
$this->d3DoPRGSelfRedirect();
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -24,11 +24,11 @@ class SearchController_PRGredirect extends SearchController_PRGredirect_parent
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render(): string
|
||||
public function render()
|
||||
{
|
||||
$template = parent::render();
|
||||
|
||||
$this->d3DoPRGRedirect();
|
||||
$this->d3DoPRGSelfRedirect();
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -24,11 +24,11 @@ class VendorListController_PRGredirect extends VendorListController_PRGredirect_
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render(): string
|
||||
public function render()
|
||||
{
|
||||
$template = parent::render();
|
||||
|
||||
$this->d3DoPRGRedirect();
|
||||
$this->d3DoPRGSelfRedirect();
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -15,12 +15,16 @@ declare(strict_types=1);
|
||||
|
||||
namespace D3\PRGredirects\Modules\Core;
|
||||
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class Utils_PRGredirect extends Utils_PRGredirect_parent
|
||||
{
|
||||
public function d3PrgRedirect($url)
|
||||
/**
|
||||
* @param string $url
|
||||
* @return void
|
||||
*/
|
||||
public function d3PrgRedirect(string $url): void
|
||||
{
|
||||
$url = str_ireplace("&", "&", $url);
|
||||
$headerCode = "HTTP/1.1 303 See Other";
|
||||
@ -29,7 +33,7 @@ class Utils_PRGredirect extends Utils_PRGredirect_parent
|
||||
$this->_simpleRedirect($url, $headerCode);
|
||||
|
||||
Registry::getSession()->freeze();
|
||||
} catch (Exception $e) {
|
||||
} catch (StandardException $e) {
|
||||
$e->debugOut();
|
||||
}
|
||||
|
||||
|
@ -25,18 +25,21 @@
|
||||
"GPL-3.0-or-later"
|
||||
],
|
||||
"require": {
|
||||
"oxid-esales/oxideshop-ce": "6.3 - 6.10"
|
||||
"php": ">=7.1",
|
||||
"oxid-esales/oxideshop-ce": "6.3 - 6.14"
|
||||
},
|
||||
"require-dev": {
|
||||
"oxid-esales/oxideshop-ce": "~6.10.0",
|
||||
"friendsofphp/php-cs-fixer": "^2.19"
|
||||
"friendsofphp/php-cs-fixer": "^2.19",
|
||||
"phpstan/phpstan": "^1.8"
|
||||
},
|
||||
"extra": {
|
||||
"oxideshop": {
|
||||
"blacklist-filter": [
|
||||
"*.md",
|
||||
"composer.json",
|
||||
".php-cs-fixer.php"
|
||||
".php-cs-fixer.php",
|
||||
"*.neon"
|
||||
],
|
||||
"target-directory": "d3/prg-redirects"
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ $aModule = [
|
||||
'de' => 'siehe https://de.wikipedia.org/wiki/Post/Redirect/Get',
|
||||
'en' => 'see https://en.wikipedia.org/wiki/Post/Redirect/Get',
|
||||
],
|
||||
'version' => '1.0.0.0',
|
||||
'version' => '1.1.2.0',
|
||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
|
9
phpstan.neon
Normale Datei
9
phpstan.neon
Normale Datei
@ -0,0 +1,9 @@
|
||||
parameters:
|
||||
scanFiles:
|
||||
- IntelliSenseHelper.php
|
||||
- ../../oxid-esales/oxideshop-ce/source/oxfunctions.php
|
||||
paths:
|
||||
- Application
|
||||
- Modules
|
||||
level: 9
|
||||
phpVersion: 70100
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren