@@ -396,7 +396,7 @@ |
||
| 396 | 396 | $GLOBALS['LANG']->getLL('update.documentSetFormatForOldEntriesOkay', TRUE), |
| 397 | 397 | $GLOBALS['LANG']->getLL('update.documentSetFormatForOldEntries', TRUE), |
| 398 | 398 | \TYPO3\CMS\Core\Messaging\FlashMessage::OK |
| 399 | - ); |
|
| 399 | + ); |
|
| 400 | 400 | } else { |
| 401 | 401 | Helper::addMessage( |
| 402 | 402 | $GLOBALS['LANG']->getLL('update.documentSetFormatForOldEntriesNotOkay', TRUE), |
@@ -364,10 +364,10 @@ |
||
| 364 | 364 | ); |
| 365 | 365 | while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
| 366 | 366 | if ($resArray['COLUMN_NAME'] == 'document_format') { |
| 367 | - return false; |
|
| 367 | + return FALSE; |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | - return true; |
|
| 370 | + return TRUE; |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | protected function updateDocumentAddFormat() { |
@@ -14,19 +14,19 @@ discard block |
||
| 14 | 14 | } |
| 15 | 15 | // Define constants. |
| 16 | 16 | if (!defined('DEVLOG_SEVERITY_OK')) { |
| 17 | - define ('DEVLOG_SEVERITY_OK', -1); |
|
| 17 | + define('DEVLOG_SEVERITY_OK', -1); |
|
| 18 | 18 | } |
| 19 | 19 | if (!defined('DEVLOG_SEVERITY_INFO')) { |
| 20 | - define ('DEVLOG_SEVERITY_INFO', 0); |
|
| 20 | + define('DEVLOG_SEVERITY_INFO', 0); |
|
| 21 | 21 | } |
| 22 | 22 | if (!defined('DEVLOG_SEVERITY_NOTICE')) { |
| 23 | - define ('DEVLOG_SEVERITY_NOTICE', 1); |
|
| 23 | + define('DEVLOG_SEVERITY_NOTICE', 1); |
|
| 24 | 24 | } |
| 25 | 25 | if (!defined('DEVLOG_SEVERITY_WARNING')) { |
| 26 | - define ('DEVLOG_SEVERITY_WARNING', 2); |
|
| 26 | + define('DEVLOG_SEVERITY_WARNING', 2); |
|
| 27 | 27 | } |
| 28 | 28 | if (!defined('DEVLOG_SEVERITY_ERROR')) { |
| 29 | - define ('DEVLOG_SEVERITY_ERROR', 3); |
|
| 29 | + define('DEVLOG_SEVERITY_ERROR', 3); |
|
| 30 | 30 | } |
| 31 | 31 | // Register plugins. |
| 32 | 32 | \Kitodo\Dlf\Hooks\ExtensionManagementUtility::addPItoST43($_EXTKEY, \Kitodo\Dlf\Plugin\AudioPlayer::class, '_audioplayer', 'list_type', TRUE); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Common/MetsDocument.php']['hookClass'][] = \Kitodo\Dlf\Hooks\KitodoProductionHacks::class; |
| 64 | 64 | // Register command line scripts. |
| 65 | 65 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys'][$_EXTKEY] = [ |
| 66 | - function () { |
|
| 66 | + function() { |
|
| 67 | 67 | $SOBE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Kitodo\Dlf\Cli\CommandLineIndexer::class); |
| 68 | 68 | $SOBE->main(); |
| 69 | 69 | }, |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | /* @var $xml \SimpleXMLElement */ |
| 463 | 463 | $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/'); |
| 464 | 464 | $xpathResult = $xml->xpath('//mets:mets'); |
| 465 | - $documentFormat = ($xpathResult !== false && count($xpathResult)>0) ? 'METS' : null; |
|
| 465 | + $documentFormat = ($xpathResult !== false && count($xpathResult) > 0) ? 'METS' : null; |
|
| 466 | 466 | } else { |
| 467 | 467 | // Try to load file as IIIF resource instead. |
| 468 | 468 | $contentAsJsonArray = json_decode($content, true); |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | return $depth; |
| 721 | 721 | } elseif (array_key_exists('children', $element)) { |
| 722 | 722 | $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId); |
| 723 | - if ($foundInChildren!==false) { |
|
| 723 | + if ($foundInChildren !== false) { |
|
| 724 | 724 | return $foundInChildren; |
| 725 | 725 | } |
| 726 | 726 | } |
@@ -411,9 +411,9 @@ discard block |
||
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | // Create new instance depending on format (METS or IIIF) ... |
| 414 | - $documentFormat = null; |
|
| 415 | - $xml = null; |
|
| 416 | - $iiif = null; |
|
| 414 | + $documentFormat = NULL; |
|
| 415 | + $xml = NULL; |
|
| 416 | + $iiif = NULL; |
|
| 417 | 417 | // Try to get document format from database |
| 418 | 418 | if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($uid)) { |
| 419 | 419 | $whereClause = 'tx_dlf_documents.uid='.intval($uid).Helper::whereClause('tx_dlf_documents'); |
@@ -458,15 +458,15 @@ discard block |
||
| 458 | 458 | libxml_disable_entity_loader($previousValueOfEntityLoader); |
| 459 | 459 | // Reset libxml's error logging. |
| 460 | 460 | libxml_use_internal_errors($libxmlErrors); |
| 461 | - if ($xml !== false) { |
|
| 461 | + if ($xml !== FALSE) { |
|
| 462 | 462 | /* @var $xml \SimpleXMLElement */ |
| 463 | 463 | $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/'); |
| 464 | 464 | $xpathResult = $xml->xpath('//mets:mets'); |
| 465 | - $documentFormat = ($xpathResult !== false && count($xpathResult)>0) ? 'METS' : null; |
|
| 465 | + $documentFormat = ($xpathResult !== FALSE && count($xpathResult)>0) ? 'METS' : NULL; |
|
| 466 | 466 | } else { |
| 467 | 467 | // Try to load file as IIIF resource instead. |
| 468 | - $contentAsJsonArray = json_decode($content, true); |
|
| 469 | - if ($contentAsJsonArray !== null) { |
|
| 468 | + $contentAsJsonArray = json_decode($content, TRUE); |
|
| 469 | + if ($contentAsJsonArray !== NULL) { |
|
| 470 | 470 | // Load plugin configuration. |
| 471 | 471 | $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 472 | 472 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
@@ -720,12 +720,12 @@ discard block |
||
| 720 | 720 | return $depth; |
| 721 | 721 | } elseif (array_key_exists('children', $element)) { |
| 722 | 722 | $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId); |
| 723 | - if ($foundInChildren!==false) { |
|
| 723 | + if ($foundInChildren!==FALSE) { |
|
| 724 | 724 | return $foundInChildren; |
| 725 | 725 | } |
| 726 | 726 | } |
| 727 | 727 | } |
| 728 | - return false; |
|
| 728 | + return FALSE; |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | /** |
@@ -580,18 +580,18 @@ |
||
| 580 | 580 | return $original; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | - /** |
|
| 584 | - * Process a data and/or command map with TYPO3 core engine as admin. |
|
| 585 | - * |
|
| 586 | - * @access public |
|
| 587 | - * |
|
| 588 | - * @param array $data: Data map |
|
| 589 | - * @param array $cmd: Command map |
|
| 590 | - * @param boolean $reverseOrder: Should the data map be reversed? |
|
| 591 | - * @param boolean $cmdFirst: Should the command map be processed first? |
|
| 592 | - * |
|
| 593 | - * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
|
| 594 | - */ |
|
| 583 | + /** |
|
| 584 | + * Process a data and/or command map with TYPO3 core engine as admin. |
|
| 585 | + * |
|
| 586 | + * @access public |
|
| 587 | + * |
|
| 588 | + * @param array $data: Data map |
|
| 589 | + * @param array $cmd: Command map |
|
| 590 | + * @param boolean $reverseOrder: Should the data map be reversed? |
|
| 591 | + * @param boolean $cmdFirst: Should the command map be processed first? |
|
| 592 | + * |
|
| 593 | + * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
|
| 594 | + */ |
|
| 595 | 595 | public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = FALSE, $cmdFirst = FALSE) { |
| 596 | 596 | if (TYPO3_MODE === 'BE' |
| 597 | 597 | && $GLOBALS['BE_USER']->isAdmin()) { |
@@ -283,17 +283,17 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | // populate structural metadata info |
| 285 | 285 | $elements[$canvasOrder] = $canvas->getId(); |
| 286 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['id']=$canvas->getId(); |
|
| 287 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId']=null; |
|
| 288 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['label']=$canvas->getLabelForDisplay(); |
|
| 289 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['orderlabel']=$canvas->getLabelForDisplay(); |
|
| 286 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['id'] = $canvas->getId(); |
|
| 287 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId'] = null; |
|
| 288 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['label'] = $canvas->getLabelForDisplay(); |
|
| 289 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['orderlabel'] = $canvas->getLabelForDisplay(); |
|
| 290 | 290 | // assume that a canvas always represents a page |
| 291 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['type']='page'; |
|
| 292 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds']=null; |
|
| 291 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['type'] = 'page'; |
|
| 292 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds'] = null; |
|
| 293 | 293 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = null; |
| 294 | 294 | if (!empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
| 295 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = array(); |
|
| 296 | - $this->physicalStructureInfo[$physSeq[0]]['annotationContainers'] = array(); |
|
| 295 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = array (); |
|
| 296 | + $this->physicalStructureInfo[$physSeq[0]]['annotationContainers'] = array (); |
|
| 297 | 297 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 298 | 298 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'][] = $annotationContainer->getId(); |
| 299 | 299 | if ($extConf['indexAnnotations']) { |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | $details = $this->getLogicalStructureInfo($logUnits[0]); |
| 425 | 425 | } else { |
| 426 | 426 | // cache the ranges - they might occure multiple times in the structures "tree" - with full data as well as referenced as id |
| 427 | - $processedStructures = array(); |
|
| 427 | + $processedStructures = array (); |
|
| 428 | 428 | foreach ($logUnits as $logUnit) { |
| 429 | 429 | if (array_search($logUnit->getId(), $processedStructures) == false) { |
| 430 | 430 | $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, TRUE, $processedStructures); |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | * @param array $processedStructures: IIIF resources that already have been processed |
| 446 | 446 | * @return array Logical structure array |
| 447 | 447 | */ |
| 448 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = array()) { |
|
| 448 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = array ()) { |
|
| 449 | 449 | $details = array (); |
| 450 | 450 | $details['id'] = $resource->getId(); |
| 451 | 451 | $details['dmdId'] = ''; |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | $this->_getSmLinks(); |
| 468 | 468 | // Load physical structure. |
| 469 | 469 | $this-> _getPhysicalStructure(); |
| 470 | - $canvases = array(); |
|
| 470 | + $canvases = array (); |
|
| 471 | 471 | if ($resource instanceof ManifestInterface) { |
| 472 | 472 | $startCanvas = $resource->getStartCanvasOrFirstCanvas(); |
| 473 | 473 | $canvases = $resource->getDefaultCanvases(); |
@@ -478,13 +478,13 @@ discard block |
||
| 478 | 478 | if ($startCanvas != null) { |
| 479 | 479 | $details['pagination'] = $startCanvas->getLabel(); |
| 480 | 480 | $startCanvasIndex = array_search($startCanvas, $this->iiif->getDefaultCanvases()); |
| 481 | - if ($startCanvasIndex!==false) { |
|
| 481 | + if ($startCanvasIndex !== false) { |
|
| 482 | 482 | $details['points'] = $startCanvasIndex + 1; |
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | $useGroups = $this->getUseGroups('fileGrps'); |
| 486 | 486 | if (is_string($useGroups)) { |
| 487 | - $useGroups = array($useGroups); |
|
| 487 | + $useGroups = array ($useGroups); |
|
| 488 | 488 | } |
| 489 | 489 | // Keep for later usage. |
| 490 | 490 | $this->logicalUnits[$details['id']] = $details; |
@@ -542,9 +542,9 @@ discard block |
||
| 542 | 542 | return $this->originalMetadataArray[$id]; |
| 543 | 543 | } |
| 544 | 544 | $iiifResource = $this->iiif->getContainedResourceById($id); |
| 545 | - $result = array(); |
|
| 545 | + $result = array (); |
|
| 546 | 546 | if ($iiifResource != null) { |
| 547 | - if ($iiifResource->getLabel()!=null && $iiifResource->getLabel() != "") { |
|
| 547 | + if ($iiifResource->getLabel() != null && $iiifResource->getLabel() != "") { |
|
| 548 | 548 | $result['label'] = $iiifResource->getLabel(); |
| 549 | 549 | } |
| 550 | 550 | if (!empty($iiifResource->getMetadata())) { |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != null) { |
| 620 | 620 | if (is_string($values)) { |
| 621 | 621 | $metadata[$resArray['index_name']] = array (trim((string) $values)); |
| 622 | - } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data())>1 ) { |
|
| 622 | + } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) { |
|
| 623 | 623 | $metadata[$resArray['index_name']] = array (); |
| 624 | 624 | foreach ($values->data() as $value) { |
| 625 | 625 | $metadata[$resArray['index_name']][] = trim((string) $value); |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != null)) { |
| 637 | 637 | if ($values instanceof string) { |
| 638 | 638 | $metadata[$resArray['index_name'].'_sorting'][0] = array (trim((string) $values)); |
| 639 | - } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()>1 )) { |
|
| 639 | + } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data() > 1)) { |
|
| 640 | 640 | $metadata[$resArray['index_name']] = array (); |
| 641 | 641 | foreach ($values->data() as $value) { |
| 642 | 642 | $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $value); |
@@ -748,13 +748,13 @@ discard block |
||
| 748 | 748 | // Get annotation containers |
| 749 | 749 | $annotationContainerIds = $this->physicalStructureInfo[$id]['annotationContainers']; |
| 750 | 750 | if (!empty($annotationContainerIds)) { |
| 751 | - $annotationTexts = array(); |
|
| 751 | + $annotationTexts = array (); |
|
| 752 | 752 | foreach ($annotationContainerIds as $annotationListId) { |
| 753 | 753 | $annotationContainer = $this->iiif->getContainedResourceById($annotationListId); |
| 754 | 754 | /* @var $annotationContainer \Ubl\Iiif\Presentation\Common\Model\Resources\AnnotationContainerInterface */ |
| 755 | 755 | foreach ($annotationContainer->getTextAnnotations(Motivation::PAINTING) as $annotation) { |
| 756 | 756 | if ($annotation->getTargetResourceId() == $iiifResource->getId() && |
| 757 | - $annotation->getBody()!=null && $annotation->getBody()->getChars()!=null) { |
|
| 757 | + $annotation->getBody() != null && $annotation->getBody()->getChars() != null) { |
|
| 758 | 758 | $annotationTexts[] = $annotation->getBody()->getChars(); |
| 759 | 759 | } |
| 760 | 760 | } |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 805 | 805 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 806 | 806 | $resource = IiifHelper::loadIiifResource($content); |
| 807 | - if ($resource != null ) { |
|
| 807 | + if ($resource != null) { |
|
| 808 | 808 | if ($resource instanceof ManifestInterface) { |
| 809 | 809 | $this->iiif = $resource; |
| 810 | 810 | return true; |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 918 | 918 | $resource = IiifHelper::loadIiifResource($this->asJson); |
| 919 | 919 | if ($resource != null && $resource instanceof ManifestInterface) { |
| 920 | - $this->asJson=''; |
|
| 920 | + $this->asJson = ''; |
|
| 921 | 921 | $this->iiif = $resource; |
| 922 | 922 | $this->init(); |
| 923 | 923 | } else { |
@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | * @subpackage tx_dlf |
| 38 | 38 | * @access public |
| 39 | 39 | */ |
| 40 | -final class IiifManifest extends Document |
|
| 41 | -{ |
|
| 40 | +final class IiifManifest extends Document { |
|
| 42 | 41 | /** |
| 43 | 42 | * This holds the manifest file as string for serialization purposes |
| 44 | 43 | * @see __sleep() / __wakeup() |
@@ -99,8 +98,7 @@ discard block |
||
| 99 | 98 | * {@inheritDoc} |
| 100 | 99 | * @see Document::establishRecordId() |
| 101 | 100 | */ |
| 102 | - protected function establishRecordId($pid) |
|
| 103 | - { |
|
| 101 | + protected function establishRecordId($pid) { |
|
| 104 | 102 | if ($this->iiif !== null) { |
| 105 | 103 | /* |
| 106 | 104 | * FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss |
@@ -140,8 +138,7 @@ discard block |
||
| 140 | 138 | * {@inheritDoc} |
| 141 | 139 | * @see Document::getDocument() |
| 142 | 140 | */ |
| 143 | - protected function getDocument() |
|
| 144 | - { |
|
| 141 | + protected function getDocument() { |
|
| 145 | 142 | return $this->iiif; |
| 146 | 143 | } |
| 147 | 144 | |
@@ -195,8 +192,7 @@ discard block |
||
| 195 | 192 | * |
| 196 | 193 | * @return array|string |
| 197 | 194 | */ |
| 198 | - protected function getUseGroups($use) |
|
| 199 | - { |
|
| 195 | + protected function getUseGroups($use) { |
|
| 200 | 196 | if (!$this->useGrpsLoaded) { |
| 201 | 197 | // Get configured USE attributes. |
| 202 | 198 | $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
@@ -223,8 +219,7 @@ discard block |
||
| 223 | 219 | * {@inheritDoc} |
| 224 | 220 | * @see Document::_getPhysicalStructure() |
| 225 | 221 | */ |
| 226 | - protected function _getPhysicalStructure() |
|
| 227 | - { |
|
| 222 | + protected function _getPhysicalStructure() { |
|
| 228 | 223 | // Is there no physical structure array yet? |
| 229 | 224 | if (!$this->physicalStructureLoaded) { |
| 230 | 225 | if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
@@ -358,8 +353,7 @@ discard block |
||
| 358 | 353 | * {@inheritDoc} |
| 359 | 354 | * @see Document::getFileLocation() |
| 360 | 355 | */ |
| 361 | - public function getFileLocation($id) |
|
| 362 | - { |
|
| 356 | + public function getFileLocation($id) { |
|
| 363 | 357 | if ($id == null) { |
| 364 | 358 | return null; |
| 365 | 359 | } |
@@ -383,8 +377,7 @@ discard block |
||
| 383 | 377 | * {@inheritDoc} |
| 384 | 378 | * @see Document::getFileMimeType() |
| 385 | 379 | */ |
| 386 | - public function getFileMimeType($id) |
|
| 387 | - { |
|
| 380 | + public function getFileMimeType($id) { |
|
| 388 | 381 | $fileResource = $this->iiif->getContainedResourceById($id); |
| 389 | 382 | if ($fileResource instanceof CanvasInterface) { |
| 390 | 383 | $format = "application/vnd.kitodo.iiif"; |
@@ -409,8 +402,7 @@ discard block |
||
| 409 | 402 | * {@inheritDoc} |
| 410 | 403 | * @see Document::getLogicalStructure() |
| 411 | 404 | */ |
| 412 | - public function getLogicalStructure($id, $recursive = FALSE) |
|
| 413 | - { |
|
| 405 | + public function getLogicalStructure($id, $recursive = FALSE) { |
|
| 414 | 406 | $details = array (); |
| 415 | 407 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
| 416 | 408 | return $this->logicalUnits[$id]; |
@@ -579,8 +571,7 @@ discard block |
||
| 579 | 571 | * {@inheritDoc} |
| 580 | 572 | * @see Document::getMetadata() |
| 581 | 573 | */ |
| 582 | - public function getMetadata($id, $cPid = 0) |
|
| 583 | - { |
|
| 574 | + public function getMetadata($id, $cPid = 0) { |
|
| 584 | 575 | if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) { |
| 585 | 576 | return $this->metadataArray[$id]; |
| 586 | 577 | } |
@@ -702,8 +693,7 @@ discard block |
||
| 702 | 693 | * @param CanvasInterface $canvas |
| 703 | 694 | * @param IiifResourceInterface $resource |
| 704 | 695 | */ |
| 705 | - private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) |
|
| 706 | - { |
|
| 696 | + private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) { |
|
| 707 | 697 | $this->smLinks['l2p'][$resource->getId()][] = $canvas->getId(); |
| 708 | 698 | if (!is_array($this->smLinks['p2l'][$canvas->getId()]) || !in_array($resource->getId(), $this->smLinks['p2l'][$canvas->getId()])) { |
| 709 | 699 | $this->smLinks['p2l'][$canvas->getId()][] = $resource->getId(); |
@@ -718,8 +708,7 @@ discard block |
||
| 718 | 708 | * |
| 719 | 709 | * @see Document::getParentDocumentUidForSaving() |
| 720 | 710 | */ |
| 721 | - protected function getParentDocumentUidForSaving($pid, $core) |
|
| 722 | - { |
|
| 711 | + protected function getParentDocumentUidForSaving($pid, $core) { |
|
| 723 | 712 | // Do nothing. |
| 724 | 713 | } |
| 725 | 714 | |
@@ -778,8 +767,7 @@ discard block |
||
| 778 | 767 | * |
| 779 | 768 | * @return IiifResourceInterface |
| 780 | 769 | */ |
| 781 | - public function getIiif() |
|
| 782 | - { |
|
| 770 | + public function getIiif() { |
|
| 783 | 771 | return $this->iiif; |
| 784 | 772 | } |
| 785 | 773 | |
@@ -787,8 +775,7 @@ discard block |
||
| 787 | 775 | * {@inheritDoc} |
| 788 | 776 | * @see Document::init() |
| 789 | 777 | */ |
| 790 | - protected function init() |
|
| 791 | - { |
|
| 778 | + protected function init() { |
|
| 792 | 779 | // Nothing to do here, at the moment |
| 793 | 780 | } |
| 794 | 781 | |
@@ -796,8 +783,7 @@ discard block |
||
| 796 | 783 | * {@inheritDoc} |
| 797 | 784 | * @see Document::loadLocation() |
| 798 | 785 | */ |
| 799 | - protected function loadLocation($location) |
|
| 800 | - { |
|
| 786 | + protected function loadLocation($location) { |
|
| 801 | 787 | $content = GeneralUtility::getUrl($location); |
| 802 | 788 | $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 803 | 789 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
@@ -818,8 +804,7 @@ discard block |
||
| 818 | 804 | * {@inheritDoc} |
| 819 | 805 | * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray() |
| 820 | 806 | */ |
| 821 | - protected function prepareMetadataArray($cPid) |
|
| 822 | - { |
|
| 807 | + protected function prepareMetadataArray($cPid) { |
|
| 823 | 808 | $id = $this->iiif->getId(); |
| 824 | 809 | $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid); |
| 825 | 810 | } |
@@ -840,8 +825,7 @@ discard block |
||
| 840 | 825 | * {@inheritDoc} |
| 841 | 826 | * @see Document::ensureHasFulltextIsSet() |
| 842 | 827 | */ |
| 843 | - protected function ensureHasFulltextIsSet() |
|
| 844 | - { |
|
| 828 | + protected function ensureHasFulltextIsSet() { |
|
| 845 | 829 | /* |
| 846 | 830 | * TODO Check annotations and annotation lists of canvas for ALTO documents. |
| 847 | 831 | * Example: |
@@ -883,8 +867,7 @@ discard block |
||
| 883 | 867 | * {@inheritDoc} |
| 884 | 868 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
| 885 | 869 | */ |
| 886 | - protected function _getThumbnail($forceReload = FALSE) |
|
| 887 | - { |
|
| 870 | + protected function _getThumbnail($forceReload = FALSE) { |
|
| 888 | 871 | return $this->iiif->getThumbnailUrl(); |
| 889 | 872 | } |
| 890 | 873 | |
@@ -892,8 +875,7 @@ discard block |
||
| 892 | 875 | * {@inheritDoc} |
| 893 | 876 | * @see \Kitodo\Dlf\Common\Document::_getToplevelId() |
| 894 | 877 | */ |
| 895 | - protected function _getToplevelId() |
|
| 896 | - { |
|
| 878 | + protected function _getToplevelId() { |
|
| 897 | 879 | if (empty($this->toplevelId)) { |
| 898 | 880 | if (isset($this->iiif)) { |
| 899 | 881 | $this->toplevelId = $this->iiif->getId(); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @var boolean |
| 69 | 69 | * @access protected |
| 70 | 70 | */ |
| 71 | - protected $hasFulltextSet = false; |
|
| 71 | + protected $hasFulltextSet = FALSE; |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * This holds the original manifest's parsed metadata array with their corresponding |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | protected function establishRecordId($pid) |
| 103 | 103 | { |
| 104 | - if ($this->iiif !== null) { |
|
| 104 | + if ($this->iiif !== NULL) { |
|
| 105 | 105 | /* |
| 106 | 106 | * FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss |
| 107 | 107 | * if the plugin that actually loads the manifest allows content from other pages. |
@@ -227,8 +227,8 @@ discard block |
||
| 227 | 227 | { |
| 228 | 228 | // Is there no physical structure array yet? |
| 229 | 229 | if (!$this->physicalStructureLoaded) { |
| 230 | - if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
|
| 231 | - return null; |
|
| 230 | + if ($this->iiif == NULL || !($this->iiif instanceof ManifestInterface)) { |
|
| 231 | + return NULL; |
|
| 232 | 232 | } |
| 233 | 233 | $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 234 | 234 | $iiifId = $this->iiif->getId(); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $this->physicalStructureInfo[$physSeq[0]]['label'] = $this->iiif->getLabelForDisplay(); |
| 239 | 239 | $this->physicalStructureInfo[$physSeq[0]]['orderlabel'] = $this->iiif->getLabelForDisplay(); |
| 240 | 240 | $this->physicalStructureInfo[$physSeq[0]]['type'] = 'physSequence'; |
| 241 | - $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = null; |
|
| 241 | + $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = NULL; |
|
| 242 | 242 | $fileUseDownload = $this->getUseGroups('fileGrpDownload'); |
| 243 | 243 | $fileUseFulltext = $this->getUseGroups('fileGrpFulltext'); |
| 244 | 244 | $fileUseThumbs = $this->getUseGroups('fileGrpThumbs'); |
@@ -252,14 +252,14 @@ discard block |
||
| 252 | 252 | if (isset($fileUseFulltext)) { |
| 253 | 253 | $iiifAlto = $this->iiif->getSeeAlsoUrlsForFormat("application/alto+xml"); |
| 254 | 254 | if (empty($iiifAlto)) { |
| 255 | - $iiifAlto = $this->iiif->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/", true); |
|
| 255 | + $iiifAlto = $this->iiif->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/", TRUE); |
|
| 256 | 256 | } |
| 257 | 257 | if (!empty($iiifAlto)) { |
| 258 | 258 | // TODO use multiple possible alto files? |
| 259 | 259 | $this->mimeTypes[$iiifAlto[0]] = "application/alto+xml"; |
| 260 | 260 | $this->physicalStructureInfo[$physSeq[0]]['files'][$fileUseFulltext] = $iiifAlto[0]; |
| 261 | - $this->hasFulltext = true; |
|
| 262 | - $this->hasFulltextSet = true; |
|
| 261 | + $this->hasFulltext = TRUE; |
|
| 262 | + $this->hasFulltextSet = TRUE; |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | if (!empty($this->iiif->getDefaultCanvases())) { |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | // put images in all non specific filegroups |
| 277 | 277 | if (isset($fileUses)) { |
| 278 | 278 | foreach ($fileUses as $fileUse) { |
| 279 | - if ($image->getBody() != null && $image->getBody() instanceof ContentResourceInterface) { |
|
| 279 | + if ($image->getBody() != NULL && $image->getBody() instanceof ContentResourceInterface) { |
|
| 280 | 280 | $this->physicalStructureInfo[$physSeq[0]]['files'][$fileUse] = $image->getBody()->getId(); |
| 281 | 281 | } |
| 282 | 282 | } |
@@ -284,40 +284,40 @@ discard block |
||
| 284 | 284 | // populate structural metadata info |
| 285 | 285 | $elements[$canvasOrder] = $canvas->getId(); |
| 286 | 286 | $this->physicalStructureInfo[$elements[$canvasOrder]]['id']=$canvas->getId(); |
| 287 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId']=null; |
|
| 287 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId']=NULL; |
|
| 288 | 288 | $this->physicalStructureInfo[$elements[$canvasOrder]]['label']=$canvas->getLabelForDisplay(); |
| 289 | 289 | $this->physicalStructureInfo[$elements[$canvasOrder]]['orderlabel']=$canvas->getLabelForDisplay(); |
| 290 | 290 | // assume that a canvas always represents a page |
| 291 | 291 | $this->physicalStructureInfo[$elements[$canvasOrder]]['type']='page'; |
| 292 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds']=null; |
|
| 293 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = null; |
|
| 292 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds']=NULL; |
|
| 293 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = NULL; |
|
| 294 | 294 | if (!empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
| 295 | 295 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = array(); |
| 296 | 296 | $this->physicalStructureInfo[$physSeq[0]]['annotationContainers'] = array(); |
| 297 | 297 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 298 | 298 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'][] = $annotationContainer->getId(); |
| 299 | 299 | if ($extConf['indexAnnotations']) { |
| 300 | - $this->hasFulltext = true; |
|
| 301 | - $this->hasFulltextSet = true; |
|
| 300 | + $this->hasFulltext = TRUE; |
|
| 301 | + $this->hasFulltextSet = TRUE; |
|
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | if (isset($fileUseFulltext)) { |
| 306 | 306 | $alto = $canvas->getSeeAlsoUrlsForFormat("application/alto+xml"); |
| 307 | 307 | if (empty($alto)) { |
| 308 | - $alto = $canvas->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/", true); |
|
| 308 | + $alto = $canvas->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/", TRUE); |
|
| 309 | 309 | } |
| 310 | 310 | if (!empty($alto)) { |
| 311 | 311 | // TODO use all possible alto files? |
| 312 | 312 | $this->mimeTypes[$alto[0]] = "application/alto+xml"; |
| 313 | 313 | $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUseFulltext] = $alto[0]; |
| 314 | - $this->hasFulltext = true; |
|
| 315 | - $this->hasFulltextSet = true; |
|
| 314 | + $this->hasFulltext = TRUE; |
|
| 315 | + $this->hasFulltextSet = TRUE; |
|
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | if (isset($fileUses)) { |
| 319 | 319 | foreach ($fileUses as $fileUse) { |
| 320 | - if ($image->getBody() != null && $image->getBody() instanceof ContentResourceInterface) { |
|
| 320 | + if ($image->getBody() != NULL && $image->getBody() instanceof ContentResourceInterface) { |
|
| 321 | 321 | $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUse] = $image->getBody()->getId(); |
| 322 | 322 | } |
| 323 | 323 | } |
@@ -360,15 +360,15 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public function getFileLocation($id) |
| 362 | 362 | { |
| 363 | - if ($id == null) { |
|
| 364 | - return null; |
|
| 363 | + if ($id == NULL) { |
|
| 364 | + return NULL; |
|
| 365 | 365 | } |
| 366 | 366 | $resource = $this->iiif->getContainedResourceById($id); |
| 367 | 367 | if (isset($resource)) { |
| 368 | 368 | if ($resource instanceof CanvasInterface) { |
| 369 | - return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != null) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id; |
|
| 369 | + return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != NULL) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id; |
|
| 370 | 370 | } elseif ($resource instanceof ContentResourceInterface) { |
| 371 | - return $resource->getSingleService() != null && $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id; |
|
| 371 | + return $resource->getSingleService() != NULL && $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id; |
|
| 372 | 372 | } elseif ($resource instanceof AbstractImageService) { |
| 373 | 373 | return $resource->getId(); |
| 374 | 374 | } elseif ($resource instanceof AnnotationContainerInterface) { |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | } elseif ($fileResource instanceof AnnotationInterface) { |
| 392 | 392 | $format = "application/vnd.kitodo.iiif"; |
| 393 | 393 | } elseif ($fileResource instanceof ContentResourceInterface) { |
| 394 | - if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == null || !($fileResource->getSingleService() instanceof AbstractImageService))) { |
|
| 394 | + if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == NULL || !($fileResource->getSingleService() instanceof AbstractImageService))) { |
|
| 395 | 395 | // Support static images without an image service |
| 396 | 396 | return $fileResource->getFormat(); |
| 397 | 397 | } |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | // cache the ranges - they might occure multiple times in the structures "tree" - with full data as well as referenced as id |
| 427 | 427 | $processedStructures = array(); |
| 428 | 428 | foreach ($logUnits as $logUnit) { |
| 429 | - if (array_search($logUnit->getId(), $processedStructures) == false) { |
|
| 429 | + if (array_search($logUnit->getId(), $processedStructures) == FALSE) { |
|
| 430 | 430 | $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, TRUE, $processedStructures); |
| 431 | 431 | } |
| 432 | 432 | } |
@@ -445,12 +445,12 @@ discard block |
||
| 445 | 445 | * @param array $processedStructures: IIIF resources that already have been processed |
| 446 | 446 | * @return array Logical structure array |
| 447 | 447 | */ |
| 448 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = array()) { |
|
| 448 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = FALSE, &$processedStructures = array()) { |
|
| 449 | 449 | $details = array (); |
| 450 | 450 | $details['id'] = $resource->getId(); |
| 451 | 451 | $details['dmdId'] = ''; |
| 452 | - $details['label'] = $resource->getLabelForDisplay() !== null ? $resource->getLabelForDisplay() : ''; |
|
| 453 | - $details['orderlabel'] = $resource->getLabelForDisplay() !== null ? $resource->getLabelForDisplay() : ''; |
|
| 452 | + $details['label'] = $resource->getLabelForDisplay() !== NULL ? $resource->getLabelForDisplay() : ''; |
|
| 453 | + $details['orderlabel'] = $resource->getLabelForDisplay() !== NULL ? $resource->getLabelForDisplay() : ''; |
|
| 454 | 454 | $details['contentIds'] = ''; |
| 455 | 455 | $details['volume'] = ''; |
| 456 | 456 | $details['pagination'] = ''; |
@@ -475,10 +475,10 @@ discard block |
||
| 475 | 475 | $startCanvas = $resource->getStartCanvasOrFirstCanvas(); |
| 476 | 476 | $canvases = $resource->getAllCanvases(); |
| 477 | 477 | } |
| 478 | - if ($startCanvas != null) { |
|
| 478 | + if ($startCanvas != NULL) { |
|
| 479 | 479 | $details['pagination'] = $startCanvas->getLabel(); |
| 480 | 480 | $startCanvasIndex = array_search($startCanvas, $this->iiif->getDefaultCanvases()); |
| 481 | - if ($startCanvasIndex!==false) { |
|
| 481 | + if ($startCanvasIndex!==FALSE) { |
|
| 482 | 482 | $details['points'] = $startCanvasIndex + 1; |
| 483 | 483 | } |
| 484 | 484 | } |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | if ($recursive) { |
| 493 | 493 | $processedStructures[] = $resource->getId(); |
| 494 | 494 | $details['children'] = array (); |
| 495 | - if ($resource instanceof ManifestInterface && $resource->getRootRanges() != null) { |
|
| 495 | + if ($resource instanceof ManifestInterface && $resource->getRootRanges() != NULL) { |
|
| 496 | 496 | $rangesToAdd = []; |
| 497 | 497 | $rootRanges = []; |
| 498 | 498 | if (sizeof($this->iiif->getRootRanges()) == 1 && $this->iiif->getRootRanges()[0]->isTopRange()) { |
@@ -504,14 +504,14 @@ discard block |
||
| 504 | 504 | $rootRanges[] = $range; |
| 505 | 505 | } |
| 506 | 506 | foreach ($rootRanges as $range) { |
| 507 | - if ((array_search($range->getId(), $processedStructures) == false)) { |
|
| 507 | + if ((array_search($range->getId(), $processedStructures) == FALSE)) { |
|
| 508 | 508 | $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures); |
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | } elseif ($resource instanceof RangeInterface) { |
| 512 | 512 | if (!empty($resource->getAllRanges())) { |
| 513 | 513 | foreach ($resource->getAllRanges() as $range) { |
| 514 | - if ((array_search($range->getId(), $processedStructures) == false)) { |
|
| 514 | + if ((array_search($range->getId(), $processedStructures) == FALSE)) { |
|
| 515 | 515 | $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures); |
| 516 | 516 | } |
| 517 | 517 | } |
@@ -537,14 +537,14 @@ discard block |
||
| 537 | 537 | * |
| 538 | 538 | * @todo This method is still in experimental; the method signature may change. |
| 539 | 539 | */ |
| 540 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) { |
|
| 540 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = TRUE, $withRights = TRUE, $withRelated = TRUE) { |
|
| 541 | 541 | if (!empty($this->originalMetadataArray[$id])) { |
| 542 | 542 | return $this->originalMetadataArray[$id]; |
| 543 | 543 | } |
| 544 | 544 | $iiifResource = $this->iiif->getContainedResourceById($id); |
| 545 | 545 | $result = array(); |
| 546 | - if ($iiifResource != null) { |
|
| 547 | - if ($iiifResource->getLabel()!=null && $iiifResource->getLabel() != "") { |
|
| 546 | + if ($iiifResource != NULL) { |
|
| 547 | + if ($iiifResource->getLabel()!=NULL && $iiifResource->getLabel() != "") { |
|
| 548 | 548 | $result['label'] = $iiifResource->getLabel(); |
| 549 | 549 | } |
| 550 | 550 | if (!empty($iiifResource->getMetadata())) { |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $iiifResource = $this->iiif->getContainedResourceById($id); |
| 617 | 617 | while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
| 618 | 618 | // Set metadata field's value(s). |
| 619 | - if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != null) { |
|
| 619 | + if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != NULL) { |
|
| 620 | 620 | if (is_string($values)) { |
| 621 | 621 | $metadata[$resArray['index_name']] = array (trim((string) $values)); |
| 622 | 622 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data())>1 ) { |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | // Set sorting value if applicable. |
| 634 | 634 | if (!empty($metadata[$resArray['index_name']]) && $resArray['is_sortable']) { |
| 635 | 635 | if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting']) |
| 636 | - && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != null)) { |
|
| 636 | + && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != NULL)) { |
|
| 637 | 637 | if ($values instanceof string) { |
| 638 | 638 | $metadata[$resArray['index_name'].'_sorting'][0] = array (trim((string) $values)); |
| 639 | 639 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()>1 )) { |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | $this->smLinkRangeCanvasesRecursively($range); |
| 668 | 668 | } |
| 669 | 669 | } |
| 670 | - $this->smLinksLoaded = true; |
|
| 670 | + $this->smLinksLoaded = TRUE; |
|
| 671 | 671 | } |
| 672 | 672 | return $this->smLinks; |
| 673 | 673 | } |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | /* @var $annotationContainer \Ubl\Iiif\Presentation\Common\Model\Resources\AnnotationContainerInterface */ |
| 755 | 755 | foreach ($annotationContainer->getTextAnnotations(Motivation::PAINTING) as $annotation) { |
| 756 | 756 | if ($annotation->getTargetResourceId() == $iiifResource->getId() && |
| 757 | - $annotation->getBody()!=null && $annotation->getBody()->getChars()!=null) { |
|
| 757 | + $annotation->getBody()!=NULL && $annotation->getBody()->getChars()!=NULL) { |
|
| 758 | 758 | $annotationTexts[] = $annotation->getBody()->getChars(); |
| 759 | 759 | } |
| 760 | 760 | } |
@@ -804,10 +804,10 @@ discard block |
||
| 804 | 804 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 805 | 805 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 806 | 806 | $resource = IiifHelper::loadIiifResource($content); |
| 807 | - if ($resource != null ) { |
|
| 807 | + if ($resource != NULL ) { |
|
| 808 | 808 | if ($resource instanceof ManifestInterface) { |
| 809 | 809 | $this->iiif = $resource; |
| 810 | - return true; |
|
| 810 | + return TRUE; |
|
| 811 | 811 | } |
| 812 | 812 | } else { |
| 813 | 813 | Helper::devLog('Could not load IIIF manifest from "'.$location.'"', self::$extKey, SYSLOG_SEVERITY_ERROR); |
@@ -831,9 +831,9 @@ discard block |
||
| 831 | 831 | protected function setPreloadedDocument($preloadedDocument) { |
| 832 | 832 | if ($preloadedDocument instanceof ManifestInterface) { |
| 833 | 833 | $this->iiif = $preloadedDocument; |
| 834 | - return true; |
|
| 834 | + return TRUE; |
|
| 835 | 835 | } |
| 836 | - return false; |
|
| 836 | + return FALSE; |
|
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | /** |
@@ -854,20 +854,20 @@ discard block |
||
| 854 | 854 | foreach ($canvases as $canvas) { |
| 855 | 855 | if (!empty($canvas->getSeeAlsoUrlsForFormat("application/alto+xml")) || |
| 856 | 856 | !empty($canvas->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/"))) { |
| 857 | - $this->hasFulltextSet = true; |
|
| 858 | - $this->hasFulltext = true; |
|
| 857 | + $this->hasFulltextSet = TRUE; |
|
| 858 | + $this->hasFulltext = TRUE; |
|
| 859 | 859 | return; |
| 860 | 860 | } |
| 861 | 861 | $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 862 | 862 | if ($extConf['indexAnnotations'] == 1 && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
| 863 | 863 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 864 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
| 864 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
| 865 | 865 | foreach ($textAnnotations as $annotation) { |
| 866 | - if ($annotation->getBody() != null && |
|
| 866 | + if ($annotation->getBody() != NULL && |
|
| 867 | 867 | $annotation->getBody()->getFormat() == "text/plain" && |
| 868 | - $annotation->getBody()->getChars() != null) { |
|
| 869 | - $this->hasFulltextSet = true; |
|
| 870 | - $this->hasFulltext = true; |
|
| 868 | + $annotation->getBody()->getChars() != NULL) { |
|
| 869 | + $this->hasFulltextSet = TRUE; |
|
| 870 | + $this->hasFulltext = TRUE; |
|
| 871 | 871 | return; |
| 872 | 872 | } |
| 873 | 873 | } |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | } |
| 876 | 876 | } |
| 877 | 877 | } |
| 878 | - $this->hasFulltextSet = true; |
|
| 878 | + $this->hasFulltextSet = TRUE; |
|
| 879 | 879 | } |
| 880 | 880 | } |
| 881 | 881 | |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 917 | 917 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 918 | 918 | $resource = IiifHelper::loadIiifResource($this->asJson); |
| 919 | - if ($resource != null && $resource instanceof ManifestInterface) { |
|
| 919 | + if ($resource != NULL && $resource instanceof ManifestInterface) { |
|
| 920 | 920 | $this->asJson=''; |
| 921 | 921 | $this->iiif = $resource; |
| 922 | 922 | $this->init(); |
@@ -131,8 +131,7 @@ |
||
| 131 | 131 | $fileMimeType = $this->getFileMimeType($id); |
| 132 | 132 | $fileLocation = $this->getFileLocation($id); |
| 133 | 133 | if ($fileMimeType == "application/vnd.kitodo.iiif") { |
| 134 | - $fileLocation = strrpos($fileLocation, "info.json") == strlen($fileLocation) - 9 ? $fileLocation : |
|
| 135 | - strrpos($fileLocation, "/") == strlen($fileLocation) ? $fileLocation."info.json" : $fileLocation."/info.json"; |
|
| 134 | + $fileLocation = strrpos($fileLocation, "info.json") == strlen($fileLocation) - 9 ? $fileLocation : strrpos($fileLocation, "/") == strlen($fileLocation) ? $fileLocation."info.json" : $fileLocation."/info.json"; |
|
| 136 | 135 | $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 137 | 136 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 138 | 137 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -23,8 +23,7 @@ discard block |
||
| 23 | 23 | * @subpackage tx_dlf |
| 24 | 24 | * @access public |
| 25 | 25 | */ |
| 26 | -final class MetsDocument extends Document |
|
| 27 | -{ |
|
| 26 | +final class MetsDocument extends Document { |
|
| 28 | 27 | /** |
| 29 | 28 | * This holds the whole XML file as string for serialization purposes |
| 30 | 29 | * @see __sleep() / __wakeup() |
@@ -256,14 +255,16 @@ discard block |
||
| 256 | 255 | // Yes. Get the file reference. |
| 257 | 256 | $details['points'] = (string) $structure->children('http://www.loc.gov/METS/')->mptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 258 | 257 | } elseif (!empty($this->physicalStructure) |
| 259 | - && array_key_exists($details['id'], $this->smLinks['l2p'])) { // Are there any physical elements and is this logical unit linked to at least one of them? |
|
| 258 | + && array_key_exists($details['id'], $this->smLinks['l2p'])) { |
|
| 259 | +// Are there any physical elements and is this logical unit linked to at least one of them? |
|
| 260 | 260 | $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE)), 1); |
| 261 | 261 | if (!empty($this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$extConf['fileGrpThumbs']])) { |
| 262 | 262 | $details['thumbnailId'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$extConf['fileGrpThumbs']]; |
| 263 | 263 | } |
| 264 | 264 | // Get page/track number of the first page/track related to this structure element. |
| 265 | 265 | $details['pagination'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['orderlabel']; |
| 266 | - } elseif ($details['id'] == $this->_getToplevelId()) { // Is this the toplevel structure element? |
|
| 266 | + } elseif ($details['id'] == $this->_getToplevelId()) { |
|
| 267 | +// Is this the toplevel structure element? |
|
| 267 | 268 | // Yes. Point to itself. |
| 268 | 269 | $details['points'] = 1; |
| 269 | 270 | if (!empty($this->physicalStructure) |
@@ -481,8 +482,7 @@ discard block |
||
| 481 | 482 | * {@inheritDoc} |
| 482 | 483 | * @see Document::getStructureDepth() |
| 483 | 484 | */ |
| 484 | - public function getStructureDepth($logId) |
|
| 485 | - { |
|
| 485 | + public function getStructureDepth($logId) { |
|
| 486 | 486 | return count($this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*')); |
| 487 | 487 | } |
| 488 | 488 | |
@@ -542,8 +542,7 @@ discard block |
||
| 542 | 542 | * {@inheritDoc} |
| 543 | 543 | * @see Document::getParentDocumentUid() |
| 544 | 544 | */ |
| 545 | - protected function getParentDocumentUidForSaving($pid, $core) |
|
| 546 | - { |
|
| 545 | + protected function getParentDocumentUidForSaving($pid, $core) { |
|
| 547 | 546 | $partof = 0; |
| 548 | 547 | // Get the closest ancestor of the current document which has a MPTR child. |
| 549 | 548 | $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->_getToplevelId().'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 139 | 139 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 140 | 140 | $service = IiifHelper::loadIiifResource($fileLocation); |
| 141 | - if ($service != null && $service instanceof AbstractImageService) { |
|
| 141 | + if ($service != NULL && $service instanceof AbstractImageService) { |
|
| 142 | 142 | return $service->getImageUrl(); |
| 143 | 143 | } |
| 144 | 144 | } elseif ($fileMimeType = "application/vnd.netfpx") { |
| 145 | - $baseURL = $fileLocation.(strpos($fileLocation, "?") === false ? "?" : ""); |
|
| 145 | + $baseURL = $fileLocation.(strpos($fileLocation, "?") === FALSE ? "?" : ""); |
|
| 146 | 146 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
| 147 | 147 | return $baseURL."&CVT=jpeg"; |
| 148 | 148 | } |
@@ -570,9 +570,9 @@ discard block |
||
| 570 | 570 | |
| 571 | 571 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
| 572 | 572 | $this->xml = $preloadedDocument; |
| 573 | - return true; |
|
| 573 | + return TRUE; |
|
| 574 | 574 | } |
| 575 | - return false; |
|
| 575 | + return FALSE; |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | /** |
@@ -165,7 +165,7 @@ |
||
| 165 | 165 | $iiifwrap['value.']['required'] = 1; |
| 166 | 166 | $iiifwrap['value.']['wrap'] = '<dd>|</dd>'; |
| 167 | 167 | } |
| 168 | - $iiifLink=[]; |
|
| 168 | + $iiifLink = []; |
|
| 169 | 169 | $iiifLink['key.']['wrap'] = '<dt>|</dt>'; |
| 170 | 170 | $iiifLink['value.']['required'] = 1; |
| 171 | 171 | $iiifLink['value.']['setContentToCurrent'] = 1; |
@@ -150,7 +150,7 @@ |
||
| 150 | 150 | * |
| 151 | 151 | * @return string The metadata array ready for output |
| 152 | 152 | */ |
| 153 | - protected function printMetadata(array $metadataArray, $useOriginalIiifManifestMetadata = false) { |
|
| 153 | + protected function printMetadata(array $metadataArray, $useOriginalIiifManifestMetadata = FALSE) { |
|
| 154 | 154 | // Load template file. |
| 155 | 155 | $this->getTemplate(); |
| 156 | 156 | $output = ''; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @var array |
| 58 | 58 | * @access protected |
| 59 | 59 | */ |
| 60 | - protected $annotationContainers = array(); |
|
| 60 | + protected $annotationContainers = array (); |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Adds Viewer javascript |
@@ -250,8 +250,8 @@ discard block |
||
| 250 | 250 | if ($iiif instanceof ManifestInterface) { |
| 251 | 251 | $canvas = $iiif->getContainedResourceById($canvasId); |
| 252 | 252 | /* @var $canvas \Ubl\Iiif\Presentation\Common\Model\Resources\CanvasInterface */ |
| 253 | - if ($canvas!=null && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
| 254 | - $annotationContainers = array(); |
|
| 253 | + if ($canvas != null && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
| 254 | + $annotationContainers = array (); |
|
| 255 | 255 | /* |
| 256 | 256 | * TODO Analyzing the annotations on the server side requires loading the annotation lists / pages |
| 257 | 257 | * just to determine wether they contain text annotations for painting. This will take time and lead to a bad user experience. |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | - return array(); |
|
| 288 | + return array (); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -242,8 +242,7 @@ |
||
| 242 | 242 | * @return array An array containing the IRIs of the AnnotationLists / AnnotationPages as well as |
| 243 | 243 | * some information about the canvas. |
| 244 | 244 | */ |
| 245 | - protected function getAnnotationContainers($page) |
|
| 246 | - { |
|
| 245 | + protected function getAnnotationContainers($page) { |
|
| 247 | 246 | if ($this->doc instanceof IiifManifest) { |
| 248 | 247 | $canvasId = $this->doc->physicalStructure[$page]; |
| 249 | 248 | $iiif = $this->doc->getIiif(); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | if ($iiif instanceof ManifestInterface) { |
| 251 | 251 | $canvas = $iiif->getContainedResourceById($canvasId); |
| 252 | 252 | /* @var $canvas \Ubl\Iiif\Presentation\Common\Model\Resources\CanvasInterface */ |
| 253 | - if ($canvas!=null && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
| 253 | + if ($canvas!=NULL && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
| 254 | 254 | $annotationContainers = array(); |
| 255 | 255 | /* |
| 256 | 256 | * TODO Analyzing the annotations on the server side requires loading the annotation lists / pages |
@@ -260,10 +260,10 @@ discard block |
||
| 260 | 260 | * On the other hand, server connections are potentially better than client connections. Downloading annotation lists |
| 261 | 261 | */ |
| 262 | 262 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 263 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
| 263 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
| 264 | 264 | foreach ($textAnnotations as $annotation) { |
| 265 | 265 | if ($annotation->getBody()->getFormat() == "text/plain" |
| 266 | - && $annotation->getBody()->getChars() != null) { |
|
| 266 | + && $annotation->getBody()->getChars() != NULL) { |
|
| 267 | 267 | $annotationListData = []; |
| 268 | 268 | $annotationListData["uri"] = $annotationContainer->getId(); |
| 269 | 269 | $annotationListData["label"] = $annotationContainer->getLabelForDisplay(); |
@@ -552,14 +552,14 @@ |
||
| 552 | 552 | $results = $solr->service->select($selectQuery); |
| 553 | 553 | $facet = $results->getFacetSet(); |
| 554 | 554 | |
| 555 | - $facetCollectionArray = array(); |
|
| 555 | + $facetCollectionArray = array (); |
|
| 556 | 556 | |
| 557 | 557 | // replace everything expect numbers and comma |
| 558 | 558 | $facetCollections = preg_replace('/[^0-9,]/', '', $this->conf['facetCollections']); |
| 559 | 559 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
| 560 | 560 | 'tx_dlf_collections.index_name AS index_name', |
| 561 | 561 | 'tx_dlf_collections', |
| 562 | - 'tx_dlf_collections.uid IN (' . $facetCollections . ')' |
|
| 562 | + 'tx_dlf_collections.uid IN ('.$facetCollections.')' |
|
| 563 | 563 | .Helper::whereClause('tx_dlf_collections') |
| 564 | 564 | ); |
| 565 | 565 | |