Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Nano1237 committed Dec 12, 2018
1 parent 7a0c533 commit 3fe714c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Classes/Decoder/UrlDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ class UrlDecoder {
*
* @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
*/
protected $pObject = null;
protected $typoScriptFrontendController = null;
/**
* partialCache
*
* @var PartialRegistrationUtility
*/
protected $partialCache = null;
protected $partialRegistrationUtility = null;


public function __construct () {
$this->partialCache = GeneralUtility::makeInstance(PartialRegistrationUtility::class);
$this->partialRegistrationUtility = GeneralUtility::makeInstance(PartialRegistrationUtility::class);
}


Expand All @@ -42,7 +42,7 @@ public function __construct () {
* @return void
*/
public function decodeUrl (array $params) {
$this->pObject = $params['pObj'];
$this->typoScriptFrontendController = $params['pObj'];
if ($this->canDecodeUrl()) {
$this->outputTemplateForUrl();
}
Expand All @@ -53,7 +53,7 @@ public function decodeUrl (array $params) {
* Either outputs the content if the given partial directly or does nothing resulting in calling the next hook
*/
private function outputTemplateForUrl () {
$partialContent = $this->getPartialForPath($this->pObject->siteScript);
$partialContent = $this->getPartialForPath($this->typoScriptFrontendController->siteScript);
if ($partialContent !== null) {
exit($partialContent);
}
Expand All @@ -70,16 +70,16 @@ private function outputTemplateForUrl () {
private function getPartialForPath (string $path) {
list($url, $arguments) = explode('?', $path);
list($iizuna, $extension, $partial) = explode('/', $url, 3);
if ($this->partialCache->isRegistered($extension, $partial)) {
$configuration = $this->partialCache->getConfiguration($extension, $partial);
if ($this->partialRegistrationUtility->isRegistered($extension, $partial)) {
$configuration = $this->partialRegistrationUtility->getConfiguration($extension, $partial);
$passingArguments = [];
foreach ($configuration[2] as $allowedArguments) {
if (isset($_GET[$allowedArguments])) {
$passingArguments[$allowedArguments] = strip_tags(urldecode($_GET[$allowedArguments]));
}
}

return $this->partialCache->getPartial($extension, $partial, $passingArguments);
return $this->partialRegistrationUtility->getPartial($extension, $partial, $passingArguments);
}

return null;
Expand All @@ -93,6 +93,6 @@ private function getPartialForPath (string $path) {
* @return bool
*/
private function canDecodeUrl () {
return strpos($this->pObject->siteScript, 'iizuna') === 0;
return strpos($this->typoScriptFrontendController->siteScript, 'iizuna') === 0;
}
}

0 comments on commit 3fe714c

Please sign in to comment.