@@ -19,13 +19,11 @@ |
||
| 19 | 19 | /** |
| 20 | 20 | * Add inline JavaScript code to footer * |
| 21 | 21 | */ |
| 22 | -class JsFooterViewHelper extends AbstractViewHelper |
|
| 23 | -{ |
|
| 22 | +class JsFooterViewHelper extends AbstractViewHelper { |
|
| 24 | 23 | /** |
| 25 | 24 | * Initialize arguments. |
| 26 | 25 | */ |
| 27 | - public function initializeArguments() |
|
| 28 | - { |
|
| 26 | + public function initializeArguments() { |
|
| 29 | 27 | parent::initializeArguments(); |
| 30 | 28 | $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', true); |
| 31 | 29 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | public function initializeArguments() |
| 28 | 28 | { |
| 29 | 29 | parent::initializeArguments(); |
| 30 | - $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', true); |
|
| 30 | + $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', TRUE); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | $fulltext['mimetype'] = $this->document->getDoc()->getFileMimeType($this->document->getDoc()->physicalStructureInfo[$this->document->getDoc()->physicalStructure[$page]]['files'][$fileGrpFulltext]); |
| 147 | 147 | break; |
| 148 | 148 | } else { |
| 149 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrp "' . $fileGrpFulltext . '"'); |
|
| 149 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrp "'.$fileGrpFulltext.'"'); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | if (empty($fulltext)) { |
| 153 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrps "' . $this->settings['fileGrpFulltext'] . '"'); |
|
| 153 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrps "'.$this->settings['fileGrpFulltext'].'"'); |
|
| 154 | 154 | } |
| 155 | 155 | return $fulltext; |
| 156 | 156 | } |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | $viewerConfiguration = '$(document).ready(function() { |
| 169 | 169 | if (dlfUtils.exists(dlfViewer)) { |
| 170 | 170 | tx_dlf_viewer = new dlfViewer({ |
| 171 | - controls: ["' . implode('", "', $this->controls) . '"], |
|
| 172 | - div: "' . $this->settings['elementId'] . '", |
|
| 173 | - images: ' . json_encode($this->images) . ', |
|
| 174 | - fulltexts: ' . json_encode($this->fulltexts) . ', |
|
| 175 | - annotationContainers: ' . json_encode($this->annotationContainers) . ', |
|
| 176 | - useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0) . ' |
|
| 171 | + controls: ["' . implode('", "', $this->controls).'"], |
|
| 172 | + div: "' . $this->settings['elementId'].'", |
|
| 173 | + images: ' . json_encode($this->images).', |
|
| 174 | + fulltexts: ' . json_encode($this->fulltexts).', |
|
| 175 | + annotationContainers: ' . json_encode($this->annotationContainers).', |
|
| 176 | + useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0).' |
|
| 177 | 177 | }); |
| 178 | 178 | } |
| 179 | 179 | });'; |
@@ -271,11 +271,11 @@ discard block |
||
| 271 | 271 | $image['mimetype'] = $this->document->getDoc()->getFileMimeType($this->document->getDoc()->physicalStructureInfo[$this->document->getDoc()->physicalStructure[$page]]['files'][$fileGrpImages]); |
| 272 | 272 | break; |
| 273 | 273 | } else { |
| 274 | - $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"'); |
|
| 274 | + $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"'); |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | if (empty($image)) { |
| 278 | - $this->logger->warning('No image file found for page "' . $page . '" in fileGrps "' . $this->settings['fileGrpImages'] . '"'); |
|
| 278 | + $this->logger->warning('No image file found for page "'.$page.'" in fileGrps "'.$this->settings['fileGrpImages'].'"'); |
|
| 279 | 279 | } |
| 280 | 280 | return $image; |
| 281 | 281 | } |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | * @subpackage dlf |
| 27 | 27 | * @access public |
| 28 | 28 | */ |
| 29 | -class PageViewController extends AbstractController |
|
| 30 | -{ |
|
| 29 | +class PageViewController extends AbstractController { |
|
| 31 | 30 | /** |
| 32 | 31 | * Holds the controls to add to the map |
| 33 | 32 | * |
@@ -65,8 +64,7 @@ discard block |
||
| 65 | 64 | * |
| 66 | 65 | * @return void |
| 67 | 66 | */ |
| 68 | - public function mainAction() |
|
| 69 | - { |
|
| 67 | + public function mainAction() { |
|
| 70 | 68 | // Load current document. |
| 71 | 69 | $this->loadDocument($this->requestData); |
| 72 | 70 | if ( |
@@ -121,8 +119,7 @@ discard block |
||
| 121 | 119 | * |
| 122 | 120 | * @return array URL and MIME type of fulltext file |
| 123 | 121 | */ |
| 124 | - protected function getFulltext($page) |
|
| 125 | - { |
|
| 122 | + protected function getFulltext($page) { |
|
| 126 | 123 | $fulltext = []; |
| 127 | 124 | // Get fulltext link. |
| 128 | 125 | $fileGrpsFulltext = GeneralUtility::trimExplode(',', $this->extConf['fileGrpFulltext']); |
@@ -162,8 +159,7 @@ discard block |
||
| 162 | 159 | * |
| 163 | 160 | * @return void |
| 164 | 161 | */ |
| 165 | - protected function addViewerJS() |
|
| 166 | - { |
|
| 162 | + protected function addViewerJS() { |
|
| 167 | 163 | // Viewer configuration. |
| 168 | 164 | $viewerConfiguration = '$(document).ready(function() { |
| 169 | 165 | if (dlfUtils.exists(dlfViewer)) { |
@@ -189,8 +185,7 @@ discard block |
||
| 189 | 185 | * @return array An array containing the IRIs of the AnnotationLists / AnnotationPages as well as |
| 190 | 186 | * some information about the canvas. |
| 191 | 187 | */ |
| 192 | - protected function getAnnotationContainers($page) |
|
| 193 | - { |
|
| 188 | + protected function getAnnotationContainers($page) { |
|
| 194 | 189 | if ($this->document->getDoc() instanceof IiifManifest) { |
| 195 | 190 | $canvasId = $this->document->getDoc()->physicalStructure[$page]; |
| 196 | 191 | $iiif = $this->document->getDoc()->getIiif(); |
@@ -246,8 +241,7 @@ discard block |
||
| 246 | 241 | * |
| 247 | 242 | * @return array URL and MIME type of image file |
| 248 | 243 | */ |
| 249 | - protected function getImage($page) |
|
| 250 | - { |
|
| 244 | + protected function getImage($page) { |
|
| 251 | 245 | $image = []; |
| 252 | 246 | // Get @USE value of METS fileGrp. |
| 253 | 247 | $fileGrpsImages = GeneralUtility::trimExplode(',', $this->extConf['fileGrpImages']); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | // Load current document. |
| 71 | 71 | $this->loadDocument($this->requestData); |
| 72 | 72 | if ( |
| 73 | - $this->document === null |
|
| 73 | + $this->document === NULL |
|
| 74 | 74 | || $this->document->getDoc()->numPages < 1 |
| 75 | 75 | ) { |
| 76 | 76 | // Quit without doing anything if required variables are not set. |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | // Configure @action URL for form. |
| 134 | 134 | $uri = $this->uriBuilder->reset() |
| 135 | 135 | ->setTargetPageUid($GLOBALS['TSFE']->id) |
| 136 | - ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? true : false) |
|
| 136 | + ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE) |
|
| 137 | 137 | ->setArguments([ |
| 138 | 138 | 'eID' => 'tx_dlf_pageview_proxy', |
| 139 | 139 | 'url' => $fulltext['url'], |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | if ($iiif instanceof ManifestInterface) { |
| 198 | 198 | $canvas = $iiif->getContainedResourceById($canvasId); |
| 199 | 199 | /* @var $canvas \Ubl\Iiif\Presentation\Common\Model\Resources\CanvasInterface */ |
| 200 | - if ($canvas != null && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
| 200 | + if ($canvas != NULL && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
| 201 | 201 | $annotationContainers = []; |
| 202 | 202 | /* |
| 203 | 203 | * TODO Analyzing the annotations on the server side requires loading the annotation lists / pages |
@@ -207,11 +207,11 @@ discard block |
||
| 207 | 207 | * On the other hand, server connections are potentially better than client connections. Downloading annotation lists |
| 208 | 208 | */ |
| 209 | 209 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 210 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
| 210 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
| 211 | 211 | foreach ($textAnnotations as $annotation) { |
| 212 | 212 | if ( |
| 213 | 213 | $annotation->getBody()->getFormat() == 'text/plain' |
| 214 | - && $annotation->getBody()->getChars() != null |
|
| 214 | + && $annotation->getBody()->getChars() != NULL |
|
| 215 | 215 | ) { |
| 216 | 216 | $annotationListData = []; |
| 217 | 217 | $annotationListData['uri'] = $annotationContainer->getId(); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | // Configure @action URL for form. |
| 260 | 260 | $uri = $this->uriBuilder->reset() |
| 261 | 261 | ->setTargetPageUid($GLOBALS['TSFE']->id) |
| 262 | - ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? true : false) |
|
| 262 | + ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE) |
|
| 263 | 263 | ->setArguments([ |
| 264 | 264 | 'eID' => 'tx_dlf_pageview_proxy', |
| 265 | 265 | 'url' => $image['url'], |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | * @subpackage dlf |
| 32 | 32 | * @access public |
| 33 | 33 | */ |
| 34 | -class Helper |
|
| 35 | -{ |
|
| 34 | +class Helper { |
|
| 36 | 35 | /** |
| 37 | 36 | * The extension key |
| 38 | 37 | * |
@@ -80,8 +79,7 @@ discard block |
||
| 80 | 79 | * |
| 81 | 80 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
| 82 | 81 | */ |
| 83 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
| 84 | - { |
|
| 82 | + public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') { |
|
| 85 | 83 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 86 | 84 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 87 | 85 | $flashMessage = GeneralUtility::makeInstance( |
@@ -106,8 +104,7 @@ discard block |
||
| 106 | 104 | * |
| 107 | 105 | * @return bool Is $id a valid GNL identifier of the given $type? |
| 108 | 106 | */ |
| 109 | - public static function checkIdentifier($id, $type) |
|
| 110 | - { |
|
| 107 | + public static function checkIdentifier($id, $type) { |
|
| 111 | 108 | $digits = substr($id, 0, 8); |
| 112 | 109 | $checksum = 0; |
| 113 | 110 | for ($i = 0, $j = strlen($digits); $i < $j; $i++) { |
@@ -171,8 +168,7 @@ discard block |
||
| 171 | 168 | * |
| 172 | 169 | * @return mixed The decrypted value or false on error |
| 173 | 170 | */ |
| 174 | - public static function decrypt($encrypted) |
|
| 175 | - { |
|
| 171 | + public static function decrypt($encrypted) { |
|
| 176 | 172 | if ( |
| 177 | 173 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 178 | 174 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -211,8 +207,7 @@ discard block |
||
| 211 | 207 | * |
| 212 | 208 | * @return \SimpleXMLElement|false |
| 213 | 209 | */ |
| 214 | - public static function getXmlFileAsString($content) |
|
| 215 | - { |
|
| 210 | + public static function getXmlFileAsString($content) { |
|
| 216 | 211 | // Don't make simplexml_load_string throw (when $content is an array |
| 217 | 212 | // or object) |
| 218 | 213 | if (!is_string($content)) { |
@@ -243,8 +238,7 @@ discard block |
||
| 243 | 238 | * |
| 244 | 239 | * @return void |
| 245 | 240 | */ |
| 246 | - public static function log($message, $severity = 0) |
|
| 247 | - { |
|
| 241 | + public static function log($message, $severity = 0) { |
|
| 248 | 242 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_called_class()); |
| 249 | 243 | |
| 250 | 244 | switch ($severity) { |
@@ -274,8 +268,7 @@ discard block |
||
| 274 | 268 | * |
| 275 | 269 | * @return mixed Hashed string or false on error |
| 276 | 270 | */ |
| 277 | - public static function digest($string) |
|
| 278 | - { |
|
| 271 | + public static function digest($string) { |
|
| 279 | 272 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
| 280 | 273 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
| 281 | 274 | return false; |
@@ -294,8 +287,7 @@ discard block |
||
| 294 | 287 | * |
| 295 | 288 | * @return mixed Encrypted string or false on error |
| 296 | 289 | */ |
| 297 | - public static function encrypt($string) |
|
| 298 | - { |
|
| 290 | + public static function encrypt($string) { |
|
| 299 | 291 | if ( |
| 300 | 292 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 301 | 293 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -328,8 +320,7 @@ discard block |
||
| 328 | 320 | * |
| 329 | 321 | * @return string The unqualified class name |
| 330 | 322 | */ |
| 331 | - public static function getUnqualifiedClassName($qualifiedClassname) |
|
| 332 | - { |
|
| 323 | + public static function getUnqualifiedClassName($qualifiedClassname) { |
|
| 333 | 324 | $nameParts = explode('\\', $qualifiedClassname); |
| 334 | 325 | return end($nameParts); |
| 335 | 326 | } |
@@ -343,8 +334,7 @@ discard block |
||
| 343 | 334 | * |
| 344 | 335 | * @return string The cleaned up string |
| 345 | 336 | */ |
| 346 | - public static function getCleanString($string) |
|
| 347 | - { |
|
| 337 | + public static function getCleanString($string) { |
|
| 348 | 338 | // Convert to lowercase. |
| 349 | 339 | $string = strtolower($string); |
| 350 | 340 | // Remove non-alphanumeric characters. |
@@ -365,8 +355,7 @@ discard block |
||
| 365 | 355 | * |
| 366 | 356 | * @return array Array of hook objects for the class |
| 367 | 357 | */ |
| 368 | - public static function getHookObjects($scriptRelPath) |
|
| 369 | - { |
|
| 358 | + public static function getHookObjects($scriptRelPath) { |
|
| 370 | 359 | $hookObjects = []; |
| 371 | 360 | if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
| 372 | 361 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
@@ -387,8 +376,7 @@ discard block |
||
| 387 | 376 | * |
| 388 | 377 | * @return string "index_name" for the given UID |
| 389 | 378 | */ |
| 390 | - public static function getIndexNameFromUid($uid, $table, $pid = -1) |
|
| 391 | - { |
|
| 379 | + public static function getIndexNameFromUid($uid, $table, $pid = -1) { |
|
| 392 | 380 | // Sanitize input. |
| 393 | 381 | $uid = max(intval($uid), 0); |
| 394 | 382 | if ( |
@@ -438,8 +426,7 @@ discard block |
||
| 438 | 426 | * |
| 439 | 427 | * @return string Localized full name of language or unchanged input |
| 440 | 428 | */ |
| 441 | - public static function getLanguageName($code) |
|
| 442 | - { |
|
| 429 | + public static function getLanguageName($code) { |
|
| 443 | 430 | // Analyze code and set appropriate ISO table. |
| 444 | 431 | $isoCode = strtolower(trim($code)); |
| 445 | 432 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
@@ -481,8 +468,7 @@ discard block |
||
| 481 | 468 | * |
| 482 | 469 | * @return array |
| 483 | 470 | */ |
| 484 | - public static function getDocumentStructures($pid = -1) |
|
| 485 | - { |
|
| 471 | + public static function getDocumentStructures($pid = -1) { |
|
| 486 | 472 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
| 487 | 473 | $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_structures'); |
| 488 | 474 | |
@@ -522,8 +508,7 @@ discard block |
||
| 522 | 508 | * |
| 523 | 509 | * @return string Uniform Resource Name as string |
| 524 | 510 | */ |
| 525 | - public static function getURN($base, $id) |
|
| 526 | - { |
|
| 511 | + public static function getURN($base, $id) { |
|
| 527 | 512 | $concordance = [ |
| 528 | 513 | '0' => 1, |
| 529 | 514 | '1' => 2, |
@@ -590,8 +575,7 @@ discard block |
||
| 590 | 575 | * |
| 591 | 576 | * @return bool Is $id a valid PPN? |
| 592 | 577 | */ |
| 593 | - public static function isPPN($id) |
|
| 594 | - { |
|
| 578 | + public static function isPPN($id) { |
|
| 595 | 579 | return self::checkIdentifier($id, 'PPN'); |
| 596 | 580 | } |
| 597 | 581 | |
@@ -602,8 +586,7 @@ discard block |
||
| 602 | 586 | * |
| 603 | 587 | * @return bool |
| 604 | 588 | */ |
| 605 | - public static function isValidHttpUrl($url) |
|
| 606 | - { |
|
| 589 | + public static function isValidHttpUrl($url) { |
|
| 607 | 590 | if (!GeneralUtility::isValidUrl($url)) { |
| 608 | 591 | return false; |
| 609 | 592 | } |
@@ -629,8 +612,7 @@ discard block |
||
| 629 | 612 | * |
| 630 | 613 | * @return array Merged array |
| 631 | 614 | */ |
| 632 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
| 633 | - { |
|
| 615 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) { |
|
| 634 | 616 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 635 | 617 | return $original; |
| 636 | 618 | } |
@@ -644,8 +626,7 @@ discard block |
||
| 644 | 626 | * |
| 645 | 627 | * @return string All flash messages in the queue rendered as HTML. |
| 646 | 628 | */ |
| 647 | - public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') |
|
| 648 | - { |
|
| 629 | + public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') { |
|
| 649 | 630 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 650 | 631 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 651 | 632 | $flashMessages = $flashMessageQueue->getAllMessagesAndFlush(); |
@@ -665,8 +646,7 @@ discard block |
||
| 665 | 646 | * |
| 666 | 647 | * @return string Localized label for $index_name |
| 667 | 648 | */ |
| 668 | - public static function translate($index_name, $table, $pid) |
|
| 669 | - { |
|
| 649 | + public static function translate($index_name, $table, $pid) { |
|
| 670 | 650 | // Load labels into static variable for future use. |
| 671 | 651 | static $labels = []; |
| 672 | 652 | // Sanitize input. |
@@ -794,8 +774,7 @@ discard block |
||
| 794 | 774 | * |
| 795 | 775 | * @return string Additional WHERE expression |
| 796 | 776 | */ |
| 797 | - public static function whereExpression($table, $showHidden = false) |
|
| 798 | - { |
|
| 777 | + public static function whereExpression($table, $showHidden = false) { |
|
| 799 | 778 | if (\TYPO3_MODE === 'FE') { |
| 800 | 779 | // Should we ignore the record's hidden flag? |
| 801 | 780 | $ignoreHide = 0; |
@@ -827,8 +806,7 @@ discard block |
||
| 827 | 806 | * |
| 828 | 807 | * @access private |
| 829 | 808 | */ |
| 830 | - private function __construct() |
|
| 831 | - { |
|
| 809 | + private function __construct() { |
|
| 832 | 810 | // This is a static class, thus no instances should be created. |
| 833 | 811 | } |
| 834 | 812 | |
@@ -854,8 +832,7 @@ discard block |
||
| 854 | 832 | * |
| 855 | 833 | * @access public |
| 856 | 834 | */ |
| 857 | - public static function polyfillExtbaseClassesForTYPO3v9() |
|
| 858 | - { |
|
| 835 | + public static function polyfillExtbaseClassesForTYPO3v9() { |
|
| 859 | 836 | $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php'; |
| 860 | 837 | |
| 861 | 838 | $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
@@ -892,8 +869,7 @@ discard block |
||
| 892 | 869 | * |
| 893 | 870 | * @return string|bool |
| 894 | 871 | */ |
| 895 | - public static function getUrl(string $url) |
|
| 896 | - { |
|
| 872 | + public static function getUrl(string $url) { |
|
| 897 | 873 | if (!Helper::isValidHttpUrl($url)) { |
| 898 | 874 | return false; |
| 899 | 875 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
| 82 | 82 | */ |
| 83 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
| 83 | + public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages') |
|
| 84 | 84 | { |
| 85 | 85 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 86 | 86 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
@@ -122,9 +122,9 @@ discard block |
||
| 122 | 122 | $checksum = 'X'; |
| 123 | 123 | } |
| 124 | 124 | if (!preg_match('/[0-9]{8}[0-9X]{1}/i', $id)) { |
| 125 | - return false; |
|
| 125 | + return FALSE; |
|
| 126 | 126 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 127 | - return false; |
|
| 127 | + return FALSE; |
|
| 128 | 128 | } |
| 129 | 129 | break; |
| 130 | 130 | case 'ZDB': |
@@ -132,19 +132,19 @@ discard block |
||
| 132 | 132 | $checksum = 'X'; |
| 133 | 133 | } |
| 134 | 134 | if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) { |
| 135 | - return false; |
|
| 135 | + return FALSE; |
|
| 136 | 136 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 137 | - return false; |
|
| 137 | + return FALSE; |
|
| 138 | 138 | } |
| 139 | 139 | break; |
| 140 | 140 | case 'SWD': |
| 141 | 141 | $checksum = 11 - $checksum; |
| 142 | 142 | if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) { |
| 143 | - return false; |
|
| 143 | + return FALSE; |
|
| 144 | 144 | } elseif ($checksum == 10) { |
| 145 | 145 | return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
| 146 | 146 | } elseif (substr($id, -1, 1) != $checksum) { |
| 147 | - return false; |
|
| 147 | + return FALSE; |
|
| 148 | 148 | } |
| 149 | 149 | break; |
| 150 | 150 | case 'GKD': |
@@ -153,13 +153,13 @@ discard block |
||
| 153 | 153 | $checksum = 'X'; |
| 154 | 154 | } |
| 155 | 155 | if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) { |
| 156 | - return false; |
|
| 156 | + return FALSE; |
|
| 157 | 157 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 158 | - return false; |
|
| 158 | + return FALSE; |
|
| 159 | 159 | } |
| 160 | 160 | break; |
| 161 | 161 | } |
| 162 | - return true; |
|
| 162 | + return TRUE; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -174,28 +174,28 @@ discard block |
||
| 174 | 174 | public static function decrypt($encrypted) |
| 175 | 175 | { |
| 176 | 176 | if ( |
| 177 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
| 178 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
| 177 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
| 178 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
| 179 | 179 | ) { |
| 180 | 180 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
| 181 | - return false; |
|
| 181 | + return FALSE; |
|
| 182 | 182 | } |
| 183 | 183 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
| 184 | 184 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
| 185 | - return false; |
|
| 185 | + return FALSE; |
|
| 186 | 186 | } |
| 187 | 187 | if ( |
| 188 | 188 | empty($encrypted) |
| 189 | 189 | || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm) |
| 190 | 190 | ) { |
| 191 | 191 | self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR); |
| 192 | - return false; |
|
| 192 | + return FALSE; |
|
| 193 | 193 | } |
| 194 | 194 | // Split initialisation vector and encrypted data. |
| 195 | 195 | $binary = base64_decode($encrypted); |
| 196 | 196 | $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 197 | 197 | $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 198 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
| 198 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
| 199 | 199 | // Decrypt data. |
| 200 | 200 | $decrypted = openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 201 | 201 | return $decrypted; |
@@ -216,13 +216,13 @@ discard block |
||
| 216 | 216 | // Don't make simplexml_load_string throw (when $content is an array |
| 217 | 217 | // or object) |
| 218 | 218 | if (!is_string($content)) { |
| 219 | - return false; |
|
| 219 | + return FALSE; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | // Turn off libxml's error logging. |
| 223 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
| 223 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
| 224 | 224 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
| 225 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
| 225 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
| 226 | 226 | // Try to load XML from file. |
| 227 | 227 | $xml = simplexml_load_string($content); |
| 228 | 228 | // reset entity loader setting |
@@ -276,9 +276,9 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | public static function digest($string) |
| 278 | 278 | { |
| 279 | - if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
|
| 279 | + if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) { |
|
| 280 | 280 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
| 281 | - return false; |
|
| 281 | + return FALSE; |
|
| 282 | 282 | } |
| 283 | 283 | // Hash string. |
| 284 | 284 | $hashed = openssl_digest($string, self::$hashAlgorithm); |
@@ -297,23 +297,23 @@ discard block |
||
| 297 | 297 | public static function encrypt($string) |
| 298 | 298 | { |
| 299 | 299 | if ( |
| 300 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
| 301 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
| 300 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
| 301 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
| 302 | 302 | ) { |
| 303 | 303 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
| 304 | - return false; |
|
| 304 | + return FALSE; |
|
| 305 | 305 | } |
| 306 | 306 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
| 307 | 307 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
| 308 | - return false; |
|
| 308 | + return FALSE; |
|
| 309 | 309 | } |
| 310 | 310 | // Generate random initialisation vector. |
| 311 | 311 | $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 312 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
| 312 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
| 313 | 313 | // Encrypt data. |
| 314 | 314 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 315 | 315 | // Merge initialisation vector and encrypted data. |
| 316 | - if ($encrypted !== false) { |
|
| 316 | + if ($encrypted !== FALSE) { |
|
| 317 | 317 | $encrypted = base64_encode($iv . $encrypted); |
| 318 | 318 | } |
| 319 | 319 | return $encrypted; |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | $lang = $languageService->getLLL($isoCode, $iso639); |
| 459 | 459 | } |
| 460 | 460 | } elseif (\TYPO3_MODE === 'BE') { |
| 461 | - $iso639 = $languageService->includeLLFile($file, false, true); |
|
| 461 | + $iso639 = $languageService->includeLLFile($file, FALSE, TRUE); |
|
| 462 | 462 | if (!empty($iso639['default'][$isoCode])) { |
| 463 | 463 | $lang = $languageService->getLLL($isoCode, $iso639); |
| 464 | 464 | } |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | public static function isValidHttpUrl($url) |
| 606 | 606 | { |
| 607 | 607 | if (!GeneralUtility::isValidUrl($url)) { |
| 608 | - return false; |
|
| 608 | + return FALSE; |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | $parsed = parse_url($url); |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | * |
| 630 | 630 | * @return array Merged array |
| 631 | 631 | */ |
| 632 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
| 632 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE) |
|
| 633 | 633 | { |
| 634 | 634 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 635 | 635 | return $original; |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | ->where( |
| 702 | 702 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 703 | 703 | $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
| 704 | - self::whereExpression($table, true) |
|
| 704 | + self::whereExpression($table, TRUE) |
|
| 705 | 705 | ) |
| 706 | 706 | ->setMaxResults(1) |
| 707 | 707 | ->execute(); |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 720 | 720 | $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
| 721 | 721 | $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())), |
| 722 | - self::whereExpression($table, true) |
|
| 722 | + self::whereExpression($table, TRUE) |
|
| 723 | 723 | ) |
| 724 | 724 | ->setMaxResults(1) |
| 725 | 725 | ->execute(); |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | ->where( |
| 755 | 755 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 756 | 756 | $additionalWhere, |
| 757 | - self::whereExpression($table, true) |
|
| 757 | + self::whereExpression($table, TRUE) |
|
| 758 | 758 | ) |
| 759 | 759 | ->setMaxResults(10000) |
| 760 | 760 | ->execute(); |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | * |
| 795 | 795 | * @return string Additional WHERE expression |
| 796 | 796 | */ |
| 797 | - public static function whereExpression($table, $showHidden = false) |
|
| 797 | + public static function whereExpression($table, $showHidden = FALSE) |
|
| 798 | 798 | { |
| 799 | 799 | if (\TYPO3_MODE === 'FE') { |
| 800 | 800 | // Should we ignore the record's hidden flag? |
@@ -863,13 +863,13 @@ discard block |
||
| 863 | 863 | $frameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); |
| 864 | 864 | |
| 865 | 865 | $extbaseClassmap = &$frameworkConfiguration['persistence']['classes']; |
| 866 | - if ($extbaseClassmap === null) { |
|
| 866 | + if ($extbaseClassmap === NULL) { |
|
| 867 | 867 | $extbaseClassmap = []; |
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | foreach ($classes as $className => $classConfig) { |
| 871 | 871 | $extbaseClass = &$extbaseClassmap[$className]; |
| 872 | - if ($extbaseClass === null) { |
|
| 872 | + if ($extbaseClass === NULL) { |
|
| 873 | 873 | $extbaseClass = []; |
| 874 | 874 | } |
| 875 | 875 | if (!isset($extbaseClass['mapping'])) { |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | public static function getUrl(string $url) |
| 896 | 896 | { |
| 897 | 897 | if (!Helper::isValidHttpUrl($url)) { |
| 898 | - return false; |
|
| 898 | + return FALSE; |
|
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | // Get extension configuration. |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $parent->setDoc($doc); |
| 116 | 116 | $success = self::add($parent); |
| 117 | 117 | } else { |
| 118 | - Helper::log('Could not load parent document with UID ' . $document->getDoc()->parentId, LOG_SEVERITY_ERROR); |
|
| 118 | + Helper::log('Could not load parent document with UID '.$document->getDoc()->parentId, LOG_SEVERITY_ERROR); |
|
| 119 | 119 | return false; |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | self::$processedDocs[] = $document->getUid(); |
| 126 | 126 | // Delete old Solr documents. |
| 127 | 127 | $updateQuery = self::$solr->service->createUpdate(); |
| 128 | - $updateQuery->addDeleteQuery('uid:' . $document->getUid()); |
|
| 128 | + $updateQuery->addDeleteQuery('uid:'.$document->getUid()); |
|
| 129 | 129 | self::$solr->service->update($updateQuery); |
| 130 | 130 | |
| 131 | 131 | // Index every logical unit as separate Solr document. |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | } catch (\Exception $e) { |
| 175 | 175 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 176 | 176 | Helper::addMessage( |
| 177 | - Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()), |
|
| 177 | + Helper::getLanguageService()->getLL('flash.solrException').' '.htmlspecialchars($e->getMessage()), |
|
| 178 | 178 | Helper::getLanguageService()->getLL('flash.error'), |
| 179 | 179 | FlashMessage::ERROR, |
| 180 | 180 | true, |
| 181 | 181 | 'core.template.flashMessages' |
| 182 | 182 | ); |
| 183 | 183 | } |
| 184 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
| 184 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
| 185 | 185 | return false; |
| 186 | 186 | } |
| 187 | 187 | } else { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | // Sanitize input. |
| 215 | 215 | $pid = max(intval($pid), 0); |
| 216 | 216 | if (!$pid) { |
| 217 | - Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR); |
|
| 217 | + Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR); |
|
| 218 | 218 | return ''; |
| 219 | 219 | } |
| 220 | 220 | // Load metadata configuration. |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u'); |
| 224 | 224 | $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u'); |
| 225 | 225 | $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u'); |
| 226 | - $index_name .= '_' . $suffix; |
|
| 226 | + $index_name .= '_'.$suffix; |
|
| 227 | 227 | return $index_name; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -356,11 +356,11 @@ discard block |
||
| 356 | 356 | $solrDoc->setField(self::getIndexFieldName($index_name, $document->getPid()), $data, self::$fields['fieldboost'][$index_name]); |
| 357 | 357 | if (in_array($index_name, self::$fields['sortables'])) { |
| 358 | 358 | // Add sortable fields to index. |
| 359 | - $solrDoc->setField($index_name . '_sorting', $metadata[$index_name . '_sorting'][0]); |
|
| 359 | + $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]); |
|
| 360 | 360 | } |
| 361 | 361 | if (in_array($index_name, self::$fields['facets'])) { |
| 362 | 362 | // Add facets to index. |
| 363 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
| 363 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
| 364 | 364 | } |
| 365 | 365 | if (in_array($index_name, self::$fields['autocomplete'])) { |
| 366 | 366 | $autocomplete = array_merge($autocomplete, $data); |
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | } catch (\Exception $e) { |
| 386 | 386 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 387 | 387 | Helper::addMessage( |
| 388 | - Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 388 | + Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($e->getMessage()), |
|
| 389 | 389 | Helper::getLanguageService()->getLL('flash.error'), |
| 390 | 390 | FlashMessage::ERROR, |
| 391 | 391 | true, |
| 392 | 392 | 'core.template.flashMessages' |
| 393 | 393 | ); |
| 394 | 394 | } |
| 395 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
| 395 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
| 396 | 396 | return false; |
| 397 | 397 | } |
| 398 | 398 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | $data = self::removeAppendsFromAuthor($data); |
| 459 | 459 | } |
| 460 | 460 | // Add facets to index. |
| 461 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
| 461 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | 464 | } |
@@ -476,14 +476,14 @@ discard block |
||
| 476 | 476 | } catch (\Exception $e) { |
| 477 | 477 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 478 | 478 | Helper::addMessage( |
| 479 | - Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 479 | + Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($e->getMessage()), |
|
| 480 | 480 | Helper::getLanguageService()->getLL('flash.error'), |
| 481 | 481 | FlashMessage::ERROR, |
| 482 | 482 | true, |
| 483 | 483 | 'core.template.flashMessages' |
| 484 | 484 | ); |
| 485 | 485 | } |
| 486 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
| 486 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
| 487 | 487 | return false; |
| 488 | 488 | } |
| 489 | 489 | } |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | private static function getSolrDocument($updateQuery, $document, $unit, $fullText = '') { |
| 535 | 535 | $solrDoc = $updateQuery->createDocument(); |
| 536 | 536 | // Create unique identifier from document's UID and unit's XML ID. |
| 537 | - $solrDoc->setField('id', $document->getUid() . $unit['id']); |
|
| 537 | + $solrDoc->setField('id', $document->getUid().$unit['id']); |
|
| 538 | 538 | $solrDoc->setField('uid', $document->getUid()); |
| 539 | 539 | $solrDoc->setField('pid', $document->getPid()); |
| 540 | 540 | $solrDoc->setField('partof', $document->getPartof()); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @var bool |
| 67 | 67 | * @access protected |
| 68 | 68 | */ |
| 69 | - protected static $fieldsLoaded = false; |
|
| 69 | + protected static $fieldsLoaded = FALSE; |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * List of already processed documents |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | public static function add(Document $document) |
| 97 | 97 | { |
| 98 | 98 | if (in_array($document->getUid(), self::$processedDocs)) { |
| 99 | - return true; |
|
| 99 | + return TRUE; |
|
| 100 | 100 | } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) { |
| 101 | - $success = true; |
|
| 101 | + $success = TRUE; |
|
| 102 | 102 | Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf'); |
| 103 | 103 | // Handle multi-volume documents. |
| 104 | 104 | if ($parentId = $document->getPartof()) { |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | $parent = $documentRepository->findByUid($parentId); |
| 111 | 111 | if ($parent) { |
| 112 | 112 | // get XML document of parent |
| 113 | - $doc = Doc::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], true); |
|
| 114 | - if ($doc !== null) { |
|
| 113 | + $doc = Doc::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], TRUE); |
|
| 114 | + if ($doc !== NULL) { |
|
| 115 | 115 | $parent->setDoc($doc); |
| 116 | 116 | $success = self::add($parent); |
| 117 | 117 | } else { |
| 118 | 118 | Helper::log('Could not load parent document with UID ' . $document->getDoc()->parentId, LOG_SEVERITY_ERROR); |
| 119 | - return false; |
|
| 119 | + return FALSE; |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | sprintf(Helper::getLanguageService()->getLL('flash.documentIndexed'), $document->getTitle(), $document->getUid()), |
| 158 | 158 | Helper::getLanguageService()->getLL('flash.done'), |
| 159 | 159 | FlashMessage::OK, |
| 160 | - true, |
|
| 160 | + TRUE, |
|
| 161 | 161 | 'core.template.flashMessages' |
| 162 | 162 | ); |
| 163 | 163 | } else { |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | sprintf(Helper::getLanguageService()->getLL('flash.documentNotIndexed'), $document->getTitle(), $document->getUid()), |
| 166 | 166 | Helper::getLanguageService()->getLL('flash.error'), |
| 167 | 167 | FlashMessage::ERROR, |
| 168 | - true, |
|
| 168 | + TRUE, |
|
| 169 | 169 | 'core.template.flashMessages' |
| 170 | 170 | ); |
| 171 | 171 | } |
@@ -177,12 +177,12 @@ discard block |
||
| 177 | 177 | Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()), |
| 178 | 178 | Helper::getLanguageService()->getLL('flash.error'), |
| 179 | 179 | FlashMessage::ERROR, |
| 180 | - true, |
|
| 180 | + TRUE, |
|
| 181 | 181 | 'core.template.flashMessages' |
| 182 | 182 | ); |
| 183 | 183 | } |
| 184 | 184 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
| 185 | - return false; |
|
| 185 | + return FALSE; |
|
| 186 | 186 | } |
| 187 | 187 | } else { |
| 188 | 188 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | Helper::getLanguageService()->getLL('flash.solrNoConnection'), |
| 191 | 191 | Helper::getLanguageService()->getLL('flash.warning'), |
| 192 | 192 | FlashMessage::WARNING, |
| 193 | - true, |
|
| 193 | + TRUE, |
|
| 194 | 194 | 'core.template.flashMessages' |
| 195 | 195 | ); |
| 196 | 196 | } |
| 197 | 197 | Helper::log('Could not connect to Apache Solr server', LOG_SEVERITY_ERROR); |
| 198 | - return false; |
|
| 198 | + return FALSE; |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | if ($indexing['index_boost'] > 0.0) { |
| 291 | 291 | self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']); |
| 292 | 292 | } else { |
| 293 | - self::$fields['fieldboost'][$indexing['index_name']] = false; |
|
| 293 | + self::$fields['fieldboost'][$indexing['index_name']] = FALSE; |
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | - self::$fieldsLoaded = true; |
|
| 296 | + self::$fieldsLoaded = TRUE; |
|
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | protected static function processLogical(Document $document, array $logicalUnit) |
| 311 | 311 | { |
| 312 | - $success = true; |
|
| 312 | + $success = TRUE; |
|
| 313 | 313 | $doc = $document->getDoc(); |
| 314 | 314 | $doc->cPid = $document->getPid(); |
| 315 | 315 | // Get metadata for logical unit. |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $solrDoc->setField('thumbnail', $doc->getFileLocation($logicalUnit['thumbnailId'])); |
| 334 | 334 | } |
| 335 | 335 | // There can be only one toplevel unit per UID, independently of backend configuration |
| 336 | - $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? true : false); |
|
| 336 | + $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? TRUE : FALSE); |
|
| 337 | 337 | $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
| 338 | 338 | $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
| 339 | 339 | $solrDoc->setField('record_id', $metadata['record_id'][0]); |
@@ -388,12 +388,12 @@ discard block |
||
| 388 | 388 | Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
| 389 | 389 | Helper::getLanguageService()->getLL('flash.error'), |
| 390 | 390 | FlashMessage::ERROR, |
| 391 | - true, |
|
| 391 | + TRUE, |
|
| 392 | 392 | 'core.template.flashMessages' |
| 393 | 393 | ); |
| 394 | 394 | } |
| 395 | 395 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
| 396 | - return false; |
|
| 396 | + return FALSE; |
|
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | // Check for child elements... |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | break; |
| 440 | 440 | } |
| 441 | 441 | } |
| 442 | - $solrDoc->setField('toplevel', false); |
|
| 442 | + $solrDoc->setField('toplevel', FALSE); |
|
| 443 | 443 | $solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']); |
| 444 | 444 | $solrDoc->setField('collection', $doc->metadataArray[$doc->toplevelId]['collection']); |
| 445 | 445 | |
@@ -479,15 +479,15 @@ discard block |
||
| 479 | 479 | Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
| 480 | 480 | Helper::getLanguageService()->getLL('flash.error'), |
| 481 | 481 | FlashMessage::ERROR, |
| 482 | - true, |
|
| 482 | + TRUE, |
|
| 483 | 483 | 'core.template.flashMessages' |
| 484 | 484 | ); |
| 485 | 485 | } |
| 486 | 486 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
| 487 | - return false; |
|
| 487 | + return FALSE; |
|
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | - return true; |
|
| 490 | + return TRUE; |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | /** |
@@ -513,10 +513,10 @@ discard block |
||
| 513 | 513 | self::loadIndexConf($pid); |
| 514 | 514 | } |
| 515 | 515 | } else { |
| 516 | - return false; |
|
| 516 | + return FALSE; |
|
| 517 | 517 | } |
| 518 | 518 | } |
| 519 | - return true; |
|
| 519 | + return TRUE; |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | /** |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | // Add uHash parameter to suggest parameter to make a basic protection of this form. |
| 163 | 163 | if ($this->settings['suggest']) { |
| 164 | - $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()) . Environment::getExtensionsPath(), 'SearchSuggest')); |
|
| 164 | + $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()).Environment::getExtensionsPath(), 'SearchSuggest')); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $this->view->assign('viewData', $this->viewData); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | // Get facets from plugin configuration. |
| 185 | 185 | $facets = []; |
| 186 | 186 | foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
| 187 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
| 187 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $this->view->assign('facetsMenu', $this->makeFacetsMenuArray($facets)); |
@@ -226,13 +226,13 @@ discard block |
||
| 226 | 226 | $searchParams = $this->searchParams; |
| 227 | 227 | if ( |
| 228 | 228 | (!empty($searchParams['fulltext'])) |
| 229 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches) |
|
| 229 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches) |
|
| 230 | 230 | ) { |
| 231 | 231 | // If the query already is a fulltext query e.g using the facets |
| 232 | 232 | $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1]; |
| 233 | 233 | // Search in fulltext field if applicable. Query must not be empty! |
| 234 | 234 | if (!empty($this->searchParams['query'])) { |
| 235 | - $search['query'] = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')'; |
|
| 235 | + $search['query'] = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')'; |
|
| 236 | 236 | } |
| 237 | 237 | } else { |
| 238 | 238 | // Retain given search field if valid. |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | in_array($searchParams['extOperator'][$i], $allowedOperators) |
| 257 | 257 | ) { |
| 258 | 258 | if (!empty($search['query'])) { |
| 259 | - $search['query'] .= ' ' . $searchParams['extOperator'][$i] . ' '; |
|
| 259 | + $search['query'] .= ' '.$searchParams['extOperator'][$i].' '; |
|
| 260 | 260 | } |
| 261 | - $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')'; |
|
| 261 | + $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')'; |
|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | $entryArray['doNotLinkIt'] = 0; |
| 384 | 384 | // Check if facet is already selected. |
| 385 | 385 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
| 386 | - $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
|
| 386 | + $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn); |
|
| 387 | 387 | if ($index !== false) { |
| 388 | 388 | // Facet is selected, thus remove it from filter. |
| 389 | 389 | unset($queryColumn[$index]); |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | } |
| 398 | 398 | } else { |
| 399 | 399 | // Facet is not selected, thus add it to filter. |
| 400 | - $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")'; |
|
| 400 | + $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")'; |
|
| 401 | 401 | $entryArray['ITEM_STATE'] = 'NO'; |
| 402 | 402 | } |
| 403 | 403 | $entryArray['queryColumn'] = $queryColumn; |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | * @subpackage dlf |
| 33 | 33 | * @access public |
| 34 | 34 | */ |
| 35 | -class SearchController extends AbstractController |
|
| 36 | -{ |
|
| 35 | +class SearchController extends AbstractController { |
|
| 37 | 36 | /** |
| 38 | 37 | * @var CollectionRepository |
| 39 | 38 | */ |
@@ -42,8 +41,7 @@ discard block |
||
| 42 | 41 | /** |
| 43 | 42 | * @param CollectionRepository $collectionRepository |
| 44 | 43 | */ |
| 45 | - public function injectCollectionRepository(CollectionRepository $collectionRepository) |
|
| 46 | - { |
|
| 44 | + public function injectCollectionRepository(CollectionRepository $collectionRepository) { |
|
| 47 | 45 | $this->collectionRepository = $collectionRepository; |
| 48 | 46 | } |
| 49 | 47 | |
@@ -55,8 +53,7 @@ discard block |
||
| 55 | 53 | /** |
| 56 | 54 | * @param MetadataRepository $metadataRepository |
| 57 | 55 | */ |
| 58 | - public function injectMetadataRepository(MetadataRepository $metadataRepository) |
|
| 59 | - { |
|
| 56 | + public function injectMetadataRepository(MetadataRepository $metadataRepository) { |
|
| 60 | 57 | $this->metadataRepository = $metadataRepository; |
| 61 | 58 | } |
| 62 | 59 | |
@@ -71,8 +68,7 @@ discard block |
||
| 71 | 68 | * |
| 72 | 69 | * @return void |
| 73 | 70 | */ |
| 74 | - public function searchAction() |
|
| 75 | - { |
|
| 71 | + public function searchAction() { |
|
| 76 | 72 | // if search was triggered, get search parameters from POST variables |
| 77 | 73 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
| 78 | 74 | |
@@ -87,8 +83,7 @@ discard block |
||
| 87 | 83 | * |
| 88 | 84 | * @return void |
| 89 | 85 | */ |
| 90 | - public function mainAction() |
|
| 91 | - { |
|
| 86 | + public function mainAction() { |
|
| 92 | 87 | $listViewSearch = false; |
| 93 | 88 | // Quit without doing anything if required variables are not set. |
| 94 | 89 | if (empty($this->settings['solrcore'])) { |
@@ -174,8 +169,7 @@ discard block |
||
| 174 | 169 | * |
| 175 | 170 | * @return string HTML output of facets menu |
| 176 | 171 | */ |
| 177 | - protected function addFacetsMenu() |
|
| 178 | - { |
|
| 172 | + protected function addFacetsMenu() { |
|
| 179 | 173 | // Quit without doing anything if no facets are configured. |
| 180 | 174 | if (empty($this->settings['facets']) && empty($this->settings['facetCollections'])) { |
| 181 | 175 | return ''; |
@@ -200,8 +194,7 @@ discard block |
||
| 200 | 194 | * |
| 201 | 195 | * @return array HMENU array |
| 202 | 196 | */ |
| 203 | - public function makeFacetsMenuArray($facets) |
|
| 204 | - { |
|
| 197 | + public function makeFacetsMenuArray($facets) { |
|
| 205 | 198 | $menuArray = []; |
| 206 | 199 | // Set default value for facet search. |
| 207 | 200 | $search = [ |
@@ -360,8 +353,7 @@ discard block |
||
| 360 | 353 | * |
| 361 | 354 | * @return array The array for the facet's menu entry |
| 362 | 355 | */ |
| 363 | - protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) |
|
| 364 | - { |
|
| 356 | + protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
| 365 | 357 | $entryArray = []; |
| 366 | 358 | // Translate value. |
| 367 | 359 | if ($field == 'owner_faceting') { |
@@ -412,8 +404,7 @@ discard block |
||
| 412 | 404 | * |
| 413 | 405 | * @return string The extended search form or an empty string |
| 414 | 406 | */ |
| 415 | - protected function addExtendedSearch() |
|
| 416 | - { |
|
| 407 | + protected function addExtendedSearch() { |
|
| 417 | 408 | // Quit without doing anything if no fields for extended search are selected. |
| 418 | 409 | if ( |
| 419 | 410 | empty($this->settings['extendedSlotCount']) |
@@ -5,10 +5,8 @@ |
||
| 5 | 5 | use Kitodo\Dlf\Common\Helper; |
| 6 | 6 | use TYPO3\TestingFramework\Core\Unit\UnitTestCase; |
| 7 | 7 | |
| 8 | -class HelperTest extends UnitTestCase |
|
| 9 | -{ |
|
| 10 | - public function assertInvalidXml($xml) |
|
| 11 | - { |
|
| 8 | +class HelperTest extends UnitTestCase { |
|
| 9 | + public function assertInvalidXml($xml) { |
|
| 12 | 10 | $result = Helper::getXmlFileAsString($xml); |
| 13 | 11 | $this->assertEquals(false, $result); |
| 14 | 12 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | public function assertInvalidXml($xml) |
| 11 | 11 | { |
| 12 | 12 | $result = Helper::getXmlFileAsString($xml); |
| 13 | - $this->assertEquals(false, $result); |
|
| 13 | + $this->assertEquals(FALSE, $result); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function invalidXmlYieldsFalse(): void |
| 21 | 21 | { |
| 22 | - $this->assertInvalidXml(false); |
|
| 23 | - $this->assertInvalidXml(null); |
|
| 22 | + $this->assertInvalidXml(FALSE); |
|
| 23 | + $this->assertInvalidXml(NULL); |
|
| 24 | 24 | $this->assertInvalidXml(1); |
| 25 | 25 | $this->assertInvalidXml([]); |
| 26 | 26 | $this->assertInvalidXml(new \stdClass()); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | <root> |
| 41 | 41 | <single /> |
| 42 | 42 | </root> |
| 43 | -XML; |
|
| 43 | +xml; |
|
| 44 | 44 | $node = Helper::getXmlFileAsString($xml); |
| 45 | 45 | $this->assertIsObject($node); |
| 46 | 46 | $this->assertEquals('root', $node->getName()); |
@@ -15,10 +15,10 @@ |
||
| 15 | 15 | preg_match("@.*/(?:acceptance|functional-[a-z0-9]+)@", $_SERVER['REQUEST_URI'], $matches); |
| 16 | 16 | |
| 17 | 17 | if (!empty($matches)) { |
| 18 | - $root = realpath($_SERVER['DOCUMENT_ROOT'] . $matches[0]); |
|
| 18 | + $root = realpath($_SERVER['DOCUMENT_ROOT'].$matches[0]); |
|
| 19 | 19 | if ($root !== false) { |
| 20 | - putenv('TYPO3_PATH_ROOT=' . $root); |
|
| 21 | - putenv('TYPO3_PATH_APP=' . $root); |
|
| 20 | + putenv('TYPO3_PATH_ROOT='.$root); |
|
| 21 | + putenv('TYPO3_PATH_APP='.$root); |
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
@@ -16,10 +16,10 @@ |
||
| 16 | 16 | |
| 17 | 17 | if (!empty($matches)) { |
| 18 | 18 | $root = realpath($_SERVER['DOCUMENT_ROOT'] . $matches[0]); |
| 19 | - if ($root !== false) { |
|
| 19 | + if ($root !== FALSE) { |
|
| 20 | 20 | putenv('TYPO3_PATH_ROOT=' . $root); |
| 21 | 21 | putenv('TYPO3_PATH_APP=' . $root); |
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -return false; |
|
| 25 | +return FALSE; |
|
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
| 71 | 71 | |
| 72 | 72 | if ($this->disableJsonWrappedResponse) { |
| 73 | - $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function ($ext) { |
|
| 73 | + $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function($ext) { |
|
| 74 | 74 | return $ext !== 'Resources/Core/Functional/Extensions/json_response'; |
| 75 | 75 | }); |
| 76 | 76 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
| 84 | 84 | |
| 85 | - $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/'; |
|
| 85 | + $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-'.$this->identifier.'/'; |
|
| 86 | 86 | $this->httpClient = new HttpClient([ |
| 87 | 87 | 'base_uri' => $this->baseUrl, |
| 88 | 88 | 'http_errors' => false, |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | protected function addSiteConfig($identifier, $baseUrl) |
| 128 | 128 | { |
| 129 | - $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
|
| 129 | + $siteConfig = Yaml::parseFile(__DIR__.'/../Fixtures/siteconfig.yaml'); |
|
| 130 | 130 | $siteConfig['base'] = $baseUrl; |
| 131 | 131 | $siteConfig['languages'][0]['base'] = $baseUrl; |
| 132 | 132 | |
| 133 | - $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier; |
|
| 133 | + $siteConfigPath = $this->instancePath.'/typo3conf/sites/'.$identifier; |
|
| 134 | 134 | @mkdir($siteConfigPath, 0775, true); |
| 135 | - file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
|
| 135 | + file_put_contents($siteConfigPath.'/config.yaml', Yaml::dump($siteConfig)); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | protected function initializeRepository(string $className, int $storagePid) |
@@ -12,8 +12,7 @@ discard block |
||
| 12 | 12 | * Base class for functional test cases. This provides some common configuration |
| 13 | 13 | * and collects utility methods for functional tests. |
| 14 | 14 | */ |
| 15 | -class FunctionalTestCase extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase |
|
| 16 | -{ |
|
| 15 | +class FunctionalTestCase extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase { |
|
| 17 | 16 | protected $testExtensionsToLoad = [ |
| 18 | 17 | 'typo3conf/ext/dlf', |
| 19 | 18 | ]; |
@@ -63,8 +62,7 @@ discard block |
||
| 63 | 62 | */ |
| 64 | 63 | protected $httpClient; |
| 65 | 64 | |
| 66 | - public function __construct() |
|
| 67 | - { |
|
| 65 | + public function __construct() { |
|
| 68 | 66 | parent::__construct(); |
| 69 | 67 | |
| 70 | 68 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
@@ -91,8 +89,7 @@ discard block |
||
| 91 | 89 | $this->addSiteConfig('dlf-testing', $this->baseUrl); |
| 92 | 90 | } |
| 93 | 91 | |
| 94 | - protected function getDlfConfiguration() |
|
| 95 | - { |
|
| 92 | + protected function getDlfConfiguration() { |
|
| 96 | 93 | return [ |
| 97 | 94 | 'solrFieldAutocomplete' => 'autocomplete', |
| 98 | 95 | 'solrFieldCollection' => 'collection', |
@@ -124,8 +121,7 @@ discard block |
||
| 124 | 121 | ]; |
| 125 | 122 | } |
| 126 | 123 | |
| 127 | - protected function addSiteConfig($identifier, $baseUrl) |
|
| 128 | - { |
|
| 124 | + protected function addSiteConfig($identifier, $baseUrl) { |
|
| 129 | 125 | $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
| 130 | 126 | $siteConfig['base'] = $baseUrl; |
| 131 | 127 | $siteConfig['languages'][0]['base'] = $baseUrl; |
@@ -135,8 +131,7 @@ discard block |
||
| 135 | 131 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
| 136 | 132 | } |
| 137 | 133 | |
| 138 | - protected function initializeRepository(string $className, int $storagePid) |
|
| 139 | - { |
|
| 134 | + protected function initializeRepository(string $className, int $storagePid) { |
|
| 140 | 135 | $repository = $this->objectManager->get($className); |
| 141 | 136 | |
| 142 | 137 | $querySettings = $this->objectManager->get(Typo3QuerySettings::class); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @var bool |
| 50 | 50 | */ |
| 51 | - protected $disableJsonWrappedResponse = false; |
|
| 51 | + protected $disableJsonWrappedResponse = FALSE; |
|
| 52 | 52 | |
| 53 | 53 | /** @var ObjectManager */ |
| 54 | 54 | protected $objectManager; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/'; |
| 86 | 86 | $this->httpClient = new HttpClient([ |
| 87 | 87 | 'base_uri' => $this->baseUrl, |
| 88 | - 'http_errors' => false, |
|
| 88 | + 'http_errors' => FALSE, |
|
| 89 | 89 | ]); |
| 90 | 90 | |
| 91 | 91 | $this->addSiteConfig('dlf-testing', $this->baseUrl); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $siteConfig['languages'][0]['base'] = $baseUrl; |
| 132 | 132 | |
| 133 | 133 | $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier; |
| 134 | - @mkdir($siteConfigPath, 0775, true); |
|
| 134 | + @mkdir($siteConfigPath, 0775, TRUE); |
|
| 135 | 135 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | ]); |
| 78 | 78 | |
| 79 | 79 | $this->assertEquals(200, $response->getStatusCode()); |
| 80 | - $this->assertEquals('This is some plain text test file.' . "\n", (string) $response->getBody()); |
|
| 80 | + $this->assertEquals('This is some plain text test file.'."\n", (string) $response->getBody()); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -6,19 +6,16 @@ |
||
| 6 | 6 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
| 7 | 7 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
| 8 | 8 | |
| 9 | -class PageViewProxyTest extends FunctionalTestCase |
|
| 10 | -{ |
|
| 9 | +class PageViewProxyTest extends FunctionalTestCase { |
|
| 11 | 10 | protected $disableJsonWrappedResponse = true; |
| 12 | 11 | |
| 13 | - protected function getDlfConfiguration() |
|
| 14 | - { |
|
| 12 | + protected function getDlfConfiguration() { |
|
| 15 | 13 | return array_merge(parent::getDlfConfiguration(), [ |
| 16 | 14 | 'enableInternalProxy' => true, |
| 17 | 15 | ]); |
| 18 | 16 | } |
| 19 | 17 | |
| 20 | - protected function queryProxy(array $query, string $method = 'GET') |
|
| 21 | - { |
|
| 18 | + protected function queryProxy(array $query, string $method = 'GET') { |
|
| 22 | 19 | $query['eID'] = 'tx_dlf_pageview_proxy'; |
| 23 | 20 | |
| 24 | 21 | return $this->httpClient->request($method, '', [ |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageViewProxyTest extends FunctionalTestCase |
| 10 | 10 | { |
| 11 | - protected $disableJsonWrappedResponse = true; |
|
| 11 | + protected $disableJsonWrappedResponse = TRUE; |
|
| 12 | 12 | |
| 13 | 13 | protected function getDlfConfiguration() |
| 14 | 14 | { |
| 15 | 15 | return array_merge(parent::getDlfConfiguration(), [ |
| 16 | - 'enableInternalProxy' => true, |
|
| 16 | + 'enableInternalProxy' => TRUE, |
|
| 17 | 17 | ]); |
| 18 | 18 | } |
| 19 | 19 | |