@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $fileMimeType = $this->getFileMimeType($id); |
| 170 | 170 | $fileLocation = $this->getFileLocation($id); |
| 171 | 171 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
| 172 | - $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation . 'info.json' : $fileLocation . '/info.json'); |
|
| 172 | + $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation.'info.json' : $fileLocation.'/info.json'); |
|
| 173 | 173 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 174 | 174 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 175 | 175 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | return $service->getImageUrl(); |
| 180 | 180 | } |
| 181 | 181 | } elseif ($fileMimeType === 'application/vnd.netfpx') { |
| 182 | - $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : ''); |
|
| 182 | + $baseURL = $fileLocation.(strpos($fileLocation, '?') === false ? '?' : ''); |
|
| 183 | 183 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
| 184 | - return $baseURL . '&CVT=jpeg'; |
|
| 184 | + return $baseURL.'&CVT=jpeg'; |
|
| 185 | 185 | } |
| 186 | 186 | return $fileLocation; |
| 187 | 187 | } |
@@ -192,14 +192,14 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function getFileLocation($id) |
| 194 | 194 | { |
| 195 | - $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
| 195 | + $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
| 196 | 196 | if ( |
| 197 | 197 | !empty($id) |
| 198 | 198 | && !empty($location) |
| 199 | 199 | ) { |
| 200 | 200 | return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 201 | 201 | } else { |
| 202 | - Helper::devLog('There is no file node with @ID "' . $id . '"', DEVLOG_SEVERITY_WARNING); |
|
| 202 | + Helper::devLog('There is no file node with @ID "'.$id.'"', DEVLOG_SEVERITY_WARNING); |
|
| 203 | 203 | return ''; |
| 204 | 204 | } |
| 205 | 205 | } |
@@ -210,14 +210,14 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function getFileMimeType($id) |
| 212 | 212 | { |
| 213 | - $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
|
| 213 | + $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'); |
|
| 214 | 214 | if ( |
| 215 | 215 | !empty($id) |
| 216 | 216 | && !empty($mimetype) |
| 217 | 217 | ) { |
| 218 | 218 | return (string) $mimetype[0]; |
| 219 | 219 | } else { |
| 220 | - Helper::devLog('There is no file node with @ID "' . $id . '" or no MIME type specified', DEVLOG_SEVERITY_WARNING); |
|
| 220 | + Helper::devLog('There is no file node with @ID "'.$id.'" or no MIME type specified', DEVLOG_SEVERITY_WARNING); |
|
| 221 | 221 | return ''; |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | return $this->logicalUnits[$id]; |
| 239 | 239 | } elseif (!empty($id)) { |
| 240 | 240 | // Get specified logical unit. |
| 241 | - $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]'); |
|
| 241 | + $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]'); |
|
| 242 | 242 | } else { |
| 243 | 243 | // Get all logical units at top level. |
| 244 | 244 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | // Retain current PID. |
| 379 | 379 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 380 | 380 | } elseif (!$cPid) { |
| 381 | - Helper::devLog('Invalid PID ' . $cPid . ' for metadata definitions', DEVLOG_SEVERITY_WARNING); |
|
| 381 | + Helper::devLog('Invalid PID '.$cPid.' for metadata definitions', DEVLOG_SEVERITY_WARNING); |
|
| 382 | 382 | return []; |
| 383 | 383 | } |
| 384 | 384 | // Get metadata from parsed metadata array if available. |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | if (!empty($this->logicalUnits[$id])) { |
| 420 | 420 | $dmdIds = $this->logicalUnits[$id]['dmdId']; |
| 421 | 421 | } else { |
| 422 | - $dmdIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@DMDID'); |
|
| 422 | + $dmdIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@DMDID'); |
|
| 423 | 423 | $dmdIds = (string) $dmdIds[0]; |
| 424 | 424 | } |
| 425 | 425 | if (!empty($dmdIds)) { |
@@ -445,11 +445,11 @@ discard block |
||
| 445 | 445 | ) { |
| 446 | 446 | $obj->extractMetadata($this->dmdSec[$dmdId]['xml'], $metadata); |
| 447 | 447 | } else { |
| 448 | - Helper::devLog('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->dmdSec[$dmdId]['type'] . '"', DEVLOG_SEVERITY_WARNING); |
|
| 448 | + Helper::devLog('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->dmdSec[$dmdId]['type'].'"', DEVLOG_SEVERITY_WARNING); |
|
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | } else { |
| 452 | - Helper::devLog('Unsupported metadata format "' . $this->dmdSec[$dmdId]['type'] . '" in dmdSec with @ID "' . $dmdId . '"', DEVLOG_SEVERITY_NOTICE); |
|
| 452 | + Helper::devLog('Unsupported metadata format "'.$this->dmdSec[$dmdId]['type'].'" in dmdSec with @ID "'.$dmdId.'"', DEVLOG_SEVERITY_NOTICE); |
|
| 453 | 453 | // Continue searching for supported metadata with next @DMDID. |
| 454 | 454 | continue; |
| 455 | 455 | } |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | if (!empty($this->logicalUnits[$id])) { |
| 458 | 458 | $metadata['type'] = [$this->logicalUnits[$id]['type']]; |
| 459 | 459 | } else { |
| 460 | - $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE'); |
|
| 460 | + $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
|
| 461 | 461 | if (!empty($struct)) { |
| 462 | 462 | $metadata['type'] = [(string) $struct[0]]; |
| 463 | 463 | } |
@@ -574,13 +574,13 @@ discard block |
||
| 574 | 574 | $values instanceof \DOMNodeList |
| 575 | 575 | && $values->length > 0 |
| 576 | 576 | ) { |
| 577 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 577 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 578 | 578 | } elseif (!($values instanceof \DOMNodeList)) { |
| 579 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values); |
|
| 579 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values); |
|
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
| 583 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 582 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
| 583 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 584 | 584 | } |
| 585 | 585 | } |
| 586 | 586 | } |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | if ($hasSupportedMetadata) { |
| 643 | 643 | return $metadata; |
| 644 | 644 | } else { |
| 645 | - Helper::devLog('No supported metadata found for logical structure with @ID "' . $id . '"', DEVLOG_SEVERITY_WARNING); |
|
| 645 | + Helper::devLog('No supported metadata found for logical structure with @ID "'.$id.'"', DEVLOG_SEVERITY_WARNING); |
|
| 646 | 646 | return []; |
| 647 | 647 | } |
| 648 | 648 | } |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | */ |
| 673 | 673 | public function getStructureDepth($logId) |
| 674 | 674 | { |
| 675 | - $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
|
| 675 | + $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'); |
|
| 676 | 676 | if (!empty($ancestors)) { |
| 677 | 677 | return count($ancestors); |
| 678 | 678 | } else { |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | // Register namespaces. |
| 695 | 695 | $this->registerNamespaces($this->mets); |
| 696 | 696 | } else { |
| 697 | - Helper::devLog('No METS part found in document with UID ' . $this->uid, DEVLOG_SEVERITY_ERROR); |
|
| 697 | + Helper::devLog('No METS part found in document with UID '.$this->uid, DEVLOG_SEVERITY_ERROR); |
|
| 698 | 698 | } |
| 699 | 699 | } |
| 700 | 700 | |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | return true; |
| 723 | 723 | } |
| 724 | 724 | } |
| 725 | - Helper::devLog('Could not load XML file from "' . $location . '"', DEVLOG_SEVERITY_ERROR); |
|
| 725 | + Helper::devLog('Could not load XML file from "'.$location.'"', DEVLOG_SEVERITY_ERROR); |
|
| 726 | 726 | return false; |
| 727 | 727 | } |
| 728 | 728 | |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | { |
| 747 | 747 | $partof = 0; |
| 748 | 748 | // Get the closest ancestor of the current document which has a MPTR child. |
| 749 | - $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->_getToplevelId() . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
| 749 | + $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->_getToplevelId().'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
| 750 | 750 | if (!empty($parentMptr)) { |
| 751 | 751 | $parentLocation = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 752 | 752 | if ($parentLocation != $this->location) { |
@@ -813,15 +813,15 @@ discard block |
||
| 813 | 813 | $dmdIds = $this->mets->xpath('./mets:dmdSec/@ID'); |
| 814 | 814 | if (!empty($dmdIds)) { |
| 815 | 815 | foreach ($dmdIds as $dmdId) { |
| 816 | - if ($type = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) { |
|
| 816 | + if ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) { |
|
| 817 | 817 | if (!empty($this->formats[(string) $type[0]])) { |
| 818 | 818 | $type = (string) $type[0]; |
| 819 | - $xml = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 819 | + $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 820 | 820 | } |
| 821 | - } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) { |
|
| 821 | + } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) { |
|
| 822 | 822 | if (!empty($this->formats[(string) $type[0]])) { |
| 823 | 823 | $type = (string) $type[0]; |
| 824 | - $xml = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 824 | + $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 825 | 825 | } |
| 826 | 826 | } |
| 827 | 827 | if (!empty($xml)) { |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | // Retain current PID. |
| 1007 | 1007 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 1008 | 1008 | if (!$cPid) { |
| 1009 | - Helper::devLog('Invalid PID ' . $cPid . ' for structure definitions', DEVLOG_SEVERITY_ERROR); |
|
| 1009 | + Helper::devLog('Invalid PID '.$cPid.' for structure definitions', DEVLOG_SEVERITY_ERROR); |
|
| 1010 | 1010 | $this->thumbnailLoaded = true; |
| 1011 | 1011 | return $this->thumbnail; |
| 1012 | 1012 | } |
@@ -1043,7 +1043,7 @@ discard block |
||
| 1043 | 1043 | if (!empty($resArray['thumbnail'])) { |
| 1044 | 1044 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid); |
| 1045 | 1045 | // Check if this document has a structure element of the desired type. |
| 1046 | - $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
|
| 1046 | + $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID'); |
|
| 1047 | 1047 | if (!empty($strctIds)) { |
| 1048 | 1048 | $strctId = (string) $strctIds[0]; |
| 1049 | 1049 | } |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | } |
| 1067 | 1067 | } |
| 1068 | 1068 | } else { |
| 1069 | - Helper::devLog('No structure of type "' . $metadata['type'][0] . '" found in database', DEVLOG_SEVERITY_ERROR); |
|
| 1069 | + Helper::devLog('No structure of type "'.$metadata['type'][0].'" found in database', DEVLOG_SEVERITY_ERROR); |
|
| 1070 | 1070 | } |
| 1071 | 1071 | $this->thumbnailLoaded = true; |
| 1072 | 1072 | } |
@@ -48,8 +48,7 @@ discard block |
||
| 48 | 48 | * @property-read string $toplevelId This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF) |
| 49 | 49 | * @property-read mixed $uid This holds the UID or the URL of the document |
| 50 | 50 | */ |
| 51 | -final class MetsDocument extends Document |
|
| 52 | -{ |
|
| 51 | +final class MetsDocument extends Document { |
|
| 53 | 52 | /** |
| 54 | 53 | * This holds the whole XML file as string for serialization purposes |
| 55 | 54 | * @see __sleep() / __wakeup() |
@@ -128,8 +127,7 @@ discard block |
||
| 128 | 127 | * |
| 129 | 128 | * @return void |
| 130 | 129 | */ |
| 131 | - public function addMetadataFromMets(&$metadata, $id) |
|
| 132 | - { |
|
| 130 | + public function addMetadataFromMets(&$metadata, $id) { |
|
| 133 | 131 | $details = $this->getLogicalStructure($id); |
| 134 | 132 | if (!empty($details)) { |
| 135 | 133 | $metadata['mets_order'][0] = $details['order']; |
@@ -143,8 +141,7 @@ discard block |
||
| 143 | 141 | * {@inheritDoc} |
| 144 | 142 | * @see \Kitodo\Dlf\Common\Document::establishRecordId() |
| 145 | 143 | */ |
| 146 | - protected function establishRecordId($pid) |
|
| 147 | - { |
|
| 144 | + protected function establishRecordId($pid) { |
|
| 148 | 145 | // Check for METS object @ID. |
| 149 | 146 | if (!empty($this->mets['OBJID'])) { |
| 150 | 147 | $this->recordId = (string) $this->mets['OBJID']; |
@@ -164,8 +161,7 @@ discard block |
||
| 164 | 161 | * {@inheritDoc} |
| 165 | 162 | * @see \Kitodo\Dlf\Common\Document::getDownloadLocation() |
| 166 | 163 | */ |
| 167 | - public function getDownloadLocation($id) |
|
| 168 | - { |
|
| 164 | + public function getDownloadLocation($id) { |
|
| 169 | 165 | $fileMimeType = $this->getFileMimeType($id); |
| 170 | 166 | $fileLocation = $this->getFileLocation($id); |
| 171 | 167 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
@@ -190,8 +186,7 @@ discard block |
||
| 190 | 186 | * {@inheritDoc} |
| 191 | 187 | * @see \Kitodo\Dlf\Common\Document::getFileLocation() |
| 192 | 188 | */ |
| 193 | - public function getFileLocation($id) |
|
| 194 | - { |
|
| 189 | + public function getFileLocation($id) { |
|
| 195 | 190 | $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
| 196 | 191 | if ( |
| 197 | 192 | !empty($id) |
@@ -208,8 +203,7 @@ discard block |
||
| 208 | 203 | * {@inheritDoc} |
| 209 | 204 | * @see \Kitodo\Dlf\Common\Document::getFileMimeType() |
| 210 | 205 | */ |
| 211 | - public function getFileMimeType($id) |
|
| 212 | - { |
|
| 206 | + public function getFileMimeType($id) { |
|
| 213 | 207 | $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
| 214 | 208 | if ( |
| 215 | 209 | !empty($id) |
@@ -226,8 +220,7 @@ discard block |
||
| 226 | 220 | * {@inheritDoc} |
| 227 | 221 | * @see \Kitodo\Dlf\Common\Document::getLogicalStructure() |
| 228 | 222 | */ |
| 229 | - public function getLogicalStructure($id, $recursive = false) |
|
| 230 | - { |
|
| 223 | + public function getLogicalStructure($id, $recursive = false) { |
|
| 231 | 224 | $details = []; |
| 232 | 225 | // Is the requested logical unit already loaded? |
| 233 | 226 | if ( |
@@ -267,8 +260,7 @@ discard block |
||
| 267 | 260 | * |
| 268 | 261 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
| 269 | 262 | */ |
| 270 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) |
|
| 271 | - { |
|
| 263 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) { |
|
| 272 | 264 | // Get attributes. |
| 273 | 265 | foreach ($structure->attributes() as $attribute => $value) { |
| 274 | 266 | $attributes[$attribute] = (string) $value; |
@@ -366,8 +358,7 @@ discard block |
||
| 366 | 358 | * {@inheritDoc} |
| 367 | 359 | * @see \Kitodo\Dlf\Common\Document::getMetadata() |
| 368 | 360 | */ |
| 369 | - public function getMetadata($id, $cPid = 0) |
|
| 370 | - { |
|
| 361 | + public function getMetadata($id, $cPid = 0) { |
|
| 371 | 362 | // Make sure $cPid is a non-negative integer. |
| 372 | 363 | $cPid = max(intval($cPid), 0); |
| 373 | 364 | // If $cPid is not given, try to get it elsewhere. |
@@ -651,8 +642,7 @@ discard block |
||
| 651 | 642 | * {@inheritDoc} |
| 652 | 643 | * @see \Kitodo\Dlf\Common\Document::getRawText() |
| 653 | 644 | */ |
| 654 | - public function getRawText($id) |
|
| 655 | - { |
|
| 645 | + public function getRawText($id) { |
|
| 656 | 646 | $rawText = ''; |
| 657 | 647 | // Get text from raw text array if available. |
| 658 | 648 | if (!empty($this->rawTextArray[$id])) { |
@@ -670,8 +660,7 @@ discard block |
||
| 670 | 660 | * {@inheritDoc} |
| 671 | 661 | * @see Document::getStructureDepth() |
| 672 | 662 | */ |
| 673 | - public function getStructureDepth($logId) |
|
| 674 | - { |
|
| 663 | + public function getStructureDepth($logId) { |
|
| 675 | 664 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
| 676 | 665 | if (!empty($ancestors)) { |
| 677 | 666 | return count($ancestors); |
@@ -684,8 +673,7 @@ discard block |
||
| 684 | 673 | * {@inheritDoc} |
| 685 | 674 | * @see \Kitodo\Dlf\Common\Document::init() |
| 686 | 675 | */ |
| 687 | - protected function init() |
|
| 688 | - { |
|
| 676 | + protected function init() { |
|
| 689 | 677 | // Get METS node from XML file. |
| 690 | 678 | $this->registerNamespaces($this->xml); |
| 691 | 679 | $mets = $this->xml->xpath('//mets:mets'); |
@@ -702,8 +690,7 @@ discard block |
||
| 702 | 690 | * {@inheritDoc} |
| 703 | 691 | * @see \Kitodo\Dlf\Common\Document::loadLocation() |
| 704 | 692 | */ |
| 705 | - protected function loadLocation($location) |
|
| 706 | - { |
|
| 693 | + protected function loadLocation($location) { |
|
| 707 | 694 | $fileResource = GeneralUtility::getUrl($location); |
| 708 | 695 | if ($fileResource !== false) { |
| 709 | 696 | // Turn off libxml's error logging. |
@@ -730,8 +717,7 @@ discard block |
||
| 730 | 717 | * {@inheritDoc} |
| 731 | 718 | * @see \Kitodo\Dlf\Common\Document::ensureHasFulltextIsSet() |
| 732 | 719 | */ |
| 733 | - protected function ensureHasFulltextIsSet() |
|
| 734 | - { |
|
| 720 | + protected function ensureHasFulltextIsSet() { |
|
| 735 | 721 | // Are the fileGrps already loaded? |
| 736 | 722 | if (!$this->fileGrpsLoaded) { |
| 737 | 723 | $this->_getFileGrps(); |
@@ -742,8 +728,7 @@ discard block |
||
| 742 | 728 | * {@inheritDoc} |
| 743 | 729 | * @see Document::getParentDocumentUid() |
| 744 | 730 | */ |
| 745 | - protected function getParentDocumentUidForSaving($pid, $core) |
|
| 746 | - { |
|
| 731 | + protected function getParentDocumentUidForSaving($pid, $core) { |
|
| 747 | 732 | $partof = 0; |
| 748 | 733 | // Get the closest ancestor of the current document which has a MPTR child. |
| 749 | 734 | $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->_getToplevelId() . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
@@ -766,8 +751,7 @@ discard block |
||
| 766 | 751 | * {@inheritDoc} |
| 767 | 752 | * @see Document::setPreloadedDocument() |
| 768 | 753 | */ |
| 769 | - protected function setPreloadedDocument($preloadedDocument) |
|
| 770 | - { |
|
| 754 | + protected function setPreloadedDocument($preloadedDocument) { |
|
| 771 | 755 | |
| 772 | 756 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
| 773 | 757 | $this->xml = $preloadedDocument; |
@@ -780,8 +764,7 @@ discard block |
||
| 780 | 764 | * {@inheritDoc} |
| 781 | 765 | * @see Document::getDocument() |
| 782 | 766 | */ |
| 783 | - protected function getDocument() |
|
| 784 | - { |
|
| 767 | + protected function getDocument() { |
|
| 785 | 768 | return $this->mets; |
| 786 | 769 | } |
| 787 | 770 | |
@@ -792,8 +775,7 @@ discard block |
||
| 792 | 775 | * |
| 793 | 776 | * @return int The PID of the metadata definitions |
| 794 | 777 | */ |
| 795 | - protected function _getCPid() |
|
| 796 | - { |
|
| 778 | + protected function _getCPid() { |
|
| 797 | 779 | return $this->cPid; |
| 798 | 780 | } |
| 799 | 781 | |
@@ -804,8 +786,7 @@ discard block |
||
| 804 | 786 | * |
| 805 | 787 | * @return array Array of dmdSecs with their IDs as array key |
| 806 | 788 | */ |
| 807 | - protected function _getDmdSec() |
|
| 808 | - { |
|
| 789 | + protected function _getDmdSec() { |
|
| 809 | 790 | if (!$this->dmdSecLoaded) { |
| 810 | 791 | // Get available data formats. |
| 811 | 792 | $this->loadFormats(); |
@@ -843,8 +824,7 @@ discard block |
||
| 843 | 824 | * |
| 844 | 825 | * @return array Array of file use groups with file IDs |
| 845 | 826 | */ |
| 846 | - protected function _getFileGrps() |
|
| 847 | - { |
|
| 827 | + protected function _getFileGrps() { |
|
| 848 | 828 | if (!$this->fileGrpsLoaded) { |
| 849 | 829 | // Get configured USE attributes. |
| 850 | 830 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -889,8 +869,7 @@ discard block |
||
| 889 | 869 | * {@inheritDoc} |
| 890 | 870 | * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray() |
| 891 | 871 | */ |
| 892 | - protected function prepareMetadataArray($cPid) |
|
| 893 | - { |
|
| 872 | + protected function prepareMetadataArray($cPid) { |
|
| 894 | 873 | $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'); |
| 895 | 874 | // Get all logical structure nodes with metadata. |
| 896 | 875 | if (!empty($ids)) { |
@@ -908,8 +887,7 @@ discard block |
||
| 908 | 887 | * |
| 909 | 888 | * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object |
| 910 | 889 | */ |
| 911 | - protected function _getMets() |
|
| 912 | - { |
|
| 890 | + protected function _getMets() { |
|
| 913 | 891 | return $this->mets; |
| 914 | 892 | } |
| 915 | 893 | |
@@ -917,8 +895,7 @@ discard block |
||
| 917 | 895 | * {@inheritDoc} |
| 918 | 896 | * @see \Kitodo\Dlf\Common\Document::_getPhysicalStructure() |
| 919 | 897 | */ |
| 920 | - protected function _getPhysicalStructure() |
|
| 921 | - { |
|
| 898 | + protected function _getPhysicalStructure() { |
|
| 922 | 899 | // Is there no physical structure array yet? |
| 923 | 900 | if (!$this->physicalStructureLoaded) { |
| 924 | 901 | // Does the document have a structMap node of type "PHYSICAL"? |
@@ -978,8 +955,7 @@ discard block |
||
| 978 | 955 | * {@inheritDoc} |
| 979 | 956 | * @see \Kitodo\Dlf\Common\Document::_getSmLinks() |
| 980 | 957 | */ |
| 981 | - protected function _getSmLinks() |
|
| 982 | - { |
|
| 958 | + protected function _getSmLinks() { |
|
| 983 | 959 | if (!$this->smLinksLoaded) { |
| 984 | 960 | $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink'); |
| 985 | 961 | if (!empty($smLinks)) { |
@@ -997,8 +973,7 @@ discard block |
||
| 997 | 973 | * {@inheritDoc} |
| 998 | 974 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
| 999 | 975 | */ |
| 1000 | - protected function _getThumbnail($forceReload = false) |
|
| 1001 | - { |
|
| 976 | + protected function _getThumbnail($forceReload = false) { |
|
| 1002 | 977 | if ( |
| 1003 | 978 | !$this->thumbnailLoaded |
| 1004 | 979 | || $forceReload |
@@ -1077,8 +1052,7 @@ discard block |
||
| 1077 | 1052 | * {@inheritDoc} |
| 1078 | 1053 | * @see \Kitodo\Dlf\Common\Document::_getToplevelId() |
| 1079 | 1054 | */ |
| 1080 | - protected function _getToplevelId() |
|
| 1081 | - { |
|
| 1055 | + protected function _getToplevelId() { |
|
| 1082 | 1056 | if (empty($this->toplevelId)) { |
| 1083 | 1057 | // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
| 1084 | 1058 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'); |
@@ -1110,8 +1084,7 @@ discard block |
||
| 1110 | 1084 | * |
| 1111 | 1085 | * @return array Properties to be serialized |
| 1112 | 1086 | */ |
| 1113 | - public function __sleep() |
|
| 1114 | - { |
|
| 1087 | + public function __sleep() { |
|
| 1115 | 1088 | // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization |
| 1116 | 1089 | $this->asXML = $this->xml->asXML(); |
| 1117 | 1090 | return ['uid', 'pid', 'recordId', 'parentId', 'asXML']; |
@@ -1124,8 +1097,7 @@ discard block |
||
| 1124 | 1097 | * |
| 1125 | 1098 | * @return string String representing the METS object |
| 1126 | 1099 | */ |
| 1127 | - public function __toString() |
|
| 1128 | - { |
|
| 1100 | + public function __toString() { |
|
| 1129 | 1101 | $xml = new \DOMDocument('1.0', 'utf-8'); |
| 1130 | 1102 | $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
| 1131 | 1103 | $xml->formatOutput = true; |
@@ -1140,8 +1112,7 @@ discard block |
||
| 1140 | 1112 | * |
| 1141 | 1113 | * @return void |
| 1142 | 1114 | */ |
| 1143 | - public function __wakeup() |
|
| 1144 | - { |
|
| 1115 | + public function __wakeup() { |
|
| 1145 | 1116 | // Turn off libxml's error logging. |
| 1146 | 1117 | $libxmlErrors = libxml_use_internal_errors(true); |
| 1147 | 1118 | // Reload XML from string. |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @var bool |
| 75 | 75 | * @access protected |
| 76 | 76 | */ |
| 77 | - protected $dmdSecLoaded = false; |
|
| 77 | + protected $dmdSecLoaded = FALSE; |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * The extension key |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @var bool |
| 101 | 101 | * @access protected |
| 102 | 102 | */ |
| 103 | - protected $fileGrpsLoaded = false; |
|
| 103 | + protected $fileGrpsLoaded = FALSE; |
|
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * This holds the XML file's METS part as \SimpleXMLElement object |
@@ -175,11 +175,11 @@ discard block |
||
| 175 | 175 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 176 | 176 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 177 | 177 | $service = IiifHelper::loadIiifResource($fileLocation); |
| 178 | - if ($service !== null && $service instanceof AbstractImageService) { |
|
| 178 | + if ($service !== NULL && $service instanceof AbstractImageService) { |
|
| 179 | 179 | return $service->getImageUrl(); |
| 180 | 180 | } |
| 181 | 181 | } elseif ($fileMimeType === 'application/vnd.netfpx') { |
| 182 | - $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : ''); |
|
| 182 | + $baseURL = $fileLocation . (strpos($fileLocation, '?') === FALSE ? '?' : ''); |
|
| 183 | 183 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
| 184 | 184 | return $baseURL . '&CVT=jpeg'; |
| 185 | 185 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * {@inheritDoc} |
| 227 | 227 | * @see \Kitodo\Dlf\Common\Document::getLogicalStructure() |
| 228 | 228 | */ |
| 229 | - public function getLogicalStructure($id, $recursive = false) |
|
| 229 | + public function getLogicalStructure($id, $recursive = FALSE) |
|
| 230 | 230 | { |
| 231 | 231 | $details = []; |
| 232 | 232 | // Is the requested logical unit already loaded? |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * |
| 268 | 268 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
| 269 | 269 | */ |
| 270 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) |
|
| 270 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = FALSE) |
|
| 271 | 271 | { |
| 272 | 272 | // Get attributes. |
| 273 | 273 | foreach ($structure->attributes() as $attribute => $value) { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | && array_key_exists($details['id'], $this->smLinks['l2p']) |
| 313 | 313 | ) { |
| 314 | 314 | // Link logical structure to the first corresponding physical page/track. |
| 315 | - $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, true)), 1); |
|
| 315 | + $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE)), 1); |
|
| 316 | 316 | $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']); |
| 317 | 317 | while ($fileGrpThumb = array_shift($fileGrpsThumb)) { |
| 318 | 318 | if (!empty($this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$fileGrpThumb])) { |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $details['children'] = []; |
| 357 | 357 | foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) { |
| 358 | 358 | // Repeat for all children. |
| 359 | - $details['children'][] = $this->getLogicalStructureInfo($child, true); |
|
| 359 | + $details['children'][] = $this->getLogicalStructureInfo($child, TRUE); |
|
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | return $details; |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | if (!empty($dmdIds)) { |
| 426 | 426 | // Handle multiple DMDIDs separately. |
| 427 | 427 | $dmdIds = explode(' ', $dmdIds); |
| 428 | - $hasSupportedMetadata = false; |
|
| 428 | + $hasSupportedMetadata = FALSE; |
|
| 429 | 429 | } else { |
| 430 | 430 | // There is no dmdSec for this structure node. |
| 431 | 431 | return []; |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | // Extract metadata only from first supported dmdSec. |
| 639 | - $hasSupportedMetadata = true; |
|
| 639 | + $hasSupportedMetadata = TRUE; |
|
| 640 | 640 | break; |
| 641 | 641 | } |
| 642 | 642 | if ($hasSupportedMetadata) { |
@@ -705,11 +705,11 @@ discard block |
||
| 705 | 705 | protected function loadLocation($location) |
| 706 | 706 | { |
| 707 | 707 | $fileResource = GeneralUtility::getUrl($location); |
| 708 | - if ($fileResource !== false) { |
|
| 708 | + if ($fileResource !== FALSE) { |
|
| 709 | 709 | // Turn off libxml's error logging. |
| 710 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
| 710 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
| 711 | 711 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
| 712 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
| 712 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
| 713 | 713 | // Load XML from file. |
| 714 | 714 | $xml = simplexml_load_string($fileResource); |
| 715 | 715 | // reset entity loader setting |
@@ -717,13 +717,13 @@ discard block |
||
| 717 | 717 | // Reset libxml's error logging. |
| 718 | 718 | libxml_use_internal_errors($libxmlErrors); |
| 719 | 719 | // Set some basic properties. |
| 720 | - if ($xml !== false) { |
|
| 720 | + if ($xml !== FALSE) { |
|
| 721 | 721 | $this->xml = $xml; |
| 722 | - return true; |
|
| 722 | + return TRUE; |
|
| 723 | 723 | } |
| 724 | 724 | } |
| 725 | 725 | Helper::devLog('Could not load XML file from "' . $location . '"', DEVLOG_SEVERITY_ERROR); |
| 726 | - return false; |
|
| 726 | + return FALSE; |
|
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | /** |
@@ -771,9 +771,9 @@ discard block |
||
| 771 | 771 | |
| 772 | 772 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
| 773 | 773 | $this->xml = $preloadedDocument; |
| 774 | - return true; |
|
| 774 | + return TRUE; |
|
| 775 | 775 | } |
| 776 | - return false; |
|
| 776 | + return FALSE; |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | /** |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | } |
| 832 | 832 | } |
| 833 | 833 | } |
| 834 | - $this->dmdSecLoaded = true; |
|
| 834 | + $this->dmdSecLoaded = TRUE; |
|
| 835 | 835 | } |
| 836 | 836 | return $this->dmdSec; |
| 837 | 837 | } |
@@ -878,9 +878,9 @@ discard block |
||
| 878 | 878 | !empty($extConf['fileGrpFulltext']) |
| 879 | 879 | && array_intersect(GeneralUtility::trimExplode(',', $extConf['fileGrpFulltext']), $this->fileGrps) !== [] |
| 880 | 880 | ) { |
| 881 | - $this->hasFulltext = true; |
|
| 881 | + $this->hasFulltext = TRUE; |
|
| 882 | 882 | } |
| 883 | - $this->fileGrpsLoaded = true; |
|
| 883 | + $this->fileGrpsLoaded = TRUE; |
|
| 884 | 884 | } |
| 885 | 885 | return $this->fileGrps; |
| 886 | 886 | } |
@@ -969,7 +969,7 @@ discard block |
||
| 969 | 969 | $this->physicalStructure = array_merge($physSeq, $elements); |
| 970 | 970 | } |
| 971 | 971 | } |
| 972 | - $this->physicalStructureLoaded = true; |
|
| 972 | + $this->physicalStructureLoaded = TRUE; |
|
| 973 | 973 | } |
| 974 | 974 | return $this->physicalStructure; |
| 975 | 975 | } |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | $this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from; |
| 989 | 989 | } |
| 990 | 990 | } |
| 991 | - $this->smLinksLoaded = true; |
|
| 991 | + $this->smLinksLoaded = TRUE; |
|
| 992 | 992 | } |
| 993 | 993 | return $this->smLinks; |
| 994 | 994 | } |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | * {@inheritDoc} |
| 998 | 998 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
| 999 | 999 | */ |
| 1000 | - protected function _getThumbnail($forceReload = false) |
|
| 1000 | + protected function _getThumbnail($forceReload = FALSE) |
|
| 1001 | 1001 | { |
| 1002 | 1002 | if ( |
| 1003 | 1003 | !$this->thumbnailLoaded |
@@ -1007,14 +1007,14 @@ discard block |
||
| 1007 | 1007 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 1008 | 1008 | if (!$cPid) { |
| 1009 | 1009 | Helper::devLog('Invalid PID ' . $cPid . ' for structure definitions', DEVLOG_SEVERITY_ERROR); |
| 1010 | - $this->thumbnailLoaded = true; |
|
| 1010 | + $this->thumbnailLoaded = TRUE; |
|
| 1011 | 1011 | return $this->thumbnail; |
| 1012 | 1012 | } |
| 1013 | 1013 | // Load extension configuration. |
| 1014 | 1014 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 1015 | 1015 | if (empty($extConf['fileGrpThumbs'])) { |
| 1016 | 1016 | Helper::devLog('No fileGrp for thumbnails specified', DEVLOG_SEVERITY_WARNING); |
| 1017 | - $this->thumbnailLoaded = true; |
|
| 1017 | + $this->thumbnailLoaded = TRUE; |
|
| 1018 | 1018 | return $this->thumbnail; |
| 1019 | 1019 | } |
| 1020 | 1020 | $strctId = $this->_getToplevelId(); |
@@ -1068,7 +1068,7 @@ discard block |
||
| 1068 | 1068 | } else { |
| 1069 | 1069 | Helper::devLog('No structure of type "' . $metadata['type'][0] . '" found in database', DEVLOG_SEVERITY_ERROR); |
| 1070 | 1070 | } |
| 1071 | - $this->thumbnailLoaded = true; |
|
| 1071 | + $this->thumbnailLoaded = TRUE; |
|
| 1072 | 1072 | } |
| 1073 | 1073 | return $this->thumbnail; |
| 1074 | 1074 | } |
@@ -1127,8 +1127,8 @@ discard block |
||
| 1127 | 1127 | public function __toString() |
| 1128 | 1128 | { |
| 1129 | 1129 | $xml = new \DOMDocument('1.0', 'utf-8'); |
| 1130 | - $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
|
| 1131 | - $xml->formatOutput = true; |
|
| 1130 | + $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE)); |
|
| 1131 | + $xml->formatOutput = TRUE; |
|
| 1132 | 1132 | return $xml->saveXML(); |
| 1133 | 1133 | } |
| 1134 | 1134 | |
@@ -1143,12 +1143,12 @@ discard block |
||
| 1143 | 1143 | public function __wakeup() |
| 1144 | 1144 | { |
| 1145 | 1145 | // Turn off libxml's error logging. |
| 1146 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
| 1146 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
| 1147 | 1147 | // Reload XML from string. |
| 1148 | 1148 | $xml = @simplexml_load_string($this->asXML); |
| 1149 | 1149 | // Reset libxml's error logging. |
| 1150 | 1150 | libxml_use_internal_errors($libxmlErrors); |
| 1151 | - if ($xml !== false) { |
|
| 1151 | + if ($xml !== FALSE) { |
|
| 1152 | 1152 | $this->asXML = ''; |
| 1153 | 1153 | $this->xml = $xml; |
| 1154 | 1154 | // Rebuild the unserializable properties. |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | protected function printContent() |
| 101 | 101 | { |
| 102 | 102 | $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); |
| 103 | - $this->doc->setModuleTemplate('EXT:' . $this->extKey . '/Resources/Private/Templates/' . Helper::getUnqualifiedClassName(get_class($this)) . '.tmpl'); |
|
| 103 | + $this->doc->setModuleTemplate('EXT:'.$this->extKey.'/Resources/Private/Templates/'.Helper::getUnqualifiedClassName(get_class($this)).'.tmpl'); |
|
| 104 | 104 | $this->doc->backPath = $GLOBALS['BACK_PATH']; |
| 105 | - $this->doc->bodyTagAdditions = 'class="ext-' . $this->extKey . '-modules"'; |
|
| 105 | + $this->doc->bodyTagAdditions = 'class="ext-'.$this->extKey.'-modules"'; |
|
| 106 | 106 | $this->doc->form = '<form action="" method="post" enctype="multipart/form-data">'; |
| 107 | 107 | // Add Javascript for function menu. |
| 108 | 108 | $this->doc->JScode .= '<script type="text/javascript">script_ended = 0;function jumpToUrl(URL) { document.location = URL; }</script>'; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title')); |
| 113 | 113 | // Set defaults for menu. |
| 114 | 114 | if (empty($this->markerArray['CSH'])) { |
| 115 | - $this->markerArray['CSH'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_' . $GLOBALS['MCONF']['name'], 'csh'); |
|
| 115 | + $this->markerArray['CSH'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_'.$GLOBALS['MCONF']['name'], 'csh'); |
|
| 116 | 116 | } |
| 117 | 117 | if (empty($this->markerArray['MOD_MENU'])) { |
| 118 | 118 | $this->markerArray['MOD_MENU'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function __construct() |
| 133 | 133 | { |
| 134 | - $GLOBALS['LANG']->includeLLFile('EXT:' . $this->extKey . '/Resources/Private/Language/' . Helper::getUnqualifiedClassName(get_class($this)) . '.xml'); |
|
| 134 | + $GLOBALS['LANG']->includeLLFile('EXT:'.$this->extKey.'/Resources/Private/Language/'.Helper::getUnqualifiedClassName(get_class($this)).'.xml'); |
|
| 135 | 135 | $this->conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get($this->extKey); |
| 136 | 136 | $this->data = GeneralUtility::_GPmerged($this->prefixId); |
| 137 | 137 | } |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | * @access public |
| 25 | 25 | * @abstract |
| 26 | 26 | */ |
| 27 | -abstract class AbstractModule extends \TYPO3\CMS\Backend\Module\BaseScriptClass |
|
| 28 | -{ |
|
| 27 | +abstract class AbstractModule extends \TYPO3\CMS\Backend\Module\BaseScriptClass { |
|
| 29 | 28 | public $extKey = 'dlf'; |
| 30 | 29 | public $prefixId = 'tx_dlf'; |
| 31 | 30 | |
@@ -97,8 +96,7 @@ discard block |
||
| 97 | 96 | * |
| 98 | 97 | * @return string |
| 99 | 98 | */ |
| 100 | - protected function printContent() |
|
| 101 | - { |
|
| 99 | + protected function printContent() { |
|
| 102 | 100 | $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); |
| 103 | 101 | $this->doc->setModuleTemplate('EXT:' . $this->extKey . '/Resources/Private/Templates/' . Helper::getUnqualifiedClassName(get_class($this)) . '.tmpl'); |
| 104 | 102 | $this->doc->backPath = $GLOBALS['BACK_PATH']; |
@@ -129,8 +127,7 @@ discard block |
||
| 129 | 127 | * |
| 130 | 128 | * @return void |
| 131 | 129 | */ |
| 132 | - public function __construct() |
|
| 133 | - { |
|
| 130 | + public function __construct() { |
|
| 134 | 131 | $GLOBALS['LANG']->includeLLFile('EXT:' . $this->extKey . '/Resources/Private/Language/' . Helper::getUnqualifiedClassName(get_class($this)) . '.xml'); |
| 135 | 132 | $this->conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get($this->extKey); |
| 136 | 133 | $this->data = GeneralUtility::_GPmerged($this->prefixId); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @var bool |
| 94 | 94 | * @access protected |
| 95 | 95 | */ |
| 96 | - protected $formatsLoaded = false; |
|
| 96 | + protected $formatsLoaded = FALSE; |
|
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Are there any fulltext files available? This also includes IIIF text annotations |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @var bool |
| 104 | 104 | * @access protected |
| 105 | 105 | */ |
| 106 | - protected $hasFulltext = false; |
|
| 106 | + protected $hasFulltext = FALSE; |
|
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | 109 | * Last searched logical and physical page |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @var array |
| 112 | 112 | * @access protected |
| 113 | 113 | */ |
| 114 | - protected $lastSearchedPhysicalPage = ['logicalPage' => null, 'physicalPage' => null]; |
|
| 114 | + protected $lastSearchedPhysicalPage = ['logicalPage' => NULL, 'physicalPage' => NULL]; |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * This holds the documents location |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @var bool |
| 146 | 146 | * @access protected |
| 147 | 147 | */ |
| 148 | - protected $metadataArrayLoaded = false; |
|
| 148 | + protected $metadataArrayLoaded = FALSE; |
|
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | 151 | * The holds the total number of pages |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @var bool |
| 187 | 187 | * @access protected |
| 188 | 188 | */ |
| 189 | - protected $physicalStructureLoaded = false; |
|
| 189 | + protected $physicalStructureLoaded = FALSE; |
|
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | 192 | * This holds the PID of the document or zero if not in database |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @var bool |
| 212 | 212 | * @access protected |
| 213 | 213 | */ |
| 214 | - protected $ready = false; |
|
| 214 | + protected $ready = FALSE; |
|
| 215 | 215 | |
| 216 | 216 | /** |
| 217 | 217 | * The METS file's / IIIF manifest's record identifier |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @var bool |
| 246 | 246 | * @access protected |
| 247 | 247 | */ |
| 248 | - protected $rootIdLoaded = false; |
|
| 248 | + protected $rootIdLoaded = FALSE; |
|
| 249 | 249 | |
| 250 | 250 | /** |
| 251 | 251 | * This holds the smLinks between logical and physical structMap |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * @var bool |
| 263 | 263 | * @access protected |
| 264 | 264 | */ |
| 265 | - protected $smLinksLoaded = false; |
|
| 265 | + protected $smLinksLoaded = FALSE; |
|
| 266 | 266 | |
| 267 | 267 | /** |
| 268 | 268 | * This holds the logical structure |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * @var bool |
| 280 | 280 | * @access protected |
| 281 | 281 | */ |
| 282 | - protected $tableOfContentsLoaded = false; |
|
| 282 | + protected $tableOfContentsLoaded = FALSE; |
|
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | 285 | * This holds the document's thumbnail location |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * @var bool |
| 297 | 297 | * @access protected |
| 298 | 298 | */ |
| 299 | - protected $thumbnailLoaded = false; |
|
| 299 | + protected $thumbnailLoaded = FALSE; |
|
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | 302 | * This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF) |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | * |
| 414 | 414 | * @return \Kitodo\Dlf\Common\Document Instance of this class, either MetsDocument or IiifManifest |
| 415 | 415 | */ |
| 416 | - public static function &getInstance($uid, $pid = 0, $forceReload = false) |
|
| 416 | + public static function &getInstance($uid, $pid = 0, $forceReload = FALSE) |
|
| 417 | 417 | { |
| 418 | 418 | // Sanitize input. |
| 419 | 419 | $pid = max(intval($pid), 0); |
@@ -453,10 +453,10 @@ discard block |
||
| 453 | 453 | } |
| 454 | 454 | } |
| 455 | 455 | // Create new instance depending on format (METS or IIIF) ... |
| 456 | - $instance = null; |
|
| 457 | - $documentFormat = null; |
|
| 458 | - $xml = null; |
|
| 459 | - $iiif = null; |
|
| 456 | + $instance = NULL; |
|
| 457 | + $documentFormat = NULL; |
|
| 458 | + $xml = NULL; |
|
| 459 | + $iiif = NULL; |
|
| 460 | 460 | // Try to get document format from database |
| 461 | 461 | if (MathUtility::canBeInterpretedAsInteger($uid)) { |
| 462 | 462 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -505,27 +505,27 @@ discard block |
||
| 505 | 505 | @ini_set('user_agent', $extConf['useragent']); |
| 506 | 506 | } |
| 507 | 507 | $content = GeneralUtility::getUrl($location); |
| 508 | - if ($content !== false) { |
|
| 508 | + if ($content !== FALSE) { |
|
| 509 | 509 | // TODO use single place to load xml |
| 510 | 510 | // Turn off libxml's error logging. |
| 511 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
| 511 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
| 512 | 512 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
| 513 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
| 513 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
| 514 | 514 | // Try to load XML from file. |
| 515 | 515 | $xml = simplexml_load_string($content); |
| 516 | 516 | // reset entity loader setting |
| 517 | 517 | libxml_disable_entity_loader($previousValueOfEntityLoader); |
| 518 | 518 | // Reset libxml's error logging. |
| 519 | 519 | libxml_use_internal_errors($libxmlErrors); |
| 520 | - if ($xml !== false) { |
|
| 520 | + if ($xml !== FALSE) { |
|
| 521 | 521 | /* @var $xml \SimpleXMLElement */ |
| 522 | 522 | $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/'); |
| 523 | 523 | $xpathResult = $xml->xpath('//mets:mets'); |
| 524 | - $documentFormat = !empty($xpathResult) ? 'METS' : null; |
|
| 524 | + $documentFormat = !empty($xpathResult) ? 'METS' : NULL; |
|
| 525 | 525 | } else { |
| 526 | 526 | // Try to load file as IIIF resource instead. |
| 527 | - $contentAsJsonArray = json_decode($content, true); |
|
| 528 | - if ($contentAsJsonArray !== null) { |
|
| 527 | + $contentAsJsonArray = json_decode($content, TRUE); |
|
| 528 | + if ($contentAsJsonArray !== NULL) { |
|
| 529 | 529 | // Load plugin configuration. |
| 530 | 530 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 531 | 531 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | * |
| 580 | 580 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
| 581 | 581 | */ |
| 582 | - public abstract function getLogicalStructure($id, $recursive = false); |
|
| 582 | + public abstract function getLogicalStructure($id, $recursive = FALSE); |
|
| 583 | 583 | |
| 584 | 584 | /** |
| 585 | 585 | * This extracts all the metadata for a logical structure node |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | } else { |
| 617 | 617 | $physicalPage = 0; |
| 618 | 618 | foreach ($this->physicalStructureInfo as $page) { |
| 619 | - if (strpos($page['orderlabel'], $logicalPage) !== false) { |
|
| 619 | + if (strpos($page['orderlabel'], $logicalPage) !== FALSE) { |
|
| 620 | 620 | $this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage; |
| 621 | 621 | $this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage; |
| 622 | 622 | return $physicalPage; |
@@ -669,11 +669,11 @@ discard block |
||
| 669 | 669 | if (!empty($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])) { |
| 670 | 670 | // Get fulltext file. |
| 671 | 671 | $file = GeneralUtility::getUrl($this->getFileLocation($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])); |
| 672 | - if ($file !== false) { |
|
| 672 | + if ($file !== FALSE) { |
|
| 673 | 673 | // Turn off libxml's error logging. |
| 674 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
| 674 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
| 675 | 675 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept. |
| 676 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
| 676 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
| 677 | 677 | // Load XML from file. |
| 678 | 678 | $rawTextXml = simplexml_load_string($file); |
| 679 | 679 | // Reset entity loader setting. |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | * |
| 730 | 730 | * @return string The title of the document itself or a parent document |
| 731 | 731 | */ |
| 732 | - public static function getTitle($uid, $recursive = false) |
|
| 732 | + public static function getTitle($uid, $recursive = FALSE) |
|
| 733 | 733 | { |
| 734 | 734 | $title = ''; |
| 735 | 735 | // Sanitize input. |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | && intval($partof) |
| 763 | 763 | && $partof != $uid |
| 764 | 764 | ) { |
| 765 | - $title = self::getTitle($partof, true); |
|
| 765 | + $title = self::getTitle($partof, TRUE); |
|
| 766 | 766 | } |
| 767 | 767 | } else { |
| 768 | 768 | Helper::devLog('No document with UID ' . $uid . ' found or document not accessible', DEVLOG_SEVERITY_WARNING); |
@@ -823,12 +823,12 @@ discard block |
||
| 823 | 823 | return $depth; |
| 824 | 824 | } elseif (array_key_exists('children', $element)) { |
| 825 | 825 | $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId); |
| 826 | - if ($foundInChildren !== false) { |
|
| 826 | + if ($foundInChildren !== FALSE) { |
|
| 827 | 827 | return $foundInChildren; |
| 828 | 828 | } |
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | - return false; |
|
| 831 | + return FALSE; |
|
| 832 | 832 | } |
| 833 | 833 | |
| 834 | 834 | /** |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | } else { |
| 906 | 906 | Helper::devLog('Invalid file location "' . $location . '" for document loading', DEVLOG_SEVERITY_ERROR); |
| 907 | 907 | } |
| 908 | - return false; |
|
| 908 | + return FALSE; |
|
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | /** |
@@ -952,7 +952,7 @@ discard block |
||
| 952 | 952 | 'class' => $resArray['class'] |
| 953 | 953 | ]; |
| 954 | 954 | } |
| 955 | - $this->formatsLoaded = true; |
|
| 955 | + $this->formatsLoaded = TRUE; |
|
| 956 | 956 | } |
| 957 | 957 | } |
| 958 | 958 | |
@@ -998,7 +998,7 @@ discard block |
||
| 998 | 998 | { |
| 999 | 999 | if (\TYPO3_MODE !== 'BE') { |
| 1000 | 1000 | Helper::devLog('Saving a document is only allowed in the backend', DEVLOG_SEVERITY_ERROR); |
| 1001 | - return false; |
|
| 1001 | + return FALSE; |
|
| 1002 | 1002 | } |
| 1003 | 1003 | // Make sure $pid is a non-negative integer. |
| 1004 | 1004 | $pid = max(intval($pid), 0); |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | $pid = $this->pid; |
| 1014 | 1014 | } elseif (!$pid) { |
| 1015 | 1015 | Helper::devLog('Invalid PID ' . $pid . ' for document saving', DEVLOG_SEVERITY_ERROR); |
| 1016 | - return false; |
|
| 1016 | + return FALSE; |
|
| 1017 | 1017 | } |
| 1018 | 1018 | // Set PID for metadata definitions. |
| 1019 | 1019 | $this->cPid = $pid; |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | // Check for record identifier. |
| 1027 | 1027 | if (empty($metadata['record_id'][0])) { |
| 1028 | 1028 | Helper::devLog('No record identifier found to avoid duplication', DEVLOG_SEVERITY_ERROR); |
| 1029 | - return false; |
|
| 1029 | + return FALSE; |
|
| 1030 | 1030 | } |
| 1031 | 1031 | // Load plugin configuration. |
| 1032 | 1032 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -1050,7 +1050,7 @@ discard block |
||
| 1050 | 1050 | $structure = $resArray['uid']; |
| 1051 | 1051 | } else { |
| 1052 | 1052 | Helper::devLog('Could not identify document/structure type "' . $queryBuilder->expr()->literal($metadata['type'][0]) . '"', DEVLOG_SEVERITY_ERROR); |
| 1053 | - return false; |
|
| 1053 | + return FALSE; |
|
| 1054 | 1054 | } |
| 1055 | 1055 | $metadata['type'][0] = $structure; |
| 1056 | 1056 | |
@@ -1107,9 +1107,9 @@ discard block |
||
| 1107 | 1107 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 1108 | 1108 | Helper::addMessage( |
| 1109 | 1109 | htmlspecialchars(sprintf(Helper::getMessage('flash.newCollection'), $collection, $substUid[$collNewUid])), |
| 1110 | - Helper::getMessage('flash.attention', true), |
|
| 1110 | + Helper::getMessage('flash.attention', TRUE), |
|
| 1111 | 1111 | \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
| 1112 | - true |
|
| 1112 | + TRUE |
|
| 1113 | 1113 | ); |
| 1114 | 1114 | } |
| 1115 | 1115 | } |
@@ -1158,9 +1158,9 @@ discard block |
||
| 1158 | 1158 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 1159 | 1159 | Helper::addMessage( |
| 1160 | 1160 | htmlspecialchars(sprintf(Helper::getMessage('flash.newLibrary'), $owner, $ownerUid)), |
| 1161 | - Helper::getMessage('flash.attention', true), |
|
| 1161 | + Helper::getMessage('flash.attention', TRUE), |
|
| 1162 | 1162 | \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
| 1163 | - true |
|
| 1163 | + TRUE |
|
| 1164 | 1164 | ); |
| 1165 | 1165 | } |
| 1166 | 1166 | } |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | 'author' => implode('; ', $metadata['author']), |
| 1247 | 1247 | 'year' => implode('; ', $metadata['year']), |
| 1248 | 1248 | 'place' => implode('; ', $metadata['place']), |
| 1249 | - 'thumbnail' => $this->_getThumbnail(true), |
|
| 1249 | + 'thumbnail' => $this->_getThumbnail(TRUE), |
|
| 1250 | 1250 | 'metadata' => serialize($listed), |
| 1251 | 1251 | 'metadata_sorting' => serialize($sortable), |
| 1252 | 1252 | 'structure' => $metadata['type'][0], |
@@ -1282,9 +1282,9 @@ discard block |
||
| 1282 | 1282 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 1283 | 1283 | Helper::addMessage( |
| 1284 | 1284 | htmlspecialchars(sprintf(Helper::getMessage('flash.documentSaved'), $metadata['title'][0], $this->uid)), |
| 1285 | - Helper::getMessage('flash.done', true), |
|
| 1285 | + Helper::getMessage('flash.done', TRUE), |
|
| 1286 | 1286 | \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
| 1287 | - true |
|
| 1287 | + TRUE |
|
| 1288 | 1288 | ); |
| 1289 | 1289 | } |
| 1290 | 1290 | // Add document to index. |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | } else { |
| 1294 | 1294 | Helper::devLog('Invalid UID "' . $core . '" for Solr core', DEVLOG_SEVERITY_NOTICE); |
| 1295 | 1295 | } |
| 1296 | - return true; |
|
| 1296 | + return TRUE; |
|
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | 1299 | /** |
@@ -1366,7 +1366,7 @@ discard block |
||
| 1366 | 1366 | ) { |
| 1367 | 1367 | $this->prepareMetadataArray($cPid); |
| 1368 | 1368 | $this->metadataArray[0] = $cPid; |
| 1369 | - $this->metadataArrayLoaded = true; |
|
| 1369 | + $this->metadataArrayLoaded = TRUE; |
|
| 1370 | 1370 | } |
| 1371 | 1371 | return $this->metadataArray; |
| 1372 | 1372 | } |
@@ -1475,7 +1475,7 @@ discard block |
||
| 1475 | 1475 | $parent = self::getInstance($this->parentId, $this->pid); |
| 1476 | 1476 | $this->rootId = $parent->rootId; |
| 1477 | 1477 | } |
| 1478 | - $this->rootIdLoaded = true; |
|
| 1478 | + $this->rootIdLoaded = TRUE; |
|
| 1479 | 1479 | } |
| 1480 | 1480 | return $this->rootId; |
| 1481 | 1481 | } |
@@ -1504,8 +1504,8 @@ discard block |
||
| 1504 | 1504 | // Is there no logical structure array yet? |
| 1505 | 1505 | if (!$this->tableOfContentsLoaded) { |
| 1506 | 1506 | // Get all logical structures. |
| 1507 | - $this->getLogicalStructure('', true); |
|
| 1508 | - $this->tableOfContentsLoaded = true; |
|
| 1507 | + $this->getLogicalStructure('', TRUE); |
|
| 1508 | + $this->tableOfContentsLoaded = TRUE; |
|
| 1509 | 1509 | } |
| 1510 | 1510 | return $this->tableOfContents; |
| 1511 | 1511 | } |
@@ -1521,7 +1521,7 @@ discard block |
||
| 1521 | 1521 | * |
| 1522 | 1522 | * @return string The document's thumbnail location |
| 1523 | 1523 | */ |
| 1524 | - protected abstract function _getThumbnail($forceReload = false); |
|
| 1524 | + protected abstract function _getThumbnail($forceReload = FALSE); |
|
| 1525 | 1525 | |
| 1526 | 1526 | /** |
| 1527 | 1527 | * This returns the ID of the toplevel logical structure node |
@@ -1602,7 +1602,7 @@ discard block |
||
| 1602 | 1602 | && $this->load($uid))) { |
| 1603 | 1603 | // Initialize core METS object. |
| 1604 | 1604 | $this->init(); |
| 1605 | - if ($this->getDocument() !== null) { |
|
| 1605 | + if ($this->getDocument() !== NULL) { |
|
| 1606 | 1606 | // Cast to string for safety reasons. |
| 1607 | 1607 | $location = (string) $uid; |
| 1608 | 1608 | $this->establishRecordId($pid); |
@@ -1660,30 +1660,30 @@ discard block |
||
| 1660 | 1660 | $this->parentId = $resArray['partof']; |
| 1661 | 1661 | $this->thumbnail = $resArray['thumbnail']; |
| 1662 | 1662 | $this->location = $resArray['location']; |
| 1663 | - $this->thumbnailLoaded = true; |
|
| 1663 | + $this->thumbnailLoaded = TRUE; |
|
| 1664 | 1664 | // Load XML file if necessary... |
| 1665 | 1665 | if ( |
| 1666 | - $this->getDocument() === null |
|
| 1666 | + $this->getDocument() === NULL |
|
| 1667 | 1667 | && $this->load($this->location) |
| 1668 | 1668 | ) { |
| 1669 | 1669 | // ...and set some basic properties. |
| 1670 | 1670 | $this->init(); |
| 1671 | 1671 | } |
| 1672 | 1672 | // Do we have a METS / IIIF object now? |
| 1673 | - if ($this->getDocument() !== null) { |
|
| 1673 | + if ($this->getDocument() !== NULL) { |
|
| 1674 | 1674 | // Set new location if necessary. |
| 1675 | 1675 | if (!empty($location)) { |
| 1676 | 1676 | $this->location = $location; |
| 1677 | 1677 | } |
| 1678 | 1678 | // Document ready! |
| 1679 | - $this->ready = true; |
|
| 1679 | + $this->ready = TRUE; |
|
| 1680 | 1680 | } |
| 1681 | - } elseif ($this->getDocument() !== null) { |
|
| 1681 | + } elseif ($this->getDocument() !== NULL) { |
|
| 1682 | 1682 | // Set location as UID for documents not in database. |
| 1683 | 1683 | $this->uid = $location; |
| 1684 | 1684 | $this->location = $location; |
| 1685 | 1685 | // Document ready! |
| 1686 | - $this->ready = true; |
|
| 1686 | + $this->ready = TRUE; |
|
| 1687 | 1687 | } else { |
| 1688 | 1688 | Helper::devLog('No document with UID ' . $uid . ' found or document not accessible', DEVLOG_SEVERITY_ERROR); |
| 1689 | 1689 | } |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | * @property-read string $toplevelId This holds the toplevel manifest's @id |
| 57 | 57 | * @property-read mixed $uid This holds the UID or the URL of the document |
| 58 | 58 | */ |
| 59 | -final class IiifManifest extends Document |
|
| 60 | -{ |
|
| 59 | +final class IiifManifest extends Document { |
|
| 61 | 60 | /** |
| 62 | 61 | * This holds the manifest file as string for serialization purposes |
| 63 | 62 | * @see __sleep() / __wakeup() |
@@ -118,8 +117,7 @@ discard block |
||
| 118 | 117 | * {@inheritDoc} |
| 119 | 118 | * @see Document::establishRecordId() |
| 120 | 119 | */ |
| 121 | - protected function establishRecordId($pid) |
|
| 122 | - { |
|
| 120 | + protected function establishRecordId($pid) { |
|
| 123 | 121 | if ($this->iiif !== null) { |
| 124 | 122 | /* |
| 125 | 123 | * FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss |
@@ -170,8 +168,7 @@ discard block |
||
| 170 | 168 | * {@inheritDoc} |
| 171 | 169 | * @see Document::getDocument() |
| 172 | 170 | */ |
| 173 | - protected function getDocument() |
|
| 174 | - { |
|
| 171 | + protected function getDocument() { |
|
| 175 | 172 | return $this->iiif; |
| 176 | 173 | } |
| 177 | 174 | |
@@ -184,8 +181,7 @@ discard block |
||
| 184 | 181 | * @return string 'IIIF1' if the resource is a Metadata API 1 resource, 'IIIF2' / 'IIIF3' if |
| 185 | 182 | * the resource is a Presentation API 2 / 3 resource |
| 186 | 183 | */ |
| 187 | - public function getIiifVersion() |
|
| 188 | - { |
|
| 184 | + public function getIiifVersion() { |
|
| 189 | 185 | if (!isset($this->iiifVersion)) { |
| 190 | 186 | if ($this->iiif instanceof AbstractIiifResource1) { |
| 191 | 187 | $this->iiifVersion = 'IIIF1'; |
@@ -226,8 +222,7 @@ discard block |
||
| 226 | 222 | * |
| 227 | 223 | * @return array|string |
| 228 | 224 | */ |
| 229 | - protected function getUseGroups($use) |
|
| 230 | - { |
|
| 225 | + protected function getUseGroups($use) { |
|
| 231 | 226 | if (!$this->useGrpsLoaded) { |
| 232 | 227 | // Get configured USE attributes. |
| 233 | 228 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -255,8 +250,7 @@ discard block |
||
| 255 | 250 | * {@inheritDoc} |
| 256 | 251 | * @see Document::_getPhysicalStructure() |
| 257 | 252 | */ |
| 258 | - protected function _getPhysicalStructure() |
|
| 259 | - { |
|
| 253 | + protected function _getPhysicalStructure() { |
|
| 260 | 254 | // Is there no physical structure array yet? |
| 261 | 255 | if (!$this->physicalStructureLoaded) { |
| 262 | 256 | if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
@@ -369,8 +363,7 @@ discard block |
||
| 369 | 363 | * {@inheritDoc} |
| 370 | 364 | * @see Document::getDownloadLocation() |
| 371 | 365 | */ |
| 372 | - public function getDownloadLocation($id) |
|
| 373 | - { |
|
| 366 | + public function getDownloadLocation($id) { |
|
| 374 | 367 | $fileLocation = $this->getFileLocation($id); |
| 375 | 368 | $resource = $this->iiif->getContainedResourceById($fileLocation); |
| 376 | 369 | if ($resource instanceof AbstractImageService) { |
@@ -383,8 +376,7 @@ discard block |
||
| 383 | 376 | * {@inheritDoc} |
| 384 | 377 | * @see Document::getFileLocation() |
| 385 | 378 | */ |
| 386 | - public function getFileLocation($id) |
|
| 387 | - { |
|
| 379 | + public function getFileLocation($id) { |
|
| 388 | 380 | if ($id == null) { |
| 389 | 381 | return null; |
| 390 | 382 | } |
@@ -408,8 +400,7 @@ discard block |
||
| 408 | 400 | * {@inheritDoc} |
| 409 | 401 | * @see Document::getFileMimeType() |
| 410 | 402 | */ |
| 411 | - public function getFileMimeType($id) |
|
| 412 | - { |
|
| 403 | + public function getFileMimeType($id) { |
|
| 413 | 404 | $fileResource = $this->iiif->getContainedResourceById($id); |
| 414 | 405 | if ($fileResource instanceof CanvasInterface) { |
| 415 | 406 | $format = "application/vnd.kitodo.iiif"; |
@@ -434,8 +425,7 @@ discard block |
||
| 434 | 425 | * {@inheritDoc} |
| 435 | 426 | * @see Document::getLogicalStructure() |
| 436 | 427 | */ |
| 437 | - public function getLogicalStructure($id, $recursive = false) |
|
| 438 | - { |
|
| 428 | + public function getLogicalStructure($id, $recursive = false) { |
|
| 439 | 429 | $details = []; |
| 440 | 430 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
| 441 | 431 | return $this->logicalUnits[$id]; |
@@ -470,8 +460,7 @@ discard block |
||
| 470 | 460 | * @param array $processedStructures: IIIF resources that already have been processed |
| 471 | 461 | * @return array Logical structure array |
| 472 | 462 | */ |
| 473 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) |
|
| 474 | - { |
|
| 463 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) { |
|
| 475 | 464 | $details = []; |
| 476 | 465 | $details['id'] = $resource->getId(); |
| 477 | 466 | $details['dmdId'] = ''; |
@@ -563,8 +552,7 @@ discard block |
||
| 563 | 552 | * |
| 564 | 553 | * @todo This method is still in experimental; the method signature may change. |
| 565 | 554 | */ |
| 566 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) |
|
| 567 | - { |
|
| 555 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) { |
|
| 568 | 556 | if (!empty($this->originalMetadataArray[$id])) { |
| 569 | 557 | return $this->originalMetadataArray[$id]; |
| 570 | 558 | } |
@@ -606,8 +594,7 @@ discard block |
||
| 606 | 594 | * {@inheritDoc} |
| 607 | 595 | * @see Document::getMetadata() |
| 608 | 596 | */ |
| 609 | - public function getMetadata($id, $cPid = 0) |
|
| 610 | - { |
|
| 597 | + public function getMetadata($id, $cPid = 0) { |
|
| 611 | 598 | if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) { |
| 612 | 599 | return $this->metadataArray[$id]; |
| 613 | 600 | } |
@@ -714,8 +701,7 @@ discard block |
||
| 714 | 701 | * {@inheritDoc} |
| 715 | 702 | * @see Document::_getSmLinks() |
| 716 | 703 | */ |
| 717 | - protected function _getSmLinks() |
|
| 718 | - { |
|
| 704 | + protected function _getSmLinks() { |
|
| 719 | 705 | if (!$this->smLinksLoaded && isset($this->iiif) && $this->iiif instanceof ManifestInterface) { |
| 720 | 706 | if (!empty($this->iiif->getDefaultCanvases())) { |
| 721 | 707 | foreach ($this->iiif->getDefaultCanvases() as $canvas) { |
@@ -739,8 +725,7 @@ discard block |
||
| 739 | 725 | * |
| 740 | 726 | * @param RangeInterface $range: Current range whose canvases shall be linked |
| 741 | 727 | */ |
| 742 | - private function smLinkRangeCanvasesRecursively(RangeInterface $range) |
|
| 743 | - { |
|
| 728 | + private function smLinkRangeCanvasesRecursively(RangeInterface $range) { |
|
| 744 | 729 | // map range's canvases including all child ranges' canvases |
| 745 | 730 | if (!$range->isTopRange()) { |
| 746 | 731 | foreach ($range->getAllCanvasesRecursively() as $canvas) { |
@@ -763,8 +748,7 @@ discard block |
||
| 763 | 748 | * @param CanvasInterface $canvas |
| 764 | 749 | * @param IiifResourceInterface $resource |
| 765 | 750 | */ |
| 766 | - private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) |
|
| 767 | - { |
|
| 751 | + private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) { |
|
| 768 | 752 | $this->smLinks['l2p'][$resource->getId()][] = $canvas->getId(); |
| 769 | 753 | if (!is_array($this->smLinks['p2l'][$canvas->getId()]) || !in_array($resource->getId(), $this->smLinks['p2l'][$canvas->getId()])) { |
| 770 | 754 | $this->smLinks['p2l'][$canvas->getId()][] = $resource->getId(); |
@@ -779,8 +763,7 @@ discard block |
||
| 779 | 763 | * |
| 780 | 764 | * @see Document::getParentDocumentUidForSaving() |
| 781 | 765 | */ |
| 782 | - protected function getParentDocumentUidForSaving($pid, $core) |
|
| 783 | - { |
|
| 766 | + protected function getParentDocumentUidForSaving($pid, $core) { |
|
| 784 | 767 | // Do nothing. |
| 785 | 768 | } |
| 786 | 769 | |
@@ -788,8 +771,7 @@ discard block |
||
| 788 | 771 | * {@inheritDoc} |
| 789 | 772 | * @see Document::getRawText() |
| 790 | 773 | */ |
| 791 | - public function getRawText($id) |
|
| 792 | - { |
|
| 774 | + public function getRawText($id) { |
|
| 793 | 775 | $rawText = ''; |
| 794 | 776 | // Get text from raw text array if available. |
| 795 | 777 | if (!empty($this->rawTextArray[$id])) { |
@@ -846,8 +828,7 @@ discard block |
||
| 846 | 828 | * |
| 847 | 829 | * @return IiifResourceInterface |
| 848 | 830 | */ |
| 849 | - public function getIiif() |
|
| 850 | - { |
|
| 831 | + public function getIiif() { |
|
| 851 | 832 | return $this->iiif; |
| 852 | 833 | } |
| 853 | 834 | |
@@ -855,8 +836,7 @@ discard block |
||
| 855 | 836 | * {@inheritDoc} |
| 856 | 837 | * @see Document::init() |
| 857 | 838 | */ |
| 858 | - protected function init() |
|
| 859 | - { |
|
| 839 | + protected function init() { |
|
| 860 | 840 | // Nothing to do here, at the moment |
| 861 | 841 | } |
| 862 | 842 | |
@@ -864,8 +844,7 @@ discard block |
||
| 864 | 844 | * {@inheritDoc} |
| 865 | 845 | * @see Document::loadLocation() |
| 866 | 846 | */ |
| 867 | - protected function loadLocation($location) |
|
| 868 | - { |
|
| 847 | + protected function loadLocation($location) { |
|
| 869 | 848 | $fileResource = GeneralUtility::getUrl($location); |
| 870 | 849 | if ($fileResource !== false) { |
| 871 | 850 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -888,8 +867,7 @@ discard block |
||
| 888 | 867 | * {@inheritDoc} |
| 889 | 868 | * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray() |
| 890 | 869 | */ |
| 891 | - protected function prepareMetadataArray($cPid) |
|
| 892 | - { |
|
| 870 | + protected function prepareMetadataArray($cPid) { |
|
| 893 | 871 | $id = $this->iiif->getId(); |
| 894 | 872 | $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid); |
| 895 | 873 | } |
@@ -898,8 +876,7 @@ discard block |
||
| 898 | 876 | * {@inheritDoc} |
| 899 | 877 | * @see Document::setPreloadedDocument() |
| 900 | 878 | */ |
| 901 | - protected function setPreloadedDocument($preloadedDocument) |
|
| 902 | - { |
|
| 879 | + protected function setPreloadedDocument($preloadedDocument) { |
|
| 903 | 880 | if ($preloadedDocument instanceof ManifestInterface) { |
| 904 | 881 | $this->iiif = $preloadedDocument; |
| 905 | 882 | return true; |
@@ -911,8 +888,7 @@ discard block |
||
| 911 | 888 | * {@inheritDoc} |
| 912 | 889 | * @see Document::ensureHasFulltextIsSet() |
| 913 | 890 | */ |
| 914 | - protected function ensureHasFulltextIsSet() |
|
| 915 | - { |
|
| 891 | + protected function ensureHasFulltextIsSet() { |
|
| 916 | 892 | /* |
| 917 | 893 | * TODO Check annotations and annotation lists of canvas for ALTO documents. |
| 918 | 894 | * Example: |
@@ -958,8 +934,7 @@ discard block |
||
| 958 | 934 | * {@inheritDoc} |
| 959 | 935 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
| 960 | 936 | */ |
| 961 | - protected function _getThumbnail($forceReload = false) |
|
| 962 | - { |
|
| 937 | + protected function _getThumbnail($forceReload = false) { |
|
| 963 | 938 | return $this->iiif->getThumbnailUrl(); |
| 964 | 939 | } |
| 965 | 940 | |
@@ -967,8 +942,7 @@ discard block |
||
| 967 | 942 | * {@inheritDoc} |
| 968 | 943 | * @see \Kitodo\Dlf\Common\Document::_getToplevelId() |
| 969 | 944 | */ |
| 970 | - protected function _getToplevelId() |
|
| 971 | - { |
|
| 945 | + protected function _getToplevelId() { |
|
| 972 | 946 | if (empty($this->toplevelId)) { |
| 973 | 947 | if (isset($this->iiif)) { |
| 974 | 948 | $this->toplevelId = $this->iiif->getId(); |
@@ -985,8 +959,7 @@ discard block |
||
| 985 | 959 | * |
| 986 | 960 | * @return void |
| 987 | 961 | */ |
| 988 | - public function __wakeup() |
|
| 989 | - { |
|
| 962 | + public function __wakeup() { |
|
| 990 | 963 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 991 | 964 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 992 | 965 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -1005,8 +978,7 @@ discard block |
||
| 1005 | 978 | * |
| 1006 | 979 | * @return string[] |
| 1007 | 980 | */ |
| 1008 | - public function __sleep() |
|
| 1009 | - { |
|
| 981 | + public function __sleep() { |
|
| 1010 | 982 | // TODO implement serializiation in IIIF library |
| 1011 | 983 | $jsonArray = $this->iiif->getOriginalJsonArray(); |
| 1012 | 984 | $this->asJson = json_encode($jsonArray); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @var bool |
| 88 | 88 | * @access protected |
| 89 | 89 | */ |
| 90 | - protected $hasFulltextSet = false; |
|
| 90 | + protected $hasFulltextSet = FALSE; |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * This holds the original manifest's parsed metadata array with their corresponding |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | protected function establishRecordId($pid) |
| 122 | 122 | { |
| 123 | - if ($this->iiif !== null) { |
|
| 123 | + if ($this->iiif !== NULL) { |
|
| 124 | 124 | /* |
| 125 | 125 | * FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss |
| 126 | 126 | * if the plugin that actually loads the manifest allows content from other pages. |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @var bool |
| 205 | 205 | * @access protected |
| 206 | 206 | */ |
| 207 | - protected $useGrpsLoaded = false; |
|
| 207 | + protected $useGrpsLoaded = FALSE; |
|
| 208 | 208 | |
| 209 | 209 | /** |
| 210 | 210 | * Holds the configured useGrps as array. |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | if (!empty($extConf['fileGrpAudio'])) { |
| 247 | 247 | $this->useGrps['fileGrpAudio'] = GeneralUtility::trimExplode(',', $extConf['fileGrpAudio']); |
| 248 | 248 | } |
| 249 | - $this->useGrpsLoaded = true; |
|
| 249 | + $this->useGrpsLoaded = TRUE; |
|
| 250 | 250 | } |
| 251 | 251 | return array_key_exists($use, $this->useGrps) ? $this->useGrps[$use] : []; |
| 252 | 252 | } |
@@ -259,8 +259,8 @@ discard block |
||
| 259 | 259 | { |
| 260 | 260 | // Is there no physical structure array yet? |
| 261 | 261 | if (!$this->physicalStructureLoaded) { |
| 262 | - if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
|
| 263 | - return null; |
|
| 262 | + if ($this->iiif == NULL || !($this->iiif instanceof ManifestInterface)) { |
|
| 263 | + return NULL; |
|
| 264 | 264 | } |
| 265 | 265 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 266 | 266 | $iiifId = $this->iiif->getId(); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $this->physicalStructureInfo[$physSeq[0]]['label'] = $this->iiif->getLabelForDisplay(); |
| 271 | 271 | $this->physicalStructureInfo[$physSeq[0]]['orderlabel'] = $this->iiif->getLabelForDisplay(); |
| 272 | 272 | $this->physicalStructureInfo[$physSeq[0]]['type'] = 'physSequence'; |
| 273 | - $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = null; |
|
| 273 | + $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = NULL; |
|
| 274 | 274 | $fileUseDownload = $this->getUseGroups('fileGrpDownload'); |
| 275 | 275 | $fileUseFulltext = $this->getUseGroups('fileGrpFulltext'); |
| 276 | 276 | $fileUseThumbs = $this->getUseGroups('fileGrpThumbs'); |
@@ -284,13 +284,13 @@ discard block |
||
| 284 | 284 | if (!empty($fileUseFulltext)) { |
| 285 | 285 | $iiifAlto = $this->iiif->getSeeAlsoUrlsForFormat('application/alto+xml'); |
| 286 | 286 | if (empty($iiifAlto)) { |
| 287 | - $iiifAlto = $this->iiif->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', true); |
|
| 287 | + $iiifAlto = $this->iiif->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', TRUE); |
|
| 288 | 288 | } |
| 289 | 289 | if (!empty($iiifAlto)) { |
| 290 | 290 | $this->mimeTypes[$iiifAlto[0]] = 'application/alto+xml'; |
| 291 | 291 | $this->physicalStructureInfo[$physSeq[0]]['files'][$fileUseFulltext[0]] = $iiifAlto[0]; |
| 292 | - $this->hasFulltext = true; |
|
| 293 | - $this->hasFulltextSet = true; |
|
| 292 | + $this->hasFulltext = TRUE; |
|
| 293 | + $this->hasFulltextSet = TRUE; |
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | if (!empty($this->iiif->getDefaultCanvases())) { |
@@ -309,39 +309,39 @@ discard block |
||
| 309 | 309 | // populate structural metadata info |
| 310 | 310 | $elements[$canvasOrder] = $canvas->getId(); |
| 311 | 311 | $this->physicalStructureInfo[$elements[$canvasOrder]]['id'] = $canvas->getId(); |
| 312 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId'] = null; |
|
| 312 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId'] = NULL; |
|
| 313 | 313 | $this->physicalStructureInfo[$elements[$canvasOrder]]['label'] = $canvas->getLabelForDisplay(); |
| 314 | 314 | $this->physicalStructureInfo[$elements[$canvasOrder]]['orderlabel'] = $canvas->getLabelForDisplay(); |
| 315 | 315 | // assume that a canvas always represents a page |
| 316 | 316 | $this->physicalStructureInfo[$elements[$canvasOrder]]['type'] = 'page'; |
| 317 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds'] = null; |
|
| 318 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = null; |
|
| 317 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds'] = NULL; |
|
| 318 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = NULL; |
|
| 319 | 319 | if (!empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
| 320 | 320 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = []; |
| 321 | 321 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 322 | 322 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'][] = $annotationContainer->getId(); |
| 323 | 323 | if ($extConf['indexAnnotations']) { |
| 324 | - $this->hasFulltext = true; |
|
| 325 | - $this->hasFulltextSet = true; |
|
| 324 | + $this->hasFulltext = TRUE; |
|
| 325 | + $this->hasFulltextSet = TRUE; |
|
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | if (!empty($fileUseFulltext)) { |
| 330 | 330 | $alto = $canvas->getSeeAlsoUrlsForFormat('application/alto+xml'); |
| 331 | 331 | if (empty($alto)) { |
| 332 | - $alto = $canvas->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', true); |
|
| 332 | + $alto = $canvas->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', TRUE); |
|
| 333 | 333 | } |
| 334 | 334 | if (!empty($alto)) { |
| 335 | 335 | $this->mimeTypes[$alto[0]] = 'application/alto+xml'; |
| 336 | 336 | $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUseFulltext[0]] = $alto[0]; |
| 337 | - $this->hasFulltext = true; |
|
| 338 | - $this->hasFulltextSet = true; |
|
| 337 | + $this->hasFulltext = TRUE; |
|
| 338 | + $this->hasFulltextSet = TRUE; |
|
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | if (!empty($fileUses)) { |
| 342 | 342 | $image = $canvas->getImageAnnotations()[0]; |
| 343 | 343 | foreach ($fileUses as $fileUse) { |
| 344 | - if ($image->getBody() !== null && $image->getBody() instanceof ContentResourceInterface) { |
|
| 344 | + if ($image->getBody() !== NULL && $image->getBody() instanceof ContentResourceInterface) { |
|
| 345 | 345 | $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUse] = $image->getBody()->getId(); |
| 346 | 346 | } |
| 347 | 347 | } |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | // Merge and re-index the array to get nice numeric indexes. |
| 361 | 361 | $this->physicalStructure = array_merge($physSeq, $elements); |
| 362 | 362 | } |
| 363 | - $this->physicalStructureLoaded = true; |
|
| 363 | + $this->physicalStructureLoaded = TRUE; |
|
| 364 | 364 | } |
| 365 | 365 | return $this->physicalStructure; |
| 366 | 366 | } |
@@ -385,15 +385,15 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | public function getFileLocation($id) |
| 387 | 387 | { |
| 388 | - if ($id == null) { |
|
| 389 | - return null; |
|
| 388 | + if ($id == NULL) { |
|
| 389 | + return NULL; |
|
| 390 | 390 | } |
| 391 | 391 | $resource = $this->iiif->getContainedResourceById($id); |
| 392 | 392 | if (isset($resource)) { |
| 393 | 393 | if ($resource instanceof CanvasInterface) { |
| 394 | - return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != null) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id; |
|
| 394 | + return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != NULL) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id; |
|
| 395 | 395 | } elseif ($resource instanceof ContentResourceInterface) { |
| 396 | - return $resource->getSingleService() != null && $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id; |
|
| 396 | + return $resource->getSingleService() != NULL && $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id; |
|
| 397 | 397 | } elseif ($resource instanceof AbstractImageService) { |
| 398 | 398 | return $resource->getId(); |
| 399 | 399 | } elseif ($resource instanceof AnnotationContainerInterface) { |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | } elseif ($fileResource instanceof AnnotationInterface) { |
| 417 | 417 | $format = "application/vnd.kitodo.iiif"; |
| 418 | 418 | } elseif ($fileResource instanceof ContentResourceInterface) { |
| 419 | - if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == null || !($fileResource->getSingleService() instanceof AbstractImageService))) { |
|
| 419 | + if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == NULL || !($fileResource->getSingleService() instanceof AbstractImageService))) { |
|
| 420 | 420 | // Support static images without an image service |
| 421 | 421 | return $fileResource->getFormat(); |
| 422 | 422 | } |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | * {@inheritDoc} |
| 435 | 435 | * @see Document::getLogicalStructure() |
| 436 | 436 | */ |
| 437 | - public function getLogicalStructure($id, $recursive = false) |
|
| 437 | + public function getLogicalStructure($id, $recursive = FALSE) |
|
| 438 | 438 | { |
| 439 | 439 | $details = []; |
| 440 | 440 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
@@ -451,8 +451,8 @@ discard block |
||
| 451 | 451 | // cache the ranges - they might occure multiple times in the structures "tree" - with full data as well as referenced as id |
| 452 | 452 | $processedStructures = []; |
| 453 | 453 | foreach ($logUnits as $logUnit) { |
| 454 | - if (array_search($logUnit->getId(), $processedStructures) == false) { |
|
| 455 | - $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, true, $processedStructures); |
|
| 454 | + if (array_search($logUnit->getId(), $processedStructures) == FALSE) { |
|
| 455 | + $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, TRUE, $processedStructures); |
|
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | } |
@@ -470,13 +470,13 @@ discard block |
||
| 470 | 470 | * @param array $processedStructures: IIIF resources that already have been processed |
| 471 | 471 | * @return array Logical structure array |
| 472 | 472 | */ |
| 473 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) |
|
| 473 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = FALSE, &$processedStructures = []) |
|
| 474 | 474 | { |
| 475 | 475 | $details = []; |
| 476 | 476 | $details['id'] = $resource->getId(); |
| 477 | 477 | $details['dmdId'] = ''; |
| 478 | - $details['label'] = $resource->getLabelForDisplay() !== null ? $resource->getLabelForDisplay() : ''; |
|
| 479 | - $details['orderlabel'] = $resource->getLabelForDisplay() !== null ? $resource->getLabelForDisplay() : ''; |
|
| 478 | + $details['label'] = $resource->getLabelForDisplay() !== NULL ? $resource->getLabelForDisplay() : ''; |
|
| 479 | + $details['orderlabel'] = $resource->getLabelForDisplay() !== NULL ? $resource->getLabelForDisplay() : ''; |
|
| 480 | 480 | $details['contentIds'] = ''; |
| 481 | 481 | $details['volume'] = ''; |
| 482 | 482 | $details['pagination'] = ''; |
@@ -501,10 +501,10 @@ discard block |
||
| 501 | 501 | $startCanvas = $resource->getStartCanvasOrFirstCanvas(); |
| 502 | 502 | $canvases = $resource->getAllCanvases(); |
| 503 | 503 | } |
| 504 | - if ($startCanvas != null) { |
|
| 504 | + if ($startCanvas != NULL) { |
|
| 505 | 505 | $details['pagination'] = $startCanvas->getLabel(); |
| 506 | 506 | $startCanvasIndex = array_search($startCanvas, $this->iiif->getDefaultCanvases()); |
| 507 | - if ($startCanvasIndex !== false) { |
|
| 507 | + if ($startCanvasIndex !== FALSE) { |
|
| 508 | 508 | $details['points'] = $startCanvasIndex + 1; |
| 509 | 509 | } |
| 510 | 510 | } |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | if ($recursive) { |
| 519 | 519 | $processedStructures[] = $resource->getId(); |
| 520 | 520 | $details['children'] = []; |
| 521 | - if ($resource instanceof ManifestInterface && $resource->getRootRanges() != null) { |
|
| 521 | + if ($resource instanceof ManifestInterface && $resource->getRootRanges() != NULL) { |
|
| 522 | 522 | $rangesToAdd = []; |
| 523 | 523 | $rootRanges = []; |
| 524 | 524 | if (sizeof($this->iiif->getRootRanges()) == 1 && $this->iiif->getRootRanges()[0]->isTopRange()) { |
@@ -530,15 +530,15 @@ discard block |
||
| 530 | 530 | $rootRanges[] = $range; |
| 531 | 531 | } |
| 532 | 532 | foreach ($rootRanges as $range) { |
| 533 | - if ((array_search($range->getId(), $processedStructures) == false)) { |
|
| 534 | - $details['children'][] = $this->getLogicalStructureInfo($range, true, $processedStructures); |
|
| 533 | + if ((array_search($range->getId(), $processedStructures) == FALSE)) { |
|
| 534 | + $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures); |
|
| 535 | 535 | } |
| 536 | 536 | } |
| 537 | 537 | } elseif ($resource instanceof RangeInterface) { |
| 538 | 538 | if (!empty($resource->getAllRanges())) { |
| 539 | 539 | foreach ($resource->getAllRanges() as $range) { |
| 540 | - if ((array_search($range->getId(), $processedStructures) == false)) { |
|
| 541 | - $details['children'][] = $this->getLogicalStructureInfo($range, true, $processedStructures); |
|
| 540 | + if ((array_search($range->getId(), $processedStructures) == FALSE)) { |
|
| 541 | + $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures); |
|
| 542 | 542 | } |
| 543 | 543 | } |
| 544 | 544 | } |
@@ -563,15 +563,15 @@ discard block |
||
| 563 | 563 | * |
| 564 | 564 | * @todo This method is still in experimental; the method signature may change. |
| 565 | 565 | */ |
| 566 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) |
|
| 566 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = TRUE, $withRights = TRUE, $withRelated = TRUE) |
|
| 567 | 567 | { |
| 568 | 568 | if (!empty($this->originalMetadataArray[$id])) { |
| 569 | 569 | return $this->originalMetadataArray[$id]; |
| 570 | 570 | } |
| 571 | 571 | $iiifResource = $this->iiif->getContainedResourceById($id); |
| 572 | 572 | $result = []; |
| 573 | - if ($iiifResource != null) { |
|
| 574 | - if ($iiifResource->getLabel() != null && $iiifResource->getLabel() != "") { |
|
| 573 | + if ($iiifResource != NULL) { |
|
| 574 | + if ($iiifResource->getLabel() != NULL && $iiifResource->getLabel() != "") { |
|
| 575 | 575 | $result['label'] = $iiifResource->getLabel(); |
| 576 | 576 | } |
| 577 | 577 | if (!empty($iiifResource->getMetadata())) { |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | $iiifResource = $this->iiif->getContainedResourceById($id); |
| 674 | 674 | while ($resArray = $result->fetch()) { |
| 675 | 675 | // Set metadata field's value(s). |
| 676 | - if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != null) { |
|
| 676 | + if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != NULL) { |
|
| 677 | 677 | if (is_string($values)) { |
| 678 | 678 | $metadata[$resArray['index_name']] = [trim((string) $values)]; |
| 679 | 679 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) { |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | if (!empty($metadata[$resArray['index_name']]) && $resArray['is_sortable']) { |
| 692 | 692 | if ( |
| 693 | 693 | $resArray['format'] > 0 && !empty($resArray['xpath_sorting']) |
| 694 | - && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != null) |
|
| 694 | + && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != NULL) |
|
| 695 | 695 | ) { |
| 696 | 696 | if (is_string($values)) { |
| 697 | 697 | $metadata[$resArray['index_name'] . '_sorting'][0] = [trim((string) $values)]; |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | $this->smLinkRangeCanvasesRecursively($range); |
| 728 | 728 | } |
| 729 | 729 | } |
| 730 | - $this->smLinksLoaded = true; |
|
| 730 | + $this->smLinksLoaded = TRUE; |
|
| 731 | 731 | } |
| 732 | 732 | return $this->smLinks; |
| 733 | 733 | } |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | foreach ($annotationContainer->getTextAnnotations(Motivation::PAINTING) as $annotation) { |
| 822 | 822 | if ( |
| 823 | 823 | $annotation->getTargetResourceId() == $iiifResource->getId() && |
| 824 | - $annotation->getBody() != null && $annotation->getBody()->getChars() != null |
|
| 824 | + $annotation->getBody() != NULL && $annotation->getBody()->getChars() != NULL |
|
| 825 | 825 | ) { |
| 826 | 826 | $annotationTexts[] = $annotation->getBody()->getChars(); |
| 827 | 827 | } |
@@ -867,21 +867,21 @@ discard block |
||
| 867 | 867 | protected function loadLocation($location) |
| 868 | 868 | { |
| 869 | 869 | $fileResource = GeneralUtility::getUrl($location); |
| 870 | - if ($fileResource !== false) { |
|
| 870 | + if ($fileResource !== FALSE) { |
|
| 871 | 871 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 872 | 872 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 873 | 873 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 874 | 874 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 875 | 875 | $resource = IiifHelper::loadIiifResource($fileResource); |
| 876 | - if ($resource != null) { |
|
| 876 | + if ($resource != NULL) { |
|
| 877 | 877 | if ($resource instanceof ManifestInterface) { |
| 878 | 878 | $this->iiif = $resource; |
| 879 | - return true; |
|
| 879 | + return TRUE; |
|
| 880 | 880 | } |
| 881 | 881 | } |
| 882 | 882 | } |
| 883 | 883 | Helper::devLog('Could not load IIIF manifest from "' . $location . '"', DEVLOG_SEVERITY_ERROR); |
| 884 | - return false; |
|
| 884 | + return FALSE; |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | /** |
@@ -902,9 +902,9 @@ discard block |
||
| 902 | 902 | { |
| 903 | 903 | if ($preloadedDocument instanceof ManifestInterface) { |
| 904 | 904 | $this->iiif = $preloadedDocument; |
| 905 | - return true; |
|
| 905 | + return TRUE; |
|
| 906 | 906 | } |
| 907 | - return false; |
|
| 907 | + return FALSE; |
|
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | /** |
@@ -927,22 +927,22 @@ discard block |
||
| 927 | 927 | !empty($canvas->getSeeAlsoUrlsForFormat("application/alto+xml")) || |
| 928 | 928 | !empty($canvas->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/")) |
| 929 | 929 | ) { |
| 930 | - $this->hasFulltextSet = true; |
|
| 931 | - $this->hasFulltext = true; |
|
| 930 | + $this->hasFulltextSet = TRUE; |
|
| 931 | + $this->hasFulltext = TRUE; |
|
| 932 | 932 | return; |
| 933 | 933 | } |
| 934 | 934 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 935 | 935 | if ($extConf['indexAnnotations'] == 1 && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
| 936 | 936 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 937 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
| 937 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
| 938 | 938 | foreach ($textAnnotations as $annotation) { |
| 939 | 939 | if ( |
| 940 | - $annotation->getBody() != null && |
|
| 940 | + $annotation->getBody() != NULL && |
|
| 941 | 941 | $annotation->getBody()->getFormat() == "text/plain" && |
| 942 | - $annotation->getBody()->getChars() != null |
|
| 942 | + $annotation->getBody()->getChars() != NULL |
|
| 943 | 943 | ) { |
| 944 | - $this->hasFulltextSet = true; |
|
| 945 | - $this->hasFulltext = true; |
|
| 944 | + $this->hasFulltextSet = TRUE; |
|
| 945 | + $this->hasFulltext = TRUE; |
|
| 946 | 946 | return; |
| 947 | 947 | } |
| 948 | 948 | } |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | } |
| 951 | 951 | } |
| 952 | 952 | } |
| 953 | - $this->hasFulltextSet = true; |
|
| 953 | + $this->hasFulltextSet = TRUE; |
|
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | 956 | |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | * {@inheritDoc} |
| 959 | 959 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
| 960 | 960 | */ |
| 961 | - protected function _getThumbnail($forceReload = false) |
|
| 961 | + protected function _getThumbnail($forceReload = FALSE) |
|
| 962 | 962 | { |
| 963 | 963 | return $this->iiif->getThumbnailUrl(); |
| 964 | 964 | } |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 993 | 993 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 994 | 994 | $resource = IiifHelper::loadIiifResource($this->asJson); |
| 995 | - if ($resource != null && $resource instanceof ManifestInterface) { |
|
| 995 | + if ($resource != NULL && $resource instanceof ManifestInterface) { |
|
| 996 | 996 | $this->asJson = ''; |
| 997 | 997 | $this->iiif = $resource; |
| 998 | 998 | $this->init(); |