@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | '###LABEL_PAGE###' => htmlspecialchars($this->pi_getLL('label.logicalPage')), |
| 109 | 109 | '###LABEL_NORESULT###' => htmlspecialchars($this->pi_getLL('label.noresult')), |
| 110 | 110 | '###CURRENT_DOCUMENT###' => $this->doc->uid, |
| 111 | - '###SOLR_ENCRYPTED###' => $encryptedSolr ?: '', |
|
| 111 | + '###SOLR_ENCRYPTED###' => $encryptedSolr ? : '', |
|
| 112 | 112 | ]; |
| 113 | 113 | |
| 114 | 114 | $content .= $this->templateService->substituteMarkerArray($this->template, $markerArray); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | protected function addSearchInDocumentJS() |
| 126 | 126 | { |
| 127 | 127 | $pageRenderer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class); |
| 128 | - $pageRenderer->addJsFooterFile(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)) . 'Resources/Public/Javascript/Search/SearchInDocument.js'); |
|
| 128 | + $pageRenderer->addJsFooterFile(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)).'Resources/Public/Javascript/Search/SearchInDocument.js'); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | * @subpackage dlf |
| 25 | 25 | * @access public |
| 26 | 26 | */ |
| 27 | -class SearchInDocumentTool extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 28 | -{ |
|
| 27 | +class SearchInDocumentTool extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 29 | 28 | public $scriptRelPath = 'Classes/Plugin/Tools/SearchInDocumentTool.php'; |
| 30 | 29 | |
| 31 | 30 | /** |
@@ -38,8 +37,7 @@ discard block |
||
| 38 | 37 | * |
| 39 | 38 | * @return string The content that is displayed on the website |
| 40 | 39 | */ |
| 41 | - public function main($content, $conf) |
|
| 42 | - { |
|
| 40 | + public function main($content, $conf) { |
|
| 43 | 41 | |
| 44 | 42 | $this->init($conf); |
| 45 | 43 | |
@@ -122,8 +120,7 @@ discard block |
||
| 122 | 120 | * |
| 123 | 121 | * @return void |
| 124 | 122 | */ |
| 125 | - protected function addSearchInDocumentJS() |
|
| 126 | - { |
|
| 123 | + protected function addSearchInDocumentJS() { |
|
| 127 | 124 | $pageRenderer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class); |
| 128 | 125 | $pageRenderer->addJsFooterFile(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)) . 'Resources/Public/Javascript/Search/SearchInDocument.js'); |
| 129 | 126 | } |
@@ -135,8 +132,7 @@ discard block |
||
| 135 | 132 | * |
| 136 | 133 | * @return string with encrypted core name |
| 137 | 134 | */ |
| 138 | - protected function getEncryptedCoreName() |
|
| 139 | - { |
|
| 135 | + protected function getEncryptedCoreName() { |
|
| 140 | 136 | // Get core name. |
| 141 | 137 | $name = Helper::getIndexNameFromUid($this->conf['solrcore'], 'tx_dlf_solrcores'); |
| 142 | 138 | // Encrypt core name. |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | if ($result->rowCount() == 1) { |
| 63 | 63 | $pageRenderer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class); |
| 64 | - $pageRenderer->addJsFooterFile(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)) . 'Resources/Public/Javascript/Search/Suggester.js'); |
|
| 64 | + $pageRenderer->addJsFooterFile(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)).'Resources/Public/Javascript/Search/Suggester.js'); |
|
| 65 | 65 | } else { |
| 66 | 66 | Helper::devLog('No metadata fields configured for search suggestions', DEVLOG_SEVERITY_WARNING); |
| 67 | 67 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | && $list->metadata['options']['source'] == 'collection' |
| 84 | 84 | ) { |
| 85 | 85 | // Get collection's UID. |
| 86 | - return '<input type="hidden" name="' . $this->prefixId . '[collection]" value="' . $list->metadata['options']['select'] . '" />'; |
|
| 86 | + return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$list->metadata['options']['select'].'" />'; |
|
| 87 | 87 | } elseif (!empty($list->metadata['options']['params']['filterquery'])) { |
| 88 | 88 | // Get collection's UID from search metadata. |
| 89 | 89 | foreach ($list->metadata['options']['params']['filterquery'] as $facet) { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $collectionId = Helper::getUidFromIndexName(trim($facetKeyVal[1], '(")'), 'tx_dlf_collections'); |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | - return '<input type="hidden" name="' . $this->prefixId . '[collection]" value="' . $collectionId . '" />'; |
|
| 98 | + return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$collectionId.'" />'; |
|
| 99 | 99 | } |
| 100 | 100 | return ''; |
| 101 | 101 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $this->loadDocument(); |
| 120 | 120 | // Get document's UID or parent ID. |
| 121 | 121 | if ($this->doc->ready) { |
| 122 | - return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . ($this->doc->parentId > 0 ? $this->doc->parentId : $this->doc->uid) . '" />'; |
|
| 122 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.($this->doc->parentId > 0 ? $this->doc->parentId : $this->doc->uid).'" />'; |
|
| 123 | 123 | } |
| 124 | 124 | } elseif (!empty($list->metadata['options']['params']['filterquery'])) { |
| 125 | 125 | // Get document's UID from search metadata. |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $documentId = (int) substr($facetKeyVal[1], 1, strpos($facetKeyVal[1], ')')); |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | - return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . $documentId . '" />'; |
|
| 132 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.$documentId.'" />'; |
|
| 133 | 133 | } |
| 134 | 134 | return ''; |
| 135 | 135 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | // Add encrypted fields to search form. |
| 153 | 153 | if ($name !== false) { |
| 154 | - return '<input type="hidden" name="' . $this->prefixId . '[encrypted]" value="' . $name . '" />'; |
|
| 154 | + return '<input type="hidden" name="'.$this->prefixId.'[encrypted]" value="'.$name.'" />'; |
|
| 155 | 155 | } else { |
| 156 | 156 | return ''; |
| 157 | 157 | } |
@@ -177,19 +177,19 @@ discard block |
||
| 177 | 177 | // Get operator options. |
| 178 | 178 | $operatorOptions = ''; |
| 179 | 179 | foreach (['AND', 'OR', 'NOT'] as $operator) { |
| 180 | - $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-' . $operator . '" value="' . $operator . '">' . htmlspecialchars($this->pi_getLL($operator, '')) . '</option>'; |
|
| 180 | + $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-'.$operator.'" value="'.$operator.'">'.htmlspecialchars($this->pi_getLL($operator, '')).'</option>'; |
|
| 181 | 181 | } |
| 182 | 182 | // Get field selector options. |
| 183 | 183 | $fieldSelectorOptions = ''; |
| 184 | 184 | $searchFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], true); |
| 185 | 185 | foreach ($searchFields as $searchField) { |
| 186 | - $fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-' . $searchField . '" value="' . $searchField . '">' . Helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']) . '</option>'; |
|
| 186 | + $fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-'.$searchField.'" value="'.$searchField.'">'.Helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']).'</option>'; |
|
| 187 | 187 | } |
| 188 | 188 | for ($i = 0; $i < $this->conf['extendedSlotCount']; $i++) { |
| 189 | 189 | $markerArray = [ |
| 190 | - '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-' . $i . '" name="' . $this->prefixId . '[extOperator][' . $i . ']">' . $operatorOptions . '</select>', |
|
| 191 | - '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-' . $i . '" name="' . $this->prefixId . '[extField][' . $i . ']">' . $fieldSelectorOptions . '</select>', |
|
| 192 | - '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-' . $i . '" type="text" name="' . $this->prefixId . '[extQuery][' . $i . ']" />' |
|
| 190 | + '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-'.$i.'" name="'.$this->prefixId.'[extOperator]['.$i.']">'.$operatorOptions.'</select>', |
|
| 191 | + '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-'.$i.'" name="'.$this->prefixId.'[extField]['.$i.']">'.$fieldSelectorOptions.'</select>', |
|
| 192 | + '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-'.$i.'" type="text" name="'.$this->prefixId.'[extQuery]['.$i.']" />' |
|
| 193 | 193 | ]; |
| 194 | 194 | $extendedSearch .= $this->templateService->substituteMarkerArray($this->templateService->getSubpart($this->template, '###EXT_SEARCH_ENTRY###'), $markerArray); |
| 195 | 195 | } |
@@ -217,12 +217,12 @@ discard block |
||
| 217 | 217 | // Get facets from plugin configuration. |
| 218 | 218 | $facets = []; |
| 219 | 219 | foreach (GeneralUtility::trimExplode(',', $this->conf['facets'], true) as $facet) { |
| 220 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
| 220 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
| 221 | 221 | } |
| 222 | 222 | // Render facets menu. |
| 223 | 223 | $TSconfig = []; |
| 224 | 224 | $TSconfig['special'] = 'userfunction'; |
| 225 | - $TSconfig['special.']['userFunc'] = \Kitodo\Dlf\Plugin\Search::class . '->makeFacetsMenuArray'; |
|
| 225 | + $TSconfig['special.']['userFunc'] = \Kitodo\Dlf\Plugin\Search::class.'->makeFacetsMenuArray'; |
|
| 226 | 226 | $TSconfig['special.']['facets'] = $facets; |
| 227 | 227 | $TSconfig['special.']['limit'] = max(intval($this->conf['limitFacets']), 1); |
| 228 | 228 | $TSconfig = Helper::mergeRecursiveWithOverrule($this->conf['facetsConf.'], $TSconfig); |
@@ -243,10 +243,10 @@ discard block |
||
| 243 | 243 | $output = ''; |
| 244 | 244 | // Check for plugin configuration. |
| 245 | 245 | if (!empty($this->conf['fulltext'])) { |
| 246 | - $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-no" type="radio" name="' . $this->prefixId . '[fulltext]" value="0" ' . ($isFulltextSearch == 0 ? 'checked="checked"' : '') . ' />'; |
|
| 247 | - $output .= ' <label for="tx-dlf-search-fulltext-no">' . htmlspecialchars($this->pi_getLL('label.inMetadata', '')) . '</label>'; |
|
| 248 | - $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-yes" type="radio" name="' . $this->prefixId . '[fulltext]" value="1" ' . ($isFulltextSearch == 1 ? 'checked="checked"' : '') . '/>'; |
|
| 249 | - $output .= ' <label for="tx-dlf-search-fulltext-yes">' . htmlspecialchars($this->pi_getLL('label.inFulltext', '')) . '</label>'; |
|
| 246 | + $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-no" type="radio" name="'.$this->prefixId.'[fulltext]" value="0" '.($isFulltextSearch == 0 ? 'checked="checked"' : '').' />'; |
|
| 247 | + $output .= ' <label for="tx-dlf-search-fulltext-no">'.htmlspecialchars($this->pi_getLL('label.inMetadata', '')).'</label>'; |
|
| 248 | + $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-yes" type="radio" name="'.$this->prefixId.'[fulltext]" value="1" '.($isFulltextSearch == 1 ? 'checked="checked"' : '').'/>'; |
|
| 249 | + $output .= ' <label for="tx-dlf-search-fulltext-yes">'.htmlspecialchars($this->pi_getLL('label.inFulltext', '')).'</label>'; |
|
| 250 | 250 | } |
| 251 | 251 | return $output; |
| 252 | 252 | } |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | $output = ''; |
| 264 | 264 | // Check for plugin configuration. |
| 265 | 265 | if (!empty($this->conf['showLogicalPageField'])) { |
| 266 | - $output .= ' <label for="tx-dlf-search-logical-page">' . htmlspecialchars($this->pi_getLL('label.logicalPage', '')) . ': </label>'; |
|
| 267 | - $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="' . $this->prefixId . '[logicalPage]" />'; |
|
| 266 | + $output .= ' <label for="tx-dlf-search-logical-page">'.htmlspecialchars($this->pi_getLL('label.logicalPage', '')).': </label>'; |
|
| 267 | + $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="'.$this->prefixId.'[logicalPage]" />'; |
|
| 268 | 268 | } |
| 269 | 269 | return $output; |
| 270 | 270 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | $entryArray['doNotLinkIt'] = 0; |
| 306 | 306 | // Check if facet is already selected. |
| 307 | 307 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
| 308 | - $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
|
| 308 | + $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn); |
|
| 309 | 309 | if ($index !== false) { |
| 310 | 310 | // Facet is selected, thus remove it from filter. |
| 311 | 311 | unset($queryColumn[$index]); |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | } else { |
| 324 | 324 | // Facet is not selected, thus add it to filter. |
| 325 | - $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")'; |
|
| 325 | + $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")'; |
|
| 326 | 326 | $entryArray['ITEM_STATE'] = 'NO'; |
| 327 | 327 | } |
| 328 | 328 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(['query' => $search['query'], 'fq' => $queryColumn]); |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | '###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf), |
| 379 | 379 | '###LABEL_QUERY###' => (!empty($search['query']) ? htmlspecialchars($search['query']) : htmlspecialchars($this->pi_getLL('label.query'))), |
| 380 | 380 | '###LABEL_SUBMIT###' => htmlspecialchars($this->pi_getLL('label.submit')), |
| 381 | - '###FIELD_QUERY###' => $this->prefixId . '[query]', |
|
| 381 | + '###FIELD_QUERY###' => $this->prefixId.'[query]', |
|
| 382 | 382 | '###QUERY###' => (!empty($search['query']) ? htmlspecialchars($search['query']) : ''), |
| 383 | 383 | '###FULLTEXTSWITCH###' => $this->addFulltextSwitch($list->metadata['fulltextSearch']), |
| 384 | 384 | '###FIELD_DOC###' => ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all' ? $this->addCurrentDocument() : ''), |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $this->piVars['query'] = empty($matches[1]) ? $this->piVars['query'] : $matches[1]; |
| 411 | 411 | // Search in fulltext field if applicable. Query must not be empty! |
| 412 | 412 | if (!empty($this->piVars['query'])) { |
| 413 | - $query = 'fulltext:(' . Solr::escapeQuery(trim($this->piVars['query'])) . ')'; |
|
| 413 | + $query = 'fulltext:('.Solr::escapeQuery(trim($this->piVars['query'])).')'; |
|
| 414 | 414 | } |
| 415 | 415 | } else { |
| 416 | 416 | // Retain given search field if valid. |
@@ -431,9 +431,9 @@ discard block |
||
| 431 | 431 | && in_array($this->piVars['extField'][$i], $allowedFields) |
| 432 | 432 | ) { |
| 433 | 433 | if (!empty($query)) { |
| 434 | - $query .= ' ' . $this->piVars['extOperator'][$i] . ' '; |
|
| 434 | + $query .= ' '.$this->piVars['extOperator'][$i].' '; |
|
| 435 | 435 | } |
| 436 | - $query .= Indexer::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']) . ':(' . Solr::escapeQuery($this->piVars['extQuery'][$i]) . ')'; |
|
| 436 | + $query .= Indexer::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']).':('.Solr::escapeQuery($this->piVars['extQuery'][$i]).')'; |
|
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | } |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | !empty($this->piVars['id']) |
| 454 | 454 | && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id']) |
| 455 | 455 | ) { |
| 456 | - $params['filterquery'][]['query'] = 'uid:(' . $this->piVars['id'] . ') OR partof:(' . $this->piVars['id'] . ')'; |
|
| 456 | + $params['filterquery'][]['query'] = 'uid:('.$this->piVars['id'].') OR partof:('.$this->piVars['id'].')'; |
|
| 457 | 457 | $label .= htmlspecialchars(sprintf($this->pi_getLL('in', ''), Document::getTitle($this->piVars['id']))); |
| 458 | 458 | } |
| 459 | 459 | } |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['collection']) |
| 468 | 468 | ) { |
| 469 | 469 | $index_name = Helper::getIndexNameFromUid($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']); |
| 470 | - $params['filterquery'][]['query'] = 'collection_faceting:("' . Solr::escapeQuery($index_name) . '")'; |
|
| 470 | + $params['filterquery'][]['query'] = 'collection_faceting:("'.Solr::escapeQuery($index_name).'")'; |
|
| 471 | 471 | $label .= sprintf($this->pi_getLL('in', '', true), Helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
| 472 | 472 | } |
| 473 | 473 | } |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | $collIndexNames[] = Solr::escapeQuery(Helper::getIndexNameFromUid(intval($collId), 'tx_dlf_collections', $this->conf['pages'])); |
| 480 | 480 | } |
| 481 | 481 | // Last value is fake and used for distinction in $this->addCurrentCollection() |
| 482 | - $params['filterquery'][]['query'] = 'collection_faceting:("' . implode('" OR "', $collIndexNames) . '" OR "FakeValueForDistinction")'; |
|
| 482 | + $params['filterquery'][]['query'] = 'collection_faceting:("'.implode('" OR "', $collIndexNames).'" OR "FakeValueForDistinction")'; |
|
| 483 | 483 | } |
| 484 | 484 | // Set some query parameters. |
| 485 | 485 | $params['query'] = !empty($query) ? $query : '*'; |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $linkConf['forceAbsoluteUrl.']['scheme'] = !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'; |
| 530 | 530 | $linkConf['additionalParams'] = GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', true, false); |
| 531 | 531 | // Send headers. |
| 532 | - header('Location: ' . GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
| 532 | + header('Location: '.GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
| 533 | 533 | exit; |
| 534 | 534 | } |
| 535 | 535 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $name = Helper::encrypt($name); |
| 151 | 151 | } |
| 152 | 152 | // Add encrypted fields to search form. |
| 153 | - if ($name !== false) { |
|
| 153 | + if ($name !== FALSE) { |
|
| 154 | 154 | return '<input type="hidden" name="' . $this->prefixId . '[encrypted]" value="' . $name . '" />'; |
| 155 | 155 | } else { |
| 156 | 156 | return ''; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | // Get field selector options. |
| 183 | 183 | $fieldSelectorOptions = ''; |
| 184 | - $searchFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], true); |
|
| 184 | + $searchFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
| 185 | 185 | foreach ($searchFields as $searchField) { |
| 186 | 186 | $fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-' . $searchField . '" value="' . $searchField . '">' . Helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']) . '</option>'; |
| 187 | 187 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | // Get facets from plugin configuration. |
| 218 | 218 | $facets = []; |
| 219 | - foreach (GeneralUtility::trimExplode(',', $this->conf['facets'], true) as $facet) { |
|
| 219 | + foreach (GeneralUtility::trimExplode(',', $this->conf['facets'], TRUE) as $facet) { |
|
| 220 | 220 | $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
| 221 | 221 | } |
| 222 | 222 | // Render facets menu. |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | // Check if facet is already selected. |
| 307 | 307 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
| 308 | 308 | $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
| 309 | - if ($index !== false) { |
|
| 309 | + if ($index !== FALSE) { |
|
| 310 | 310 | // Facet is selected, thus remove it from filter. |
| 311 | 311 | unset($queryColumn[$index]); |
| 312 | 312 | $queryColumn = array_values($queryColumn); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | //Reset facets |
| 316 | 316 | if ($this->conf['resetFacets']) { |
| 317 | 317 | //remove ($count) for selected facet in template |
| 318 | - $entryArray['count'] = false; |
|
| 318 | + $entryArray['count'] = FALSE; |
|
| 319 | 319 | //build link to delete selected facet |
| 320 | 320 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(['query' => $search['query'], 'fq' => $queryColumn]); |
| 321 | 321 | $entryArray['title'] = sprintf($this->pi_getLL('resetFacet', ''), $entryArray['title']); |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | { |
| 344 | 344 | $this->init($conf); |
| 345 | 345 | // Disable caching for this plugin. |
| 346 | - $this->setCache(false); |
|
| 346 | + $this->setCache(FALSE); |
|
| 347 | 347 | // Quit without doing anything if required variables are not set. |
| 348 | 348 | if (empty($this->conf['solrcore'])) { |
| 349 | 349 | Helper::devLog('Incomplete plugin configuration', DEVLOG_SEVERITY_WARNING); |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | && is_array($this->piVars['extQuery']) |
| 423 | 423 | ) { |
| 424 | 424 | $allowedOperators = ['AND', 'OR', 'NOT']; |
| 425 | - $allowedFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], true); |
|
| 425 | + $allowedFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
| 426 | 426 | $numberOfExtQueries = count($this->piVars['extQuery']); |
| 427 | 427 | for ($i = 0; $i < $numberOfExtQueries; $i++) { |
| 428 | 428 | if (!empty($this->piVars['extQuery'][$i])) { |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | ) { |
| 469 | 469 | $index_name = Helper::getIndexNameFromUid($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']); |
| 470 | 470 | $params['filterquery'][]['query'] = 'collection_faceting:("' . Solr::escapeQuery($index_name) . '")'; |
| 471 | - $label .= sprintf($this->pi_getLL('in', '', true), Helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
|
| 471 | + $label .= sprintf($this->pi_getLL('in', '', TRUE), Helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
|
| 472 | 472 | } |
| 473 | 473 | } |
| 474 | 474 | // Add filter query for collection restrictions. |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | } |
| 528 | 528 | $linkConf['forceAbsoluteUrl'] = !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0; |
| 529 | 529 | $linkConf['forceAbsoluteUrl.']['scheme'] = !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'; |
| 530 | - $linkConf['additionalParams'] = GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', true, false); |
|
| 530 | + $linkConf['additionalParams'] = GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE); |
|
| 531 | 531 | // Send headers. |
| 532 | 532 | header('Location: ' . GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
| 533 | 533 | exit; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | // Get next available core name if none given. |
| 130 | 130 | if (empty($core)) { |
| 131 | - $core = 'dlfCore' . self::getNextCoreNumber(); |
|
| 131 | + $core = 'dlfCore'.self::getNextCoreNumber(); |
|
| 132 | 132 | } |
| 133 | 133 | // Get Solr service instance. |
| 134 | 134 | $solr = self::getInstance($core); |
@@ -224,13 +224,13 @@ discard block |
||
| 224 | 224 | ->execute(); |
| 225 | 225 | |
| 226 | 226 | while ($resArray = $result->fetch()) { |
| 227 | - $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i'; |
|
| 227 | + $fields[] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').($resArray['index_stored'] ? 's' : 'u').'i'; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | // Check if queried field is valid. |
| 231 | 231 | $splitQuery = explode(':', $query, 2); |
| 232 | 232 | if (in_array($splitQuery[0], $fields)) { |
| 233 | - $query = $splitQuery[0] . ':(' . self::escapeQuery(trim($splitQuery[1], '()')) . ')'; |
|
| 233 | + $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')'; |
|
| 234 | 234 | } else { |
| 235 | 235 | $query = self::escapeQuery($query); |
| 236 | 236 | } |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | { |
| 295 | 295 | $number = max(intval($number), 0); |
| 296 | 296 | // Check if core already exists. |
| 297 | - $solr = self::getInstance('dlfCore' . $number); |
|
| 297 | + $solr = self::getInstance('dlfCore'.$number); |
|
| 298 | 298 | if (!$solr->ready) { |
| 299 | 299 | return $number; |
| 300 | 300 | } else { |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $config['path'] .= 'solr/'; |
| 336 | 336 | } |
| 337 | 337 | // Set connection timeout lower than PHP's max_execution_time. |
| 338 | - $max_execution_time = intval(ini_get('max_execution_time')) ?: 30; |
|
| 338 | + $max_execution_time = intval(ini_get('max_execution_time')) ? : 30; |
|
| 339 | 339 | $config['timeout'] = MathUtility::forceIntegerInRange($conf['solrTimeout'], 1, $max_execution_time, 10); |
| 340 | 340 | $this->config = $config; |
| 341 | 341 | } |
@@ -369,13 +369,13 @@ discard block |
||
| 369 | 369 | // Extend filter query to get all documents with the same uids. |
| 370 | 370 | foreach ($params['filterquery'] as $key => $value) { |
| 371 | 371 | if (isset($value['query'])) { |
| 372 | - $params['filterquery'][$key]['query'] = '{!join from=uid to=uid}' . $value['query']; |
|
| 372 | + $params['filterquery'][$key]['query'] = '{!join from=uid to=uid}'.$value['query']; |
|
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | // Set filter query to just get toplevel documents. |
| 376 | 376 | $params['filterquery'][] = ['query' => 'toplevel:true']; |
| 377 | 377 | // Set join query to get all documents with the same uids. |
| 378 | - $params['query'] = '{!join from=uid to=uid}' . $params['query']; |
|
| 378 | + $params['query'] = '{!join from=uid to=uid}'.$params['query']; |
|
| 379 | 379 | // Perform search to determine the total number of toplevel hits and fetch the required rows. |
| 380 | 380 | $selectQuery = $this->service->createSelect($params); |
| 381 | 381 | $results = $this->service->select($selectQuery); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | // Set query. |
| 433 | 433 | $parameters['query'] = $query; |
| 434 | 434 | // Calculate cache identifier. |
| 435 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
| 435 | + $cacheIdentifier = Helper::digest($this->core.print_r(array_merge($this->params, $parameters), true)); |
|
| 436 | 436 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 437 | 437 | $resultSet = []; |
| 438 | 438 | if (($entry = $cache->get($cacheIdentifier)) === false) { |
@@ -563,12 +563,12 @@ discard block |
||
| 563 | 563 | */ |
| 564 | 564 | public function __get($var) |
| 565 | 565 | { |
| 566 | - $method = '_get' . ucfirst($var); |
|
| 566 | + $method = '_get'.ucfirst($var); |
|
| 567 | 567 | if ( |
| 568 | 568 | !property_exists($this, $var) |
| 569 | 569 | || !method_exists($this, $method) |
| 570 | 570 | ) { |
| 571 | - Helper::devLog('There is no getter function for property "' . $var . '"', DEVLOG_SEVERITY_WARNING); |
|
| 571 | + Helper::devLog('There is no getter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING); |
|
| 572 | 572 | return; |
| 573 | 573 | } else { |
| 574 | 574 | return $this->$method(); |
@@ -601,12 +601,12 @@ discard block |
||
| 601 | 601 | */ |
| 602 | 602 | public function __set($var, $value) |
| 603 | 603 | { |
| 604 | - $method = '_set' . ucfirst($var); |
|
| 604 | + $method = '_set'.ucfirst($var); |
|
| 605 | 605 | if ( |
| 606 | 606 | !property_exists($this, $var) |
| 607 | 607 | || !method_exists($this, $method) |
| 608 | 608 | ) { |
| 609 | - Helper::devLog('There is no setter function for property "' . $var . '"', DEVLOG_SEVERITY_WARNING); |
|
| 609 | + Helper::devLog('There is no setter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING); |
|
| 610 | 610 | } else { |
| 611 | 611 | $this->$method($value); |
| 612 | 612 | } |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | 'scheme' => $this->config['scheme'], |
| 644 | 644 | 'host' => $this->config['host'], |
| 645 | 645 | 'port' => $this->config['port'], |
| 646 | - 'path' => '/' . $this->config['path'], |
|
| 646 | + 'path' => '/'.$this->config['path'], |
|
| 647 | 647 | 'core' => $core, |
| 648 | 648 | 'username' => $this->config['username'], |
| 649 | 649 | 'password' => $this->config['password'], |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @var string|null |
| 50 | 50 | * @access protected |
| 51 | 51 | */ |
| 52 | - protected $core = null; |
|
| 52 | + protected $core = NULL; |
|
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * This holds the PID for the configuration |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @var bool |
| 98 | 98 | * @access protected |
| 99 | 99 | */ |
| 100 | - protected $ready = false; |
|
| 100 | + protected $ready = FALSE; |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * This holds the singleton search objects with their core as array key |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * |
| 250 | 250 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
| 251 | 251 | */ |
| 252 | - public static function getInstance($core = null) |
|
| 252 | + public static function getInstance($core = NULL) |
|
| 253 | 253 | { |
| 254 | 254 | // Get core name if UID is given. |
| 255 | 255 | if (MathUtility::canBeInterpretedAsInteger($core)) { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | // Check if core is set or null. |
| 259 | 259 | if ( |
| 260 | 260 | empty($core) |
| 261 | - && $core !== null |
|
| 261 | + && $core !== NULL |
|
| 262 | 262 | ) { |
| 263 | 263 | Helper::devLog('Invalid core UID or name given for Apache Solr', DEVLOG_SEVERITY_ERROR); |
| 264 | 264 | } |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | 'core' => $this->core, |
| 407 | 407 | 'pid' => $this->cPid, |
| 408 | 408 | 'order' => 'score', |
| 409 | - 'order.asc' => true, |
|
| 409 | + 'order.asc' => TRUE, |
|
| 410 | 410 | 'numberOfHits' => $this->numberOfHits, |
| 411 | 411 | 'numberOfToplevelHits' => $numberOfToplevelHits |
| 412 | 412 | ] |
@@ -432,10 +432,10 @@ discard block |
||
| 432 | 432 | // Set query. |
| 433 | 433 | $parameters['query'] = $query; |
| 434 | 434 | // Calculate cache identifier. |
| 435 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
| 435 | + $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), TRUE)); |
|
| 436 | 436 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 437 | 437 | $resultSet = []; |
| 438 | - if (($entry = $cache->get($cacheIdentifier)) === false) { |
|
| 438 | + if (($entry = $cache->get($cacheIdentifier)) === FALSE) { |
|
| 439 | 439 | $selectQuery = $this->service->createSelect(array_merge($this->params, $parameters)); |
| 440 | 440 | $result = $this->service->select($selectQuery); |
| 441 | 441 | foreach ($result as $doc) { |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | // Check if connection is established. |
| 662 | 662 | $query = $this->service->createCoreAdmin(); |
| 663 | 663 | $action = $query->createStatus(); |
| 664 | - if ($core !== null) { |
|
| 664 | + if ($core !== NULL) { |
|
| 665 | 665 | $action->setCore($core); |
| 666 | 666 | } |
| 667 | 667 | $query->setAction($action); |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | $response = $this->service->coreAdmin($query); |
| 670 | 670 | if ($response->getWasSuccessful()) { |
| 671 | 671 | // Solr is reachable, but is the core as well? |
| 672 | - if ($core !== null) { |
|
| 672 | + if ($core !== NULL) { |
|
| 673 | 673 | $result = $response->getStatusResult(); |
| 674 | 674 | if ( |
| 675 | 675 | $result instanceof \Solarium\QueryType\Server\CoreAdmin\Result\StatusResult |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | } |
| 684 | 684 | } |
| 685 | 685 | // Instantiation successful! |
| 686 | - $this->ready = true; |
|
| 686 | + $this->ready = TRUE; |
|
| 687 | 687 | } |
| 688 | 688 | } catch (\Exception $e) { |
| 689 | 689 | // Nothing to do here. |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) { |
| 136 | 136 | return false; |
| 137 | 137 | } elseif ($checksum == 10) { |
| 138 | - return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
|
| 138 | + return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD'); |
|
| 139 | 139 | } elseif (substr($id, -1, 1) != $checksum) { |
| 140 | 140 | return false; |
| 141 | 141 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $args = []; |
| 215 | 215 | $data = []; |
| 216 | 216 | if (!empty($stacktrace[1])) { |
| 217 | - $caller = $stacktrace[1]['class'] . $stacktrace[1]['type'] . $stacktrace[1]['function']; |
|
| 217 | + $caller = $stacktrace[1]['class'].$stacktrace[1]['type'].$stacktrace[1]['function']; |
|
| 218 | 218 | foreach ($stacktrace[1]['args'] as $arg) { |
| 219 | 219 | if (is_bool($arg)) { |
| 220 | 220 | $args[] = ($arg ? 'true' : 'false'); |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | $args[] = '[data]'; |
| 227 | 227 | $data[] = $arg; |
| 228 | 228 | } elseif (is_object($arg)) { |
| 229 | - $args[] = '[' . get_class($arg) . ']'; |
|
| 229 | + $args[] = '['.get_class($arg).']'; |
|
| 230 | 230 | $data[] = $arg; |
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | - $arguments = '(' . implode(', ', $args) . ')'; |
|
| 234 | + $arguments = '('.implode(', ', $args).')'; |
|
| 235 | 235 | $additionalData = (empty($data) ? false : $data); |
| 236 | - /** @scrutinizer ignore-deprecated */ \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[' . $caller . $arguments . '] ' . $message, self::$extKey, $severity, $additionalData); |
|
| 236 | + /** @scrutinizer ignore-deprecated */ \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('['.$caller.$arguments.'] '.$message, self::$extKey, $severity, $additionalData); |
|
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 287 | 287 | // Merge initialisation vector and encrypted data. |
| 288 | 288 | if ($encrypted !== false) { |
| 289 | - $encrypted = base64_encode($iv . $encrypted); |
|
| 289 | + $encrypted = base64_encode($iv.$encrypted); |
|
| 290 | 290 | } |
| 291 | 291 | return $encrypted; |
| 292 | 292 | } |
@@ -340,8 +340,8 @@ discard block |
||
| 340 | 340 | public static function getHookObjects($scriptRelPath) |
| 341 | 341 | { |
| 342 | 342 | $hookObjects = []; |
| 343 | - if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
|
| 344 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
|
| 343 | + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) { |
|
| 344 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) { |
|
| 345 | 345 | $hookObjects[] = &\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($classRef); |
| 346 | 346 | } |
| 347 | 347 | } |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | !$uid |
| 368 | 368 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
| 369 | 369 | ) { |
| 370 | - self::devLog('Invalid UID "' . $uid . '" or table "' . $table . '"', DEVLOG_SEVERITY_ERROR); |
|
| 370 | + self::devLog('Invalid UID "'.$uid.'" or table "'.$table.'"', DEVLOG_SEVERITY_ERROR); |
|
| 371 | 371 | return ''; |
| 372 | 372 | } |
| 373 | 373 | |
@@ -378,15 +378,15 @@ discard block |
||
| 378 | 378 | // Should we check for a specific PID, too? |
| 379 | 379 | if ($pid !== -1) { |
| 380 | 380 | $pid = max(intval($pid), 0); |
| 381 | - $where = $queryBuilder->expr()->eq($table . '.pid', $pid); |
|
| 381 | + $where = $queryBuilder->expr()->eq($table.'.pid', $pid); |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | // Get index_name from database. |
| 385 | 385 | $result = $queryBuilder |
| 386 | - ->select($table . '.index_name AS index_name') |
|
| 386 | + ->select($table.'.index_name AS index_name') |
|
| 387 | 387 | ->from($table) |
| 388 | 388 | ->where( |
| 389 | - $queryBuilder->expr()->eq($table . '.uid', $uid), |
|
| 389 | + $queryBuilder->expr()->eq($table.'.uid', $uid), |
|
| 390 | 390 | $where, |
| 391 | 391 | self::whereExpression($table) |
| 392 | 392 | ) |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | if ($resArray = $result->fetch()) { |
| 397 | 397 | return $resArray['index_name']; |
| 398 | 398 | } else { |
| 399 | - self::devLog('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', DEVLOG_SEVERITY_WARNING); |
|
| 399 | + self::devLog('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', DEVLOG_SEVERITY_WARNING); |
|
| 400 | 400 | return ''; |
| 401 | 401 | } |
| 402 | 402 | } |
@@ -415,9 +415,9 @@ discard block |
||
| 415 | 415 | // Analyze code and set appropriate ISO table. |
| 416 | 416 | $isoCode = strtolower(trim($code)); |
| 417 | 417 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
| 418 | - $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-2b.xml'; |
|
| 418 | + $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-2b.xml'; |
|
| 419 | 419 | } elseif (preg_match('/^[a-z]{2}$/', $isoCode)) { |
| 420 | - $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-1.xml'; |
|
| 420 | + $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-1.xml'; |
|
| 421 | 421 | } else { |
| 422 | 422 | // No ISO code, return unchanged. |
| 423 | 423 | return $code; |
@@ -434,13 +434,13 @@ discard block |
||
| 434 | 434 | $lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639); |
| 435 | 435 | } |
| 436 | 436 | } else { |
| 437 | - self::devLog('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', DEVLOG_SEVERITY_ERROR); |
|
| 437 | + self::devLog('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR); |
|
| 438 | 438 | return $code; |
| 439 | 439 | } |
| 440 | 440 | if (!empty($lang)) { |
| 441 | 441 | return $lang; |
| 442 | 442 | } else { |
| 443 | - self::devLog('Language code "' . $code . '" not found in ISO-639 table', DEVLOG_SEVERITY_NOTICE); |
|
| 443 | + self::devLog('Language code "'.$code.'" not found in ISO-639 table', DEVLOG_SEVERITY_NOTICE); |
|
| 444 | 444 | return $code; |
| 445 | 445 | } |
| 446 | 446 | } |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | } elseif (\TYPO3_MODE === 'BE') { |
| 469 | 469 | self::$messages = $GLOBALS['LANG']->includeLLFile($file, false, true); |
| 470 | 470 | } else { |
| 471 | - self::devLog('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', DEVLOG_SEVERITY_ERROR); |
|
| 471 | + self::devLog('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR); |
|
| 472 | 472 | } |
| 473 | 473 | } |
| 474 | 474 | // Get translation. |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | } elseif (\TYPO3_MODE === 'BE') { |
| 479 | 479 | $translated = $GLOBALS['LANG']->getLLL($key, self::$messages); |
| 480 | 480 | } else { |
| 481 | - self::devLog('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', DEVLOG_SEVERITY_ERROR); |
|
| 481 | + self::devLog('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR); |
|
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | 484 | // Escape HTML characters if applicable. |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | !$index_name |
| 506 | 506 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
| 507 | 507 | ) { |
| 508 | - self::devLog('Invalid UID ' . $index_name . ' or table "' . $table . '"', DEVLOG_SEVERITY_ERROR); |
|
| 508 | + self::devLog('Invalid UID '.$index_name.' or table "'.$table.'"', DEVLOG_SEVERITY_ERROR); |
|
| 509 | 509 | return ''; |
| 510 | 510 | } |
| 511 | 511 | |
@@ -516,14 +516,14 @@ discard block |
||
| 516 | 516 | // Should we check for a specific PID, too? |
| 517 | 517 | if ($pid !== -1) { |
| 518 | 518 | $pid = max(intval($pid), 0); |
| 519 | - $where = $queryBuilder->expr()->eq($table . '.pid', $pid); |
|
| 519 | + $where = $queryBuilder->expr()->eq($table.'.pid', $pid); |
|
| 520 | 520 | } |
| 521 | 521 | // Get index_name from database. |
| 522 | 522 | $result = $queryBuilder |
| 523 | - ->select($table . '.uid AS uid') |
|
| 523 | + ->select($table.'.uid AS uid') |
|
| 524 | 524 | ->from($table) |
| 525 | 525 | ->where( |
| 526 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
|
| 526 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)), |
|
| 527 | 527 | $where, |
| 528 | 528 | self::whereExpression($table) |
| 529 | 529 | ) |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | if (count($allResults) == 1) { |
| 536 | 536 | return $allResults[0]['uid']; |
| 537 | 537 | } else { |
| 538 | - self::devLog('No UID for given index_name "' . $index_name . '" and PID ' . $pid . ' found in table "' . $table . '"', DEVLOG_SEVERITY_WARNING); |
|
| 538 | + self::devLog('No UID for given index_name "'.$index_name.'" and PID '.$pid.' found in table "'.$table.'"', DEVLOG_SEVERITY_WARNING); |
|
| 539 | 539 | return ''; |
| 540 | 540 | } |
| 541 | 541 | } |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | '-' => 39, |
| 594 | 594 | ':' => 17, |
| 595 | 595 | ]; |
| 596 | - $urn = strtolower($base . $id); |
|
| 596 | + $urn = strtolower($base.$id); |
|
| 597 | 597 | if (preg_match('/[^a-z0-9:-]/', $urn)) { |
| 598 | 598 | self::devLog('Invalid chars in given parameters', DEVLOG_SEVERITY_WARNING); |
| 599 | 599 | return ''; |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | $checksum += ($i + 1) * intval(substr($digits, $i, 1)); |
| 608 | 608 | } |
| 609 | 609 | $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1); |
| 610 | - return $base . $id . $checksum; |
|
| 610 | + return $base.$id.$checksum; |
|
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | /** |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | // Cast to string for security reasons. |
| 639 | 639 | $key = (string) $key; |
| 640 | 640 | if (!$key) { |
| 641 | - self::devLog('Invalid key "' . $key . '" for session data retrieval', DEVLOG_SEVERITY_WARNING); |
|
| 641 | + self::devLog('Invalid key "'.$key.'" for session data retrieval', DEVLOG_SEVERITY_WARNING); |
|
| 642 | 642 | return; |
| 643 | 643 | } |
| 644 | 644 | // Get the session data. |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | } elseif (\TYPO3_MODE === 'BE') { |
| 648 | 648 | return $GLOBALS['BE_USER']->getSessionData($key); |
| 649 | 649 | } else { |
| 650 | - self::devLog('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', DEVLOG_SEVERITY_ERROR); |
|
| 650 | + self::devLog('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR); |
|
| 651 | 651 | return; |
| 652 | 652 | } |
| 653 | 653 | } |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | // Cast to string for security reasons. |
| 757 | 757 | $key = (string) $key; |
| 758 | 758 | if (!$key) { |
| 759 | - self::devLog('Invalid key "' . $key . '" for session data saving', DEVLOG_SEVERITY_WARNING); |
|
| 759 | + self::devLog('Invalid key "'.$key.'" for session data saving', DEVLOG_SEVERITY_WARNING); |
|
| 760 | 760 | return false; |
| 761 | 761 | } |
| 762 | 762 | // Save value in session data. |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | $GLOBALS['BE_USER']->setAndSaveSessionData($key, $value); |
| 769 | 769 | return true; |
| 770 | 770 | } else { |
| 771 | - self::devLog('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', DEVLOG_SEVERITY_ERROR); |
|
| 771 | + self::devLog('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR); |
|
| 772 | 772 | return false; |
| 773 | 773 | } |
| 774 | 774 | } |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | // Sanitize input. |
| 792 | 792 | $pid = max(intval($pid), 0); |
| 793 | 793 | if (!$pid) { |
| 794 | - self::devLog('Invalid PID ' . $pid . ' for translation', DEVLOG_SEVERITY_WARNING); |
|
| 794 | + self::devLog('Invalid PID '.$pid.' for translation', DEVLOG_SEVERITY_WARNING); |
|
| 795 | 795 | return $index_name; |
| 796 | 796 | } |
| 797 | 797 | // Check if "index_name" is an UID. |
@@ -808,13 +808,13 @@ discard block |
||
| 808 | 808 | // First fetch the uid of the received index_name |
| 809 | 809 | $result = $queryBuilder |
| 810 | 810 | ->select( |
| 811 | - $table . '.uid AS uid', |
|
| 812 | - $table . '.l18n_parent AS l18n_parent' |
|
| 811 | + $table.'.uid AS uid', |
|
| 812 | + $table.'.l18n_parent AS l18n_parent' |
|
| 813 | 813 | ) |
| 814 | 814 | ->from($table) |
| 815 | 815 | ->where( |
| 816 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 817 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
|
| 816 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 817 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)), |
|
| 818 | 818 | self::whereExpression($table, true) |
| 819 | 819 | ) |
| 820 | 820 | ->setMaxResults(1) |
@@ -827,12 +827,12 @@ discard block |
||
| 827 | 827 | $resArray = $allResults[0]; |
| 828 | 828 | |
| 829 | 829 | $result = $queryBuilder |
| 830 | - ->select($table . '.index_name AS index_name') |
|
| 830 | + ->select($table.'.index_name AS index_name') |
|
| 831 | 831 | ->from($table) |
| 832 | 832 | ->where( |
| 833 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 834 | - $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
|
| 835 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)), |
|
| 833 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 834 | + $queryBuilder->expr()->eq($table.'.uid', $resArray['l18n_parent']), |
|
| 835 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)), |
|
| 836 | 836 | self::whereExpression($table, true) |
| 837 | 837 | ) |
| 838 | 838 | ->setMaxResults(1) |
@@ -850,14 +850,14 @@ discard block |
||
| 850 | 850 | if (empty($labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$index_name])) { |
| 851 | 851 | // Check if this table is allowed for translation. |
| 852 | 852 | if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) { |
| 853 | - $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]); |
|
| 853 | + $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]); |
|
| 854 | 854 | if ($GLOBALS['TSFE']->sys_language_content > 0) { |
| 855 | 855 | $additionalWhere = $queryBuilder->expr()->andX( |
| 856 | 856 | $queryBuilder->expr()->orX( |
| 857 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
| 858 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)) |
|
| 857 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
| 858 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)) |
|
| 859 | 859 | ), |
| 860 | - $queryBuilder->expr()->eq($table . '.l18n_parent', 0) |
|
| 860 | + $queryBuilder->expr()->eq($table.'.l18n_parent', 0) |
|
| 861 | 861 | ); |
| 862 | 862 | } |
| 863 | 863 | |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | ->select('*') |
| 867 | 867 | ->from($table) |
| 868 | 868 | ->where( |
| 869 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 869 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 870 | 870 | $additionalWhere, |
| 871 | 871 | self::whereExpression($table, true) |
| 872 | 872 | ) |
@@ -884,10 +884,10 @@ discard block |
||
| 884 | 884 | } |
| 885 | 885 | } |
| 886 | 886 | } else { |
| 887 | - self::devLog('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', DEVLOG_SEVERITY_NOTICE); |
|
| 887 | + self::devLog('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', DEVLOG_SEVERITY_NOTICE); |
|
| 888 | 888 | } |
| 889 | 889 | } else { |
| 890 | - self::devLog('No translations available for table "' . $table . '"', DEVLOG_SEVERITY_WARNING); |
|
| 890 | + self::devLog('No translations available for table "'.$table.'"', DEVLOG_SEVERITY_WARNING); |
|
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | |
@@ -926,9 +926,9 @@ discard block |
||
| 926 | 926 | return GeneralUtility::makeInstance(ConnectionPool::class) |
| 927 | 927 | ->getQueryBuilderForTable($table) |
| 928 | 928 | ->expr() |
| 929 | - ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
| 929 | + ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
| 930 | 930 | } else { |
| 931 | - self::devLog('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', DEVLOG_SEVERITY_ERROR); |
|
| 931 | + self::devLog('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR); |
|
| 932 | 932 | return '1=-1'; |
| 933 | 933 | } |
| 934 | 934 | } |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | * @subpackage dlf |
| 25 | 25 | * @access public |
| 26 | 26 | */ |
| 27 | -class Helper |
|
| 28 | -{ |
|
| 27 | +class Helper { |
|
| 29 | 28 | /** |
| 30 | 29 | * The extension key |
| 31 | 30 | * |
@@ -73,8 +72,7 @@ discard block |
||
| 73 | 72 | * |
| 74 | 73 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
| 75 | 74 | */ |
| 76 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
| 77 | - { |
|
| 75 | + public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') { |
|
| 78 | 76 | $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 79 | 77 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 80 | 78 | $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
@@ -99,8 +97,7 @@ discard block |
||
| 99 | 97 | * |
| 100 | 98 | * @return bool Is $id a valid GNL identifier of the given $type? |
| 101 | 99 | */ |
| 102 | - public static function checkIdentifier($id, $type) |
|
| 103 | - { |
|
| 100 | + public static function checkIdentifier($id, $type) { |
|
| 104 | 101 | $digits = substr($id, 0, 8); |
| 105 | 102 | $checksum = 0; |
| 106 | 103 | for ($i = 0, $j = strlen($digits); $i < $j; $i++) { |
@@ -164,8 +161,7 @@ discard block |
||
| 164 | 161 | * |
| 165 | 162 | * @return mixed The decrypted value or false on error |
| 166 | 163 | */ |
| 167 | - public static function decrypt($encrypted) |
|
| 168 | - { |
|
| 164 | + public static function decrypt($encrypted) { |
|
| 169 | 165 | if ( |
| 170 | 166 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 171 | 167 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -205,8 +201,7 @@ discard block |
||
| 205 | 201 | * |
| 206 | 202 | * @return void |
| 207 | 203 | */ |
| 208 | - public static function devLog($message, $severity = 0) |
|
| 209 | - { |
|
| 204 | + public static function devLog($message, $severity = 0) { |
|
| 210 | 205 | if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog'])) { |
| 211 | 206 | $stacktrace = debug_backtrace(0, 2); |
| 212 | 207 | // Set some defaults. |
@@ -246,8 +241,7 @@ discard block |
||
| 246 | 241 | * |
| 247 | 242 | * @return mixed Hashed string or false on error |
| 248 | 243 | */ |
| 249 | - public static function digest($string) |
|
| 250 | - { |
|
| 244 | + public static function digest($string) { |
|
| 251 | 245 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
| 252 | 246 | self::devLog('OpenSSL library doesn\'t support hash algorithm', DEVLOG_SEVERITY_ERROR); |
| 253 | 247 | return false; |
@@ -266,8 +260,7 @@ discard block |
||
| 266 | 260 | * |
| 267 | 261 | * @return mixed Encrypted string or false on error |
| 268 | 262 | */ |
| 269 | - public static function encrypt($string) |
|
| 270 | - { |
|
| 263 | + public static function encrypt($string) { |
|
| 271 | 264 | if ( |
| 272 | 265 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 273 | 266 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -300,8 +293,7 @@ discard block |
||
| 300 | 293 | * |
| 301 | 294 | * @return string The unqualified class name |
| 302 | 295 | */ |
| 303 | - public static function getUnqualifiedClassName($qualifiedClassname) |
|
| 304 | - { |
|
| 296 | + public static function getUnqualifiedClassName($qualifiedClassname) { |
|
| 305 | 297 | $nameParts = explode('\\', $qualifiedClassname); |
| 306 | 298 | return end($nameParts); |
| 307 | 299 | } |
@@ -315,8 +307,7 @@ discard block |
||
| 315 | 307 | * |
| 316 | 308 | * @return string The cleaned up string |
| 317 | 309 | */ |
| 318 | - public static function getCleanString($string) |
|
| 319 | - { |
|
| 310 | + public static function getCleanString($string) { |
|
| 320 | 311 | // Convert to lowercase. |
| 321 | 312 | $string = strtolower($string); |
| 322 | 313 | // Remove non-alphanumeric characters. |
@@ -337,8 +328,7 @@ discard block |
||
| 337 | 328 | * |
| 338 | 329 | * @return array Array of hook objects for the class |
| 339 | 330 | */ |
| 340 | - public static function getHookObjects($scriptRelPath) |
|
| 341 | - { |
|
| 331 | + public static function getHookObjects($scriptRelPath) { |
|
| 342 | 332 | $hookObjects = []; |
| 343 | 333 | if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
| 344 | 334 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
@@ -359,8 +349,7 @@ discard block |
||
| 359 | 349 | * |
| 360 | 350 | * @return string "index_name" for the given UID |
| 361 | 351 | */ |
| 362 | - public static function getIndexNameFromUid($uid, $table, $pid = -1) |
|
| 363 | - { |
|
| 352 | + public static function getIndexNameFromUid($uid, $table, $pid = -1) { |
|
| 364 | 353 | // Sanitize input. |
| 365 | 354 | $uid = max(intval($uid), 0); |
| 366 | 355 | if ( |
@@ -410,8 +399,7 @@ discard block |
||
| 410 | 399 | * |
| 411 | 400 | * @return string Localized full name of language or unchanged input |
| 412 | 401 | */ |
| 413 | - public static function getLanguageName($code) |
|
| 414 | - { |
|
| 402 | + public static function getLanguageName($code) { |
|
| 415 | 403 | // Analyze code and set appropriate ISO table. |
| 416 | 404 | $isoCode = strtolower(trim($code)); |
| 417 | 405 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
@@ -456,8 +444,7 @@ discard block |
||
| 456 | 444 | * |
| 457 | 445 | * @return string The translated string or the given key on failure |
| 458 | 446 | */ |
| 459 | - public static function getMessage($key, $hsc = false, $default = '') |
|
| 460 | - { |
|
| 447 | + public static function getMessage($key, $hsc = false, $default = '') { |
|
| 461 | 448 | // Set initial output to default value. |
| 462 | 449 | $translated = (string) $default; |
| 463 | 450 | // Load common messages file. |
@@ -499,8 +486,7 @@ discard block |
||
| 499 | 486 | * |
| 500 | 487 | * @return string "uid" for the given index_name |
| 501 | 488 | */ |
| 502 | - public static function getUidFromIndexName($index_name, $table, $pid = -1) |
|
| 503 | - { |
|
| 489 | + public static function getUidFromIndexName($index_name, $table, $pid = -1) { |
|
| 504 | 490 | if ( |
| 505 | 491 | !$index_name |
| 506 | 492 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
@@ -551,8 +537,7 @@ discard block |
||
| 551 | 537 | * |
| 552 | 538 | * @return string Uniform Resource Name as string |
| 553 | 539 | */ |
| 554 | - public static function getURN($base, $id) |
|
| 555 | - { |
|
| 540 | + public static function getURN($base, $id) { |
|
| 556 | 541 | $concordance = [ |
| 557 | 542 | '0' => 1, |
| 558 | 543 | '1' => 2, |
@@ -619,8 +604,7 @@ discard block |
||
| 619 | 604 | * |
| 620 | 605 | * @return bool Is $id a valid PPN? |
| 621 | 606 | */ |
| 622 | - public static function isPPN($id) |
|
| 623 | - { |
|
| 607 | + public static function isPPN($id) { |
|
| 624 | 608 | return self::checkIdentifier($id, 'PPN'); |
| 625 | 609 | } |
| 626 | 610 | |
@@ -633,8 +617,7 @@ discard block |
||
| 633 | 617 | * |
| 634 | 618 | * @return mixed Session value for given key or null on failure |
| 635 | 619 | */ |
| 636 | - public static function loadFromSession($key) |
|
| 637 | - { |
|
| 620 | + public static function loadFromSession($key) { |
|
| 638 | 621 | // Cast to string for security reasons. |
| 639 | 622 | $key = (string) $key; |
| 640 | 623 | if (!$key) { |
@@ -666,8 +649,7 @@ discard block |
||
| 666 | 649 | * |
| 667 | 650 | * @return array Merged array |
| 668 | 651 | */ |
| 669 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
| 670 | - { |
|
| 652 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) { |
|
| 671 | 653 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 672 | 654 | return $original; |
| 673 | 655 | } |
@@ -684,8 +666,7 @@ discard block |
||
| 684 | 666 | * |
| 685 | 667 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
| 686 | 668 | */ |
| 687 | - public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
| 688 | - { |
|
| 669 | + public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) { |
|
| 689 | 670 | if ( |
| 690 | 671 | \TYPO3_MODE === 'BE' |
| 691 | 672 | && $GLOBALS['BE_USER']->isAdmin() |
@@ -731,8 +712,7 @@ discard block |
||
| 731 | 712 | * |
| 732 | 713 | * @return string All flash messages in the queue rendered as HTML. |
| 733 | 714 | */ |
| 734 | - public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') |
|
| 735 | - { |
|
| 715 | + public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') { |
|
| 736 | 716 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 737 | 717 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 738 | 718 | $flashMessages = $flashMessageQueue->getAllMessagesAndFlush(); |
@@ -751,8 +731,7 @@ discard block |
||
| 751 | 731 | * |
| 752 | 732 | * @return bool true on success, false on failure |
| 753 | 733 | */ |
| 754 | - public static function saveToSession($value, $key) |
|
| 755 | - { |
|
| 734 | + public static function saveToSession($value, $key) { |
|
| 756 | 735 | // Cast to string for security reasons. |
| 757 | 736 | $key = (string) $key; |
| 758 | 737 | if (!$key) { |
@@ -784,8 +763,7 @@ discard block |
||
| 784 | 763 | * |
| 785 | 764 | * @return string Localized label for $index_name |
| 786 | 765 | */ |
| 787 | - public static function translate($index_name, $table, $pid) |
|
| 788 | - { |
|
| 766 | + public static function translate($index_name, $table, $pid) { |
|
| 789 | 767 | // Load labels into static variable for future use. |
| 790 | 768 | static $labels = []; |
| 791 | 769 | // Sanitize input. |
@@ -908,8 +886,7 @@ discard block |
||
| 908 | 886 | * |
| 909 | 887 | * @return string Additional WHERE expression |
| 910 | 888 | */ |
| 911 | - public static function whereExpression($table, $showHidden = false) |
|
| 912 | - { |
|
| 889 | + public static function whereExpression($table, $showHidden = false) { |
|
| 913 | 890 | if (\TYPO3_MODE === 'FE') { |
| 914 | 891 | // Should we ignore the record's hidden flag? |
| 915 | 892 | $ignoreHide = 0; |
@@ -938,8 +915,7 @@ discard block |
||
| 938 | 915 | * |
| 939 | 916 | * @access private |
| 940 | 917 | */ |
| 941 | - private function __construct() |
|
| 942 | - { |
|
| 918 | + private function __construct() { |
|
| 943 | 919 | // This is a static class, thus no instances should be created. |
| 944 | 920 | } |
| 945 | 921 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
| 75 | 75 | */ |
| 76 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
| 76 | + public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages') |
|
| 77 | 77 | { |
| 78 | 78 | $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 79 | 79 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | $checksum = 'X'; |
| 116 | 116 | } |
| 117 | 117 | if (!preg_match('/[0-9]{8}[0-9X]{1}/i', $id)) { |
| 118 | - return false; |
|
| 118 | + return FALSE; |
|
| 119 | 119 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 120 | - return false; |
|
| 120 | + return FALSE; |
|
| 121 | 121 | } |
| 122 | 122 | break; |
| 123 | 123 | case 'ZDB': |
@@ -125,19 +125,19 @@ discard block |
||
| 125 | 125 | $checksum = 'X'; |
| 126 | 126 | } |
| 127 | 127 | if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) { |
| 128 | - return false; |
|
| 128 | + return FALSE; |
|
| 129 | 129 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 130 | - return false; |
|
| 130 | + return FALSE; |
|
| 131 | 131 | } |
| 132 | 132 | break; |
| 133 | 133 | case 'SWD': |
| 134 | 134 | $checksum = 11 - $checksum; |
| 135 | 135 | if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) { |
| 136 | - return false; |
|
| 136 | + return FALSE; |
|
| 137 | 137 | } elseif ($checksum == 10) { |
| 138 | 138 | return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
| 139 | 139 | } elseif (substr($id, -1, 1) != $checksum) { |
| 140 | - return false; |
|
| 140 | + return FALSE; |
|
| 141 | 141 | } |
| 142 | 142 | break; |
| 143 | 143 | case 'GKD': |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | $checksum = 'X'; |
| 147 | 147 | } |
| 148 | 148 | if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) { |
| 149 | - return false; |
|
| 149 | + return FALSE; |
|
| 150 | 150 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 151 | - return false; |
|
| 151 | + return FALSE; |
|
| 152 | 152 | } |
| 153 | 153 | break; |
| 154 | 154 | } |
| 155 | - return true; |
|
| 155 | + return TRUE; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -167,28 +167,28 @@ discard block |
||
| 167 | 167 | public static function decrypt($encrypted) |
| 168 | 168 | { |
| 169 | 169 | if ( |
| 170 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
| 171 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
| 170 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
| 171 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
| 172 | 172 | ) { |
| 173 | 173 | self::devLog('OpenSSL library doesn\'t support cipher and/or hash algorithm', DEVLOG_SEVERITY_ERROR); |
| 174 | - return false; |
|
| 174 | + return FALSE; |
|
| 175 | 175 | } |
| 176 | 176 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
| 177 | 177 | self::devLog('No encryption key set in TYPO3 configuration', DEVLOG_SEVERITY_ERROR); |
| 178 | - return false; |
|
| 178 | + return FALSE; |
|
| 179 | 179 | } |
| 180 | 180 | if ( |
| 181 | 181 | empty($encrypted) |
| 182 | 182 | || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm) |
| 183 | 183 | ) { |
| 184 | 184 | self::devLog('Invalid parameters given for decryption', DEVLOG_SEVERITY_ERROR); |
| 185 | - return false; |
|
| 185 | + return FALSE; |
|
| 186 | 186 | } |
| 187 | 187 | // Split initialisation vector and encrypted data. |
| 188 | 188 | $binary = base64_decode($encrypted); |
| 189 | 189 | $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 190 | 190 | $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 191 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
| 191 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
| 192 | 192 | // Decrypt data. |
| 193 | 193 | $decrypted = openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 194 | 194 | return $decrypted; |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | $arguments = '(' . implode(', ', $args) . ')'; |
| 235 | - $additionalData = (empty($data) ? false : $data); |
|
| 235 | + $additionalData = (empty($data) ? FALSE : $data); |
|
| 236 | 236 | /** @scrutinizer ignore-deprecated */ \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[' . $caller . $arguments . '] ' . $message, self::$extKey, $severity, $additionalData); |
| 237 | 237 | } |
| 238 | 238 | } |
@@ -248,9 +248,9 @@ discard block |
||
| 248 | 248 | */ |
| 249 | 249 | public static function digest($string) |
| 250 | 250 | { |
| 251 | - if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
|
| 251 | + if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) { |
|
| 252 | 252 | self::devLog('OpenSSL library doesn\'t support hash algorithm', DEVLOG_SEVERITY_ERROR); |
| 253 | - return false; |
|
| 253 | + return FALSE; |
|
| 254 | 254 | } |
| 255 | 255 | // Hash string. |
| 256 | 256 | $hashed = openssl_digest($string, self::$hashAlgorithm); |
@@ -269,23 +269,23 @@ discard block |
||
| 269 | 269 | public static function encrypt($string) |
| 270 | 270 | { |
| 271 | 271 | if ( |
| 272 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
| 273 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
| 272 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
| 273 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
| 274 | 274 | ) { |
| 275 | 275 | self::devLog('OpenSSL library doesn\'t support cipher and/or hash algorithm', DEVLOG_SEVERITY_ERROR); |
| 276 | - return false; |
|
| 276 | + return FALSE; |
|
| 277 | 277 | } |
| 278 | 278 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
| 279 | 279 | self::devLog('No encryption key set in TYPO3 configuration', DEVLOG_SEVERITY_ERROR); |
| 280 | - return false; |
|
| 280 | + return FALSE; |
|
| 281 | 281 | } |
| 282 | 282 | // Generate random initialisation vector. |
| 283 | 283 | $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 284 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
| 284 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
| 285 | 285 | // Encrypt data. |
| 286 | 286 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 287 | 287 | // Merge initialisation vector and encrypted data. |
| 288 | - if ($encrypted !== false) { |
|
| 288 | + if ($encrypted !== FALSE) { |
|
| 289 | 289 | $encrypted = base64_encode($iv . $encrypted); |
| 290 | 290 | } |
| 291 | 291 | return $encrypted; |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | $lang = $GLOBALS['TSFE']->getLLL($isoCode, $iso639); |
| 430 | 430 | } |
| 431 | 431 | } elseif (\TYPO3_MODE === 'BE') { |
| 432 | - $iso639 = $GLOBALS['LANG']->includeLLFile($file, false, true); |
|
| 432 | + $iso639 = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE); |
|
| 433 | 433 | if (!empty($iso639['default'][$isoCode])) { |
| 434 | 434 | $lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639); |
| 435 | 435 | } |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | * |
| 457 | 457 | * @return string The translated string or the given key on failure |
| 458 | 458 | */ |
| 459 | - public static function getMessage($key, $hsc = false, $default = '') |
|
| 459 | + public static function getMessage($key, $hsc = FALSE, $default = '') |
|
| 460 | 460 | { |
| 461 | 461 | // Set initial output to default value. |
| 462 | 462 | $translated = (string) $default; |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | if (\TYPO3_MODE === 'FE') { |
| 467 | 467 | self::$messages = $GLOBALS['TSFE']->readLLfile($file); |
| 468 | 468 | } elseif (\TYPO3_MODE === 'BE') { |
| 469 | - self::$messages = $GLOBALS['LANG']->includeLLFile($file, false, true); |
|
| 469 | + self::$messages = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE); |
|
| 470 | 470 | } else { |
| 471 | 471 | self::devLog('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', DEVLOG_SEVERITY_ERROR); |
| 472 | 472 | } |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | * |
| 667 | 667 | * @return array Merged array |
| 668 | 668 | */ |
| 669 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
| 669 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE) |
|
| 670 | 670 | { |
| 671 | 671 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 672 | 672 | return $original; |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | * |
| 685 | 685 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
| 686 | 686 | */ |
| 687 | - public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
| 687 | + public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = FALSE, $cmdFirst = FALSE) |
|
| 688 | 688 | { |
| 689 | 689 | if ( |
| 690 | 690 | \TYPO3_MODE === 'BE' |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | // Instantiate TYPO3 core engine. |
| 694 | 694 | $dataHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class); |
| 695 | 695 | // We do not use workspaces and have to bypass restrictions in DataHandler. |
| 696 | - $dataHandler->bypassWorkspaceRestrictions = true; |
|
| 696 | + $dataHandler->bypassWorkspaceRestrictions = TRUE; |
|
| 697 | 697 | // Load data and command arrays. |
| 698 | 698 | $dataHandler->start($data, $cmd); |
| 699 | 699 | // Process command map first if default order is reversed. |
@@ -757,19 +757,19 @@ discard block |
||
| 757 | 757 | $key = (string) $key; |
| 758 | 758 | if (!$key) { |
| 759 | 759 | self::devLog('Invalid key "' . $key . '" for session data saving', DEVLOG_SEVERITY_WARNING); |
| 760 | - return false; |
|
| 760 | + return FALSE; |
|
| 761 | 761 | } |
| 762 | 762 | // Save value in session data. |
| 763 | 763 | if (\TYPO3_MODE === 'FE') { |
| 764 | 764 | $GLOBALS['TSFE']->fe_user->setKey('ses', $key, $value); |
| 765 | 765 | $GLOBALS['TSFE']->fe_user->storeSessionData(); |
| 766 | - return true; |
|
| 766 | + return TRUE; |
|
| 767 | 767 | } elseif (\TYPO3_MODE === 'BE') { |
| 768 | 768 | $GLOBALS['BE_USER']->setAndSaveSessionData($key, $value); |
| 769 | - return true; |
|
| 769 | + return TRUE; |
|
| 770 | 770 | } else { |
| 771 | 771 | self::devLog('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', DEVLOG_SEVERITY_ERROR); |
| 772 | - return false; |
|
| 772 | + return FALSE; |
|
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | ->where( |
| 816 | 816 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 817 | 817 | $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
| 818 | - self::whereExpression($table, true) |
|
| 818 | + self::whereExpression($table, TRUE) |
|
| 819 | 819 | ) |
| 820 | 820 | ->setMaxResults(1) |
| 821 | 821 | ->execute(); |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 834 | 834 | $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
| 835 | 835 | $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)), |
| 836 | - self::whereExpression($table, true) |
|
| 836 | + self::whereExpression($table, TRUE) |
|
| 837 | 837 | ) |
| 838 | 838 | ->setMaxResults(1) |
| 839 | 839 | ->execute(); |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | ->where( |
| 869 | 869 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 870 | 870 | $additionalWhere, |
| 871 | - self::whereExpression($table, true) |
|
| 871 | + self::whereExpression($table, TRUE) |
|
| 872 | 872 | ) |
| 873 | 873 | ->setMaxResults(10000) |
| 874 | 874 | ->execute(); |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | * |
| 909 | 909 | * @return string Additional WHERE expression |
| 910 | 910 | */ |
| 911 | - public static function whereExpression($table, $showHidden = false) |
|
| 911 | + public static function whereExpression($table, $showHidden = FALSE) |
|
| 912 | 912 | { |
| 913 | 913 | if (\TYPO3_MODE === 'FE') { |
| 914 | 914 | // Should we ignore the record's hidden flag? |