@@ -126,8 +126,8 @@ |
||
126 | 126 | ->select(...explode(',', $fields)) |
127 | 127 | ->from($table) |
128 | 128 | ->where( |
129 | - $queryBuilder->expr()->eq($table . '.pid', intval($this->storagePid)), |
|
130 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
129 | + $queryBuilder->expr()->eq($table.'.pid', intval($this->storagePid)), |
|
130 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
131 | 131 | $andWhere |
132 | 132 | ) |
133 | 133 | ->orderBy($sorting) |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * @subpackage dlf |
27 | 27 | * @access public |
28 | 28 | */ |
29 | -class ItemsProcFunc |
|
30 | -{ |
|
29 | +class ItemsProcFunc { |
|
31 | 30 | /** |
32 | 31 | * @var int |
33 | 32 | */ |
@@ -42,8 +41,7 @@ discard block |
||
42 | 41 | * |
43 | 42 | * @return void |
44 | 43 | */ |
45 | - public function toolList(&$params) |
|
46 | - { |
|
44 | + public function toolList(&$params) { |
|
47 | 45 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'] as $class => $label) { |
48 | 46 | $params['items'][] = [Helper::getLanguageService()->getLL($label), $class]; |
49 | 47 | } |
@@ -56,8 +54,7 @@ discard block |
||
56 | 54 | * |
57 | 55 | * @return void |
58 | 56 | */ |
59 | - public function __construct() |
|
60 | - { |
|
57 | + public function __construct() { |
|
61 | 58 | $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
62 | 59 | $configurationManager = $objectManager->get(ConfigurationManager::class); |
63 | 60 | // we must get the storagePid from full TypoScript setup at this point. |
@@ -74,8 +71,7 @@ discard block |
||
74 | 71 | * |
75 | 72 | * @return void |
76 | 73 | */ |
77 | - public function extendedSearchList(&$params) |
|
78 | - { |
|
74 | + public function extendedSearchList(&$params) { |
|
79 | 75 | $this->generateList( |
80 | 76 | $params, |
81 | 77 | 'label,index_name', |
@@ -116,8 +112,7 @@ discard block |
||
116 | 112 | * |
117 | 113 | * @return void |
118 | 114 | */ |
119 | - protected function generateList(&$params, $fields, $table, $sorting, $andWhere = '') |
|
120 | - { |
|
115 | + protected function generateList(&$params, $fields, $table, $sorting, $andWhere = '') { |
|
121 | 116 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
122 | 117 | ->getQueryBuilderForTable($table); |
123 | 118 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | // parameters are available in $this->data['parameterArray']['fieldConf']['config']['parameters'] |
23 | 23 | $result = $this->initializeResultArray(); |
24 | 24 | if (!empty($this->data['databaseRow']['thumbnail'])) { |
25 | - $result['html'] = '<img alt="Thumbnail" title="" src="' . $this->data['databaseRow']['thumbnail'] . '" />'; |
|
25 | + $result['html'] = '<img alt="Thumbnail" title="" src="'.$this->data['databaseRow']['thumbnail'].'" />'; |
|
26 | 26 | } else { |
27 | 27 | $result['html'] = ''; |
28 | 28 | } |
@@ -14,10 +14,8 @@ |
||
14 | 14 | |
15 | 15 | use TYPO3\CMS\Backend\Form\Element\AbstractFormElement; |
16 | 16 | |
17 | -class ThumbnailCustomElement extends AbstractFormElement |
|
18 | -{ |
|
19 | - public function render() |
|
20 | - { |
|
17 | +class ThumbnailCustomElement extends AbstractFormElement { |
|
18 | + public function render() { |
|
21 | 19 | // Custom TCA properties and other data can be found in $this->data, for example the above |
22 | 20 | // parameters are available in $this->data['parameterArray']['fieldConf']['config']['parameters'] |
23 | 21 | $result = $this->initializeResultArray(); |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | * @subpackage dlf |
30 | 30 | * @access public |
31 | 31 | */ |
32 | -class ConfigurationForm |
|
33 | -{ |
|
32 | +class ConfigurationForm { |
|
34 | 33 | |
35 | 34 | /** |
36 | 35 | * Check if a connection to a Solr server could be established with the given credentials. |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | * |
40 | 39 | * @return string Message informing the user of success or failure |
41 | 40 | */ |
42 | - public function checkSolrConnection() |
|
43 | - { |
|
41 | + public function checkSolrConnection() { |
|
44 | 42 | $solr = Solr::getInstance(); |
45 | 43 | if ($solr->ready) { |
46 | 44 | Helper::addMessage( |
@@ -65,8 +63,7 @@ discard block |
||
65 | 63 | * |
66 | 64 | * @return void |
67 | 65 | */ |
68 | - public function __construct() |
|
69 | - { |
|
66 | + public function __construct() { |
|
70 | 67 | // Load backend localization file. |
71 | 68 | Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf'); |
72 | 69 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @var \Kitodo\Dlf\Common\Doc|null |
42 | 42 | */ |
43 | - protected $doc = null; |
|
43 | + protected $doc = NULL; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @var string |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> |
157 | 157 | * @Extbase\ORM\Lazy |
158 | 158 | */ |
159 | - protected $collections = null; |
|
159 | + protected $collections = NULL; |
|
160 | 160 | |
161 | 161 | /** |
162 | 162 | * @var string |
@@ -192,14 +192,12 @@ discard block |
||
192 | 192 | /** |
193 | 193 | * constructor |
194 | 194 | */ |
195 | - public function __construct() |
|
196 | - { |
|
195 | + public function __construct() { |
|
197 | 196 | // Do not remove the next line: It would break the functionality |
198 | 197 | $this->initStorageObjects(); |
199 | 198 | } |
200 | 199 | |
201 | - protected function initStorageObjects() |
|
202 | - { |
|
200 | + protected function initStorageObjects() { |
|
203 | 201 | $this->collections = new ObjectStorage(); |
204 | 202 | } |
205 | 203 | |
@@ -577,8 +575,7 @@ discard block |
||
577 | 575 | * |
578 | 576 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> $collections |
579 | 577 | */ |
580 | - public function getCollections() |
|
581 | - { |
|
578 | + public function getCollections() { |
|
582 | 579 | return $this->collections; |
583 | 580 | } |
584 | 581 | |
@@ -607,8 +604,7 @@ discard block |
||
607 | 604 | * |
608 | 605 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> collections |
609 | 606 | */ |
610 | - public function removeCollection(Collection $collection) |
|
611 | - { |
|
607 | + public function removeCollection(Collection $collection) { |
|
612 | 608 | $this->collections->detach($collection); |
613 | 609 | } |
614 | 610 |
@@ -61,7 +61,7 @@ |
||
61 | 61 | * |
62 | 62 | * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference |
63 | 63 | */ |
64 | - protected $thumbnail = null; |
|
64 | + protected $thumbnail = NULL; |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * @var int |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function findOneByParameters($parameters) |
52 | 52 | { |
53 | - $doc = null; |
|
54 | - $document = null; |
|
53 | + $doc = NULL; |
|
54 | + $document = NULL; |
|
55 | 55 | |
56 | 56 | if (isset($parameters['id']) && MathUtility::canBeInterpretedAsInteger($parameters['id'])) { |
57 | 57 | |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | |
64 | 64 | } else if (isset($parameters['location']) && GeneralUtility::isValidUrl($parameters['location'])) { |
65 | 65 | |
66 | - $doc = Doc::getInstance($parameters['location'], [], true); |
|
66 | + $doc = Doc::getInstance($parameters['location'], [], TRUE); |
|
67 | 67 | |
68 | 68 | if ($doc->recordId) { |
69 | 69 | $document = $this->findOneByRecordId($doc->recordId); |
70 | 70 | } |
71 | 71 | |
72 | - if ($document === null) { |
|
72 | + if ($document === NULL) { |
|
73 | 73 | // create new (dummy) Document object |
74 | 74 | $document = GeneralUtility::makeInstance(Document::class); |
75 | 75 | $document->setLocation($parameters['location']); |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - if ($document !== null && $doc === null) { |
|
81 | - $doc = Doc::getInstance($document->getLocation(), [], true); |
|
80 | + if ($document !== NULL && $doc === NULL) { |
|
81 | + $doc = Doc::getInstance($document->getLocation(), [], TRUE); |
|
82 | 82 | } |
83 | 83 | |
84 | - if ($doc !== null) { |
|
84 | + if ($doc !== NULL) { |
|
85 | 85 | $document->setDoc($doc); |
86 | 86 | } |
87 | 87 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | if (isset($settings['excludeOther']) && (int) $settings['excludeOther'] === 0) { |
170 | - $query->getQuerySettings()->setRespectStoragePage(false); |
|
170 | + $query->getQuerySettings()->setRespectStoragePage(FALSE); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | if (count($constraints)) { |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata |
557 | 557 | * @return array |
558 | 558 | */ |
559 | - public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) |
|
559 | + public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = NULL) |
|
560 | 560 | { |
561 | 561 | // set settings global inside this repository |
562 | 562 | $this->settings = $settings; |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | if (!empty($searchParams['query'])) { |
578 | 578 | $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')'; |
579 | 579 | } |
580 | - $params['fulltext'] = true; |
|
580 | + $params['fulltext'] = TRUE; |
|
581 | 581 | } else { |
582 | 582 | // Retain given search field if valid. |
583 | 583 | if (!empty($searchParams['query'])) { |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | } |
671 | 671 | |
672 | 672 | // Perform search. |
673 | - $result = $this->searchSolr($params, true); |
|
673 | + $result = $this->searchSolr($params, TRUE); |
|
674 | 674 | |
675 | 675 | // Initialize values |
676 | 676 | $numberOfToplevels = 0; |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | $documents[$doc['uid']] = $allDocuments[$doc['uid']]; |
694 | 694 | } |
695 | 695 | if ($documents[$doc['uid']]) { |
696 | - if ($doc['toplevel'] === false) { |
|
696 | + if ($doc['toplevel'] === FALSE) { |
|
697 | 697 | // this maybe a chapter, article, ..., year |
698 | 698 | if ($doc['type'] === 'year') { |
699 | 699 | continue; |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | } |
719 | 719 | $documents[$doc['uid']]['searchResults'][] = $searchResult; |
720 | 720 | } |
721 | - } else if ($doc['toplevel'] === true) { |
|
721 | + } else if ($doc['toplevel'] === TRUE) { |
|
722 | 722 | $numberOfToplevels++; |
723 | 723 | foreach ($params['listMetadataRecords'] as $indexName => $solrField) { |
724 | 724 | if (isset($doc['metadata'][$indexName])) { |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | $params['filterquery'][] = ['query' => 'toplevel:true']; |
796 | 796 | |
797 | 797 | // Perform search. |
798 | - $result = $this->searchSolr($params, true); |
|
798 | + $result = $this->searchSolr($params, TRUE); |
|
799 | 799 | |
800 | 800 | if ($result['numFound'] > 0) { |
801 | 801 | // There is only one result found because of toplevel:true. |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | * |
817 | 817 | * @return array The Apache Solr Documents that were fetched |
818 | 818 | */ |
819 | - protected function searchSolr($parameters = [], $enableCache = true) |
|
819 | + protected function searchSolr($parameters = [], $enableCache = TRUE) |
|
820 | 820 | { |
821 | 821 | // Set additional query parameters. |
822 | 822 | $parameters['start'] = 0; |
@@ -833,27 +833,27 @@ discard block |
||
833 | 833 | } |
834 | 834 | |
835 | 835 | $cacheIdentifier = ''; |
836 | - $cache = null; |
|
836 | + $cache = NULL; |
|
837 | 837 | // Calculate cache identifier. |
838 | - if ($enableCache === true) { |
|
839 | - $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true)); |
|
838 | + if ($enableCache === TRUE) { |
|
839 | + $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, TRUE)); |
|
840 | 840 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
841 | 841 | } |
842 | 842 | $resultSet = [ |
843 | 843 | 'documents' => [], |
844 | 844 | 'numFound' => 0, |
845 | 845 | ]; |
846 | - if ($enableCache === false || ($entry = $cache->get($cacheIdentifier)) === false) { |
|
846 | + if ($enableCache === FALSE || ($entry = $cache->get($cacheIdentifier)) === FALSE) { |
|
847 | 847 | $selectQuery = $solr->service->createSelect($parameters); |
848 | 848 | |
849 | - if ($parameters['fulltext'] === true) { |
|
849 | + if ($parameters['fulltext'] === TRUE) { |
|
850 | 850 | // get highlighting component and apply settings |
851 | 851 | $selectQuery->getHighlighting(); |
852 | 852 | } |
853 | 853 | |
854 | 854 | $solrRequest = $solr->service->createRequest($selectQuery); |
855 | 855 | |
856 | - if ($parameters['fulltext'] === true) { |
|
856 | + if ($parameters['fulltext'] === TRUE) { |
|
857 | 857 | // If it is a fulltext search, enable highlighting. |
858 | 858 | // field for which highlighting is going to be performed, |
859 | 859 | // is required if you want to have OCR highlighting |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | /** @scrutinizer ignore-call */ |
874 | 874 | $resultSet['numFound'] = $result->getNumFound(); |
875 | 875 | $highlighting = []; |
876 | - if ($parameters['fulltext'] === true) { |
|
876 | + if ($parameters['fulltext'] === TRUE) { |
|
877 | 877 | $data = $result->getData(); |
878 | 878 | $highlighting = $data['ocrHighlighting']; |
879 | 879 | } |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | } |
903 | 903 | |
904 | 904 | // Save value in cache. |
905 | - if (!empty($resultSet) && $enableCache === true) { |
|
905 | + if (!empty($resultSet) && $enableCache === TRUE) { |
|
906 | 906 | $cache->set($cacheIdentifier, $resultSet); |
907 | 907 | } |
908 | 908 | } else { |
@@ -210,7 +210,6 @@ |
||
210 | 210 | * Volumes are documents that are both |
211 | 211 | * a) "leaf" elements i.e. partof != 0 |
212 | 212 | * b) "root" elements that are not referenced by other documents ("root" elements that have no descendants) |
213 | - |
|
214 | 213 | * @param array $settings |
215 | 214 | * |
216 | 215 | * @return array |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | |
359 | 359 | $excludeOtherWhere = ''; |
360 | 360 | if ($settings['excludeOther']) { |
361 | - $excludeOtherWhere = 'tx_dlf_documents.pid=' . intval($settings['storagePid']); |
|
361 | + $excludeOtherWhere = 'tx_dlf_documents.pid='.intval($settings['storagePid']); |
|
362 | 362 | } |
363 | 363 | // Check if there are any metadata to suggest. |
364 | 364 | $result = $queryBuilder |
@@ -410,12 +410,12 @@ discard block |
||
410 | 410 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
411 | 411 | ->getConnectionForTable('tx_dlf_documents'); |
412 | 412 | |
413 | - $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' . |
|
414 | - 'FROM `tx_dlf_documents` ' . |
|
415 | - 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' . |
|
416 | - 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' . |
|
417 | - 'WHERE `tx_dlf_documents`.`record_id` = ? ' . |
|
418 | - 'AND `tx_dlf_relations`.`ident`="docs_colls" ' . |
|
413 | + $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '. |
|
414 | + 'FROM `tx_dlf_documents` '. |
|
415 | + 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '. |
|
416 | + 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '. |
|
417 | + 'WHERE `tx_dlf_documents`.`record_id` = ? '. |
|
418 | + 'AND `tx_dlf_relations`.`ident`="docs_colls" '. |
|
419 | 419 | $where; |
420 | 420 | |
421 | 421 | $values = [ |
@@ -445,13 +445,13 @@ discard block |
||
445 | 445 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
446 | 446 | ->getConnectionForTable('tx_dlf_documents'); |
447 | 447 | |
448 | - $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' . |
|
449 | - 'FROM `tx_dlf_documents` ' . |
|
450 | - 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' . |
|
451 | - 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' . |
|
452 | - 'WHERE `tx_dlf_documents`.`uid` IN ( ? ) ' . |
|
453 | - 'AND `tx_dlf_relations`.`ident`="docs_colls" ' . |
|
454 | - 'AND ' . Helper::whereExpression('tx_dlf_collections') . ' ' . |
|
448 | + $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '. |
|
449 | + 'FROM `tx_dlf_documents` '. |
|
450 | + 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '. |
|
451 | + 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '. |
|
452 | + 'WHERE `tx_dlf_documents`.`uid` IN ( ? ) '. |
|
453 | + 'AND `tx_dlf_relations`.`ident`="docs_colls" '. |
|
454 | + 'AND '.Helper::whereExpression('tx_dlf_collections').' '. |
|
455 | 455 | 'GROUP BY `tx_dlf_documents`.`uid` '; |
456 | 456 | |
457 | 457 | $values = [ |
@@ -533,13 +533,13 @@ discard block |
||
533 | 533 | // Set search query. |
534 | 534 | if ( |
535 | 535 | (!empty($searchParams['fulltext'])) |
536 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches) |
|
536 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches) |
|
537 | 537 | ) { |
538 | 538 | // If the query already is a fulltext query e.g using the facets |
539 | 539 | $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1]; |
540 | 540 | // Search in fulltext field if applicable. Query must not be empty! |
541 | 541 | if (!empty($searchParams['query'])) { |
542 | - $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')'; |
|
542 | + $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')'; |
|
543 | 543 | } |
544 | 544 | $params['fulltext'] = true; |
545 | 545 | } else { |
@@ -562,9 +562,9 @@ discard block |
||
562 | 562 | in_array($searchParams['extOperator'][$i], $allowedOperators) |
563 | 563 | ) { |
564 | 564 | if (!empty($query)) { |
565 | - $query .= ' ' . $searchParams['extOperator'][$i] . ' '; |
|
565 | + $query .= ' '.$searchParams['extOperator'][$i].' '; |
|
566 | 566 | } |
567 | - $query .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')'; |
|
567 | + $query .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')'; |
|
568 | 568 | } |
569 | 569 | } |
570 | 570 | } |
@@ -584,12 +584,12 @@ discard block |
||
584 | 584 | ) { |
585 | 585 | // Search in document and all subordinates (valid for up to three levels of hierarchy). |
586 | 586 | $params['filterquery'][]['query'] = '_query_:"{!join from=' |
587 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
588 | - . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
589 | - . $fields['uid'] . ':' . $searchParams['documentId'] . '"' . ' OR {!join from=' |
|
590 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
591 | - . $fields['uid'] . ':' . $searchParams['documentId'] . ' OR ' |
|
592 | - . $fields['uid'] . ':' . $searchParams['documentId']; |
|
587 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
588 | + . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}' |
|
589 | + . $fields['uid'].':'.$searchParams['documentId'].'"'.' OR {!join from=' |
|
590 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
591 | + . $fields['uid'].':'.$searchParams['documentId'].' OR ' |
|
592 | + . $fields['uid'].':'.$searchParams['documentId']; |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | // if a collection is given, we prepare the collection query string |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $collecionsQueryString = $collection->getIndexName(); |
598 | 598 | $params['filterquery'][]['query'] = 'toplevel:true'; |
599 | 599 | $params['filterquery'][]['query'] = 'partof:0'; |
600 | - $params['filterquery'][]['query'] = 'collection_faceting:("' . $collecionsQueryString . '")'; |
|
600 | + $params['filterquery'][]['query'] = 'collection_faceting:("'.$collecionsQueryString.'")'; |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | // Set some query parameters. |
@@ -626,8 +626,8 @@ discard block |
||
626 | 626 | if ($listedMetadata) { |
627 | 627 | foreach ($listedMetadata as $metadata) { |
628 | 628 | if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { |
629 | - $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
630 | - $params['fields'] .= ',' . $listMetadataRecord; |
|
629 | + $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
630 | + $params['fields'] .= ','.$listMetadataRecord; |
|
631 | 631 | $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord; |
632 | 632 | } |
633 | 633 | } |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | if (empty($documents[$doc['uid']]['title']) && ($documents[$doc['uid']]['partOf'] > 0)) { |
714 | 714 | $parentDocument = $this->findByUid($documents[$doc['uid']]['partOf']); |
715 | 715 | if ($parentDocument) { |
716 | - $documents[$doc['uid']]['title'] = '[' . $parentDocument->getTitle() . ']'; |
|
716 | + $documents[$doc['uid']]['title'] = '['.$parentDocument->getTitle().']'; |
|
717 | 717 | } |
718 | 718 | } |
719 | 719 | } |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | $metadataArray = []; |
738 | 738 | |
739 | 739 | // Set some query parameters. |
740 | - $params['query'] = 'uid:' . $uid; |
|
740 | + $params['query'] = 'uid:'.$uid; |
|
741 | 741 | $params['start'] = 0; |
742 | 742 | $params['rows'] = 1; |
743 | 743 | $params['sort'] = ['score' => 'desc']; |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | if ($listedMetadata) { |
750 | 750 | foreach ($listedMetadata as $metadata) { |
751 | 751 | if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { |
752 | - $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
753 | - $params['fields'] .= ',' . $listMetadataRecord; |
|
752 | + $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
753 | + $params['fields'] .= ','.$listMetadataRecord; |
|
754 | 754 | $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord; |
755 | 755 | } |
756 | 756 | } |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | $cache = null; |
801 | 801 | // Calculate cache identifier. |
802 | 802 | if ($enableCache === true) { |
803 | - $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true)); |
|
803 | + $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true)); |
|
804 | 804 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
805 | 805 | } |
806 | 806 | $resultSet = [ |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return \Kitodo\Dlf\Domain\Model\Document|null |
52 | 52 | */ |
53 | - public function findOneByParameters($parameters) |
|
54 | - { |
|
53 | + public function findOneByParameters($parameters) { |
|
55 | 54 | $doc = null; |
56 | 55 | $document = null; |
57 | 56 | |
@@ -95,8 +94,7 @@ discard block |
||
95 | 94 | * |
96 | 95 | * @return \Kitodo\Dlf\Domain\Model\Document|null |
97 | 96 | */ |
98 | - public function findOldestDocument() |
|
99 | - { |
|
97 | + public function findOldestDocument() { |
|
100 | 98 | $query = $this->createQuery(); |
101 | 99 | |
102 | 100 | $query->setOrderings(['tstamp' => QueryInterface::ORDER_ASCENDING]); |
@@ -110,8 +108,7 @@ discard block |
||
110 | 108 | * @param \Kitodo\Dlf\Domain\Model\Structure $structure |
111 | 109 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
112 | 110 | */ |
113 | - public function getChildrenOfYearAnchor($partOf, $structure) |
|
114 | - { |
|
111 | + public function getChildrenOfYearAnchor($partOf, $structure) { |
|
115 | 112 | $query = $this->createQuery(); |
116 | 113 | |
117 | 114 | $query->matching($query->equals('structure', $structure)); |
@@ -132,8 +129,7 @@ discard block |
||
132 | 129 | * |
133 | 130 | * @return \Kitodo\Dlf\Domain\Model\Document|null |
134 | 131 | */ |
135 | - public function findOneByIdAndSettings($uid, $settings = []) |
|
136 | - { |
|
132 | + public function findOneByIdAndSettings($uid, $settings = []) { |
|
137 | 133 | $settings = ['documentSets' => $uid]; |
138 | 134 | |
139 | 135 | return $this->findDocumentsBySettings($settings)->getFirst(); |
@@ -146,8 +142,7 @@ discard block |
||
146 | 142 | * |
147 | 143 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
148 | 144 | */ |
149 | - public function findDocumentsBySettings($settings = []) |
|
150 | - { |
|
145 | + public function findDocumentsBySettings($settings = []) { |
|
151 | 146 | $query = $this->createQuery(); |
152 | 147 | |
153 | 148 | $constraints = []; |
@@ -177,8 +172,7 @@ discard block |
||
177 | 172 | * |
178 | 173 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
179 | 174 | */ |
180 | - public function findAllByCollectionsLimited($collections, $limit = 50) |
|
181 | - { |
|
175 | + public function findAllByCollectionsLimited($collections, $limit = 50) { |
|
182 | 176 | $query = $this->createQuery(); |
183 | 177 | |
184 | 178 | // order by start_date -> start_time... |
@@ -215,8 +209,7 @@ discard block |
||
215 | 209 | * |
216 | 210 | * @return array |
217 | 211 | */ |
218 | - public function getStatisticsForSelectedCollection($settings) |
|
219 | - { |
|
212 | + public function getStatisticsForSelectedCollection($settings) { |
|
220 | 213 | if ($settings['collections']) { |
221 | 214 | // Include only selected collections. |
222 | 215 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -350,8 +343,7 @@ discard block |
||
350 | 343 | * |
351 | 344 | * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
352 | 345 | */ |
353 | - public function getTableOfContentsFromDb($uid, $pid, $settings) |
|
354 | - { |
|
346 | + public function getTableOfContentsFromDb($uid, $pid, $settings) { |
|
355 | 347 | // Build table of contents from database. |
356 | 348 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
357 | 349 | ->getQueryBuilderForTable('tx_dlf_documents'); |
@@ -399,8 +391,7 @@ discard block |
||
399 | 391 | * |
400 | 392 | * @return array The found document object |
401 | 393 | */ |
402 | - public function getOaiRecord($settings, $parameters) |
|
403 | - { |
|
394 | + public function getOaiRecord($settings, $parameters) { |
|
404 | 395 | $where = ''; |
405 | 396 | |
406 | 397 | if (!$settings['show_userdefined']) { |
@@ -440,8 +431,7 @@ discard block |
||
440 | 431 | * |
441 | 432 | * @return array The found document objects |
442 | 433 | */ |
443 | - public function getOaiDocumentList($settings, $documentsToProcess) |
|
444 | - { |
|
434 | + public function getOaiDocumentList($settings, $documentsToProcess) { |
|
445 | 435 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
446 | 436 | ->getConnectionForTable('tx_dlf_documents'); |
447 | 437 | |
@@ -475,8 +465,7 @@ discard block |
||
475 | 465 | * |
476 | 466 | * @return array |
477 | 467 | */ |
478 | - private function findAllByUids($uids) |
|
479 | - { |
|
468 | + private function findAllByUids($uids) { |
|
480 | 469 | // get all documents from db we are talking about |
481 | 470 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
482 | 471 | $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_documents'); |
@@ -520,8 +509,7 @@ discard block |
||
520 | 509 | * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata |
521 | 510 | * @return array |
522 | 511 | */ |
523 | - public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) |
|
524 | - { |
|
512 | + public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) { |
|
525 | 513 | // set settings global inside this repository |
526 | 514 | $this->settings = $settings; |
527 | 515 | |
@@ -730,8 +718,7 @@ discard block |
||
730 | 718 | * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata |
731 | 719 | * @return array |
732 | 720 | */ |
733 | - protected function fetchMetadataFromSolr($uid, $listedMetadata = []) |
|
734 | - { |
|
721 | + protected function fetchMetadataFromSolr($uid, $listedMetadata = []) { |
|
735 | 722 | // Prepare query parameters. |
736 | 723 | $params = []; |
737 | 724 | $metadataArray = []; |
@@ -780,8 +767,7 @@ discard block |
||
780 | 767 | * |
781 | 768 | * @return array The Apache Solr Documents that were fetched |
782 | 769 | */ |
783 | - protected function searchSolr($parameters = [], $enableCache = true) |
|
784 | - { |
|
770 | + protected function searchSolr($parameters = [], $enableCache = true) { |
|
785 | 771 | // Set additional query parameters. |
786 | 772 | $parameters['start'] = 0; |
787 | 773 | // Set query. |
@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | // order by oai_name |
49 | 49 | $query->setOrderings( |
50 | - array('sorting' => QueryInterface::ORDER_ASCENDING) |
|
50 | + array ('sorting' => QueryInterface::ORDER_ASCENDING) |
|
51 | 51 | ); |
52 | 52 | |
53 | 53 | return $query->execute(); |
@@ -25,8 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
27 | 27 | */ |
28 | - public function findBySettings($settings = []) |
|
29 | - { |
|
28 | + public function findBySettings($settings = []) { |
|
30 | 29 | $query = $this->createQuery(); |
31 | 30 | |
32 | 31 | $constraints = []; |
@@ -98,7 +98,7 @@ |
||
98 | 98 | |
99 | 99 | // order by oai_name |
100 | 100 | $query->setOrderings( |
101 | - array('oai_name' => QueryInterface::ORDER_ASCENDING) |
|
101 | + array ('oai_name' => QueryInterface::ORDER_ASCENDING) |
|
102 | 102 | ); |
103 | 103 | |
104 | 104 | return $query->execute(); |
@@ -35,8 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
37 | 37 | */ |
38 | - public function findAllByUids($uids) |
|
39 | - { |
|
38 | + public function findAllByUids($uids) { |
|
40 | 39 | $query = $this->createQuery(); |
41 | 40 | |
42 | 41 | $constraints = []; |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | return $query->execute(); |
50 | 49 | } |
51 | 50 | |
52 | - public function getCollectionForMetadata($pages) |
|
53 | - { |
|
51 | + public function getCollectionForMetadata($pages) { |
|
54 | 52 | // Get list of collections to show. |
55 | 53 | $query = $this->createQuery(); |
56 | 54 | |
@@ -66,8 +64,7 @@ discard block |
||
66 | 64 | * |
67 | 65 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
68 | 66 | */ |
69 | - public function findCollectionsBySettings($settings = []) |
|
70 | - { |
|
67 | + public function findCollectionsBySettings($settings = []) { |
|
71 | 68 | $query = $this->createQuery(); |
72 | 69 | |
73 | 70 | $constraints = []; |
@@ -104,8 +101,7 @@ discard block |
||
104 | 101 | return $query->execute(); |
105 | 102 | } |
106 | 103 | |
107 | - public function getIndexNameForSolr($settings, $set) |
|
108 | - { |
|
104 | + public function getIndexNameForSolr($settings, $set) { |
|
109 | 105 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
110 | 106 | ->getQueryBuilderForTable('tx_dlf_collections'); |
111 | 107 |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | if ($this->document) { |
158 | 158 | $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
159 | 159 | } else { |
160 | - $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
|
160 | + $this->logger->error('Invalid UID "'.$requestData['id'].'" or PID "'.$pid.'" for document loading'); |
|
161 | 161 | } |
162 | 162 | } else if (GeneralUtility::isValidUrl($requestData['id'])) { |
163 | 163 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | $this->document->setLocation($requestData['id']); |
177 | 177 | } else { |
178 | - $this->logger->error('Invalid location given "' . $requestData['id'] . '" for document loading'); |
|
178 | + $this->logger->error('Invalid location given "'.$requestData['id'].'" for document loading'); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | if ($this->document !== null && $doc !== null) { |
193 | 193 | $this->document->setDoc($doc); |
194 | 194 | } else { |
195 | - $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"'); |
|
195 | + $this->logger->error('Failed to load document with record ID "'.$requestData['recordId'].'"'); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | } else { |
199 | - $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
|
199 | + $this->logger->error('Invalid UID "'.$requestData['id'].'" or PID "'.$pid.'" for document loading'); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | } |
@@ -41,8 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @return ExpressionFunction[] An array of Function instances |
43 | 43 | */ |
44 | - public function getFunctions() |
|
45 | - { |
|
44 | + public function getFunctions() { |
|
46 | 45 | return [ |
47 | 46 | $this->getDocumentTypeFunction(), |
48 | 47 | ]; |
@@ -68,8 +67,7 @@ discard block |
||
68 | 67 | * |
69 | 68 | * @return void |
70 | 69 | */ |
71 | - protected function initializeRepositories($storagePid) |
|
72 | - { |
|
70 | + protected function initializeRepositories($storagePid) { |
|
73 | 71 | Helper::polyfillExtbaseClassesForTYPO3v9(); |
74 | 72 | |
75 | 73 | // TODO: When we drop support for TYPO3v9, we needn't/shouldn't use ObjectManager anymore |
@@ -92,12 +90,10 @@ discard block |
||
92 | 90 | { |
93 | 91 | return new ExpressionFunction( |
94 | 92 | 'getDocumentType', |
95 | - function() |
|
96 | - { |
|
93 | + function() { |
|
97 | 94 | // Not implemented, we only use the evaluator |
98 | 95 | }, |
99 | - function($arguments, $cPid) |
|
100 | - { |
|
96 | + function($arguments, $cPid) { |
|
101 | 97 | /** @var RequestWrapper $requestWrapper */ |
102 | 98 | $requestWrapper = $arguments['request']; |
103 | 99 | $queryParams = $requestWrapper->getQueryParams(); |
@@ -143,8 +139,7 @@ discard block |
||
143 | 139 | * |
144 | 140 | * @return void |
145 | 141 | */ |
146 | - protected function loadDocument($requestData, int $pid) |
|
147 | - { |
|
142 | + protected function loadDocument($requestData, int $pid) { |
|
148 | 143 | // Try to get document format from database |
149 | 144 | if (!empty($requestData['id'])) { |
150 | 145 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | // Load document with current plugin parameters. |
114 | 114 | $this->loadDocument($queryParams['tx_dlf'], $cPid); |
115 | - if ($this->document === null) { |
|
115 | + if ($this->document === NULL) { |
|
116 | 116 | return $type; |
117 | 117 | } |
118 | 118 | // Set PID for metadata definitions. |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | // Calendar plugin does not support IIIF (yet). Abort for all newspaper related types. |
124 | 124 | if ( |
125 | 125 | $this->document->getDoc() instanceof IiifManifest |
126 | - && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== false |
|
126 | + && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== FALSE |
|
127 | 127 | ) { |
128 | 128 | return $type; |
129 | 129 | } |
@@ -150,25 +150,25 @@ discard block |
||
150 | 150 | |
151 | 151 | $this->initializeRepositories($pid); |
152 | 152 | |
153 | - $doc = null; |
|
153 | + $doc = NULL; |
|
154 | 154 | if (MathUtility::canBeInterpretedAsInteger($requestData['id'])) { |
155 | 155 | // find document from repository by uid |
156 | 156 | $this->document = $this->documentRepository->findOneByIdAndSettings((int) $requestData['id'], ['storagePid' => $pid]); |
157 | 157 | if ($this->document) { |
158 | - $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
|
158 | + $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], TRUE); |
|
159 | 159 | } else { |
160 | 160 | $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
161 | 161 | } |
162 | 162 | } else if (GeneralUtility::isValidUrl($requestData['id'])) { |
163 | 163 | |
164 | - $doc = Doc::getInstance($requestData['id'], ['storagePid' => $pid], true); |
|
164 | + $doc = Doc::getInstance($requestData['id'], ['storagePid' => $pid], TRUE); |
|
165 | 165 | |
166 | - if ($doc !== null) { |
|
166 | + if ($doc !== NULL) { |
|
167 | 167 | if ($doc->recordId) { |
168 | 168 | $this->document = $this->documentRepository->findOneByRecordId($doc->recordId); |
169 | 169 | } |
170 | 170 | |
171 | - if ($this->document === null) { |
|
171 | + if ($this->document === NULL) { |
|
172 | 172 | // create new dummy Document object |
173 | 173 | $this->document = GeneralUtility::makeInstance(Document::class); |
174 | 174 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | - if ($this->document !== null && $doc !== null) { |
|
182 | + if ($this->document !== NULL && $doc !== NULL) { |
|
183 | 183 | $this->document->setDoc($doc); |
184 | 184 | } |
185 | 185 | |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | |
188 | 188 | $this->document = $this->documentRepository->findOneByRecordId($requestData['recordId']); |
189 | 189 | |
190 | - if ($this->document !== null) { |
|
191 | - $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
|
192 | - if ($this->document !== null && $doc !== null) { |
|
190 | + if ($this->document !== NULL) { |
|
191 | + $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], TRUE); |
|
192 | + if ($this->document !== NULL && $doc !== NULL) { |
|
193 | 193 | $this->document->setDoc($doc); |
194 | 194 | } else { |
195 | 195 | $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"'); |