@@ -181,18 +181,18 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | $navigationArray[$i]['next'] = [ |
184 | - 'tx_dlf[docPage][' . $i . ']' => |
|
184 | + 'tx_dlf[docPage]['.$i.']' => |
|
185 | 185 | MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] + 1, 1, $document->numPages, 1) |
186 | 186 | ]; |
187 | 187 | $navigationArray[$i]['prev'] = [ |
188 | - 'tx_dlf[docPage][' . $i . ']' => |
|
188 | + 'tx_dlf[docPage]['.$i.']' => |
|
189 | 189 | MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] - 1, 1, $document->numPages, 1) |
190 | 190 | ]; |
191 | 191 | |
192 | 192 | $navigateAllPageNext = array_merge( |
193 | 193 | $navigateAllPageNext, |
194 | 194 | [ |
195 | - 'tx_dlf[docPage][' . $i . ']' => |
|
195 | + 'tx_dlf[docPage]['.$i.']' => |
|
196 | 196 | MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] + 1, 1, $document->numPages, 1) |
197 | 197 | ] |
198 | 198 | ); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $navigateAllPagePrev = array_merge( |
201 | 201 | $navigateAllPagePrev, |
202 | 202 | [ |
203 | - 'tx_dlf[docPage][' . $i . ']' => |
|
203 | + 'tx_dlf[docPage]['.$i.']' => |
|
204 | 204 | MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] - 1, 1, $document->numPages, 1) |
205 | 205 | ] |
206 | 206 | ); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $navigateAllMeasureNext = array_merge( |
209 | 209 | $navigateAllMeasureNext, |
210 | 210 | [ |
211 | - 'tx_dlf[docMeasure][' . $i . ']' => |
|
211 | + 'tx_dlf[docMeasure]['.$i.']' => |
|
212 | 212 | MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] + 1, 1, $document->numMeasures, 1) |
213 | 213 | ] |
214 | 214 | ); |
@@ -216,19 +216,19 @@ discard block |
||
216 | 216 | $navigateAllMeasurePrev = array_merge( |
217 | 217 | $navigateAllMeasurePrev, |
218 | 218 | [ |
219 | - 'tx_dlf[docMeasure][' . $i . ']' => |
|
219 | + 'tx_dlf[docMeasure]['.$i.']' => |
|
220 | 220 | MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] - 1, 1, $document->numMeasures, 1) |
221 | 221 | ] |
222 | 222 | ); |
223 | 223 | |
224 | 224 | if ($document->numMeasures > 0) { |
225 | 225 | $navigationMeasureArray[$i]['next'] = [ |
226 | - 'tx_dlf[docMeasure][' . $i . ']' => |
|
226 | + 'tx_dlf[docMeasure]['.$i.']' => |
|
227 | 227 | MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] + 1, 1, $document->numMeasures, 1) |
228 | 228 | ]; |
229 | 229 | |
230 | 230 | $navigationMeasureArray[$i]['prev'] = [ |
231 | - 'tx_dlf[docMeasure][' . $i . ']' => |
|
231 | + 'tx_dlf[docMeasure]['.$i.']' => |
|
232 | 232 | MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] - 1, 1, $document->numMeasures, 1) |
233 | 233 | ]; |
234 | 234 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | } |
283 | 283 | $params = array_merge( |
284 | 284 | ['tx_dlf' => $this->requestData], |
285 | - ['tx_dlf[multipleSource][' . $nextMultipleSourceKey . ']' => $formAddDocument->getLocation()], |
|
285 | + ['tx_dlf[multipleSource]['.$nextMultipleSourceKey.']' => $formAddDocument->getLocation()], |
|
286 | 286 | ['tx_dlf[multiview]' => 1] |
287 | 287 | ); |
288 | 288 | $uriBuilder = $this->uriBuilder; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | // build link for each measure |
330 | 330 | $params = [ |
331 | 331 | 'tx_dlf' => $this->requestData, |
332 | - 'tx_dlf[docMeasure][' . $docNumber . ']' => $i |
|
332 | + 'tx_dlf[docMeasure]['.$docNumber.']' => $i |
|
333 | 333 | ]; |
334 | 334 | } else { |
335 | 335 | // build link for each measure |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | } |
414 | 414 | |
415 | 415 | if (empty($score)) { |
416 | - $this->logger->notice('No score file found for page "' . $page . '" in fileGrps "' . $this->settings['fileGrpScore'] . '"'); |
|
416 | + $this->logger->notice('No score file found for page "'.$page.'" in fileGrps "'.$this->settings['fileGrpScore'].'"'); |
|
417 | 417 | } |
418 | 418 | return $score; |
419 | 419 | } |
@@ -444,11 +444,11 @@ discard block |
||
444 | 444 | $fulltext['mimetype'] = $file['mimeType']; |
445 | 445 | break; |
446 | 446 | } else { |
447 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrp "' . $fileGrpFulltext . '"'); |
|
447 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrp "'.$fileGrpFulltext.'"'); |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | if (empty($fulltext)) { |
451 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrps "' . $this->extConf['files']['fileGrpFulltext'] . '"'); |
|
451 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrps "'.$this->extConf['files']['fileGrpFulltext'].'"'); |
|
452 | 452 | } |
453 | 453 | return $fulltext; |
454 | 454 | } |
@@ -493,19 +493,19 @@ discard block |
||
493 | 493 | $currentMeasureId = $docMeasures['measureCounterToMeasureId'][$this->requestData['docMeasure'][$i]]; |
494 | 494 | } |
495 | 495 | |
496 | - $jsViewer .= 'tx_dlf_viewer[' . $i . '] = new dlfViewer({ |
|
497 | - controls: ["' . implode('", "', $this->controls) . '"], |
|
498 | - div: "tx-dfgviewer-map-' . $i . '", |
|
499 | - progressElementId: "' . $this->settings['progressElementId'] . '", |
|
500 | - counter: "' . $i . '", |
|
501 | - images: ' . json_encode($docImage) . ', |
|
502 | - fulltexts: ' . json_encode($docFulltext) . ', |
|
503 | - score: ' . json_encode($docScore) . ', |
|
504 | - annotationContainers: ' . json_encode($docAnnotationContainers) . ', |
|
505 | - measureCoords: ' . json_encode($docMeasures['measureCoordsCurrentSite']) . ', |
|
506 | - useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0) . ', |
|
507 | - currentMeasureId: "' . $currentMeasureId . '", |
|
508 | - measureIdLinks: ' . json_encode($docMeasures['measureLinks']) . ' |
|
496 | + $jsViewer .= 'tx_dlf_viewer['.$i.'] = new dlfViewer({ |
|
497 | + controls: ["' . implode('", "', $this->controls).'"], |
|
498 | + div: "tx-dfgviewer-map-' . $i.'", |
|
499 | + progressElementId: "' . $this->settings['progressElementId'].'", |
|
500 | + counter: "' . $i.'", |
|
501 | + images: ' . json_encode($docImage).', |
|
502 | + fulltexts: ' . json_encode($docFulltext).', |
|
503 | + score: ' . json_encode($docScore).', |
|
504 | + annotationContainers: ' . json_encode($docAnnotationContainers).', |
|
505 | + measureCoords: ' . json_encode($docMeasures['measureCoordsCurrentSite']).', |
|
506 | + useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0).', |
|
507 | + currentMeasureId: "' . $currentMeasureId.'", |
|
508 | + measureIdLinks: ' . json_encode($docMeasures['measureLinks']).' |
|
509 | 509 | }); |
510 | 510 | '; |
511 | 511 | $i++; |
@@ -515,8 +515,8 @@ discard block |
||
515 | 515 | // Viewer configuration. |
516 | 516 | $viewerConfiguration = '$(document).ready(function() { |
517 | 517 | if (dlfUtils.exists(dlfViewer)) { |
518 | - ' . $jsViewer . ' |
|
519 | - viewerCount = ' . ($i - 1) . '; |
|
518 | + ' . $jsViewer.' |
|
519 | + viewerCount = ' . ($i - 1).'; |
|
520 | 520 | } |
521 | 521 | });'; |
522 | 522 | } else { |
@@ -532,18 +532,18 @@ discard block |
||
532 | 532 | $viewerConfiguration = '$(document).ready(function() { |
533 | 533 | if (dlfUtils.exists(dlfViewer)) { |
534 | 534 | tx_dlf_viewer = new dlfViewer({ |
535 | - controls: ["' . implode('", "', $this->controls) . '"], |
|
536 | - div: "' . $this->settings['elementId'] . '", |
|
537 | - progressElementId: "' . $this->settings['progressElementId'] . '", |
|
538 | - images: ' . json_encode($this->images) . ', |
|
539 | - fulltexts: ' . json_encode($this->fulltexts) . ', |
|
540 | - score: ' . json_encode($this->scores) . ', |
|
541 | - annotationContainers: ' . json_encode($this->annotationContainers) . ', |
|
542 | - measureCoords: ' . json_encode($docMeasures['measureCoordsCurrentSite']) . ', |
|
543 | - useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0) . ', |
|
544 | - verovioAnnotations: ' . json_encode($this->verovioAnnotations) . ', |
|
545 | - currentMeasureId: "' . $currentMeasureId . '", |
|
546 | - measureIdLinks: ' . json_encode($docMeasures['measureLinks']) . ' |
|
535 | + controls: ["' . implode('", "', $this->controls).'"], |
|
536 | + div: "' . $this->settings['elementId'].'", |
|
537 | + progressElementId: "' . $this->settings['progressElementId'].'", |
|
538 | + images: ' . json_encode($this->images).', |
|
539 | + fulltexts: ' . json_encode($this->fulltexts).', |
|
540 | + score: ' . json_encode($this->scores).', |
|
541 | + annotationContainers: ' . json_encode($this->annotationContainers).', |
|
542 | + measureCoords: ' . json_encode($docMeasures['measureCoordsCurrentSite']).', |
|
543 | + useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0).', |
|
544 | + verovioAnnotations: ' . json_encode($this->verovioAnnotations).', |
|
545 | + currentMeasureId: "' . $currentMeasureId.'", |
|
546 | + measureIdLinks: ' . json_encode($docMeasures['measureLinks']).' |
|
547 | 547 | }); |
548 | 548 | } |
549 | 549 | });'; |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | } |
641 | 641 | break; |
642 | 642 | } else { |
643 | - $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"'); |
|
643 | + $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"'); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | } else { |
@@ -660,12 +660,12 @@ discard block |
||
660 | 660 | } |
661 | 661 | break; |
662 | 662 | } else { |
663 | - $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"'); |
|
663 | + $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"'); |
|
664 | 664 | } |
665 | 665 | } |
666 | 666 | } |
667 | 667 | if (empty($image)) { |
668 | - $this->logger->warning('No image file found for page "' . $page . '" in fileGrps "' . $this->extConf['files']['fileGrpImages'] . '"'); |
|
668 | + $this->logger->warning('No image file found for page "'.$page.'" in fileGrps "'.$this->extConf['files']['fileGrpImages'].'"'); |
|
669 | 669 | } |
670 | 670 | return $image; |
671 | 671 | } |
@@ -30,8 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @access public |
32 | 32 | */ |
33 | -class PageViewController extends AbstractController |
|
34 | -{ |
|
33 | +class PageViewController extends AbstractController { |
|
35 | 34 | /** |
36 | 35 | * @access protected |
37 | 36 | * @var array Holds the controls to add to the map |
@@ -256,8 +255,7 @@ discard block |
||
256 | 255 | * @param $page |
257 | 256 | * @return false|int|mixed|string|null |
258 | 257 | */ |
259 | - public function convertMeasureOrPage($document, $measure = null, $page = null) |
|
260 | - { |
|
258 | + public function convertMeasureOrPage($document, $measure = null, $page = null) { |
|
261 | 259 | $return = null; |
262 | 260 | $measure2Page = array_column($document->musicalStructure, 'page'); |
263 | 261 | if ($measure) { |
@@ -273,8 +271,7 @@ discard block |
||
273 | 271 | * Action to add multiple mets sources (multi page view) |
274 | 272 | * @return void |
275 | 273 | */ |
276 | - public function addDocumentAction(FormAddDocument $formAddDocument) |
|
277 | - { |
|
274 | + public function addDocumentAction(FormAddDocument $formAddDocument) { |
|
278 | 275 | if (GeneralUtility::isValidUrl($formAddDocument->getLocation())) { |
279 | 276 | $nextMultipleSourceKey = 0; |
280 | 277 | if ($this->requestData['multipleSource']) { |
@@ -367,8 +364,7 @@ discard block |
||
367 | 364 | * |
368 | 365 | * @return array URL and MIME type of fulltext file |
369 | 366 | */ |
370 | - protected function getScore(int $page, MetsDocument $specificDoc = null) |
|
371 | - { |
|
367 | + protected function getScore(int $page, MetsDocument $specificDoc = null) { |
|
372 | 368 | $score = []; |
373 | 369 | $loc = ''; |
374 | 370 | if ($specificDoc) { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | // convert either page or measure if requestData exists |
175 | 175 | if ($this->requestData['docPage'][$i] && empty($this->requestData['docMeasure'][$i])) { |
176 | 176 | // convert document page information to measure count information |
177 | - $this->requestData['docMeasure'][$i] = $this->convertMeasureOrPage($document, null, $this->requestData['docPage'][$i]); |
|
177 | + $this->requestData['docMeasure'][$i] = $this->convertMeasureOrPage($document, NULL, $this->requestData['docPage'][$i]); |
|
178 | 178 | |
179 | 179 | } elseif ((empty($this->requestData['docPage'][$i]) || $this->requestData['docPage'][$i] === 1) && $this->requestData['docMeasure'][$i]) { |
180 | 180 | $this->requestData['docPage'][$i] = $this->convertMeasureOrPage($document, $this->requestData['docMeasure'][$i]); |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | * @param $page |
257 | 257 | * @return false|int|mixed|string|null |
258 | 258 | */ |
259 | - public function convertMeasureOrPage($document, $measure = null, $page = null) |
|
259 | + public function convertMeasureOrPage($document, $measure = NULL, $page = NULL) |
|
260 | 260 | { |
261 | - $return = null; |
|
261 | + $return = NULL; |
|
262 | 262 | $measure2Page = array_column($document->musicalStructure, 'page'); |
263 | 263 | if ($measure) { |
264 | 264 | $return = $measure2Page[$measure]; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @param int|null $docNumber |
304 | 304 | * @return array |
305 | 305 | */ |
306 | - protected function getMeasures(int $page, MetsDocument $specificDoc = null, $docNumber = null): array |
|
306 | + protected function getMeasures(int $page, MetsDocument $specificDoc = NULL, $docNumber = NULL): array |
|
307 | 307 | { |
308 | 308 | if ($specificDoc) { |
309 | 309 | $doc = $specificDoc; |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | * |
368 | 368 | * @return array URL and MIME type of fulltext file |
369 | 369 | */ |
370 | - protected function getScore(int $page, MetsDocument $specificDoc = null) |
|
370 | + protected function getScore(int $page, MetsDocument $specificDoc = NULL) |
|
371 | 371 | { |
372 | 372 | $score = []; |
373 | 373 | $loc = ''; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | // Configure @action URL for form. |
398 | 398 | $uri = $this->uriBuilder->reset() |
399 | 399 | ->setTargetPageUid($this->pageUid) |
400 | - ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? true : false) |
|
400 | + ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE) |
|
401 | 401 | ->setArguments( |
402 | 402 | [ |
403 | 403 | 'eID' => 'tx_dlf_pageview_proxy', |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $jsViewer = 'tx_dlf_viewer = [];'; |
467 | 467 | $i = 0; |
468 | 468 | foreach ($this->documentArray as $document) { |
469 | - if ($document !== null) { |
|
469 | + if ($document !== NULL) { |
|
470 | 470 | $docPage = $this->requestData['docPage'][$i]; |
471 | 471 | $docImage = []; |
472 | 472 | $docFulltext = []; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | $docPage = $measure2Page[$this->requestData['docMeasure'][$i]]; |
481 | 481 | } |
482 | 482 | } |
483 | - if ($docPage == null) { |
|
483 | + if ($docPage == NULL) { |
|
484 | 484 | $docPage = 1; |
485 | 485 | } |
486 | 486 | $docImage[0] = $this->getImage($docPage, $document); |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | if ($iiif instanceof ManifestInterface) { |
568 | 568 | $canvas = $iiif->getContainedResourceById($canvasId); |
569 | 569 | /* @var $canvas \Ubl\Iiif\Presentation\Common\Model\Resources\CanvasInterface */ |
570 | - if ($canvas != null && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
570 | + if ($canvas != NULL && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
571 | 571 | $annotationContainers = []; |
572 | 572 | /* |
573 | 573 | * TODO Analyzing the annotations on the server side requires loading the annotation lists / pages |
@@ -577,11 +577,11 @@ discard block |
||
577 | 577 | * On the other hand, server connections are potentially better than client connections. Downloading annotation lists |
578 | 578 | */ |
579 | 579 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
580 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
580 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
581 | 581 | foreach ($textAnnotations as $annotation) { |
582 | 582 | if ( |
583 | 583 | $annotation->getBody()->getFormat() == 'text/plain' |
584 | - && $annotation->getBody()->getChars() != null |
|
584 | + && $annotation->getBody()->getChars() != NULL |
|
585 | 585 | ) { |
586 | 586 | $annotationListData = []; |
587 | 587 | $annotationListData['uri'] = $annotationContainer->getId(); |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | * |
619 | 619 | * @return array URL and MIME type of image file |
620 | 620 | */ |
621 | - protected function getImage(int $page, MetsDocument $specificDoc = null): array |
|
621 | + protected function getImage(int $page, MetsDocument $specificDoc = NULL): array |
|
622 | 622 | { |
623 | 623 | $image = []; |
624 | 624 | // Get @USE value of METS fileGrp. |
@@ -21,15 +21,13 @@ |
||
21 | 21 | * @subpackage dlf |
22 | 22 | * @access public |
23 | 23 | */ |
24 | -class AnnotationController extends AbstractController |
|
25 | -{ |
|
24 | +class AnnotationController extends AbstractController { |
|
26 | 25 | /** |
27 | 26 | * The main method of the plugin |
28 | 27 | * |
29 | 28 | * @return void |
30 | 29 | */ |
31 | - public function mainAction() |
|
32 | - { |
|
30 | + public function mainAction() { |
|
33 | 31 | $this->loadDocument(); |
34 | 32 | |
35 | 33 | if ( |
@@ -33,8 +33,8 @@ |
||
33 | 33 | $this->loadDocument(); |
34 | 34 | |
35 | 35 | if ( |
36 | - $this->document === null |
|
37 | - || $this->document->getCurrentDocument() === null |
|
36 | + $this->document === NULL |
|
37 | + || $this->document->getCurrentDocument() === NULL |
|
38 | 38 | ) { |
39 | 39 | // Quit without doing anything if required variables are not set. |
40 | 40 | return; |
@@ -18,10 +18,8 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Checks if the given subject is an array. |
20 | 20 | */ |
21 | -class IsArrayViewHelper extends AbstractViewHelper |
|
22 | -{ |
|
23 | - public function initializeArguments() |
|
24 | - { |
|
21 | +class IsArrayViewHelper extends AbstractViewHelper { |
|
22 | + public function initializeArguments() { |
|
25 | 23 | parent::initializeArguments(); |
26 | 24 | $this->registerArgument('subject', 'string', 'The subject'); |
27 | 25 | } |
@@ -29,8 +27,7 @@ discard block |
||
29 | 27 | /** |
30 | 28 | * @return bool |
31 | 29 | */ |
32 | - public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) |
|
33 | - { |
|
30 | + public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { |
|
34 | 31 | $subject = $arguments['subject']; |
35 | 32 | if ($subject === null) { |
36 | 33 | $subject = $renderChildrenClosure(); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) |
33 | 33 | { |
34 | 34 | $subject = $arguments['subject']; |
35 | - if ($subject === null) { |
|
35 | + if ($subject === NULL) { |
|
36 | 36 | $subject = $renderChildrenClosure(); |
37 | 37 | } |
38 | 38 |
@@ -13,10 +13,8 @@ discard block |
||
13 | 13 | |
14 | 14 | use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; |
15 | 15 | |
16 | -class IsInArrayViewHelper extends AbstractViewHelper |
|
17 | -{ |
|
18 | - public function initializeArguments() |
|
19 | - { |
|
16 | +class IsInArrayViewHelper extends AbstractViewHelper { |
|
17 | + public function initializeArguments() { |
|
20 | 18 | parent::initializeArguments(); |
21 | 19 | $this->registerArgument('needle', 'mixed', 'The searched value', true); |
22 | 20 | $this->registerArgument('haystack', 'array', 'The array', true); |
@@ -27,8 +25,7 @@ discard block |
||
27 | 25 | * |
28 | 26 | * @return bool |
29 | 27 | */ |
30 | - public function render() |
|
31 | - { |
|
28 | + public function render() { |
|
32 | 29 | $needle = $this->arguments['needle']; |
33 | 30 | $haystack = $this->arguments['haystack']; |
34 | 31 |
@@ -18,8 +18,8 @@ |
||
18 | 18 | public function initializeArguments() |
19 | 19 | { |
20 | 20 | parent::initializeArguments(); |
21 | - $this->registerArgument('needle', 'mixed', 'The searched value', true); |
|
22 | - $this->registerArgument('haystack', 'array', 'The array', true); |
|
21 | + $this->registerArgument('needle', 'mixed', 'The searched value', TRUE); |
|
22 | + $this->registerArgument('haystack', 'array', 'The array', TRUE); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -13,10 +13,8 @@ discard block |
||
13 | 13 | |
14 | 14 | use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; |
15 | 15 | |
16 | -class ImplodeViewHelper extends AbstractViewHelper |
|
17 | -{ |
|
18 | - public function initializeArguments() |
|
19 | - { |
|
16 | +class ImplodeViewHelper extends AbstractViewHelper { |
|
17 | + public function initializeArguments() { |
|
20 | 18 | parent::initializeArguments(); |
21 | 19 | $this->registerArgument('value', 'array', 'The array to be imploded', true); |
22 | 20 | $this->registerArgument('delimiter', 'string', 'The delimiter ', true); |
@@ -27,8 +25,7 @@ discard block |
||
27 | 25 | * |
28 | 26 | * @return string |
29 | 27 | */ |
30 | - public function render() |
|
31 | - { |
|
28 | + public function render() { |
|
32 | 29 | $value = $this->arguments['value']; |
33 | 30 | $delimiter = $this->arguments['delimiter']; |
34 | 31 |
@@ -18,8 +18,8 @@ |
||
18 | 18 | public function initializeArguments() |
19 | 19 | { |
20 | 20 | parent::initializeArguments(); |
21 | - $this->registerArgument('value', 'array', 'The array to be imploded', true); |
|
22 | - $this->registerArgument('delimiter', 'string', 'The delimiter ', true); |
|
21 | + $this->registerArgument('value', 'array', 'The array to be imploded', TRUE); |
|
22 | + $this->registerArgument('delimiter', 'string', 'The delimiter ', TRUE); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct($apiUrl) |
26 | 26 | { |
27 | - $this->apiUrl = trim($apiUrl, "/ "); |
|
27 | + $this->apiUrl = trim($apiUrl, "/ "); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | $annotations = []; |
61 | 61 | |
62 | - $annotationData = $this->requestAnnotions($this->apiUrl . '?target=' . urlencode($id . '/*')); |
|
62 | + $annotationData = $this->requestAnnotions($this->apiUrl.'?target='.urlencode($id.'/*')); |
|
63 | 63 | |
64 | 64 | if (array_key_exists('first', $annotationData)) { |
65 | 65 | $annotationPageData = $annotationData['first']; |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | * LICENSE.txt file that was distributed with this source code. |
13 | 13 | */ |
14 | 14 | |
15 | -class AnnotationRequest |
|
16 | -{ |
|
15 | +class AnnotationRequest { |
|
17 | 16 | /** |
18 | 17 | * @var string |
19 | 18 | */ |
@@ -22,8 +21,7 @@ discard block |
||
22 | 21 | /** |
23 | 22 | * @param string $apiUrl The url of the annotation server api. |
24 | 23 | */ |
25 | - public function __construct($apiUrl) |
|
26 | - { |
|
24 | + public function __construct($apiUrl) { |
|
27 | 25 | $this->apiUrl = trim($apiUrl, "/ "); |
28 | 26 | } |
29 | 27 | |
@@ -55,8 +53,7 @@ discard block |
||
55 | 53 | * @param string $id Document id (purl) |
56 | 54 | * @return array |
57 | 55 | */ |
58 | - public function getAll($id) |
|
59 | - { |
|
56 | + public function getAll($id) { |
|
60 | 57 | $annotations = []; |
61 | 58 | |
62 | 59 | $annotationData = $this->requestAnnotions($this->apiUrl . '?target=' . urlencode($id . '/*')); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $jsonld = Helper::getUrl($url); |
40 | 40 | |
41 | 41 | if ($jsonld) { |
42 | - $annotationData = json_decode($jsonld, true); |
|
42 | + $annotationData = json_decode($jsonld, TRUE); |
|
43 | 43 | |
44 | 44 | if ($annotationData) { |
45 | 45 | return $annotationData; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | { |
231 | 231 | $file = $this->getFileInfo($id); |
232 | 232 | if ($file['mimeType'] === 'application/vnd.kitodo.iiif') { |
233 | - $file['location'] = (strrpos($file['location'], 'info.json') === strlen($file['location']) - 9) ? $file['location'] : (strrpos($file['location'], '/') === strlen($file['location']) ? $file['location'] . 'info.json' : $file['location'] . '/info.json'); |
|
233 | + $file['location'] = (strrpos($file['location'], 'info.json') === strlen($file['location']) - 9) ? $file['location'] : (strrpos($file['location'], '/') === strlen($file['location']) ? $file['location'].'info.json' : $file['location'].'/info.json'); |
|
234 | 234 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'iiif'); |
235 | 235 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
236 | 236 | IiifHelper::setMaxThumbnailHeight($conf['thumbnailHeight']); |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | return $service->getImageUrl(); |
241 | 241 | } |
242 | 242 | } elseif ($file['mimeType'] === 'application/vnd.netfpx') { |
243 | - $baseURL = $file['location'] . (strpos($file['location'], '?') === false ? '?' : ''); |
|
243 | + $baseURL = $file['location'].(strpos($file['location'], '?') === false ? '?' : ''); |
|
244 | 244 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
245 | - return $baseURL . '&CVT=jpeg'; |
|
245 | + return $baseURL.'&CVT=jpeg'; |
|
246 | 246 | } |
247 | 247 | return $file['location']; |
248 | 248 | } |
@@ -271,14 +271,14 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function getFileLocation(string $id): string |
273 | 273 | { |
274 | - $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
274 | + $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
275 | 275 | if ( |
276 | 276 | !empty($id) |
277 | 277 | && !empty($location) |
278 | 278 | ) { |
279 | 279 | return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
280 | 280 | } else { |
281 | - $this->logger->warning('There is no file node with @ID "' . $id . '"'); |
|
281 | + $this->logger->warning('There is no file node with @ID "'.$id.'"'); |
|
282 | 282 | return ''; |
283 | 283 | } |
284 | 284 | } |
@@ -290,9 +290,9 @@ discard block |
||
290 | 290 | { |
291 | 291 | $mets = $this->mets |
292 | 292 | ->xpath( |
293 | - './mets:structMap[@TYPE="PHYSICAL"]' . |
|
294 | - '//mets:div[@ID="' . $pageId . '"]' . |
|
295 | - '/mets:fptr[@FILEID="' . $fileId . '"]' . |
|
293 | + './mets:structMap[@TYPE="PHYSICAL"]'. |
|
294 | + '//mets:div[@ID="'.$pageId.'"]'. |
|
295 | + '/mets:fptr[@FILEID="'.$fileId.'"]'. |
|
296 | 296 | '/mets:area/@BEGIN' |
297 | 297 | ); |
298 | 298 | return empty($mets) ? '' : $mets[0]->__toString(); |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function getFileMimeType(string $id): string |
306 | 306 | { |
307 | - $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
|
307 | + $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'); |
|
308 | 308 | if ( |
309 | 309 | !empty($id) |
310 | 310 | && !empty($mimetype) |
311 | 311 | ) { |
312 | 312 | return (string) $mimetype[0]; |
313 | 313 | } else { |
314 | - $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified'); |
|
314 | + $this->logger->warning('There is no file node with @ID "'.$id.'" or no MIME type specified'); |
|
315 | 315 | return ''; |
316 | 316 | } |
317 | 317 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | return $this->logicalUnits[$id]; |
332 | 332 | } elseif (!empty($id)) { |
333 | 333 | // Get specified logical unit. |
334 | - $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]'); |
|
334 | + $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]'); |
|
335 | 335 | } else { |
336 | 336 | // Get all logical units at top level. |
337 | 337 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $cPid = max($cPid, 0); |
547 | 547 | if ($cPid == 0 && ($this->cPid || $this->pid)) { |
548 | 548 | // Retain current PID. |
549 | - $cPid = $this->cPid ?: $this->pid; |
|
549 | + $cPid = $this->cPid ? : $this->pid; |
|
550 | 550 | } |
551 | 551 | return $cPid; |
552 | 552 | } |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | if (isset($this->fileInfos[$id]) || in_array('dmdSec', $metadataSections)) { |
614 | 614 | return $metadata; |
615 | 615 | } else { |
616 | - $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "' . $id . '"'); |
|
616 | + $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "'.$id.'"'); |
|
617 | 617 | return []; |
618 | 618 | } |
619 | 619 | } |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | if (!empty($this->logicalUnits[$id])) { |
693 | 693 | return [$this->logicalUnits[$id]['type']]; |
694 | 694 | } else { |
695 | - $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE'); |
|
695 | + $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
|
696 | 696 | if (!empty($struct)) { |
697 | 697 | return [(string) $struct[0]]; |
698 | 698 | } |
@@ -849,17 +849,17 @@ discard block |
||
849 | 849 | if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting'])) { |
850 | 850 | $values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode); |
851 | 851 | if ($values instanceof DOMNodeList && $values->length > 0) { |
852 | - $metadata[$indexName . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
852 | + $metadata[$indexName.'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
853 | 853 | } elseif (!($values instanceof DOMNodeList)) { |
854 | - $metadata[$indexName . '_sorting'][0] = trim((string) $values); |
|
854 | + $metadata[$indexName.'_sorting'][0] = trim((string) $values); |
|
855 | 855 | } |
856 | 856 | } |
857 | - if (empty($metadata[$indexName . '_sorting'][0])) { |
|
857 | + if (empty($metadata[$indexName.'_sorting'][0])) { |
|
858 | 858 | if (is_array($currentMetadata)) { |
859 | 859 | $sortingValue = implode(',', array_column($currentMetadata, 0)); |
860 | - $metadata[$indexName . '_sorting'][0] = $sortingValue; |
|
860 | + $metadata[$indexName.'_sorting'][0] = $sortingValue; |
|
861 | 861 | } else { |
862 | - $metadata[$indexName . '_sorting'][0] = $currentMetadata; |
|
862 | + $metadata[$indexName.'_sorting'][0] = $currentMetadata; |
|
863 | 863 | } |
864 | 864 | } |
865 | 865 | } |
@@ -920,11 +920,11 @@ discard block |
||
920 | 920 | return true; |
921 | 921 | } |
922 | 922 | } else { |
923 | - $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"'); |
|
923 | + $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->mdSec[$dmdId]['type'].'"'); |
|
924 | 924 | } |
925 | 925 | } |
926 | 926 | } else { |
927 | - $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"'); |
|
927 | + $this->logger->notice('Unsupported metadata format "'.$this->mdSec[$dmdId]['type'].'" in '.$mdSectionType.' with @ID "'.$dmdId.'"'); |
|
928 | 928 | } |
929 | 929 | return false; |
930 | 930 | } |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | $dmdIds = $this->logicalUnits[$id]['dmdId'] ?? ''; |
1078 | 1078 | $admIds = $this->logicalUnits[$id]['admId'] ?? ''; |
1079 | 1079 | } else { |
1080 | - $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]')[0]; |
|
1080 | + $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]')[0]; |
|
1081 | 1081 | if ($mdSec) { |
1082 | 1082 | $dmdIds = (string) $mdSec->attributes()->DMDID; |
1083 | 1083 | $admIds = (string) $mdSec->attributes()->ADMID; |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | return array_filter( |
1109 | 1109 | $allMdIds, |
1110 | - function ($element) { |
|
1110 | + function($element) { |
|
1111 | 1111 | return !empty($element); |
1112 | 1112 | } |
1113 | 1113 | ); |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | */ |
1134 | 1134 | public function getStructureDepth(string $logId) |
1135 | 1135 | { |
1136 | - $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
|
1136 | + $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'); |
|
1137 | 1137 | if (!empty($ancestors)) { |
1138 | 1138 | return count($ancestors); |
1139 | 1139 | } else { |
@@ -1157,9 +1157,9 @@ discard block |
||
1157 | 1157 | $this->registerNamespaces($this->mets); |
1158 | 1158 | } else { |
1159 | 1159 | if (!empty($location)) { |
1160 | - $this->logger->error('No METS part found in document with location "' . $location . '".'); |
|
1160 | + $this->logger->error('No METS part found in document with location "'.$location.'".'); |
|
1161 | 1161 | } elseif (!empty($this->recordId)) { |
1162 | - $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".'); |
|
1162 | + $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".'); |
|
1163 | 1163 | } else { |
1164 | 1164 | $this->logger->error('No METS part found in current document.'); |
1165 | 1165 | } |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | return true; |
1181 | 1181 | } |
1182 | 1182 | } |
1183 | - $this->logger->error('Could not load XML file from "' . $location . '"'); |
|
1183 | + $this->logger->error('Could not load XML file from "'.$location.'"'); |
|
1184 | 1184 | return false; |
1185 | 1185 | } |
1186 | 1186 | |
@@ -1303,10 +1303,10 @@ discard block |
||
1303 | 1303 | |
1304 | 1304 | if (!empty($mdType) && !empty($this->formats[(string) $mdType[0]])) { |
1305 | 1305 | $type = (string) $mdType[0]; |
1306 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
1306 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
1307 | 1307 | } elseif (!empty($otherMdType) && !empty($this->formats[(string) $otherMdType[0]])) { |
1308 | 1308 | $type = (string) $otherMdType[0]; |
1309 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
1309 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
1310 | 1310 | } |
1311 | 1311 | |
1312 | 1312 | if (empty($xml)) { |
@@ -1513,7 +1513,7 @@ discard block |
||
1513 | 1513 | // Get track info wtih begin end extent time for later assignment with musical |
1514 | 1514 | if ((string) $elementNode['TYPE'] === 'track') { |
1515 | 1515 | foreach ($elementNode->children('http://www.loc.gov/METS/')->fptr as $fptr) { |
1516 | - if (isset($fptr->area) && ((string) $fptr->area->attributes()->BETYPE === 'TIME')) { |
|
1516 | + if (isset($fptr->area) && ((string) $fptr->area->attributes()->BETYPE === 'TIME')) { |
|
1517 | 1517 | // Check if file has valid @USE attribute. |
1518 | 1518 | if (!empty($fileUse[(string) $fptr->area->attributes()->FILEID])) { |
1519 | 1519 | $this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['tracks'][$fileUse[(string) $fptr->area->attributes()->FILEID]] = [ |
@@ -1567,9 +1567,9 @@ discard block |
||
1567 | 1567 | || $forceReload |
1568 | 1568 | ) { |
1569 | 1569 | // Retain current PID. |
1570 | - $cPid = $this->cPid ?: $this->pid; |
|
1570 | + $cPid = $this->cPid ? : $this->pid; |
|
1571 | 1571 | if (!$cPid) { |
1572 | - $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
|
1572 | + $this->logger->error('Invalid PID '.$cPid.' for structure definitions'); |
|
1573 | 1573 | $this->thumbnailLoaded = true; |
1574 | 1574 | return $this->thumbnail; |
1575 | 1575 | } |
@@ -1606,7 +1606,7 @@ discard block |
||
1606 | 1606 | if (!empty($resArray['thumbnail'])) { |
1607 | 1607 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid); |
1608 | 1608 | // Check if this document has a structure element of the desired type. |
1609 | - $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
|
1609 | + $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID'); |
|
1610 | 1610 | if (!empty($strctIds)) { |
1611 | 1611 | $strctId = (string) $strctIds[0]; |
1612 | 1612 | } |
@@ -1629,7 +1629,7 @@ discard block |
||
1629 | 1629 | } |
1630 | 1630 | } |
1631 | 1631 | } else { |
1632 | - $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
|
1632 | + $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database'); |
|
1633 | 1633 | } |
1634 | 1634 | $this->thumbnailLoaded = true; |
1635 | 1635 | } |
@@ -1675,7 +1675,7 @@ discard block |
||
1675 | 1675 | { |
1676 | 1676 | if (empty($this->parentHref)) { |
1677 | 1677 | // Get the closest ancestor of the current document which has a MPTR child. |
1678 | - $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
1678 | + $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->toplevelId.'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
1679 | 1679 | if (!empty($parentMptr)) { |
1680 | 1680 | $this->parentHref = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
1681 | 1681 | } |
@@ -72,8 +72,7 @@ discard block |
||
72 | 72 | * @property-read SimpleXMLElement $mets this holds the XML file's METS part as SimpleXMLElement object |
73 | 73 | * @property-read string $parentHref URL of the parent document (determined via mptr element), or empty string if none is available |
74 | 74 | */ |
75 | -final class MetsDocument extends AbstractDocument |
|
76 | -{ |
|
75 | +final class MetsDocument extends AbstractDocument { |
|
77 | 76 | /** |
78 | 77 | * @access protected |
79 | 78 | * @var string[] Subsections / tags that may occur within `<mets:amdSec>` |
@@ -286,8 +285,7 @@ discard block |
||
286 | 285 | /** |
287 | 286 | * This gets the measure beginning of a page |
288 | 287 | */ |
289 | - public function getPageBeginning($pageId, $fileId) |
|
290 | - { |
|
288 | + public function getPageBeginning($pageId, $fileId) { |
|
291 | 289 | $mets = $this->mets |
292 | 290 | ->xpath( |
293 | 291 | './mets:structMap[@TYPE="PHYSICAL"]' . |
@@ -482,8 +480,7 @@ discard block |
||
482 | 480 | * |
483 | 481 | * @return ?string thumbnail or null if not found |
484 | 482 | */ |
485 | - private function getThumbnail(string $id = '') |
|
486 | - { |
|
483 | + private function getThumbnail(string $id = '') { |
|
487 | 484 | // Load plugin configuration. |
488 | 485 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files'); |
489 | 486 | $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']); |
@@ -624,8 +621,7 @@ discard block |
||
624 | 621 | * @param DOMNode $parentNode |
625 | 622 | * @return array|false |
626 | 623 | */ |
627 | - private function getSubentries($allSubentries, string $parentIndex, DOMNode $parentNode) |
|
628 | - { |
|
624 | + private function getSubentries($allSubentries, string $parentIndex, DOMNode $parentNode) { |
|
629 | 625 | $domXPath = new DOMXPath($parentNode->ownerDocument); |
630 | 626 | $this->registerNamespaces($domXPath); |
631 | 627 | $theseSubentries = []; |
@@ -655,8 +651,7 @@ discard block |
||
655 | 651 | * @param $subentry |
656 | 652 | * @return array |
657 | 653 | */ |
658 | - private function getSubentryValue($values, $subentry) |
|
659 | - { |
|
654 | + private function getSubentryValue($values, $subentry) { |
|
660 | 655 | $theseSubentries = []; |
661 | 656 | if ( |
662 | 657 | ($values instanceof DOMNodeList |
@@ -906,8 +901,7 @@ discard block |
||
906 | 901 | * |
907 | 902 | * @return bool true if extraction successful, false otherwise |
908 | 903 | */ |
909 | - private function extractMetadataIfTypeSupported(string $dmdId, string $mdSectionType, array &$metadata) |
|
910 | - { |
|
904 | + private function extractMetadataIfTypeSupported(string $dmdId, string $mdSectionType, array &$metadata) { |
|
911 | 905 | // Is this metadata format supported? |
912 | 906 | if (!empty($this->formats[$this->mdSec[$dmdId]['type']])) { |
913 | 907 | if (!empty($this->formats[$this->mdSec[$dmdId]['type']]['class'])) { |
@@ -939,8 +933,7 @@ discard block |
||
939 | 933 | * |
940 | 934 | * @return array additional metadata data queried from database |
941 | 935 | */ |
942 | - private function getAdditionalMetadataFromDatabase(int $cPid, string $dmdId) |
|
943 | - { |
|
936 | + private function getAdditionalMetadataFromDatabase(int $cPid, string $dmdId) { |
|
944 | 937 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
945 | 938 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
946 | 939 | // Get hidden records, too. |
@@ -1131,8 +1124,7 @@ discard block |
||
1131 | 1124 | /** |
1132 | 1125 | * @see AbstractDocument::getStructureDepth() |
1133 | 1126 | */ |
1134 | - public function getStructureDepth(string $logId) |
|
1135 | - { |
|
1127 | + public function getStructureDepth(string $logId) { |
|
1136 | 1128 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
1137 | 1129 | if (!empty($ancestors)) { |
1138 | 1130 | return count($ancestors); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @see MetsDocument::$mdSec |
111 | 111 | */ |
112 | - protected bool $mdSecLoaded = false; |
|
112 | + protected bool $mdSecLoaded = FALSE; |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * @access protected |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @see $fileGrps |
133 | 133 | */ |
134 | - protected bool $fileGrpsLoaded = false; |
|
134 | + protected bool $fileGrpsLoaded = FALSE; |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * @access protected |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @var bool |
175 | 175 | * @access protected |
176 | 176 | */ |
177 | - protected bool $musicalStructureLoaded = false; |
|
177 | + protected bool $musicalStructureLoaded = FALSE; |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * The holds the total number of measures |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | return $service->getImageUrl(); |
241 | 241 | } |
242 | 242 | } elseif ($file['mimeType'] === 'application/vnd.netfpx') { |
243 | - $baseURL = $file['location'] . (strpos($file['location'], '?') === false ? '?' : ''); |
|
243 | + $baseURL = $file['location'] . (strpos($file['location'], '?') === FALSE ? '?' : ''); |
|
244 | 244 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
245 | 245 | return $baseURL . '&CVT=jpeg'; |
246 | 246 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $this->fileInfos[$id]['mimeType'] = $this->getFileMimeType($id); |
264 | 264 | } |
265 | 265 | |
266 | - return $this->fileInfos[$id] ?? null; |
|
266 | + return $this->fileInfos[$id] ?? NULL; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | /** |
320 | 320 | * @see AbstractDocument::getLogicalStructure() |
321 | 321 | */ |
322 | - public function getLogicalStructure(string $id, bool $recursive = false): array |
|
322 | + public function getLogicalStructure(string $id, bool $recursive = FALSE): array |
|
323 | 323 | { |
324 | 324 | $details = []; |
325 | 325 | // Is the requested logical unit already loaded? |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * |
361 | 361 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
362 | 362 | */ |
363 | - protected function getLogicalStructureInfo(SimpleXMLElement $structure, bool $recursive = false): array |
|
363 | + protected function getLogicalStructureInfo(SimpleXMLElement $structure, bool $recursive = FALSE): array |
|
364 | 364 | { |
365 | 365 | $attributes = $structure->attributes(); |
366 | 366 | |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | 'pagination' => '', |
379 | 379 | 'type' => isset($attributes['TYPE']) ? (string) $attributes['TYPE'] : '', |
380 | 380 | 'description' => '', |
381 | - 'thumbnailId' => null, |
|
381 | + 'thumbnailId' => NULL, |
|
382 | 382 | 'files' => [], |
383 | 383 | ]; |
384 | 384 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $details['children'] = []; |
414 | 414 | foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) { |
415 | 415 | // Repeat for all children. |
416 | - $details['children'][] = $this->getLogicalStructureInfo($child, true); |
|
416 | + $details['children'][] = $this->getLogicalStructureInfo($child, TRUE); |
|
417 | 417 | } |
418 | 418 | } |
419 | 419 | return $details; |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | && array_key_exists($details['id'], $this->smLinks['l2p']) |
460 | 460 | ) { |
461 | 461 | // Link logical structure to the first corresponding physical page/track. |
462 | - $details['points'] = max((int) array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, true), 1); |
|
462 | + $details['points'] = max((int) array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE), 1); |
|
463 | 463 | $details['thumbnailId'] = $this->getThumbnail(); |
464 | 464 | // Get page/track number of the first page/track related to this structure element. |
465 | 465 | $details['pagination'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['orderlabel']; |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $details['points'] = 1; |
469 | 469 | $details['thumbnailId'] = $this->getThumbnail(); |
470 | 470 | } |
471 | - if ($details['thumbnailId'] === null) { |
|
471 | + if ($details['thumbnailId'] === NULL) { |
|
472 | 472 | unset($details['thumbnailId']); |
473 | 473 | } |
474 | 474 | } |
@@ -488,14 +488,14 @@ discard block |
||
488 | 488 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files'); |
489 | 489 | $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']); |
490 | 490 | |
491 | - $thumbnail = null; |
|
491 | + $thumbnail = NULL; |
|
492 | 492 | |
493 | 493 | while ($fileGrpThumb = array_shift($fileGrpsThumb)) { |
494 | 494 | if (empty($id)) { |
495 | - $thumbnail = $this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$fileGrpThumb] ?? null; |
|
495 | + $thumbnail = $this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$fileGrpThumb] ?? NULL; |
|
496 | 496 | } else { |
497 | - $parentId = $this->smLinks['l2p'][$id][0] ?? null; |
|
498 | - $thumbnail = $this->physicalStructureInfo[$parentId]['files'][$fileGrpThumb] ?? null; |
|
497 | + $parentId = $this->smLinks['l2p'][$id][0] ?? NULL; |
|
498 | + $thumbnail = $this->physicalStructureInfo[$parentId]['files'][$fileGrpThumb] ?? NULL; |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | if (!empty($thumbnail)) { |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | } |
646 | 646 | } |
647 | 647 | if (empty($theseSubentries)) { |
648 | - return false; |
|
648 | + return FALSE; |
|
649 | 649 | } |
650 | 650 | return $theseSubentries; |
651 | 651 | } |
@@ -716,13 +716,13 @@ discard block |
||
716 | 716 | private function extractAndProcessMetadata(string $dmdId, string $mdSectionType, array &$metadata, int $cPid, array $metadataSections): bool |
717 | 717 | { |
718 | 718 | if ($this->hasMetadataSection($metadataSections, $mdSectionType, 'dmdSec')) { |
719 | - return true; |
|
719 | + return TRUE; |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | $metadataExtracted = $this->extractMetadataIfTypeSupported($dmdId, $mdSectionType, $metadata); |
723 | 723 | |
724 | 724 | if (!$metadataExtracted) { |
725 | - return false; |
|
725 | + return FALSE; |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | $additionalMetadata = $this->getAdditionalMetadataFromDatabase($cPid, $dmdId); |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | |
734 | 734 | $this->processAdditionalMetadata($additionalMetadata, $domXPath, $domNode, $metadata); |
735 | 735 | |
736 | - return true; |
|
736 | + return TRUE; |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | /** |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | $obj = GeneralUtility::makeInstance($class); |
918 | 918 | if ($obj instanceof MetadataInterface) { |
919 | 919 | $obj->extractMetadata($this->mdSec[$dmdId]['xml'], $metadata, GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'general')['useExternalApisForMetadata']); |
920 | - return true; |
|
920 | + return TRUE; |
|
921 | 921 | } |
922 | 922 | } else { |
923 | 923 | $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"'); |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | } else { |
927 | 927 | $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"'); |
928 | 928 | } |
929 | - return false; |
|
929 | + return FALSE; |
|
930 | 930 | } |
931 | 931 | |
932 | 932 | /** |
@@ -1172,16 +1172,16 @@ discard block |
||
1172 | 1172 | protected function loadLocation(string $location): bool |
1173 | 1173 | { |
1174 | 1174 | $fileResource = Helper::getUrl($location); |
1175 | - if ($fileResource !== false) { |
|
1175 | + if ($fileResource !== FALSE) { |
|
1176 | 1176 | $xml = Helper::getXmlFileAsString($fileResource); |
1177 | 1177 | // Set some basic properties. |
1178 | - if ($xml !== false) { |
|
1178 | + if ($xml !== FALSE) { |
|
1179 | 1179 | $this->xml = $xml; |
1180 | - return true; |
|
1180 | + return TRUE; |
|
1181 | 1181 | } |
1182 | 1182 | } |
1183 | 1183 | $this->logger->error('Could not load XML file from "' . $location . '"'); |
1184 | - return false; |
|
1184 | + return FALSE; |
|
1185 | 1185 | } |
1186 | 1186 | |
1187 | 1187 | /** |
@@ -1203,9 +1203,9 @@ discard block |
||
1203 | 1203 | |
1204 | 1204 | if ($preloadedDocument instanceof SimpleXMLElement) { |
1205 | 1205 | $this->xml = $preloadedDocument; |
1206 | - return true; |
|
1206 | + return TRUE; |
|
1207 | 1207 | } |
1208 | - return false; |
|
1208 | + return FALSE; |
|
1209 | 1209 | } |
1210 | 1210 | |
1211 | 1211 | /** |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | foreach ($this->mets->xpath('./mets:dmdSec') as $dmdSecTag) { |
1232 | 1232 | $dmdSec = $this->processMdSec($dmdSecTag); |
1233 | 1233 | |
1234 | - if ($dmdSec !== null) { |
|
1234 | + if ($dmdSec !== NULL) { |
|
1235 | 1235 | $this->mdSec[$dmdSec['id']] = $dmdSec; |
1236 | 1236 | $this->dmdSec[$dmdSec['id']] = $dmdSec; |
1237 | 1237 | } |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | // TODO: Should we check that the format may occur within this type (e.g., to ignore VIDEOMD within rightsMD)? |
1249 | 1249 | $mdSec = $this->processMdSec($mdSecTag); |
1250 | 1250 | |
1251 | - if ($mdSec !== null) { |
|
1251 | + if ($mdSec !== NULL) { |
|
1252 | 1252 | $this->mdSec[$mdSec['id']] = $mdSec; |
1253 | 1253 | |
1254 | 1254 | $childIds[] = $mdSec['id']; |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | } |
1262 | 1262 | } |
1263 | 1263 | |
1264 | - $this->mdSecLoaded = true; |
|
1264 | + $this->mdSecLoaded = TRUE; |
|
1265 | 1265 | } |
1266 | 1266 | return $this->mdSec; |
1267 | 1267 | } |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | { |
1293 | 1293 | $mdId = (string) $element->attributes()->ID; |
1294 | 1294 | if (empty($mdId)) { |
1295 | - return null; |
|
1295 | + return NULL; |
|
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | $this->registerNamespaces($element); |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | } |
1311 | 1311 | |
1312 | 1312 | if (empty($xml)) { |
1313 | - return null; |
|
1313 | + return NULL; |
|
1314 | 1314 | } |
1315 | 1315 | |
1316 | 1316 | $this->registerNamespaces($xml[0]); |
@@ -1376,9 +1376,9 @@ discard block |
||
1376 | 1376 | !empty($extConf['fileGrpFulltext']) |
1377 | 1377 | && array_intersect(GeneralUtility::trimExplode(',', $extConf['fileGrpFulltext']), $this->fileGrps) !== [] |
1378 | 1378 | ) { |
1379 | - $this->hasFulltext = true; |
|
1379 | + $this->hasFulltext = TRUE; |
|
1380 | 1380 | } |
1381 | - $this->fileGrpsLoaded = true; |
|
1381 | + $this->fileGrpsLoaded = TRUE; |
|
1382 | 1382 | } |
1383 | 1383 | return $this->fileGrps; |
1384 | 1384 | } |
@@ -1439,7 +1439,7 @@ discard block |
||
1439 | 1439 | |
1440 | 1440 | $this->physicalStructure = $this->getPhysicalElements($elementNodes, $fileUse); |
1441 | 1441 | } |
1442 | - $this->physicalStructureLoaded = true; |
|
1442 | + $this->physicalStructureLoaded = TRUE; |
|
1443 | 1443 | |
1444 | 1444 | } |
1445 | 1445 | |
@@ -1552,7 +1552,7 @@ discard block |
||
1552 | 1552 | $this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from; |
1553 | 1553 | } |
1554 | 1554 | } |
1555 | - $this->smLinksLoaded = true; |
|
1555 | + $this->smLinksLoaded = TRUE; |
|
1556 | 1556 | } |
1557 | 1557 | return $this->smLinks; |
1558 | 1558 | } |
@@ -1560,7 +1560,7 @@ discard block |
||
1560 | 1560 | /** |
1561 | 1561 | * @see AbstractDocument::magicGetThumbnail() |
1562 | 1562 | */ |
1563 | - protected function magicGetThumbnail(bool $forceReload = false): string |
|
1563 | + protected function magicGetThumbnail(bool $forceReload = FALSE): string |
|
1564 | 1564 | { |
1565 | 1565 | if ( |
1566 | 1566 | !$this->thumbnailLoaded |
@@ -1570,14 +1570,14 @@ discard block |
||
1570 | 1570 | $cPid = $this->cPid ?: $this->pid; |
1571 | 1571 | if (!$cPid) { |
1572 | 1572 | $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
1573 | - $this->thumbnailLoaded = true; |
|
1573 | + $this->thumbnailLoaded = TRUE; |
|
1574 | 1574 | return $this->thumbnail; |
1575 | 1575 | } |
1576 | 1576 | // Load extension configuration. |
1577 | 1577 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files'); |
1578 | 1578 | if (empty($extConf['fileGrpThumbs'])) { |
1579 | 1579 | $this->logger->warning('No fileGrp for thumbnails specified'); |
1580 | - $this->thumbnailLoaded = true; |
|
1580 | + $this->thumbnailLoaded = TRUE; |
|
1581 | 1581 | return $this->thumbnail; |
1582 | 1582 | } |
1583 | 1583 | $strctId = $this->magicGetToplevelId(); |
@@ -1631,7 +1631,7 @@ discard block |
||
1631 | 1631 | } else { |
1632 | 1632 | $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
1633 | 1633 | } |
1634 | - $this->thumbnailLoaded = true; |
|
1634 | + $this->thumbnailLoaded = TRUE; |
|
1635 | 1635 | } |
1636 | 1636 | return $this->thumbnail; |
1637 | 1637 | } |
@@ -1709,8 +1709,8 @@ discard block |
||
1709 | 1709 | public function __toString(): string |
1710 | 1710 | { |
1711 | 1711 | $xml = new DOMDocument('1.0', 'utf-8'); |
1712 | - $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
|
1713 | - $xml->formatOutput = true; |
|
1712 | + $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE)); |
|
1713 | + $xml->formatOutput = TRUE; |
|
1714 | 1714 | return $xml->saveXML(); |
1715 | 1715 | } |
1716 | 1716 | |
@@ -1725,7 +1725,7 @@ discard block |
||
1725 | 1725 | public function __wakeup(): void |
1726 | 1726 | { |
1727 | 1727 | $xml = Helper::getXmlFileAsString($this->asXML); |
1728 | - if ($xml !== false) { |
|
1728 | + if ($xml !== FALSE) { |
|
1729 | 1729 | $this->asXML = ''; |
1730 | 1730 | $this->xml = $xml; |
1731 | 1731 | // Rebuild the unserializable properties. |
@@ -1848,7 +1848,7 @@ discard block |
||
1848 | 1848 | } |
1849 | 1849 | |
1850 | 1850 | } |
1851 | - $this->musicalStructureLoaded = true; |
|
1851 | + $this->musicalStructureLoaded = TRUE; |
|
1852 | 1852 | } |
1853 | 1853 | |
1854 | 1854 | return $this->musicalStructure; |
@@ -130,11 +130,11 @@ |
||
130 | 130 | ); |
131 | 131 | } |
132 | 132 | } elseif ($annotationTarget->getObjectId()) { |
133 | - $objectTargetPages = []; |
|
133 | + $objectTargetPages = []; |
|
134 | 134 | foreach ($this->document->getCurrentDocument()->physicalStructureInfo as $physInfo) { |
135 | - $order = $physInfo['order']; |
|
135 | + $order = $physInfo['order']; |
|
136 | 136 | if ($order) { |
137 | - $objectTargetPages[] = $order; |
|
137 | + $objectTargetPages[] = $order; |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | if ($objectTargetPages) { |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | ]; |
109 | 109 | } else { |
110 | 110 | $this->logger->warning( |
111 | - ' No target pages found! Annotation: "' . $annotation->getId() . '", ' |
|
112 | - . 'Target: "' . $annotationTarget->getUrl() . '"' |
|
111 | + ' No target pages found! Annotation: "'.$annotation->getId().'", ' |
|
112 | + . 'Target: "'.$annotationTarget->getUrl().'"' |
|
113 | 113 | ); |
114 | 114 | } |
115 | 115 | } |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | ]; |
126 | 126 | } else { |
127 | 127 | $this->logger->warning( |
128 | - ' No target pages found! Annotation: "' . $annotation->getId() . '", ' |
|
129 | - . 'Target: "' . $annotationTarget->getUrl() . '"' |
|
128 | + ' No target pages found! Annotation: "'.$annotation->getId().'", ' |
|
129 | + . 'Target: "'.$annotationTarget->getUrl().'"' |
|
130 | 130 | ); |
131 | 131 | } |
132 | 132 | } elseif ($annotationTarget->getObjectId()) { |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | } |
146 | 146 | } else { |
147 | 147 | $this->logger->warning( |
148 | - ' No target pages found! Annotation: "' . $annotation->getId() . '", ' |
|
149 | - . 'Target: "' . $annotationTarget->getUrl() . '"' |
|
148 | + ' No target pages found! Annotation: "'.$annotation->getId().'", ' |
|
149 | + . 'Target: "'.$annotationTarget->getUrl().'"' |
|
150 | 150 | ); |
151 | 151 | } |
152 | 152 | } else { |
153 | 153 | $this->logger->warning( |
154 | - 'Invalid target! Annotation: "' . $annotation->getId() . '", ' |
|
155 | - . 'Target: "' . $annotationTarget->getUrl() . '"' |
|
154 | + 'Invalid target! Annotation: "'.$annotation->getId().'", ' |
|
155 | + . 'Target: "'.$annotationTarget->getUrl().'"' |
|
156 | 156 | ); |
157 | 157 | } |
158 | 158 | } |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | $intervalTo = \DateTime::createFromFormat('U.u', $to); |
268 | 268 | } |
269 | 269 | foreach ($tracks as $index => $track) { |
270 | - $begin = new DateTime("1970-01-01 " . $track['begin']); |
|
271 | - $extent = new DateTime("1970-01-01 " . $track['extent']); |
|
270 | + $begin = new DateTime("1970-01-01 ".$track['begin']); |
|
271 | + $extent = new DateTime("1970-01-01 ".$track['extent']); |
|
272 | 272 | $diff = (new DateTime("1970-01-01 00:00:00"))->diff($extent); |
273 | - $end = (new DateTime("1970-01-01 " . $track['begin']))->add($diff); |
|
273 | + $end = (new DateTime("1970-01-01 ".$track['begin']))->add($diff); |
|
274 | 274 | if ( |
275 | 275 | !( |
276 | 276 | $intervalFrom < $end && ( |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @access public |
30 | 30 | */ |
31 | -class DocumentAnnotation |
|
32 | -{ |
|
31 | +class DocumentAnnotation { |
|
33 | 32 | /** |
34 | 33 | * @var null|DocumentAnnotation |
35 | 34 | */ |
@@ -55,8 +54,7 @@ discard block |
||
55 | 54 | * @param array $annotationData |
56 | 55 | * @param Document $document |
57 | 56 | */ |
58 | - private function __construct($annotationData, $document) |
|
59 | - { |
|
57 | + private function __construct($annotationData, $document) { |
|
60 | 58 | $this->annotationData = $annotationData; |
61 | 59 | $this->document = $document; |
62 | 60 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
@@ -67,8 +65,7 @@ discard block |
||
67 | 65 | * |
68 | 66 | * @return Annotation[]|array |
69 | 67 | */ |
70 | - public function getAnnotations() |
|
71 | - { |
|
68 | + public function getAnnotations() { |
|
72 | 69 | if (empty($this->annotationData)) { |
73 | 70 | return []; |
74 | 71 | } |
@@ -168,8 +165,7 @@ discard block |
||
168 | 165 | * @param string $logicalId |
169 | 166 | * @return array |
170 | 167 | */ |
171 | - protected function getPagesByLogicalId($logicalId) |
|
172 | - { |
|
168 | + protected function getPagesByLogicalId($logicalId) { |
|
173 | 169 | $pages = []; |
174 | 170 | if ( |
175 | 171 | array_key_exists('l2p', $this->document->getCurrentDocument()->smLinks) && |
@@ -193,8 +189,7 @@ discard block |
||
193 | 189 | * @param string $physicalId |
194 | 190 | * @return array |
195 | 191 | */ |
196 | - protected function getPagesByPhysicalId($physicalId) |
|
197 | - { |
|
192 | + protected function getPagesByPhysicalId($physicalId) { |
|
198 | 193 | $pages = []; |
199 | 194 | foreach ($this->document->getCurrentDocument()->physicalStructureInfo as $physicalInfo) { |
200 | 195 | $order = $physicalInfo['order']; |
@@ -217,8 +212,7 @@ discard block |
||
217 | 212 | * @param string $fileId |
218 | 213 | * @return array |
219 | 214 | */ |
220 | - protected function getPagesByFileId($fileId) |
|
221 | - { |
|
215 | + protected function getPagesByFileId($fileId) { |
|
222 | 216 | $pages = []; |
223 | 217 | foreach ($this->document->getCurrentDocument()->physicalStructureInfo as $physicalInfo) { |
224 | 218 | if ( |
@@ -243,8 +237,7 @@ discard block |
||
243 | 237 | * @param string $range |
244 | 238 | * @return array |
245 | 239 | */ |
246 | - protected function getAudioPagesByFileId($fileId, $range = null) |
|
247 | - { |
|
240 | + protected function getAudioPagesByFileId($fileId, $range = null) { |
|
248 | 241 | $tracks = []; |
249 | 242 | foreach ($this->document->getCurrentDocument()->physicalStructureInfo as $physicalInfo) { |
250 | 243 | if (array_key_exists('tracks', $physicalInfo) && is_array($physicalInfo['tracks'])) { |
@@ -299,8 +292,7 @@ discard block |
||
299 | 292 | * @param string $range |
300 | 293 | * @return array |
301 | 294 | */ |
302 | - protected function getMeasurePagesByFileId($fileId, $range = null) |
|
303 | - { |
|
295 | + protected function getMeasurePagesByFileId($fileId, $range = null) { |
|
304 | 296 | // Get all measures referencing the fileid |
305 | 297 | $measures = []; |
306 | 298 | // Get the related page numbers |
@@ -355,8 +347,7 @@ discard block |
||
355 | 347 | * |
356 | 348 | * @return array |
357 | 349 | */ |
358 | - public function getVerovioRelevantAnnotations() |
|
359 | - { |
|
350 | + public function getVerovioRelevantAnnotations() { |
|
360 | 351 | $annotations = []; |
361 | 352 | /** @var Annotation $annotation */ |
362 | 353 | foreach ($this->getAnnotations() as $annotation) { |
@@ -373,8 +364,7 @@ discard block |
||
373 | 364 | * @param Document $document |
374 | 365 | * @return array |
375 | 366 | */ |
376 | - protected static function loadData($document) |
|
377 | - { |
|
367 | + protected static function loadData($document) { |
|
378 | 368 | $annotationData = []; |
379 | 369 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('dlf'); |
380 | 370 | $apiBaseUrl = $conf['annotationServerUrl']; |
@@ -393,8 +383,7 @@ discard block |
||
393 | 383 | * @return DocumentAnnotation|null |
394 | 384 | * |
395 | 385 | */ |
396 | - public static function getInstance($document) |
|
397 | - { |
|
386 | + public static function getInstance($document) { |
|
398 | 387 | if (self::$instance == null) { |
399 | 388 | $annotationData = self::loadData($document); |
400 | 389 | self::$instance = new DocumentAnnotation($annotationData, $document); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $targetPages[] = [ |
91 | 91 | 'target' => $annotationTarget, |
92 | 92 | 'pages' => $meiTargetPages, |
93 | - 'verovioRelevant' => true |
|
93 | + 'verovioRelevant' => TRUE |
|
94 | 94 | ]; |
95 | 95 | } elseif ( |
96 | 96 | $audioTargetPages = $this->getAudioPagesByFileId( |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @param string $range |
244 | 244 | * @return array |
245 | 245 | */ |
246 | - protected function getAudioPagesByFileId($fileId, $range = null) |
|
246 | + protected function getAudioPagesByFileId($fileId, $range = NULL) |
|
247 | 247 | { |
248 | 248 | $tracks = []; |
249 | 249 | foreach ($this->document->getCurrentDocument()->physicalStructureInfo as $physicalInfo) { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $from = sprintf('%02.6f', (empty($from) ? "0" : $from)); |
262 | 262 | $intervalFrom = \DateTime::createFromFormat('U.u', $from); |
263 | 263 | if (empty($to)) { |
264 | - $intervalTo = null; |
|
264 | + $intervalTo = NULL; |
|
265 | 265 | } else { |
266 | 266 | $to = sprintf('%02.6f', $to); |
267 | 267 | $intervalTo = \DateTime::createFromFormat('U.u', $to); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | if ( |
275 | 275 | !( |
276 | 276 | $intervalFrom < $end && ( |
277 | - $intervalTo === null || $intervalTo > $begin |
|
277 | + $intervalTo === NULL || $intervalTo > $begin |
|
278 | 278 | ) |
279 | 279 | ) |
280 | 280 | ) { |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | // Get the related page numbers |
286 | 286 | $trackPages = []; |
287 | 287 | foreach ($tracks as $track) { |
288 | - if ($track['order'] !== null) { |
|
288 | + if ($track['order'] !== NULL) { |
|
289 | 289 | $trackPages[] = $track['order']; |
290 | 290 | } |
291 | 291 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param string $range |
300 | 300 | * @return array |
301 | 301 | */ |
302 | - protected function getMeasurePagesByFileId($fileId, $range = null) |
|
302 | + protected function getMeasurePagesByFileId($fileId, $range = NULL) |
|
303 | 303 | { |
304 | 304 | // Get all measures referencing the fileid |
305 | 305 | $measures = []; |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | */ |
396 | 396 | public static function getInstance($document) |
397 | 397 | { |
398 | - if (self::$instance == null) { |
|
398 | + if (self::$instance == NULL) { |
|
399 | 399 | $annotationData = self::loadData($document); |
400 | 400 | self::$instance = new DocumentAnnotation($annotationData, $document); |
401 | 401 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_metadata.wrap', |
88 | 88 | 'config' => [ |
89 | 89 | 'behaviour' => [ |
90 | - 'allowLanguageSynchronization' => true |
|
90 | + 'allowLanguageSynchronization' => TRUE |
|
91 | 91 | ], |
92 | 92 | 'type' => 'text', |
93 | 93 | 'cols' => 48, |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | 'wrap' => 'off', |
96 | 96 | 'eval' => 'trim', |
97 | 97 | 'default' => "key.wrap = <strong>|:</strong>\nvalue.required = 1\nvalue.wrap = <span>|</span>\nall.wrap = <li>|</li>", |
98 | - 'fixedFont' => true, |
|
99 | - 'enableTabulator' => true |
|
98 | + 'fixedFont' => TRUE, |
|
99 | + 'enableTabulator' => TRUE |
|
100 | 100 | ], |
101 | 101 | ], |
102 | 102 | ], |