@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | public function __construct($viaf, RequestFactory $requestFactory) |
67 | 67 | { |
68 | 68 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
69 | - $this->viafUrl = 'http://viaf.org/viaf/' . $viaf; |
|
69 | + $this->viafUrl = 'http://viaf.org/viaf/'.$viaf; |
|
70 | 70 | $this->requestFactory = $requestFactory; |
71 | 71 | } |
72 | 72 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | try { |
93 | 93 | $response = $this->requestFactory->request($url); |
94 | 94 | } catch (\Exception $e) { |
95 | - $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
|
95 | + $this->logger->warning('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.'); |
|
96 | 96 | return false; |
97 | 97 | } |
98 | 98 | return $response->getBody()->getContents(); |
@@ -105,6 +105,6 @@ discard block |
||
105 | 105 | **/ |
106 | 106 | protected function getApiEndpoint() |
107 | 107 | { |
108 | - return $this->viafUrl . '/' . $this->endpoint; |
|
108 | + return $this->viafUrl.'/'.$this->endpoint; |
|
109 | 109 | } |
110 | 110 | } |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @subpackage dlf |
26 | 26 | * @access public |
27 | 27 | **/ |
28 | -class Client |
|
29 | -{ |
|
28 | +class Client { |
|
30 | 29 | /** |
31 | 30 | * This holds the logger |
32 | 31 | * |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | * @param RequestFactory $requestFactory a request object to inject |
64 | 63 | * @return void |
65 | 64 | **/ |
66 | - public function __construct($viaf, RequestFactory $requestFactory) |
|
67 | - { |
|
65 | + public function __construct($viaf, RequestFactory $requestFactory) { |
|
68 | 66 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
69 | 67 | $this->viafUrl = 'http://viaf.org/viaf/' . $viaf; |
70 | 68 | $this->requestFactory = $requestFactory; |
@@ -86,8 +84,7 @@ discard block |
||
86 | 84 | * |
87 | 85 | * @return object|bool |
88 | 86 | **/ |
89 | - public function getData() |
|
90 | - { |
|
87 | + public function getData() { |
|
91 | 88 | $url = $this->getApiEndpoint(); |
92 | 89 | try { |
93 | 90 | $response = $this->requestFactory->request($url); |
@@ -103,8 +100,7 @@ discard block |
||
103 | 100 | * |
104 | 101 | * @return string |
105 | 102 | **/ |
106 | - protected function getApiEndpoint() |
|
107 | - { |
|
103 | + protected function getApiEndpoint() { |
|
108 | 104 | return $this->viafUrl . '/' . $this->endpoint; |
109 | 105 | } |
110 | 106 | } |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @var string |
49 | 49 | **/ |
50 | - private $viafUrl = null; |
|
50 | + private $viafUrl = NULL; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * The request object |
54 | 54 | * |
55 | 55 | * @var RequestFactoryInterface |
56 | 56 | **/ |
57 | - private $requestFactory = null; |
|
57 | + private $requestFactory = NULL; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Constructs a new instance |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $response = $this->requestFactory->request($url); |
94 | 94 | } catch (\Exception $e) { |
95 | 95 | $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
96 | - return false; |
|
96 | + return FALSE; |
|
97 | 97 | } |
98 | 98 | return $response->getBody()->getContents(); |
99 | 99 | } |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @subpackage dlf |
26 | 26 | * @access public |
27 | 27 | **/ |
28 | -class Profile |
|
29 | -{ |
|
28 | +class Profile { |
|
30 | 29 | /** |
31 | 30 | * This holds the logger |
32 | 31 | * |
@@ -57,8 +56,7 @@ discard block |
||
57 | 56 | * |
58 | 57 | * @return void |
59 | 58 | **/ |
60 | - public function __construct($viaf) |
|
61 | - { |
|
59 | + public function __construct($viaf) { |
|
62 | 60 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
63 | 61 | $this->client = new Client($viaf, GeneralUtility::makeInstance(RequestFactory::class)); |
64 | 62 | } |
@@ -68,8 +66,7 @@ discard block |
||
68 | 66 | * |
69 | 67 | * @return array|false |
70 | 68 | **/ |
71 | - public function getData() |
|
72 | - { |
|
69 | + public function getData() { |
|
73 | 70 | $this->getRaw(); |
74 | 71 | if (!empty($this->raw)) { |
75 | 72 | $data = []; |
@@ -87,8 +84,7 @@ discard block |
||
87 | 84 | * |
88 | 85 | * @return string|false |
89 | 86 | **/ |
90 | - public function getAddress() |
|
91 | - { |
|
87 | + public function getAddress() { |
|
92 | 88 | $this->getRaw(); |
93 | 89 | if (!empty($this->raw->asXML())) { |
94 | 90 | return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0]; |
@@ -103,8 +99,7 @@ discard block |
||
103 | 99 | * |
104 | 100 | * @return string|false |
105 | 101 | **/ |
106 | - public function getFullName() |
|
107 | - { |
|
102 | + public function getFullName() { |
|
108 | 103 | $this->getRaw(); |
109 | 104 | if (!empty($this->raw->asXML())) { |
110 | 105 | $rawName = $this->raw->xpath('./ns1:mainHeadings/ns1:data/ns1:text'); |
@@ -122,8 +117,7 @@ discard block |
||
122 | 117 | * |
123 | 118 | * @return void |
124 | 119 | **/ |
125 | - protected function getRaw() |
|
126 | - { |
|
120 | + protected function getRaw() { |
|
127 | 121 | $data = $this->client->getData(); |
128 | 122 | if (!isset($this->raw) && $data != false) { |
129 | 123 | $this->raw = Helper::getXmlFileAsString($data); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @var \SimpleXmlElement|false |
50 | 50 | **/ |
51 | - private $raw = null; |
|
51 | + private $raw = NULL; |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Constructs client instance |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | return $data; |
79 | 79 | } else { |
80 | 80 | $this->logger->warning('No data found for given VIAF URL'); |
81 | - return false; |
|
81 | + return FALSE; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0]; |
95 | 95 | } else { |
96 | 96 | $this->logger->warning('No address found for given VIAF URL'); |
97 | - return false; |
|
97 | + return FALSE; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return $name; |
114 | 114 | } else { |
115 | 115 | $this->logger->warning('No name found for given VIAF URL'); |
116 | - return false; |
|
116 | + return FALSE; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | protected function getRaw() |
126 | 126 | { |
127 | 127 | $data = $this->client->getData(); |
128 | - if (!isset($this->raw) && $data != false) { |
|
128 | + if (!isset($this->raw) && $data != FALSE) { |
|
129 | 129 | $this->raw = Helper::getXmlFileAsString($data); |
130 | 130 | $this->raw->registerXPathNamespace('ns1', 'http://viaf.org/viaf/terms#'); |
131 | 131 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | array_unshift($metadata, $data); |
113 | 113 | } |
114 | 114 | if (empty($metadata)) { |
115 | - $this->logger->warning('No metadata found for document with UID ' . $this->document->getUid()); |
|
115 | + $this->logger->warning('No metadata found for document with UID '.$this->document->getUid()); |
|
116 | 116 | return ''; |
117 | 117 | } |
118 | 118 | ksort($metadata); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | if (empty(implode('', $value)) && $this->settings['getTitle'] && $this->document->getPartof()) { |
216 | 216 | $superiorTitle = Doc::getTitle($this->document->getPartof(), true); |
217 | 217 | if (!empty($superiorTitle)) { |
218 | - $metadata[$i][$name] = ['[' . $superiorTitle . ']']; |
|
218 | + $metadata[$i][$name] = ['['.$superiorTitle.']']; |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | if (!empty($value)) { |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | * @subpackage dlf |
30 | 30 | * @access public |
31 | 31 | */ |
32 | -class MetadataController extends AbstractController |
|
33 | -{ |
|
32 | +class MetadataController extends AbstractController { |
|
34 | 33 | /** |
35 | 34 | * @var CollectionRepository |
36 | 35 | */ |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | /** |
40 | 39 | * @param CollectionRepository $collectionRepository |
41 | 40 | */ |
42 | - public function injectCollectionRepository(CollectionRepository $collectionRepository) |
|
43 | - { |
|
41 | + public function injectCollectionRepository(CollectionRepository $collectionRepository) { |
|
44 | 42 | $this->collectionRepository = $collectionRepository; |
45 | 43 | } |
46 | 44 | |
@@ -52,8 +50,7 @@ discard block |
||
52 | 50 | /** |
53 | 51 | * @param MetadataRepository $metadataRepository |
54 | 52 | */ |
55 | - public function injectMetadataRepository(MetadataRepository $metadataRepository) |
|
56 | - { |
|
53 | + public function injectMetadataRepository(MetadataRepository $metadataRepository) { |
|
57 | 54 | $this->metadataRepository = $metadataRepository; |
58 | 55 | } |
59 | 56 | |
@@ -65,16 +62,14 @@ discard block |
||
65 | 62 | /** |
66 | 63 | * @param StructureRepository $structureRepository |
67 | 64 | */ |
68 | - public function injectStructureRepository(StructureRepository $structureRepository) |
|
69 | - { |
|
65 | + public function injectStructureRepository(StructureRepository $structureRepository) { |
|
70 | 66 | $this->structureRepository = $structureRepository; |
71 | 67 | } |
72 | 68 | |
73 | 69 | /** |
74 | 70 | * @return string|void |
75 | 71 | */ |
76 | - public function mainAction() |
|
77 | - { |
|
72 | + public function mainAction() { |
|
78 | 73 | $this->cObj = $this->configurationManager->getContentObject(); |
79 | 74 | |
80 | 75 | // Load current document. |
@@ -130,8 +125,7 @@ discard block |
||
130 | 125 | * |
131 | 126 | * @return string The metadata array ready for output |
132 | 127 | */ |
133 | - protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false) |
|
134 | - { |
|
128 | + protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false) { |
|
135 | 129 | if ($useOriginalIiifManifestMetadata) { |
136 | 130 | $iiifData = []; |
137 | 131 | foreach ($metadata as $row) { |
@@ -269,8 +263,7 @@ discard block |
||
269 | 263 | } |
270 | 264 | |
271 | 265 | if (is_array($metadata[$i][$name])) { |
272 | - $metadata[$i][$name] = array_values(array_filter($metadata[$i][$name], function($metadataValue) |
|
273 | - { |
|
266 | + $metadata[$i][$name] = array_values(array_filter($metadata[$i][$name], function($metadataValue) { |
|
274 | 267 | return !empty($metadataValue); |
275 | 268 | })); |
276 | 269 | } |
@@ -294,8 +287,7 @@ discard block |
||
294 | 287 | * |
295 | 288 | * @return array metadata |
296 | 289 | */ |
297 | - private function getMetadata() |
|
298 | - { |
|
290 | + private function getMetadata() { |
|
299 | 291 | $metadata = []; |
300 | 292 | if ($this->settings['rootline'] < 2) { |
301 | 293 | // Get current structure's @ID. |
@@ -333,8 +325,7 @@ discard block |
||
333 | 325 | * |
334 | 326 | * @return array metadata |
335 | 327 | */ |
336 | - private function getMetadataForIds($id, $metadata) |
|
337 | - { |
|
328 | + private function getMetadataForIds($id, $metadata) { |
|
338 | 329 | $useOriginalIiifManifestMetadata = $this->settings['originalIiifMetadata'] == 1 && $this->document->getDoc() instanceof IiifManifest; |
339 | 330 | foreach ($id as $sid) { |
340 | 331 | if ($useOriginalIiifManifestMetadata) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return string The metadata array ready for output |
129 | 129 | */ |
130 | - protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false) |
|
130 | + protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = FALSE) |
|
131 | 131 | { |
132 | 132 | if ($useOriginalIiifManifestMetadata) { |
133 | 133 | $iiifData = []; |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | $iiifData[$key] = [ |
146 | 146 | 'label' => $key, |
147 | 147 | 'value' => $group, |
148 | - 'buildUrl' => true, |
|
148 | + 'buildUrl' => TRUE, |
|
149 | 149 | ]; |
150 | 150 | } else { |
151 | 151 | // Data output |
152 | 152 | $iiifData[$key] = [ |
153 | 153 | 'label' => $key, |
154 | 154 | 'value' => $group, |
155 | - 'buildUrl' => false, |
|
155 | + 'buildUrl' => FALSE, |
|
156 | 156 | ]; |
157 | 157 | } |
158 | 158 | } else { |
@@ -169,18 +169,18 @@ discard block |
||
169 | 169 | $iiifData[$key]['data'][] = [ |
170 | 170 | 'label' => $nolabel ? '' : $label, |
171 | 171 | 'value' => $value, |
172 | - 'buildUrl' => true, |
|
172 | + 'buildUrl' => TRUE, |
|
173 | 173 | ]; |
174 | 174 | } else { |
175 | 175 | $iiifData[$key]['data'][] = [ |
176 | 176 | 'label' => $label, |
177 | 177 | 'value' => $value, |
178 | - 'buildUrl' => false, |
|
178 | + 'buildUrl' => FALSE, |
|
179 | 179 | ]; |
180 | 180 | } |
181 | 181 | } |
182 | 182 | } |
183 | - $this->view->assign('useIiif', true); |
|
183 | + $this->view->assign('useIiif', TRUE); |
|
184 | 184 | $this->view->assign('iiifData', $iiifData); |
185 | 185 | } |
186 | 186 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | if ($name == 'title') { |
211 | 211 | // Get title of parent document if needed. |
212 | 212 | if (empty(implode('', $value)) && $this->settings['getTitle'] && $this->document->getPartof()) { |
213 | - $superiorTitle = Doc::getTitle($this->document->getPartof(), true); |
|
213 | + $superiorTitle = Doc::getTitle($this->document->getPartof(), TRUE); |
|
214 | 214 | if (!empty($superiorTitle)) { |
215 | 215 | $metadata[$i][$name] = ['[' . $superiorTitle . ']']; |
216 | 216 | } |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | * @property-read string $toplevelId This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF) |
51 | 51 | * @property-read string $parentHref URL of the parent document (determined via mptr element), or empty string if none is available |
52 | 52 | */ |
53 | -final class MetsDocument extends Doc |
|
54 | -{ |
|
53 | +final class MetsDocument extends Doc { |
|
55 | 54 | /** |
56 | 55 | * Subsections / tags that may occur within `<mets:amdSec>`. |
57 | 56 | * |
@@ -176,8 +175,7 @@ discard block |
||
176 | 175 | * |
177 | 176 | * @return void |
178 | 177 | */ |
179 | - public function addMetadataFromMets(&$metadata, $id) |
|
180 | - { |
|
178 | + public function addMetadataFromMets(&$metadata, $id) { |
|
181 | 179 | $details = $this->getLogicalStructure($id); |
182 | 180 | if (!empty($details)) { |
183 | 181 | $metadata['mets_order'][0] = $details['order']; |
@@ -191,8 +189,7 @@ discard block |
||
191 | 189 | * {@inheritDoc} |
192 | 190 | * @see \Kitodo\Dlf\Common\Doc::establishRecordId() |
193 | 191 | */ |
194 | - protected function establishRecordId($pid) |
|
195 | - { |
|
192 | + protected function establishRecordId($pid) { |
|
196 | 193 | // Check for METS object @ID. |
197 | 194 | if (!empty($this->mets['OBJID'])) { |
198 | 195 | $this->recordId = (string) $this->mets['OBJID']; |
@@ -212,8 +209,7 @@ discard block |
||
212 | 209 | * {@inheritDoc} |
213 | 210 | * @see \Kitodo\Dlf\Common\Doc::getDownloadLocation() |
214 | 211 | */ |
215 | - public function getDownloadLocation($id) |
|
216 | - { |
|
212 | + public function getDownloadLocation($id) { |
|
217 | 213 | $fileMimeType = $this->getFileMimeType($id); |
218 | 214 | $fileLocation = $this->getFileLocation($id); |
219 | 215 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
@@ -238,8 +234,7 @@ discard block |
||
238 | 234 | * {@inheritDoc} |
239 | 235 | * @see \Kitodo\Dlf\Common\Doc::getFileLocation() |
240 | 236 | */ |
241 | - public function getFileLocation($id) |
|
242 | - { |
|
237 | + public function getFileLocation($id) { |
|
243 | 238 | $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
244 | 239 | if ( |
245 | 240 | !empty($id) |
@@ -256,8 +251,7 @@ discard block |
||
256 | 251 | * {@inheritDoc} |
257 | 252 | * @see \Kitodo\Dlf\Common\Doc::getFileMimeType() |
258 | 253 | */ |
259 | - public function getFileMimeType($id) |
|
260 | - { |
|
254 | + public function getFileMimeType($id) { |
|
261 | 255 | $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
262 | 256 | if ( |
263 | 257 | !empty($id) |
@@ -274,8 +268,7 @@ discard block |
||
274 | 268 | * {@inheritDoc} |
275 | 269 | * @see \Kitodo\Dlf\Common\Doc::getLogicalStructure() |
276 | 270 | */ |
277 | - public function getLogicalStructure($id, $recursive = false) |
|
278 | - { |
|
271 | + public function getLogicalStructure($id, $recursive = false) { |
|
279 | 272 | $details = []; |
280 | 273 | // Is the requested logical unit already loaded? |
281 | 274 | if ( |
@@ -315,8 +308,7 @@ discard block |
||
315 | 308 | * |
316 | 309 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
317 | 310 | */ |
318 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) |
|
319 | - { |
|
311 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) { |
|
320 | 312 | // Get attributes. |
321 | 313 | foreach ($structure->attributes() as $attribute => $value) { |
322 | 314 | $attributes[$attribute] = (string) $value; |
@@ -420,8 +412,7 @@ discard block |
||
420 | 412 | * {@inheritDoc} |
421 | 413 | * @see \Kitodo\Dlf\Common\Doc::getMetadata() |
422 | 414 | */ |
423 | - public function getMetadata($id, $cPid = 0) |
|
424 | - { |
|
415 | + public function getMetadata($id, $cPid = 0) { |
|
425 | 416 | // Make sure $cPid is a non-negative integer. |
426 | 417 | $cPid = max(intval($cPid), 0); |
427 | 418 | // If $cPid is not given, try to get it elsewhere. |
@@ -675,8 +666,7 @@ discard block |
||
675 | 666 | * @param string $id: The "@ID" attribute of the file node |
676 | 667 | * @return void |
677 | 668 | */ |
678 | - protected function getMetadataIds($id) |
|
679 | - { |
|
669 | + protected function getMetadataIds($id) { |
|
680 | 670 | // Load amdSecChildIds concordance |
681 | 671 | $this->_getMdSec(); |
682 | 672 | $this->_getFileInfos(); |
@@ -723,8 +713,7 @@ discard block |
||
723 | 713 | * {@inheritDoc} |
724 | 714 | * @see \Kitodo\Dlf\Common\Doc::getFullText() |
725 | 715 | */ |
726 | - public function getFullText($id) |
|
727 | - { |
|
716 | + public function getFullText($id) { |
|
728 | 717 | $fullText = ''; |
729 | 718 | |
730 | 719 | // Load fileGrps and check for full text files. |
@@ -739,8 +728,7 @@ discard block |
||
739 | 728 | * {@inheritDoc} |
740 | 729 | * @see Doc::getStructureDepth() |
741 | 730 | */ |
742 | - public function getStructureDepth($logId) |
|
743 | - { |
|
731 | + public function getStructureDepth($logId) { |
|
744 | 732 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
745 | 733 | if (!empty($ancestors)) { |
746 | 734 | return count($ancestors); |
@@ -753,8 +741,7 @@ discard block |
||
753 | 741 | * {@inheritDoc} |
754 | 742 | * @see \Kitodo\Dlf\Common\Doc::init() |
755 | 743 | */ |
756 | - protected function init($location) |
|
757 | - { |
|
744 | + protected function init($location) { |
|
758 | 745 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_class($this)); |
759 | 746 | // Get METS node from XML file. |
760 | 747 | $this->registerNamespaces($this->xml); |
@@ -778,8 +765,7 @@ discard block |
||
778 | 765 | * {@inheritDoc} |
779 | 766 | * @see \Kitodo\Dlf\Common\Doc::loadLocation() |
780 | 767 | */ |
781 | - protected function loadLocation($location) |
|
782 | - { |
|
768 | + protected function loadLocation($location) { |
|
783 | 769 | $fileResource = Helper::getUrl($location); |
784 | 770 | if ($fileResource !== false) { |
785 | 771 | $xml = Helper::getXmlFileAsString($fileResource); |
@@ -797,8 +783,7 @@ discard block |
||
797 | 783 | * {@inheritDoc} |
798 | 784 | * @see \Kitodo\Dlf\Common\Doc::ensureHasFulltextIsSet() |
799 | 785 | */ |
800 | - protected function ensureHasFulltextIsSet() |
|
801 | - { |
|
786 | + protected function ensureHasFulltextIsSet() { |
|
802 | 787 | // Are the fileGrps already loaded? |
803 | 788 | if (!$this->fileGrpsLoaded) { |
804 | 789 | $this->_getFileGrps(); |
@@ -809,8 +794,7 @@ discard block |
||
809 | 794 | * {@inheritDoc} |
810 | 795 | * @see Doc::setPreloadedDocument() |
811 | 796 | */ |
812 | - protected function setPreloadedDocument($preloadedDocument) |
|
813 | - { |
|
797 | + protected function setPreloadedDocument($preloadedDocument) { |
|
814 | 798 | |
815 | 799 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
816 | 800 | $this->xml = $preloadedDocument; |
@@ -823,8 +807,7 @@ discard block |
||
823 | 807 | * {@inheritDoc} |
824 | 808 | * @see Doc::getDocument() |
825 | 809 | */ |
826 | - protected function getDocument() |
|
827 | - { |
|
810 | + protected function getDocument() { |
|
828 | 811 | return $this->mets; |
829 | 812 | } |
830 | 813 | |
@@ -835,8 +818,7 @@ discard block |
||
835 | 818 | * |
836 | 819 | * @return array Array of metadata sections with their IDs as array key |
837 | 820 | */ |
838 | - protected function _getMdSec() |
|
839 | - { |
|
821 | + protected function _getMdSec() { |
|
840 | 822 | if (!$this->mdSecLoaded) { |
841 | 823 | $this->loadFormats(); |
842 | 824 | |
@@ -878,8 +860,7 @@ discard block |
||
878 | 860 | return $this->mdSec; |
879 | 861 | } |
880 | 862 | |
881 | - protected function _getDmdSec() |
|
882 | - { |
|
863 | + protected function _getDmdSec() { |
|
883 | 864 | $this->_getMdSec(); |
884 | 865 | return $this->dmdSec; |
885 | 866 | } |
@@ -893,8 +874,7 @@ discard block |
||
893 | 874 | * |
894 | 875 | * @return array|null The processed metadata section |
895 | 876 | */ |
896 | - protected function processMdSec($element) |
|
897 | - { |
|
877 | + protected function processMdSec($element) { |
|
898 | 878 | $mdId = (string) $element->attributes()->ID; |
899 | 879 | if (empty($mdId)) { |
900 | 880 | return null; |
@@ -934,8 +914,7 @@ discard block |
||
934 | 914 | * |
935 | 915 | * @return array Array of file use groups with file IDs |
936 | 916 | */ |
937 | - protected function _getFileGrps() |
|
938 | - { |
|
917 | + protected function _getFileGrps() { |
|
939 | 918 | if (!$this->fileGrpsLoaded) { |
940 | 919 | // Get configured USE attributes. |
941 | 920 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -987,8 +966,7 @@ discard block |
||
987 | 966 | * @access protected |
988 | 967 | * @return array |
989 | 968 | */ |
990 | - protected function _getFileInfos() |
|
991 | - { |
|
969 | + protected function _getFileInfos() { |
|
992 | 970 | $this->_getFileGrps(); |
993 | 971 | return $this->fileInfos; |
994 | 972 | } |
@@ -997,8 +975,7 @@ discard block |
||
997 | 975 | * {@inheritDoc} |
998 | 976 | * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray() |
999 | 977 | */ |
1000 | - protected function prepareMetadataArray($cPid) |
|
1001 | - { |
|
978 | + protected function prepareMetadataArray($cPid) { |
|
1002 | 979 | $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'); |
1003 | 980 | // Get all logical structure nodes with metadata. |
1004 | 981 | if (!empty($ids)) { |
@@ -1016,8 +993,7 @@ discard block |
||
1016 | 993 | * |
1017 | 994 | * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object |
1018 | 995 | */ |
1019 | - protected function _getMets() |
|
1020 | - { |
|
996 | + protected function _getMets() { |
|
1021 | 997 | return $this->mets; |
1022 | 998 | } |
1023 | 999 | |
@@ -1025,8 +1001,7 @@ discard block |
||
1025 | 1001 | * {@inheritDoc} |
1026 | 1002 | * @see \Kitodo\Dlf\Common\Doc::_getPhysicalStructure() |
1027 | 1003 | */ |
1028 | - protected function _getPhysicalStructure() |
|
1029 | - { |
|
1004 | + protected function _getPhysicalStructure() { |
|
1030 | 1005 | // Is there no physical structure array yet? |
1031 | 1006 | if (!$this->physicalStructureLoaded) { |
1032 | 1007 | // Does the document have a structMap node of type "PHYSICAL"? |
@@ -1088,8 +1063,7 @@ discard block |
||
1088 | 1063 | * {@inheritDoc} |
1089 | 1064 | * @see \Kitodo\Dlf\Common\Doc::_getSmLinks() |
1090 | 1065 | */ |
1091 | - protected function _getSmLinks() |
|
1092 | - { |
|
1066 | + protected function _getSmLinks() { |
|
1093 | 1067 | if (!$this->smLinksLoaded) { |
1094 | 1068 | $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink'); |
1095 | 1069 | if (!empty($smLinks)) { |
@@ -1107,8 +1081,7 @@ discard block |
||
1107 | 1081 | * {@inheritDoc} |
1108 | 1082 | * @see \Kitodo\Dlf\Common\Doc::_getThumbnail() |
1109 | 1083 | */ |
1110 | - protected function _getThumbnail($forceReload = false) |
|
1111 | - { |
|
1084 | + protected function _getThumbnail($forceReload = false) { |
|
1112 | 1085 | if ( |
1113 | 1086 | !$this->thumbnailLoaded |
1114 | 1087 | || $forceReload |
@@ -1187,8 +1160,7 @@ discard block |
||
1187 | 1160 | * {@inheritDoc} |
1188 | 1161 | * @see \Kitodo\Dlf\Common\Doc::_getToplevelId() |
1189 | 1162 | */ |
1190 | - protected function _getToplevelId() |
|
1191 | - { |
|
1163 | + protected function _getToplevelId() { |
|
1192 | 1164 | if (empty($this->toplevelId)) { |
1193 | 1165 | // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
1194 | 1166 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'); |
@@ -1217,8 +1189,7 @@ discard block |
||
1217 | 1189 | * |
1218 | 1190 | * @return string|null |
1219 | 1191 | */ |
1220 | - public function _getParentHref() |
|
1221 | - { |
|
1192 | + public function _getParentHref() { |
|
1222 | 1193 | if ($this->parentHref === null) { |
1223 | 1194 | $this->parentHref = ''; |
1224 | 1195 | |
@@ -1240,8 +1211,7 @@ discard block |
||
1240 | 1211 | * |
1241 | 1212 | * @return array Properties to be serialized |
1242 | 1213 | */ |
1243 | - public function __sleep() |
|
1244 | - { |
|
1214 | + public function __sleep() { |
|
1245 | 1215 | // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization |
1246 | 1216 | $this->asXML = $this->xml->asXML(); |
1247 | 1217 | return ['uid', 'pid', 'recordId', 'parentId', 'asXML']; |
@@ -1254,8 +1224,7 @@ discard block |
||
1254 | 1224 | * |
1255 | 1225 | * @return string String representing the METS object |
1256 | 1226 | */ |
1257 | - public function __toString() |
|
1258 | - { |
|
1227 | + public function __toString() { |
|
1259 | 1228 | $xml = new \DOMDocument('1.0', 'utf-8'); |
1260 | 1229 | $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
1261 | 1230 | $xml->formatOutput = true; |
@@ -1270,8 +1239,7 @@ discard block |
||
1270 | 1239 | * |
1271 | 1240 | * @return void |
1272 | 1241 | */ |
1273 | - public function __wakeup() |
|
1274 | - { |
|
1242 | + public function __wakeup() { |
|
1275 | 1243 | $xml = Helper::getXmlFileAsString($this->asXML); |
1276 | 1244 | if ($xml !== false) { |
1277 | 1245 | $this->asXML = ''; |
@@ -96,20 +96,20 @@ |
||
96 | 96 | foreach ($collections as $collection) { |
97 | 97 | $solr_query = ''; |
98 | 98 | if ($collection->getIndexSearch() != '') { |
99 | - $solr_query .= '(' . $collection->getIndexSearch() . ')'; |
|
99 | + $solr_query .= '('.$collection->getIndexSearch().')'; |
|
100 | 100 | } else { |
101 | - $solr_query .= 'collection:("' . Solr::escapeQuery($collection->getIndexName()) . '")'; |
|
101 | + $solr_query .= 'collection:("'.Solr::escapeQuery($collection->getIndexName()).'")'; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | // virtual collection might yield documents, that are not toplevel true or partof anything |
105 | 105 | if ($collection->getIndexSearch()) { |
106 | 106 | $params['query'] = $solr_query; |
107 | 107 | } else { |
108 | - $params['query'] = $solr_query . ' AND partof:0 AND toplevel:true'; |
|
108 | + $params['query'] = $solr_query.' AND partof:0 AND toplevel:true'; |
|
109 | 109 | } |
110 | 110 | $partOfNothing = $solr->search_raw($params); |
111 | 111 | |
112 | - $params['query'] = $solr_query . ' AND NOT partof:0 AND toplevel:true'; |
|
112 | + $params['query'] = $solr_query.' AND NOT partof:0 AND toplevel:true'; |
|
113 | 113 | $partOfSomething = $solr->search_raw($params); |
114 | 114 | // Titles are all documents that are "root" elements i.e. partof == 0 |
115 | 115 | $collectionInfo['titles'] = []; |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | // sanitize date search input |
111 | - if(empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) { |
|
111 | + if (empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) { |
|
112 | 112 | $this->searchParams['dateFrom'] = '*'; |
113 | 113 | } |
114 | - if(empty($this->searchParams['dateTo']) && !empty($this->searchParams['dateFrom'])) { |
|
114 | + if (empty($this->searchParams['dateTo']) && !empty($this->searchParams['dateFrom'])) { |
|
115 | 115 | $this->searchParams['dateTo'] = 'NOW'; |
116 | 116 | } |
117 | - if($this->searchParams['dateFrom'] > $this->searchParams['dateTo']) { |
|
117 | + if ($this->searchParams['dateFrom'] > $this->searchParams['dateTo']) { |
|
118 | 118 | $tmpDate = $this->searchParams['dateFrom']; |
119 | 119 | $this->searchParams['dateFrom'] = $this->searchParams['dateTo']; |
120 | 120 | $this->searchParams['dateTo'] = $tmpDate; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | // Add uHash parameter to suggest parameter to make a basic protection of this form. |
177 | 177 | if ($this->settings['suggest']) { |
178 | - $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()) . Environment::getExtensionsPath(), 'SearchSuggest')); |
|
178 | + $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()).Environment::getExtensionsPath(), 'SearchSuggest')); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | $this->view->assign('viewData', $this->viewData); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | // Get facets from plugin configuration. |
199 | 199 | $facets = []; |
200 | 200 | foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
201 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
201 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | $this->view->assign('facetsMenu', $this->makeFacetsMenuArray($facets)); |
@@ -240,13 +240,13 @@ discard block |
||
240 | 240 | $searchParams = $this->searchParams; |
241 | 241 | if ( |
242 | 242 | (!empty($searchParams['fulltext'])) |
243 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches) |
|
243 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches) |
|
244 | 244 | ) { |
245 | 245 | // If the query already is a fulltext query e.g using the facets |
246 | 246 | $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1]; |
247 | 247 | // Search in fulltext field if applicable. Query must not be empty! |
248 | 248 | if (!empty($this->searchParams['query'])) { |
249 | - $search['query'] = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')'; |
|
249 | + $search['query'] = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')'; |
|
250 | 250 | } |
251 | 251 | } else { |
252 | 252 | // Retain given search field if valid. |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | // extract collections from collection parameter |
260 | 260 | $collection = null; |
261 | 261 | if ($this->searchParams['collection']) { |
262 | - foreach(explode(',', $this->searchParams['collection']) as $collectionEntry) { |
|
262 | + foreach (explode(',', $this->searchParams['collection']) as $collectionEntry) { |
|
263 | 263 | $collection[] = $this->collectionRepository->findByUid($collectionEntry); |
264 | 264 | } |
265 | 265 | |
@@ -269,26 +269,26 @@ discard block |
||
269 | 269 | $virtualCollectionsQueryString = ''; |
270 | 270 | foreach ($collection as $collectionEntry) { |
271 | 271 | // check for virtual collections query string |
272 | - if($collectionEntry->getIndexSearch()) { |
|
273 | - $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collectionEntry->getIndexSearch() . ')' : ' OR ('. $collectionEntry->getIndexSearch() . ')' ; |
|
272 | + if ($collectionEntry->getIndexSearch()) { |
|
273 | + $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '('.$collectionEntry->getIndexSearch().')' : ' OR ('.$collectionEntry->getIndexSearch().')'; |
|
274 | 274 | } |
275 | 275 | else { |
276 | - $collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collectionEntry->getIndexName() . '"' : ' OR "' . $collectionEntry->getIndexName() . '"'; |
|
276 | + $collectionsQueryString .= empty($collectionsQueryString) ? '"'.$collectionEntry->getIndexName().'"' : ' OR "'.$collectionEntry->getIndexName().'"'; |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
280 | 280 | // distinguish between simple collection browsing and actual searching within the collection(s) |
281 | - if(!empty($collectionsQueryString)) { |
|
282 | - if(empty($searchParams['query'])) { |
|
283 | - $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . ') AND toplevel:true AND partof:0)'; |
|
281 | + if (!empty($collectionsQueryString)) { |
|
282 | + if (empty($searchParams['query'])) { |
|
283 | + $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.') AND toplevel:true AND partof:0)'; |
|
284 | 284 | } else { |
285 | - $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . '))'; |
|
285 | + $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.'))'; |
|
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
289 | 289 | // virtual collections might query documents that are neither toplevel:true nor partof:0 and need to be searched separatly |
290 | - if(!empty($virtualCollectionsQueryString)) { |
|
291 | - $virtualCollectionsQueryString = '(' . $virtualCollectionsQueryString . ')'; |
|
290 | + if (!empty($virtualCollectionsQueryString)) { |
|
291 | + $virtualCollectionsQueryString = '('.$virtualCollectionsQueryString.')'; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // combine both querystrings into a single filterquery via OR if both are given, otherwise pass either of those |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | // add filter query for date search |
299 | 299 | if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) { |
300 | 300 | // combine dateFrom and dateTo into filterquery as range search |
301 | - $search['params']['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}' . $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']'; |
|
301 | + $search['params']['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']'; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | // Add extended search query. |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | in_array($searchParams['extOperator'][$i], $allowedOperators) |
317 | 317 | ) { |
318 | 318 | if (!empty($search['query'])) { |
319 | - $search['query'] .= ' ' . $searchParams['extOperator'][$i] . ' '; |
|
319 | + $search['query'] .= ' '.$searchParams['extOperator'][$i].' '; |
|
320 | 320 | } |
321 | - $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')'; |
|
321 | + $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')'; |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | } |
@@ -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; |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | * @subpackage dlf |
33 | 33 | * @access public |
34 | 34 | */ |
35 | -class SearchController extends AbstractController |
|
36 | -{ |
|
35 | +class SearchController extends AbstractController { |
|
37 | 36 | /** |
38 | 37 | * @var CollectionRepository |
39 | 38 | */ |
@@ -42,8 +41,7 @@ discard block |
||
42 | 41 | /** |
43 | 42 | * @param CollectionRepository $collectionRepository |
44 | 43 | */ |
45 | - public function injectCollectionRepository(CollectionRepository $collectionRepository) |
|
46 | - { |
|
44 | + public function injectCollectionRepository(CollectionRepository $collectionRepository) { |
|
47 | 45 | $this->collectionRepository = $collectionRepository; |
48 | 46 | } |
49 | 47 | |
@@ -55,8 +53,7 @@ discard block |
||
55 | 53 | /** |
56 | 54 | * @param MetadataRepository $metadataRepository |
57 | 55 | */ |
58 | - public function injectMetadataRepository(MetadataRepository $metadataRepository) |
|
59 | - { |
|
56 | + public function injectMetadataRepository(MetadataRepository $metadataRepository) { |
|
60 | 57 | $this->metadataRepository = $metadataRepository; |
61 | 58 | } |
62 | 59 | |
@@ -71,8 +68,7 @@ discard block |
||
71 | 68 | * |
72 | 69 | * @return void |
73 | 70 | */ |
74 | - public function searchAction() |
|
75 | - { |
|
71 | + public function searchAction() { |
|
76 | 72 | // if search was triggered, get search parameters from POST variables |
77 | 73 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
78 | 74 | |
@@ -87,8 +83,7 @@ discard block |
||
87 | 83 | * |
88 | 84 | * @return void |
89 | 85 | */ |
90 | - public function mainAction() |
|
91 | - { |
|
86 | + public function mainAction() { |
|
92 | 87 | $listViewSearch = false; |
93 | 88 | // Quit without doing anything if required variables are not set. |
94 | 89 | if (empty($this->settings['solrcore'])) { |
@@ -188,8 +183,7 @@ discard block |
||
188 | 183 | * |
189 | 184 | * @return string HTML output of facets menu |
190 | 185 | */ |
191 | - protected function addFacetsMenu() |
|
192 | - { |
|
186 | + protected function addFacetsMenu() { |
|
193 | 187 | // Quit without doing anything if no facets are configured. |
194 | 188 | if (empty($this->settings['facets']) && empty($this->settings['facetCollections'])) { |
195 | 189 | return ''; |
@@ -214,8 +208,7 @@ discard block |
||
214 | 208 | * |
215 | 209 | * @return array HMENU array |
216 | 210 | */ |
217 | - public function makeFacetsMenuArray($facets) |
|
218 | - { |
|
211 | + public function makeFacetsMenuArray($facets) { |
|
219 | 212 | $menuArray = []; |
220 | 213 | // Set default value for facet search. |
221 | 214 | $search = [ |
@@ -271,8 +264,7 @@ discard block |
||
271 | 264 | // check for virtual collections query string |
272 | 265 | if($collectionEntry->getIndexSearch()) { |
273 | 266 | $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collectionEntry->getIndexSearch() . ')' : ' OR ('. $collectionEntry->getIndexSearch() . ')' ; |
274 | - } |
|
275 | - else { |
|
267 | + } else { |
|
276 | 268 | $collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collectionEntry->getIndexName() . '"' : ' OR "' . $collectionEntry->getIndexName() . '"'; |
277 | 269 | } |
278 | 270 | } |
@@ -421,8 +413,7 @@ discard block |
||
421 | 413 | * |
422 | 414 | * @return array The array for the facet's menu entry |
423 | 415 | */ |
424 | - protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) |
|
425 | - { |
|
416 | + protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
426 | 417 | $entryArray = []; |
427 | 418 | // Translate value. |
428 | 419 | if ($field == 'owner_faceting') { |
@@ -473,8 +464,7 @@ discard block |
||
473 | 464 | * |
474 | 465 | * @return string The extended search form or an empty string |
475 | 466 | */ |
476 | - protected function addExtendedSearch() |
|
477 | - { |
|
467 | + protected function addExtendedSearch() { |
|
478 | 468 | // Quit without doing anything if no fields for extended search are selected. |
479 | 469 | if ( |
480 | 470 | empty($this->settings['extendedSlotCount']) |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
78 | 78 | |
79 | 79 | // output is done by main action |
80 | - $this->forward('main', null, null, ['searchParameter' => $this->searchParams]); |
|
80 | + $this->forward('main', NULL, NULL, ['searchParameter' => $this->searchParams]); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function mainAction() |
91 | 91 | { |
92 | - $listViewSearch = false; |
|
92 | + $listViewSearch = FALSE; |
|
93 | 93 | // Quit without doing anything if required variables are not set. |
94 | 94 | if (empty($this->settings['solrcore'])) { |
95 | 95 | $this->logger->warning('Incomplete plugin configuration'); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | if (isset($listRequestData['searchParameter']) && is_array($listRequestData['searchParameter'])) { |
105 | 105 | $this->searchParams = array_merge($this->searchParams ? : [], $listRequestData['searchParameter']); |
106 | - $listViewSearch = true; |
|
106 | + $listViewSearch = TRUE; |
|
107 | 107 | $GLOBALS['TSFE']->fe_user->setKey('ses', 'search', $this->searchParams); |
108 | 108 | } |
109 | 109 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | // If a targetPid is given, the results will be shown by ListView on the target page. |
130 | 130 | if (!empty($this->settings['targetPid']) && !empty($this->searchParams) && !$listViewSearch) { |
131 | - $this->redirect('main', 'ListView', null, |
|
131 | + $this->redirect('main', 'ListView', NULL, |
|
132 | 132 | [ |
133 | 133 | 'searchParameter' => $this->searchParams, |
134 | 134 | 'widgetPage' => $widgetPage |
@@ -139,16 +139,16 @@ discard block |
||
139 | 139 | // If no search has been executed, no variables habe to be prepared. An empty form will be shown. |
140 | 140 | if (is_array($this->searchParams) && !empty($this->searchParams)) { |
141 | 141 | // get all sortable metadata records |
142 | - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); |
|
142 | + $sortableMetadata = $this->metadataRepository->findByIsSortable(TRUE); |
|
143 | 143 | |
144 | 144 | // get all metadata records to be shown in results |
145 | - $listedMetadata = $this->metadataRepository->findByIsListed(true); |
|
145 | + $listedMetadata = $this->metadataRepository->findByIsListed(TRUE); |
|
146 | 146 | |
147 | 147 | $solrResults = []; |
148 | 148 | $numResults = 0; |
149 | 149 | // Do not execute the Solr search if used together with ListView plugin. |
150 | 150 | if (!$listViewSearch) { |
151 | - $solrResults = $this->documentRepository->findSolrByCollection(null, $this->settings, $this->searchParams, $listedMetadata); |
|
151 | + $solrResults = $this->documentRepository->findSolrByCollection(NULL, $this->settings, $this->searchParams, $listedMetadata); |
|
152 | 152 | $numResults = $solrResults->getNumFound(); |
153 | 153 | } |
154 | 154 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | // Get facets from plugin configuration. |
199 | 199 | $facets = []; |
200 | - foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
|
200 | + foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], TRUE) as $facet) { |
|
201 | 201 | $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
202 | 202 | } |
203 | 203 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | |
258 | 258 | // if collections are given, we prepare the collection query string |
259 | 259 | // extract collections from collection parameter |
260 | - $collection = null; |
|
260 | + $collection = NULL; |
|
261 | 261 | if ($this->searchParams['collection']) { |
262 | 262 | foreach(explode(',', $this->searchParams['collection']) as $collectionEntry) { |
263 | 263 | $collection[] = $this->collectionRepository->findByUid($collectionEntry); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | // Check if facet is already selected. |
446 | 446 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
447 | 447 | $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
448 | - if ($index !== false) { |
|
448 | + if ($index !== FALSE) { |
|
449 | 449 | // Facet is selected, thus remove it from filter. |
450 | 450 | unset($queryColumn[$index]); |
451 | 451 | $queryColumn = array_values($queryColumn); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $state = 'ACTIFSUB'; |
454 | 454 | // Reset facets |
455 | 455 | if ($this->settings['resetFacets']) { |
456 | - $entryArray['resetFacet'] = true; |
|
456 | + $entryArray['resetFacet'] = TRUE; |
|
457 | 457 | $entryArray['queryColumn'] = $queryColumn; |
458 | 458 | } |
459 | 459 | } else { |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | } |
485 | 485 | |
486 | 486 | // Get field selector options. |
487 | - $searchFields = GeneralUtility::trimExplode(',', $this->settings['extendedFields'], true); |
|
487 | + $searchFields = GeneralUtility::trimExplode(',', $this->settings['extendedFields'], TRUE); |
|
488 | 488 | |
489 | 489 | $slotCountArray = []; |
490 | 490 | for ($i = 0; $i < $this->settings['extendedSlotCount']; $i++) { |
@@ -75,7 +75,7 @@ |
||
75 | 75 | // extract collection(s) from collection parameter |
76 | 76 | $collection = null; |
77 | 77 | if ($this->searchParams['collection']) { |
78 | - foreach(explode(',', $this->searchParams['collection']) as $collectionEntry) { |
|
78 | + foreach (explode(',', $this->searchParams['collection']) as $collectionEntry) { |
|
79 | 79 | $collection[] = $this->collectionRepository->findByUid($collectionEntry); |
80 | 80 | } |
81 | 81 | } |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | * @subpackage dlf |
30 | 30 | * @access public |
31 | 31 | */ |
32 | -class ListViewController extends AbstractController |
|
33 | -{ |
|
32 | +class ListViewController extends AbstractController { |
|
34 | 33 | /** |
35 | 34 | * @var CollectionRepository |
36 | 35 | */ |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | /** |
40 | 39 | * @param CollectionRepository $collectionRepository |
41 | 40 | */ |
42 | - public function injectCollectionRepository(CollectionRepository $collectionRepository) |
|
43 | - { |
|
41 | + public function injectCollectionRepository(CollectionRepository $collectionRepository) { |
|
44 | 42 | $this->collectionRepository = $collectionRepository; |
45 | 43 | } |
46 | 44 | |
@@ -52,8 +50,7 @@ discard block |
||
52 | 50 | /** |
53 | 51 | * @param MetadataRepository $metadataRepository |
54 | 52 | */ |
55 | - public function injectMetadataRepository(MetadataRepository $metadataRepository) |
|
56 | - { |
|
53 | + public function injectMetadataRepository(MetadataRepository $metadataRepository) { |
|
57 | 54 | $this->metadataRepository = $metadataRepository; |
58 | 55 | } |
59 | 56 | |
@@ -68,8 +65,7 @@ discard block |
||
68 | 65 | * |
69 | 66 | * @return void |
70 | 67 | */ |
71 | - public function mainAction() |
|
72 | - { |
|
68 | + public function mainAction() { |
|
73 | 69 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
74 | 70 | |
75 | 71 | // extract collection(s) from collection parameter |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
74 | 74 | |
75 | 75 | // extract collection(s) from collection parameter |
76 | - $collection = null; |
|
76 | + $collection = NULL; |
|
77 | 77 | if ($this->searchParams['collection']) { |
78 | 78 | foreach(explode(',', $this->searchParams['collection']) as $collectionEntry) { |
79 | 79 | $collection[] = $this->collectionRepository->findByUid($collectionEntry); |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | $GLOBALS['TSFE']->fe_user->setKey('ses', 'widgetPage', $widgetPage); |
88 | 88 | |
89 | 89 | // get all sortable metadata records |
90 | - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); |
|
90 | + $sortableMetadata = $this->metadataRepository->findByIsSortable(TRUE); |
|
91 | 91 | |
92 | 92 | // get all metadata records to be shown in results |
93 | - $listedMetadata = $this->metadataRepository->findByIsListed(true); |
|
93 | + $listedMetadata = $this->metadataRepository->findByIsListed(TRUE); |
|
94 | 94 | |
95 | 95 | $solrResults = []; |
96 | 96 | $numResults = 0; |
97 | 97 | if (is_array($this->searchParams) && !empty($this->searchParams)) { |
98 | - $solrResults = $this->documentRepository->findSolrByCollection($collection ? : null, $this->settings, $this->searchParams, $listedMetadata); |
|
98 | + $solrResults = $this->documentRepository->findSolrByCollection($collection ? : NULL, $this->settings, $this->searchParams, $listedMetadata); |
|
99 | 99 | $numResults = $solrResults->getNumFound(); |
100 | 100 | } |
101 | 101 |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * @subpackage dlf |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class NavigationController extends AbstractController |
|
27 | -{ |
|
26 | +class NavigationController extends AbstractController { |
|
28 | 27 | /** |
29 | 28 | * Method to get the page select values and use them with chash |
30 | 29 | * @param \Kitodo\Dlf\Domain\Model\PageSelectForm|NULL $pageSelectForm |
@@ -53,8 +52,7 @@ discard block |
||
53 | 52 | * |
54 | 53 | * @return void |
55 | 54 | */ |
56 | - public function mainAction() |
|
57 | - { |
|
55 | + public function mainAction() { |
|
58 | 56 | // Load current document. |
59 | 57 | $this->loadDocument($this->requestData); |
60 | 58 | if ($this->isDocMissing()) { |
@@ -121,7 +121,7 @@ |
||
121 | 121 | // prepare feature array for fluid |
122 | 122 | $features = []; |
123 | 123 | foreach (explode(',', $this->settings['features']) as $feature) { |
124 | - $features[$feature] = true; |
|
124 | + $features[$feature] = TRUE; |
|
125 | 125 | } |
126 | 126 | $this->view->assign('features', $features); |
127 | 127 | } |
@@ -23,15 +23,13 @@ discard block |
||
23 | 23 | * @subpackage dlf |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class ToolboxController extends AbstractController |
|
27 | -{ |
|
26 | +class ToolboxController extends AbstractController { |
|
28 | 27 | /** |
29 | 28 | * The main method of the plugin |
30 | 29 | * |
31 | 30 | * @return void |
32 | 31 | */ |
33 | - public function mainAction() |
|
34 | - { |
|
32 | + public function mainAction() { |
|
35 | 33 | // Load current document. |
36 | 34 | $this->loadDocument($this->requestData); |
37 | 35 | |
@@ -52,8 +50,7 @@ discard block |
||
52 | 50 | * |
53 | 51 | * @return void |
54 | 52 | */ |
55 | - public function annotationtool() |
|
56 | - { |
|
53 | + public function annotationtool() { |
|
57 | 54 | if ($this->isDocMissingOrEmpty()) { |
58 | 55 | // Quit without doing anything if required variables are not set. |
59 | 56 | return ''; |
@@ -91,8 +88,7 @@ discard block |
||
91 | 88 | * |
92 | 89 | * @return void |
93 | 90 | */ |
94 | - public function fulltextdownloadtool() |
|
95 | - { |
|
91 | + public function fulltextdownloadtool() { |
|
96 | 92 | if ( |
97 | 93 | $this->isDocMissingOrEmpty() |
98 | 94 | || empty($this->extConf['fileGrpFulltext']) |
@@ -136,8 +132,7 @@ discard block |
||
136 | 132 | * |
137 | 133 | * @return void |
138 | 134 | */ |
139 | - public function fulltexttool() |
|
140 | - { |
|
135 | + public function fulltexttool() { |
|
141 | 136 | if ( |
142 | 137 | $this->isDocMissingOrEmpty() |
143 | 138 | || empty($this->extConf['fileGrpFulltext']) |
@@ -181,8 +176,7 @@ discard block |
||
181 | 176 | * |
182 | 177 | * @return void |
183 | 178 | */ |
184 | - public function imagedownloadtool() |
|
185 | - { |
|
179 | + public function imagedownloadtool() { |
|
186 | 180 | if ( |
187 | 181 | $this->isDocMissingOrEmpty() |
188 | 182 | || empty($this->settings['fileGrpsImageDownload']) |
@@ -224,8 +218,7 @@ discard block |
||
224 | 218 | * |
225 | 219 | * @return array Array of image links and image format information |
226 | 220 | */ |
227 | - protected function getImage($page) |
|
228 | - { |
|
221 | + protected function getImage($page) { |
|
229 | 222 | $image = []; |
230 | 223 | // Get @USE value of METS fileGrp. |
231 | 224 | $fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->settings['fileGrpsImageDownload']); |
@@ -258,8 +251,7 @@ discard block |
||
258 | 251 | * |
259 | 252 | * @return void |
260 | 253 | */ |
261 | - public function imagemanipulationtool() |
|
262 | - { |
|
254 | + public function imagemanipulationtool() { |
|
263 | 255 | // Set parent element for initialization. |
264 | 256 | $parentContainer = !empty($this->settings['parentContainer']) ? $this->settings['parentContainer'] : '.tx-dlf-imagemanipulationtool'; |
265 | 257 | |
@@ -272,8 +264,7 @@ discard block |
||
272 | 264 | * |
273 | 265 | * @return void |
274 | 266 | */ |
275 | - public function pdfdownloadtool() |
|
276 | - { |
|
267 | + public function pdfdownloadtool() { |
|
277 | 268 | if ( |
278 | 269 | $this->isDocMissingOrEmpty() |
279 | 270 | || empty($this->extConf['fileGrpDownload']) |
@@ -310,8 +301,7 @@ discard block |
||
310 | 301 | * |
311 | 302 | * @return array Link to downloadable page |
312 | 303 | */ |
313 | - protected function getPageLink() |
|
314 | - { |
|
304 | + protected function getPageLink() { |
|
315 | 305 | $page1Link = ''; |
316 | 306 | $page2Link = ''; |
317 | 307 | $pageLinkArray = []; |
@@ -355,8 +345,7 @@ discard block |
||
355 | 345 | * |
356 | 346 | * @return string Link to downloadable work |
357 | 347 | */ |
358 | - protected function getWorkLink() |
|
359 | - { |
|
348 | + protected function getWorkLink() { |
|
360 | 349 | $workLink = ''; |
361 | 350 | $fileGrpsDownload = GeneralUtility::trimExplode(',', $this->extConf['fileGrpDownload']); |
362 | 351 | // Get work link. |
@@ -385,8 +374,7 @@ discard block |
||
385 | 374 | * |
386 | 375 | * @return void |
387 | 376 | */ |
388 | - public function searchindocumenttool() |
|
389 | - { |
|
377 | + public function searchindocumenttool() { |
|
390 | 378 | if ( |
391 | 379 | $this->isDocMissingOrEmpty() |
392 | 380 | || empty($this->extConf['fileGrpFulltext']) |
@@ -448,8 +436,7 @@ discard block |
||
448 | 436 | * |
449 | 437 | * @return string with current document id |
450 | 438 | */ |
451 | - protected function getCurrentDocumentId() |
|
452 | - { |
|
439 | + protected function getCurrentDocumentId() { |
|
453 | 440 | $id = $this->document->getUid(); |
454 | 441 | |
455 | 442 | if ($id !== null && $id > 0) { |
@@ -484,8 +471,7 @@ discard block |
||
484 | 471 | * |
485 | 472 | * @return string with encrypted core name |
486 | 473 | */ |
487 | - protected function getEncryptedCoreName() |
|
488 | - { |
|
474 | + protected function getEncryptedCoreName() { |
|
489 | 475 | // Get core name. |
490 | 476 | $name = Helper::getIndexNameFromUid($this->settings['solrcore'], 'tx_dlf_solrcores'); |
491 | 477 | // Encrypt core name. |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | foreach ($tools as $tool) { |
44 | 44 | $tool = trim(str_replace('tx_dlf_', '', $tool)); |
45 | 45 | $this->$tool(); |
46 | - $this->view->assign($tool, true); |
|
46 | + $this->view->assign($tool, TRUE); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | |
78 | 78 | $annotationContainers = $this->document->getDoc()->physicalStructureInfo[$this->document->getDoc()->physicalStructure[$this->requestData['page']]]['annotationContainers']; |
79 | 79 | if ( |
80 | - $annotationContainers != null |
|
80 | + $annotationContainers != NULL |
|
81 | 81 | && sizeof($annotationContainers) > 0 |
82 | 82 | ) { |
83 | - $this->view->assign('annotationTool', true); |
|
83 | + $this->view->assign('annotationTool', TRUE); |
|
84 | 84 | } else { |
85 | - $this->view->assign('annotationTool', false); |
|
85 | + $this->view->assign('annotationTool', FALSE); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | } |
126 | 126 | } |
127 | 127 | if (!empty($fullTextFile)) { |
128 | - $this->view->assign('fulltextDownload', true); |
|
128 | + $this->view->assign('fulltextDownload', TRUE); |
|
129 | 129 | } else { |
130 | - $this->view->assign('fulltextDownload', false); |
|
130 | + $this->view->assign('fulltextDownload', FALSE); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | } |
170 | 170 | } |
171 | 171 | if (!empty($fullTextFile)) { |
172 | - $this->view->assign('fulltext', true); |
|
172 | + $this->view->assign('fulltext', TRUE); |
|
173 | 173 | $this->view->assign('activateFullTextInitially', MathUtility::forceIntegerInRange($this->settings['activateFullTextInitially'], 0, 1, 0)); |
174 | 174 | } else { |
175 | - $this->view->assign('fulltext', false); |
|
175 | + $this->view->assign('fulltext', FALSE); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | // Set parent element for initialization. |
264 | 264 | $parentContainer = !empty($this->settings['parentContainer']) ? $this->settings['parentContainer'] : '.tx-dlf-imagemanipulationtool'; |
265 | 265 | |
266 | - $this->view->assign('imageManipulation', true); |
|
266 | + $this->view->assign('imageManipulation', TRUE); |
|
267 | 267 | $this->view->assign('parentContainer', $parentContainer); |
268 | 268 | } |
269 | 269 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | { |
453 | 453 | $id = $this->document->getUid(); |
454 | 454 | |
455 | - if ($id !== null && $id > 0) { |
|
455 | + if ($id !== NULL && $id > 0) { |
|
456 | 456 | // we found the document uid |
457 | 457 | return (string) $id; |
458 | 458 | } else { |