@@ -19,13 +19,11 @@ |
||
19 | 19 | /** |
20 | 20 | * Add inline JavaScript code to footer * |
21 | 21 | */ |
22 | -class JsFooterViewHelper extends AbstractViewHelper |
|
23 | -{ |
|
22 | +class JsFooterViewHelper extends AbstractViewHelper { |
|
24 | 23 | /** |
25 | 24 | * Initialize arguments. |
26 | 25 | */ |
27 | - public function initializeArguments() |
|
28 | - { |
|
26 | + public function initializeArguments() { |
|
29 | 27 | parent::initializeArguments(); |
30 | 28 | $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', true); |
31 | 29 | } |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | $fulltext['mimetype'] = $this->document->getDoc()->getFileMimeType($this->document->getDoc()->physicalStructureInfo[$this->document->getDoc()->physicalStructure[$page]]['files'][$fileGrpFulltext]); |
147 | 147 | break; |
148 | 148 | } else { |
149 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrp "' . $fileGrpFulltext . '"'); |
|
149 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrp "'.$fileGrpFulltext.'"'); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | if (empty($fulltext)) { |
153 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrps "' . $this->settings['fileGrpFulltext'] . '"'); |
|
153 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrps "'.$this->settings['fileGrpFulltext'].'"'); |
|
154 | 154 | } |
155 | 155 | return $fulltext; |
156 | 156 | } |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | $viewerConfiguration = '$(document).ready(function() { |
169 | 169 | if (dlfUtils.exists(dlfViewer)) { |
170 | 170 | tx_dlf_viewer = new dlfViewer({ |
171 | - controls: ["' . implode('", "', $this->controls) . '"], |
|
172 | - div: "' . $this->settings['elementId'] . '", |
|
173 | - images: ' . json_encode($this->images) . ', |
|
174 | - fulltexts: ' . json_encode($this->fulltexts) . ', |
|
175 | - annotationContainers: ' . json_encode($this->annotationContainers) . ', |
|
176 | - useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0) . ' |
|
171 | + controls: ["' . implode('", "', $this->controls).'"], |
|
172 | + div: "' . $this->settings['elementId'].'", |
|
173 | + images: ' . json_encode($this->images).', |
|
174 | + fulltexts: ' . json_encode($this->fulltexts).', |
|
175 | + annotationContainers: ' . json_encode($this->annotationContainers).', |
|
176 | + useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0).' |
|
177 | 177 | }); |
178 | 178 | } |
179 | 179 | });'; |
@@ -271,11 +271,11 @@ discard block |
||
271 | 271 | $image['mimetype'] = $this->document->getDoc()->getFileMimeType($this->document->getDoc()->physicalStructureInfo[$this->document->getDoc()->physicalStructure[$page]]['files'][$fileGrpImages]); |
272 | 272 | break; |
273 | 273 | } else { |
274 | - $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"'); |
|
274 | + $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"'); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | if (empty($image)) { |
278 | - $this->logger->warning('No image file found for page "' . $page . '" in fileGrps "' . $this->settings['fileGrpImages'] . '"'); |
|
278 | + $this->logger->warning('No image file found for page "'.$page.'" in fileGrps "'.$this->settings['fileGrpImages'].'"'); |
|
279 | 279 | } |
280 | 280 | return $image; |
281 | 281 | } |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * @subpackage dlf |
27 | 27 | * @access public |
28 | 28 | */ |
29 | -class PageViewController extends AbstractController |
|
30 | -{ |
|
29 | +class PageViewController extends AbstractController { |
|
31 | 30 | /** |
32 | 31 | * Holds the controls to add to the map |
33 | 32 | * |
@@ -65,8 +64,7 @@ discard block |
||
65 | 64 | * |
66 | 65 | * @return void |
67 | 66 | */ |
68 | - public function mainAction() |
|
69 | - { |
|
67 | + public function mainAction() { |
|
70 | 68 | // Load current document. |
71 | 69 | $this->loadDocument($this->requestData); |
72 | 70 | if ( |
@@ -121,8 +119,7 @@ discard block |
||
121 | 119 | * |
122 | 120 | * @return array URL and MIME type of fulltext file |
123 | 121 | */ |
124 | - protected function getFulltext($page) |
|
125 | - { |
|
122 | + protected function getFulltext($page) { |
|
126 | 123 | $fulltext = []; |
127 | 124 | // Get fulltext link. |
128 | 125 | $fileGrpsFulltext = GeneralUtility::trimExplode(',', $this->extConf['fileGrpFulltext']); |
@@ -162,8 +159,7 @@ discard block |
||
162 | 159 | * |
163 | 160 | * @return void |
164 | 161 | */ |
165 | - protected function addViewerJS() |
|
166 | - { |
|
162 | + protected function addViewerJS() { |
|
167 | 163 | // Viewer configuration. |
168 | 164 | $viewerConfiguration = '$(document).ready(function() { |
169 | 165 | if (dlfUtils.exists(dlfViewer)) { |
@@ -189,8 +185,7 @@ discard block |
||
189 | 185 | * @return array An array containing the IRIs of the AnnotationLists / AnnotationPages as well as |
190 | 186 | * some information about the canvas. |
191 | 187 | */ |
192 | - protected function getAnnotationContainers($page) |
|
193 | - { |
|
188 | + protected function getAnnotationContainers($page) { |
|
194 | 189 | if ($this->document->getDoc() instanceof IiifManifest) { |
195 | 190 | $canvasId = $this->document->getDoc()->physicalStructure[$page]; |
196 | 191 | $iiif = $this->document->getDoc()->getIiif(); |
@@ -246,8 +241,7 @@ discard block |
||
246 | 241 | * |
247 | 242 | * @return array URL and MIME type of image file |
248 | 243 | */ |
249 | - protected function getImage($page) |
|
250 | - { |
|
244 | + protected function getImage($page) { |
|
251 | 245 | $image = []; |
252 | 246 | // Get @USE value of METS fileGrp. |
253 | 247 | $fileGrpsImages = GeneralUtility::trimExplode(',', $this->extConf['fileGrpImages']); |
@@ -31,8 +31,7 @@ discard block |
||
31 | 31 | * @subpackage dlf |
32 | 32 | * @access public |
33 | 33 | */ |
34 | -class Helper |
|
35 | -{ |
|
34 | +class Helper { |
|
36 | 35 | /** |
37 | 36 | * The extension key |
38 | 37 | * |
@@ -80,8 +79,7 @@ discard block |
||
80 | 79 | * |
81 | 80 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
82 | 81 | */ |
83 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
84 | - { |
|
82 | + public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') { |
|
85 | 83 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
86 | 84 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
87 | 85 | $flashMessage = GeneralUtility::makeInstance( |
@@ -106,8 +104,7 @@ discard block |
||
106 | 104 | * |
107 | 105 | * @return bool Is $id a valid GNL identifier of the given $type? |
108 | 106 | */ |
109 | - public static function checkIdentifier($id, $type) |
|
110 | - { |
|
107 | + public static function checkIdentifier($id, $type) { |
|
111 | 108 | $digits = substr($id, 0, 8); |
112 | 109 | $checksum = 0; |
113 | 110 | for ($i = 0, $j = strlen($digits); $i < $j; $i++) { |
@@ -171,8 +168,7 @@ discard block |
||
171 | 168 | * |
172 | 169 | * @return mixed The decrypted value or false on error |
173 | 170 | */ |
174 | - public static function decrypt($encrypted) |
|
175 | - { |
|
171 | + public static function decrypt($encrypted) { |
|
176 | 172 | if ( |
177 | 173 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
178 | 174 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -211,8 +207,7 @@ discard block |
||
211 | 207 | * |
212 | 208 | * @return \SimpleXMLElement|false |
213 | 209 | */ |
214 | - public static function getXmlFileAsString($content) |
|
215 | - { |
|
210 | + public static function getXmlFileAsString($content) { |
|
216 | 211 | // Don't make simplexml_load_string throw (when $content is an array |
217 | 212 | // or object) |
218 | 213 | if (!is_string($content)) { |
@@ -243,8 +238,7 @@ discard block |
||
243 | 238 | * |
244 | 239 | * @return void |
245 | 240 | */ |
246 | - public static function log($message, $severity = 0) |
|
247 | - { |
|
241 | + public static function log($message, $severity = 0) { |
|
248 | 242 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_called_class()); |
249 | 243 | |
250 | 244 | switch ($severity) { |
@@ -274,8 +268,7 @@ discard block |
||
274 | 268 | * |
275 | 269 | * @return mixed Hashed string or false on error |
276 | 270 | */ |
277 | - public static function digest($string) |
|
278 | - { |
|
271 | + public static function digest($string) { |
|
279 | 272 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
280 | 273 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
281 | 274 | return false; |
@@ -294,8 +287,7 @@ discard block |
||
294 | 287 | * |
295 | 288 | * @return mixed Encrypted string or false on error |
296 | 289 | */ |
297 | - public static function encrypt($string) |
|
298 | - { |
|
290 | + public static function encrypt($string) { |
|
299 | 291 | if ( |
300 | 292 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
301 | 293 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -328,8 +320,7 @@ discard block |
||
328 | 320 | * |
329 | 321 | * @return string The unqualified class name |
330 | 322 | */ |
331 | - public static function getUnqualifiedClassName($qualifiedClassname) |
|
332 | - { |
|
323 | + public static function getUnqualifiedClassName($qualifiedClassname) { |
|
333 | 324 | $nameParts = explode('\\', $qualifiedClassname); |
334 | 325 | return end($nameParts); |
335 | 326 | } |
@@ -343,8 +334,7 @@ discard block |
||
343 | 334 | * |
344 | 335 | * @return string The cleaned up string |
345 | 336 | */ |
346 | - public static function getCleanString($string) |
|
347 | - { |
|
337 | + public static function getCleanString($string) { |
|
348 | 338 | // Convert to lowercase. |
349 | 339 | $string = strtolower($string); |
350 | 340 | // Remove non-alphanumeric characters. |
@@ -365,8 +355,7 @@ discard block |
||
365 | 355 | * |
366 | 356 | * @return array Array of hook objects for the class |
367 | 357 | */ |
368 | - public static function getHookObjects($scriptRelPath) |
|
369 | - { |
|
358 | + public static function getHookObjects($scriptRelPath) { |
|
370 | 359 | $hookObjects = []; |
371 | 360 | if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
372 | 361 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
@@ -387,8 +376,7 @@ discard block |
||
387 | 376 | * |
388 | 377 | * @return string "index_name" for the given UID |
389 | 378 | */ |
390 | - public static function getIndexNameFromUid($uid, $table, $pid = -1) |
|
391 | - { |
|
379 | + public static function getIndexNameFromUid($uid, $table, $pid = -1) { |
|
392 | 380 | // Sanitize input. |
393 | 381 | $uid = max(intval($uid), 0); |
394 | 382 | if ( |
@@ -438,8 +426,7 @@ discard block |
||
438 | 426 | * |
439 | 427 | * @return string Localized full name of language or unchanged input |
440 | 428 | */ |
441 | - public static function getLanguageName($code) |
|
442 | - { |
|
429 | + public static function getLanguageName($code) { |
|
443 | 430 | // Analyze code and set appropriate ISO table. |
444 | 431 | $isoCode = strtolower(trim($code)); |
445 | 432 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
@@ -481,8 +468,7 @@ discard block |
||
481 | 468 | * |
482 | 469 | * @return array |
483 | 470 | */ |
484 | - public static function getDocumentStructures($pid = -1) |
|
485 | - { |
|
471 | + public static function getDocumentStructures($pid = -1) { |
|
486 | 472 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
487 | 473 | $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_structures'); |
488 | 474 | |
@@ -522,8 +508,7 @@ discard block |
||
522 | 508 | * |
523 | 509 | * @return string Uniform Resource Name as string |
524 | 510 | */ |
525 | - public static function getURN($base, $id) |
|
526 | - { |
|
511 | + public static function getURN($base, $id) { |
|
527 | 512 | $concordance = [ |
528 | 513 | '0' => 1, |
529 | 514 | '1' => 2, |
@@ -590,8 +575,7 @@ discard block |
||
590 | 575 | * |
591 | 576 | * @return bool Is $id a valid PPN? |
592 | 577 | */ |
593 | - public static function isPPN($id) |
|
594 | - { |
|
578 | + public static function isPPN($id) { |
|
595 | 579 | return self::checkIdentifier($id, 'PPN'); |
596 | 580 | } |
597 | 581 | |
@@ -602,8 +586,7 @@ discard block |
||
602 | 586 | * |
603 | 587 | * @return bool |
604 | 588 | */ |
605 | - public static function isValidHttpUrl($url) |
|
606 | - { |
|
589 | + public static function isValidHttpUrl($url) { |
|
607 | 590 | if (!GeneralUtility::isValidUrl($url)) { |
608 | 591 | return false; |
609 | 592 | } |
@@ -629,8 +612,7 @@ discard block |
||
629 | 612 | * |
630 | 613 | * @return array Merged array |
631 | 614 | */ |
632 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
633 | - { |
|
615 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) { |
|
634 | 616 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
635 | 617 | return $original; |
636 | 618 | } |
@@ -644,8 +626,7 @@ discard block |
||
644 | 626 | * |
645 | 627 | * @return string All flash messages in the queue rendered as HTML. |
646 | 628 | */ |
647 | - public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') |
|
648 | - { |
|
629 | + public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') { |
|
649 | 630 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
650 | 631 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
651 | 632 | $flashMessages = $flashMessageQueue->getAllMessagesAndFlush(); |
@@ -665,8 +646,7 @@ discard block |
||
665 | 646 | * |
666 | 647 | * @return string Localized label for $index_name |
667 | 648 | */ |
668 | - public static function translate($index_name, $table, $pid) |
|
669 | - { |
|
649 | + public static function translate($index_name, $table, $pid) { |
|
670 | 650 | // Load labels into static variable for future use. |
671 | 651 | static $labels = []; |
672 | 652 | // Sanitize input. |
@@ -794,8 +774,7 @@ discard block |
||
794 | 774 | * |
795 | 775 | * @return string Additional WHERE expression |
796 | 776 | */ |
797 | - public static function whereExpression($table, $showHidden = false) |
|
798 | - { |
|
777 | + public static function whereExpression($table, $showHidden = false) { |
|
799 | 778 | if (\TYPO3_MODE === 'FE') { |
800 | 779 | // Should we ignore the record's hidden flag? |
801 | 780 | $ignoreHide = 0; |
@@ -827,8 +806,7 @@ discard block |
||
827 | 806 | * |
828 | 807 | * @access private |
829 | 808 | */ |
830 | - private function __construct() |
|
831 | - { |
|
809 | + private function __construct() { |
|
832 | 810 | // This is a static class, thus no instances should be created. |
833 | 811 | } |
834 | 812 | |
@@ -854,8 +832,7 @@ discard block |
||
854 | 832 | * |
855 | 833 | * @access public |
856 | 834 | */ |
857 | - public static function polyfillExtbaseClassesForTYPO3v9() |
|
858 | - { |
|
835 | + public static function polyfillExtbaseClassesForTYPO3v9() { |
|
859 | 836 | $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php'; |
860 | 837 | |
861 | 838 | $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
@@ -892,8 +869,7 @@ discard block |
||
892 | 869 | * |
893 | 870 | * @return string|bool |
894 | 871 | */ |
895 | - public static function getUrl(string $url) |
|
896 | - { |
|
872 | + public static function getUrl(string $url) { |
|
897 | 873 | if (!Helper::isValidHttpUrl($url)) { |
898 | 874 | return false; |
899 | 875 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $parent->setDoc($doc); |
116 | 116 | $success = self::add($parent); |
117 | 117 | } else { |
118 | - Helper::log('Could not load parent document with UID ' . $document->getDoc()->parentId, LOG_SEVERITY_ERROR); |
|
118 | + Helper::log('Could not load parent document with UID '.$document->getDoc()->parentId, LOG_SEVERITY_ERROR); |
|
119 | 119 | return false; |
120 | 120 | } |
121 | 121 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | self::$processedDocs[] = $document->getUid(); |
126 | 126 | // Delete old Solr documents. |
127 | 127 | $updateQuery = self::$solr->service->createUpdate(); |
128 | - $updateQuery->addDeleteQuery('uid:' . $document->getUid()); |
|
128 | + $updateQuery->addDeleteQuery('uid:'.$document->getUid()); |
|
129 | 129 | self::$solr->service->update($updateQuery); |
130 | 130 | |
131 | 131 | // Index every logical unit as separate Solr document. |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | } catch (\Exception $e) { |
175 | 175 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
176 | 176 | Helper::addMessage( |
177 | - Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()), |
|
177 | + Helper::getLanguageService()->getLL('flash.solrException').' '.htmlspecialchars($e->getMessage()), |
|
178 | 178 | Helper::getLanguageService()->getLL('flash.error'), |
179 | 179 | FlashMessage::ERROR, |
180 | 180 | true, |
181 | 181 | 'core.template.flashMessages' |
182 | 182 | ); |
183 | 183 | } |
184 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
184 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
185 | 185 | return false; |
186 | 186 | } |
187 | 187 | } else { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | // Sanitize input. |
215 | 215 | $pid = max(intval($pid), 0); |
216 | 216 | if (!$pid) { |
217 | - Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR); |
|
217 | + Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR); |
|
218 | 218 | return ''; |
219 | 219 | } |
220 | 220 | // Load metadata configuration. |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u'); |
224 | 224 | $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u'); |
225 | 225 | $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u'); |
226 | - $index_name .= '_' . $suffix; |
|
226 | + $index_name .= '_'.$suffix; |
|
227 | 227 | return $index_name; |
228 | 228 | } |
229 | 229 | |
@@ -356,11 +356,11 @@ discard block |
||
356 | 356 | $solrDoc->setField(self::getIndexFieldName($index_name, $document->getPid()), $data, self::$fields['fieldboost'][$index_name]); |
357 | 357 | if (in_array($index_name, self::$fields['sortables'])) { |
358 | 358 | // Add sortable fields to index. |
359 | - $solrDoc->setField($index_name . '_sorting', $metadata[$index_name . '_sorting'][0]); |
|
359 | + $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]); |
|
360 | 360 | } |
361 | 361 | if (in_array($index_name, self::$fields['facets'])) { |
362 | 362 | // Add facets to index. |
363 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
363 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
364 | 364 | } |
365 | 365 | if (in_array($index_name, self::$fields['autocomplete'])) { |
366 | 366 | $autocomplete = array_merge($autocomplete, $data); |
@@ -385,14 +385,14 @@ discard block |
||
385 | 385 | } catch (\Exception $e) { |
386 | 386 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
387 | 387 | Helper::addMessage( |
388 | - Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
|
388 | + Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($e->getMessage()), |
|
389 | 389 | Helper::getLanguageService()->getLL('flash.error'), |
390 | 390 | FlashMessage::ERROR, |
391 | 391 | true, |
392 | 392 | 'core.template.flashMessages' |
393 | 393 | ); |
394 | 394 | } |
395 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
395 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
396 | 396 | return false; |
397 | 397 | } |
398 | 398 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $data = self::removeAppendsFromAuthor($data); |
459 | 459 | } |
460 | 460 | // Add facets to index. |
461 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
461 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
462 | 462 | } |
463 | 463 | } |
464 | 464 | } |
@@ -476,14 +476,14 @@ discard block |
||
476 | 476 | } catch (\Exception $e) { |
477 | 477 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
478 | 478 | Helper::addMessage( |
479 | - Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
|
479 | + Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($e->getMessage()), |
|
480 | 480 | Helper::getLanguageService()->getLL('flash.error'), |
481 | 481 | FlashMessage::ERROR, |
482 | 482 | true, |
483 | 483 | 'core.template.flashMessages' |
484 | 484 | ); |
485 | 485 | } |
486 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
486 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
487 | 487 | return false; |
488 | 488 | } |
489 | 489 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | private static function getSolrDocument($updateQuery, $document, $unit, $fullText = '') { |
535 | 535 | $solrDoc = $updateQuery->createDocument(); |
536 | 536 | // Create unique identifier from document's UID and unit's XML ID. |
537 | - $solrDoc->setField('id', $document->getUid() . $unit['id']); |
|
537 | + $solrDoc->setField('id', $document->getUid().$unit['id']); |
|
538 | 538 | $solrDoc->setField('uid', $document->getUid()); |
539 | 539 | $solrDoc->setField('pid', $document->getPid()); |
540 | 540 | $solrDoc->setField('partof', $document->getPartof()); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | // Add uHash parameter to suggest parameter to make a basic protection of this form. |
163 | 163 | if ($this->settings['suggest']) { |
164 | - $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()) . Environment::getExtensionsPath(), 'SearchSuggest')); |
|
164 | + $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()).Environment::getExtensionsPath(), 'SearchSuggest')); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | $this->view->assign('viewData', $this->viewData); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | // Get facets from plugin configuration. |
185 | 185 | $facets = []; |
186 | 186 | foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
187 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
187 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | $this->view->assign('facetsMenu', $this->makeFacetsMenuArray($facets)); |
@@ -226,13 +226,13 @@ discard block |
||
226 | 226 | $searchParams = $this->searchParams; |
227 | 227 | if ( |
228 | 228 | (!empty($searchParams['fulltext'])) |
229 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches) |
|
229 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches) |
|
230 | 230 | ) { |
231 | 231 | // If the query already is a fulltext query e.g using the facets |
232 | 232 | $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1]; |
233 | 233 | // Search in fulltext field if applicable. Query must not be empty! |
234 | 234 | if (!empty($this->searchParams['query'])) { |
235 | - $search['query'] = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')'; |
|
235 | + $search['query'] = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')'; |
|
236 | 236 | } |
237 | 237 | } else { |
238 | 238 | // Retain given search field if valid. |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | in_array($searchParams['extOperator'][$i], $allowedOperators) |
257 | 257 | ) { |
258 | 258 | if (!empty($search['query'])) { |
259 | - $search['query'] .= ' ' . $searchParams['extOperator'][$i] . ' '; |
|
259 | + $search['query'] .= ' '.$searchParams['extOperator'][$i].' '; |
|
260 | 260 | } |
261 | - $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')'; |
|
261 | + $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')'; |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | $entryArray['doNotLinkIt'] = 0; |
384 | 384 | // Check if facet is already selected. |
385 | 385 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
386 | - $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
|
386 | + $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn); |
|
387 | 387 | if ($index !== false) { |
388 | 388 | // Facet is selected, thus remove it from filter. |
389 | 389 | unset($queryColumn[$index]); |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | } |
398 | 398 | } else { |
399 | 399 | // Facet is not selected, thus add it to filter. |
400 | - $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")'; |
|
400 | + $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")'; |
|
401 | 401 | $entryArray['ITEM_STATE'] = 'NO'; |
402 | 402 | } |
403 | 403 | $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'])) { |
@@ -174,8 +169,7 @@ discard block |
||
174 | 169 | * |
175 | 170 | * @return string HTML output of facets menu |
176 | 171 | */ |
177 | - protected function addFacetsMenu() |
|
178 | - { |
|
172 | + protected function addFacetsMenu() { |
|
179 | 173 | // Quit without doing anything if no facets are configured. |
180 | 174 | if (empty($this->settings['facets']) && empty($this->settings['facetCollections'])) { |
181 | 175 | return ''; |
@@ -200,8 +194,7 @@ discard block |
||
200 | 194 | * |
201 | 195 | * @return array HMENU array |
202 | 196 | */ |
203 | - public function makeFacetsMenuArray($facets) |
|
204 | - { |
|
197 | + public function makeFacetsMenuArray($facets) { |
|
205 | 198 | $menuArray = []; |
206 | 199 | // Set default value for facet search. |
207 | 200 | $search = [ |
@@ -360,8 +353,7 @@ discard block |
||
360 | 353 | * |
361 | 354 | * @return array The array for the facet's menu entry |
362 | 355 | */ |
363 | - protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) |
|
364 | - { |
|
356 | + protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
365 | 357 | $entryArray = []; |
366 | 358 | // Translate value. |
367 | 359 | if ($field == 'owner_faceting') { |
@@ -412,8 +404,7 @@ discard block |
||
412 | 404 | * |
413 | 405 | * @return string The extended search form or an empty string |
414 | 406 | */ |
415 | - protected function addExtendedSearch() |
|
416 | - { |
|
407 | + protected function addExtendedSearch() { |
|
417 | 408 | // Quit without doing anything if no fields for extended search are selected. |
418 | 409 | if ( |
419 | 410 | empty($this->settings['extendedSlotCount']) |
@@ -5,10 +5,8 @@ |
||
5 | 5 | use Kitodo\Dlf\Common\Helper; |
6 | 6 | use TYPO3\TestingFramework\Core\Unit\UnitTestCase; |
7 | 7 | |
8 | -class HelperTest extends UnitTestCase |
|
9 | -{ |
|
10 | - public function assertInvalidXml($xml) |
|
11 | - { |
|
8 | +class HelperTest extends UnitTestCase { |
|
9 | + public function assertInvalidXml($xml) { |
|
12 | 10 | $result = Helper::getXmlFileAsString($xml); |
13 | 11 | $this->assertEquals(false, $result); |
14 | 12 | } |
@@ -15,10 +15,10 @@ |
||
15 | 15 | preg_match("@.*/(?:acceptance|functional-[a-z0-9]+)@", $_SERVER['REQUEST_URI'], $matches); |
16 | 16 | |
17 | 17 | if (!empty($matches)) { |
18 | - $root = realpath($_SERVER['DOCUMENT_ROOT'] . $matches[0]); |
|
18 | + $root = realpath($_SERVER['DOCUMENT_ROOT'].$matches[0]); |
|
19 | 19 | if ($root !== false) { |
20 | - putenv('TYPO3_PATH_ROOT=' . $root); |
|
21 | - putenv('TYPO3_PATH_APP=' . $root); |
|
20 | + putenv('TYPO3_PATH_ROOT='.$root); |
|
21 | + putenv('TYPO3_PATH_APP='.$root); |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
71 | 71 | |
72 | 72 | if ($this->disableJsonWrappedResponse) { |
73 | - $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function ($ext) { |
|
73 | + $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function($ext) { |
|
74 | 74 | return $ext !== 'Resources/Core/Functional/Extensions/json_response'; |
75 | 75 | }); |
76 | 76 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
84 | 84 | |
85 | - $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/'; |
|
85 | + $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-'.$this->identifier.'/'; |
|
86 | 86 | $this->httpClient = new HttpClient([ |
87 | 87 | 'base_uri' => $this->baseUrl, |
88 | 88 | 'http_errors' => false, |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function addSiteConfig($identifier, $baseUrl) |
128 | 128 | { |
129 | - $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
|
129 | + $siteConfig = Yaml::parseFile(__DIR__.'/../Fixtures/siteconfig.yaml'); |
|
130 | 130 | $siteConfig['base'] = $baseUrl; |
131 | 131 | $siteConfig['languages'][0]['base'] = $baseUrl; |
132 | 132 | |
133 | - $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier; |
|
133 | + $siteConfigPath = $this->instancePath.'/typo3conf/sites/'.$identifier; |
|
134 | 134 | @mkdir($siteConfigPath, 0775, true); |
135 | - file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
|
135 | + file_put_contents($siteConfigPath.'/config.yaml', Yaml::dump($siteConfig)); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | protected function initializeRepository(string $className, int $storagePid) |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | * Base class for functional test cases. This provides some common configuration |
13 | 13 | * and collects utility methods for functional tests. |
14 | 14 | */ |
15 | -class FunctionalTestCase extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase |
|
16 | -{ |
|
15 | +class FunctionalTestCase extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase { |
|
17 | 16 | protected $testExtensionsToLoad = [ |
18 | 17 | 'typo3conf/ext/dlf', |
19 | 18 | ]; |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | */ |
64 | 63 | protected $httpClient; |
65 | 64 | |
66 | - public function __construct() |
|
67 | - { |
|
65 | + public function __construct() { |
|
68 | 66 | parent::__construct(); |
69 | 67 | |
70 | 68 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
@@ -91,8 +89,7 @@ discard block |
||
91 | 89 | $this->addSiteConfig('dlf-testing', $this->baseUrl); |
92 | 90 | } |
93 | 91 | |
94 | - protected function getDlfConfiguration() |
|
95 | - { |
|
92 | + protected function getDlfConfiguration() { |
|
96 | 93 | return [ |
97 | 94 | 'solrFieldAutocomplete' => 'autocomplete', |
98 | 95 | 'solrFieldCollection' => 'collection', |
@@ -124,8 +121,7 @@ discard block |
||
124 | 121 | ]; |
125 | 122 | } |
126 | 123 | |
127 | - protected function addSiteConfig($identifier, $baseUrl) |
|
128 | - { |
|
124 | + protected function addSiteConfig($identifier, $baseUrl) { |
|
129 | 125 | $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
130 | 126 | $siteConfig['base'] = $baseUrl; |
131 | 127 | $siteConfig['languages'][0]['base'] = $baseUrl; |
@@ -135,8 +131,7 @@ discard block |
||
135 | 131 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
136 | 132 | } |
137 | 133 | |
138 | - protected function initializeRepository(string $className, int $storagePid) |
|
139 | - { |
|
134 | + protected function initializeRepository(string $className, int $storagePid) { |
|
140 | 135 | $repository = $this->objectManager->get($className); |
141 | 136 | |
142 | 137 | $querySettings = $this->objectManager->get(Typo3QuerySettings::class); |
@@ -77,7 +77,7 @@ |
||
77 | 77 | ]); |
78 | 78 | |
79 | 79 | $this->assertEquals(200, $response->getStatusCode()); |
80 | - $this->assertEquals('This is some plain text test file.' . "\n", (string) $response->getBody()); |
|
80 | + $this->assertEquals('This is some plain text test file.'."\n", (string) $response->getBody()); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -6,19 +6,16 @@ |
||
6 | 6 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
7 | 7 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
8 | 8 | |
9 | -class PageViewProxyTest extends FunctionalTestCase |
|
10 | -{ |
|
9 | +class PageViewProxyTest extends FunctionalTestCase { |
|
11 | 10 | protected $disableJsonWrappedResponse = true; |
12 | 11 | |
13 | - protected function getDlfConfiguration() |
|
14 | - { |
|
12 | + protected function getDlfConfiguration() { |
|
15 | 13 | return array_merge(parent::getDlfConfiguration(), [ |
16 | 14 | 'enableInternalProxy' => true, |
17 | 15 | ]); |
18 | 16 | } |
19 | 17 | |
20 | - protected function queryProxy(array $query, string $method = 'GET') |
|
21 | - { |
|
18 | + protected function queryProxy(array $query, string $method = 'GET') { |
|
22 | 19 | $query['eID'] = 'tx_dlf_pageview_proxy'; |
23 | 20 | |
24 | 21 | return $this->httpClient->request($method, '', [ |