diff --git a/Classes/Controller/SingleCollectionController.php b/Classes/Controller/SingleCollectionController.php index 547edcd..f50bd99 100644 --- a/Classes/Controller/SingleCollectionController.php +++ b/Classes/Controller/SingleCollectionController.php @@ -96,7 +96,7 @@ public function injectMetadataRepository(MetadataRepository $metadataRepository) /** * initializeAction * - * @return + * @return void */ protected function initializeAction() { diff --git a/Classes/ViewHelpers/CalcViewHelper.php b/Classes/ViewHelpers/CalcViewHelper.php index a5b1c71..46ec981 100644 --- a/Classes/ViewHelpers/CalcViewHelper.php +++ b/Classes/ViewHelpers/CalcViewHelper.php @@ -23,7 +23,6 @@ * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -66,6 +65,7 @@ public static function renderStatic( $val1 = $arguments['val1']; $val2 = $arguments['val2']; $operator = $arguments['operator']; + $result = ''; switch ($operator) { case '+': $result = (int)$val1 + (int)$val2; diff --git a/Classes/ViewHelpers/ExtractFulltextViewHelper.php b/Classes/ViewHelpers/ExtractFulltextViewHelper.php index d7120f5..c96fb4e 100644 --- a/Classes/ViewHelpers/ExtractFulltextViewHelper.php +++ b/Classes/ViewHelpers/ExtractFulltextViewHelper.php @@ -23,7 +23,6 @@ * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -62,13 +61,9 @@ public static function renderStatic( RenderingContextInterface $renderingContext ) { $file= $arguments['file']; - + $rawText = ''; $altoXml = @simplexml_load_file($file); - if($altoXml === FALSE) - { - // fulltext not accessible - $rawText = ''; - } else { + if($altoXml !== FALSE) { $altoXml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); // Get all (presumed) words of the text. $words = $altoXml->xpath('./alto:Layout/alto:Page/alto:PrintSpace//alto:TextBlock/alto:TextLine/alto:String/@CONTENT'); @@ -77,7 +72,6 @@ public static function renderStatic( } } return $rawText; - } } diff --git a/Classes/ViewHelpers/PageInfoViewHelper.php b/Classes/ViewHelpers/PageInfoViewHelper.php index 5326fbb..b7834c0 100644 --- a/Classes/ViewHelpers/PageInfoViewHelper.php +++ b/Classes/ViewHelpers/PageInfoViewHelper.php @@ -65,7 +65,7 @@ public static function renderStatic( ) { $pageUid = $arguments['uid']; $field = $arguments['field']; - if (0 === $uid) { + if (0 === $pageUid) { $pageUid = $GLOBALS['TSFE']->id; } $pageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class); diff --git a/Classes/ViewHelpers/XpathViewHelper.php b/Classes/ViewHelpers/XpathViewHelper.php index df26ff5..429fe1f 100644 --- a/Classes/ViewHelpers/XpathViewHelper.php +++ b/Classes/ViewHelpers/XpathViewHelper.php @@ -114,22 +114,25 @@ public static function renderStatic( $result = $document->getDoc()->mets->xpath($xpath); if (is_array($result)) { - foreach ($result as $row) { + if (!$returnArray) { + $output = ''; + } + foreach ($result as $row) { + if ($returnArray) { + $output[] = $htmlspecialchars ? htmlspecialchars(trim($row)) : trim($row); + } else { + $output .= $htmlspecialchars ? htmlspecialchars(trim($row)) : trim($row) . ' '; + } + } + } else { if ($returnArray) { - $output[] = $htmlspecialchars ? htmlspecialchars(trim($row)) : trim($row); + $output[] = $htmlspecialchars ? htmlspecialchars(trim($result)) : trim($result); } else { - $output .= $htmlspecialchars ? htmlspecialchars(trim($row)) : trim($row) . ' '; + $output = $htmlspecialchars ? htmlspecialchars(trim($result)) : trim($result); } - } - } else { - if ($returnArray) { - $output[] = $htmlspecialchars ? htmlspecialchars(trim($row)) : trim($row); - } else { - $output = $htmlspecialchars ? htmlspecialchars(trim($row)) : trim($row); - } } - if (! $returnArray) { + if (!$returnArray) { return trim($output); } else { return $output;