@@ -48,8 +48,7 @@ discard block |
||
48 | 48 | * @property-read mixed $uid This holds the UID or the URL of the document |
49 | 49 | * @abstract |
50 | 50 | */ |
51 | -abstract class Document |
|
52 | -{ |
|
51 | +abstract class Document { |
|
53 | 52 | /** |
54 | 53 | * This holds the logger |
55 | 54 | * |
@@ -341,8 +340,7 @@ discard block |
||
341 | 340 | * |
342 | 341 | * @return void |
343 | 342 | */ |
344 | - public static function clearRegistry() |
|
345 | - { |
|
343 | + public static function clearRegistry() { |
|
346 | 344 | // Reset registry array. |
347 | 345 | self::$registry = []; |
348 | 346 | } |
@@ -607,8 +605,7 @@ discard block |
||
607 | 605 | * |
608 | 606 | * @return int The physical page number |
609 | 607 | */ |
610 | - public function getPhysicalPage($logicalPage) |
|
611 | - { |
|
608 | + public function getPhysicalPage($logicalPage) { |
|
612 | 609 | if ( |
613 | 610 | !empty($this->lastSearchedPhysicalPage['logicalPage']) |
614 | 611 | && $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage |
@@ -653,8 +650,7 @@ discard block |
||
653 | 650 | * |
654 | 651 | * @return string The OCR full text |
655 | 652 | */ |
656 | - protected function getFullTextFromXml($id) |
|
657 | - { |
|
653 | + protected function getFullTextFromXml($id) { |
|
658 | 654 | $fullText = ''; |
659 | 655 | // Load available text formats, ... |
660 | 656 | $this->loadFormats(); |
@@ -716,8 +712,7 @@ discard block |
||
716 | 712 | * |
717 | 713 | * @return string The format of the OCR full text |
718 | 714 | */ |
719 | - private function getTextFormat($fileContent) |
|
720 | - { |
|
715 | + private function getTextFormat($fileContent) { |
|
721 | 716 | $xml = Helper::getXmlFileAsString($fileContent); |
722 | 717 | |
723 | 718 | if ($xml !== false) { |
@@ -740,8 +735,7 @@ discard block |
||
740 | 735 | * |
741 | 736 | * @return string The title of the document itself or a parent document |
742 | 737 | */ |
743 | - public static function getTitle($uid, $recursive = false) |
|
744 | - { |
|
738 | + public static function getTitle($uid, $recursive = false) { |
|
745 | 739 | $title = ''; |
746 | 740 | // Sanitize input. |
747 | 741 | $uid = max(intval($uid), 0); |
@@ -793,8 +787,7 @@ discard block |
||
793 | 787 | * |
794 | 788 | * @return array The logical structure node's / resource's parsed metadata array |
795 | 789 | */ |
796 | - public function getTitledata($cPid = 0) |
|
797 | - { |
|
790 | + public function getTitledata($cPid = 0) { |
|
798 | 791 | $titledata = $this->getMetadata($this->_getToplevelId(), $cPid); |
799 | 792 | // Add information from METS structural map to titledata array. |
800 | 793 | if ($this instanceof MetsDocument) { |
@@ -827,8 +820,7 @@ discard block |
||
827 | 820 | * @return int|bool: false if structure with $logId is not a child of this substructure, |
828 | 821 | * or the actual depth. |
829 | 822 | */ |
830 | - protected function getTreeDepth($structure, $depth, $logId) |
|
831 | - { |
|
823 | + protected function getTreeDepth($structure, $depth, $logId) { |
|
832 | 824 | foreach ($structure as $element) { |
833 | 825 | if ($element['id'] == $logId) { |
834 | 826 | return $depth; |
@@ -850,8 +842,7 @@ discard block |
||
850 | 842 | * @param string $logId: The id of the logical structure element whose depth is requested |
851 | 843 | * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC. |
852 | 844 | */ |
853 | - public function getStructureDepth($logId) |
|
854 | - { |
|
845 | + public function getStructureDepth($logId) { |
|
855 | 846 | return $this->getTreeDepth($this->_getTableOfContents(), 1, $logId); |
856 | 847 | } |
857 | 848 | |
@@ -901,8 +892,7 @@ discard block |
||
901 | 892 | * |
902 | 893 | * @return bool true on success or false on failure |
903 | 894 | */ |
904 | - protected function load($location) |
|
905 | - { |
|
895 | + protected function load($location) { |
|
906 | 896 | // Load XML / JSON-LD file. |
907 | 897 | if (GeneralUtility::isValidUrl($location)) { |
908 | 898 | // Load extension configuration |
@@ -935,8 +925,7 @@ discard block |
||
935 | 925 | * |
936 | 926 | * @return void |
937 | 927 | */ |
938 | - protected function loadFormats() |
|
939 | - { |
|
928 | + protected function loadFormats() { |
|
940 | 929 | if (!$this->formatsLoaded) { |
941 | 930 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
942 | 931 | ->getQueryBuilderForTable('tx_dlf_formats'); |
@@ -976,8 +965,7 @@ discard block |
||
976 | 965 | * |
977 | 966 | * @return void |
978 | 967 | */ |
979 | - public function registerNamespaces(&$obj) |
|
980 | - { |
|
968 | + public function registerNamespaces(&$obj) { |
|
981 | 969 | // TODO Check usage. XML specific method does not seem to be used anywhere outside this class within the project, but it is public and may be used by extensions. |
982 | 970 | $this->loadFormats(); |
983 | 971 | // Do we have a \SimpleXMLElement or \DOMXPath object? |
@@ -1006,8 +994,7 @@ discard block |
||
1006 | 994 | * |
1007 | 995 | * @return bool true on success or false on failure |
1008 | 996 | */ |
1009 | - public function save($pid = 0, $core = 0, $owner = null) |
|
1010 | - { |
|
997 | + public function save($pid = 0, $core = 0, $owner = null) { |
|
1011 | 998 | if (\TYPO3_MODE !== 'BE') { |
1012 | 999 | $this->logger->error('Saving a document is only allowed in the backend'); |
1013 | 1000 | return false; |
@@ -1335,8 +1322,7 @@ discard block |
||
1335 | 1322 | * |
1336 | 1323 | * @return int The PID of the metadata definitions |
1337 | 1324 | */ |
1338 | - protected function _getCPid() |
|
1339 | - { |
|
1325 | + protected function _getCPid() { |
|
1340 | 1326 | return $this->cPid; |
1341 | 1327 | } |
1342 | 1328 | |
@@ -1347,8 +1333,7 @@ discard block |
||
1347 | 1333 | * |
1348 | 1334 | * @return bool Are there any fulltext files available? |
1349 | 1335 | */ |
1350 | - protected function _getHasFulltext() |
|
1351 | - { |
|
1336 | + protected function _getHasFulltext() { |
|
1352 | 1337 | $this->ensureHasFulltextIsSet(); |
1353 | 1338 | return $this->hasFulltext; |
1354 | 1339 | } |
@@ -1360,8 +1345,7 @@ discard block |
||
1360 | 1345 | * |
1361 | 1346 | * @return string The location of the document |
1362 | 1347 | */ |
1363 | - protected function _getLocation() |
|
1364 | - { |
|
1348 | + protected function _getLocation() { |
|
1365 | 1349 | return $this->location; |
1366 | 1350 | } |
1367 | 1351 | |
@@ -1383,8 +1367,7 @@ discard block |
||
1383 | 1367 | * |
1384 | 1368 | * @return array Array of metadata with their corresponding logical structure node ID as key |
1385 | 1369 | */ |
1386 | - protected function _getMetadataArray() |
|
1387 | - { |
|
1370 | + protected function _getMetadataArray() { |
|
1388 | 1371 | // Set metadata definitions' PID. |
1389 | 1372 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
1390 | 1373 | if (!$cPid) { |
@@ -1409,8 +1392,7 @@ discard block |
||
1409 | 1392 | * |
1410 | 1393 | * @return int The total number of pages and/or tracks |
1411 | 1394 | */ |
1412 | - protected function _getNumPages() |
|
1413 | - { |
|
1395 | + protected function _getNumPages() { |
|
1414 | 1396 | $this->_getPhysicalStructure(); |
1415 | 1397 | return $this->numPages; |
1416 | 1398 | } |
@@ -1422,8 +1404,7 @@ discard block |
||
1422 | 1404 | * |
1423 | 1405 | * @return int The UID of the parent document or zero if not applicable |
1424 | 1406 | */ |
1425 | - protected function _getParentId() |
|
1426 | - { |
|
1407 | + protected function _getParentId() { |
|
1427 | 1408 | return $this->parentId; |
1428 | 1409 | } |
1429 | 1410 | |
@@ -1446,8 +1427,7 @@ discard block |
||
1446 | 1427 | * |
1447 | 1428 | * @return array Array of elements' type, label and file representations ordered by @ID attribute / Canvas order |
1448 | 1429 | */ |
1449 | - protected function _getPhysicalStructureInfo() |
|
1450 | - { |
|
1430 | + protected function _getPhysicalStructureInfo() { |
|
1451 | 1431 | // Is there no physical structure array yet? |
1452 | 1432 | if (!$this->physicalStructureLoaded) { |
1453 | 1433 | // Build physical structure array. |
@@ -1463,8 +1443,7 @@ discard block |
||
1463 | 1443 | * |
1464 | 1444 | * @return int The PID of the document or zero if not in database |
1465 | 1445 | */ |
1466 | - protected function _getPid() |
|
1467 | - { |
|
1446 | + protected function _getPid() { |
|
1468 | 1447 | return $this->pid; |
1469 | 1448 | } |
1470 | 1449 | |
@@ -1475,8 +1454,7 @@ discard block |
||
1475 | 1454 | * |
1476 | 1455 | * @return bool Is the document instantiated successfully? |
1477 | 1456 | */ |
1478 | - protected function _getReady() |
|
1479 | - { |
|
1457 | + protected function _getReady() { |
|
1480 | 1458 | return $this->ready; |
1481 | 1459 | } |
1482 | 1460 | |
@@ -1487,8 +1465,7 @@ discard block |
||
1487 | 1465 | * |
1488 | 1466 | * @return mixed The METS file's / IIIF manifest's record identifier |
1489 | 1467 | */ |
1490 | - protected function _getRecordId() |
|
1491 | - { |
|
1468 | + protected function _getRecordId() { |
|
1492 | 1469 | return $this->recordId; |
1493 | 1470 | } |
1494 | 1471 | |
@@ -1499,8 +1476,7 @@ discard block |
||
1499 | 1476 | * |
1500 | 1477 | * @return int The UID of the root document or zero if not applicable |
1501 | 1478 | */ |
1502 | - protected function _getRootId() |
|
1503 | - { |
|
1479 | + protected function _getRootId() { |
|
1504 | 1480 | if (!$this->rootIdLoaded) { |
1505 | 1481 | if ($this->parentId) { |
1506 | 1482 | $parent = self::getInstance($this->parentId, $this->pid); |
@@ -1530,8 +1506,7 @@ discard block |
||
1530 | 1506 | * |
1531 | 1507 | * @return array Array of structure nodes' id, label, type and physical page indexes/mptr / Canvas link with original hierarchy preserved |
1532 | 1508 | */ |
1533 | - protected function _getTableOfContents() |
|
1534 | - { |
|
1509 | + protected function _getTableOfContents() { |
|
1535 | 1510 | // Is there no logical structure array yet? |
1536 | 1511 | if (!$this->tableOfContentsLoaded) { |
1537 | 1512 | // Get all logical structures. |
@@ -1572,8 +1547,7 @@ discard block |
||
1572 | 1547 | * |
1573 | 1548 | * @return mixed The UID or the URL of the document |
1574 | 1549 | */ |
1575 | - protected function _getUid() |
|
1576 | - { |
|
1550 | + protected function _getUid() { |
|
1577 | 1551 | return $this->uid; |
1578 | 1552 | } |
1579 | 1553 | |
@@ -1586,8 +1560,7 @@ discard block |
||
1586 | 1560 | * |
1587 | 1561 | * @return void |
1588 | 1562 | */ |
1589 | - protected function _setCPid($value) |
|
1590 | - { |
|
1563 | + protected function _setCPid($value) { |
|
1591 | 1564 | $this->cPid = max(intval($value), 0); |
1592 | 1565 | } |
1593 | 1566 | |
@@ -1598,8 +1571,7 @@ discard block |
||
1598 | 1571 | * |
1599 | 1572 | * @return void |
1600 | 1573 | */ |
1601 | - protected function __clone() |
|
1602 | - { |
|
1574 | + protected function __clone() { |
|
1603 | 1575 | // This method is defined as protected because singleton objects should not be cloned. |
1604 | 1576 | } |
1605 | 1577 | |
@@ -1616,8 +1588,7 @@ discard block |
||
1616 | 1588 | * |
1617 | 1589 | * @return void |
1618 | 1590 | */ |
1619 | - protected function __construct($uid, $pid, $preloadedDocument) |
|
1620 | - { |
|
1591 | + protected function __construct($uid, $pid, $preloadedDocument) { |
|
1621 | 1592 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(); |
1622 | 1593 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
1623 | 1594 | ->getQueryBuilderForTable('tx_dlf_documents'); |
@@ -1730,8 +1701,7 @@ discard block |
||
1730 | 1701 | * |
1731 | 1702 | * @return mixed Value of $this->$var |
1732 | 1703 | */ |
1733 | - public function __get($var) |
|
1734 | - { |
|
1704 | + public function __get($var) { |
|
1735 | 1705 | $method = '_get' . ucfirst($var); |
1736 | 1706 | if ( |
1737 | 1707 | !property_exists($this, $var) |
@@ -1753,8 +1723,7 @@ discard block |
||
1753 | 1723 | * |
1754 | 1724 | * @return bool true if variable is set and not empty, false otherwise |
1755 | 1725 | */ |
1756 | - public function __isset($var) |
|
1757 | - { |
|
1726 | + public function __isset($var) { |
|
1758 | 1727 | return !empty($this->__get($var)); |
1759 | 1728 | } |
1760 | 1729 | |
@@ -1768,8 +1737,7 @@ discard block |
||
1768 | 1737 | * |
1769 | 1738 | * @return void |
1770 | 1739 | */ |
1771 | - public function __set($var, $value) |
|
1772 | - { |
|
1740 | + public function __set($var, $value) { |
|
1773 | 1741 | $method = '_set' . ucfirst($var); |
1774 | 1742 | if ( |
1775 | 1743 | !property_exists($this, $var) |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @var bool |
104 | 104 | * @access protected |
105 | 105 | */ |
106 | - protected $formatsLoaded = false; |
|
106 | + protected $formatsLoaded = FALSE; |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Are there any fulltext files available? This also includes IIIF text annotations |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @var bool |
114 | 114 | * @access protected |
115 | 115 | */ |
116 | - protected $hasFulltext = false; |
|
116 | + protected $hasFulltext = FALSE; |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Last searched logical and physical page |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @var array |
122 | 122 | * @access protected |
123 | 123 | */ |
124 | - protected $lastSearchedPhysicalPage = ['logicalPage' => null, 'physicalPage' => null]; |
|
124 | + protected $lastSearchedPhysicalPage = ['logicalPage' => NULL, 'physicalPage' => NULL]; |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * This holds the documents location |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @var bool |
156 | 156 | * @access protected |
157 | 157 | */ |
158 | - protected $metadataArrayLoaded = false; |
|
158 | + protected $metadataArrayLoaded = FALSE; |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * The holds the total number of pages |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @var bool |
197 | 197 | * @access protected |
198 | 198 | */ |
199 | - protected $physicalStructureLoaded = false; |
|
199 | + protected $physicalStructureLoaded = FALSE; |
|
200 | 200 | |
201 | 201 | /** |
202 | 202 | * This holds the PID of the document or zero if not in database |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @var bool |
222 | 222 | * @access protected |
223 | 223 | */ |
224 | - protected $ready = false; |
|
224 | + protected $ready = FALSE; |
|
225 | 225 | |
226 | 226 | /** |
227 | 227 | * The METS file's / IIIF manifest's record identifier |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @var bool |
256 | 256 | * @access protected |
257 | 257 | */ |
258 | - protected $rootIdLoaded = false; |
|
258 | + protected $rootIdLoaded = FALSE; |
|
259 | 259 | |
260 | 260 | /** |
261 | 261 | * This holds the smLinks between logical and physical structMap |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @var bool |
273 | 273 | * @access protected |
274 | 274 | */ |
275 | - protected $smLinksLoaded = false; |
|
275 | + protected $smLinksLoaded = FALSE; |
|
276 | 276 | |
277 | 277 | /** |
278 | 278 | * This holds the logical structure |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @var bool |
290 | 290 | * @access protected |
291 | 291 | */ |
292 | - protected $tableOfContentsLoaded = false; |
|
292 | + protected $tableOfContentsLoaded = FALSE; |
|
293 | 293 | |
294 | 294 | /** |
295 | 295 | * This holds the document's thumbnail location |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @var bool |
307 | 307 | * @access protected |
308 | 308 | */ |
309 | - protected $thumbnailLoaded = false; |
|
309 | + protected $thumbnailLoaded = FALSE; |
|
310 | 310 | |
311 | 311 | /** |
312 | 312 | * This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF) |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | * |
424 | 424 | * @return \Kitodo\Dlf\Common\Document Instance of this class, either MetsDocument or IiifManifest |
425 | 425 | */ |
426 | - public static function &getInstance($uid, $pid = 0, $forceReload = false) |
|
426 | + public static function &getInstance($uid, $pid = 0, $forceReload = FALSE) |
|
427 | 427 | { |
428 | 428 | // Sanitize input. |
429 | 429 | $pid = max(intval($pid), 0); |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | } |
464 | 464 | } |
465 | 465 | // Create new instance depending on format (METS or IIIF) ... |
466 | - $instance = null; |
|
467 | - $documentFormat = null; |
|
468 | - $xml = null; |
|
469 | - $iiif = null; |
|
466 | + $instance = NULL; |
|
467 | + $documentFormat = NULL; |
|
468 | + $xml = NULL; |
|
469 | + $iiif = NULL; |
|
470 | 470 | // Try to get document format from database |
471 | 471 | if (MathUtility::canBeInterpretedAsInteger($uid)) { |
472 | 472 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -515,17 +515,17 @@ discard block |
||
515 | 515 | @ini_set('user_agent', $extConf['useragent']); |
516 | 516 | } |
517 | 517 | $content = GeneralUtility::getUrl($location); |
518 | - if ($content !== false) { |
|
518 | + if ($content !== FALSE) { |
|
519 | 519 | $xml = Helper::getXmlFileAsString($content); |
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()); |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
582 | 582 | */ |
583 | - public abstract function getLogicalStructure($id, $recursive = false); |
|
583 | + public abstract function getLogicalStructure($id, $recursive = FALSE); |
|
584 | 584 | |
585 | 585 | /** |
586 | 586 | * This extracts all the metadata for a logical structure node |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | } else { |
618 | 618 | $physicalPage = 0; |
619 | 619 | foreach ($this->physicalStructureInfo as $page) { |
620 | - if (strpos($page['orderlabel'], $logicalPage) !== false) { |
|
620 | + if (strpos($page['orderlabel'], $logicalPage) !== FALSE) { |
|
621 | 621 | $this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage; |
622 | 622 | $this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage; |
623 | 623 | return $physicalPage; |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | if (!empty($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])) { |
669 | 669 | // Get full text file. |
670 | 670 | $fileContent = GeneralUtility::getUrl($this->getFileLocation($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])); |
671 | - if ($fileContent !== false) { |
|
671 | + if ($fileContent !== FALSE) { |
|
672 | 672 | $textFormat = $this->getTextFormat($fileContent); |
673 | 673 | } else { |
674 | 674 | $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"'); |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | { |
721 | 721 | $xml = Helper::getXmlFileAsString($fileContent); |
722 | 722 | |
723 | - if ($xml !== false) { |
|
723 | + if ($xml !== FALSE) { |
|
724 | 724 | // Get the root element's name as text format. |
725 | 725 | return strtoupper($xml->getName()); |
726 | 726 | } else { |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | * |
741 | 741 | * @return string The title of the document itself or a parent document |
742 | 742 | */ |
743 | - public static function getTitle($uid, $recursive = false) |
|
743 | + public static function getTitle($uid, $recursive = FALSE) |
|
744 | 744 | { |
745 | 745 | $title = ''; |
746 | 746 | // Sanitize input. |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | && intval($partof) |
774 | 774 | && $partof != $uid |
775 | 775 | ) { |
776 | - $title = self::getTitle($partof, true); |
|
776 | + $title = self::getTitle($partof, TRUE); |
|
777 | 777 | } |
778 | 778 | } else { |
779 | 779 | Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING); |
@@ -834,12 +834,12 @@ discard block |
||
834 | 834 | return $depth; |
835 | 835 | } elseif (array_key_exists('children', $element)) { |
836 | 836 | $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId); |
837 | - if ($foundInChildren !== false) { |
|
837 | + if ($foundInChildren !== FALSE) { |
|
838 | 838 | return $foundInChildren; |
839 | 839 | } |
840 | 840 | } |
841 | 841 | } |
842 | - return false; |
|
842 | + return FALSE; |
|
843 | 843 | } |
844 | 844 | |
845 | 845 | /** |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | } else { |
917 | 917 | $this->logger->error('Invalid file location "' . $location . '" for document loading'); |
918 | 918 | } |
919 | - return false; |
|
919 | + return FALSE; |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | /** |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | 'class' => $resArray['class'] |
964 | 964 | ]; |
965 | 965 | } |
966 | - $this->formatsLoaded = true; |
|
966 | + $this->formatsLoaded = TRUE; |
|
967 | 967 | } |
968 | 968 | } |
969 | 969 | |
@@ -1006,11 +1006,11 @@ discard block |
||
1006 | 1006 | * |
1007 | 1007 | * @return bool true on success or false on failure |
1008 | 1008 | */ |
1009 | - public function save($pid = 0, $core = 0, $owner = null) |
|
1009 | + public function save($pid = 0, $core = 0, $owner = NULL) |
|
1010 | 1010 | { |
1011 | 1011 | if (\TYPO3_MODE !== 'BE') { |
1012 | 1012 | $this->logger->error('Saving a document is only allowed in the backend'); |
1013 | - return false; |
|
1013 | + return FALSE; |
|
1014 | 1014 | } |
1015 | 1015 | // Make sure $pid is a non-negative integer. |
1016 | 1016 | $pid = max(intval($pid), 0); |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | $pid = $this->pid; |
1026 | 1026 | } elseif (!$pid) { |
1027 | 1027 | $this->logger->error('Invalid PID ' . $pid . ' for document saving'); |
1028 | - return false; |
|
1028 | + return FALSE; |
|
1029 | 1029 | } |
1030 | 1030 | // Set PID for metadata definitions. |
1031 | 1031 | $this->cPid = $pid; |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | // Check for record identifier. |
1039 | 1039 | if (empty($metadata['record_id'][0])) { |
1040 | 1040 | $this->logger->error('No record identifier found to avoid duplication'); |
1041 | - return false; |
|
1041 | + return FALSE; |
|
1042 | 1042 | } |
1043 | 1043 | // Load plugin configuration. |
1044 | 1044 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | $structure = $resArray['uid']; |
1063 | 1063 | } else { |
1064 | 1064 | $this->logger->error('Could not identify document/structure type "' . $queryBuilder->expr()->literal($metadata['type'][0]) . '"'); |
1065 | - return false; |
|
1065 | + return FALSE; |
|
1066 | 1066 | } |
1067 | 1067 | $metadata['type'][0] = $structure; |
1068 | 1068 | |
@@ -1122,9 +1122,9 @@ discard block |
||
1122 | 1122 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
1123 | 1123 | Helper::addMessage( |
1124 | 1124 | htmlspecialchars(sprintf(Helper::getMessage('flash.newCollection'), $collection, $substUid[$collNewUid])), |
1125 | - Helper::getMessage('flash.attention', true), |
|
1125 | + Helper::getMessage('flash.attention', TRUE), |
|
1126 | 1126 | \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
1127 | - true |
|
1127 | + TRUE |
|
1128 | 1128 | ); |
1129 | 1129 | } |
1130 | 1130 | } |
@@ -1175,9 +1175,9 @@ discard block |
||
1175 | 1175 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
1176 | 1176 | Helper::addMessage( |
1177 | 1177 | htmlspecialchars(sprintf(Helper::getMessage('flash.newLibrary'), $owner, $ownerUid)), |
1178 | - Helper::getMessage('flash.attention', true), |
|
1178 | + Helper::getMessage('flash.attention', TRUE), |
|
1179 | 1179 | \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
1180 | - true |
|
1180 | + TRUE |
|
1181 | 1181 | ); |
1182 | 1182 | } |
1183 | 1183 | } |
@@ -1265,7 +1265,7 @@ discard block |
||
1265 | 1265 | 'author' => implode('; ', $metadata['author']), |
1266 | 1266 | 'year' => implode('; ', $metadata['year']), |
1267 | 1267 | 'place' => implode('; ', $metadata['place']), |
1268 | - 'thumbnail' => $this->_getThumbnail(true), |
|
1268 | + 'thumbnail' => $this->_getThumbnail(TRUE), |
|
1269 | 1269 | 'metadata' => serialize($listed), |
1270 | 1270 | 'metadata_sorting' => serialize($sortable), |
1271 | 1271 | 'structure' => $metadata['type'][0], |
@@ -1301,9 +1301,9 @@ discard block |
||
1301 | 1301 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
1302 | 1302 | Helper::addMessage( |
1303 | 1303 | htmlspecialchars(sprintf(Helper::getMessage('flash.documentSaved'), $metadata['title'][0], $this->uid)), |
1304 | - Helper::getMessage('flash.done', true), |
|
1304 | + Helper::getMessage('flash.done', TRUE), |
|
1305 | 1305 | \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
1306 | - true |
|
1306 | + TRUE |
|
1307 | 1307 | ); |
1308 | 1308 | } |
1309 | 1309 | // Add document to index. |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | return Indexer::add($this, $core); |
1312 | 1312 | } else { |
1313 | 1313 | $this->logger->notice('Invalid UID "' . $core . '" for Solr core'); |
1314 | - return false; |
|
1314 | + return FALSE; |
|
1315 | 1315 | } |
1316 | 1316 | } |
1317 | 1317 | |
@@ -1397,7 +1397,7 @@ discard block |
||
1397 | 1397 | ) { |
1398 | 1398 | $this->prepareMetadataArray($cPid); |
1399 | 1399 | $this->metadataArray[0] = $cPid; |
1400 | - $this->metadataArrayLoaded = true; |
|
1400 | + $this->metadataArrayLoaded = TRUE; |
|
1401 | 1401 | } |
1402 | 1402 | return $this->metadataArray; |
1403 | 1403 | } |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | $parent = self::getInstance($this->parentId, $this->pid); |
1507 | 1507 | $this->rootId = $parent->rootId; |
1508 | 1508 | } |
1509 | - $this->rootIdLoaded = true; |
|
1509 | + $this->rootIdLoaded = TRUE; |
|
1510 | 1510 | } |
1511 | 1511 | return $this->rootId; |
1512 | 1512 | } |
@@ -1535,8 +1535,8 @@ discard block |
||
1535 | 1535 | // Is there no logical structure array yet? |
1536 | 1536 | if (!$this->tableOfContentsLoaded) { |
1537 | 1537 | // Get all logical structures. |
1538 | - $this->getLogicalStructure('', true); |
|
1539 | - $this->tableOfContentsLoaded = true; |
|
1538 | + $this->getLogicalStructure('', TRUE); |
|
1539 | + $this->tableOfContentsLoaded = TRUE; |
|
1540 | 1540 | } |
1541 | 1541 | return $this->tableOfContents; |
1542 | 1542 | } |
@@ -1552,7 +1552,7 @@ discard block |
||
1552 | 1552 | * |
1553 | 1553 | * @return string The document's thumbnail location |
1554 | 1554 | */ |
1555 | - protected abstract function _getThumbnail($forceReload = false); |
|
1555 | + protected abstract function _getThumbnail($forceReload = FALSE); |
|
1556 | 1556 | |
1557 | 1557 | /** |
1558 | 1558 | * This returns the ID of the toplevel logical structure node |
@@ -1634,7 +1634,7 @@ discard block |
||
1634 | 1634 | && $this->load($uid))) { |
1635 | 1635 | // Initialize core METS object. |
1636 | 1636 | $this->init(); |
1637 | - if ($this->getDocument() !== null) { |
|
1637 | + if ($this->getDocument() !== NULL) { |
|
1638 | 1638 | // Cast to string for safety reasons. |
1639 | 1639 | $location = (string) $uid; |
1640 | 1640 | $this->establishRecordId($pid); |
@@ -1692,30 +1692,30 @@ discard block |
||
1692 | 1692 | $this->parentId = $resArray['partof']; |
1693 | 1693 | $this->thumbnail = $resArray['thumbnail']; |
1694 | 1694 | $this->location = $resArray['location']; |
1695 | - $this->thumbnailLoaded = true; |
|
1695 | + $this->thumbnailLoaded = TRUE; |
|
1696 | 1696 | // Load XML file if necessary... |
1697 | 1697 | if ( |
1698 | - $this->getDocument() === null |
|
1698 | + $this->getDocument() === NULL |
|
1699 | 1699 | && $this->load($this->location) |
1700 | 1700 | ) { |
1701 | 1701 | // ...and set some basic properties. |
1702 | 1702 | $this->init(); |
1703 | 1703 | } |
1704 | 1704 | // Do we have a METS / IIIF object now? |
1705 | - if ($this->getDocument() !== null) { |
|
1705 | + if ($this->getDocument() !== NULL) { |
|
1706 | 1706 | // Set new location if necessary. |
1707 | 1707 | if (!empty($location)) { |
1708 | 1708 | $this->location = $location; |
1709 | 1709 | } |
1710 | 1710 | // Document ready! |
1711 | - $this->ready = true; |
|
1711 | + $this->ready = TRUE; |
|
1712 | 1712 | } |
1713 | - } elseif ($this->getDocument() !== null) { |
|
1713 | + } elseif ($this->getDocument() !== NULL) { |
|
1714 | 1714 | // Set location as UID for documents not in database. |
1715 | 1715 | $this->uid = $location; |
1716 | 1716 | $this->location = $location; |
1717 | 1717 | // Document ready! |
1718 | - $this->ready = true; |
|
1718 | + $this->ready = TRUE; |
|
1719 | 1719 | } else { |
1720 | 1720 | $this->logger->error('No document with UID ' . $uid . ' found or document not accessible'); |
1721 | 1721 | } |
@@ -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 []; |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | } |
661 | 661 | } |
662 | 662 | // Extract metadata only from first supported dmdSec. |
663 | - $hasSupportedMetadata = true; |
|
663 | + $hasSupportedMetadata = TRUE; |
|
664 | 664 | break; |
665 | 665 | } |
666 | 666 | if ($hasSupportedMetadata) { |
@@ -726,16 +726,16 @@ discard block |
||
726 | 726 | protected function loadLocation($location) |
727 | 727 | { |
728 | 728 | $fileResource = GeneralUtility::getUrl($location); |
729 | - if ($fileResource !== false) { |
|
729 | + if ($fileResource !== FALSE) { |
|
730 | 730 | $xml = Helper::getXmlFileAsString($fileResource); |
731 | 731 | // Set some basic properties. |
732 | - if ($xml !== false) { |
|
732 | + if ($xml !== FALSE) { |
|
733 | 733 | $this->xml = $xml; |
734 | - return true; |
|
734 | + return TRUE; |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | $this->logger->error('Could not load XML file from "' . $location . '"'); |
738 | - return false; |
|
738 | + return FALSE; |
|
739 | 739 | } |
740 | 740 | |
741 | 741 | /** |
@@ -783,9 +783,9 @@ discard block |
||
783 | 783 | |
784 | 784 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
785 | 785 | $this->xml = $preloadedDocument; |
786 | - return true; |
|
786 | + return TRUE; |
|
787 | 787 | } |
788 | - return false; |
|
788 | + return FALSE; |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | /** |
@@ -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 | $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
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 | $this->logger->warning('No fileGrp for thumbnails specified'); |
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 | $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
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,7 +1143,7 @@ discard block |
||
1143 | 1143 | public function __wakeup() |
1144 | 1144 | { |
1145 | 1145 | $xml = Helper::getXmlFileAsString($this->asXML); |
1146 | - if ($xml !== false) { |
|
1146 | + if ($xml !== FALSE) { |
|
1147 | 1147 | $this->asXML = ''; |
1148 | 1148 | $this->xml = $xml; |
1149 | 1149 | // Rebuild the unserializable properties. |