@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
| 74 | 74 | |
| 75 | - $collection = null; |
|
| 75 | + $collection = NULL; |
|
| 76 | 76 | if ($this->searchParams['collection'] && MathUtility::canBeInterpretedAsInteger($this->searchParams['collection'])) { |
| 77 | 77 | $collection = $this->collectionRepository->findByUid($this->searchParams['collection']); |
| 78 | 78 | } |
@@ -84,15 +84,15 @@ discard block |
||
| 84 | 84 | $GLOBALS['TSFE']->fe_user->setKey('ses', 'widgetPage', $widgetPage); |
| 85 | 85 | |
| 86 | 86 | // get all sortable metadata records |
| 87 | - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); |
|
| 87 | + $sortableMetadata = $this->metadataRepository->findByIsSortable(TRUE); |
|
| 88 | 88 | |
| 89 | 89 | // get all metadata records to be shown in results |
| 90 | - $listedMetadata = $this->metadataRepository->findByIsListed(true); |
|
| 90 | + $listedMetadata = $this->metadataRepository->findByIsListed(TRUE); |
|
| 91 | 91 | |
| 92 | 92 | $solrResults = []; |
| 93 | 93 | $numResults = 0; |
| 94 | 94 | if (is_array($this->searchParams) && !empty($this->searchParams)) { |
| 95 | - $solrResults = $this->documentRepository->findSolrByCollection($collection ? : null, $this->settings, $this->searchParams, $listedMetadata); |
|
| 95 | + $solrResults = $this->documentRepository->findSolrByCollection($collection ? : NULL, $this->settings, $this->searchParams, $listedMetadata); |
|
| 96 | 96 | $numResults = $solrResults->getNumFound(); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | if (!preg_match('/\d{8}-\d{1}/i', $id)) { |
| 144 | 144 | return false; |
| 145 | 145 | } elseif ($checksum == 10) { |
| 146 | - return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
|
| 146 | + return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD'); |
|
| 147 | 147 | } elseif (substr($id, -1, 1) != $checksum) { |
| 148 | 148 | return false; |
| 149 | 149 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 316 | 316 | // Merge initialisation vector and encrypted data. |
| 317 | 317 | if ($encrypted !== false) { |
| 318 | - $encrypted = base64_encode($iv . $encrypted); |
|
| 318 | + $encrypted = base64_encode($iv.$encrypted); |
|
| 319 | 319 | } |
| 320 | 320 | return $encrypted; |
| 321 | 321 | } |
@@ -369,8 +369,8 @@ discard block |
||
| 369 | 369 | public static function getHookObjects($scriptRelPath) |
| 370 | 370 | { |
| 371 | 371 | $hookObjects = []; |
| 372 | - if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
|
| 373 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
|
| 372 | + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) { |
|
| 373 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) { |
|
| 374 | 374 | $hookObjects[] = GeneralUtility::makeInstance($classRef); |
| 375 | 375 | } |
| 376 | 376 | } |
@@ -397,12 +397,12 @@ discard block |
||
| 397 | 397 | // NOTE: Only use tables that don't have too many entries! |
| 398 | 398 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
| 399 | 399 | ) { |
| 400 | - self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
| 400 | + self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
| 401 | 401 | return ''; |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - $makeCacheKey = function ($pid, $uid) { |
|
| 405 | - return $pid . '.' . $uid; |
|
| 404 | + $makeCacheKey = function($pid, $uid) { |
|
| 405 | + return $pid.'.'.$uid; |
|
| 406 | 406 | }; |
| 407 | 407 | |
| 408 | 408 | static $cache = []; |
@@ -412,9 +412,9 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | $result = $queryBuilder |
| 414 | 414 | ->select( |
| 415 | - $table . '.index_name AS index_name', |
|
| 416 | - $table . '.uid AS uid', |
|
| 417 | - $table . '.pid AS pid', |
|
| 415 | + $table.'.index_name AS index_name', |
|
| 416 | + $table.'.uid AS uid', |
|
| 417 | + $table.'.pid AS pid', |
|
| 418 | 418 | ) |
| 419 | 419 | ->from($table) |
| 420 | 420 | ->execute(); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $result = $cache[$table][$cacheKey] ?? ''; |
| 433 | 433 | |
| 434 | 434 | if ($result === '') { |
| 435 | - self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
| 435 | + self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | return $result; |
@@ -459,11 +459,11 @@ discard block |
||
| 459 | 459 | // No ISO code, return unchanged. |
| 460 | 460 | return $code; |
| 461 | 461 | } |
| 462 | - $lang = LocalizationUtility::translate('LLL:' . $file . ':' . $code); |
|
| 462 | + $lang = LocalizationUtility::translate('LLL:'.$file.':'.$code); |
|
| 463 | 463 | if (!empty($lang)) { |
| 464 | 464 | return $lang; |
| 465 | 465 | } else { |
| 466 | - self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
| 466 | + self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
| 467 | 467 | return $code; |
| 468 | 468 | } |
| 469 | 469 | } |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | '-' => 39, |
| 561 | 561 | ':' => 17, |
| 562 | 562 | ]; |
| 563 | - $urn = strtolower($base . $id); |
|
| 563 | + $urn = strtolower($base.$id); |
|
| 564 | 564 | if (preg_match('/[^a-z\d:-]/', $urn)) { |
| 565 | 565 | self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING); |
| 566 | 566 | return ''; |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | $checksum += ($i + 1) * intval(substr($digits, $i, 1)); |
| 575 | 575 | } |
| 576 | 576 | $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1); |
| 577 | - return $base . $id . $checksum; |
|
| 577 | + return $base.$id.$checksum; |
|
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | /** |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | // Sanitize input. |
| 669 | 669 | $pid = max(intval($pid), 0); |
| 670 | 670 | if (!$pid) { |
| 671 | - self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING); |
|
| 671 | + self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING); |
|
| 672 | 672 | return $index_name; |
| 673 | 673 | } |
| 674 | 674 | /** @var \TYPO3\CMS\Frontend\Page\PageRepository $pageRepository */ |
@@ -690,13 +690,13 @@ discard block |
||
| 690 | 690 | // First fetch the uid of the received index_name |
| 691 | 691 | $result = $queryBuilder |
| 692 | 692 | ->select( |
| 693 | - $table . '.uid AS uid', |
|
| 694 | - $table . '.l18n_parent AS l18n_parent' |
|
| 693 | + $table.'.uid AS uid', |
|
| 694 | + $table.'.l18n_parent AS l18n_parent' |
|
| 695 | 695 | ) |
| 696 | 696 | ->from($table) |
| 697 | 697 | ->where( |
| 698 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 699 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
|
| 698 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 699 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)), |
|
| 700 | 700 | self::whereExpression($table, true) |
| 701 | 701 | ) |
| 702 | 702 | ->setMaxResults(1) |
@@ -709,12 +709,12 @@ discard block |
||
| 709 | 709 | $resArray = $allResults[0]; |
| 710 | 710 | |
| 711 | 711 | $result = $queryBuilder |
| 712 | - ->select($table . '.index_name AS index_name') |
|
| 712 | + ->select($table.'.index_name AS index_name') |
|
| 713 | 713 | ->from($table) |
| 714 | 714 | ->where( |
| 715 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 716 | - $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
|
| 717 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())), |
|
| 715 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 716 | + $queryBuilder->expr()->eq($table.'.uid', $resArray['l18n_parent']), |
|
| 717 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId())), |
|
| 718 | 718 | self::whereExpression($table, true) |
| 719 | 719 | ) |
| 720 | 720 | ->setMaxResults(1) |
@@ -732,14 +732,14 @@ discard block |
||
| 732 | 732 | if (empty($labels[$table][$pid][$languageAspect->getContentId()][$index_name])) { |
| 733 | 733 | // Check if this table is allowed for translation. |
| 734 | 734 | if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) { |
| 735 | - $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]); |
|
| 735 | + $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]); |
|
| 736 | 736 | if ($languageAspect->getContentId() > 0) { |
| 737 | 737 | $additionalWhere = $queryBuilder->expr()->andX( |
| 738 | 738 | $queryBuilder->expr()->orX( |
| 739 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
| 740 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())) |
|
| 739 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
| 740 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId())) |
|
| 741 | 741 | ), |
| 742 | - $queryBuilder->expr()->eq($table . '.l18n_parent', 0) |
|
| 742 | + $queryBuilder->expr()->eq($table.'.l18n_parent', 0) |
|
| 743 | 743 | ); |
| 744 | 744 | } |
| 745 | 745 | |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | ->select('*') |
| 749 | 749 | ->from($table) |
| 750 | 750 | ->where( |
| 751 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 751 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 752 | 752 | $additionalWhere, |
| 753 | 753 | self::whereExpression($table, true) |
| 754 | 754 | ) |
@@ -766,10 +766,10 @@ discard block |
||
| 766 | 766 | } |
| 767 | 767 | } |
| 768 | 768 | } else { |
| 769 | - self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
| 769 | + self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
| 770 | 770 | } |
| 771 | 771 | } else { |
| 772 | - self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
| 772 | + self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | |
@@ -811,9 +811,9 @@ discard block |
||
| 811 | 811 | return GeneralUtility::makeInstance(ConnectionPool::class) |
| 812 | 812 | ->getQueryBuilderForTable($table) |
| 813 | 813 | ->expr() |
| 814 | - ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
| 814 | + ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
| 815 | 815 | } else { |
| 816 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
| 816 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
| 817 | 817 | return '1=-1'; |
| 818 | 818 | } |
| 819 | 819 | } |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | */ |
| 853 | 853 | public static function polyfillExtbaseClassesForTYPO3v9() |
| 854 | 854 | { |
| 855 | - $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php'; |
|
| 855 | + $classes = require __DIR__.'/../../Configuration/Extbase/Persistence/Classes.php'; |
|
| 856 | 856 | |
| 857 | 857 | $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
| 858 | 858 | $configurationManager = $objectManager->get(ConfigurationManager::class); |
@@ -908,10 +908,10 @@ discard block |
||
| 908 | 908 | try { |
| 909 | 909 | $response = $requestFactory->request($url, 'GET', $configuration); |
| 910 | 910 | } catch (\Exception $e) { |
| 911 | - self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
|
| 911 | + self::log('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.', LOG_SEVERITY_WARNING); |
|
| 912 | 912 | return false; |
| 913 | 913 | } |
| 914 | - $content = $response->getBody()->getContents(); |
|
| 914 | + $content = $response->getBody()->getContents(); |
|
| 915 | 915 | |
| 916 | 916 | return $content; |
| 917 | 917 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
| 83 | 83 | */ |
| 84 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
| 84 | + public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages') |
|
| 85 | 85 | { |
| 86 | 86 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 87 | 87 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
@@ -123,9 +123,9 @@ discard block |
||
| 123 | 123 | $checksum = 'X'; |
| 124 | 124 | } |
| 125 | 125 | if (!preg_match('/\d{8}[\dX]{1}/i', $id)) { |
| 126 | - return false; |
|
| 126 | + return FALSE; |
|
| 127 | 127 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 128 | - return false; |
|
| 128 | + return FALSE; |
|
| 129 | 129 | } |
| 130 | 130 | break; |
| 131 | 131 | case 'ZDB': |
@@ -133,19 +133,19 @@ discard block |
||
| 133 | 133 | $checksum = 'X'; |
| 134 | 134 | } |
| 135 | 135 | if (!preg_match('/\d{8}-[\dX]{1}/i', $id)) { |
| 136 | - return false; |
|
| 136 | + return FALSE; |
|
| 137 | 137 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 138 | - return false; |
|
| 138 | + return FALSE; |
|
| 139 | 139 | } |
| 140 | 140 | break; |
| 141 | 141 | case 'SWD': |
| 142 | 142 | $checksum = 11 - $checksum; |
| 143 | 143 | if (!preg_match('/\d{8}-\d{1}/i', $id)) { |
| 144 | - return false; |
|
| 144 | + return FALSE; |
|
| 145 | 145 | } elseif ($checksum == 10) { |
| 146 | 146 | return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
| 147 | 147 | } elseif (substr($id, -1, 1) != $checksum) { |
| 148 | - return false; |
|
| 148 | + return FALSE; |
|
| 149 | 149 | } |
| 150 | 150 | break; |
| 151 | 151 | case 'GKD': |
@@ -154,13 +154,13 @@ discard block |
||
| 154 | 154 | $checksum = 'X'; |
| 155 | 155 | } |
| 156 | 156 | if (!preg_match('/\d{8}-[\dX]{1}/i', $id)) { |
| 157 | - return false; |
|
| 157 | + return FALSE; |
|
| 158 | 158 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 159 | - return false; |
|
| 159 | + return FALSE; |
|
| 160 | 160 | } |
| 161 | 161 | break; |
| 162 | 162 | } |
| 163 | - return true; |
|
| 163 | + return TRUE; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -175,28 +175,28 @@ discard block |
||
| 175 | 175 | public static function decrypt($encrypted) |
| 176 | 176 | { |
| 177 | 177 | if ( |
| 178 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
| 179 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
| 178 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
| 179 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
| 180 | 180 | ) { |
| 181 | 181 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
| 182 | - return false; |
|
| 182 | + return FALSE; |
|
| 183 | 183 | } |
| 184 | 184 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
| 185 | 185 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
| 186 | - return false; |
|
| 186 | + return FALSE; |
|
| 187 | 187 | } |
| 188 | 188 | if ( |
| 189 | 189 | empty($encrypted) |
| 190 | 190 | || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm) |
| 191 | 191 | ) { |
| 192 | 192 | self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR); |
| 193 | - return false; |
|
| 193 | + return FALSE; |
|
| 194 | 194 | } |
| 195 | 195 | // Split initialisation vector and encrypted data. |
| 196 | 196 | $binary = base64_decode($encrypted); |
| 197 | 197 | $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 198 | 198 | $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 199 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
| 199 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
| 200 | 200 | // Decrypt data. |
| 201 | 201 | $decrypted = openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 202 | 202 | return $decrypted; |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | // Don't make simplexml_load_string throw (when $content is an array |
| 218 | 218 | // or object) |
| 219 | 219 | if (!is_string($content)) { |
| 220 | - return false; |
|
| 220 | + return FALSE; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | // Turn off libxml's error logging. |
| 224 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
| 224 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
| 225 | 225 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
| 226 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
| 226 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
| 227 | 227 | // Try to load XML from file. |
| 228 | 228 | $xml = simplexml_load_string($content); |
| 229 | 229 | // reset entity loader setting |
@@ -277,9 +277,9 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public static function digest($string) |
| 279 | 279 | { |
| 280 | - if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
|
| 280 | + if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) { |
|
| 281 | 281 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
| 282 | - return false; |
|
| 282 | + return FALSE; |
|
| 283 | 283 | } |
| 284 | 284 | // Hash string. |
| 285 | 285 | $hashed = openssl_digest($string, self::$hashAlgorithm); |
@@ -298,23 +298,23 @@ discard block |
||
| 298 | 298 | public static function encrypt($string) |
| 299 | 299 | { |
| 300 | 300 | if ( |
| 301 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
| 302 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
| 301 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
| 302 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
| 303 | 303 | ) { |
| 304 | 304 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
| 305 | - return false; |
|
| 305 | + return FALSE; |
|
| 306 | 306 | } |
| 307 | 307 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
| 308 | 308 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
| 309 | - return false; |
|
| 309 | + return FALSE; |
|
| 310 | 310 | } |
| 311 | 311 | // Generate random initialisation vector. |
| 312 | 312 | $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 313 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
| 313 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
| 314 | 314 | // Encrypt data. |
| 315 | 315 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 316 | 316 | // Merge initialisation vector and encrypted data. |
| 317 | - if ($encrypted !== false) { |
|
| 317 | + if ($encrypted !== FALSE) { |
|
| 318 | 318 | $encrypted = base64_encode($iv . $encrypted); |
| 319 | 319 | } |
| 320 | 320 | return $encrypted; |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | public static function isValidHttpUrl($url) |
| 602 | 602 | { |
| 603 | 603 | if (!GeneralUtility::isValidUrl($url)) { |
| 604 | - return false; |
|
| 604 | + return FALSE; |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | $parsed = parse_url($url); |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | * |
| 626 | 626 | * @return array Merged array |
| 627 | 627 | */ |
| 628 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
| 628 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE) |
|
| 629 | 629 | { |
| 630 | 630 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 631 | 631 | return $original; |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | ->where( |
| 698 | 698 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 699 | 699 | $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
| 700 | - self::whereExpression($table, true) |
|
| 700 | + self::whereExpression($table, TRUE) |
|
| 701 | 701 | ) |
| 702 | 702 | ->setMaxResults(1) |
| 703 | 703 | ->execute(); |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 716 | 716 | $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
| 717 | 717 | $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())), |
| 718 | - self::whereExpression($table, true) |
|
| 718 | + self::whereExpression($table, TRUE) |
|
| 719 | 719 | ) |
| 720 | 720 | ->setMaxResults(1) |
| 721 | 721 | ->execute(); |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | ->where( |
| 751 | 751 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 752 | 752 | $additionalWhere, |
| 753 | - self::whereExpression($table, true) |
|
| 753 | + self::whereExpression($table, TRUE) |
|
| 754 | 754 | ) |
| 755 | 755 | ->setMaxResults(10000) |
| 756 | 756 | ->execute(); |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | * |
| 791 | 791 | * @return string Additional WHERE expression |
| 792 | 792 | */ |
| 793 | - public static function whereExpression($table, $showHidden = false) |
|
| 793 | + public static function whereExpression($table, $showHidden = FALSE) |
|
| 794 | 794 | { |
| 795 | 795 | if (\TYPO3_MODE === 'FE') { |
| 796 | 796 | // Should we ignore the record's hidden flag? |
@@ -859,13 +859,13 @@ discard block |
||
| 859 | 859 | $frameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); |
| 860 | 860 | |
| 861 | 861 | $extbaseClassmap = &$frameworkConfiguration['persistence']['classes']; |
| 862 | - if ($extbaseClassmap === null) { |
|
| 862 | + if ($extbaseClassmap === NULL) { |
|
| 863 | 863 | $extbaseClassmap = []; |
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | foreach ($classes as $className => $classConfig) { |
| 867 | 867 | $extbaseClass = &$extbaseClassmap[$className]; |
| 868 | - if ($extbaseClass === null) { |
|
| 868 | + if ($extbaseClass === NULL) { |
|
| 869 | 869 | $extbaseClass = []; |
| 870 | 870 | } |
| 871 | 871 | if (!isset($extbaseClass['mapping'])) { |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | public static function getUrl(string $url) |
| 892 | 892 | { |
| 893 | 893 | if (!Helper::isValidHttpUrl($url)) { |
| 894 | - return false; |
|
| 894 | + return FALSE; |
|
| 895 | 895 | } |
| 896 | 896 | |
| 897 | 897 | // Get extension configuration. |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | $response = $requestFactory->request($url, 'GET', $configuration); |
| 910 | 910 | } catch (\Exception $e) { |
| 911 | 911 | self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
| 912 | - return false; |
|
| 912 | + return FALSE; |
|
| 913 | 913 | } |
| 914 | 914 | $content = $response->getBody()->getContents(); |
| 915 | 915 | |
@@ -15,10 +15,10 @@ |
||
| 15 | 15 | preg_match("@.*/(?:acceptance|functional-[a-z\d]+)@", $_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 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | // in which case metadata of toplevel entry isn't yet filled. |
| 99 | 99 | if (empty($document['metadata'])) { |
| 100 | 100 | $document['metadata'] = $this->fetchToplevelMetadataFromSolr([ |
| 101 | - 'query' => 'uid:' . $document['uid'], |
|
| 101 | + 'query' => 'uid:'.$document['uid'], |
|
| 102 | 102 | 'start' => 0, |
| 103 | 103 | 'rows' => 1, |
| 104 | 104 | 'sort' => ['score' => 'desc'], |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | if (empty($document['title']) && $document['partOf'] > 0) { |
| 110 | 110 | $superiorTitle = Doc::getTitle($document['partOf'], true); |
| 111 | 111 | if (!empty($superiorTitle)) { |
| 112 | - $document['title'] = '[' . $superiorTitle . ']'; |
|
| 112 | + $document['title'] = '['.$superiorTitle.']'; |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -172,13 +172,13 @@ discard block |
||
| 172 | 172 | // Set search query. |
| 173 | 173 | if ( |
| 174 | 174 | (!empty($this->searchParams['fulltext'])) |
| 175 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($this->searchParams['query']), $matches) |
|
| 175 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($this->searchParams['query']), $matches) |
|
| 176 | 176 | ) { |
| 177 | 177 | // If the query already is a fulltext query e.g using the facets |
| 178 | 178 | $this->searchParams['query'] = empty($matches[1]) ? $this->searchParams['query'] : $matches[1]; |
| 179 | 179 | // Search in fulltext field if applicable. Query must not be empty! |
| 180 | 180 | if (!empty($this->searchParams['query'])) { |
| 181 | - $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')'; |
|
| 181 | + $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($this->searchParams['query'])).')'; |
|
| 182 | 182 | } |
| 183 | 183 | $params['fulltext'] = true; |
| 184 | 184 | } else { |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | in_array($this->searchParams['extOperator'][$i], $allowedOperators) |
| 202 | 202 | ) { |
| 203 | 203 | if (!empty($query)) { |
| 204 | - $query .= ' ' . $this->searchParams['extOperator'][$i] . ' '; |
|
| 204 | + $query .= ' '.$this->searchParams['extOperator'][$i].' '; |
|
| 205 | 205 | } |
| 206 | - $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($this->searchParams['extQuery'][$i]) . ')'; |
|
| 206 | + $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($this->searchParams['extQuery'][$i]).')'; |
|
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | // Add filter query for date search |
| 213 | 213 | if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) { |
| 214 | 214 | // combine dateFrom and dateTo into range search |
| 215 | - $params['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}'. $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']'; |
|
| 215 | + $params['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']'; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // Add filter query for faceting. |
@@ -229,22 +229,22 @@ discard block |
||
| 229 | 229 | ) { |
| 230 | 230 | // Search in document and all subordinates (valid for up to three levels of hierarchy). |
| 231 | 231 | $params['filterquery'][]['query'] = '_query_:"{!join from=' |
| 232 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 233 | - . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 234 | - . $fields['uid'] . ':' . $this->searchParams['documentId'] . '"' . ' OR {!join from=' |
|
| 235 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 236 | - . $fields['uid'] . ':' . $this->searchParams['documentId'] . ' OR ' |
|
| 237 | - . $fields['uid'] . ':' . $this->searchParams['documentId']; |
|
| 232 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
| 233 | + . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}' |
|
| 234 | + . $fields['uid'].':'.$this->searchParams['documentId'].'"'.' OR {!join from=' |
|
| 235 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
| 236 | + . $fields['uid'].':'.$this->searchParams['documentId'].' OR ' |
|
| 237 | + . $fields['uid'].':'.$this->searchParams['documentId']; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | // if a collection is given, we prepare the collection query string |
| 241 | 241 | if ($this->collection) { |
| 242 | 242 | if ($this->collection instanceof Collection) { |
| 243 | - $collectionsQueryString = '"' . $this->collection->getIndexName() . '"'; |
|
| 243 | + $collectionsQueryString = '"'.$this->collection->getIndexName().'"'; |
|
| 244 | 244 | } else { |
| 245 | 245 | $collectionsQueryString = ''; |
| 246 | 246 | foreach ($this->collection as $index => $collectionEntry) { |
| 247 | - $collectionsQueryString .= ($index > 0 ? ' OR ' : '') . '"' . $collectionEntry->getIndexName() . '"'; |
|
| 247 | + $collectionsQueryString .= ($index > 0 ? ' OR ' : '').'"'.$collectionEntry->getIndexName().'"'; |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $params['filterquery'][]['query'] = 'toplevel:true'; |
| 253 | 253 | $params['filterquery'][]['query'] = 'partof:0'; |
| 254 | 254 | } |
| 255 | - $params['filterquery'][]['query'] = 'collection_faceting:(' . $collectionsQueryString . ')'; |
|
| 255 | + $params['filterquery'][]['query'] = 'collection_faceting:('.$collectionsQueryString.')'; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // Set some query parameters. |
@@ -279,8 +279,8 @@ discard block |
||
| 279 | 279 | if ($this->listedMetadata) { |
| 280 | 280 | foreach ($this->listedMetadata as $metadata) { |
| 281 | 281 | if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { |
| 282 | - $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 283 | - $params['fields'] .= ',' . $listMetadataRecord; |
|
| 282 | + $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 283 | + $params['fields'] .= ','.$listMetadataRecord; |
|
| 284 | 284 | $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord; |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -324,8 +324,8 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | if ($documents[$doc['uid']]) { |
| 326 | 326 | // translate language code if applicable |
| 327 | - if($doc['metadata']['language']) { |
|
| 328 | - foreach($doc['metadata']['language'] as $indexName => $language) { |
|
| 327 | + if ($doc['metadata']['language']) { |
|
| 328 | + foreach ($doc['metadata']['language'] as $indexName => $language) { |
|
| 329 | 329 | $doc['metadata']['language'][$indexName] = Helper::getLanguageName($doc['metadata']['language'][$indexName]); |
| 330 | 330 | } |
| 331 | 331 | } |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | $children = $childrenOf[$doc['uid']] ?? []; |
| 365 | 365 | if (!empty($children)) { |
| 366 | 366 | $metadataOf = $this->fetchToplevelMetadataFromSolr([ |
| 367 | - 'query' => 'partof:' . $doc['uid'], |
|
| 367 | + 'query' => 'partof:'.$doc['uid'], |
|
| 368 | 368 | 'start' => 0, |
| 369 | 369 | 'rows' => 100, |
| 370 | 370 | ]); |
@@ -411,8 +411,8 @@ discard block |
||
| 411 | 411 | if ($this->listedMetadata) { |
| 412 | 412 | foreach ($this->listedMetadata as $metadata) { |
| 413 | 413 | if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { |
| 414 | - $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 415 | - $params['fields'] .= ',' . $listMetadataRecord; |
|
| 414 | + $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 415 | + $params['fields'] .= ','.$listMetadataRecord; |
|
| 416 | 416 | $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord; |
| 417 | 417 | } |
| 418 | 418 | } |
@@ -425,8 +425,8 @@ discard block |
||
| 425 | 425 | |
| 426 | 426 | foreach ($result['documents'] as $doc) { |
| 427 | 427 | // translate language code if applicable |
| 428 | - if($doc['metadata']['language']) { |
|
| 429 | - foreach($doc['metadata']['language'] as $indexName => $language) { |
|
| 428 | + if ($doc['metadata']['language']) { |
|
| 429 | + foreach ($doc['metadata']['language'] as $indexName => $language) { |
|
| 430 | 430 | $doc['metadata']['language'][$indexName] = Helper::getLanguageName($doc['metadata']['language'][$indexName]); |
| 431 | 431 | } |
| 432 | 432 | } |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $cache = null; |
| 469 | 469 | // Calculate cache identifier. |
| 470 | 470 | if ($enableCache === true) { |
| 471 | - $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true)); |
|
| 471 | + $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true)); |
|
| 472 | 472 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 473 | 473 | } |
| 474 | 474 | $resultSet = [ |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param array $searchParams |
| 35 | 35 | * @param QueryResult $listedMetadata |
| 36 | 36 | */ |
| 37 | - public function __construct($documentRepository, $collection, $settings, $searchParams, $listedMetadata = null) |
|
| 37 | + public function __construct($documentRepository, $collection, $settings, $searchParams, $listedMetadata = NULL) |
|
| 38 | 38 | { |
| 39 | 39 | $this->documentRepository = $documentRepository; |
| 40 | 40 | $this->collection = $collection; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public function count() |
| 52 | 52 | { |
| 53 | - if ($this->result === null) { |
|
| 53 | + if ($this->result === NULL) { |
|
| 54 | 54 | return 0; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | public function offsetGet($offset) |
| 92 | 92 | { |
| 93 | 93 | $idx = $this->result['document_keys'][$offset]; |
| 94 | - $document = $this->result['documents'][$idx] ?? null; |
|
| 94 | + $document = $this->result['documents'][$idx] ?? NULL; |
|
| 95 | 95 | |
| 96 | - if ($document !== null) { |
|
| 96 | + if ($document !== NULL) { |
|
| 97 | 97 | // It may happen that a Solr group only includes non-toplevel results, |
| 98 | 98 | // in which case metadata of toplevel entry isn't yet filled. |
| 99 | 99 | if (empty($document['metadata'])) { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | // get title of parent/grandparent/... if empty |
| 109 | 109 | if (empty($document['title']) && $document['partOf'] > 0) { |
| 110 | - $superiorTitle = Doc::getTitle($document['partOf'], true); |
|
| 110 | + $superiorTitle = Doc::getTitle($document['partOf'], TRUE); |
|
| 111 | 111 | if (!empty($superiorTitle)) { |
| 112 | 112 | $document['title'] = '[' . $superiorTitle . ']'; |
| 113 | 113 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | if (!empty($this->searchParams['query'])) { |
| 181 | 181 | $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')'; |
| 182 | 182 | } |
| 183 | - $params['fulltext'] = true; |
|
| 183 | + $params['fulltext'] = TRUE; |
|
| 184 | 184 | } else { |
| 185 | 185 | // Retain given search field if valid. |
| 186 | 186 | if (!empty($this->searchParams['query'])) { |
@@ -289,17 +289,17 @@ discard block |
||
| 289 | 289 | $this->params = $params; |
| 290 | 290 | |
| 291 | 291 | // Send off query to get total number of search results in advance |
| 292 | - $this->submit(0, 1, false); |
|
| 292 | + $this->submit(0, 1, FALSE); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - public function submit($start, $rows, $processResults = true) |
|
| 295 | + public function submit($start, $rows, $processResults = TRUE) |
|
| 296 | 296 | { |
| 297 | 297 | $params = $this->params; |
| 298 | 298 | $params['start'] = $start; |
| 299 | 299 | $params['rows'] = $rows; |
| 300 | 300 | |
| 301 | 301 | // Perform search. |
| 302 | - $result = $this->searchSolr($params, true); |
|
| 302 | + $result = $this->searchSolr($params, TRUE); |
|
| 303 | 303 | |
| 304 | 304 | // Initialize values |
| 305 | 305 | $documents = []; |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $doc['metadata']['language'][$indexName] = Helper::getLanguageName($doc['metadata']['language'][$indexName]); |
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | - if ($doc['toplevel'] === false) { |
|
| 332 | + if ($doc['toplevel'] === FALSE) { |
|
| 333 | 333 | // this maybe a chapter, article, ..., year |
| 334 | 334 | if ($doc['type'] === 'year') { |
| 335 | 335 | continue; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | $documents[$doc['uid']]['searchResults'][] = $searchResult; |
| 355 | 355 | } |
| 356 | - } else if ($doc['toplevel'] === true) { |
|
| 356 | + } else if ($doc['toplevel'] === TRUE) { |
|
| 357 | 357 | foreach ($params['listMetadataRecords'] as $indexName => $solrField) { |
| 358 | 358 | if (isset($doc['metadata'][$indexName])) { |
| 359 | 359 | $documents[$doc['uid']]['metadata'][$indexName] = $doc['metadata'][$indexName]; |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | $params['filterquery'][] = ['query' => 'toplevel:true']; |
| 422 | 422 | |
| 423 | 423 | // Perform search. |
| 424 | - $result = $this->searchSolr($params, true); |
|
| 424 | + $result = $this->searchSolr($params, TRUE); |
|
| 425 | 425 | |
| 426 | 426 | foreach ($result['documents'] as $doc) { |
| 427 | 427 | // translate language code if applicable |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | * |
| 447 | 447 | * @return array The Apache Solr Documents that were fetched |
| 448 | 448 | */ |
| 449 | - protected function searchSolr($parameters = [], $enableCache = true) |
|
| 449 | + protected function searchSolr($parameters = [], $enableCache = TRUE) |
|
| 450 | 450 | { |
| 451 | 451 | // Set query. |
| 452 | 452 | $parameters['query'] = isset($parameters['query']) ? $parameters['query'] : '*'; |
@@ -465,10 +465,10 @@ discard block |
||
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | $cacheIdentifier = ''; |
| 468 | - $cache = null; |
|
| 468 | + $cache = NULL; |
|
| 469 | 469 | // Calculate cache identifier. |
| 470 | - if ($enableCache === true) { |
|
| 471 | - $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true)); |
|
| 470 | + if ($enableCache === TRUE) { |
|
| 471 | + $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, TRUE)); |
|
| 472 | 472 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 473 | 473 | } |
| 474 | 474 | $resultSet = [ |
@@ -476,22 +476,22 @@ discard block |
||
| 476 | 476 | 'numberOfToplevels' => 0, |
| 477 | 477 | 'numFound' => 0, |
| 478 | 478 | ]; |
| 479 | - if ($enableCache === false || ($entry = $cache->get($cacheIdentifier)) === false) { |
|
| 479 | + if ($enableCache === FALSE || ($entry = $cache->get($cacheIdentifier)) === FALSE) { |
|
| 480 | 480 | $selectQuery = $solr->service->createSelect($parameters); |
| 481 | 481 | |
| 482 | 482 | $grouping = $selectQuery->getGrouping(); |
| 483 | 483 | $grouping->addField('uid'); |
| 484 | 484 | $grouping->setLimit(100); // Results in group (TODO: check) |
| 485 | - $grouping->setNumberOfGroups(true); |
|
| 485 | + $grouping->setNumberOfGroups(TRUE); |
|
| 486 | 486 | |
| 487 | - if ($parameters['fulltext'] === true) { |
|
| 487 | + if ($parameters['fulltext'] === TRUE) { |
|
| 488 | 488 | // get highlighting component and apply settings |
| 489 | 489 | $selectQuery->getHighlighting(); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | $solrRequest = $solr->service->createRequest($selectQuery); |
| 493 | 493 | |
| 494 | - if ($parameters['fulltext'] === true) { |
|
| 494 | + if ($parameters['fulltext'] === TRUE) { |
|
| 495 | 495 | // If it is a fulltext search, enable highlighting. |
| 496 | 496 | // field for which highlighting is going to be performed, |
| 497 | 497 | // is required if you want to have OCR highlighting |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $resultSet['numberOfToplevels'] = $uidGroup->getNumberOfGroups(); |
| 513 | 513 | $resultSet['numFound'] = $uidGroup->getMatches(); |
| 514 | 514 | $highlighting = []; |
| 515 | - if ($parameters['fulltext'] === true) { |
|
| 515 | + if ($parameters['fulltext'] === TRUE) { |
|
| 516 | 516 | $data = $result->getData(); |
| 517 | 517 | $highlighting = $data['ocrHighlighting']; |
| 518 | 518 | } |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | // Save value in cache. |
| 546 | - if (!empty($resultSet) && $enableCache === true) { |
|
| 546 | + if (!empty($resultSet) && $enableCache === TRUE) { |
|
| 547 | 547 | $cache->set($cacheIdentifier, $resultSet); |
| 548 | 548 | } |
| 549 | 549 | } else { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | public function __construct($viaf, RequestFactory $requestFactory) |
| 67 | 67 | { |
| 68 | 68 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
| 69 | - $this->viafUrl = 'http://viaf.org/viaf/' . $viaf; |
|
| 69 | + $this->viafUrl = 'http://viaf.org/viaf/'.$viaf; |
|
| 70 | 70 | $this->requestFactory = $requestFactory; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | try { |
| 93 | 93 | $response = $this->requestFactory->request($url); |
| 94 | 94 | } catch (\Exception $e) { |
| 95 | - $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
|
| 95 | + $this->logger->warning('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.'); |
|
| 96 | 96 | return false; |
| 97 | 97 | } |
| 98 | 98 | return $response->getBody()->getContents(); |
@@ -105,6 +105,6 @@ discard block |
||
| 105 | 105 | **/ |
| 106 | 106 | protected function getApiEndpoint() |
| 107 | 107 | { |
| 108 | - return $this->viafUrl . '/' . $this->endpoint; |
|
| 108 | + return $this->viafUrl.'/'.$this->endpoint; |
|
| 109 | 109 | } |
| 110 | 110 | } |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage dlf |
| 26 | 26 | * @access public |
| 27 | 27 | **/ |
| 28 | -class Client |
|
| 29 | -{ |
|
| 28 | +class Client { |
|
| 30 | 29 | /** |
| 31 | 30 | * This holds the logger |
| 32 | 31 | * |
@@ -63,8 +62,7 @@ discard block |
||
| 63 | 62 | * @param RequestFactory $requestFactory a request object to inject |
| 64 | 63 | * @return void |
| 65 | 64 | **/ |
| 66 | - public function __construct($viaf, RequestFactory $requestFactory) |
|
| 67 | - { |
|
| 65 | + public function __construct($viaf, RequestFactory $requestFactory) { |
|
| 68 | 66 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
| 69 | 67 | $this->viafUrl = 'http://viaf.org/viaf/' . $viaf; |
| 70 | 68 | $this->requestFactory = $requestFactory; |
@@ -86,8 +84,7 @@ discard block |
||
| 86 | 84 | * |
| 87 | 85 | * @return object|bool |
| 88 | 86 | **/ |
| 89 | - public function getData() |
|
| 90 | - { |
|
| 87 | + public function getData() { |
|
| 91 | 88 | $url = $this->getApiEndpoint(); |
| 92 | 89 | try { |
| 93 | 90 | $response = $this->requestFactory->request($url); |
@@ -103,8 +100,7 @@ discard block |
||
| 103 | 100 | * |
| 104 | 101 | * @return string |
| 105 | 102 | **/ |
| 106 | - protected function getApiEndpoint() |
|
| 107 | - { |
|
| 103 | + protected function getApiEndpoint() { |
|
| 108 | 104 | return $this->viafUrl . '/' . $this->endpoint; |
| 109 | 105 | } |
| 110 | 106 | } |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @var string |
| 49 | 49 | **/ |
| 50 | - private $viafUrl = null; |
|
| 50 | + private $viafUrl = NULL; |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * The request object |
| 54 | 54 | * |
| 55 | 55 | * @var RequestFactoryInterface |
| 56 | 56 | **/ |
| 57 | - private $requestFactory = null; |
|
| 57 | + private $requestFactory = NULL; |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * Constructs a new instance |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $response = $this->requestFactory->request($url); |
| 94 | 94 | } catch (\Exception $e) { |
| 95 | 95 | $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
| 96 | - return false; |
|
| 96 | + return FALSE; |
|
| 97 | 97 | } |
| 98 | 98 | return $response->getBody()->getContents(); |
| 99 | 99 | } |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage dlf |
| 26 | 26 | * @access public |
| 27 | 27 | **/ |
| 28 | -class Profile |
|
| 29 | -{ |
|
| 28 | +class Profile { |
|
| 30 | 29 | /** |
| 31 | 30 | * This holds the logger |
| 32 | 31 | * |
@@ -57,8 +56,7 @@ discard block |
||
| 57 | 56 | * |
| 58 | 57 | * @return void |
| 59 | 58 | **/ |
| 60 | - public function __construct($viaf) |
|
| 61 | - { |
|
| 59 | + public function __construct($viaf) { |
|
| 62 | 60 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
| 63 | 61 | $this->client = new Client($viaf, GeneralUtility::makeInstance(RequestFactory::class)); |
| 64 | 62 | } |
@@ -68,8 +66,7 @@ discard block |
||
| 68 | 66 | * |
| 69 | 67 | * @return array|false |
| 70 | 68 | **/ |
| 71 | - public function getData() |
|
| 72 | - { |
|
| 69 | + public function getData() { |
|
| 73 | 70 | $this->getRaw(); |
| 74 | 71 | if (!empty($this->raw)) { |
| 75 | 72 | $data = []; |
@@ -87,8 +84,7 @@ discard block |
||
| 87 | 84 | * |
| 88 | 85 | * @return string|false |
| 89 | 86 | **/ |
| 90 | - public function getAddress() |
|
| 91 | - { |
|
| 87 | + public function getAddress() { |
|
| 92 | 88 | $this->getRaw(); |
| 93 | 89 | if (!empty($this->raw->asXML())) { |
| 94 | 90 | return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0]; |
@@ -103,8 +99,7 @@ discard block |
||
| 103 | 99 | * |
| 104 | 100 | * @return string|false |
| 105 | 101 | **/ |
| 106 | - public function getFullName() |
|
| 107 | - { |
|
| 102 | + public function getFullName() { |
|
| 108 | 103 | $this->getRaw(); |
| 109 | 104 | if (!empty($this->raw->asXML())) { |
| 110 | 105 | $rawName = $this->raw->xpath('./ns1:mainHeadings/ns1:data/ns1:text'); |
@@ -122,8 +117,7 @@ discard block |
||
| 122 | 117 | * |
| 123 | 118 | * @return void |
| 124 | 119 | **/ |
| 125 | - protected function getRaw() |
|
| 126 | - { |
|
| 120 | + protected function getRaw() { |
|
| 127 | 121 | $data = $this->client->getData(); |
| 128 | 122 | if (!isset($this->raw) && $data != false) { |
| 129 | 123 | $this->raw = Helper::getXmlFileAsString($data); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @var \SimpleXmlElement|false |
| 50 | 50 | **/ |
| 51 | - private $raw = null; |
|
| 51 | + private $raw = NULL; |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Constructs client instance |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | return $data; |
| 79 | 79 | } else { |
| 80 | 80 | $this->logger->warning('No data found for given VIAF URL'); |
| 81 | - return false; |
|
| 81 | + return FALSE; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0]; |
| 95 | 95 | } else { |
| 96 | 96 | $this->logger->warning('No address found for given VIAF URL'); |
| 97 | - return false; |
|
| 97 | + return FALSE; |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | return $name; |
| 114 | 114 | } else { |
| 115 | 115 | $this->logger->warning('No name found for given VIAF URL'); |
| 116 | - return false; |
|
| 116 | + return FALSE; |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | protected function getRaw() |
| 126 | 126 | { |
| 127 | 127 | $data = $this->client->getData(); |
| 128 | - if (!isset($this->raw) && $data != false) { |
|
| 128 | + if (!isset($this->raw) && $data != FALSE) { |
|
| 129 | 129 | $this->raw = Helper::getXmlFileAsString($data); |
| 130 | 130 | $this->raw->registerXPathNamespace('ns1', 'http://viaf.org/viaf/terms#'); |
| 131 | 131 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | array_unshift($metadata, $data); |
| 113 | 113 | } |
| 114 | 114 | if (empty($metadata)) { |
| 115 | - $this->logger->warning('No metadata found for document with UID ' . $this->document->getUid()); |
|
| 115 | + $this->logger->warning('No metadata found for document with UID '.$this->document->getUid()); |
|
| 116 | 116 | return ''; |
| 117 | 117 | } |
| 118 | 118 | ksort($metadata); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | if (empty(implode('', $value)) && $this->settings['getTitle'] && $this->document->getPartof()) { |
| 216 | 216 | $superiorTitle = Doc::getTitle($this->document->getPartof(), true); |
| 217 | 217 | if (!empty($superiorTitle)) { |
| 218 | - $metadata[$i][$name] = ['[' . $superiorTitle . ']']; |
|
| 218 | + $metadata[$i][$name] = ['['.$superiorTitle.']']; |
|
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | if (!empty($value)) { |
@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | * @subpackage dlf |
| 30 | 30 | * @access public |
| 31 | 31 | */ |
| 32 | -class MetadataController extends AbstractController |
|
| 33 | -{ |
|
| 32 | +class MetadataController extends AbstractController { |
|
| 34 | 33 | /** |
| 35 | 34 | * @var CollectionRepository |
| 36 | 35 | */ |
@@ -39,8 +38,7 @@ discard block |
||
| 39 | 38 | /** |
| 40 | 39 | * @param CollectionRepository $collectionRepository |
| 41 | 40 | */ |
| 42 | - public function injectCollectionRepository(CollectionRepository $collectionRepository) |
|
| 43 | - { |
|
| 41 | + public function injectCollectionRepository(CollectionRepository $collectionRepository) { |
|
| 44 | 42 | $this->collectionRepository = $collectionRepository; |
| 45 | 43 | } |
| 46 | 44 | |
@@ -52,8 +50,7 @@ discard block |
||
| 52 | 50 | /** |
| 53 | 51 | * @param MetadataRepository $metadataRepository |
| 54 | 52 | */ |
| 55 | - public function injectMetadataRepository(MetadataRepository $metadataRepository) |
|
| 56 | - { |
|
| 53 | + public function injectMetadataRepository(MetadataRepository $metadataRepository) { |
|
| 57 | 54 | $this->metadataRepository = $metadataRepository; |
| 58 | 55 | } |
| 59 | 56 | |
@@ -65,16 +62,14 @@ discard block |
||
| 65 | 62 | /** |
| 66 | 63 | * @param StructureRepository $structureRepository |
| 67 | 64 | */ |
| 68 | - public function injectStructureRepository(StructureRepository $structureRepository) |
|
| 69 | - { |
|
| 65 | + public function injectStructureRepository(StructureRepository $structureRepository) { |
|
| 70 | 66 | $this->structureRepository = $structureRepository; |
| 71 | 67 | } |
| 72 | 68 | |
| 73 | 69 | /** |
| 74 | 70 | * @return string|void |
| 75 | 71 | */ |
| 76 | - public function mainAction() |
|
| 77 | - { |
|
| 72 | + public function mainAction() { |
|
| 78 | 73 | $this->cObj = $this->configurationManager->getContentObject(); |
| 79 | 74 | |
| 80 | 75 | // Load current document. |
@@ -130,8 +125,7 @@ discard block |
||
| 130 | 125 | * |
| 131 | 126 | * @return string The metadata array ready for output |
| 132 | 127 | */ |
| 133 | - protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false) |
|
| 134 | - { |
|
| 128 | + protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false) { |
|
| 135 | 129 | if ($useOriginalIiifManifestMetadata) { |
| 136 | 130 | $iiifData = []; |
| 137 | 131 | foreach ($metadata as $row) { |
@@ -269,8 +263,7 @@ discard block |
||
| 269 | 263 | } |
| 270 | 264 | |
| 271 | 265 | if (is_array($metadata[$i][$name])) { |
| 272 | - $metadata[$i][$name] = array_values(array_filter($metadata[$i][$name], function($metadataValue) |
|
| 273 | - { |
|
| 266 | + $metadata[$i][$name] = array_values(array_filter($metadata[$i][$name], function($metadataValue) { |
|
| 274 | 267 | return !empty($metadataValue); |
| 275 | 268 | })); |
| 276 | 269 | } |
@@ -294,8 +287,7 @@ discard block |
||
| 294 | 287 | * |
| 295 | 288 | * @return array metadata |
| 296 | 289 | */ |
| 297 | - private function getMetadata() |
|
| 298 | - { |
|
| 290 | + private function getMetadata() { |
|
| 299 | 291 | $metadata = []; |
| 300 | 292 | if ($this->settings['rootline'] < 2) { |
| 301 | 293 | // Get current structure's @ID. |
@@ -333,8 +325,7 @@ discard block |
||
| 333 | 325 | * |
| 334 | 326 | * @return array metadata |
| 335 | 327 | */ |
| 336 | - private function getMetadataForIds($id, $metadata) |
|
| 337 | - { |
|
| 328 | + private function getMetadataForIds($id, $metadata) { |
|
| 338 | 329 | $useOriginalIiifManifestMetadata = $this->settings['originalIiifMetadata'] == 1 && $this->document->getDoc() instanceof IiifManifest; |
| 339 | 330 | foreach ($id as $sid) { |
| 340 | 331 | if ($useOriginalIiifManifestMetadata) { |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | // Load current document. |
| 81 | 81 | $this->loadDocument($this->requestData); |
| 82 | 82 | if ( |
| 83 | - $this->document === null |
|
| 84 | - || $this->document->getDoc() === null |
|
| 83 | + $this->document === NULL |
|
| 84 | + || $this->document->getDoc() === NULL |
|
| 85 | 85 | ) { |
| 86 | 86 | // Quit without doing anything if required variables are not set. |
| 87 | 87 | return ''; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @return string The metadata array ready for output |
| 132 | 132 | */ |
| 133 | - protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false) |
|
| 133 | + protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = FALSE) |
|
| 134 | 134 | { |
| 135 | 135 | if ($useOriginalIiifManifestMetadata) { |
| 136 | 136 | $iiifData = []; |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | $iiifData[$key] = [ |
| 149 | 149 | 'label' => $key, |
| 150 | 150 | 'value' => $group, |
| 151 | - 'buildUrl' => true, |
|
| 151 | + 'buildUrl' => TRUE, |
|
| 152 | 152 | ]; |
| 153 | 153 | } else { |
| 154 | 154 | // Data output |
| 155 | 155 | $iiifData[$key] = [ |
| 156 | 156 | 'label' => $key, |
| 157 | 157 | 'value' => $group, |
| 158 | - 'buildUrl' => false, |
|
| 158 | + 'buildUrl' => FALSE, |
|
| 159 | 159 | ]; |
| 160 | 160 | } |
| 161 | 161 | } else { |
@@ -172,18 +172,18 @@ discard block |
||
| 172 | 172 | $iiifData[$key]['data'][] = [ |
| 173 | 173 | 'label' => $nolabel ? '' : $label, |
| 174 | 174 | 'value' => $value, |
| 175 | - 'buildUrl' => true, |
|
| 175 | + 'buildUrl' => TRUE, |
|
| 176 | 176 | ]; |
| 177 | 177 | } else { |
| 178 | 178 | $iiifData[$key]['data'][] = [ |
| 179 | 179 | 'label' => $label, |
| 180 | 180 | 'value' => $value, |
| 181 | - 'buildUrl' => false, |
|
| 181 | + 'buildUrl' => FALSE, |
|
| 182 | 182 | ]; |
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | - $this->view->assign('useIiif', true); |
|
| 186 | + $this->view->assign('useIiif', TRUE); |
|
| 187 | 187 | $this->view->assign('iiifData', $iiifData); |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | if ($name == 'title') { |
| 214 | 214 | // Get title of parent document if needed. |
| 215 | 215 | if (empty(implode('', $value)) && $this->settings['getTitle'] && $this->document->getPartof()) { |
| 216 | - $superiorTitle = Doc::getTitle($this->document->getPartof(), true); |
|
| 216 | + $superiorTitle = Doc::getTitle($this->document->getPartof(), TRUE); |
|
| 217 | 217 | if (!empty($superiorTitle)) { |
| 218 | 218 | $metadata[$i][$name] = ['[' . $superiorTitle . ']']; |
| 219 | 219 | } |