We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -422,7 +422,7 @@ |
||
| 422 | 422 | $GLOBALS['LANG']->getLL('update.documentSetFormatForOldEntriesOkay', TRUE), |
| 423 | 423 | $GLOBALS['LANG']->getLL('update.documentSetFormatForOldEntries', TRUE), |
| 424 | 424 | \TYPO3\CMS\Core\Messaging\FlashMessage::OK |
| 425 | - ); |
|
| 425 | + ); |
|
| 426 | 426 | } else { |
| 427 | 427 | Helper::addMessage( |
| 428 | 428 | $GLOBALS['LANG']->getLL('update.documentSetFormatForOldEntriesNotOkay', TRUE), |
@@ -390,10 +390,10 @@ |
||
| 390 | 390 | ); |
| 391 | 391 | while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
| 392 | 392 | if ($resArray['COLUMN_NAME'] == 'document_format') { |
| 393 | - return false; |
|
| 393 | + return FALSE; |
|
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | - return true; |
|
| 396 | + return TRUE; |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | protected function updateDocumentAddFormat() { |
@@ -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']); |
@@ -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 | } |
@@ -580,9 +580,9 @@ discard block |
||
| 580 | 580 | |
| 581 | 581 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
| 582 | 582 | $this->xml = $preloadedDocument; |
| 583 | - return true; |
|
| 583 | + return TRUE; |
|
| 584 | 584 | } |
| 585 | - return false; |
|
| 585 | + return FALSE; |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | /** |
@@ -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() |
@@ -259,14 +258,16 @@ discard block |
||
| 259 | 258 | // Yes. Get the file reference. |
| 260 | 259 | $details['points'] = (string) $structure->children('http://www.loc.gov/METS/')->mptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 261 | 260 | } elseif (!empty($this->physicalStructure) |
| 262 | - && 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? |
|
| 261 | + && array_key_exists($details['id'], $this->smLinks['l2p'])) { |
|
| 262 | +// Are there any physical elements and is this logical unit linked to at least one of them? |
|
| 263 | 263 | $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE)), 1); |
| 264 | 264 | if (!empty($this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$extConf['fileGrpThumbs']])) { |
| 265 | 265 | $details['thumbnailId'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$extConf['fileGrpThumbs']]; |
| 266 | 266 | } |
| 267 | 267 | // Get page/track number of the first page/track related to this structure element. |
| 268 | 268 | $details['pagination'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['orderlabel']; |
| 269 | - } elseif ($details['id'] == $this->_getToplevelId()) { // Is this the toplevel structure element? |
|
| 269 | + } elseif ($details['id'] == $this->_getToplevelId()) { |
|
| 270 | +// Is this the toplevel structure element? |
|
| 270 | 271 | // Yes. Point to itself. |
| 271 | 272 | $details['points'] = 1; |
| 272 | 273 | if (!empty($this->physicalStructure) |
@@ -491,8 +492,7 @@ discard block |
||
| 491 | 492 | * {@inheritDoc} |
| 492 | 493 | * @see Document::getStructureDepth() |
| 493 | 494 | */ |
| 494 | - public function getStructureDepth($logId) |
|
| 495 | - { |
|
| 495 | + public function getStructureDepth($logId) { |
|
| 496 | 496 | return count($this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*')); |
| 497 | 497 | } |
| 498 | 498 | |
@@ -551,8 +551,7 @@ discard block |
||
| 551 | 551 | * {@inheritDoc} |
| 552 | 552 | * @see Document::getParentDocumentUid() |
| 553 | 553 | */ |
| 554 | - protected function getParentDocumentUidForSaving($pid, $core) |
|
| 555 | - { |
|
| 554 | + protected function getParentDocumentUidForSaving($pid, $core) { |
|
| 556 | 555 | $partof = 0; |
| 557 | 556 | // Get the closest ancestor of the current document which has a MPTR child. |
| 558 | 557 | $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->_getToplevelId().'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | // Load template file. |
| 66 | 66 | $this->getTemplate(); |
| 67 | 67 | $annotationContainers = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['annotationContainers']; |
| 68 | - if ($annotationContainers != null && sizeof($annotationContainers)>0) { |
|
| 68 | + if ($annotationContainers != null && sizeof($annotationContainers) > 0) { |
|
| 69 | 69 | $markerArray['###ANNOTATION_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-annotations" title="" data-dic="annotations-on:' |
| 70 | 70 | .$this->pi_getLL('annotations-on', '', TRUE).';annotations-off:' |
| 71 | 71 | .$this->pi_getLL('annotations-off', '', TRUE).'"> </a>'; |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | // Load template file. |
| 66 | 66 | $this->getTemplate(); |
| 67 | 67 | $annotationContainers = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['annotationContainers']; |
| 68 | - if ($annotationContainers != null && sizeof($annotationContainers)>0) { |
|
| 68 | + if ($annotationContainers != NULL && sizeof($annotationContainers)>0) { |
|
| 69 | 69 | $markerArray['###ANNOTATION_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-annotations" title="" data-dic="annotations-on:' |
| 70 | 70 | .$this->pi_getLL('annotations-on', '', TRUE).';annotations-off:' |
| 71 | 71 | .$this->pi_getLL('annotations-off', '', TRUE).'"> </a>'; |
@@ -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 = ''; |
@@ -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; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | if ($iiif instanceof ManifestInterface) { |
| 248 | 248 | $canvas = $iiif->getContainedResourceById($canvasId); |
| 249 | 249 | /* @var $canvas \Ubl\Iiif\Presentation\Common\Model\Resources\CanvasInterface */ |
| 250 | - if ($canvas!=null && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
| 250 | + if ($canvas!=NULL && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
| 251 | 251 | $annotationContainers = array(); |
| 252 | 252 | /* |
| 253 | 253 | * TODO Analyzing the annotations on the server side requires loading the annotation lists / pages |
@@ -257,10 +257,10 @@ discard block |
||
| 257 | 257 | * On the other hand, server connections are potentially better than client connections. Downloading annotation lists |
| 258 | 258 | */ |
| 259 | 259 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 260 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
| 260 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
| 261 | 261 | foreach ($textAnnotations as $annotation) { |
| 262 | 262 | if ($annotation->getBody()->getFormat() == "text/plain" |
| 263 | - && $annotation->getBody()->getChars() != null) { |
|
| 263 | + && $annotation->getBody()->getChars() != NULL) { |
|
| 264 | 264 | $annotationListData = []; |
| 265 | 265 | $annotationListData["uri"] = $annotationContainer->getId(); |
| 266 | 266 | $annotationListData["label"] = $annotationContainer->getLabelForDisplay(); |
@@ -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(); |
@@ -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); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Common/MetsDocument.php']['hookClass'][] = \Kitodo\Dlf\Hooks\KitodoProductionHacks::class; |
| 63 | 63 | // Register command line scripts. |
| 64 | 64 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys'][$_EXTKEY] = [ |
| 65 | - function () { |
|
| 65 | + function() { |
|
| 66 | 66 | $SOBE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Kitodo\Dlf\Cli\CommandLineIndexer::class); |
| 67 | 67 | $SOBE->main(); |
| 68 | 68 | }, |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | /* @var $xml \SimpleXMLElement */ |
| 449 | 449 | $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/'); |
| 450 | 450 | $xpathResult = $xml->xpath('//mets:mets'); |
| 451 | - $documentFormat = ($xpathResult !== false && count($xpathResult)>0) ? 'METS' : null; |
|
| 451 | + $documentFormat = ($xpathResult !== false && count($xpathResult) > 0) ? 'METS' : null; |
|
| 452 | 452 | } else { |
| 453 | 453 | // Try to load file as IIIF resource instead. |
| 454 | 454 | $contentAsJsonArray = json_decode($content, true); |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | return $depth; |
| 683 | 683 | } elseif (array_key_exists('children', $element)) { |
| 684 | 684 | $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId); |
| 685 | - if ($foundInChildren!==false) { |
|
| 685 | + if ($foundInChildren !== false) { |
|
| 686 | 686 | return $foundInChildren; |
| 687 | 687 | } |
| 688 | 688 | } |
@@ -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'); |
@@ -460,15 +460,15 @@ discard block |
||
| 460 | 460 | libxml_disable_entity_loader($previousValueOfEntityLoader); |
| 461 | 461 | // Reset libxml's error logging. |
| 462 | 462 | libxml_use_internal_errors($libxmlErrors); |
| 463 | - if ($xml !== false) { |
|
| 463 | + if ($xml !== FALSE) { |
|
| 464 | 464 | /* @var $xml \SimpleXMLElement */ |
| 465 | 465 | $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/'); |
| 466 | 466 | $xpathResult = $xml->xpath('//mets:mets'); |
| 467 | - $documentFormat = ($xpathResult !== false && count($xpathResult)>0) ? 'METS' : null; |
|
| 467 | + $documentFormat = ($xpathResult !== FALSE && count($xpathResult)>0) ? 'METS' : NULL; |
|
| 468 | 468 | } else { |
| 469 | 469 | // Try to load file as IIIF resource instead. |
| 470 | - $contentAsJsonArray = json_decode($content, true); |
|
| 471 | - if ($contentAsJsonArray !== null) { |
|
| 470 | + $contentAsJsonArray = json_decode($content, TRUE); |
|
| 471 | + if ($contentAsJsonArray !== NULL) { |
|
| 472 | 472 | // Load plugin configuration. |
| 473 | 473 | $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 474 | 474 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
@@ -722,12 +722,12 @@ discard block |
||
| 722 | 722 | return $depth; |
| 723 | 723 | } elseif (array_key_exists('children', $element)) { |
| 724 | 724 | $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId); |
| 725 | - if ($foundInChildren!==false) { |
|
| 725 | + if ($foundInChildren!==FALSE) { |
|
| 726 | 726 | return $foundInChildren; |
| 727 | 727 | } |
| 728 | 728 | } |
| 729 | 729 | } |
| 730 | - return false; |
|
| 730 | + return FALSE; |
|
| 731 | 731 | } |
| 732 | 732 | |
| 733 | 733 | /** |
@@ -284,17 +284,17 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | // populate structural metadata info |
| 286 | 286 | $elements[$canvasOrder] = $canvas->getId(); |
| 287 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['id']=$canvas->getId(); |
|
| 288 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId']=null; |
|
| 289 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['label']=$canvas->getLabelForDisplay(); |
|
| 290 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['orderlabel']=$canvas->getLabelForDisplay(); |
|
| 287 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['id'] = $canvas->getId(); |
|
| 288 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId'] = null; |
|
| 289 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['label'] = $canvas->getLabelForDisplay(); |
|
| 290 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['orderlabel'] = $canvas->getLabelForDisplay(); |
|
| 291 | 291 | // assume that a canvas always represents a page |
| 292 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['type']='page'; |
|
| 293 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds']=null; |
|
| 292 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['type'] = 'page'; |
|
| 293 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds'] = null; |
|
| 294 | 294 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = null; |
| 295 | 295 | if (!empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
| 296 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = array(); |
|
| 297 | - $this->physicalStructureInfo[$physSeq[0]]['annotationContainers'] = array(); |
|
| 296 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = array (); |
|
| 297 | + $this->physicalStructureInfo[$physSeq[0]]['annotationContainers'] = array (); |
|
| 298 | 298 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 299 | 299 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'][] = $annotationContainer->getId(); |
| 300 | 300 | if ($extConf['indexAnnotations']) { |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | $details = $this->getLogicalStructureInfo($logUnits[0]); |
| 426 | 426 | } else { |
| 427 | 427 | // cache the ranges - they might occure multiple times in the structures "tree" - with full data as well as referenced as id |
| 428 | - $processedStructures = array(); |
|
| 428 | + $processedStructures = array (); |
|
| 429 | 429 | foreach ($logUnits as $logUnit) { |
| 430 | 430 | if (array_search($logUnit->getId(), $processedStructures) == false) { |
| 431 | 431 | $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, TRUE, $processedStructures); |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | * @param array $processedStructures: IIIF resources that already have been processed |
| 447 | 447 | * @return array Logical structure array |
| 448 | 448 | */ |
| 449 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = array()) { |
|
| 449 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = array ()) { |
|
| 450 | 450 | $details = array (); |
| 451 | 451 | $details['id'] = $resource->getId(); |
| 452 | 452 | $details['dmdId'] = ''; |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $this->_getSmLinks(); |
| 469 | 469 | // Load physical structure. |
| 470 | 470 | $this-> _getPhysicalStructure(); |
| 471 | - $canvases = array(); |
|
| 471 | + $canvases = array (); |
|
| 472 | 472 | if ($resource instanceof ManifestInterface) { |
| 473 | 473 | $startCanvas = $resource->getStartCanvasOrFirstCanvas(); |
| 474 | 474 | $canvases = $resource->getDefaultCanvases(); |
@@ -479,13 +479,13 @@ discard block |
||
| 479 | 479 | if ($startCanvas != null) { |
| 480 | 480 | $details['pagination'] = $startCanvas->getLabel(); |
| 481 | 481 | $startCanvasIndex = array_search($startCanvas, $this->iiif->getDefaultCanvases()); |
| 482 | - if ($startCanvasIndex!==false) { |
|
| 482 | + if ($startCanvasIndex !== false) { |
|
| 483 | 483 | $details['points'] = $startCanvasIndex + 1; |
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | $useGroups = $this->getUseGroups('fileGrps'); |
| 487 | 487 | if (is_string($useGroups)) { |
| 488 | - $useGroups = array($useGroups); |
|
| 488 | + $useGroups = array ($useGroups); |
|
| 489 | 489 | } |
| 490 | 490 | // Keep for later usage. |
| 491 | 491 | $this->logicalUnits[$details['id']] = $details; |
@@ -543,9 +543,9 @@ discard block |
||
| 543 | 543 | return $this->originalMetadataArray[$id]; |
| 544 | 544 | } |
| 545 | 545 | $iiifResource = $this->iiif->getContainedResourceById($id); |
| 546 | - $result = array(); |
|
| 546 | + $result = array (); |
|
| 547 | 547 | if ($iiifResource != null) { |
| 548 | - if ($iiifResource->getLabel()!=null && $iiifResource->getLabel() != "") { |
|
| 548 | + if ($iiifResource->getLabel() != null && $iiifResource->getLabel() != "") { |
|
| 549 | 549 | $result['label'] = $iiifResource->getLabel(); |
| 550 | 550 | } |
| 551 | 551 | if (!empty($iiifResource->getMetadata())) { |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != null) { |
| 622 | 622 | if (is_string($values)) { |
| 623 | 623 | $metadata[$resArray['index_name']] = array (trim((string) $values)); |
| 624 | - } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data())>1 ) { |
|
| 624 | + } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) { |
|
| 625 | 625 | $metadata[$resArray['index_name']] = array (); |
| 626 | 626 | foreach ($values->data() as $value) { |
| 627 | 627 | $metadata[$resArray['index_name']][] = trim((string) $value); |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != null)) { |
| 639 | 639 | if ($values instanceof string) { |
| 640 | 640 | $metadata[$resArray['index_name'].'_sorting'][0] = array (trim((string) $values)); |
| 641 | - } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()>1 )) { |
|
| 641 | + } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data() > 1)) { |
|
| 642 | 642 | $metadata[$resArray['index_name']] = array (); |
| 643 | 643 | foreach ($values->data() as $value) { |
| 644 | 644 | $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $value); |
@@ -750,13 +750,13 @@ discard block |
||
| 750 | 750 | // Get annotation containers |
| 751 | 751 | $annotationContainerIds = $this->physicalStructureInfo[$id]['annotationContainers']; |
| 752 | 752 | if (!empty($annotationContainerIds)) { |
| 753 | - $annotationTexts = array(); |
|
| 753 | + $annotationTexts = array (); |
|
| 754 | 754 | foreach ($annotationContainerIds as $annotationListId) { |
| 755 | 755 | $annotationContainer = $this->iiif->getContainedResourceById($annotationListId); |
| 756 | 756 | /* @var $annotationContainer \Ubl\Iiif\Presentation\Common\Model\Resources\AnnotationContainerInterface */ |
| 757 | 757 | foreach ($annotationContainer->getTextAnnotations(Motivation::PAINTING) as $annotation) { |
| 758 | 758 | if ($annotation->getTargetResourceId() == $iiifResource->getId() && |
| 759 | - $annotation->getBody()!=null && $annotation->getBody()->getChars()!=null) { |
|
| 759 | + $annotation->getBody() != null && $annotation->getBody()->getChars() != null) { |
|
| 760 | 760 | $annotationTexts[] = $annotation->getBody()->getChars(); |
| 761 | 761 | } |
| 762 | 762 | } |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 807 | 807 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 808 | 808 | $resource = IiifHelper::loadIiifResource($content); |
| 809 | - if ($resource != null ) { |
|
| 809 | + if ($resource != null) { |
|
| 810 | 810 | if ($resource instanceof ManifestInterface) { |
| 811 | 811 | $this->iiif = $resource; |
| 812 | 812 | return true; |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 920 | 920 | $resource = IiifHelper::loadIiifResource($this->asJson); |
| 921 | 921 | if ($resource != null && $resource instanceof ManifestInterface) { |
| 922 | - $this->asJson=''; |
|
| 922 | + $this->asJson = ''; |
|
| 923 | 923 | $this->iiif = $resource; |
| 924 | 924 | $this->init(); |
| 925 | 925 | } 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 |
@@ -141,8 +139,7 @@ discard block |
||
| 141 | 139 | * {@inheritDoc} |
| 142 | 140 | * @see Document::getDocument() |
| 143 | 141 | */ |
| 144 | - protected function getDocument() |
|
| 145 | - { |
|
| 142 | + protected function getDocument() { |
|
| 146 | 143 | return $this->iiif; |
| 147 | 144 | } |
| 148 | 145 | |
@@ -196,8 +193,7 @@ discard block |
||
| 196 | 193 | * |
| 197 | 194 | * @return array|string |
| 198 | 195 | */ |
| 199 | - protected function getUseGroups($use) |
|
| 200 | - { |
|
| 196 | + protected function getUseGroups($use) { |
|
| 201 | 197 | if (!$this->useGrpsLoaded) { |
| 202 | 198 | // Get configured USE attributes. |
| 203 | 199 | $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
@@ -224,8 +220,7 @@ discard block |
||
| 224 | 220 | * {@inheritDoc} |
| 225 | 221 | * @see Document::_getPhysicalStructure() |
| 226 | 222 | */ |
| 227 | - protected function _getPhysicalStructure() |
|
| 228 | - { |
|
| 223 | + protected function _getPhysicalStructure() { |
|
| 229 | 224 | // Is there no physical structure array yet? |
| 230 | 225 | if (!$this->physicalStructureLoaded) { |
| 231 | 226 | if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
@@ -359,8 +354,7 @@ discard block |
||
| 359 | 354 | * {@inheritDoc} |
| 360 | 355 | * @see Document::getFileLocation() |
| 361 | 356 | */ |
| 362 | - public function getFileLocation($id) |
|
| 363 | - { |
|
| 357 | + public function getFileLocation($id) { |
|
| 364 | 358 | if ($id == null) { |
| 365 | 359 | return null; |
| 366 | 360 | } |
@@ -384,8 +378,7 @@ discard block |
||
| 384 | 378 | * {@inheritDoc} |
| 385 | 379 | * @see Document::getFileMimeType() |
| 386 | 380 | */ |
| 387 | - public function getFileMimeType($id) |
|
| 388 | - { |
|
| 381 | + public function getFileMimeType($id) { |
|
| 389 | 382 | $fileResource = $this->iiif->getContainedResourceById($id); |
| 390 | 383 | if ($fileResource instanceof CanvasInterface) { |
| 391 | 384 | $format = "application/vnd.kitodo.iiif"; |
@@ -410,8 +403,7 @@ discard block |
||
| 410 | 403 | * {@inheritDoc} |
| 411 | 404 | * @see Document::getLogicalStructure() |
| 412 | 405 | */ |
| 413 | - public function getLogicalStructure($id, $recursive = FALSE) |
|
| 414 | - { |
|
| 406 | + public function getLogicalStructure($id, $recursive = FALSE) { |
|
| 415 | 407 | $details = array (); |
| 416 | 408 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
| 417 | 409 | return $this->logicalUnits[$id]; |
@@ -580,8 +572,7 @@ discard block |
||
| 580 | 572 | * {@inheritDoc} |
| 581 | 573 | * @see Document::getMetadata() |
| 582 | 574 | */ |
| 583 | - public function getMetadata($id, $cPid = 0) |
|
| 584 | - { |
|
| 575 | + public function getMetadata($id, $cPid = 0) { |
|
| 585 | 576 | if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) { |
| 586 | 577 | return $this->metadataArray[$id]; |
| 587 | 578 | } |
@@ -704,8 +695,7 @@ discard block |
||
| 704 | 695 | * @param CanvasInterface $canvas |
| 705 | 696 | * @param IiifResourceInterface $resource |
| 706 | 697 | */ |
| 707 | - private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) |
|
| 708 | - { |
|
| 698 | + private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) { |
|
| 709 | 699 | $this->smLinks['l2p'][$resource->getId()][] = $canvas->getId(); |
| 710 | 700 | if (!is_array($this->smLinks['p2l'][$canvas->getId()]) || !in_array($resource->getId(), $this->smLinks['p2l'][$canvas->getId()])) { |
| 711 | 701 | $this->smLinks['p2l'][$canvas->getId()][] = $resource->getId(); |
@@ -720,8 +710,7 @@ discard block |
||
| 720 | 710 | * |
| 721 | 711 | * @see Document::getParentDocumentUidForSaving() |
| 722 | 712 | */ |
| 723 | - protected function getParentDocumentUidForSaving($pid, $core) |
|
| 724 | - { |
|
| 713 | + protected function getParentDocumentUidForSaving($pid, $core) { |
|
| 725 | 714 | // Do nothing. |
| 726 | 715 | } |
| 727 | 716 | |
@@ -780,8 +769,7 @@ discard block |
||
| 780 | 769 | * |
| 781 | 770 | * @return IiifResourceInterface |
| 782 | 771 | */ |
| 783 | - public function getIiif() |
|
| 784 | - { |
|
| 772 | + public function getIiif() { |
|
| 785 | 773 | return $this->iiif; |
| 786 | 774 | } |
| 787 | 775 | |
@@ -789,8 +777,7 @@ discard block |
||
| 789 | 777 | * {@inheritDoc} |
| 790 | 778 | * @see Document::init() |
| 791 | 779 | */ |
| 792 | - protected function init() |
|
| 793 | - { |
|
| 780 | + protected function init() { |
|
| 794 | 781 | // Nothing to do here, at the moment |
| 795 | 782 | } |
| 796 | 783 | |
@@ -798,8 +785,7 @@ discard block |
||
| 798 | 785 | * {@inheritDoc} |
| 799 | 786 | * @see Document::loadLocation() |
| 800 | 787 | */ |
| 801 | - protected function loadLocation($location) |
|
| 802 | - { |
|
| 788 | + protected function loadLocation($location) { |
|
| 803 | 789 | $content = GeneralUtility::getUrl($location); |
| 804 | 790 | $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 805 | 791 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
@@ -820,8 +806,7 @@ discard block |
||
| 820 | 806 | * {@inheritDoc} |
| 821 | 807 | * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray() |
| 822 | 808 | */ |
| 823 | - protected function prepareMetadataArray($cPid) |
|
| 824 | - { |
|
| 809 | + protected function prepareMetadataArray($cPid) { |
|
| 825 | 810 | $id = $this->iiif->getId(); |
| 826 | 811 | $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid); |
| 827 | 812 | } |
@@ -842,8 +827,7 @@ discard block |
||
| 842 | 827 | * {@inheritDoc} |
| 843 | 828 | * @see Document::ensureHasFulltextIsSet() |
| 844 | 829 | */ |
| 845 | - protected function ensureHasFulltextIsSet() |
|
| 846 | - { |
|
| 830 | + protected function ensureHasFulltextIsSet() { |
|
| 847 | 831 | /* |
| 848 | 832 | * TODO Check annotations and annotation lists of canvas for ALTO documents. |
| 849 | 833 | * Example: |
@@ -885,8 +869,7 @@ discard block |
||
| 885 | 869 | * {@inheritDoc} |
| 886 | 870 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
| 887 | 871 | */ |
| 888 | - protected function _getThumbnail($forceReload = FALSE) |
|
| 889 | - { |
|
| 872 | + protected function _getThumbnail($forceReload = FALSE) { |
|
| 890 | 873 | return $this->iiif->getThumbnailUrl(); |
| 891 | 874 | } |
| 892 | 875 | |
@@ -894,8 +877,7 @@ discard block |
||
| 894 | 877 | * {@inheritDoc} |
| 895 | 878 | * @see \Kitodo\Dlf\Common\Document::_getToplevelId() |
| 896 | 879 | */ |
| 897 | - protected function _getToplevelId() |
|
| 898 | - { |
|
| 880 | + protected function _getToplevelId() { |
|
| 899 | 881 | if (empty($this->toplevelId)) { |
| 900 | 882 | if (isset($this->iiif)) { |
| 901 | 883 | $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. |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | { |
| 229 | 229 | // Is there no physical structure array yet? |
| 230 | 230 | if (!$this->physicalStructureLoaded) { |
| 231 | - if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
|
| 232 | - return null; |
|
| 231 | + if ($this->iiif == NULL || !($this->iiif instanceof ManifestInterface)) { |
|
| 232 | + return NULL; |
|
| 233 | 233 | } |
| 234 | 234 | $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 235 | 235 | $iiifId = $this->iiif->getId(); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $this->physicalStructureInfo[$physSeq[0]]['label'] = $this->iiif->getLabelForDisplay(); |
| 240 | 240 | $this->physicalStructureInfo[$physSeq[0]]['orderlabel'] = $this->iiif->getLabelForDisplay(); |
| 241 | 241 | $this->physicalStructureInfo[$physSeq[0]]['type'] = 'physSequence'; |
| 242 | - $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = null; |
|
| 242 | + $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = NULL; |
|
| 243 | 243 | $fileUseDownload = $this->getUseGroups('fileGrpDownload'); |
| 244 | 244 | $fileUseFulltext = $this->getUseGroups('fileGrpFulltext'); |
| 245 | 245 | $fileUseThumbs = $this->getUseGroups('fileGrpThumbs'); |
@@ -253,14 +253,14 @@ discard block |
||
| 253 | 253 | if (isset($fileUseFulltext)) { |
| 254 | 254 | $iiifAlto = $this->iiif->getSeeAlsoUrlsForFormat("application/alto+xml"); |
| 255 | 255 | if (empty($iiifAlto)) { |
| 256 | - $iiifAlto = $this->iiif->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/", true); |
|
| 256 | + $iiifAlto = $this->iiif->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/", TRUE); |
|
| 257 | 257 | } |
| 258 | 258 | if (!empty($iiifAlto)) { |
| 259 | 259 | // TODO use multiple possible alto files? |
| 260 | 260 | $this->mimeTypes[$iiifAlto[0]] = "application/alto+xml"; |
| 261 | 261 | $this->physicalStructureInfo[$physSeq[0]]['files'][$fileUseFulltext] = $iiifAlto[0]; |
| 262 | - $this->hasFulltext = true; |
|
| 263 | - $this->hasFulltextSet = true; |
|
| 262 | + $this->hasFulltext = TRUE; |
|
| 263 | + $this->hasFulltextSet = TRUE; |
|
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | if (!empty($this->iiif->getDefaultCanvases())) { |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | // put images in all non specific filegroups |
| 278 | 278 | if (isset($fileUses)) { |
| 279 | 279 | foreach ($fileUses as $fileUse) { |
| 280 | - if ($image->getBody() != null && $image->getBody() instanceof ContentResourceInterface) { |
|
| 280 | + if ($image->getBody() != NULL && $image->getBody() instanceof ContentResourceInterface) { |
|
| 281 | 281 | $this->physicalStructureInfo[$physSeq[0]]['files'][$fileUse] = $image->getBody()->getId(); |
| 282 | 282 | } |
| 283 | 283 | } |
@@ -285,40 +285,40 @@ discard block |
||
| 285 | 285 | // populate structural metadata info |
| 286 | 286 | $elements[$canvasOrder] = $canvas->getId(); |
| 287 | 287 | $this->physicalStructureInfo[$elements[$canvasOrder]]['id']=$canvas->getId(); |
| 288 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId']=null; |
|
| 288 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId']=NULL; |
|
| 289 | 289 | $this->physicalStructureInfo[$elements[$canvasOrder]]['label']=$canvas->getLabelForDisplay(); |
| 290 | 290 | $this->physicalStructureInfo[$elements[$canvasOrder]]['orderlabel']=$canvas->getLabelForDisplay(); |
| 291 | 291 | // assume that a canvas always represents a page |
| 292 | 292 | $this->physicalStructureInfo[$elements[$canvasOrder]]['type']='page'; |
| 293 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds']=null; |
|
| 294 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = null; |
|
| 293 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds']=NULL; |
|
| 294 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = NULL; |
|
| 295 | 295 | if (!empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
| 296 | 296 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = array(); |
| 297 | 297 | $this->physicalStructureInfo[$physSeq[0]]['annotationContainers'] = array(); |
| 298 | 298 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 299 | 299 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'][] = $annotationContainer->getId(); |
| 300 | 300 | if ($extConf['indexAnnotations']) { |
| 301 | - $this->hasFulltext = true; |
|
| 302 | - $this->hasFulltextSet = true; |
|
| 301 | + $this->hasFulltext = TRUE; |
|
| 302 | + $this->hasFulltextSet = TRUE; |
|
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | if (isset($fileUseFulltext)) { |
| 307 | 307 | $alto = $canvas->getSeeAlsoUrlsForFormat("application/alto+xml"); |
| 308 | 308 | if (empty($alto)) { |
| 309 | - $alto = $canvas->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/", true); |
|
| 309 | + $alto = $canvas->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/", TRUE); |
|
| 310 | 310 | } |
| 311 | 311 | if (!empty($alto)) { |
| 312 | 312 | // TODO use all possible alto files? |
| 313 | 313 | $this->mimeTypes[$alto[0]] = "application/alto+xml"; |
| 314 | 314 | $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUseFulltext] = $alto[0]; |
| 315 | - $this->hasFulltext = true; |
|
| 316 | - $this->hasFulltextSet = true; |
|
| 315 | + $this->hasFulltext = TRUE; |
|
| 316 | + $this->hasFulltextSet = TRUE; |
|
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | if (isset($fileUses)) { |
| 320 | 320 | foreach ($fileUses as $fileUse) { |
| 321 | - if ($image->getBody() != null && $image->getBody() instanceof ContentResourceInterface) { |
|
| 321 | + if ($image->getBody() != NULL && $image->getBody() instanceof ContentResourceInterface) { |
|
| 322 | 322 | $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUse] = $image->getBody()->getId(); |
| 323 | 323 | } |
| 324 | 324 | } |
@@ -361,15 +361,15 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | public function getFileLocation($id) |
| 363 | 363 | { |
| 364 | - if ($id == null) { |
|
| 365 | - return null; |
|
| 364 | + if ($id == NULL) { |
|
| 365 | + return NULL; |
|
| 366 | 366 | } |
| 367 | 367 | $resource = $this->iiif->getContainedResourceById($id); |
| 368 | 368 | if (isset($resource)) { |
| 369 | 369 | if ($resource instanceof CanvasInterface) { |
| 370 | - return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != null) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id; |
|
| 370 | + return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != NULL) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id; |
|
| 371 | 371 | } elseif ($resource instanceof ContentResourceInterface) { |
| 372 | - return $resource->getSingleService() != null && $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id; |
|
| 372 | + return $resource->getSingleService() != NULL && $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id; |
|
| 373 | 373 | } elseif ($resource instanceof AbstractImageService) { |
| 374 | 374 | return $resource->getId(); |
| 375 | 375 | } elseif ($resource instanceof AnnotationContainerInterface) { |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | } elseif ($fileResource instanceof AnnotationInterface) { |
| 393 | 393 | $format = "application/vnd.kitodo.iiif"; |
| 394 | 394 | } elseif ($fileResource instanceof ContentResourceInterface) { |
| 395 | - if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == null || !($fileResource->getSingleService() instanceof AbstractImageService))) { |
|
| 395 | + if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == NULL || !($fileResource->getSingleService() instanceof AbstractImageService))) { |
|
| 396 | 396 | // Support static images without an image service |
| 397 | 397 | return $fileResource->getFormat(); |
| 398 | 398 | } |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | // cache the ranges - they might occure multiple times in the structures "tree" - with full data as well as referenced as id |
| 428 | 428 | $processedStructures = array(); |
| 429 | 429 | foreach ($logUnits as $logUnit) { |
| 430 | - if (array_search($logUnit->getId(), $processedStructures) == false) { |
|
| 430 | + if (array_search($logUnit->getId(), $processedStructures) == FALSE) { |
|
| 431 | 431 | $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, TRUE, $processedStructures); |
| 432 | 432 | } |
| 433 | 433 | } |
@@ -446,12 +446,12 @@ discard block |
||
| 446 | 446 | * @param array $processedStructures: IIIF resources that already have been processed |
| 447 | 447 | * @return array Logical structure array |
| 448 | 448 | */ |
| 449 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = array()) { |
|
| 449 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = FALSE, &$processedStructures = array()) { |
|
| 450 | 450 | $details = array (); |
| 451 | 451 | $details['id'] = $resource->getId(); |
| 452 | 452 | $details['dmdId'] = ''; |
| 453 | - $details['label'] = $resource->getLabelForDisplay() !== null ? $resource->getLabelForDisplay() : ''; |
|
| 454 | - $details['orderlabel'] = $resource->getLabelForDisplay() !== null ? $resource->getLabelForDisplay() : ''; |
|
| 453 | + $details['label'] = $resource->getLabelForDisplay() !== NULL ? $resource->getLabelForDisplay() : ''; |
|
| 454 | + $details['orderlabel'] = $resource->getLabelForDisplay() !== NULL ? $resource->getLabelForDisplay() : ''; |
|
| 455 | 455 | $details['contentIds'] = ''; |
| 456 | 456 | $details['volume'] = ''; |
| 457 | 457 | $details['pagination'] = ''; |
@@ -476,10 +476,10 @@ discard block |
||
| 476 | 476 | $startCanvas = $resource->getStartCanvasOrFirstCanvas(); |
| 477 | 477 | $canvases = $resource->getAllCanvases(); |
| 478 | 478 | } |
| 479 | - if ($startCanvas != null) { |
|
| 479 | + if ($startCanvas != NULL) { |
|
| 480 | 480 | $details['pagination'] = $startCanvas->getLabel(); |
| 481 | 481 | $startCanvasIndex = array_search($startCanvas, $this->iiif->getDefaultCanvases()); |
| 482 | - if ($startCanvasIndex!==false) { |
|
| 482 | + if ($startCanvasIndex!==FALSE) { |
|
| 483 | 483 | $details['points'] = $startCanvasIndex + 1; |
| 484 | 484 | } |
| 485 | 485 | } |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | if ($recursive) { |
| 494 | 494 | $processedStructures[] = $resource->getId(); |
| 495 | 495 | $details['children'] = array (); |
| 496 | - if ($resource instanceof ManifestInterface && $resource->getRootRanges() != null) { |
|
| 496 | + if ($resource instanceof ManifestInterface && $resource->getRootRanges() != NULL) { |
|
| 497 | 497 | $rangesToAdd = []; |
| 498 | 498 | $rootRanges = []; |
| 499 | 499 | if (sizeof($this->iiif->getRootRanges()) == 1 && $this->iiif->getRootRanges()[0]->isTopRange()) { |
@@ -505,14 +505,14 @@ discard block |
||
| 505 | 505 | $rootRanges[] = $range; |
| 506 | 506 | } |
| 507 | 507 | foreach ($rootRanges as $range) { |
| 508 | - if ((array_search($range->getId(), $processedStructures) == false)) { |
|
| 508 | + if ((array_search($range->getId(), $processedStructures) == FALSE)) { |
|
| 509 | 509 | $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures); |
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | } elseif ($resource instanceof RangeInterface) { |
| 513 | 513 | if (!empty($resource->getAllRanges())) { |
| 514 | 514 | foreach ($resource->getAllRanges() as $range) { |
| 515 | - if ((array_search($range->getId(), $processedStructures) == false)) { |
|
| 515 | + if ((array_search($range->getId(), $processedStructures) == FALSE)) { |
|
| 516 | 516 | $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures); |
| 517 | 517 | } |
| 518 | 518 | } |
@@ -538,14 +538,14 @@ discard block |
||
| 538 | 538 | * |
| 539 | 539 | * @todo This method is still in experimental; the method signature may change. |
| 540 | 540 | */ |
| 541 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) { |
|
| 541 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = TRUE, $withRights = TRUE, $withRelated = TRUE) { |
|
| 542 | 542 | if (!empty($this->originalMetadataArray[$id])) { |
| 543 | 543 | return $this->originalMetadataArray[$id]; |
| 544 | 544 | } |
| 545 | 545 | $iiifResource = $this->iiif->getContainedResourceById($id); |
| 546 | 546 | $result = array(); |
| 547 | - if ($iiifResource != null) { |
|
| 548 | - if ($iiifResource->getLabel()!=null && $iiifResource->getLabel() != "") { |
|
| 547 | + if ($iiifResource != NULL) { |
|
| 548 | + if ($iiifResource->getLabel()!=NULL && $iiifResource->getLabel() != "") { |
|
| 549 | 549 | $result['label'] = $iiifResource->getLabel(); |
| 550 | 550 | } |
| 551 | 551 | if (!empty($iiifResource->getMetadata())) { |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | $iiifResource = $this->iiif->getContainedResourceById($id); |
| 619 | 619 | while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
| 620 | 620 | // Set metadata field's value(s). |
| 621 | - if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != null) { |
|
| 621 | + if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != NULL) { |
|
| 622 | 622 | if (is_string($values)) { |
| 623 | 623 | $metadata[$resArray['index_name']] = array (trim((string) $values)); |
| 624 | 624 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data())>1 ) { |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | // Set sorting value if applicable. |
| 636 | 636 | if (!empty($metadata[$resArray['index_name']]) && $resArray['is_sortable']) { |
| 637 | 637 | if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting']) |
| 638 | - && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != null)) { |
|
| 638 | + && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != NULL)) { |
|
| 639 | 639 | if ($values instanceof string) { |
| 640 | 640 | $metadata[$resArray['index_name'].'_sorting'][0] = array (trim((string) $values)); |
| 641 | 641 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()>1 )) { |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | $this->smLinkRangeCanvasesRecursively($range); |
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | - $this->smLinksLoaded = true; |
|
| 672 | + $this->smLinksLoaded = TRUE; |
|
| 673 | 673 | } |
| 674 | 674 | return $this->smLinks; |
| 675 | 675 | } |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | /* @var $annotationContainer \Ubl\Iiif\Presentation\Common\Model\Resources\AnnotationContainerInterface */ |
| 757 | 757 | foreach ($annotationContainer->getTextAnnotations(Motivation::PAINTING) as $annotation) { |
| 758 | 758 | if ($annotation->getTargetResourceId() == $iiifResource->getId() && |
| 759 | - $annotation->getBody()!=null && $annotation->getBody()->getChars()!=null) { |
|
| 759 | + $annotation->getBody()!=NULL && $annotation->getBody()->getChars()!=NULL) { |
|
| 760 | 760 | $annotationTexts[] = $annotation->getBody()->getChars(); |
| 761 | 761 | } |
| 762 | 762 | } |
@@ -806,10 +806,10 @@ discard block |
||
| 806 | 806 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 807 | 807 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 808 | 808 | $resource = IiifHelper::loadIiifResource($content); |
| 809 | - if ($resource != null ) { |
|
| 809 | + if ($resource != NULL ) { |
|
| 810 | 810 | if ($resource instanceof ManifestInterface) { |
| 811 | 811 | $this->iiif = $resource; |
| 812 | - return true; |
|
| 812 | + return TRUE; |
|
| 813 | 813 | } |
| 814 | 814 | } else { |
| 815 | 815 | Helper::devLog('Could not load IIIF manifest from "'.$location.'"', self::$extKey, SYSLOG_SEVERITY_ERROR); |
@@ -833,9 +833,9 @@ discard block |
||
| 833 | 833 | protected function setPreloadedDocument($preloadedDocument) { |
| 834 | 834 | if ($preloadedDocument instanceof ManifestInterface) { |
| 835 | 835 | $this->iiif = $preloadedDocument; |
| 836 | - return true; |
|
| 836 | + return TRUE; |
|
| 837 | 837 | } |
| 838 | - return false; |
|
| 838 | + return FALSE; |
|
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | /** |
@@ -856,20 +856,20 @@ discard block |
||
| 856 | 856 | foreach ($canvases as $canvas) { |
| 857 | 857 | if (!empty($canvas->getSeeAlsoUrlsForFormat("application/alto+xml")) || |
| 858 | 858 | !empty($canvas->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/"))) { |
| 859 | - $this->hasFulltextSet = true; |
|
| 860 | - $this->hasFulltext = true; |
|
| 859 | + $this->hasFulltextSet = TRUE; |
|
| 860 | + $this->hasFulltext = TRUE; |
|
| 861 | 861 | return; |
| 862 | 862 | } |
| 863 | 863 | $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 864 | 864 | if ($extConf['indexAnnotations'] == 1 && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
| 865 | 865 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 866 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
| 866 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
| 867 | 867 | foreach ($textAnnotations as $annotation) { |
| 868 | - if ($annotation->getBody() != null && |
|
| 868 | + if ($annotation->getBody() != NULL && |
|
| 869 | 869 | $annotation->getBody()->getFormat() == "text/plain" && |
| 870 | - $annotation->getBody()->getChars() != null) { |
|
| 871 | - $this->hasFulltextSet = true; |
|
| 872 | - $this->hasFulltext = true; |
|
| 870 | + $annotation->getBody()->getChars() != NULL) { |
|
| 871 | + $this->hasFulltextSet = TRUE; |
|
| 872 | + $this->hasFulltext = TRUE; |
|
| 873 | 873 | return; |
| 874 | 874 | } |
| 875 | 875 | } |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | } |
| 878 | 878 | } |
| 879 | 879 | } |
| 880 | - $this->hasFulltextSet = true; |
|
| 880 | + $this->hasFulltextSet = TRUE; |
|
| 881 | 881 | } |
| 882 | 882 | } |
| 883 | 883 | |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 919 | 919 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 920 | 920 | $resource = IiifHelper::loadIiifResource($this->asJson); |
| 921 | - if ($resource != null && $resource instanceof ManifestInterface) { |
|
| 921 | + if ($resource != NULL && $resource instanceof ManifestInterface) { |
|
| 922 | 922 | $this->asJson=''; |
| 923 | 923 | $this->iiif = $resource; |
| 924 | 924 | $this->init(); |