diff --git a/Classes/Domain/Model/Redirect.php b/Classes/Domain/Model/Redirect.php index 4b3985e..d957913 100644 --- a/Classes/Domain/Model/Redirect.php +++ b/Classes/Domain/Model/Redirect.php @@ -55,6 +55,13 @@ class Redirect */ protected $forwardUrl; + /** + * Additional params for the URL + * + * @var string + */ + protected $additionalParams; + /** * The scheme * @@ -110,6 +117,7 @@ class Redirect * @param int $languageUid The language uid * @param int $type The type of redirect * @param string $forwardUrl The URL to be forwarded + * @param string $additionalParams Additional params for the URL * @param int $internalPage Uid of the internal page * @param string $externalUrl External URL * @param string $internalFile Path to the internal file @@ -120,6 +128,7 @@ public function __construct( $languageUid, $type, $forwardUrl, + $additionalParams, $internalPage, $externalUrl, $internalFile, @@ -129,6 +138,7 @@ public function __construct( $this->languageUid = (int) $languageUid; $this->type = (int) $type; $this->forwardUrl = (string) $forwardUrl; + $this->additionalParams = (string) $additionalParams; $this->internalPage = (int) $internalPage; $this->externalUrl = (string) $externalUrl; $this->internalFile = (string) $internalFile; @@ -198,7 +208,7 @@ protected function constructUrlForInternalPage() [ 'parameter' => $this->internalPage, 'forceAbsoluteUrl' => true, - 'additionalParams' => '&L=' . $this->languageUid + 'additionalParams' => '&L=' . $this->languageUid . $this->additionalParams ] ); } @@ -232,7 +242,7 @@ protected function constructUrlForExternal() */ protected function constructUrlForPath($scheme, $host, $oldPath) { - $needle = '/'.preg_quote($this->path, '/').'/'; + $needle = '/'.preg_quote(trim($this->path, '/'), '/').'/'; $newPath = preg_replace($needle, trim($this->forwardUrl, '/'), $oldPath, 1); diff --git a/Classes/Domain/Repository/RedirectRepository.php b/Classes/Domain/Repository/RedirectRepository.php index a3e63dc..2e0476c 100755 --- a/Classes/Domain/Repository/RedirectRepository.php +++ b/Classes/Domain/Repository/RedirectRepository.php @@ -56,6 +56,7 @@ public function findByPathAndDomain($host, $path) tx_urlforwarding_domain_model_redirect.sys_language_uid, tx_urlforwarding_domain_model_redirect.type, tx_urlforwarding_domain_model_redirect.forward_url, + tx_urlforwarding_domain_model_redirect.additional_params, tx_urlforwarding_domain_model_redirect.internal_page, tx_urlforwarding_domain_model_redirect.external_url, tx_urlforwarding_domain_model_redirect.internal_file, @@ -110,6 +111,7 @@ public function findByPathAndDomain($host, $path) $result['sys_language_uid'], $result['type'], $result['forward_url'], + $result['additional_params'], $result['internal_page'], $result['external_url'], $result['internal_file'], diff --git a/Configuration/TCA/tx_urlforwarding_domain_model_redirect.php b/Configuration/TCA/tx_urlforwarding_domain_model_redirect.php index 0f52467..0649528 100644 --- a/Configuration/TCA/tx_urlforwarding_domain_model_redirect.php +++ b/Configuration/TCA/tx_urlforwarding_domain_model_redirect.php @@ -38,6 +38,7 @@ hidden, type, forward_url, + additional_params, internal_page, external_url, internal_file, @@ -57,6 +58,7 @@ --palette--;;general, forward_url, internal_page, + additional_params, http_status, domain, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, @@ -305,6 +307,15 @@ ] ] ], + 'additional_params' => [ + 'exclude' => false, + 'label' => 'LLL:EXT:url_forwarding/Resources/Private/Language/TCA/Redirect.xlf:additional_params', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim', + ] + ], 'external_url' => [ 'exclude' => false, 'label' => 'LLL:EXT:url_forwarding/Resources/Private/Language/TCA/Redirect.xlf:external_url', diff --git a/Resources/Private/Language/TCA/Redirect.xlf b/Resources/Private/Language/TCA/Redirect.xlf index 3f15e3b..34c61b3 100644 --- a/Resources/Private/Language/TCA/Redirect.xlf +++ b/Resources/Private/Language/TCA/Redirect.xlf @@ -45,6 +45,9 @@ Source + + Additional Params + New path diff --git a/Resources/Private/Language/TCA/Redirect_csh.xlf b/Resources/Private/Language/TCA/Redirect_csh.xlf new file mode 100644 index 0000000..085b4a5 --- /dev/null +++ b/Resources/Private/Language/TCA/Redirect_csh.xlf @@ -0,0 +1,11 @@ + + + +
+ + + + + + + \ No newline at end of file diff --git a/ext_tables.php b/ext_tables.php new file mode 100644 index 0000000..a73b57f --- /dev/null +++ b/ext_tables.php @@ -0,0 +1,7 @@ +