@@ -24,9 +24,9 @@ |
||
| 24 | 24 | 'suggests' => [] |
| 25 | 25 | ], |
| 26 | 26 | 'state' => 'stable', |
| 27 | - 'uploadfolder' => false, |
|
| 27 | + 'uploadfolder' => FALSE, |
|
| 28 | 28 | 'createDirs' => '', |
| 29 | - 'clearCacheOnLoad' => false, |
|
| 29 | + 'clearCacheOnLoad' => FALSE, |
|
| 30 | 30 | 'author' => 'Sebastian Meyer (Maintainer)', |
| 31 | 31 | 'author_email' => '[email protected]', |
| 32 | 32 | 'author_company' => 'Kitodo. Key to digital objects e. V.', |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage dlf |
| 26 | 26 | * @access public |
| 27 | 27 | */ |
| 28 | -class Feeds extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 29 | -{ |
|
| 28 | +class Feeds extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 30 | 29 | public $scriptRelPath = 'Classes/Plugin/Feeds.php'; |
| 31 | 30 | |
| 32 | 31 | /** |
@@ -39,8 +38,7 @@ discard block |
||
| 39 | 38 | * |
| 40 | 39 | * @return void |
| 41 | 40 | */ |
| 42 | - public function main($content, $conf) |
|
| 43 | - { |
|
| 41 | + public function main($content, $conf) { |
|
| 44 | 42 | $this->init($conf); |
| 45 | 43 | // Don't cache the output. |
| 46 | 44 | $this->setCache(false); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $this->init($conf); |
| 45 | 45 | // Don't cache the output. |
| 46 | - $this->setCache(false); |
|
| 46 | + $this->setCache(FALSE); |
|
| 47 | 47 | // Create XML document. |
| 48 | 48 | $rss = new \DOMDocument('1.0', 'utf-8'); |
| 49 | 49 | // Add mandatory root element. |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | if ((empty($resArray['title']) || !empty($this->conf['prependSuperiorTitle'])) |
| 117 | 117 | && !empty($resArray['partof']) |
| 118 | 118 | ) { |
| 119 | - $superiorTitle = Document::getTitle($resArray['partof'], true); |
|
| 119 | + $superiorTitle = Document::getTitle($resArray['partof'], TRUE); |
|
| 120 | 120 | if (!empty($superiorTitle)) { |
| 121 | 121 | $title .= '[' . $superiorTitle . ']'; |
| 122 | 122 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | 'parameter' => $this->conf['targetPid'], |
| 146 | 146 | 'forceAbsoluteUrl' => 1, |
| 147 | 147 | 'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'], |
| 148 | - 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, ['id' => $resArray['uid']], '', true, false) |
|
| 148 | + 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, ['id' => $resArray['uid']], '', TRUE, FALSE) |
|
| 149 | 149 | ]; |
| 150 | 150 | $item->appendChild($rss->createElement('link', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8'))); |
| 151 | 151 | // Add author if applicable. |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | $additionalWhere = ''; |
| 89 | 89 | // Check for pre-selected collections. |
| 90 | 90 | if (!empty($this->piVars['collection'])) { |
| 91 | - $additionalWhere = 'tx_dlf_collections.uid=' . intval($this->piVars['collection']); |
|
| 91 | + $additionalWhere = 'tx_dlf_collections.uid='.intval($this->piVars['collection']); |
|
| 92 | 92 | } elseif (!empty($this->conf['collections'])) { |
| 93 | - $additionalWhere = 'tx_dlf_collections.uid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']) . ')'; |
|
| 93 | + $additionalWhere = 'tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')'; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -121,16 +121,16 @@ discard block |
||
| 121 | 121 | $queryBuilder->expr()->eq('tx_dlf_collections.uid', $queryBuilder->quoteIdentifier('tx_dlf_documents_collections_mm.uid_foreign')) |
| 122 | 122 | ) |
| 123 | 123 | ->where( |
| 124 | - $queryBuilder->expr()->eq('tx_dlf_documents.pid', $queryBuilder->createNamedParameter((int)$this->conf['pages'])), |
|
| 124 | + $queryBuilder->expr()->eq('tx_dlf_documents.pid', $queryBuilder->createNamedParameter((int) $this->conf['pages'])), |
|
| 125 | 125 | $queryBuilder->expr()->eq('tx_dlf_documents_collections_mm.ident', $queryBuilder->createNamedParameter('docs_colls')), |
| 126 | - $queryBuilder->expr()->eq('tx_dlf_collections.pid', $queryBuilder->createNamedParameter((int)$this->conf['pages'])), |
|
| 126 | + $queryBuilder->expr()->eq('tx_dlf_collections.pid', $queryBuilder->createNamedParameter((int) $this->conf['pages'])), |
|
| 127 | 127 | $additionalWhere, |
| 128 | 128 | Helper::whereExpression('tx_dlf_documents'), |
| 129 | 129 | Helper::whereExpression('tx_dlf_collections'), |
| 130 | 130 | ) |
| 131 | 131 | ->groupBy('tx_dlf_documents.uid') |
| 132 | 132 | ->orderBy('tx_dlf_documents.tstamp', 'DESC') |
| 133 | - ->setMaxResults((int)$this->conf['limit']) |
|
| 133 | + ->setMaxResults((int) $this->conf['limit']) |
|
| 134 | 134 | ->execute(); |
| 135 | 135 | $rows = $result->fetchAll(); |
| 136 | 136 | |
@@ -145,12 +145,12 @@ discard block |
||
| 145 | 145 | ) { |
| 146 | 146 | $superiorTitle = Document::getTitle($resArray['partof'], true); |
| 147 | 147 | if (!empty($superiorTitle)) { |
| 148 | - $title .= '[' . $superiorTitle . ']'; |
|
| 148 | + $title .= '['.$superiorTitle.']'; |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | // Get title of document. |
| 152 | 152 | if (!empty($resArray['title'])) { |
| 153 | - $title .= ' ' . $resArray['title']; |
|
| 153 | + $title .= ' '.$resArray['title']; |
|
| 154 | 154 | } |
| 155 | 155 | // Set default title if empty. |
| 156 | 156 | if (empty($title)) { |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | // Append volume information. |
| 160 | 160 | if (!empty($resArray['volume'])) { |
| 161 | - $title .= ', ' . $this->pi_getLL('volume') . ' ' . $resArray['volume']; |
|
| 161 | + $title .= ', '.$this->pi_getLL('volume').' '.$resArray['volume']; |
|
| 162 | 162 | } |
| 163 | 163 | // Is this document new or updated? |
| 164 | 164 | if ($resArray['crdate'] == $resArray['tstamp']) { |
| 165 | - $title = $this->pi_getLL('new') . ' ' . trim($title); |
|
| 165 | + $title = $this->pi_getLL('new').' '.trim($title); |
|
| 166 | 166 | } else { |
| 167 | - $title = $this->pi_getLL('update') . ' ' . trim($title); |
|
| 167 | + $title = $this->pi_getLL('update').' '.trim($title); |
|
| 168 | 168 | } |
| 169 | 169 | $item->appendChild($rss->createElement('title', htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8'))); |
| 170 | 170 | // Add link. |
@@ -196,10 +196,10 @@ discard block |
||
| 196 | 196 | // Send headers. |
| 197 | 197 | header('HTTP/1.1 200 OK'); |
| 198 | 198 | header('Cache-Control: no-cache'); |
| 199 | - header('Content-Length: ' . strlen($content)); |
|
| 199 | + header('Content-Length: '.strlen($content)); |
|
| 200 | 200 | header('Content-Type: application/rss+xml; charset=utf-8'); |
| 201 | - header('Date: ' . date('r', $GLOBALS['EXEC_TIME'])); |
|
| 202 | - header('Expires: ' . date('r', $GLOBALS['EXEC_TIME'])); |
|
| 201 | + header('Date: '.date('r', $GLOBALS['EXEC_TIME'])); |
|
| 202 | + header('Expires: '.date('r', $GLOBALS['EXEC_TIME'])); |
|
| 203 | 203 | echo $content; |
| 204 | 204 | exit; |
| 205 | 205 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $fileMimeType = $this->getFileMimeType($id); |
| 168 | 168 | $fileLocation = $this->getFileLocation($id); |
| 169 | 169 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
| 170 | - $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation . 'info.json' : $fileLocation . '/info.json'); |
|
| 170 | + $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation.'info.json' : $fileLocation.'/info.json'); |
|
| 171 | 171 | $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 172 | 172 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 173 | 173 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | return $service->getImageUrl(); |
| 178 | 178 | } |
| 179 | 179 | } elseif ($fileMimeType === 'application/vnd.netfpx') { |
| 180 | - $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : ''); |
|
| 180 | + $baseURL = $fileLocation.(strpos($fileLocation, '?') === false ? '?' : ''); |
|
| 181 | 181 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
| 182 | - return $baseURL . '&CVT=jpeg'; |
|
| 182 | + return $baseURL.'&CVT=jpeg'; |
|
| 183 | 183 | } |
| 184 | 184 | return $fileLocation; |
| 185 | 185 | } |
@@ -190,14 +190,14 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function getFileLocation($id) |
| 192 | 192 | { |
| 193 | - $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
| 193 | + $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
| 194 | 194 | if ( |
| 195 | 195 | !empty($id) |
| 196 | 196 | && !empty($location) |
| 197 | 197 | ) { |
| 198 | 198 | return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 199 | 199 | } else { |
| 200 | - Helper::devLog('There is no file node with @ID "' . $id . '"', DEVLOG_SEVERITY_WARNING); |
|
| 200 | + Helper::devLog('There is no file node with @ID "'.$id.'"', DEVLOG_SEVERITY_WARNING); |
|
| 201 | 201 | return ''; |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -208,14 +208,14 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public function getFileMimeType($id) |
| 210 | 210 | { |
| 211 | - $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
|
| 211 | + $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'); |
|
| 212 | 212 | if ( |
| 213 | 213 | !empty($id) |
| 214 | 214 | && !empty($mimetype) |
| 215 | 215 | ) { |
| 216 | 216 | return (string) $mimetype[0]; |
| 217 | 217 | } else { |
| 218 | - Helper::devLog('There is no file node with @ID "' . $id . '" or no MIME type specified', DEVLOG_SEVERITY_WARNING); |
|
| 218 | + Helper::devLog('There is no file node with @ID "'.$id.'" or no MIME type specified', DEVLOG_SEVERITY_WARNING); |
|
| 219 | 219 | return ''; |
| 220 | 220 | } |
| 221 | 221 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | return $this->logicalUnits[$id]; |
| 237 | 237 | } elseif (!empty($id)) { |
| 238 | 238 | // Get specified logical unit. |
| 239 | - $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]'); |
|
| 239 | + $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]'); |
|
| 240 | 240 | } else { |
| 241 | 241 | // Get all logical units at top level. |
| 242 | 242 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | // Retain current PID. |
| 369 | 369 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 370 | 370 | } elseif (!$cPid) { |
| 371 | - Helper::devLog('Invalid PID ' . $cPid . ' for metadata definitions', DEVLOG_SEVERITY_WARNING); |
|
| 371 | + Helper::devLog('Invalid PID '.$cPid.' for metadata definitions', DEVLOG_SEVERITY_WARNING); |
|
| 372 | 372 | return []; |
| 373 | 373 | } |
| 374 | 374 | // Get metadata from parsed metadata array if available. |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | if (!empty($this->logicalUnits[$id])) { |
| 410 | 410 | $dmdIds = $this->logicalUnits[$id]['dmdId']; |
| 411 | 411 | } else { |
| 412 | - $dmdIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@DMDID'); |
|
| 412 | + $dmdIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@DMDID'); |
|
| 413 | 413 | $dmdIds = (string) $dmdIds[0]; |
| 414 | 414 | } |
| 415 | 415 | if (!empty($dmdIds)) { |
@@ -435,11 +435,11 @@ discard block |
||
| 435 | 435 | ) { |
| 436 | 436 | $obj->extractMetadata($this->dmdSec[$dmdId]['xml'], $metadata); |
| 437 | 437 | } else { |
| 438 | - Helper::devLog('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->dmdSec[$dmdId]['type'] . '"', DEVLOG_SEVERITY_WARNING); |
|
| 438 | + Helper::devLog('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->dmdSec[$dmdId]['type'].'"', DEVLOG_SEVERITY_WARNING); |
|
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | 441 | } else { |
| 442 | - Helper::devLog('Unsupported metadata format "' . $this->dmdSec[$dmdId]['type'] . '" in dmdSec with @ID "' . $dmdId . '"', DEVLOG_SEVERITY_NOTICE); |
|
| 442 | + Helper::devLog('Unsupported metadata format "'.$this->dmdSec[$dmdId]['type'].'" in dmdSec with @ID "'.$dmdId.'"', DEVLOG_SEVERITY_NOTICE); |
|
| 443 | 443 | // Continue searching for supported metadata with next @DMDID. |
| 444 | 444 | continue; |
| 445 | 445 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | if (!empty($this->logicalUnits[$id])) { |
| 448 | 448 | $metadata['type'] = [$this->logicalUnits[$id]['type']]; |
| 449 | 449 | } else { |
| 450 | - $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE'); |
|
| 450 | + $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
|
| 451 | 451 | if (!empty($struct)) { |
| 452 | 452 | $metadata['type'] = [(string) $struct[0]]; |
| 453 | 453 | } |
@@ -564,13 +564,13 @@ discard block |
||
| 564 | 564 | $values instanceof \DOMNodeList |
| 565 | 565 | && $values->length > 0 |
| 566 | 566 | ) { |
| 567 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 567 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 568 | 568 | } elseif (!($values instanceof \DOMNodeList)) { |
| 569 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values); |
|
| 569 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values); |
|
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
| 573 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 572 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
| 573 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 574 | 574 | } |
| 575 | 575 | } |
| 576 | 576 | } |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | if ($hasSupportedMetadata) { |
| 633 | 633 | return $metadata; |
| 634 | 634 | } else { |
| 635 | - Helper::devLog('No supported metadata found for logical structure with @ID "' . $id . '"', DEVLOG_SEVERITY_WARNING); |
|
| 635 | + Helper::devLog('No supported metadata found for logical structure with @ID "'.$id.'"', DEVLOG_SEVERITY_WARNING); |
|
| 636 | 636 | return []; |
| 637 | 637 | } |
| 638 | 638 | } |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | */ |
| 663 | 663 | public function getStructureDepth($logId) |
| 664 | 664 | { |
| 665 | - $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
|
| 665 | + $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'); |
|
| 666 | 666 | if (!empty($ancestors)) { |
| 667 | 667 | return count($ancestors); |
| 668 | 668 | } else { |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | // Register namespaces. |
| 685 | 685 | $this->registerNamespaces($this->mets); |
| 686 | 686 | } else { |
| 687 | - Helper::devLog('No METS part found in document with UID ' . $this->uid, DEVLOG_SEVERITY_ERROR); |
|
| 687 | + Helper::devLog('No METS part found in document with UID '.$this->uid, DEVLOG_SEVERITY_ERROR); |
|
| 688 | 688 | } |
| 689 | 689 | } |
| 690 | 690 | |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | return true; |
| 713 | 713 | } |
| 714 | 714 | } |
| 715 | - Helper::devLog('Could not load XML file from "' . $location . '"', DEVLOG_SEVERITY_ERROR); |
|
| 715 | + Helper::devLog('Could not load XML file from "'.$location.'"', DEVLOG_SEVERITY_ERROR); |
|
| 716 | 716 | return false; |
| 717 | 717 | } |
| 718 | 718 | |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | { |
| 737 | 737 | $partof = 0; |
| 738 | 738 | // Get the closest ancestor of the current document which has a MPTR child. |
| 739 | - $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->_getToplevelId() . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
| 739 | + $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->_getToplevelId().'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
| 740 | 740 | if (!empty($parentMptr)) { |
| 741 | 741 | $parentLocation = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 742 | 742 | if ($parentLocation != $this->location) { |
@@ -803,15 +803,15 @@ discard block |
||
| 803 | 803 | $dmdIds = $this->mets->xpath('./mets:dmdSec/@ID'); |
| 804 | 804 | if (!empty($dmdIds)) { |
| 805 | 805 | foreach ($dmdIds as $dmdId) { |
| 806 | - if ($type = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) { |
|
| 806 | + if ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) { |
|
| 807 | 807 | if (!empty($this->formats[(string) $type[0]])) { |
| 808 | 808 | $type = (string) $type[0]; |
| 809 | - $xml = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 809 | + $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 810 | 810 | } |
| 811 | - } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) { |
|
| 811 | + } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) { |
|
| 812 | 812 | if (!empty($this->formats[(string) $type[0]])) { |
| 813 | 813 | $type = (string) $type[0]; |
| 814 | - $xml = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 814 | + $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 815 | 815 | } |
| 816 | 816 | } |
| 817 | 817 | if (!empty($xml)) { |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | // Retain current PID. |
| 997 | 997 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 998 | 998 | if (!$cPid) { |
| 999 | - Helper::devLog('Invalid PID ' . $cPid . ' for structure definitions', DEVLOG_SEVERITY_ERROR); |
|
| 999 | + Helper::devLog('Invalid PID '.$cPid.' for structure definitions', DEVLOG_SEVERITY_ERROR); |
|
| 1000 | 1000 | $this->thumbnailLoaded = true; |
| 1001 | 1001 | return $this->thumbnail; |
| 1002 | 1002 | } |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | if (!empty($resArray['thumbnail'])) { |
| 1034 | 1034 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid); |
| 1035 | 1035 | // Check if this document has a structure element of the desired type. |
| 1036 | - $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
|
| 1036 | + $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID'); |
|
| 1037 | 1037 | if (!empty($strctIds)) { |
| 1038 | 1038 | $strctId = (string) $strctIds[0]; |
| 1039 | 1039 | } |
@@ -1050,7 +1050,7 @@ discard block |
||
| 1050 | 1050 | $this->thumbnail = $this->getFileLocation($this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$extConf['fileGrpThumbs']]); |
| 1051 | 1051 | } |
| 1052 | 1052 | } else { |
| 1053 | - Helper::devLog('No structure of type "' . $metadata['type'][0] . '" found in database', DEVLOG_SEVERITY_ERROR); |
|
| 1053 | + Helper::devLog('No structure of type "'.$metadata['type'][0].'" found in database', DEVLOG_SEVERITY_ERROR); |
|
| 1054 | 1054 | } |
| 1055 | 1055 | $this->thumbnailLoaded = true; |
| 1056 | 1056 | } |
@@ -47,8 +47,7 @@ discard block |
||
| 47 | 47 | * @property-read string $toplevelId This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF) |
| 48 | 48 | * @property-read mixed $uid This holds the UID or the URL of the document |
| 49 | 49 | */ |
| 50 | -final class MetsDocument extends Document |
|
| 51 | -{ |
|
| 50 | +final class MetsDocument extends Document { |
|
| 52 | 51 | /** |
| 53 | 52 | * This holds the whole XML file as string for serialization purposes |
| 54 | 53 | * @see __sleep() / __wakeup() |
@@ -127,8 +126,7 @@ discard block |
||
| 127 | 126 | * |
| 128 | 127 | * @return void |
| 129 | 128 | */ |
| 130 | - public function addMetadataFromMets(&$metadata, $id) |
|
| 131 | - { |
|
| 129 | + public function addMetadataFromMets(&$metadata, $id) { |
|
| 132 | 130 | $details = $this->getLogicalStructure($id); |
| 133 | 131 | if (!empty($details)) { |
| 134 | 132 | $metadata['mets_label'][0] = $details['label']; |
@@ -141,8 +139,7 @@ discard block |
||
| 141 | 139 | * {@inheritDoc} |
| 142 | 140 | * @see \Kitodo\Dlf\Common\Document::establishRecordId() |
| 143 | 141 | */ |
| 144 | - protected function establishRecordId($pid) |
|
| 145 | - { |
|
| 142 | + protected function establishRecordId($pid) { |
|
| 146 | 143 | // Check for METS object @ID. |
| 147 | 144 | if (!empty($this->mets['OBJID'])) { |
| 148 | 145 | $this->recordId = (string) $this->mets['OBJID']; |
@@ -162,8 +159,7 @@ discard block |
||
| 162 | 159 | * {@inheritDoc} |
| 163 | 160 | * @see \Kitodo\Dlf\Common\Document::getDownloadLocation() |
| 164 | 161 | */ |
| 165 | - public function getDownloadLocation($id) |
|
| 166 | - { |
|
| 162 | + public function getDownloadLocation($id) { |
|
| 167 | 163 | $fileMimeType = $this->getFileMimeType($id); |
| 168 | 164 | $fileLocation = $this->getFileLocation($id); |
| 169 | 165 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
@@ -188,8 +184,7 @@ discard block |
||
| 188 | 184 | * {@inheritDoc} |
| 189 | 185 | * @see \Kitodo\Dlf\Common\Document::getFileLocation() |
| 190 | 186 | */ |
| 191 | - public function getFileLocation($id) |
|
| 192 | - { |
|
| 187 | + public function getFileLocation($id) { |
|
| 193 | 188 | $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
| 194 | 189 | if ( |
| 195 | 190 | !empty($id) |
@@ -206,8 +201,7 @@ discard block |
||
| 206 | 201 | * {@inheritDoc} |
| 207 | 202 | * @see \Kitodo\Dlf\Common\Document::getFileMimeType() |
| 208 | 203 | */ |
| 209 | - public function getFileMimeType($id) |
|
| 210 | - { |
|
| 204 | + public function getFileMimeType($id) { |
|
| 211 | 205 | $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
| 212 | 206 | if ( |
| 213 | 207 | !empty($id) |
@@ -224,8 +218,7 @@ discard block |
||
| 224 | 218 | * {@inheritDoc} |
| 225 | 219 | * @see \Kitodo\Dlf\Common\Document::getLogicalStructure() |
| 226 | 220 | */ |
| 227 | - public function getLogicalStructure($id, $recursive = false) |
|
| 228 | - { |
|
| 221 | + public function getLogicalStructure($id, $recursive = false) { |
|
| 229 | 222 | $details = []; |
| 230 | 223 | // Is the requested logical unit already loaded? |
| 231 | 224 | if ( |
@@ -265,8 +258,7 @@ discard block |
||
| 265 | 258 | * |
| 266 | 259 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
| 267 | 260 | */ |
| 268 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) |
|
| 269 | - { |
|
| 261 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) { |
|
| 270 | 262 | // Get attributes. |
| 271 | 263 | foreach ($structure->attributes() as $attribute => $value) { |
| 272 | 264 | $attributes[$attribute] = (string) $value; |
@@ -356,8 +348,7 @@ discard block |
||
| 356 | 348 | * {@inheritDoc} |
| 357 | 349 | * @see \Kitodo\Dlf\Common\Document::getMetadata() |
| 358 | 350 | */ |
| 359 | - public function getMetadata($id, $cPid = 0) |
|
| 360 | - { |
|
| 351 | + public function getMetadata($id, $cPid = 0) { |
|
| 361 | 352 | // Make sure $cPid is a non-negative integer. |
| 362 | 353 | $cPid = max(intval($cPid), 0); |
| 363 | 354 | // If $cPid is not given, try to get it elsewhere. |
@@ -641,8 +632,7 @@ discard block |
||
| 641 | 632 | * {@inheritDoc} |
| 642 | 633 | * @see \Kitodo\Dlf\Common\Document::getRawText() |
| 643 | 634 | */ |
| 644 | - public function getRawText($id) |
|
| 645 | - { |
|
| 635 | + public function getRawText($id) { |
|
| 646 | 636 | $rawText = ''; |
| 647 | 637 | // Get text from raw text array if available. |
| 648 | 638 | if (!empty($this->rawTextArray[$id])) { |
@@ -660,8 +650,7 @@ discard block |
||
| 660 | 650 | * {@inheritDoc} |
| 661 | 651 | * @see Document::getStructureDepth() |
| 662 | 652 | */ |
| 663 | - public function getStructureDepth($logId) |
|
| 664 | - { |
|
| 653 | + public function getStructureDepth($logId) { |
|
| 665 | 654 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
| 666 | 655 | if (!empty($ancestors)) { |
| 667 | 656 | return count($ancestors); |
@@ -674,8 +663,7 @@ discard block |
||
| 674 | 663 | * {@inheritDoc} |
| 675 | 664 | * @see \Kitodo\Dlf\Common\Document::init() |
| 676 | 665 | */ |
| 677 | - protected function init() |
|
| 678 | - { |
|
| 666 | + protected function init() { |
|
| 679 | 667 | // Get METS node from XML file. |
| 680 | 668 | $this->registerNamespaces($this->xml); |
| 681 | 669 | $mets = $this->xml->xpath('//mets:mets'); |
@@ -692,8 +680,7 @@ discard block |
||
| 692 | 680 | * {@inheritDoc} |
| 693 | 681 | * @see \Kitodo\Dlf\Common\Document::loadLocation() |
| 694 | 682 | */ |
| 695 | - protected function loadLocation($location) |
|
| 696 | - { |
|
| 683 | + protected function loadLocation($location) { |
|
| 697 | 684 | $fileResource = GeneralUtility::getUrl($location); |
| 698 | 685 | if ($fileResource !== false) { |
| 699 | 686 | // Turn off libxml's error logging. |
@@ -720,8 +707,7 @@ discard block |
||
| 720 | 707 | * {@inheritDoc} |
| 721 | 708 | * @see \Kitodo\Dlf\Common\Document::ensureHasFulltextIsSet() |
| 722 | 709 | */ |
| 723 | - protected function ensureHasFulltextIsSet() |
|
| 724 | - { |
|
| 710 | + protected function ensureHasFulltextIsSet() { |
|
| 725 | 711 | // Are the fileGrps already loaded? |
| 726 | 712 | if (!$this->fileGrpsLoaded) { |
| 727 | 713 | $this->_getFileGrps(); |
@@ -732,8 +718,7 @@ discard block |
||
| 732 | 718 | * {@inheritDoc} |
| 733 | 719 | * @see Document::getParentDocumentUid() |
| 734 | 720 | */ |
| 735 | - protected function getParentDocumentUidForSaving($pid, $core) |
|
| 736 | - { |
|
| 721 | + protected function getParentDocumentUidForSaving($pid, $core) { |
|
| 737 | 722 | $partof = 0; |
| 738 | 723 | // Get the closest ancestor of the current document which has a MPTR child. |
| 739 | 724 | $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->_getToplevelId() . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
@@ -756,8 +741,7 @@ discard block |
||
| 756 | 741 | * {@inheritDoc} |
| 757 | 742 | * @see Document::setPreloadedDocument() |
| 758 | 743 | */ |
| 759 | - protected function setPreloadedDocument($preloadedDocument) |
|
| 760 | - { |
|
| 744 | + protected function setPreloadedDocument($preloadedDocument) { |
|
| 761 | 745 | |
| 762 | 746 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
| 763 | 747 | $this->xml = $preloadedDocument; |
@@ -770,8 +754,7 @@ discard block |
||
| 770 | 754 | * {@inheritDoc} |
| 771 | 755 | * @see Document::getDocument() |
| 772 | 756 | */ |
| 773 | - protected function getDocument() |
|
| 774 | - { |
|
| 757 | + protected function getDocument() { |
|
| 775 | 758 | return $this->mets; |
| 776 | 759 | } |
| 777 | 760 | |
@@ -782,8 +765,7 @@ discard block |
||
| 782 | 765 | * |
| 783 | 766 | * @return int The PID of the metadata definitions |
| 784 | 767 | */ |
| 785 | - protected function _getCPid() |
|
| 786 | - { |
|
| 768 | + protected function _getCPid() { |
|
| 787 | 769 | return $this->cPid; |
| 788 | 770 | } |
| 789 | 771 | |
@@ -794,8 +776,7 @@ discard block |
||
| 794 | 776 | * |
| 795 | 777 | * @return array Array of dmdSecs with their IDs as array key |
| 796 | 778 | */ |
| 797 | - protected function _getDmdSec() |
|
| 798 | - { |
|
| 779 | + protected function _getDmdSec() { |
|
| 799 | 780 | if (!$this->dmdSecLoaded) { |
| 800 | 781 | // Get available data formats. |
| 801 | 782 | $this->loadFormats(); |
@@ -833,8 +814,7 @@ discard block |
||
| 833 | 814 | * |
| 834 | 815 | * @return array Array of file use groups with file IDs |
| 835 | 816 | */ |
| 836 | - protected function _getFileGrps() |
|
| 837 | - { |
|
| 817 | + protected function _getFileGrps() { |
|
| 838 | 818 | if (!$this->fileGrpsLoaded) { |
| 839 | 819 | // Get configured USE attributes. |
| 840 | 820 | $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
@@ -879,8 +859,7 @@ discard block |
||
| 879 | 859 | * {@inheritDoc} |
| 880 | 860 | * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray() |
| 881 | 861 | */ |
| 882 | - protected function prepareMetadataArray($cPid) |
|
| 883 | - { |
|
| 862 | + protected function prepareMetadataArray($cPid) { |
|
| 884 | 863 | $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'); |
| 885 | 864 | // Get all logical structure nodes with metadata. |
| 886 | 865 | if (!empty($ids)) { |
@@ -898,8 +877,7 @@ discard block |
||
| 898 | 877 | * |
| 899 | 878 | * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object |
| 900 | 879 | */ |
| 901 | - protected function _getMets() |
|
| 902 | - { |
|
| 880 | + protected function _getMets() { |
|
| 903 | 881 | return $this->mets; |
| 904 | 882 | } |
| 905 | 883 | |
@@ -907,8 +885,7 @@ discard block |
||
| 907 | 885 | * {@inheritDoc} |
| 908 | 886 | * @see \Kitodo\Dlf\Common\Document::_getPhysicalStructure() |
| 909 | 887 | */ |
| 910 | - protected function _getPhysicalStructure() |
|
| 911 | - { |
|
| 888 | + protected function _getPhysicalStructure() { |
|
| 912 | 889 | // Is there no physical structure array yet? |
| 913 | 890 | if (!$this->physicalStructureLoaded) { |
| 914 | 891 | // Does the document have a structMap node of type "PHYSICAL"? |
@@ -968,8 +945,7 @@ discard block |
||
| 968 | 945 | * {@inheritDoc} |
| 969 | 946 | * @see \Kitodo\Dlf\Common\Document::_getSmLinks() |
| 970 | 947 | */ |
| 971 | - protected function _getSmLinks() |
|
| 972 | - { |
|
| 948 | + protected function _getSmLinks() { |
|
| 973 | 949 | if (!$this->smLinksLoaded) { |
| 974 | 950 | $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink'); |
| 975 | 951 | if (!empty($smLinks)) { |
@@ -987,8 +963,7 @@ discard block |
||
| 987 | 963 | * {@inheritDoc} |
| 988 | 964 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
| 989 | 965 | */ |
| 990 | - protected function _getThumbnail($forceReload = false) |
|
| 991 | - { |
|
| 966 | + protected function _getThumbnail($forceReload = false) { |
|
| 992 | 967 | if ( |
| 993 | 968 | !$this->thumbnailLoaded |
| 994 | 969 | || $forceReload |
@@ -1061,8 +1036,7 @@ discard block |
||
| 1061 | 1036 | * {@inheritDoc} |
| 1062 | 1037 | * @see \Kitodo\Dlf\Common\Document::_getToplevelId() |
| 1063 | 1038 | */ |
| 1064 | - protected function _getToplevelId() |
|
| 1065 | - { |
|
| 1039 | + protected function _getToplevelId() { |
|
| 1066 | 1040 | if (empty($this->toplevelId)) { |
| 1067 | 1041 | // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
| 1068 | 1042 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'); |
@@ -1094,8 +1068,7 @@ discard block |
||
| 1094 | 1068 | * |
| 1095 | 1069 | * @return array Properties to be serialized |
| 1096 | 1070 | */ |
| 1097 | - public function __sleep() |
|
| 1098 | - { |
|
| 1071 | + public function __sleep() { |
|
| 1099 | 1072 | // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization |
| 1100 | 1073 | $this->asXML = $this->xml->asXML(); |
| 1101 | 1074 | return ['uid', 'pid', 'recordId', 'parentId', 'asXML']; |
@@ -1108,8 +1081,7 @@ discard block |
||
| 1108 | 1081 | * |
| 1109 | 1082 | * @return string String representing the METS object |
| 1110 | 1083 | */ |
| 1111 | - public function __toString() |
|
| 1112 | - { |
|
| 1084 | + public function __toString() { |
|
| 1113 | 1085 | $xml = new \DOMDocument('1.0', 'utf-8'); |
| 1114 | 1086 | $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
| 1115 | 1087 | $xml->formatOutput = true; |
@@ -1124,8 +1096,7 @@ discard block |
||
| 1124 | 1096 | * |
| 1125 | 1097 | * @return void |
| 1126 | 1098 | */ |
| 1127 | - public function __wakeup() |
|
| 1128 | - { |
|
| 1099 | + public function __wakeup() { |
|
| 1129 | 1100 | // Turn off libxml's error logging. |
| 1130 | 1101 | $libxmlErrors = libxml_use_internal_errors(true); |
| 1131 | 1102 | // Reload XML from string. |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * @var bool |
| 74 | 74 | * @access protected |
| 75 | 75 | */ |
| 76 | - protected $dmdSecLoaded = false; |
|
| 76 | + protected $dmdSecLoaded = FALSE; |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * The extension key |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @var bool |
| 100 | 100 | * @access protected |
| 101 | 101 | */ |
| 102 | - protected $fileGrpsLoaded = false; |
|
| 102 | + protected $fileGrpsLoaded = FALSE; |
|
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * This holds the XML file's METS part as \SimpleXMLElement object |
@@ -173,11 +173,11 @@ discard block |
||
| 173 | 173 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 174 | 174 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 175 | 175 | $service = IiifHelper::loadIiifResource($fileLocation); |
| 176 | - if ($service !== null && $service instanceof AbstractImageService) { |
|
| 176 | + if ($service !== NULL && $service instanceof AbstractImageService) { |
|
| 177 | 177 | return $service->getImageUrl(); |
| 178 | 178 | } |
| 179 | 179 | } elseif ($fileMimeType === 'application/vnd.netfpx') { |
| 180 | - $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : ''); |
|
| 180 | + $baseURL = $fileLocation . (strpos($fileLocation, '?') === FALSE ? '?' : ''); |
|
| 181 | 181 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
| 182 | 182 | return $baseURL . '&CVT=jpeg'; |
| 183 | 183 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * {@inheritDoc} |
| 225 | 225 | * @see \Kitodo\Dlf\Common\Document::getLogicalStructure() |
| 226 | 226 | */ |
| 227 | - public function getLogicalStructure($id, $recursive = false) |
|
| 227 | + public function getLogicalStructure($id, $recursive = FALSE) |
|
| 228 | 228 | { |
| 229 | 229 | $details = []; |
| 230 | 230 | // Is the requested logical unit already loaded? |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * |
| 266 | 266 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
| 267 | 267 | */ |
| 268 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) |
|
| 268 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = FALSE) |
|
| 269 | 269 | { |
| 270 | 270 | // Get attributes. |
| 271 | 271 | foreach ($structure->attributes() as $attribute => $value) { |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | && array_key_exists($details['id'], $this->smLinks['l2p']) |
| 311 | 311 | ) { |
| 312 | 312 | // Link logical structure to the first corresponding physical page/track. |
| 313 | - $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, true)), 1); |
|
| 313 | + $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE)), 1); |
|
| 314 | 314 | if (!empty($this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$extConf['fileGrpThumbs']])) { |
| 315 | 315 | $details['thumbnailId'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$extConf['fileGrpThumbs']]; |
| 316 | 316 | } |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $details['children'] = []; |
| 347 | 347 | foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) { |
| 348 | 348 | // Repeat for all children. |
| 349 | - $details['children'][] = $this->getLogicalStructureInfo($child, true); |
|
| 349 | + $details['children'][] = $this->getLogicalStructureInfo($child, TRUE); |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | return $details; |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | if (!empty($dmdIds)) { |
| 416 | 416 | // Handle multiple DMDIDs separately. |
| 417 | 417 | $dmdIds = explode(' ', $dmdIds); |
| 418 | - $hasSupportedMetadata = false; |
|
| 418 | + $hasSupportedMetadata = FALSE; |
|
| 419 | 419 | } else { |
| 420 | 420 | // There is no dmdSec for this structure node. |
| 421 | 421 | return []; |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | } |
| 627 | 627 | } |
| 628 | 628 | // Extract metadata only from first supported dmdSec. |
| 629 | - $hasSupportedMetadata = true; |
|
| 629 | + $hasSupportedMetadata = TRUE; |
|
| 630 | 630 | break; |
| 631 | 631 | } |
| 632 | 632 | if ($hasSupportedMetadata) { |
@@ -695,11 +695,11 @@ discard block |
||
| 695 | 695 | protected function loadLocation($location) |
| 696 | 696 | { |
| 697 | 697 | $fileResource = GeneralUtility::getUrl($location); |
| 698 | - if ($fileResource !== false) { |
|
| 698 | + if ($fileResource !== FALSE) { |
|
| 699 | 699 | // Turn off libxml's error logging. |
| 700 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
| 700 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
| 701 | 701 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
| 702 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
| 702 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
| 703 | 703 | // Load XML from file. |
| 704 | 704 | $xml = simplexml_load_string($fileResource); |
| 705 | 705 | // reset entity loader setting |
@@ -707,13 +707,13 @@ discard block |
||
| 707 | 707 | // Reset libxml's error logging. |
| 708 | 708 | libxml_use_internal_errors($libxmlErrors); |
| 709 | 709 | // Set some basic properties. |
| 710 | - if ($xml !== false) { |
|
| 710 | + if ($xml !== FALSE) { |
|
| 711 | 711 | $this->xml = $xml; |
| 712 | - return true; |
|
| 712 | + return TRUE; |
|
| 713 | 713 | } |
| 714 | 714 | } |
| 715 | 715 | Helper::devLog('Could not load XML file from "' . $location . '"', DEVLOG_SEVERITY_ERROR); |
| 716 | - return false; |
|
| 716 | + return FALSE; |
|
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | /** |
@@ -761,9 +761,9 @@ discard block |
||
| 761 | 761 | |
| 762 | 762 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
| 763 | 763 | $this->xml = $preloadedDocument; |
| 764 | - return true; |
|
| 764 | + return TRUE; |
|
| 765 | 765 | } |
| 766 | - return false; |
|
| 766 | + return FALSE; |
|
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | /** |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | - $this->dmdSecLoaded = true; |
|
| 824 | + $this->dmdSecLoaded = TRUE; |
|
| 825 | 825 | } |
| 826 | 826 | return $this->dmdSec; |
| 827 | 827 | } |
@@ -868,9 +868,9 @@ discard block |
||
| 868 | 868 | !empty($extConf['fileGrpFulltext']) |
| 869 | 869 | && in_array($extConf['fileGrpFulltext'], $this->fileGrps) |
| 870 | 870 | ) { |
| 871 | - $this->hasFulltext = true; |
|
| 871 | + $this->hasFulltext = TRUE; |
|
| 872 | 872 | } |
| 873 | - $this->fileGrpsLoaded = true; |
|
| 873 | + $this->fileGrpsLoaded = TRUE; |
|
| 874 | 874 | } |
| 875 | 875 | return $this->fileGrps; |
| 876 | 876 | } |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | $this->physicalStructure = array_merge($physSeq, $elements); |
| 960 | 960 | } |
| 961 | 961 | } |
| 962 | - $this->physicalStructureLoaded = true; |
|
| 962 | + $this->physicalStructureLoaded = TRUE; |
|
| 963 | 963 | } |
| 964 | 964 | return $this->physicalStructure; |
| 965 | 965 | } |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | $this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from; |
| 979 | 979 | } |
| 980 | 980 | } |
| 981 | - $this->smLinksLoaded = true; |
|
| 981 | + $this->smLinksLoaded = TRUE; |
|
| 982 | 982 | } |
| 983 | 983 | return $this->smLinks; |
| 984 | 984 | } |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | * {@inheritDoc} |
| 988 | 988 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
| 989 | 989 | */ |
| 990 | - protected function _getThumbnail($forceReload = false) |
|
| 990 | + protected function _getThumbnail($forceReload = FALSE) |
|
| 991 | 991 | { |
| 992 | 992 | if ( |
| 993 | 993 | !$this->thumbnailLoaded |
@@ -997,14 +997,14 @@ discard block |
||
| 997 | 997 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 998 | 998 | if (!$cPid) { |
| 999 | 999 | Helper::devLog('Invalid PID ' . $cPid . ' for structure definitions', DEVLOG_SEVERITY_ERROR); |
| 1000 | - $this->thumbnailLoaded = true; |
|
| 1000 | + $this->thumbnailLoaded = TRUE; |
|
| 1001 | 1001 | return $this->thumbnail; |
| 1002 | 1002 | } |
| 1003 | 1003 | // Load extension configuration. |
| 1004 | 1004 | $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 1005 | 1005 | if (empty($extConf['fileGrpThumbs'])) { |
| 1006 | 1006 | Helper::devLog('No fileGrp for thumbnails specified', DEVLOG_SEVERITY_WARNING); |
| 1007 | - $this->thumbnailLoaded = true; |
|
| 1007 | + $this->thumbnailLoaded = TRUE; |
|
| 1008 | 1008 | return $this->thumbnail; |
| 1009 | 1009 | } |
| 1010 | 1010 | $strctId = $this->_getToplevelId(); |
@@ -1052,7 +1052,7 @@ discard block |
||
| 1052 | 1052 | } else { |
| 1053 | 1053 | Helper::devLog('No structure of type "' . $metadata['type'][0] . '" found in database', DEVLOG_SEVERITY_ERROR); |
| 1054 | 1054 | } |
| 1055 | - $this->thumbnailLoaded = true; |
|
| 1055 | + $this->thumbnailLoaded = TRUE; |
|
| 1056 | 1056 | } |
| 1057 | 1057 | return $this->thumbnail; |
| 1058 | 1058 | } |
@@ -1111,8 +1111,8 @@ discard block |
||
| 1111 | 1111 | public function __toString() |
| 1112 | 1112 | { |
| 1113 | 1113 | $xml = new \DOMDocument('1.0', 'utf-8'); |
| 1114 | - $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
|
| 1115 | - $xml->formatOutput = true; |
|
| 1114 | + $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE)); |
|
| 1115 | + $xml->formatOutput = TRUE; |
|
| 1116 | 1116 | return $xml->saveXML(); |
| 1117 | 1117 | } |
| 1118 | 1118 | |
@@ -1127,12 +1127,12 @@ discard block |
||
| 1127 | 1127 | public function __wakeup() |
| 1128 | 1128 | { |
| 1129 | 1129 | // Turn off libxml's error logging. |
| 1130 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
| 1130 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
| 1131 | 1131 | // Reload XML from string. |
| 1132 | 1132 | $xml = @simplexml_load_string($this->asXML); |
| 1133 | 1133 | // Reset libxml's error logging. |
| 1134 | 1134 | libxml_use_internal_errors($libxmlErrors); |
| 1135 | - if ($xml !== false) { |
|
| 1135 | + if ($xml !== FALSE) { |
|
| 1136 | 1136 | $this->asXML = ''; |
| 1137 | 1137 | $this->xml = $xml; |
| 1138 | 1138 | // Rebuild the unserializable properties. |