@@ -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 |
| 121 | 121 | if ($this->doc->ready) { |
| 122 | - return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . ($this->doc->uid) . '" />'; |
|
| 122 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.($this->doc->uid).'" />'; |
|
| 123 | 123 | } |
| 124 | 124 | } elseif (!empty($list->metadata['options']['params']['filterquery'])) { |
| 125 | 125 | // Get document's UID from search metadata. |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | if (!empty($documentId)) { |
| 137 | - return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . $documentId . '" />'; |
|
| 137 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.$documentId.'" />'; |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | return ''; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | // Add encrypted fields to search form. |
| 159 | 159 | if ($name !== false) { |
| 160 | - return '<input type="hidden" name="' . $this->prefixId . '[encrypted]" value="' . $name . '" />'; |
|
| 160 | + return '<input type="hidden" name="'.$this->prefixId.'[encrypted]" value="'.$name.'" />'; |
|
| 161 | 161 | } else { |
| 162 | 162 | return ''; |
| 163 | 163 | } |
@@ -183,19 +183,19 @@ discard block |
||
| 183 | 183 | // Get operator options. |
| 184 | 184 | $operatorOptions = ''; |
| 185 | 185 | foreach (['AND', 'OR', 'NOT'] as $operator) { |
| 186 | - $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-' . $operator . '" value="' . $operator . '">' . htmlspecialchars($this->pi_getLL($operator, '')) . '</option>'; |
|
| 186 | + $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-'.$operator.'" value="'.$operator.'">'.htmlspecialchars($this->pi_getLL($operator, '')).'</option>'; |
|
| 187 | 187 | } |
| 188 | 188 | // Get field selector options. |
| 189 | 189 | $fieldSelectorOptions = ''; |
| 190 | 190 | $searchFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], true); |
| 191 | 191 | foreach ($searchFields as $searchField) { |
| 192 | - $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>'; |
|
| 192 | + $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>'; |
|
| 193 | 193 | } |
| 194 | 194 | for ($i = 0; $i < $this->conf['extendedSlotCount']; $i++) { |
| 195 | 195 | $markerArray = [ |
| 196 | - '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-' . $i . '" name="' . $this->prefixId . '[extOperator][' . $i . ']">' . $operatorOptions . '</select>', |
|
| 197 | - '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-' . $i . '" name="' . $this->prefixId . '[extField][' . $i . ']">' . $fieldSelectorOptions . '</select>', |
|
| 198 | - '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-' . $i . '" type="text" name="' . $this->prefixId . '[extQuery][' . $i . ']" />' |
|
| 196 | + '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-'.$i.'" name="'.$this->prefixId.'[extOperator]['.$i.']">'.$operatorOptions.'</select>', |
|
| 197 | + '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-'.$i.'" name="'.$this->prefixId.'[extField]['.$i.']">'.$fieldSelectorOptions.'</select>', |
|
| 198 | + '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-'.$i.'" type="text" name="'.$this->prefixId.'[extQuery]['.$i.']" />' |
|
| 199 | 199 | ]; |
| 200 | 200 | $extendedSearch .= $this->templateService->substituteMarkerArray($this->templateService->getSubpart($this->template, '###EXT_SEARCH_ENTRY###'), $markerArray); |
| 201 | 201 | } |
@@ -223,12 +223,12 @@ discard block |
||
| 223 | 223 | // Get facets from plugin configuration. |
| 224 | 224 | $facets = []; |
| 225 | 225 | foreach (GeneralUtility::trimExplode(',', $this->conf['facets'], true) as $facet) { |
| 226 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
| 226 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
| 227 | 227 | } |
| 228 | 228 | // Render facets menu. |
| 229 | 229 | $TSconfig = []; |
| 230 | 230 | $TSconfig['special'] = 'userfunction'; |
| 231 | - $TSconfig['special.']['userFunc'] = \Kitodo\Dlf\Plugin\Search::class . '->makeFacetsMenuArray'; |
|
| 231 | + $TSconfig['special.']['userFunc'] = \Kitodo\Dlf\Plugin\Search::class.'->makeFacetsMenuArray'; |
|
| 232 | 232 | $TSconfig['special.']['facets'] = $facets; |
| 233 | 233 | $TSconfig['special.']['limit'] = max(intval($this->conf['limitFacets']), 1); |
| 234 | 234 | $TSconfig = Helper::mergeRecursiveWithOverrule($this->conf['facetsConf.'], $TSconfig); |
@@ -249,10 +249,10 @@ discard block |
||
| 249 | 249 | $output = ''; |
| 250 | 250 | // Check for plugin configuration. |
| 251 | 251 | if (!empty($this->conf['fulltext'])) { |
| 252 | - $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"' : '') . ' />'; |
|
| 253 | - $output .= ' <label for="tx-dlf-search-fulltext-no">' . htmlspecialchars($this->pi_getLL('label.inMetadata', '')) . '</label>'; |
|
| 254 | - $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"' : '') . '/>'; |
|
| 255 | - $output .= ' <label for="tx-dlf-search-fulltext-yes">' . htmlspecialchars($this->pi_getLL('label.inFulltext', '')) . '</label>'; |
|
| 252 | + $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"' : '').' />'; |
|
| 253 | + $output .= ' <label for="tx-dlf-search-fulltext-no">'.htmlspecialchars($this->pi_getLL('label.inMetadata', '')).'</label>'; |
|
| 254 | + $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"' : '').'/>'; |
|
| 255 | + $output .= ' <label for="tx-dlf-search-fulltext-yes">'.htmlspecialchars($this->pi_getLL('label.inFulltext', '')).'</label>'; |
|
| 256 | 256 | } |
| 257 | 257 | return $output; |
| 258 | 258 | } |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | $output = ''; |
| 270 | 270 | // Check for plugin configuration. |
| 271 | 271 | if (!empty($this->conf['showLogicalPageField'])) { |
| 272 | - $output .= ' <label for="tx-dlf-search-logical-page">' . htmlspecialchars($this->pi_getLL('label.logicalPage', '')) . ': </label>'; |
|
| 273 | - $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="' . $this->prefixId . '[logicalPage]" />'; |
|
| 272 | + $output .= ' <label for="tx-dlf-search-logical-page">'.htmlspecialchars($this->pi_getLL('label.logicalPage', '')).': </label>'; |
|
| 273 | + $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="'.$this->prefixId.'[logicalPage]" />'; |
|
| 274 | 274 | } |
| 275 | 275 | return $output; |
| 276 | 276 | } |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | $entryArray['doNotLinkIt'] = 0; |
| 312 | 312 | // Check if facet is already selected. |
| 313 | 313 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
| 314 | - $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
|
| 314 | + $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn); |
|
| 315 | 315 | if ($index !== false) { |
| 316 | 316 | // Facet is selected, thus remove it from filter. |
| 317 | 317 | unset($queryColumn[$index]); |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | } else { |
| 330 | 330 | // Facet is not selected, thus add it to filter. |
| 331 | - $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")'; |
|
| 331 | + $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")'; |
|
| 332 | 332 | $entryArray['ITEM_STATE'] = 'NO'; |
| 333 | 333 | } |
| 334 | 334 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(['query' => $search['query'], 'fq' => $queryColumn]); |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | '###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf), |
| 385 | 385 | '###LABEL_QUERY###' => (!empty($search['query']) ? htmlspecialchars($search['query']) : htmlspecialchars($this->pi_getLL('label.query'))), |
| 386 | 386 | '###LABEL_SUBMIT###' => htmlspecialchars($this->pi_getLL('label.submit')), |
| 387 | - '###FIELD_QUERY###' => $this->prefixId . '[query]', |
|
| 387 | + '###FIELD_QUERY###' => $this->prefixId.'[query]', |
|
| 388 | 388 | '###QUERY###' => (!empty($search['query']) ? htmlspecialchars($search['query']) : ''), |
| 389 | 389 | '###FULLTEXTSWITCH###' => $this->addFulltextSwitch($list->metadata['fulltextSearch']), |
| 390 | 390 | '###FIELD_DOC###' => ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all' ? $this->addCurrentDocument() : ''), |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $this->piVars['query'] = empty($matches[1]) ? $this->piVars['query'] : $matches[1]; |
| 417 | 417 | // Search in fulltext field if applicable. Query must not be empty! |
| 418 | 418 | if (!empty($this->piVars['query'])) { |
| 419 | - $query = 'fulltext:(' . Solr::escapeQuery(trim($this->piVars['query'])) . ')'; |
|
| 419 | + $query = 'fulltext:('.Solr::escapeQuery(trim($this->piVars['query'])).')'; |
|
| 420 | 420 | } |
| 421 | 421 | } else { |
| 422 | 422 | // Retain given search field if valid. |
@@ -437,9 +437,9 @@ discard block |
||
| 437 | 437 | && in_array($this->piVars['extField'][$i], $allowedFields) |
| 438 | 438 | ) { |
| 439 | 439 | if (!empty($query)) { |
| 440 | - $query .= ' ' . $this->piVars['extOperator'][$i] . ' '; |
|
| 440 | + $query .= ' '.$this->piVars['extOperator'][$i].' '; |
|
| 441 | 441 | } |
| 442 | - $query .= Indexer::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']) . ':(' . Solr::escapeQuery($this->piVars['extQuery'][$i]) . ')'; |
|
| 442 | + $query .= Indexer::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']).':('.Solr::escapeQuery($this->piVars['extQuery'][$i]).')'; |
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | } |
@@ -460,9 +460,9 @@ discard block |
||
| 460 | 460 | && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id']) |
| 461 | 461 | ) { |
| 462 | 462 | // Search in document and all subordinates (valid for up to three levels of hierarchy). |
| 463 | - $params['filterquery'][]['query'] = '_query_:"{!join from=uid to=partof}uid:{!join from=uid to=partof}uid:' . $this->piVars['id'] . '"' . |
|
| 464 | - ' OR {!join from=uid to=partof}uid:' . $this->piVars['id'] . |
|
| 465 | - ' OR uid:' . $this->piVars['id']; |
|
| 463 | + $params['filterquery'][]['query'] = '_query_:"{!join from=uid to=partof}uid:{!join from=uid to=partof}uid:'.$this->piVars['id'].'"'. |
|
| 464 | + ' OR {!join from=uid to=partof}uid:'.$this->piVars['id']. |
|
| 465 | + ' OR uid:'.$this->piVars['id']; |
|
| 466 | 466 | $label .= htmlspecialchars(sprintf($this->pi_getLL('in', ''), Document::getTitle($this->piVars['id']))); |
| 467 | 467 | } |
| 468 | 468 | } |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['collection']) |
| 477 | 477 | ) { |
| 478 | 478 | $index_name = Helper::getIndexNameFromUid($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']); |
| 479 | - $params['filterquery'][]['query'] = 'collection_faceting:("' . Solr::escapeQuery($index_name) . '")'; |
|
| 479 | + $params['filterquery'][]['query'] = 'collection_faceting:("'.Solr::escapeQuery($index_name).'")'; |
|
| 480 | 480 | $label .= sprintf($this->pi_getLL('in', '', true), Helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
| 481 | 481 | } |
| 482 | 482 | } |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | $collIndexNames[] = Solr::escapeQuery(Helper::getIndexNameFromUid(intval($collId), 'tx_dlf_collections', $this->conf['pages'])); |
| 489 | 489 | } |
| 490 | 490 | // Last value is fake and used for distinction in $this->addCurrentCollection() |
| 491 | - $params['filterquery'][]['query'] = 'collection_faceting:("' . implode('" OR "', $collIndexNames) . '" OR "FakeValueForDistinction")'; |
|
| 491 | + $params['filterquery'][]['query'] = 'collection_faceting:("'.implode('" OR "', $collIndexNames).'" OR "FakeValueForDistinction")'; |
|
| 492 | 492 | } |
| 493 | 493 | // Set some query parameters. |
| 494 | 494 | $params['query'] = !empty($query) ? $query : '*'; |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | $linkConf['forceAbsoluteUrl.']['scheme'] = !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'; |
| 539 | 539 | $linkConf['additionalParams'] = GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', true, false); |
| 540 | 540 | // Send headers. |
| 541 | - header('Location: ' . GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
| 541 | + header('Location: '.GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
| 542 | 542 | exit; |
| 543 | 543 | } |
| 544 | 544 | } |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | * @subpackage dlf |
| 32 | 32 | * @access public |
| 33 | 33 | */ |
| 34 | -class Search extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 35 | -{ |
|
| 34 | +class Search extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 36 | 35 | public $scriptRelPath = 'Classes/Plugin/Search.php'; |
| 37 | 36 | |
| 38 | 37 | /** |
@@ -42,8 +41,7 @@ discard block |
||
| 42 | 41 | * |
| 43 | 42 | * @return void |
| 44 | 43 | */ |
| 45 | - protected function addAutocompleteJS() |
|
| 46 | - { |
|
| 44 | + protected function addAutocompleteJS() { |
|
| 47 | 45 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 48 | 46 | ->getQueryBuilderForTable('tx_dlf_documents'); |
| 49 | 47 | |
@@ -74,8 +72,7 @@ discard block |
||
| 74 | 72 | * |
| 75 | 73 | * @return string HTML input fields with current document's UID and parent ID |
| 76 | 74 | */ |
| 77 | - protected function addCurrentCollection() |
|
| 78 | - { |
|
| 75 | + protected function addCurrentCollection() { |
|
| 79 | 76 | // Load current collection. |
| 80 | 77 | $list = GeneralUtility::makeInstance(DocumentList::class); |
| 81 | 78 | if ( |
@@ -107,8 +104,7 @@ discard block |
||
| 107 | 104 | * |
| 108 | 105 | * @return string HTML input fields with current document's UID |
| 109 | 106 | */ |
| 110 | - protected function addCurrentDocument() |
|
| 111 | - { |
|
| 107 | + protected function addCurrentDocument() { |
|
| 112 | 108 | // Load current list object. |
| 113 | 109 | $list = GeneralUtility::makeInstance(DocumentList::class); |
| 114 | 110 | // Load current document. |
@@ -147,8 +143,7 @@ discard block |
||
| 147 | 143 | * |
| 148 | 144 | * @return string HTML input fields with encrypted core name and hash |
| 149 | 145 | */ |
| 150 | - protected function addEncryptedCoreName() |
|
| 151 | - { |
|
| 146 | + protected function addEncryptedCoreName() { |
|
| 152 | 147 | // Get core name. |
| 153 | 148 | $name = Helper::getIndexNameFromUid($this->conf['solrcore'], 'tx_dlf_solrcores'); |
| 154 | 149 | // Encrypt core name. |
@@ -170,8 +165,7 @@ discard block |
||
| 170 | 165 | * |
| 171 | 166 | * @return string The extended search form or an empty string |
| 172 | 167 | */ |
| 173 | - protected function addExtendedSearch() |
|
| 174 | - { |
|
| 168 | + protected function addExtendedSearch() { |
|
| 175 | 169 | $extendedSearch = ''; |
| 176 | 170 | // Quit without doing anything if no fields for extended search are selected. |
| 177 | 171 | if ( |
@@ -209,8 +203,7 @@ discard block |
||
| 209 | 203 | * |
| 210 | 204 | * @return string HTML output of facets menu |
| 211 | 205 | */ |
| 212 | - protected function addFacetsMenu() |
|
| 213 | - { |
|
| 206 | + protected function addFacetsMenu() { |
|
| 214 | 207 | // Check for typoscript configuration to prevent fatal error. |
| 215 | 208 | if (empty($this->conf['facetsConf.'])) { |
| 216 | 209 | Helper::devLog('Incomplete plugin configuration', DEVLOG_SEVERITY_WARNING); |
@@ -244,8 +237,7 @@ discard block |
||
| 244 | 237 | * |
| 245 | 238 | * @return string HTML output of fulltext switch |
| 246 | 239 | */ |
| 247 | - protected function addFulltextSwitch($isFulltextSearch = 0) |
|
| 248 | - { |
|
| 240 | + protected function addFulltextSwitch($isFulltextSearch = 0) { |
|
| 249 | 241 | $output = ''; |
| 250 | 242 | // Check for plugin configuration. |
| 251 | 243 | if (!empty($this->conf['fulltext'])) { |
@@ -264,8 +256,7 @@ discard block |
||
| 264 | 256 | * |
| 265 | 257 | * @return string HTML output of logical page field |
| 266 | 258 | */ |
| 267 | - protected function addLogicalPage() |
|
| 268 | - { |
|
| 259 | + protected function addLogicalPage() { |
|
| 269 | 260 | $output = ''; |
| 270 | 261 | // Check for plugin configuration. |
| 271 | 262 | if (!empty($this->conf['showLogicalPageField'])) { |
@@ -288,8 +279,7 @@ discard block |
||
| 288 | 279 | * |
| 289 | 280 | * @return array The array for the facet's menu entry |
| 290 | 281 | */ |
| 291 | - protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) |
|
| 292 | - { |
|
| 282 | + protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
| 293 | 283 | $entryArray = []; |
| 294 | 284 | // Translate value. |
| 295 | 285 | if ($field == 'owner_faceting') { |
@@ -345,8 +335,7 @@ discard block |
||
| 345 | 335 | * |
| 346 | 336 | * @return string The content that is displayed on the website |
| 347 | 337 | */ |
| 348 | - public function main($content, $conf) |
|
| 349 | - { |
|
| 338 | + public function main($content, $conf) { |
|
| 350 | 339 | $this->init($conf); |
| 351 | 340 | // Disable caching for this plugin. |
| 352 | 341 | $this->setCache(false); |
@@ -553,8 +542,7 @@ discard block |
||
| 553 | 542 | * |
| 554 | 543 | * @return array HMENU array |
| 555 | 544 | */ |
| 556 | - public function makeFacetsMenuArray($content, $conf) |
|
| 557 | - { |
|
| 545 | + public function makeFacetsMenuArray($content, $conf) { |
|
| 558 | 546 | $this->init($conf); |
| 559 | 547 | $menuArray = []; |
| 560 | 548 | // Set default value for facet search. |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | // The string may be e.g. "{!join from=uid to=partof}uid:{!join from=uid to=partof}uid:2" OR {!join from=uid to=partof}uid:2 OR uid:2" |
| 127 | 127 | // or "collection_faceting:("Some Collection Title")" |
| 128 | 128 | foreach ($list->metadata['options']['params']['filterquery'] as $facet) { |
| 129 | - if (($lastUidPos = strrpos($facet['query'], 'uid:')) !== false) { |
|
| 129 | + if (($lastUidPos = strrpos($facet['query'], 'uid:')) !== FALSE) { |
|
| 130 | 130 | $facetKeyVal = explode(':', substr($facet['query'], $lastUidPos)); |
| 131 | 131 | if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($facetKeyVal[1])) { |
| 132 | 132 | $documentId = (int) $facetKeyVal[1]; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $name = Helper::encrypt($name); |
| 157 | 157 | } |
| 158 | 158 | // Add encrypted fields to search form. |
| 159 | - if ($name !== false) { |
|
| 159 | + if ($name !== FALSE) { |
|
| 160 | 160 | return '<input type="hidden" name="' . $this->prefixId . '[encrypted]" value="' . $name . '" />'; |
| 161 | 161 | } else { |
| 162 | 162 | return ''; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | // Get field selector options. |
| 189 | 189 | $fieldSelectorOptions = ''; |
| 190 | - $searchFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], true); |
|
| 190 | + $searchFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
| 191 | 191 | foreach ($searchFields as $searchField) { |
| 192 | 192 | $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>'; |
| 193 | 193 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | // Get facets from plugin configuration. |
| 224 | 224 | $facets = []; |
| 225 | - foreach (GeneralUtility::trimExplode(',', $this->conf['facets'], true) as $facet) { |
|
| 225 | + foreach (GeneralUtility::trimExplode(',', $this->conf['facets'], TRUE) as $facet) { |
|
| 226 | 226 | $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
| 227 | 227 | } |
| 228 | 228 | // Render facets menu. |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | // Check if facet is already selected. |
| 313 | 313 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
| 314 | 314 | $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
| 315 | - if ($index !== false) { |
|
| 315 | + if ($index !== FALSE) { |
|
| 316 | 316 | // Facet is selected, thus remove it from filter. |
| 317 | 317 | unset($queryColumn[$index]); |
| 318 | 318 | $queryColumn = array_values($queryColumn); |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | //Reset facets |
| 322 | 322 | if ($this->conf['resetFacets']) { |
| 323 | 323 | //remove ($count) for selected facet in template |
| 324 | - $entryArray['count'] = false; |
|
| 324 | + $entryArray['count'] = FALSE; |
|
| 325 | 325 | //build link to delete selected facet |
| 326 | 326 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(['query' => $search['query'], 'fq' => $queryColumn]); |
| 327 | 327 | $entryArray['title'] = sprintf($this->pi_getLL('resetFacet', ''), $entryArray['title']); |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | { |
| 350 | 350 | $this->init($conf); |
| 351 | 351 | // Disable caching for this plugin. |
| 352 | - $this->setCache(false); |
|
| 352 | + $this->setCache(FALSE); |
|
| 353 | 353 | // Quit without doing anything if required variables are not set. |
| 354 | 354 | if (empty($this->conf['solrcore'])) { |
| 355 | 355 | Helper::devLog('Incomplete plugin configuration', DEVLOG_SEVERITY_WARNING); |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | && is_array($this->piVars['extQuery']) |
| 429 | 429 | ) { |
| 430 | 430 | $allowedOperators = ['AND', 'OR', 'NOT']; |
| 431 | - $allowedFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], true); |
|
| 431 | + $allowedFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
| 432 | 432 | $numberOfExtQueries = count($this->piVars['extQuery']); |
| 433 | 433 | for ($i = 0; $i < $numberOfExtQueries; $i++) { |
| 434 | 434 | if (!empty($this->piVars['extQuery'][$i])) { |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | ) { |
| 478 | 478 | $index_name = Helper::getIndexNameFromUid($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']); |
| 479 | 479 | $params['filterquery'][]['query'] = 'collection_faceting:("' . Solr::escapeQuery($index_name) . '")'; |
| 480 | - $label .= sprintf($this->pi_getLL('in', '', true), Helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
|
| 480 | + $label .= sprintf($this->pi_getLL('in', '', TRUE), Helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
|
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | // Add filter query for collection restrictions. |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | } |
| 537 | 537 | $linkConf['forceAbsoluteUrl'] = !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0; |
| 538 | 538 | $linkConf['forceAbsoluteUrl.']['scheme'] = !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'; |
| 539 | - $linkConf['additionalParams'] = GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', true, false); |
|
| 539 | + $linkConf['additionalParams'] = GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE); |
|
| 540 | 540 | // Send headers. |
| 541 | 541 | header('Location: ' . GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
| 542 | 542 | 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,7 +369,7 @@ discard block |
||
| 369 | 369 | // Set filter query to just get toplevel documents. |
| 370 | 370 | $params['filterquery'][] = ['query' => 'toplevel:true']; |
| 371 | 371 | // Set join query to get all documents with the same uids. |
| 372 | - $params['query'] = '{!join from=uid to=uid}' . $params['query']; |
|
| 372 | + $params['query'] = '{!join from=uid to=uid}'.$params['query']; |
|
| 373 | 373 | // Perform search to determine the total number of toplevel hits and fetch the required rows. |
| 374 | 374 | $selectQuery = $this->service->createSelect($params); |
| 375 | 375 | $results = $this->service->select($selectQuery); |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | // Set query. |
| 427 | 427 | $parameters['query'] = $query; |
| 428 | 428 | // Calculate cache identifier. |
| 429 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
| 429 | + $cacheIdentifier = Helper::digest($this->core.print_r(array_merge($this->params, $parameters), true)); |
|
| 430 | 430 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 431 | 431 | $resultSet = []; |
| 432 | 432 | if (($entry = $cache->get($cacheIdentifier)) === false) { |
@@ -557,12 +557,12 @@ discard block |
||
| 557 | 557 | */ |
| 558 | 558 | public function __get($var) |
| 559 | 559 | { |
| 560 | - $method = '_get' . ucfirst($var); |
|
| 560 | + $method = '_get'.ucfirst($var); |
|
| 561 | 561 | if ( |
| 562 | 562 | !property_exists($this, $var) |
| 563 | 563 | || !method_exists($this, $method) |
| 564 | 564 | ) { |
| 565 | - Helper::devLog('There is no getter function for property "' . $var . '"', DEVLOG_SEVERITY_WARNING); |
|
| 565 | + Helper::devLog('There is no getter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING); |
|
| 566 | 566 | return; |
| 567 | 567 | } else { |
| 568 | 568 | return $this->$method(); |
@@ -595,12 +595,12 @@ discard block |
||
| 595 | 595 | */ |
| 596 | 596 | public function __set($var, $value) |
| 597 | 597 | { |
| 598 | - $method = '_set' . ucfirst($var); |
|
| 598 | + $method = '_set'.ucfirst($var); |
|
| 599 | 599 | if ( |
| 600 | 600 | !property_exists($this, $var) |
| 601 | 601 | || !method_exists($this, $method) |
| 602 | 602 | ) { |
| 603 | - Helper::devLog('There is no setter function for property "' . $var . '"', DEVLOG_SEVERITY_WARNING); |
|
| 603 | + Helper::devLog('There is no setter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING); |
|
| 604 | 604 | } else { |
| 605 | 605 | $this->$method($value); |
| 606 | 606 | } |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | 'scheme' => $this->config['scheme'], |
| 638 | 638 | 'host' => $this->config['host'], |
| 639 | 639 | 'port' => $this->config['port'], |
| 640 | - 'path' => '/' . $this->config['path'], |
|
| 640 | + 'path' => '/'.$this->config['path'], |
|
| 641 | 641 | 'core' => $core, |
| 642 | 642 | 'username' => $this->config['username'], |
| 643 | 643 | 'password' => $this->config['password'], |