@@ -28,8 +28,7 @@ |
||
28 | 28 | * |
29 | 29 | * @access public |
30 | 30 | */ |
31 | -class CollectionController extends AbstractController |
|
32 | -{ |
|
31 | +class CollectionController extends AbstractController { |
|
33 | 32 | /** |
34 | 33 | * @access protected |
35 | 34 | * @var CollectionRepository |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | if (count($collections) == 1 && empty($this->settings['dont_show_single']) && is_array($collections)) { |
101 | - $this->forward('show', null, null, ['collection' => array_pop($collections)]); |
|
101 | + $this->forward('show', NULL, NULL, ['collection' => array_pop($collections)]); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $processedCollections = $this->processCollections($collections, $solr); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $searchParams['collection'] = $collection; |
141 | 141 | // If a targetPid is given, the results will be shown by ListView on the target page. |
142 | 142 | if (!empty($this->settings['targetPid'])) { |
143 | - $this->redirect('main', 'ListView', null, |
|
143 | + $this->redirect('main', 'ListView', NULL, |
|
144 | 144 | [ |
145 | 145 | 'searchParameter' => $searchParams, |
146 | 146 | 'page' => $currentPage |
@@ -149,16 +149,16 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | // get all metadata records to be shown in results |
152 | - $listedMetadata = $this->metadataRepository->findByIsListed(true); |
|
152 | + $listedMetadata = $this->metadataRepository->findByIsListed(TRUE); |
|
153 | 153 | |
154 | 154 | // get all indexed metadata fields |
155 | - $indexedMetadata = $this->metadataRepository->findByIndexIndexed(true); |
|
155 | + $indexedMetadata = $this->metadataRepository->findByIndexIndexed(TRUE); |
|
156 | 156 | |
157 | 157 | // get all sortable metadata records |
158 | - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); |
|
158 | + $sortableMetadata = $this->metadataRepository->findByIsSortable(TRUE); |
|
159 | 159 | |
160 | 160 | // get all documents of given collection |
161 | - $solrResults = null; |
|
161 | + $solrResults = NULL; |
|
162 | 162 | if (is_array($searchParams) && !empty($searchParams)) { |
163 | 163 | $solrResults = $this->documentRepository->findSolrByCollection($collection, $this->settings, $searchParams, $listedMetadata, $indexedMetadata); |
164 | 164 | |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | // if search was triggered, get search parameters from POST variables |
195 | 195 | $searchParams = $this->getParametersSafely('searchParameter'); |
196 | 196 | |
197 | - $collection = null; |
|
197 | + $collection = NULL; |
|
198 | 198 | if ($searchParams['collection']['__identity'] && MathUtility::canBeInterpretedAsInteger($searchParams['collection']['__identity'])) { |
199 | 199 | $collection = $this->collectionRepository->findByUid($searchParams['collection']['__identity']); |
200 | 200 | } |
201 | 201 | |
202 | 202 | // output is done by show action |
203 | - $this->forward('show', null, null, ['searchParameter' => $searchParams, 'collection' => $collection]); |
|
203 | + $this->forward('show', NULL, NULL, ['searchParameter' => $searchParams, 'collection' => $collection]); |
|
204 | 204 | |
205 | 205 | } |
206 | 206 |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $simplePagination = new SimplePagination($solrPaginator); |
169 | 169 | |
170 | 170 | $pagination = $this->buildSimplePagination($simplePagination, $solrPaginator); |
171 | - $this->view->assignMultiple([ 'pagination' => $pagination, 'paginator' => $solrPaginator ]); |
|
171 | + $this->view->assignMultiple(['pagination' => $pagination, 'paginator' => $solrPaginator]); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | $this->view->assign('viewData', $this->viewData); |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | foreach ($collections as $collection) { |
221 | 221 | $solrQuery = ''; |
222 | 222 | if ($collection->getIndexSearch() != '') { |
223 | - $solrQuery .= '(' . $collection->getIndexSearch() . ')'; |
|
223 | + $solrQuery .= '('.$collection->getIndexSearch().')'; |
|
224 | 224 | } else { |
225 | - $solrQuery .= 'collection:("' . Solr::escapeQuery($collection->getIndexName()) . '")'; |
|
225 | + $solrQuery .= 'collection:("'.Solr::escapeQuery($collection->getIndexName()).'")'; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | // We only care about the UID and partOf in the results and want them sorted |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | if ($collection->getIndexSearch()) { |
237 | 237 | $params['query'] = $solrQuery; |
238 | 238 | } else { |
239 | - $params['query'] = $solrQuery . ' AND partof:0 AND toplevel:true'; |
|
239 | + $params['query'] = $solrQuery.' AND partof:0 AND toplevel:true'; |
|
240 | 240 | } |
241 | 241 | $partOfNothing = $solr->searchRaw($params); |
242 | 242 | |
243 | - $params['query'] = $solrQuery . ' AND NOT partof:0 AND toplevel:true'; |
|
243 | + $params['query'] = $solrQuery.' AND NOT partof:0 AND toplevel:true'; |
|
244 | 244 | $partOfSomething = $solr->searchRaw($params); |
245 | 245 | |
246 | 246 | $collectionInfo = []; |
@@ -42,8 +42,7 @@ |
||
42 | 42 | * |
43 | 43 | * @access public |
44 | 44 | */ |
45 | -class NewTenantController extends AbstractController |
|
46 | -{ |
|
45 | +class NewTenantController extends AbstractController { |
|
47 | 46 | /** |
48 | 47 | * @access protected |
49 | 48 | * @var int |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | $data['tx_dlf_metadata'][uniqid('NEW')] = [ |
252 | 252 | 'pid' => $this->pid, |
253 | - 'label' => $this->getLLL('metadata.' . $indexName, $this->siteLanguages[0]->getTypo3Language(), $metadataLabels), |
|
253 | + 'label' => $this->getLLL('metadata.'.$indexName, $this->siteLanguages[0]->getTypo3Language(), $metadataLabels), |
|
254 | 254 | 'index_name' => $indexName, |
255 | 255 | 'format' => implode(',', $formatIds), |
256 | 256 | 'default_value' => $values['default_value'], |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | 'pid' => $this->pid, |
290 | 290 | 'sys_language_uid' => $siteLanguage->getLanguageId(), |
291 | 291 | 'l18n_parent' => $id, |
292 | - 'label' => $this->getLLL('metadata.' . $indexName, $siteLanguage->getTypo3Language(), $metadataLabels), |
|
292 | + 'label' => $this->getLLL('metadata.'.$indexName, $siteLanguage->getTypo3Language(), $metadataLabels), |
|
293 | 293 | ]; |
294 | 294 | } |
295 | 295 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | if ($this->solrCoreRepository->findOneByPid($this->pid) === null) { |
317 | 317 | $newRecord = GeneralUtility::makeInstance(SolrCore::class); |
318 | - $newRecord->setLabel($this->getLLL('flexform.solrcore', $this->siteLanguages[0]->getTypo3Language(), $beLabels). ' (PID ' . $this->pid . ')'); |
|
318 | + $newRecord->setLabel($this->getLLL('flexform.solrcore', $this->siteLanguages[0]->getTypo3Language(), $beLabels).' (PID '.$this->pid.')'); |
|
319 | 319 | $indexName = Solr::createCore(''); |
320 | 320 | if (!empty($indexName)) { |
321 | 321 | $newRecord->setIndexName($indexName); |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | $data['tx_dlf_structures'][uniqid('NEW')] = [ |
356 | 356 | 'pid' => $this->pid, |
357 | 357 | 'toplevel' => $values['toplevel'], |
358 | - 'label' => $this->getLLL('structure.' . $indexName, $this->siteLanguages[0]->getTypo3Language(), $structureLabels), |
|
358 | + 'label' => $this->getLLL('structure.'.$indexName, $this->siteLanguages[0]->getTypo3Language(), $structureLabels), |
|
359 | 359 | 'index_name' => $indexName, |
360 | 360 | 'oai_name' => $values['oai_name'], |
361 | 361 | 'thumbnail' => 0, |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | 'pid' => $this->pid, |
381 | 381 | 'sys_language_uid' => $siteLanguage->getLanguageId(), |
382 | 382 | 'l18n_parent' => $id, |
383 | - 'label' => $this->getLLL('structure.' . $indexName, $siteLanguage->getTypo3Language(), $structureLabels), |
|
383 | + 'label' => $this->getLLL('structure.'.$indexName, $siteLanguage->getTypo3Language(), $structureLabels), |
|
384 | 384 | ]; |
385 | 385 | } |
386 | 386 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | } elseif (isset($langArray['default'][$index][0]['target'])) { |
476 | 476 | return $langArray['default'][$index][0]['target']; |
477 | 477 | } else { |
478 | - return 'Missing translation for ' . $index; |
|
478 | + return 'Missing translation for '.$index; |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | */ |
491 | 491 | private function getRecords(string $recordType): array |
492 | 492 | { |
493 | - $filePath = Environment::getPublicPath() . '/typo3conf/ext/dlf/Resources/Private/Data/' . $recordType . 'Defaults.json'; |
|
493 | + $filePath = Environment::getPublicPath().'/typo3conf/ext/dlf/Resources/Private/Data/'.$recordType.'Defaults.json'; |
|
494 | 494 | |
495 | 495 | $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class); |
496 | 496 | $fileObject = $resourceFactory->getFileObjectFromCombinedIdentifier($filePath); |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | $frameworkConfiguration['persistence']['storagePid'] = 0; |
188 | 188 | $this->configurationManager->setConfiguration($frameworkConfiguration); |
189 | 189 | |
190 | - $doPersist = false; |
|
190 | + $doPersist = FALSE; |
|
191 | 191 | |
192 | 192 | foreach ($formatsDefaults as $type => $values) { |
193 | 193 | // if default format record is not found, add it to the repository |
194 | - if ($this->formatRepository->findOneByType($type) === null) { |
|
194 | + if ($this->formatRepository->findOneByType($type) === NULL) { |
|
195 | 195 | $newRecord = GeneralUtility::makeInstance(Format::class); |
196 | 196 | $newRecord->setType($type); |
197 | 197 | $newRecord->setRoot($values['root']); |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | $newRecord->setClass($values['class']); |
200 | 200 | $this->formatRepository->add($newRecord); |
201 | 201 | |
202 | - $doPersist = true; |
|
202 | + $doPersist = TRUE; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
206 | 206 | // We must persist here, if we changed anything. |
207 | - if ($doPersist === true) { |
|
207 | + if ($doPersist === TRUE) { |
|
208 | 208 | $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); |
209 | 209 | $persistenceManager->persistAll(); |
210 | 210 | } |
@@ -266,13 +266,13 @@ discard block |
||
266 | 266 | ]; |
267 | 267 | } |
268 | 268 | |
269 | - $metadataIds = Helper::processDatabaseAsAdmin($data, [], true); |
|
269 | + $metadataIds = Helper::processDatabaseAsAdmin($data, [], TRUE); |
|
270 | 270 | |
271 | 271 | $insertedMetadata = []; |
272 | 272 | foreach ($metadataIds as $id => $uid) { |
273 | 273 | $metadata = $this->metadataRepository->findByUid($uid); |
274 | 274 | // id array contains also ids of formats |
275 | - if ($metadata != null) { |
|
275 | + if ($metadata != NULL) { |
|
276 | 276 | $insertedMetadata[$uid] = $metadata->getIndexName(); |
277 | 277 | } |
278 | 278 | } |
@@ -308,12 +308,12 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function addSolrCoreAction(): void |
310 | 310 | { |
311 | - $doPersist = false; |
|
311 | + $doPersist = FALSE; |
|
312 | 312 | |
313 | 313 | // load language file in own array |
314 | 314 | $beLabels = $this->languageFactory->getParsedData('EXT:dlf/Resources/Private/Language/locallang_be.xlf', $this->siteLanguages[0]->getTypo3Language()); |
315 | 315 | |
316 | - if ($this->solrCoreRepository->findOneByPid($this->pid) === null) { |
|
316 | + if ($this->solrCoreRepository->findOneByPid($this->pid) === NULL) { |
|
317 | 317 | $newRecord = GeneralUtility::makeInstance(SolrCore::class); |
318 | 318 | $newRecord->setLabel($this->getLLL('flexform.solrcore', $this->siteLanguages[0]->getTypo3Language(), $beLabels). ' (PID ' . $this->pid . ')'); |
319 | 319 | $indexName = Solr::createCore(''); |
@@ -322,12 +322,12 @@ discard block |
||
322 | 322 | |
323 | 323 | $this->solrCoreRepository->add($newRecord); |
324 | 324 | |
325 | - $doPersist = true; |
|
325 | + $doPersist = TRUE; |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
329 | 329 | // We must persist here, if we changed anything. |
330 | - if ($doPersist === true) { |
|
330 | + if ($doPersist === TRUE) { |
|
331 | 331 | $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); |
332 | 332 | $persistenceManager->persistAll(); |
333 | 333 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | 'thumbnail' => 0, |
362 | 362 | ]; |
363 | 363 | } |
364 | - $structureIds = Helper::processDatabaseAsAdmin($data, [], true); |
|
364 | + $structureIds = Helper::processDatabaseAsAdmin($data, [], TRUE); |
|
365 | 365 | |
366 | 366 | $insertedStructures = []; |
367 | 367 | foreach ($structureIds as $id => $uid) { |
@@ -495,9 +495,9 @@ discard block |
||
495 | 495 | $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class); |
496 | 496 | $fileObject = $resourceFactory->getFileObjectFromCombinedIdentifier($filePath); |
497 | 497 | |
498 | - if ($fileObject !== null) { |
|
498 | + if ($fileObject !== NULL) { |
|
499 | 499 | $fileContents = $fileObject->getContents(); |
500 | - $records = json_decode($fileContents, true); |
|
500 | + $records = json_decode($fileContents, TRUE); |
|
501 | 501 | |
502 | 502 | if (json_last_error() === JSON_ERROR_NONE) { |
503 | 503 | return $records; |
@@ -33,8 +33,7 @@ |
||
33 | 33 | * |
34 | 34 | * @access public |
35 | 35 | */ |
36 | -class SearchController extends AbstractController |
|
37 | -{ |
|
36 | +class SearchController extends AbstractController { |
|
38 | 37 | /** |
39 | 38 | * @access protected |
40 | 39 | * @var CollectionRepository |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | if (isset($listRequestData['searchParameter']) && is_array($listRequestData['searchParameter'])) { |
125 | - $this->searchParams = array_merge($this->searchParams ?: [], $listRequestData['searchParameter']); |
|
125 | + $this->searchParams = array_merge($this->searchParams ? : [], $listRequestData['searchParameter']); |
|
126 | 126 | $listViewSearch = true; |
127 | 127 | $GLOBALS['TSFE']->fe_user->setKey('ses', 'search', $this->searchParams); |
128 | 128 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $simplePagination = new SimplePagination($solrPaginator); |
184 | 184 | |
185 | 185 | $pagination = $this->buildSimplePagination($simplePagination, $solrPaginator); |
186 | - $this->view->assignMultiple([ 'pagination' => $pagination, 'paginator' => $solrPaginator ]); |
|
186 | + $this->view->assignMultiple(['pagination' => $pagination, 'paginator' => $solrPaginator]); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $this->view->assign('documents', !empty($solrResults) ? $solrResults : []); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | // Add uHash parameter to suggest parameter to make a basic protection of this form. |
210 | 210 | if ($this->settings['suggest']) { |
211 | - $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()) . Environment::getExtensionsPath(), 'SearchSuggest')); |
|
211 | + $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()).Environment::getExtensionsPath(), 'SearchSuggest')); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | $this->view->assign('viewData', $this->viewData); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | // Get facets from plugin configuration. |
230 | 230 | $facets = []; |
231 | 231 | foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
232 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
232 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | $this->view->assign('facetsMenu', $this->makeFacetsMenuArray($facets)); |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | $searchParams = $this->searchParams; |
266 | 266 | if ( |
267 | 267 | (!empty($searchParams['fulltext'])) |
268 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches) |
|
268 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches) |
|
269 | 269 | ) { |
270 | 270 | // If the query already is a fulltext query e.g using the facets |
271 | 271 | $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1]; |
272 | 272 | // Search in fulltext field if applicable. Query must not be empty! |
273 | 273 | if (!empty($searchParams['query'])) { |
274 | - $search['query'] = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')'; |
|
274 | + $search['query'] = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')'; |
|
275 | 275 | } |
276 | 276 | } else { |
277 | 277 | // Retain given search field if valid. |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | // add filter query for date search |
289 | 289 | if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) { |
290 | 290 | // combine dateFrom and dateTo into filterquery as range search |
291 | - $search['params']['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}' . $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']'; |
|
291 | + $search['params']['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']'; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // Add extended search query. |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | in_array($searchParams['extOperator'][$i], $allowedOperators) |
307 | 307 | ) { |
308 | 308 | if (!empty($search['query'])) { |
309 | - $search['query'] .= ' ' . $searchParams['extOperator'][$i] . ' '; |
|
309 | + $search['query'] .= ' '.$searchParams['extOperator'][$i].' '; |
|
310 | 310 | } |
311 | - $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')'; |
|
311 | + $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')'; |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | } |
@@ -397,24 +397,24 @@ discard block |
||
397 | 397 | foreach ($collections as $collectionEntry) { |
398 | 398 | // check for virtual collections query string |
399 | 399 | if ($collectionEntry->getIndexSearch()) { |
400 | - $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collectionEntry->getIndexSearch() . ')' : ' OR (' . $collectionEntry->getIndexSearch() . ')'; |
|
400 | + $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '('.$collectionEntry->getIndexSearch().')' : ' OR ('.$collectionEntry->getIndexSearch().')'; |
|
401 | 401 | } else { |
402 | - $collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collectionEntry->getIndexName() . '"' : ' OR "' . $collectionEntry->getIndexName() . '"'; |
|
402 | + $collectionsQueryString .= empty($collectionsQueryString) ? '"'.$collectionEntry->getIndexName().'"' : ' OR "'.$collectionEntry->getIndexName().'"'; |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
406 | 406 | // distinguish between simple collection browsing and actual searching within the collection(s) |
407 | 407 | if (!empty($collectionsQueryString)) { |
408 | 408 | if (empty($query)) { |
409 | - $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . ') AND toplevel:true AND partof:0)'; |
|
409 | + $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.') AND toplevel:true AND partof:0)'; |
|
410 | 410 | } else { |
411 | - $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . '))'; |
|
411 | + $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.'))'; |
|
412 | 412 | } |
413 | 413 | } |
414 | 414 | |
415 | 415 | // virtual collections might query documents that are neither toplevel:true nor partof:0 and need to be searched separately |
416 | 416 | if (!empty($virtualCollectionsQueryString)) { |
417 | - $virtualCollectionsQueryString = '(' . $virtualCollectionsQueryString . ')'; |
|
417 | + $virtualCollectionsQueryString = '('.$virtualCollectionsQueryString.')'; |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | // combine both querystrings into a single filterquery via OR if both are given, otherwise pass either of those |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $entryArray['doNotLinkIt'] = 0; |
445 | 445 | // Check if facet is already selected. |
446 | 446 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
447 | - $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
|
447 | + $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn); |
|
448 | 448 | if ($index !== false) { |
449 | 449 | // Facet is selected, thus remove it from filter. |
450 | 450 | unset($queryColumn[$index]); |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | } |
459 | 459 | } else { |
460 | 460 | // Facet is not selected, thus add it to filter. |
461 | - $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")'; |
|
461 | + $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")'; |
|
462 | 462 | $entryArray['ITEM_STATE'] = 'NO'; |
463 | 463 | } |
464 | 464 | $entryArray['queryColumn'] = $queryColumn; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
91 | 91 | |
92 | 92 | // output is done by main action |
93 | - $this->forward('main', null, null, ['searchParameter' => $this->searchParams]); |
|
93 | + $this->forward('main', NULL, NULL, ['searchParameter' => $this->searchParams]); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function mainAction(): void |
106 | 106 | { |
107 | - $listViewSearch = false; |
|
107 | + $listViewSearch = FALSE; |
|
108 | 108 | // Quit without doing anything if required variables are not set. |
109 | 109 | if (empty($this->settings['solrcore'])) { |
110 | 110 | $this->logger->warning('Incomplete plugin configuration'); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | if (isset($listRequestData['searchParameter']) && is_array($listRequestData['searchParameter'])) { |
125 | 125 | $this->searchParams = array_merge($this->searchParams ?: [], $listRequestData['searchParameter']); |
126 | - $listViewSearch = true; |
|
126 | + $listViewSearch = TRUE; |
|
127 | 127 | $GLOBALS['TSFE']->fe_user->setKey('ses', 'search', $this->searchParams); |
128 | 128 | } |
129 | 129 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $this->redirect( |
156 | 156 | 'main', |
157 | 157 | 'ListView', |
158 | - null, |
|
158 | + NULL, |
|
159 | 159 | [ |
160 | 160 | 'searchParameter' => $this->searchParams, |
161 | 161 | 'page' => $currentPage |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | // An empty form will be shown. |
168 | 168 | if (is_array($this->searchParams) && !empty($this->searchParams)) { |
169 | 169 | // get all sortable metadata records |
170 | - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); |
|
170 | + $sortableMetadata = $this->metadataRepository->findByIsSortable(TRUE); |
|
171 | 171 | |
172 | 172 | // get all metadata records to be shown in results |
173 | - $listedMetadata = $this->metadataRepository->findByIsListed(true); |
|
173 | + $listedMetadata = $this->metadataRepository->findByIsListed(TRUE); |
|
174 | 174 | |
175 | 175 | // get all indexed metadata fields |
176 | - $indexedMetadata = $this->metadataRepository->findByIndexIndexed(true); |
|
176 | + $indexedMetadata = $this->metadataRepository->findByIndexIndexed(TRUE); |
|
177 | 177 | |
178 | - $solrResults = null; |
|
178 | + $solrResults = NULL; |
|
179 | 179 | $numResults = 0; |
180 | 180 | // Do not execute the Solr search if used together with ListView plugin. |
181 | 181 | if (!$listViewSearch) { |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | // Get facets from plugin configuration. |
237 | 237 | $facets = []; |
238 | - foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
|
238 | + foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], TRUE) as $facet) { |
|
239 | 239 | $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
240 | 240 | } |
241 | 241 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | { |
393 | 393 | // if collections are given, we prepare the collections query string |
394 | 394 | // extract collections from collection parameter |
395 | - $collections = null; |
|
395 | + $collections = NULL; |
|
396 | 396 | if (array_key_exists('collection', $this->searchParams)) { |
397 | 397 | foreach (explode(',', $this->searchParams['collection']) as $collectionEntry) { |
398 | 398 | $collections[] = $this->collectionRepository->findByUid((int) $collectionEntry); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | // Check if facet is already selected. |
453 | 453 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
454 | 454 | $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
455 | - if ($index !== false) { |
|
455 | + if ($index !== FALSE) { |
|
456 | 456 | // Facet is selected, thus remove it from filter. |
457 | 457 | unset($queryColumn[$index]); |
458 | 458 | $queryColumn = array_values($queryColumn); |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $state = 'ACTIFSUB'; |
461 | 461 | // Reset facets |
462 | 462 | if ($this->settings['resetFacets']) { |
463 | - $entryArray['resetFacet'] = true; |
|
463 | + $entryArray['resetFacet'] = TRUE; |
|
464 | 464 | $entryArray['queryColumn'] = $queryColumn; |
465 | 465 | } |
466 | 466 | } else { |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | } |
572 | 572 | |
573 | 573 | // Get field selector options. |
574 | - $searchFields = GeneralUtility::trimExplode(',', $this->settings['extendedFields'], true); |
|
574 | + $searchFields = GeneralUtility::trimExplode(',', $this->settings['extendedFields'], TRUE); |
|
575 | 575 | |
576 | 576 | $slotCountArray = []; |
577 | 577 | for ($i = 0; $i < $this->settings['extendedSlotCount']; $i++) { |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $metadata['video_duration'] = [$videoDuration]; |
54 | 54 | } |
55 | 55 | |
56 | - $metadata['duration'] = $metadata['video_duration'] ?: $metadata['audio_duration'] ?: []; |
|
56 | + $metadata['duration'] = $metadata['video_duration'] ? : $metadata['audio_duration'] ? : []; |
|
57 | 57 | |
58 | 58 | if ($useExternalApis) { |
59 | 59 | // TODO? |
@@ -25,8 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @access public |
27 | 27 | */ |
28 | -class AudioVideoMD implements MetadataInterface |
|
29 | -{ |
|
28 | +class AudioVideoMD implements MetadataInterface { |
|
30 | 29 | /** |
31 | 30 | * Extract some essential AudioMD/VideoMD metadata. |
32 | 31 | * |
@@ -38,7 +38,7 @@ |
||
38 | 38 | * |
39 | 39 | * @return void |
40 | 40 | */ |
41 | - public function extractMetadata(\SimpleXMLElement $xml, array &$metadata, bool $useExternalApis = false): void |
|
41 | + public function extractMetadata(\SimpleXMLElement $xml, array &$metadata, bool $useExternalApis = FALSE): void |
|
42 | 42 | { |
43 | 43 | $xml->registerXPathNamespace('audiomd', 'http://www.loc.gov/audioMD/'); |
44 | 44 | $xml->registerXPathNamespace('videomd', 'http://www.loc.gov/videoMD/'); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | return ' '; |
125 | 125 | } |
126 | - return htmlspecialchars((string) $attributes['CONTENT']) . ' '; |
|
126 | + return htmlspecialchars((string) $attributes['CONTENT']).' '; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | private function getCoordinates(\SimpleXMLElement $attributes): string |
139 | 139 | { |
140 | - return (string) $attributes['HPOS'] . ' ' . (string) $attributes['VPOS'] . ' ' . (string) $attributes['WIDTH'] . ' ' . (string) $attributes['HEIGHT']; |
|
140 | + return (string) $attributes['HPOS'].' '.(string) $attributes['VPOS'].' '.(string) $attributes['WIDTH'].' '.(string) $attributes['HEIGHT']; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -147,8 +147,7 @@ |
||
147 | 147 | * |
148 | 148 | * @param \SimpleXMLElement &$xml: The XML to register the namespace for |
149 | 149 | */ |
150 | - private function registerAltoNamespace(\SimpleXMLElement &$xml) |
|
151 | - { |
|
150 | + private function registerAltoNamespace(\SimpleXMLElement &$xml) { |
|
152 | 151 | $namespace = $xml->getDocNamespaces(); |
153 | 152 | |
154 | 153 | if (in_array('http://www.loc.gov/standards/alto/ns-v2#', $namespace, true)) { |
@@ -151,11 +151,11 @@ |
||
151 | 151 | { |
152 | 152 | $namespace = $xml->getDocNamespaces(); |
153 | 153 | |
154 | - if (in_array('http://www.loc.gov/standards/alto/ns-v2#', $namespace, true)) { |
|
154 | + if (in_array('http://www.loc.gov/standards/alto/ns-v2#', $namespace, TRUE)) { |
|
155 | 155 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); |
156 | - } elseif (in_array('http://www.loc.gov/standards/alto/ns-v3#', $namespace, true)) { |
|
156 | + } elseif (in_array('http://www.loc.gov/standards/alto/ns-v3#', $namespace, TRUE)) { |
|
157 | 157 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v3#'); |
158 | - } elseif (in_array('http://www.loc.gov/standards/alto/ns-v4#', $namespace, true)) { |
|
158 | + } elseif (in_array('http://www.loc.gov/standards/alto/ns-v4#', $namespace, TRUE)) { |
|
159 | 159 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v4#'); |
160 | 160 | } |
161 | 161 | } |
@@ -24,8 +24,7 @@ |
||
24 | 24 | * |
25 | 25 | * @access public |
26 | 26 | */ |
27 | -class Mods implements MetadataInterface |
|
28 | -{ |
|
27 | +class Mods implements MetadataInterface { |
|
29 | 28 | /** |
30 | 29 | * @access private |
31 | 30 | * @var \SimpleXMLElement The metadata XML |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | if (!empty($name)) { |
125 | 125 | $this->metadata['author'][$i] = [ |
126 | 126 | 'name' => $name, |
127 | - 'url' => 'https://orcid.org/' . $orcidId |
|
127 | + 'url' => 'https://orcid.org/'.$orcidId |
|
128 | 128 | ]; |
129 | 129 | } else { |
130 | 130 | //fallback into display form |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | // Append "valueURI" to name using Unicode unit separator. |
183 | 183 | if (!empty($authors[$i]->getValueURI())) { |
184 | - $this->metadata['author'][$i] .= pack('C', 31) . $authors[$i]->getValueURI(); |
|
184 | + $this->metadata['author'][$i] .= pack('C', 31).$authors[$i]->getValueURI(); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | if (!empty($name)) { |
245 | 245 | $this->metadata['holder'][$i] = [ |
246 | 246 | 'name' => $name, |
247 | - 'url' => 'http://viaf.org/viaf/' . $viafId |
|
247 | + 'url' => 'http://viaf.org/viaf/'.$viafId |
|
248 | 248 | ]; |
249 | 249 | } else { |
250 | 250 | //fallback into display form |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $this->getHolderFromXmlDisplayForm($holders, $i); |
268 | 268 | // Append "valueURI" to name using Unicode unit separator. |
269 | 269 | if (!empty($holders[$i]->getValueURI())) { |
270 | - $this->metadata['holder'][$i] .= pack('C', 31) . $holders[$i]->getValueURI(); |
|
270 | + $this->metadata['holder'][$i] .= pack('C', 31).$holders[$i]->getValueURI(); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 |
@@ -22,8 +22,7 @@ |
||
22 | 22 | * |
23 | 23 | * @access public |
24 | 24 | */ |
25 | -class TeiHeader implements MetadataInterface |
|
26 | -{ |
|
25 | +class TeiHeader implements MetadataInterface { |
|
27 | 26 | /** |
28 | 27 | * This extracts the essential TEIHDR metadata from XML |
29 | 28 | * |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * @return void |
37 | 37 | */ |
38 | - public function extractMetadata(\SimpleXMLElement $xml, array &$metadata, bool $useExternalApis = false): void |
|
38 | + public function extractMetadata(\SimpleXMLElement $xml, array &$metadata, bool $useExternalApis = FALSE): void |
|
39 | 39 | { |
40 | 40 | $xml->registerXPathNamespace('teihdr', 'http://www.tei-c.org/ns/1.0'); |
41 | 41 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function __construct(string $viaf, RequestFactory $requestFactory) |
66 | 66 | { |
67 | 67 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
68 | - $this->viafUrl = 'http://viaf.org/viaf/' . $viaf; |
|
68 | + $this->viafUrl = 'http://viaf.org/viaf/'.$viaf; |
|
69 | 69 | $this->requestFactory = $requestFactory; |
70 | 70 | } |
71 | 71 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | try { |
96 | 96 | $response = $this->requestFactory->request($url); |
97 | 97 | } catch (\Exception $e) { |
98 | - $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
|
98 | + $this->logger->warning('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.'); |
|
99 | 99 | return false; |
100 | 100 | } |
101 | 101 | return $response->getBody()->getContents(); |
@@ -110,6 +110,6 @@ discard block |
||
110 | 110 | **/ |
111 | 111 | private function getApiEndpoint(): string |
112 | 112 | { |
113 | - return $this->viafUrl . '/' . $this->endpoint; |
|
113 | + return $this->viafUrl.'/'.$this->endpoint; |
|
114 | 114 | } |
115 | 115 | } |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @access public |
28 | 28 | **/ |
29 | -class Client |
|
30 | -{ |
|
29 | +class Client { |
|
31 | 30 | /** |
32 | 31 | * @access protected |
33 | 32 | * @var Logger This holds the logger |
@@ -62,8 +61,7 @@ discard block |
||
62 | 61 | * |
63 | 62 | * @return void |
64 | 63 | **/ |
65 | - public function __construct(string $viaf, RequestFactory $requestFactory) |
|
66 | - { |
|
64 | + public function __construct(string $viaf, RequestFactory $requestFactory) { |
|
67 | 65 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
68 | 66 | $this->viafUrl = 'http://viaf.org/viaf/' . $viaf; |
69 | 67 | $this->requestFactory = $requestFactory; |
@@ -89,8 +87,7 @@ discard block |
||
89 | 87 | * |
90 | 88 | * @return object|bool |
91 | 89 | **/ |
92 | - public function getData() |
|
93 | - { |
|
90 | + public function getData() { |
|
94 | 91 | $url = $this->getApiEndpoint(); |
95 | 92 | try { |
96 | 93 | $response = $this->requestFactory->request($url); |
@@ -96,7 +96,7 @@ |
||
96 | 96 | $response = $this->requestFactory->request($url); |
97 | 97 | } catch (\Exception $e) { |
98 | 98 | $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
99 | - return false; |
|
99 | + return FALSE; |
|
100 | 100 | } |
101 | 101 | return $response->getBody()->getContents(); |
102 | 102 | } |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @access public |
28 | 28 | **/ |
29 | -class Profile |
|
30 | -{ |
|
29 | +class Profile { |
|
31 | 30 | /** |
32 | 31 | * @access private |
33 | 32 | * @var Logger This holds the logger |
@@ -55,8 +54,7 @@ discard block |
||
55 | 54 | * |
56 | 55 | * @return void |
57 | 56 | **/ |
58 | - public function __construct(string $viaf) |
|
59 | - { |
|
57 | + public function __construct(string $viaf) { |
|
60 | 58 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
61 | 59 | $this->client = new Client($viaf, GeneralUtility::makeInstance(RequestFactory::class)); |
62 | 60 | } |
@@ -68,8 +66,7 @@ discard block |
||
68 | 66 | * |
69 | 67 | * @return array|false |
70 | 68 | **/ |
71 | - public function getData() |
|
72 | - { |
|
69 | + public function getData() { |
|
73 | 70 | $this->getRaw(); |
74 | 71 | if ($this->raw !== false && !empty($this->raw)) { |
75 | 72 | $data = []; |
@@ -89,8 +86,7 @@ discard block |
||
89 | 86 | * |
90 | 87 | * @return string|false |
91 | 88 | **/ |
92 | - public function getAddress() |
|
93 | - { |
|
89 | + public function getAddress() { |
|
94 | 90 | $this->getRaw(); |
95 | 91 | if ($this->raw !== false && !empty($this->raw->asXML())) { |
96 | 92 | return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0]; |
@@ -107,8 +103,7 @@ discard block |
||
107 | 103 | * |
108 | 104 | * @return string|false |
109 | 105 | **/ |
110 | - public function getFullName() |
|
111 | - { |
|
106 | + public function getFullName() { |
|
112 | 107 | $this->getRaw(); |
113 | 108 | if ($this->raw !== false && !empty($this->raw->asXML())) { |
114 | 109 | $rawName = $this->raw->xpath('./ns1:mainHeadings/ns1:data/ns1:text'); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @access private |
45 | 45 | * @var \SimpleXmlElement|false The raw VIAF profile or false if not found |
46 | 46 | **/ |
47 | - private $raw = false; |
|
47 | + private $raw = FALSE; |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Constructs client instance |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | public function getData() |
72 | 72 | { |
73 | 73 | $this->getRaw(); |
74 | - if ($this->raw !== false && !empty($this->raw)) { |
|
74 | + if ($this->raw !== FALSE && !empty($this->raw)) { |
|
75 | 75 | $data = []; |
76 | 76 | $data['address'] = $this->getAddress(); |
77 | 77 | $data['fullName'] = $this->getFullName(); |
78 | 78 | return $data; |
79 | 79 | } else { |
80 | 80 | $this->logger->warning('No data found for given VIAF URL'); |
81 | - return false; |
|
81 | + return FALSE; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | public function getAddress() |
93 | 93 | { |
94 | 94 | $this->getRaw(); |
95 | - if ($this->raw !== false && !empty($this->raw->asXML())) { |
|
95 | + if ($this->raw !== FALSE && !empty($this->raw->asXML())) { |
|
96 | 96 | return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0]; |
97 | 97 | } else { |
98 | 98 | $this->logger->warning('No address found for given VIAF URL'); |
99 | - return false; |
|
99 | + return FALSE; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | public function getFullName() |
111 | 111 | { |
112 | 112 | $this->getRaw(); |
113 | - if ($this->raw !== false && !empty($this->raw->asXML())) { |
|
113 | + if ($this->raw !== FALSE && !empty($this->raw->asXML())) { |
|
114 | 114 | $rawName = $this->raw->xpath('./ns1:mainHeadings/ns1:data/ns1:text'); |
115 | 115 | $name = (string) $rawName[0]; |
116 | 116 | $name = trim(trim(trim($name), ','), '.'); |
117 | 117 | return $name; |
118 | 118 | } else { |
119 | 119 | $this->logger->warning('No name found for given VIAF URL'); |
120 | - return false; |
|
120 | + return FALSE; |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | private function getRaw(): void |
132 | 132 | { |
133 | 133 | $data = $this->client->getData(); |
134 | - if ($data != false) { |
|
134 | + if ($data != FALSE) { |
|
135 | 135 | $this->raw = Helper::getXmlFileAsString($data); |
136 | - if ($this->raw != false && !empty($this->raw->asXML())) { |
|
136 | + if ($this->raw != FALSE && !empty($this->raw->asXML())) { |
|
137 | 137 | $this->raw->registerXPathNamespace('ns1', 'http://viaf.org/viaf/terms#'); |
138 | 138 | } |
139 | 139 | } |