@@ -693,14 +693,14 @@ discard block |
||
693 | 693 | // Get the root element's name as text format. |
694 | 694 | $textFormat = strtoupper($rawTextXml->getName()); |
695 | 695 | } else { |
696 | - $this->logger->warning('Couldn\'t load fulltext file for structure node @ID "' . $id . '"'); |
|
696 | + $this->logger->warning('Couldn\'t load fulltext file for structure node @ID "'.$id.'"'); |
|
697 | 697 | return $rawText; |
698 | 698 | } |
699 | 699 | break; |
700 | 700 | } |
701 | 701 | } |
702 | 702 | } else { |
703 | - $this->logger->warning('Invalid structure node @ID "' . $id . '"'); |
|
703 | + $this->logger->warning('Invalid structure node @ID "'.$id.'"'); |
|
704 | 704 | return $rawText; |
705 | 705 | } |
706 | 706 | // Is this text format supported? |
@@ -718,11 +718,11 @@ discard block |
||
718 | 718 | $rawText = $obj->getRawText($rawTextXml); |
719 | 719 | $this->rawTextArray[$id] = $rawText; |
720 | 720 | } else { |
721 | - $this->logger->warning('Invalid class/method "' . $class . '->getRawText()" for text format "' . $textFormat . '"'); |
|
721 | + $this->logger->warning('Invalid class/method "'.$class.'->getRawText()" for text format "'.$textFormat.'"'); |
|
722 | 722 | } |
723 | 723 | } |
724 | 724 | } else { |
725 | - $this->logger->warning('Unsupported text format "' . $textFormat . '" in physical node with @ID "' . $id . '"'); |
|
725 | + $this->logger->warning('Unsupported text format "'.$textFormat.'" in physical node with @ID "'.$id.'"'); |
|
726 | 726 | } |
727 | 727 | return $rawText; |
728 | 728 | } |
@@ -777,10 +777,10 @@ discard block |
||
777 | 777 | $title = self::getTitle($partof, true); |
778 | 778 | } |
779 | 779 | } else { |
780 | - $logger->warning('No document with UID ' . $uid . ' found or document not accessible'); |
|
780 | + $logger->warning('No document with UID '.$uid.' found or document not accessible'); |
|
781 | 781 | } |
782 | 782 | } else { |
783 | - $logger->error('Invalid UID ' . $uid . ' for document'); |
|
783 | + $logger->error('Invalid UID '.$uid.' for document'); |
|
784 | 784 | } |
785 | 785 | return $title; |
786 | 786 | } |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | // the actual loading is format specific |
916 | 916 | return $this->loadLocation($location); |
917 | 917 | } else { |
918 | - $this->logger->error('Invalid file location "' . $location . '" for document loading'); |
|
918 | + $this->logger->error('Invalid file location "'.$location.'" for document loading'); |
|
919 | 919 | } |
920 | 920 | return false; |
921 | 921 | } |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | // Retain current PID. |
1025 | 1025 | $pid = $this->pid; |
1026 | 1026 | } elseif (!$pid) { |
1027 | - $this->logger->error('Invalid PID ' . $pid . ' for document saving'); |
|
1027 | + $this->logger->error('Invalid PID '.$pid.' for document saving'); |
|
1028 | 1028 | return false; |
1029 | 1029 | } |
1030 | 1030 | // Set PID for metadata definitions. |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | if ($resArray = $result->fetch()) { |
1062 | 1062 | $structure = $resArray['uid']; |
1063 | 1063 | } else { |
1064 | - $this->logger->error('Could not identify document/structure type "' . $queryBuilder->expr()->literal($metadata['type'][0]) . '"'); |
|
1064 | + $this->logger->error('Could not identify document/structure type "'.$queryBuilder->expr()->literal($metadata['type'][0]).'"'); |
|
1065 | 1065 | return false; |
1066 | 1066 | } |
1067 | 1067 | $metadata['type'][0] = $structure; |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | if ($core) { |
1304 | 1304 | Indexer::add($this, $core); |
1305 | 1305 | } else { |
1306 | - $this->logger->notice('Invalid UID "' . $core . '" for Solr core'); |
|
1306 | + $this->logger->notice('Invalid UID "'.$core.'" for Solr core'); |
|
1307 | 1307 | } |
1308 | 1308 | return true; |
1309 | 1309 | } |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | // Set metadata definitions' PID. |
1370 | 1370 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
1371 | 1371 | if (!$cPid) { |
1372 | - $this->logger->error('Invalid PID ' . $cPid . ' for metadata definitions'); |
|
1372 | + $this->logger->error('Invalid PID '.$cPid.' for metadata definitions'); |
|
1373 | 1373 | return []; |
1374 | 1374 | } |
1375 | 1375 | if ( |
@@ -1697,7 +1697,7 @@ discard block |
||
1697 | 1697 | // Document ready! |
1698 | 1698 | $this->ready = true; |
1699 | 1699 | } else { |
1700 | - $this->logger->error('No document with UID ' . $uid . ' found or document not accessible'); |
|
1700 | + $this->logger->error('No document with UID '.$uid.' found or document not accessible'); |
|
1701 | 1701 | } |
1702 | 1702 | } |
1703 | 1703 | |
@@ -1712,12 +1712,12 @@ discard block |
||
1712 | 1712 | */ |
1713 | 1713 | public function __get($var) |
1714 | 1714 | { |
1715 | - $method = '_get' . ucfirst($var); |
|
1715 | + $method = '_get'.ucfirst($var); |
|
1716 | 1716 | if ( |
1717 | 1717 | !property_exists($this, $var) |
1718 | 1718 | || !method_exists($this, $method) |
1719 | 1719 | ) { |
1720 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
1720 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
1721 | 1721 | return; |
1722 | 1722 | } else { |
1723 | 1723 | return $this->$method(); |
@@ -1750,12 +1750,12 @@ discard block |
||
1750 | 1750 | */ |
1751 | 1751 | public function __set($var, $value) |
1752 | 1752 | { |
1753 | - $method = '_set' . ucfirst($var); |
|
1753 | + $method = '_set'.ucfirst($var); |
|
1754 | 1754 | if ( |
1755 | 1755 | !property_exists($this, $var) |
1756 | 1756 | || !method_exists($this, $method) |
1757 | 1757 | ) { |
1758 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
1758 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
1759 | 1759 | } else { |
1760 | 1760 | $this->$method($value); |
1761 | 1761 | } |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | * @property-read mixed $uid This holds the UID or the URL of the document |
48 | 48 | * @abstract |
49 | 49 | */ |
50 | -abstract class Document |
|
51 | -{ |
|
50 | +abstract class Document { |
|
52 | 51 | /** |
53 | 52 | * This holds the logger |
54 | 53 | * |
@@ -340,8 +339,7 @@ discard block |
||
340 | 339 | * |
341 | 340 | * @return void |
342 | 341 | */ |
343 | - public static function clearRegistry() |
|
344 | - { |
|
342 | + public static function clearRegistry() { |
|
345 | 343 | // Reset registry array. |
346 | 344 | self::$registry = []; |
347 | 345 | } |
@@ -616,8 +614,7 @@ discard block |
||
616 | 614 | * |
617 | 615 | * @return int The physical page number |
618 | 616 | */ |
619 | - public function getPhysicalPage($logicalPage) |
|
620 | - { |
|
617 | + public function getPhysicalPage($logicalPage) { |
|
621 | 618 | if ( |
622 | 619 | !empty($this->lastSearchedPhysicalPage['logicalPage']) |
623 | 620 | && $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage |
@@ -664,8 +661,7 @@ discard block |
||
664 | 661 | * |
665 | 662 | * @return string The physical structure node's / IIIF resource's raw text from XML |
666 | 663 | */ |
667 | - protected function getRawTextFromXml($id) |
|
668 | - { |
|
664 | + protected function getRawTextFromXml($id) { |
|
669 | 665 | $rawText = ''; |
670 | 666 | // Load available text formats, ... |
671 | 667 | $this->loadFormats(); |
@@ -739,8 +735,7 @@ discard block |
||
739 | 735 | * |
740 | 736 | * @return string The title of the document itself or a parent document |
741 | 737 | */ |
742 | - public static function getTitle($uid, $recursive = false) |
|
743 | - { |
|
738 | + public static function getTitle($uid, $recursive = false) { |
|
744 | 739 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); |
745 | 740 | |
746 | 741 | $title = ''; |
@@ -794,8 +789,7 @@ discard block |
||
794 | 789 | * |
795 | 790 | * @return array The logical structure node's / resource's parsed metadata array |
796 | 791 | */ |
797 | - public function getTitledata($cPid = 0) |
|
798 | - { |
|
792 | + public function getTitledata($cPid = 0) { |
|
799 | 793 | $titledata = $this->getMetadata($this->_getToplevelId(), $cPid); |
800 | 794 | // Add information from METS structural map to titledata array. |
801 | 795 | if ($this instanceof MetsDocument) { |
@@ -828,8 +822,7 @@ discard block |
||
828 | 822 | * @return int|bool: false if structure with $logId is not a child of this substructure, |
829 | 823 | * or the actual depth. |
830 | 824 | */ |
831 | - protected function getTreeDepth($structure, $depth, $logId) |
|
832 | - { |
|
825 | + protected function getTreeDepth($structure, $depth, $logId) { |
|
833 | 826 | foreach ($structure as $element) { |
834 | 827 | if ($element['id'] == $logId) { |
835 | 828 | return $depth; |
@@ -851,8 +844,7 @@ discard block |
||
851 | 844 | * @param string $logId: The id of the logical structure element whose depth is requested |
852 | 845 | * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC. |
853 | 846 | */ |
854 | - public function getStructureDepth($logId) |
|
855 | - { |
|
847 | + public function getStructureDepth($logId) { |
|
856 | 848 | return $this->getTreeDepth($this->_getTableOfContents(), 1, $logId); |
857 | 849 | } |
858 | 850 | |
@@ -902,8 +894,7 @@ discard block |
||
902 | 894 | * |
903 | 895 | * @return bool true on success or false on failure |
904 | 896 | */ |
905 | - protected function load($location) |
|
906 | - { |
|
897 | + protected function load($location) { |
|
907 | 898 | // Load XML / JSON-LD file. |
908 | 899 | if (GeneralUtility::isValidUrl($location)) { |
909 | 900 | // Load extension configuration |
@@ -936,8 +927,7 @@ discard block |
||
936 | 927 | * |
937 | 928 | * @return void |
938 | 929 | */ |
939 | - protected function loadFormats() |
|
940 | - { |
|
930 | + protected function loadFormats() { |
|
941 | 931 | if (!$this->formatsLoaded) { |
942 | 932 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
943 | 933 | ->getQueryBuilderForTable('tx_dlf_formats'); |
@@ -977,8 +967,7 @@ discard block |
||
977 | 967 | * |
978 | 968 | * @return void |
979 | 969 | */ |
980 | - public function registerNamespaces(&$obj) |
|
981 | - { |
|
970 | + public function registerNamespaces(&$obj) { |
|
982 | 971 | // 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. |
983 | 972 | $this->loadFormats(); |
984 | 973 | // Do we have a \SimpleXMLElement or \DOMXPath object? |
@@ -1007,8 +996,7 @@ discard block |
||
1007 | 996 | * |
1008 | 997 | * @return bool true on success or false on failure |
1009 | 998 | */ |
1010 | - public function save($pid = 0, $core = 0, $owner = null) |
|
1011 | - { |
|
999 | + public function save($pid = 0, $core = 0, $owner = null) { |
|
1012 | 1000 | if (\TYPO3_MODE !== 'BE') { |
1013 | 1001 | $this->logger->error('Saving a document is only allowed in the backend'); |
1014 | 1002 | return false; |
@@ -1333,8 +1321,7 @@ discard block |
||
1333 | 1321 | * |
1334 | 1322 | * @return int The PID of the metadata definitions |
1335 | 1323 | */ |
1336 | - protected function _getCPid() |
|
1337 | - { |
|
1324 | + protected function _getCPid() { |
|
1338 | 1325 | return $this->cPid; |
1339 | 1326 | } |
1340 | 1327 | |
@@ -1345,8 +1332,7 @@ discard block |
||
1345 | 1332 | * |
1346 | 1333 | * @return bool Are there any fulltext files available? |
1347 | 1334 | */ |
1348 | - protected function _getHasFulltext() |
|
1349 | - { |
|
1335 | + protected function _getHasFulltext() { |
|
1350 | 1336 | $this->ensureHasFulltextIsSet(); |
1351 | 1337 | return $this->hasFulltext; |
1352 | 1338 | } |
@@ -1358,8 +1344,7 @@ discard block |
||
1358 | 1344 | * |
1359 | 1345 | * @return string The location of the document |
1360 | 1346 | */ |
1361 | - protected function _getLocation() |
|
1362 | - { |
|
1347 | + protected function _getLocation() { |
|
1363 | 1348 | return $this->location; |
1364 | 1349 | } |
1365 | 1350 | |
@@ -1381,8 +1366,7 @@ discard block |
||
1381 | 1366 | * |
1382 | 1367 | * @return array Array of metadata with their corresponding logical structure node ID as key |
1383 | 1368 | */ |
1384 | - protected function _getMetadataArray() |
|
1385 | - { |
|
1369 | + protected function _getMetadataArray() { |
|
1386 | 1370 | // Set metadata definitions' PID. |
1387 | 1371 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
1388 | 1372 | if (!$cPid) { |
@@ -1407,8 +1391,7 @@ discard block |
||
1407 | 1391 | * |
1408 | 1392 | * @return int The total number of pages and/or tracks |
1409 | 1393 | */ |
1410 | - protected function _getNumPages() |
|
1411 | - { |
|
1394 | + protected function _getNumPages() { |
|
1412 | 1395 | $this->_getPhysicalStructure(); |
1413 | 1396 | return $this->numPages; |
1414 | 1397 | } |
@@ -1420,8 +1403,7 @@ discard block |
||
1420 | 1403 | * |
1421 | 1404 | * @return int The UID of the parent document or zero if not applicable |
1422 | 1405 | */ |
1423 | - protected function _getParentId() |
|
1424 | - { |
|
1406 | + protected function _getParentId() { |
|
1425 | 1407 | return $this->parentId; |
1426 | 1408 | } |
1427 | 1409 | |
@@ -1444,8 +1426,7 @@ discard block |
||
1444 | 1426 | * |
1445 | 1427 | * @return array Array of elements' type, label and file representations ordered by @ID attribute / Canvas order |
1446 | 1428 | */ |
1447 | - protected function _getPhysicalStructureInfo() |
|
1448 | - { |
|
1429 | + protected function _getPhysicalStructureInfo() { |
|
1449 | 1430 | // Is there no physical structure array yet? |
1450 | 1431 | if (!$this->physicalStructureLoaded) { |
1451 | 1432 | // Build physical structure array. |
@@ -1461,8 +1442,7 @@ discard block |
||
1461 | 1442 | * |
1462 | 1443 | * @return int The PID of the document or zero if not in database |
1463 | 1444 | */ |
1464 | - protected function _getPid() |
|
1465 | - { |
|
1445 | + protected function _getPid() { |
|
1466 | 1446 | return $this->pid; |
1467 | 1447 | } |
1468 | 1448 | |
@@ -1473,8 +1453,7 @@ discard block |
||
1473 | 1453 | * |
1474 | 1454 | * @return bool Is the document instantiated successfully? |
1475 | 1455 | */ |
1476 | - protected function _getReady() |
|
1477 | - { |
|
1456 | + protected function _getReady() { |
|
1478 | 1457 | return $this->ready; |
1479 | 1458 | } |
1480 | 1459 | |
@@ -1485,8 +1464,7 @@ discard block |
||
1485 | 1464 | * |
1486 | 1465 | * @return mixed The METS file's / IIIF manifest's record identifier |
1487 | 1466 | */ |
1488 | - protected function _getRecordId() |
|
1489 | - { |
|
1467 | + protected function _getRecordId() { |
|
1490 | 1468 | return $this->recordId; |
1491 | 1469 | } |
1492 | 1470 | |
@@ -1497,8 +1475,7 @@ discard block |
||
1497 | 1475 | * |
1498 | 1476 | * @return int The UID of the root document or zero if not applicable |
1499 | 1477 | */ |
1500 | - protected function _getRootId() |
|
1501 | - { |
|
1478 | + protected function _getRootId() { |
|
1502 | 1479 | if (!$this->rootIdLoaded) { |
1503 | 1480 | if ($this->parentId) { |
1504 | 1481 | $parent = self::getInstance($this->parentId, $this->pid); |
@@ -1528,8 +1505,7 @@ discard block |
||
1528 | 1505 | * |
1529 | 1506 | * @return array Array of structure nodes' id, label, type and physical page indexes/mptr / Canvas link with original hierarchy preserved |
1530 | 1507 | */ |
1531 | - protected function _getTableOfContents() |
|
1532 | - { |
|
1508 | + protected function _getTableOfContents() { |
|
1533 | 1509 | // Is there no logical structure array yet? |
1534 | 1510 | if (!$this->tableOfContentsLoaded) { |
1535 | 1511 | // Get all logical structures. |
@@ -1570,8 +1546,7 @@ discard block |
||
1570 | 1546 | * |
1571 | 1547 | * @return mixed The UID or the URL of the document |
1572 | 1548 | */ |
1573 | - protected function _getUid() |
|
1574 | - { |
|
1549 | + protected function _getUid() { |
|
1575 | 1550 | return $this->uid; |
1576 | 1551 | } |
1577 | 1552 | |
@@ -1584,8 +1559,7 @@ discard block |
||
1584 | 1559 | * |
1585 | 1560 | * @return void |
1586 | 1561 | */ |
1587 | - protected function _setCPid($value) |
|
1588 | - { |
|
1562 | + protected function _setCPid($value) { |
|
1589 | 1563 | $this->cPid = max(intval($value), 0); |
1590 | 1564 | } |
1591 | 1565 | |
@@ -1596,8 +1570,7 @@ discard block |
||
1596 | 1570 | * |
1597 | 1571 | * @return void |
1598 | 1572 | */ |
1599 | - protected function __clone() |
|
1600 | - { |
|
1573 | + protected function __clone() { |
|
1601 | 1574 | // This method is defined as protected because singleton objects should not be cloned. |
1602 | 1575 | } |
1603 | 1576 | |
@@ -1614,8 +1587,7 @@ discard block |
||
1614 | 1587 | * |
1615 | 1588 | * @return void |
1616 | 1589 | */ |
1617 | - protected function __construct($uid, $pid, $preloadedDocument) |
|
1618 | - { |
|
1590 | + protected function __construct($uid, $pid, $preloadedDocument) { |
|
1619 | 1591 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
1620 | 1592 | ->getQueryBuilderForTable('tx_dlf_documents'); |
1621 | 1593 | $location = ''; |
@@ -1727,8 +1699,7 @@ discard block |
||
1727 | 1699 | * |
1728 | 1700 | * @return mixed Value of $this->$var |
1729 | 1701 | */ |
1730 | - public function __get($var) |
|
1731 | - { |
|
1702 | + public function __get($var) { |
|
1732 | 1703 | $method = '_get' . ucfirst($var); |
1733 | 1704 | if ( |
1734 | 1705 | !property_exists($this, $var) |
@@ -1750,8 +1721,7 @@ discard block |
||
1750 | 1721 | * |
1751 | 1722 | * @return bool true if variable is set and not empty, false otherwise |
1752 | 1723 | */ |
1753 | - public function __isset($var) |
|
1754 | - { |
|
1724 | + public function __isset($var) { |
|
1755 | 1725 | return !empty($this->__get($var)); |
1756 | 1726 | } |
1757 | 1727 | |
@@ -1765,8 +1735,7 @@ discard block |
||
1765 | 1735 | * |
1766 | 1736 | * @return void |
1767 | 1737 | */ |
1768 | - public function __set($var, $value) |
|
1769 | - { |
|
1738 | + public function __set($var, $value) { |
|
1770 | 1739 | $method = '_set' . ucfirst($var); |
1771 | 1740 | if ( |
1772 | 1741 | !property_exists($this, $var) |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @var bool |
103 | 103 | * @access protected |
104 | 104 | */ |
105 | - protected $formatsLoaded = false; |
|
105 | + protected $formatsLoaded = FALSE; |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Are there any fulltext files available? This also includes IIIF text annotations |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @var bool |
113 | 113 | * @access protected |
114 | 114 | */ |
115 | - protected $hasFulltext = false; |
|
115 | + protected $hasFulltext = FALSE; |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Last searched logical and physical page |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @var array |
121 | 121 | * @access protected |
122 | 122 | */ |
123 | - protected $lastSearchedPhysicalPage = ['logicalPage' => null, 'physicalPage' => null]; |
|
123 | + protected $lastSearchedPhysicalPage = ['logicalPage' => NULL, 'physicalPage' => NULL]; |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * This holds the documents location |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @var bool |
155 | 155 | * @access protected |
156 | 156 | */ |
157 | - protected $metadataArrayLoaded = false; |
|
157 | + protected $metadataArrayLoaded = FALSE; |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * The holds the total number of pages |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @var bool |
196 | 196 | * @access protected |
197 | 197 | */ |
198 | - protected $physicalStructureLoaded = false; |
|
198 | + protected $physicalStructureLoaded = FALSE; |
|
199 | 199 | |
200 | 200 | /** |
201 | 201 | * This holds the PID of the document or zero if not in database |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @var bool |
221 | 221 | * @access protected |
222 | 222 | */ |
223 | - protected $ready = false; |
|
223 | + protected $ready = FALSE; |
|
224 | 224 | |
225 | 225 | /** |
226 | 226 | * The METS file's / IIIF manifest's record identifier |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @var bool |
255 | 255 | * @access protected |
256 | 256 | */ |
257 | - protected $rootIdLoaded = false; |
|
257 | + protected $rootIdLoaded = FALSE; |
|
258 | 258 | |
259 | 259 | /** |
260 | 260 | * This holds the smLinks between logical and physical structMap |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @var bool |
272 | 272 | * @access protected |
273 | 273 | */ |
274 | - protected $smLinksLoaded = false; |
|
274 | + protected $smLinksLoaded = FALSE; |
|
275 | 275 | |
276 | 276 | /** |
277 | 277 | * This holds the logical structure |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * @var bool |
289 | 289 | * @access protected |
290 | 290 | */ |
291 | - protected $tableOfContentsLoaded = false; |
|
291 | + protected $tableOfContentsLoaded = FALSE; |
|
292 | 292 | |
293 | 293 | /** |
294 | 294 | * This holds the document's thumbnail location |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * @var bool |
306 | 306 | * @access protected |
307 | 307 | */ |
308 | - protected $thumbnailLoaded = false; |
|
308 | + protected $thumbnailLoaded = FALSE; |
|
309 | 309 | |
310 | 310 | /** |
311 | 311 | * This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF) |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * |
423 | 423 | * @return \Kitodo\Dlf\Common\Document Instance of this class, either MetsDocument or IiifManifest |
424 | 424 | */ |
425 | - public static function &getInstance($uid, $pid = 0, $forceReload = false) |
|
425 | + public static function &getInstance($uid, $pid = 0, $forceReload = FALSE) |
|
426 | 426 | { |
427 | 427 | // Sanitize input. |
428 | 428 | $pid = max(intval($pid), 0); |
@@ -462,10 +462,10 @@ discard block |
||
462 | 462 | } |
463 | 463 | } |
464 | 464 | // Create new instance depending on format (METS or IIIF) ... |
465 | - $instance = null; |
|
466 | - $documentFormat = null; |
|
467 | - $xml = null; |
|
468 | - $iiif = null; |
|
465 | + $instance = NULL; |
|
466 | + $documentFormat = NULL; |
|
467 | + $xml = NULL; |
|
468 | + $iiif = NULL; |
|
469 | 469 | // Try to get document format from database |
470 | 470 | if (MathUtility::canBeInterpretedAsInteger($uid)) { |
471 | 471 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -514,27 +514,27 @@ discard block |
||
514 | 514 | @ini_set('user_agent', $extConf['useragent']); |
515 | 515 | } |
516 | 516 | $content = GeneralUtility::getUrl($location); |
517 | - if ($content !== false) { |
|
517 | + if ($content !== FALSE) { |
|
518 | 518 | // TODO use single place to load xml |
519 | 519 | // Turn off libxml's error logging. |
520 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
520 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
521 | 521 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
522 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
522 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
523 | 523 | // Try to load XML from file. |
524 | 524 | $xml = simplexml_load_string($content); |
525 | 525 | // reset entity loader setting |
526 | 526 | libxml_disable_entity_loader($previousValueOfEntityLoader); |
527 | 527 | // Reset libxml's error logging. |
528 | 528 | libxml_use_internal_errors($libxmlErrors); |
529 | - if ($xml !== false) { |
|
529 | + if ($xml !== FALSE) { |
|
530 | 530 | /* @var $xml \SimpleXMLElement */ |
531 | 531 | $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/'); |
532 | 532 | $xpathResult = $xml->xpath('//mets:mets'); |
533 | - $documentFormat = !empty($xpathResult) ? 'METS' : null; |
|
533 | + $documentFormat = !empty($xpathResult) ? 'METS' : NULL; |
|
534 | 534 | } else { |
535 | 535 | // Try to load file as IIIF resource instead. |
536 | - $contentAsJsonArray = json_decode($content, true); |
|
537 | - if ($contentAsJsonArray !== null) { |
|
536 | + $contentAsJsonArray = json_decode($content, TRUE); |
|
537 | + if ($contentAsJsonArray !== NULL) { |
|
538 | 538 | // Load plugin configuration. |
539 | 539 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
540 | 540 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | * |
590 | 590 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
591 | 591 | */ |
592 | - public abstract function getLogicalStructure($id, $recursive = false); |
|
592 | + public abstract function getLogicalStructure($id, $recursive = FALSE); |
|
593 | 593 | |
594 | 594 | /** |
595 | 595 | * This extracts all the metadata for a logical structure node |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | } else { |
627 | 627 | $physicalPage = 0; |
628 | 628 | foreach ($this->physicalStructureInfo as $page) { |
629 | - if (strpos($page['orderlabel'], $logicalPage) !== false) { |
|
629 | + if (strpos($page['orderlabel'], $logicalPage) !== FALSE) { |
|
630 | 630 | $this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage; |
631 | 631 | $this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage; |
632 | 632 | return $physicalPage; |
@@ -679,11 +679,11 @@ discard block |
||
679 | 679 | if (!empty($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])) { |
680 | 680 | // Get fulltext file. |
681 | 681 | $file = GeneralUtility::getUrl($this->getFileLocation($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])); |
682 | - if ($file !== false) { |
|
682 | + if ($file !== FALSE) { |
|
683 | 683 | // Turn off libxml's error logging. |
684 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
684 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
685 | 685 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept. |
686 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
686 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
687 | 687 | // Load XML from file. |
688 | 688 | $rawTextXml = simplexml_load_string($file); |
689 | 689 | // Reset entity loader setting. |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | * |
740 | 740 | * @return string The title of the document itself or a parent document |
741 | 741 | */ |
742 | - public static function getTitle($uid, $recursive = false) |
|
742 | + public static function getTitle($uid, $recursive = FALSE) |
|
743 | 743 | { |
744 | 744 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); |
745 | 745 | |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | && intval($partof) |
775 | 775 | && $partof != $uid |
776 | 776 | ) { |
777 | - $title = self::getTitle($partof, true); |
|
777 | + $title = self::getTitle($partof, TRUE); |
|
778 | 778 | } |
779 | 779 | } else { |
780 | 780 | $logger->warning('No document with UID ' . $uid . ' found or document not accessible'); |
@@ -835,12 +835,12 @@ discard block |
||
835 | 835 | return $depth; |
836 | 836 | } elseif (array_key_exists('children', $element)) { |
837 | 837 | $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId); |
838 | - if ($foundInChildren !== false) { |
|
838 | + if ($foundInChildren !== FALSE) { |
|
839 | 839 | return $foundInChildren; |
840 | 840 | } |
841 | 841 | } |
842 | 842 | } |
843 | - return false; |
|
843 | + return FALSE; |
|
844 | 844 | } |
845 | 845 | |
846 | 846 | /** |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | } else { |
918 | 918 | $this->logger->error('Invalid file location "' . $location . '" for document loading'); |
919 | 919 | } |
920 | - return false; |
|
920 | + return FALSE; |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | /** |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | 'class' => $resArray['class'] |
965 | 965 | ]; |
966 | 966 | } |
967 | - $this->formatsLoaded = true; |
|
967 | + $this->formatsLoaded = TRUE; |
|
968 | 968 | } |
969 | 969 | } |
970 | 970 | |
@@ -1007,11 +1007,11 @@ discard block |
||
1007 | 1007 | * |
1008 | 1008 | * @return bool true on success or false on failure |
1009 | 1009 | */ |
1010 | - public function save($pid = 0, $core = 0, $owner = null) |
|
1010 | + public function save($pid = 0, $core = 0, $owner = NULL) |
|
1011 | 1011 | { |
1012 | 1012 | if (\TYPO3_MODE !== 'BE') { |
1013 | 1013 | $this->logger->error('Saving a document is only allowed in the backend'); |
1014 | - return false; |
|
1014 | + return FALSE; |
|
1015 | 1015 | } |
1016 | 1016 | // Make sure $pid is a non-negative integer. |
1017 | 1017 | $pid = max(intval($pid), 0); |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | $pid = $this->pid; |
1027 | 1027 | } elseif (!$pid) { |
1028 | 1028 | $this->logger->error('Invalid PID ' . $pid . ' for document saving'); |
1029 | - return false; |
|
1029 | + return FALSE; |
|
1030 | 1030 | } |
1031 | 1031 | // Set PID for metadata definitions. |
1032 | 1032 | $this->cPid = $pid; |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | // Check for record identifier. |
1040 | 1040 | if (empty($metadata['record_id'][0])) { |
1041 | 1041 | $this->logger->error('No record identifier found to avoid duplication'); |
1042 | - return false; |
|
1042 | + return FALSE; |
|
1043 | 1043 | } |
1044 | 1044 | // Load plugin configuration. |
1045 | 1045 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | $structure = $resArray['uid']; |
1064 | 1064 | } else { |
1065 | 1065 | $this->logger->error('Could not identify document/structure type "' . $queryBuilder->expr()->literal($metadata['type'][0]) . '"'); |
1066 | - return false; |
|
1066 | + return FALSE; |
|
1067 | 1067 | } |
1068 | 1068 | $metadata['type'][0] = $structure; |
1069 | 1069 | |
@@ -1120,9 +1120,9 @@ discard block |
||
1120 | 1120 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
1121 | 1121 | Helper::addMessage( |
1122 | 1122 | htmlspecialchars(sprintf(Helper::getMessage('flash.newCollection'), $collection, $substUid[$collNewUid])), |
1123 | - Helper::getMessage('flash.attention', true), |
|
1123 | + Helper::getMessage('flash.attention', TRUE), |
|
1124 | 1124 | \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
1125 | - true |
|
1125 | + TRUE |
|
1126 | 1126 | ); |
1127 | 1127 | } |
1128 | 1128 | } |
@@ -1173,9 +1173,9 @@ discard block |
||
1173 | 1173 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
1174 | 1174 | Helper::addMessage( |
1175 | 1175 | htmlspecialchars(sprintf(Helper::getMessage('flash.newLibrary'), $owner, $ownerUid)), |
1176 | - Helper::getMessage('flash.attention', true), |
|
1176 | + Helper::getMessage('flash.attention', TRUE), |
|
1177 | 1177 | \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
1178 | - true |
|
1178 | + TRUE |
|
1179 | 1179 | ); |
1180 | 1180 | } |
1181 | 1181 | } |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | 'author' => implode('; ', $metadata['author']), |
1264 | 1264 | 'year' => implode('; ', $metadata['year']), |
1265 | 1265 | 'place' => implode('; ', $metadata['place']), |
1266 | - 'thumbnail' => $this->_getThumbnail(true), |
|
1266 | + 'thumbnail' => $this->_getThumbnail(TRUE), |
|
1267 | 1267 | 'metadata' => serialize($listed), |
1268 | 1268 | 'metadata_sorting' => serialize($sortable), |
1269 | 1269 | 'structure' => $metadata['type'][0], |
@@ -1299,9 +1299,9 @@ discard block |
||
1299 | 1299 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
1300 | 1300 | Helper::addMessage( |
1301 | 1301 | htmlspecialchars(sprintf(Helper::getMessage('flash.documentSaved'), $metadata['title'][0], $this->uid)), |
1302 | - Helper::getMessage('flash.done', true), |
|
1302 | + Helper::getMessage('flash.done', TRUE), |
|
1303 | 1303 | \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
1304 | - true |
|
1304 | + TRUE |
|
1305 | 1305 | ); |
1306 | 1306 | } |
1307 | 1307 | // Add document to index. |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | } else { |
1311 | 1311 | $this->logger->notice('Invalid UID "' . $core . '" for Solr core'); |
1312 | 1312 | } |
1313 | - return true; |
|
1313 | + return TRUE; |
|
1314 | 1314 | } |
1315 | 1315 | |
1316 | 1316 | /** |
@@ -1395,7 +1395,7 @@ discard block |
||
1395 | 1395 | ) { |
1396 | 1396 | $this->prepareMetadataArray($cPid); |
1397 | 1397 | $this->metadataArray[0] = $cPid; |
1398 | - $this->metadataArrayLoaded = true; |
|
1398 | + $this->metadataArrayLoaded = TRUE; |
|
1399 | 1399 | } |
1400 | 1400 | return $this->metadataArray; |
1401 | 1401 | } |
@@ -1504,7 +1504,7 @@ discard block |
||
1504 | 1504 | $parent = self::getInstance($this->parentId, $this->pid); |
1505 | 1505 | $this->rootId = $parent->rootId; |
1506 | 1506 | } |
1507 | - $this->rootIdLoaded = true; |
|
1507 | + $this->rootIdLoaded = TRUE; |
|
1508 | 1508 | } |
1509 | 1509 | return $this->rootId; |
1510 | 1510 | } |
@@ -1533,8 +1533,8 @@ discard block |
||
1533 | 1533 | // Is there no logical structure array yet? |
1534 | 1534 | if (!$this->tableOfContentsLoaded) { |
1535 | 1535 | // Get all logical structures. |
1536 | - $this->getLogicalStructure('', true); |
|
1537 | - $this->tableOfContentsLoaded = true; |
|
1536 | + $this->getLogicalStructure('', TRUE); |
|
1537 | + $this->tableOfContentsLoaded = TRUE; |
|
1538 | 1538 | } |
1539 | 1539 | return $this->tableOfContents; |
1540 | 1540 | } |
@@ -1550,7 +1550,7 @@ discard block |
||
1550 | 1550 | * |
1551 | 1551 | * @return string The document's thumbnail location |
1552 | 1552 | */ |
1553 | - protected abstract function _getThumbnail($forceReload = false); |
|
1553 | + protected abstract function _getThumbnail($forceReload = FALSE); |
|
1554 | 1554 | |
1555 | 1555 | /** |
1556 | 1556 | * This returns the ID of the toplevel logical structure node |
@@ -1631,7 +1631,7 @@ discard block |
||
1631 | 1631 | && $this->load($uid))) { |
1632 | 1632 | // Initialize core METS object. |
1633 | 1633 | $this->init(); |
1634 | - if ($this->getDocument() !== null) { |
|
1634 | + if ($this->getDocument() !== NULL) { |
|
1635 | 1635 | // Cast to string for safety reasons. |
1636 | 1636 | $location = (string) $uid; |
1637 | 1637 | $this->establishRecordId($pid); |
@@ -1689,30 +1689,30 @@ discard block |
||
1689 | 1689 | $this->parentId = $resArray['partof']; |
1690 | 1690 | $this->thumbnail = $resArray['thumbnail']; |
1691 | 1691 | $this->location = $resArray['location']; |
1692 | - $this->thumbnailLoaded = true; |
|
1692 | + $this->thumbnailLoaded = TRUE; |
|
1693 | 1693 | // Load XML file if necessary... |
1694 | 1694 | if ( |
1695 | - $this->getDocument() === null |
|
1695 | + $this->getDocument() === NULL |
|
1696 | 1696 | && $this->load($this->location) |
1697 | 1697 | ) { |
1698 | 1698 | // ...and set some basic properties. |
1699 | 1699 | $this->init(); |
1700 | 1700 | } |
1701 | 1701 | // Do we have a METS / IIIF object now? |
1702 | - if ($this->getDocument() !== null) { |
|
1702 | + if ($this->getDocument() !== NULL) { |
|
1703 | 1703 | // Set new location if necessary. |
1704 | 1704 | if (!empty($location)) { |
1705 | 1705 | $this->location = $location; |
1706 | 1706 | } |
1707 | 1707 | // Document ready! |
1708 | - $this->ready = true; |
|
1708 | + $this->ready = TRUE; |
|
1709 | 1709 | } |
1710 | - } elseif ($this->getDocument() !== null) { |
|
1710 | + } elseif ($this->getDocument() !== NULL) { |
|
1711 | 1711 | // Set location as UID for documents not in database. |
1712 | 1712 | $this->uid = $location; |
1713 | 1713 | $this->location = $location; |
1714 | 1714 | // Document ready! |
1715 | - $this->ready = true; |
|
1715 | + $this->ready = TRUE; |
|
1716 | 1716 | } else { |
1717 | 1717 | $this->logger->error('No document with UID ' . $uid . ' found or document not accessible'); |
1718 | 1718 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @var string|null |
56 | 56 | * @access protected |
57 | 57 | */ |
58 | - protected $core = null; |
|
58 | + protected $core = NULL; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * This holds the PID for the configuration |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @var bool |
104 | 104 | * @access protected |
105 | 105 | */ |
106 | - protected $ready = false; |
|
106 | + protected $ready = FALSE; |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * This holds the singleton search objects with their core as array key |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * |
256 | 256 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
257 | 257 | */ |
258 | - public static function getInstance($core = null) |
|
258 | + public static function getInstance($core = NULL) |
|
259 | 259 | { |
260 | 260 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); |
261 | 261 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | // Check if core is set or null. |
267 | 267 | if ( |
268 | 268 | empty($core) |
269 | - && $core !== null |
|
269 | + && $core !== NULL |
|
270 | 270 | ) { |
271 | 271 | $logger->error('Invalid core UID or name given for Apache Solr'); |
272 | 272 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | 'core' => $this->core, |
409 | 409 | 'pid' => $this->cPid, |
410 | 410 | 'order' => 'score', |
411 | - 'order.asc' => true, |
|
411 | + 'order.asc' => TRUE, |
|
412 | 412 | 'numberOfHits' => $this->numberOfHits, |
413 | 413 | 'numberOfToplevelHits' => $numberOfToplevelHits |
414 | 414 | ] |
@@ -434,10 +434,10 @@ discard block |
||
434 | 434 | // Set query. |
435 | 435 | $parameters['query'] = $query; |
436 | 436 | // Calculate cache identifier. |
437 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
437 | + $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), TRUE)); |
|
438 | 438 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
439 | 439 | $resultSet = []; |
440 | - if (($entry = $cache->get($cacheIdentifier)) === false) { |
|
440 | + if (($entry = $cache->get($cacheIdentifier)) === FALSE) { |
|
441 | 441 | $selectQuery = $this->service->createSelect(array_merge($this->params, $parameters)); |
442 | 442 | $result = $this->service->select($selectQuery); |
443 | 443 | foreach ($result as $doc) { |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | // Check if connection is established. |
664 | 664 | $query = $this->service->createCoreAdmin(); |
665 | 665 | $action = $query->createStatus(); |
666 | - if ($core !== null) { |
|
666 | + if ($core !== NULL) { |
|
667 | 667 | $action->setCore($core); |
668 | 668 | } |
669 | 669 | $query->setAction($action); |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | $response = $this->service->coreAdmin($query); |
672 | 672 | if ($response->getWasSuccessful()) { |
673 | 673 | // Solr is reachable, but is the core as well? |
674 | - if ($core !== null) { |
|
674 | + if ($core !== NULL) { |
|
675 | 675 | $result = $response->getStatusResult(); |
676 | 676 | if ( |
677 | 677 | $result instanceof \Solarium\QueryType\Server\CoreAdmin\Result\StatusResult |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | } |
686 | 686 | } |
687 | 687 | // Instantiation successful! |
688 | - $this->ready = true; |
|
688 | + $this->ready = TRUE; |
|
689 | 689 | } |
690 | 690 | } catch (\Exception $e) { |
691 | 691 | // Nothing to do here. |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | // Get next available core name if none given. |
138 | 138 | if (empty($core)) { |
139 | - $core = 'dlfCore' . self::getNextCoreNumber(); |
|
139 | + $core = 'dlfCore'.self::getNextCoreNumber(); |
|
140 | 140 | } |
141 | 141 | // Get Solr service instance. |
142 | 142 | $solr = self::getInstance($core); |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | ->execute(); |
233 | 233 | |
234 | 234 | while ($resArray = $result->fetch()) { |
235 | - $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i'; |
|
235 | + $fields[] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').($resArray['index_stored'] ? 's' : 'u').'i'; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | // Check if queried field is valid. |
239 | 239 | $splitQuery = explode(':', $query, 2); |
240 | 240 | if (in_array($splitQuery[0], $fields)) { |
241 | - $query = $splitQuery[0] . ':(' . self::escapeQuery(trim($splitQuery[1], '()')) . ')'; |
|
241 | + $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')'; |
|
242 | 242 | } else { |
243 | 243 | $query = self::escapeQuery($query); |
244 | 244 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | { |
346 | 346 | $number = max(intval($number), 0); |
347 | 347 | // Check if core already exists. |
348 | - $solr = self::getInstance('dlfCore' . $number); |
|
348 | + $solr = self::getInstance('dlfCore'.$number); |
|
349 | 349 | if (!$solr->ready) { |
350 | 350 | return $number; |
351 | 351 | } else { |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | // Set filter query to just get toplevel documents. |
421 | 421 | $params['filterquery'][] = ['query' => 'toplevel:true']; |
422 | 422 | // Set join query to get all documents with the same uids. |
423 | - $params['query'] = '{!join from=uid to=uid}' . $params['query']; |
|
423 | + $params['query'] = '{!join from=uid to=uid}'.$params['query']; |
|
424 | 424 | // Perform search to determine the total number of toplevel hits and fetch the required rows. |
425 | 425 | $selectQuery = $this->service->createSelect($params); |
426 | 426 | $results = $this->service->select($selectQuery); |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | // Set query. |
478 | 478 | $parameters['query'] = $query; |
479 | 479 | // Calculate cache identifier. |
480 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
480 | + $cacheIdentifier = Helper::digest($this->core.print_r(array_merge($this->params, $parameters), true)); |
|
481 | 481 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
482 | 482 | $resultSet = []; |
483 | 483 | if (($entry = $cache->get($cacheIdentifier)) === false) { |
@@ -608,12 +608,12 @@ discard block |
||
608 | 608 | */ |
609 | 609 | public function __get($var) |
610 | 610 | { |
611 | - $method = '_get' . ucfirst($var); |
|
611 | + $method = '_get'.ucfirst($var); |
|
612 | 612 | if ( |
613 | 613 | !property_exists($this, $var) |
614 | 614 | || !method_exists($this, $method) |
615 | 615 | ) { |
616 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
616 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
617 | 617 | return; |
618 | 618 | } else { |
619 | 619 | return $this->$method(); |
@@ -646,12 +646,12 @@ discard block |
||
646 | 646 | */ |
647 | 647 | public function __set($var, $value) |
648 | 648 | { |
649 | - $method = '_set' . ucfirst($var); |
|
649 | + $method = '_set'.ucfirst($var); |
|
650 | 650 | if ( |
651 | 651 | !property_exists($this, $var) |
652 | 652 | || !method_exists($this, $method) |
653 | 653 | ) { |
654 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
654 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
655 | 655 | } else { |
656 | 656 | $this->$method($value); |
657 | 657 | } |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | 'scheme' => $this->config['scheme'], |
689 | 689 | 'host' => $this->config['host'], |
690 | 690 | 'port' => $this->config['port'], |
691 | - 'path' => '/' . $this->config['path'], |
|
691 | + 'path' => '/'.$this->config['path'], |
|
692 | 692 | 'core' => $core, |
693 | 693 | 'username' => $this->config['username'], |
694 | 694 | 'password' => $this->config['password'], |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | * @property-read bool $ready Is the Solr service instantiated successfully? |
38 | 38 | * @property-read \Solarium\Client $service This holds the Solr service object |
39 | 39 | */ |
40 | -class Solr implements LoggerAwareInterface |
|
41 | -{ |
|
40 | +class Solr implements LoggerAwareInterface { |
|
42 | 41 | use LoggerAwareTrait; |
43 | 42 | |
44 | 43 | /** |
@@ -130,8 +129,7 @@ discard block |
||
130 | 129 | * |
131 | 130 | * @return string The name of the new core |
132 | 131 | */ |
133 | - public static function createCore($core = '') |
|
134 | - { |
|
132 | + public static function createCore($core = '') { |
|
135 | 133 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); |
136 | 134 | |
137 | 135 | // Get next available core name if none given. |
@@ -180,8 +178,7 @@ discard block |
||
180 | 178 | * |
181 | 179 | * @return string The escaped query string |
182 | 180 | */ |
183 | - public static function escapeQuery($query) |
|
184 | - { |
|
181 | + public static function escapeQuery($query) { |
|
185 | 182 | $helper = GeneralUtility::makeInstance(\Solarium\Core\Query\Helper::class); |
186 | 183 | // Escape query phrase or term. |
187 | 184 | if (preg_match('/^".*"$/', $query)) { |
@@ -204,8 +201,7 @@ discard block |
||
204 | 201 | * |
205 | 202 | * @return string The escaped query string |
206 | 203 | */ |
207 | - public static function escapeQueryKeepField($query, $pid) |
|
208 | - { |
|
204 | + public static function escapeQueryKeepField($query, $pid) { |
|
209 | 205 | // Is there a field query? |
210 | 206 | if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(?.*\)?$/', $query)) { |
211 | 207 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -255,8 +251,7 @@ discard block |
||
255 | 251 | * |
256 | 252 | * @return array fields |
257 | 253 | */ |
258 | - public static function getFields() |
|
259 | - { |
|
254 | + public static function getFields() { |
|
260 | 255 | $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
261 | 256 | |
262 | 257 | $fields = []; |
@@ -298,8 +293,7 @@ discard block |
||
298 | 293 | * |
299 | 294 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
300 | 295 | */ |
301 | - public static function getInstance($core = null) |
|
302 | - { |
|
296 | + public static function getInstance($core = null) { |
|
303 | 297 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); |
304 | 298 | |
305 | 299 | // Get core name if UID is given. |
@@ -341,8 +335,7 @@ discard block |
||
341 | 335 | * |
342 | 336 | * @return int First unused core number found |
343 | 337 | */ |
344 | - public static function getNextCoreNumber($number = 0) |
|
345 | - { |
|
338 | + public static function getNextCoreNumber($number = 0) { |
|
346 | 339 | $number = max(intval($number), 0); |
347 | 340 | // Check if core already exists. |
348 | 341 | $solr = self::getInstance('dlfCore' . $number); |
@@ -360,8 +353,7 @@ discard block |
||
360 | 353 | * |
361 | 354 | * @return void |
362 | 355 | */ |
363 | - protected function loadSolrConnectionInfo() |
|
364 | - { |
|
356 | + protected function loadSolrConnectionInfo() { |
|
365 | 357 | if (empty($this->config)) { |
366 | 358 | $config = []; |
367 | 359 | // Extract extension configuration. |
@@ -399,8 +391,7 @@ discard block |
||
399 | 391 | * |
400 | 392 | * @return \Kitodo\Dlf\Common\DocumentList The result list |
401 | 393 | */ |
402 | - public function search() |
|
403 | - { |
|
394 | + public function search() { |
|
404 | 395 | $toplevel = []; |
405 | 396 | // Take over query parameters. |
406 | 397 | $params = $this->params; |
@@ -469,8 +460,7 @@ discard block |
||
469 | 460 | * |
470 | 461 | * @return array The Apache Solr Documents that were fetched |
471 | 462 | */ |
472 | - public function search_raw($query = '', $parameters = []) |
|
473 | - { |
|
463 | + public function search_raw($query = '', $parameters = []) { |
|
474 | 464 | // Set additional query parameters. |
475 | 465 | $parameters['start'] = 0; |
476 | 466 | $parameters['rows'] = $this->limit; |
@@ -502,8 +492,7 @@ discard block |
||
502 | 492 | * |
503 | 493 | * @return string|null The core name of the current query endpoint or null if core admin endpoint |
504 | 494 | */ |
505 | - protected function _getCore() |
|
506 | - { |
|
495 | + protected function _getCore() { |
|
507 | 496 | return $this->core; |
508 | 497 | } |
509 | 498 | |
@@ -514,8 +503,7 @@ discard block |
||
514 | 503 | * |
515 | 504 | * @return int The max number of results |
516 | 505 | */ |
517 | - protected function _getLimit() |
|
518 | - { |
|
506 | + protected function _getLimit() { |
|
519 | 507 | return $this->limit; |
520 | 508 | } |
521 | 509 | |
@@ -526,8 +514,7 @@ discard block |
||
526 | 514 | * |
527 | 515 | * @return int Total number of hits for last search |
528 | 516 | */ |
529 | - protected function _getNumberOfHits() |
|
530 | - { |
|
517 | + protected function _getNumberOfHits() { |
|
531 | 518 | return $this->numberOfHits; |
532 | 519 | } |
533 | 520 | |
@@ -538,8 +525,7 @@ discard block |
||
538 | 525 | * |
539 | 526 | * @return bool Is the search instantiated successfully? |
540 | 527 | */ |
541 | - protected function _getReady() |
|
542 | - { |
|
528 | + protected function _getReady() { |
|
543 | 529 | return $this->ready; |
544 | 530 | } |
545 | 531 | |
@@ -550,8 +536,7 @@ discard block |
||
550 | 536 | * |
551 | 537 | * @return \Solarium\Client Apache Solr service object |
552 | 538 | */ |
553 | - protected function _getService() |
|
554 | - { |
|
539 | + protected function _getService() { |
|
555 | 540 | return $this->service; |
556 | 541 | } |
557 | 542 | |
@@ -564,8 +549,7 @@ discard block |
||
564 | 549 | * |
565 | 550 | * @return void |
566 | 551 | */ |
567 | - protected function _setCPid($value) |
|
568 | - { |
|
552 | + protected function _setCPid($value) { |
|
569 | 553 | $this->cPid = max(intval($value), 0); |
570 | 554 | } |
571 | 555 | |
@@ -578,8 +562,7 @@ discard block |
||
578 | 562 | * |
579 | 563 | * @return void |
580 | 564 | */ |
581 | - protected function _setLimit($value) |
|
582 | - { |
|
565 | + protected function _setLimit($value) { |
|
583 | 566 | $this->limit = max(intval($value), 0); |
584 | 567 | } |
585 | 568 | |
@@ -592,8 +575,7 @@ discard block |
||
592 | 575 | * |
593 | 576 | * @return void |
594 | 577 | */ |
595 | - protected function _setParams(array $value) |
|
596 | - { |
|
578 | + protected function _setParams(array $value) { |
|
597 | 579 | $this->params = $value; |
598 | 580 | } |
599 | 581 | |
@@ -606,8 +588,7 @@ discard block |
||
606 | 588 | * |
607 | 589 | * @return mixed Value of $this->$var |
608 | 590 | */ |
609 | - public function __get($var) |
|
610 | - { |
|
591 | + public function __get($var) { |
|
611 | 592 | $method = '_get' . ucfirst($var); |
612 | 593 | if ( |
613 | 594 | !property_exists($this, $var) |
@@ -629,8 +610,7 @@ discard block |
||
629 | 610 | * |
630 | 611 | * @return bool true if variable is set and not empty, false otherwise |
631 | 612 | */ |
632 | - public function __isset($var) |
|
633 | - { |
|
613 | + public function __isset($var) { |
|
634 | 614 | return !empty($this->__get($var)); |
635 | 615 | } |
636 | 616 | |
@@ -644,8 +624,7 @@ discard block |
||
644 | 624 | * |
645 | 625 | * @return void |
646 | 626 | */ |
647 | - public function __set($var, $value) |
|
648 | - { |
|
627 | + public function __set($var, $value) { |
|
649 | 628 | $method = '_set' . ucfirst($var); |
650 | 629 | if ( |
651 | 630 | !property_exists($this, $var) |
@@ -666,8 +645,7 @@ discard block |
||
666 | 645 | * |
667 | 646 | * @return void |
668 | 647 | */ |
669 | - protected function __construct($core) |
|
670 | - { |
|
648 | + protected function __construct($core) { |
|
671 | 649 | // Get Solr connection parameters from configuration. |
672 | 650 | $this->loadSolrConnectionInfo(); |
673 | 651 | // Configure connection adapter. |
@@ -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 | - $this->logger->warning('There is no file node with @ID "' . $id . '"'); |
|
202 | + $this->logger->warning('There is no file node with @ID "'.$id.'"'); |
|
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 | - $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified'); |
|
220 | + $this->logger->warning('There is no file node with @ID "'.$id.'" or no MIME type specified'); |
|
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 | - $this->logger->warning('Invalid PID ' . $cPid . ' for metadata definitions'); |
|
381 | + $this->logger->warning('Invalid PID '.$cPid.' for metadata definitions'); |
|
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 | - $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->dmdSec[$dmdId]['type'] . '"'); |
|
448 | + $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->dmdSec[$dmdId]['type'].'"'); |
|
449 | 449 | } |
450 | 450 | } |
451 | 451 | } else { |
452 | - $this->logger->notice('Unsupported metadata format "' . $this->dmdSec[$dmdId]['type'] . '" in dmdSec with @ID "' . $dmdId . '"'); |
|
452 | + $this->logger->notice('Unsupported metadata format "'.$this->dmdSec[$dmdId]['type'].'" in dmdSec with @ID "'.$dmdId.'"'); |
|
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 | - $this->logger->warning('No supported metadata found for logical structure with @ID "' . $id . '"'); |
|
645 | + $this->logger->warning('No supported metadata found for logical structure with @ID "'.$id.'"'); |
|
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 | - $this->logger->error('No METS part found in document with UID ' . $this->uid); |
|
697 | + $this->logger->error('No METS part found in document with UID '.$this->uid); |
|
698 | 698 | } |
699 | 699 | } |
700 | 700 | |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | return true; |
723 | 723 | } |
724 | 724 | } |
725 | - $this->logger->error('Could not load XML file from "' . $location . '"'); |
|
725 | + $this->logger->error('Could not load XML file from "'.$location.'"'); |
|
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 | - $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
|
1009 | + $this->logger->error('Invalid PID '.$cPid.' for structure definitions'); |
|
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 | - $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
|
1069 | + $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database'); |
|
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. |
@@ -669,8 +660,7 @@ discard block |
||
669 | 660 | * {@inheritDoc} |
670 | 661 | * @see \Kitodo\Dlf\Common\Document::getRawText() |
671 | 662 | */ |
672 | - public function getRawText($id) |
|
673 | - { |
|
663 | + public function getRawText($id) { |
|
674 | 664 | $rawText = ''; |
675 | 665 | // Get text from raw text array if available. |
676 | 666 | if (!empty($this->rawTextArray[$id])) { |
@@ -688,8 +678,7 @@ discard block |
||
688 | 678 | * {@inheritDoc} |
689 | 679 | * @see Document::getStructureDepth() |
690 | 680 | */ |
691 | - public function getStructureDepth($logId) |
|
692 | - { |
|
681 | + public function getStructureDepth($logId) { |
|
693 | 682 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
694 | 683 | if (!empty($ancestors)) { |
695 | 684 | return count($ancestors); |
@@ -702,8 +691,7 @@ discard block |
||
702 | 691 | * {@inheritDoc} |
703 | 692 | * @see \Kitodo\Dlf\Common\Document::init() |
704 | 693 | */ |
705 | - protected function init() |
|
706 | - { |
|
694 | + protected function init() { |
|
707 | 695 | // Get METS node from XML file. |
708 | 696 | $this->registerNamespaces($this->xml); |
709 | 697 | $mets = $this->xml->xpath('//mets:mets'); |
@@ -720,8 +708,7 @@ discard block |
||
720 | 708 | * {@inheritDoc} |
721 | 709 | * @see \Kitodo\Dlf\Common\Document::loadLocation() |
722 | 710 | */ |
723 | - protected function loadLocation($location) |
|
724 | - { |
|
711 | + protected function loadLocation($location) { |
|
725 | 712 | $fileResource = GeneralUtility::getUrl($location); |
726 | 713 | if ($fileResource !== false) { |
727 | 714 | // Turn off libxml's error logging. |
@@ -748,8 +735,7 @@ discard block |
||
748 | 735 | * {@inheritDoc} |
749 | 736 | * @see \Kitodo\Dlf\Common\Document::ensureHasFulltextIsSet() |
750 | 737 | */ |
751 | - protected function ensureHasFulltextIsSet() |
|
752 | - { |
|
738 | + protected function ensureHasFulltextIsSet() { |
|
753 | 739 | // Are the fileGrps already loaded? |
754 | 740 | if (!$this->fileGrpsLoaded) { |
755 | 741 | $this->_getFileGrps(); |
@@ -760,8 +746,7 @@ discard block |
||
760 | 746 | * {@inheritDoc} |
761 | 747 | * @see Document::getParentDocumentUid() |
762 | 748 | */ |
763 | - protected function getParentDocumentUidForSaving($pid, $core, $owner) |
|
764 | - { |
|
749 | + protected function getParentDocumentUidForSaving($pid, $core, $owner) { |
|
765 | 750 | $partof = 0; |
766 | 751 | // Get the closest ancestor of the current document which has a MPTR child. |
767 | 752 | $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->_getToplevelId() . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
@@ -784,8 +769,7 @@ discard block |
||
784 | 769 | * {@inheritDoc} |
785 | 770 | * @see Document::setPreloadedDocument() |
786 | 771 | */ |
787 | - protected function setPreloadedDocument($preloadedDocument) |
|
788 | - { |
|
772 | + protected function setPreloadedDocument($preloadedDocument) { |
|
789 | 773 | |
790 | 774 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
791 | 775 | $this->xml = $preloadedDocument; |
@@ -798,8 +782,7 @@ discard block |
||
798 | 782 | * {@inheritDoc} |
799 | 783 | * @see Document::getDocument() |
800 | 784 | */ |
801 | - protected function getDocument() |
|
802 | - { |
|
785 | + protected function getDocument() { |
|
803 | 786 | return $this->mets; |
804 | 787 | } |
805 | 788 | |
@@ -810,8 +793,7 @@ discard block |
||
810 | 793 | * |
811 | 794 | * @return array Array of dmdSecs with their IDs as array key |
812 | 795 | */ |
813 | - protected function _getDmdSec() |
|
814 | - { |
|
796 | + protected function _getDmdSec() { |
|
815 | 797 | if (!$this->dmdSecLoaded) { |
816 | 798 | // Get available data formats. |
817 | 799 | $this->loadFormats(); |
@@ -849,8 +831,7 @@ discard block |
||
849 | 831 | * |
850 | 832 | * @return array Array of file use groups with file IDs |
851 | 833 | */ |
852 | - protected function _getFileGrps() |
|
853 | - { |
|
834 | + protected function _getFileGrps() { |
|
854 | 835 | if (!$this->fileGrpsLoaded) { |
855 | 836 | // Get configured USE attributes. |
856 | 837 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -895,8 +876,7 @@ discard block |
||
895 | 876 | * {@inheritDoc} |
896 | 877 | * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray() |
897 | 878 | */ |
898 | - protected function prepareMetadataArray($cPid) |
|
899 | - { |
|
879 | + protected function prepareMetadataArray($cPid) { |
|
900 | 880 | $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'); |
901 | 881 | // Get all logical structure nodes with metadata. |
902 | 882 | if (!empty($ids)) { |
@@ -914,8 +894,7 @@ discard block |
||
914 | 894 | * |
915 | 895 | * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object |
916 | 896 | */ |
917 | - protected function _getMets() |
|
918 | - { |
|
897 | + protected function _getMets() { |
|
919 | 898 | return $this->mets; |
920 | 899 | } |
921 | 900 | |
@@ -923,8 +902,7 @@ discard block |
||
923 | 902 | * {@inheritDoc} |
924 | 903 | * @see \Kitodo\Dlf\Common\Document::_getPhysicalStructure() |
925 | 904 | */ |
926 | - protected function _getPhysicalStructure() |
|
927 | - { |
|
905 | + protected function _getPhysicalStructure() { |
|
928 | 906 | // Is there no physical structure array yet? |
929 | 907 | if (!$this->physicalStructureLoaded) { |
930 | 908 | // Does the document have a structMap node of type "PHYSICAL"? |
@@ -984,8 +962,7 @@ discard block |
||
984 | 962 | * {@inheritDoc} |
985 | 963 | * @see \Kitodo\Dlf\Common\Document::_getSmLinks() |
986 | 964 | */ |
987 | - protected function _getSmLinks() |
|
988 | - { |
|
965 | + protected function _getSmLinks() { |
|
989 | 966 | if (!$this->smLinksLoaded) { |
990 | 967 | $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink'); |
991 | 968 | if (!empty($smLinks)) { |
@@ -1003,8 +980,7 @@ discard block |
||
1003 | 980 | * {@inheritDoc} |
1004 | 981 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
1005 | 982 | */ |
1006 | - protected function _getThumbnail($forceReload = false) |
|
1007 | - { |
|
983 | + protected function _getThumbnail($forceReload = false) { |
|
1008 | 984 | if ( |
1009 | 985 | !$this->thumbnailLoaded |
1010 | 986 | || $forceReload |
@@ -1083,8 +1059,7 @@ discard block |
||
1083 | 1059 | * {@inheritDoc} |
1084 | 1060 | * @see \Kitodo\Dlf\Common\Document::_getToplevelId() |
1085 | 1061 | */ |
1086 | - protected function _getToplevelId() |
|
1087 | - { |
|
1062 | + protected function _getToplevelId() { |
|
1088 | 1063 | if (empty($this->toplevelId)) { |
1089 | 1064 | // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
1090 | 1065 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'); |
@@ -1116,8 +1091,7 @@ discard block |
||
1116 | 1091 | * |
1117 | 1092 | * @return array Properties to be serialized |
1118 | 1093 | */ |
1119 | - public function __sleep() |
|
1120 | - { |
|
1094 | + public function __sleep() { |
|
1121 | 1095 | // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization |
1122 | 1096 | $this->asXML = $this->xml->asXML(); |
1123 | 1097 | return ['uid', 'pid', 'recordId', 'parentId', 'asXML']; |
@@ -1130,8 +1104,7 @@ discard block |
||
1130 | 1104 | * |
1131 | 1105 | * @return string String representing the METS object |
1132 | 1106 | */ |
1133 | - public function __toString() |
|
1134 | - { |
|
1107 | + public function __toString() { |
|
1135 | 1108 | $xml = new \DOMDocument('1.0', 'utf-8'); |
1136 | 1109 | $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
1137 | 1110 | $xml->formatOutput = true; |
@@ -1146,8 +1119,7 @@ discard block |
||
1146 | 1119 | * |
1147 | 1120 | * @return void |
1148 | 1121 | */ |
1149 | - public function __wakeup() |
|
1150 | - { |
|
1122 | + public function __wakeup() { |
|
1151 | 1123 | // Turn off libxml's error logging. |
1152 | 1124 | $libxmlErrors = libxml_use_internal_errors(true); |
1153 | 1125 | // 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 []; |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | $metadata['owner'][0] = $resArray['owner']; |
655 | 655 | } |
656 | 656 | // Extract metadata only from first supported dmdSec. |
657 | - $hasSupportedMetadata = true; |
|
657 | + $hasSupportedMetadata = TRUE; |
|
658 | 658 | break; |
659 | 659 | } |
660 | 660 | if ($hasSupportedMetadata) { |
@@ -723,11 +723,11 @@ discard block |
||
723 | 723 | protected function loadLocation($location) |
724 | 724 | { |
725 | 725 | $fileResource = GeneralUtility::getUrl($location); |
726 | - if ($fileResource !== false) { |
|
726 | + if ($fileResource !== FALSE) { |
|
727 | 727 | // Turn off libxml's error logging. |
728 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
728 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
729 | 729 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
730 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
730 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
731 | 731 | // Load XML from file. |
732 | 732 | $xml = simplexml_load_string($fileResource); |
733 | 733 | // reset entity loader setting |
@@ -735,13 +735,13 @@ discard block |
||
735 | 735 | // Reset libxml's error logging. |
736 | 736 | libxml_use_internal_errors($libxmlErrors); |
737 | 737 | // Set some basic properties. |
738 | - if ($xml !== false) { |
|
738 | + if ($xml !== FALSE) { |
|
739 | 739 | $this->xml = $xml; |
740 | - return true; |
|
740 | + return TRUE; |
|
741 | 741 | } |
742 | 742 | } |
743 | 743 | $this->logger->error('Could not load XML file from "' . $location . '"'); |
744 | - return false; |
|
744 | + return FALSE; |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | /** |
@@ -789,9 +789,9 @@ discard block |
||
789 | 789 | |
790 | 790 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
791 | 791 | $this->xml = $preloadedDocument; |
792 | - return true; |
|
792 | + return TRUE; |
|
793 | 793 | } |
794 | - return false; |
|
794 | + return FALSE; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | } |
838 | 838 | } |
839 | 839 | } |
840 | - $this->dmdSecLoaded = true; |
|
840 | + $this->dmdSecLoaded = TRUE; |
|
841 | 841 | } |
842 | 842 | return $this->dmdSec; |
843 | 843 | } |
@@ -884,9 +884,9 @@ discard block |
||
884 | 884 | !empty($extConf['fileGrpFulltext']) |
885 | 885 | && array_intersect(GeneralUtility::trimExplode(',', $extConf['fileGrpFulltext']), $this->fileGrps) !== [] |
886 | 886 | ) { |
887 | - $this->hasFulltext = true; |
|
887 | + $this->hasFulltext = TRUE; |
|
888 | 888 | } |
889 | - $this->fileGrpsLoaded = true; |
|
889 | + $this->fileGrpsLoaded = TRUE; |
|
890 | 890 | } |
891 | 891 | return $this->fileGrps; |
892 | 892 | } |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | $this->physicalStructure = array_merge($physSeq, $elements); |
976 | 976 | } |
977 | 977 | } |
978 | - $this->physicalStructureLoaded = true; |
|
978 | + $this->physicalStructureLoaded = TRUE; |
|
979 | 979 | } |
980 | 980 | return $this->physicalStructure; |
981 | 981 | } |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | $this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from; |
995 | 995 | } |
996 | 996 | } |
997 | - $this->smLinksLoaded = true; |
|
997 | + $this->smLinksLoaded = TRUE; |
|
998 | 998 | } |
999 | 999 | return $this->smLinks; |
1000 | 1000 | } |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | * {@inheritDoc} |
1004 | 1004 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
1005 | 1005 | */ |
1006 | - protected function _getThumbnail($forceReload = false) |
|
1006 | + protected function _getThumbnail($forceReload = FALSE) |
|
1007 | 1007 | { |
1008 | 1008 | if ( |
1009 | 1009 | !$this->thumbnailLoaded |
@@ -1013,14 +1013,14 @@ discard block |
||
1013 | 1013 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
1014 | 1014 | if (!$cPid) { |
1015 | 1015 | $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
1016 | - $this->thumbnailLoaded = true; |
|
1016 | + $this->thumbnailLoaded = TRUE; |
|
1017 | 1017 | return $this->thumbnail; |
1018 | 1018 | } |
1019 | 1019 | // Load extension configuration. |
1020 | 1020 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
1021 | 1021 | if (empty($extConf['fileGrpThumbs'])) { |
1022 | 1022 | $this->logger->warning('No fileGrp for thumbnails specified'); |
1023 | - $this->thumbnailLoaded = true; |
|
1023 | + $this->thumbnailLoaded = TRUE; |
|
1024 | 1024 | return $this->thumbnail; |
1025 | 1025 | } |
1026 | 1026 | $strctId = $this->_getToplevelId(); |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | } else { |
1075 | 1075 | $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
1076 | 1076 | } |
1077 | - $this->thumbnailLoaded = true; |
|
1077 | + $this->thumbnailLoaded = TRUE; |
|
1078 | 1078 | } |
1079 | 1079 | return $this->thumbnail; |
1080 | 1080 | } |
@@ -1133,8 +1133,8 @@ discard block |
||
1133 | 1133 | public function __toString() |
1134 | 1134 | { |
1135 | 1135 | $xml = new \DOMDocument('1.0', 'utf-8'); |
1136 | - $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
|
1137 | - $xml->formatOutput = true; |
|
1136 | + $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE)); |
|
1137 | + $xml->formatOutput = TRUE; |
|
1138 | 1138 | return $xml->saveXML(); |
1139 | 1139 | } |
1140 | 1140 | |
@@ -1149,12 +1149,12 @@ discard block |
||
1149 | 1149 | public function __wakeup() |
1150 | 1150 | { |
1151 | 1151 | // Turn off libxml's error logging. |
1152 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
1152 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
1153 | 1153 | // Reload XML from string. |
1154 | 1154 | $xml = @simplexml_load_string($this->asXML); |
1155 | 1155 | // Reset libxml's error logging. |
1156 | 1156 | libxml_use_internal_errors($libxmlErrors); |
1157 | - if ($xml !== false) { |
|
1157 | + if ($xml !== FALSE) { |
|
1158 | 1158 | $this->asXML = ''; |
1159 | 1159 | $this->xml = $xml; |
1160 | 1160 | // Rebuild the unserializable properties. |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
76 | 76 | */ |
77 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
77 | + public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages') |
|
78 | 78 | { |
79 | 79 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
80 | 80 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | $checksum = 'X'; |
117 | 117 | } |
118 | 118 | if (!preg_match('/[0-9]{8}[0-9X]{1}/i', $id)) { |
119 | - return false; |
|
119 | + return FALSE; |
|
120 | 120 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
121 | - return false; |
|
121 | + return FALSE; |
|
122 | 122 | } |
123 | 123 | break; |
124 | 124 | case 'ZDB': |
@@ -126,19 +126,19 @@ discard block |
||
126 | 126 | $checksum = 'X'; |
127 | 127 | } |
128 | 128 | if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) { |
129 | - return false; |
|
129 | + return FALSE; |
|
130 | 130 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
131 | - return false; |
|
131 | + return FALSE; |
|
132 | 132 | } |
133 | 133 | break; |
134 | 134 | case 'SWD': |
135 | 135 | $checksum = 11 - $checksum; |
136 | 136 | if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) { |
137 | - return false; |
|
137 | + return FALSE; |
|
138 | 138 | } elseif ($checksum == 10) { |
139 | 139 | return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
140 | 140 | } elseif (substr($id, -1, 1) != $checksum) { |
141 | - return false; |
|
141 | + return FALSE; |
|
142 | 142 | } |
143 | 143 | break; |
144 | 144 | case 'GKD': |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | $checksum = 'X'; |
148 | 148 | } |
149 | 149 | if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) { |
150 | - return false; |
|
150 | + return FALSE; |
|
151 | 151 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
152 | - return false; |
|
152 | + return FALSE; |
|
153 | 153 | } |
154 | 154 | break; |
155 | 155 | } |
156 | - return true; |
|
156 | + return TRUE; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -168,28 +168,28 @@ discard block |
||
168 | 168 | public static function decrypt($encrypted) |
169 | 169 | { |
170 | 170 | if ( |
171 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
172 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
171 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
172 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
173 | 173 | ) { |
174 | 174 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
175 | - return false; |
|
175 | + return FALSE; |
|
176 | 176 | } |
177 | 177 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
178 | 178 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
179 | - return false; |
|
179 | + return FALSE; |
|
180 | 180 | } |
181 | 181 | if ( |
182 | 182 | empty($encrypted) |
183 | 183 | || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm) |
184 | 184 | ) { |
185 | 185 | self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR); |
186 | - return false; |
|
186 | + return FALSE; |
|
187 | 187 | } |
188 | 188 | // Split initialisation vector and encrypted data. |
189 | 189 | $binary = base64_decode($encrypted); |
190 | 190 | $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
191 | 191 | $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
192 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
192 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
193 | 193 | // Decrypt data. |
194 | 194 | $decrypted = openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
195 | 195 | return $decrypted; |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public static function digest($string) |
242 | 242 | { |
243 | - if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
|
243 | + if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) { |
|
244 | 244 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
245 | - return false; |
|
245 | + return FALSE; |
|
246 | 246 | } |
247 | 247 | // Hash string. |
248 | 248 | $hashed = openssl_digest($string, self::$hashAlgorithm); |
@@ -261,23 +261,23 @@ discard block |
||
261 | 261 | public static function encrypt($string) |
262 | 262 | { |
263 | 263 | if ( |
264 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
265 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
264 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
265 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
266 | 266 | ) { |
267 | 267 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
268 | - return false; |
|
268 | + return FALSE; |
|
269 | 269 | } |
270 | 270 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
271 | 271 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
272 | - return false; |
|
272 | + return FALSE; |
|
273 | 273 | } |
274 | 274 | // Generate random initialisation vector. |
275 | 275 | $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm)); |
276 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
276 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
277 | 277 | // Encrypt data. |
278 | 278 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
279 | 279 | // Merge initialisation vector and encrypted data. |
280 | - if ($encrypted !== false) { |
|
280 | + if ($encrypted !== FALSE) { |
|
281 | 281 | $encrypted = base64_encode($iv . $encrypted); |
282 | 282 | } |
283 | 283 | return $encrypted; |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $lang = $GLOBALS['TSFE']->getLLL($isoCode, $iso639); |
422 | 422 | } |
423 | 423 | } elseif (\TYPO3_MODE === 'BE') { |
424 | - $iso639 = $GLOBALS['LANG']->includeLLFile($file, false, true); |
|
424 | + $iso639 = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE); |
|
425 | 425 | if (!empty($iso639['default'][$isoCode])) { |
426 | 426 | $lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639); |
427 | 427 | } |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @return string The translated string or the given key on failure |
450 | 450 | */ |
451 | - public static function getMessage($key, $hsc = false, $default = '') |
|
451 | + public static function getMessage($key, $hsc = FALSE, $default = '') |
|
452 | 452 | { |
453 | 453 | // Set initial output to default value. |
454 | 454 | $translated = (string) $default; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | if (\TYPO3_MODE === 'FE') { |
459 | 459 | self::$messages = $GLOBALS['TSFE']->readLLfile($file); |
460 | 460 | } elseif (\TYPO3_MODE === 'BE') { |
461 | - self::$messages = $GLOBALS['LANG']->includeLLFile($file, false, true); |
|
461 | + self::$messages = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE); |
|
462 | 462 | } else { |
463 | 463 | self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
464 | 464 | } |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | * |
659 | 659 | * @return array Merged array |
660 | 660 | */ |
661 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
661 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE) |
|
662 | 662 | { |
663 | 663 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
664 | 664 | return $original; |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
678 | 678 | */ |
679 | - public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
679 | + public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = FALSE, $cmdFirst = FALSE) |
|
680 | 680 | { |
681 | 681 | if ( |
682 | 682 | \TYPO3_MODE === 'BE' |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | // Instantiate TYPO3 core engine. |
686 | 686 | $dataHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class); |
687 | 687 | // We do not use workspaces and have to bypass restrictions in DataHandler. |
688 | - $dataHandler->bypassWorkspaceRestrictions = true; |
|
688 | + $dataHandler->bypassWorkspaceRestrictions = TRUE; |
|
689 | 689 | // Load data and command arrays. |
690 | 690 | $dataHandler->start($data, $cmd); |
691 | 691 | // Process command map first if default order is reversed. |
@@ -749,19 +749,19 @@ discard block |
||
749 | 749 | $key = (string) $key; |
750 | 750 | if (!$key) { |
751 | 751 | self::log('Invalid key "' . $key . '" for session data saving', LOG_SEVERITY_WARNING); |
752 | - return false; |
|
752 | + return FALSE; |
|
753 | 753 | } |
754 | 754 | // Save value in session data. |
755 | 755 | if (\TYPO3_MODE === 'FE') { |
756 | 756 | $GLOBALS['TSFE']->fe_user->setKey('ses', $key, $value); |
757 | 757 | $GLOBALS['TSFE']->fe_user->storeSessionData(); |
758 | - return true; |
|
758 | + return TRUE; |
|
759 | 759 | } elseif (\TYPO3_MODE === 'BE') { |
760 | 760 | $GLOBALS['BE_USER']->setAndSaveSessionData($key, $value); |
761 | - return true; |
|
761 | + return TRUE; |
|
762 | 762 | } else { |
763 | 763 | self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
764 | - return false; |
|
764 | + return FALSE; |
|
765 | 765 | } |
766 | 766 | } |
767 | 767 | |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | ->where( |
808 | 808 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
809 | 809 | $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
810 | - self::whereExpression($table, true) |
|
810 | + self::whereExpression($table, TRUE) |
|
811 | 811 | ) |
812 | 812 | ->setMaxResults(1) |
813 | 813 | ->execute(); |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
826 | 826 | $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
827 | 827 | $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)), |
828 | - self::whereExpression($table, true) |
|
828 | + self::whereExpression($table, TRUE) |
|
829 | 829 | ) |
830 | 830 | ->setMaxResults(1) |
831 | 831 | ->execute(); |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | ->where( |
861 | 861 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
862 | 862 | $additionalWhere, |
863 | - self::whereExpression($table, true) |
|
863 | + self::whereExpression($table, TRUE) |
|
864 | 864 | ) |
865 | 865 | ->setMaxResults(10000) |
866 | 866 | ->execute(); |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | * |
901 | 901 | * @return string Additional WHERE expression |
902 | 902 | */ |
903 | - public static function whereExpression($table, $showHidden = false) |
|
903 | + public static function whereExpression($table, $showHidden = FALSE) |
|
904 | 904 | { |
905 | 905 | if (\TYPO3_MODE === 'FE') { |
906 | 906 | // Should we ignore the record's hidden flag? |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) { |
137 | 137 | return false; |
138 | 138 | } elseif ($checksum == 10) { |
139 | - return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
|
139 | + return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD'); |
|
140 | 140 | } elseif (substr($id, -1, 1) != $checksum) { |
141 | 141 | return false; |
142 | 142 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
279 | 279 | // Merge initialisation vector and encrypted data. |
280 | 280 | if ($encrypted !== false) { |
281 | - $encrypted = base64_encode($iv . $encrypted); |
|
281 | + $encrypted = base64_encode($iv.$encrypted); |
|
282 | 282 | } |
283 | 283 | return $encrypted; |
284 | 284 | } |
@@ -332,8 +332,8 @@ discard block |
||
332 | 332 | public static function getHookObjects($scriptRelPath) |
333 | 333 | { |
334 | 334 | $hookObjects = []; |
335 | - if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
|
336 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
|
335 | + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) { |
|
336 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) { |
|
337 | 337 | $hookObjects[] = GeneralUtility::makeInstance($classRef); |
338 | 338 | } |
339 | 339 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | !$uid |
360 | 360 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
361 | 361 | ) { |
362 | - self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
362 | + self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
363 | 363 | return ''; |
364 | 364 | } |
365 | 365 | |
@@ -370,15 +370,15 @@ discard block |
||
370 | 370 | // Should we check for a specific PID, too? |
371 | 371 | if ($pid !== -1) { |
372 | 372 | $pid = max(intval($pid), 0); |
373 | - $where = $queryBuilder->expr()->eq($table . '.pid', $pid); |
|
373 | + $where = $queryBuilder->expr()->eq($table.'.pid', $pid); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | // Get index_name from database. |
377 | 377 | $result = $queryBuilder |
378 | - ->select($table . '.index_name AS index_name') |
|
378 | + ->select($table.'.index_name AS index_name') |
|
379 | 379 | ->from($table) |
380 | 380 | ->where( |
381 | - $queryBuilder->expr()->eq($table . '.uid', $uid), |
|
381 | + $queryBuilder->expr()->eq($table.'.uid', $uid), |
|
382 | 382 | $where, |
383 | 383 | self::whereExpression($table) |
384 | 384 | ) |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | if ($resArray = $result->fetch()) { |
389 | 389 | return $resArray['index_name']; |
390 | 390 | } else { |
391 | - self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
391 | + self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
392 | 392 | return ''; |
393 | 393 | } |
394 | 394 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | !$uid |
413 | 413 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
414 | 414 | ) { |
415 | - self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
415 | + self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
416 | 416 | return ''; |
417 | 417 | } |
418 | 418 | |
@@ -423,15 +423,15 @@ discard block |
||
423 | 423 | // Should we check for a specific PID, too? |
424 | 424 | if ($pid !== -1) { |
425 | 425 | $pid = max(intval($pid), 0); |
426 | - $where = $queryBuilder->expr()->eq($table . '.pid', $pid); |
|
426 | + $where = $queryBuilder->expr()->eq($table.'.pid', $pid); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | // Get label from database. |
430 | 430 | $result = $queryBuilder |
431 | - ->select($table . '.label AS label') |
|
431 | + ->select($table.'.label AS label') |
|
432 | 432 | ->from($table) |
433 | 433 | ->where( |
434 | - $queryBuilder->expr()->eq($table . '.uid', $uid), |
|
434 | + $queryBuilder->expr()->eq($table.'.uid', $uid), |
|
435 | 435 | $where, |
436 | 436 | self::whereExpression($table) |
437 | 437 | ) |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | if ($resArray = $result->fetch()) { |
442 | 442 | return $resArray['label']; |
443 | 443 | } else { |
444 | - self::log('No "label" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
444 | + self::log('No "label" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
445 | 445 | return ''; |
446 | 446 | } |
447 | 447 | } |
@@ -460,9 +460,9 @@ discard block |
||
460 | 460 | // Analyze code and set appropriate ISO table. |
461 | 461 | $isoCode = strtolower(trim($code)); |
462 | 462 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
463 | - $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-2b.xml'; |
|
463 | + $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-2b.xml'; |
|
464 | 464 | } elseif (preg_match('/^[a-z]{2}$/', $isoCode)) { |
465 | - $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-1.xml'; |
|
465 | + $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-1.xml'; |
|
466 | 466 | } else { |
467 | 467 | // No ISO code, return unchanged. |
468 | 468 | return $code; |
@@ -479,13 +479,13 @@ discard block |
||
479 | 479 | $lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639); |
480 | 480 | } |
481 | 481 | } else { |
482 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
482 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
483 | 483 | return $code; |
484 | 484 | } |
485 | 485 | if (!empty($lang)) { |
486 | 486 | return $lang; |
487 | 487 | } else { |
488 | - self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
488 | + self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
489 | 489 | return $code; |
490 | 490 | } |
491 | 491 | } |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | } elseif (\TYPO3_MODE === 'BE') { |
514 | 514 | self::$messages = $GLOBALS['LANG']->includeLLFile($file, false, true); |
515 | 515 | } else { |
516 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
516 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
517 | 517 | } |
518 | 518 | } |
519 | 519 | // Get translation. |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | } elseif (\TYPO3_MODE === 'BE') { |
524 | 524 | $translated = $GLOBALS['LANG']->getLLL($key, self::$messages); |
525 | 525 | } else { |
526 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
526 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
527 | 527 | } |
528 | 528 | } |
529 | 529 | // Escape HTML characters if applicable. |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | !$index_name |
551 | 551 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
552 | 552 | ) { |
553 | - self::log('Invalid UID ' . $index_name . ' or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
553 | + self::log('Invalid UID '.$index_name.' or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
554 | 554 | return ''; |
555 | 555 | } |
556 | 556 | |
@@ -561,14 +561,14 @@ discard block |
||
561 | 561 | // Should we check for a specific PID, too? |
562 | 562 | if ($pid !== -1) { |
563 | 563 | $pid = max(intval($pid), 0); |
564 | - $where = $queryBuilder->expr()->eq($table . '.pid', $pid); |
|
564 | + $where = $queryBuilder->expr()->eq($table.'.pid', $pid); |
|
565 | 565 | } |
566 | 566 | // Get index_name from database. |
567 | 567 | $result = $queryBuilder |
568 | - ->select($table . '.uid AS uid') |
|
568 | + ->select($table.'.uid AS uid') |
|
569 | 569 | ->from($table) |
570 | 570 | ->where( |
571 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
|
571 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)), |
|
572 | 572 | $where, |
573 | 573 | self::whereExpression($table) |
574 | 574 | ) |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | if (count($allResults) == 1) { |
581 | 581 | return $allResults[0]['uid']; |
582 | 582 | } else { |
583 | - self::log('No UID for given index_name "' . $index_name . '" and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
583 | + self::log('No UID for given index_name "'.$index_name.'" and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
584 | 584 | return ''; |
585 | 585 | } |
586 | 586 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | '-' => 39, |
639 | 639 | ':' => 17, |
640 | 640 | ]; |
641 | - $urn = strtolower($base . $id); |
|
641 | + $urn = strtolower($base.$id); |
|
642 | 642 | if (preg_match('/[^a-z0-9:-]/', $urn)) { |
643 | 643 | self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING); |
644 | 644 | return ''; |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | $checksum += ($i + 1) * intval(substr($digits, $i, 1)); |
653 | 653 | } |
654 | 654 | $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1); |
655 | - return $base . $id . $checksum; |
|
655 | + return $base.$id.$checksum; |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | /** |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | // Cast to string for security reasons. |
684 | 684 | $key = (string) $key; |
685 | 685 | if (!$key) { |
686 | - self::log('Invalid key "' . $key . '" for session data retrieval', LOG_SEVERITY_WARNING); |
|
686 | + self::log('Invalid key "'.$key.'" for session data retrieval', LOG_SEVERITY_WARNING); |
|
687 | 687 | return; |
688 | 688 | } |
689 | 689 | // Get the session data. |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | } elseif (\TYPO3_MODE === 'BE') { |
693 | 693 | return $GLOBALS['BE_USER']->getSessionData($key); |
694 | 694 | } else { |
695 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
695 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
696 | 696 | return; |
697 | 697 | } |
698 | 698 | } |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | // Cast to string for security reasons. |
802 | 802 | $key = (string) $key; |
803 | 803 | if (!$key) { |
804 | - self::log('Invalid key "' . $key . '" for session data saving', LOG_SEVERITY_WARNING); |
|
804 | + self::log('Invalid key "'.$key.'" for session data saving', LOG_SEVERITY_WARNING); |
|
805 | 805 | return false; |
806 | 806 | } |
807 | 807 | // Save value in session data. |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | $GLOBALS['BE_USER']->setAndSaveSessionData($key, $value); |
814 | 814 | return true; |
815 | 815 | } else { |
816 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
816 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
817 | 817 | return false; |
818 | 818 | } |
819 | 819 | } |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | // Sanitize input. |
837 | 837 | $pid = max(intval($pid), 0); |
838 | 838 | if (!$pid) { |
839 | - self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING); |
|
839 | + self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING); |
|
840 | 840 | return $index_name; |
841 | 841 | } |
842 | 842 | // Check if "index_name" is an UID. |
@@ -853,13 +853,13 @@ discard block |
||
853 | 853 | // First fetch the uid of the received index_name |
854 | 854 | $result = $queryBuilder |
855 | 855 | ->select( |
856 | - $table . '.uid AS uid', |
|
857 | - $table . '.l18n_parent AS l18n_parent' |
|
856 | + $table.'.uid AS uid', |
|
857 | + $table.'.l18n_parent AS l18n_parent' |
|
858 | 858 | ) |
859 | 859 | ->from($table) |
860 | 860 | ->where( |
861 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
862 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
|
861 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
862 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)), |
|
863 | 863 | self::whereExpression($table, true) |
864 | 864 | ) |
865 | 865 | ->setMaxResults(1) |
@@ -872,12 +872,12 @@ discard block |
||
872 | 872 | $resArray = $allResults[0]; |
873 | 873 | |
874 | 874 | $result = $queryBuilder |
875 | - ->select($table . '.index_name AS index_name') |
|
875 | + ->select($table.'.index_name AS index_name') |
|
876 | 876 | ->from($table) |
877 | 877 | ->where( |
878 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
879 | - $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
|
880 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)), |
|
878 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
879 | + $queryBuilder->expr()->eq($table.'.uid', $resArray['l18n_parent']), |
|
880 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)), |
|
881 | 881 | self::whereExpression($table, true) |
882 | 882 | ) |
883 | 883 | ->setMaxResults(1) |
@@ -895,14 +895,14 @@ discard block |
||
895 | 895 | if (empty($labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$index_name])) { |
896 | 896 | // Check if this table is allowed for translation. |
897 | 897 | if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) { |
898 | - $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]); |
|
898 | + $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]); |
|
899 | 899 | if ($GLOBALS['TSFE']->sys_language_content > 0) { |
900 | 900 | $additionalWhere = $queryBuilder->expr()->andX( |
901 | 901 | $queryBuilder->expr()->orX( |
902 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
903 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)) |
|
902 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
903 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)) |
|
904 | 904 | ), |
905 | - $queryBuilder->expr()->eq($table . '.l18n_parent', 0) |
|
905 | + $queryBuilder->expr()->eq($table.'.l18n_parent', 0) |
|
906 | 906 | ); |
907 | 907 | } |
908 | 908 | |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | ->select('*') |
912 | 912 | ->from($table) |
913 | 913 | ->where( |
914 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
914 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
915 | 915 | $additionalWhere, |
916 | 916 | self::whereExpression($table, true) |
917 | 917 | ) |
@@ -929,10 +929,10 @@ discard block |
||
929 | 929 | } |
930 | 930 | } |
931 | 931 | } else { |
932 | - self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
932 | + self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
933 | 933 | } |
934 | 934 | } else { |
935 | - self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
935 | + self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
936 | 936 | } |
937 | 937 | } |
938 | 938 | |
@@ -971,9 +971,9 @@ discard block |
||
971 | 971 | return GeneralUtility::makeInstance(ConnectionPool::class) |
972 | 972 | ->getQueryBuilderForTable($table) |
973 | 973 | ->expr() |
974 | - ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
974 | + ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
975 | 975 | } else { |
976 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
976 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
977 | 977 | return '1=-1'; |
978 | 978 | } |
979 | 979 | } |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @subpackage dlf |
26 | 26 | * @access public |
27 | 27 | */ |
28 | -class Helper |
|
29 | -{ |
|
28 | +class Helper { |
|
30 | 29 | /** |
31 | 30 | * The extension key |
32 | 31 | * |
@@ -74,8 +73,7 @@ discard block |
||
74 | 73 | * |
75 | 74 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
76 | 75 | */ |
77 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
78 | - { |
|
76 | + public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') { |
|
79 | 77 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
80 | 78 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
81 | 79 | $flashMessage = GeneralUtility::makeInstance( |
@@ -100,8 +98,7 @@ discard block |
||
100 | 98 | * |
101 | 99 | * @return bool Is $id a valid GNL identifier of the given $type? |
102 | 100 | */ |
103 | - public static function checkIdentifier($id, $type) |
|
104 | - { |
|
101 | + public static function checkIdentifier($id, $type) { |
|
105 | 102 | $digits = substr($id, 0, 8); |
106 | 103 | $checksum = 0; |
107 | 104 | for ($i = 0, $j = strlen($digits); $i < $j; $i++) { |
@@ -165,8 +162,7 @@ discard block |
||
165 | 162 | * |
166 | 163 | * @return mixed The decrypted value or false on error |
167 | 164 | */ |
168 | - public static function decrypt($encrypted) |
|
169 | - { |
|
165 | + public static function decrypt($encrypted) { |
|
170 | 166 | if ( |
171 | 167 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
172 | 168 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -207,8 +203,7 @@ discard block |
||
207 | 203 | * @return void |
208 | 204 | */ |
209 | 205 | //TODO: find better way to handle logger in static class |
210 | - public static function log($message, $severity = 0) |
|
211 | - { |
|
206 | + public static function log($message, $severity = 0) { |
|
212 | 207 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); |
213 | 208 | |
214 | 209 | switch ($severity) { |
@@ -238,8 +233,7 @@ discard block |
||
238 | 233 | * |
239 | 234 | * @return mixed Hashed string or false on error |
240 | 235 | */ |
241 | - public static function digest($string) |
|
242 | - { |
|
236 | + public static function digest($string) { |
|
243 | 237 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
244 | 238 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
245 | 239 | return false; |
@@ -258,8 +252,7 @@ discard block |
||
258 | 252 | * |
259 | 253 | * @return mixed Encrypted string or false on error |
260 | 254 | */ |
261 | - public static function encrypt($string) |
|
262 | - { |
|
255 | + public static function encrypt($string) { |
|
263 | 256 | if ( |
264 | 257 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
265 | 258 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -292,8 +285,7 @@ discard block |
||
292 | 285 | * |
293 | 286 | * @return string The unqualified class name |
294 | 287 | */ |
295 | - public static function getUnqualifiedClassName($qualifiedClassname) |
|
296 | - { |
|
288 | + public static function getUnqualifiedClassName($qualifiedClassname) { |
|
297 | 289 | $nameParts = explode('\\', $qualifiedClassname); |
298 | 290 | return end($nameParts); |
299 | 291 | } |
@@ -307,8 +299,7 @@ discard block |
||
307 | 299 | * |
308 | 300 | * @return string The cleaned up string |
309 | 301 | */ |
310 | - public static function getCleanString($string) |
|
311 | - { |
|
302 | + public static function getCleanString($string) { |
|
312 | 303 | // Convert to lowercase. |
313 | 304 | $string = strtolower($string); |
314 | 305 | // Remove non-alphanumeric characters. |
@@ -329,8 +320,7 @@ discard block |
||
329 | 320 | * |
330 | 321 | * @return array Array of hook objects for the class |
331 | 322 | */ |
332 | - public static function getHookObjects($scriptRelPath) |
|
333 | - { |
|
323 | + public static function getHookObjects($scriptRelPath) { |
|
334 | 324 | $hookObjects = []; |
335 | 325 | if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
336 | 326 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
@@ -351,8 +341,7 @@ discard block |
||
351 | 341 | * |
352 | 342 | * @return string "index_name" for the given UID |
353 | 343 | */ |
354 | - public static function getIndexNameFromUid($uid, $table, $pid = -1) |
|
355 | - { |
|
344 | + public static function getIndexNameFromUid($uid, $table, $pid = -1) { |
|
356 | 345 | // Sanitize input. |
357 | 346 | $uid = max(intval($uid), 0); |
358 | 347 | if ( |
@@ -404,8 +393,7 @@ discard block |
||
404 | 393 | * |
405 | 394 | * @return string "label" for the given UID |
406 | 395 | */ |
407 | - public static function getLabelFromUid($uid, $table, $pid = -1) |
|
408 | - { |
|
396 | + public static function getLabelFromUid($uid, $table, $pid = -1) { |
|
409 | 397 | // Sanitize input. |
410 | 398 | $uid = max(intval($uid), 0); |
411 | 399 | if ( |
@@ -455,8 +443,7 @@ discard block |
||
455 | 443 | * |
456 | 444 | * @return string Localized full name of language or unchanged input |
457 | 445 | */ |
458 | - public static function getLanguageName($code) |
|
459 | - { |
|
446 | + public static function getLanguageName($code) { |
|
460 | 447 | // Analyze code and set appropriate ISO table. |
461 | 448 | $isoCode = strtolower(trim($code)); |
462 | 449 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
@@ -501,8 +488,7 @@ discard block |
||
501 | 488 | * |
502 | 489 | * @return string The translated string or the given key on failure |
503 | 490 | */ |
504 | - public static function getMessage($key, $hsc = false, $default = '') |
|
505 | - { |
|
491 | + public static function getMessage($key, $hsc = false, $default = '') { |
|
506 | 492 | // Set initial output to default value. |
507 | 493 | $translated = (string) $default; |
508 | 494 | // Load common messages file. |
@@ -544,8 +530,7 @@ discard block |
||
544 | 530 | * |
545 | 531 | * @return string "uid" for the given index_name |
546 | 532 | */ |
547 | - public static function getUidFromIndexName($index_name, $table, $pid = -1) |
|
548 | - { |
|
533 | + public static function getUidFromIndexName($index_name, $table, $pid = -1) { |
|
549 | 534 | if ( |
550 | 535 | !$index_name |
551 | 536 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
@@ -596,8 +581,7 @@ discard block |
||
596 | 581 | * |
597 | 582 | * @return string Uniform Resource Name as string |
598 | 583 | */ |
599 | - public static function getURN($base, $id) |
|
600 | - { |
|
584 | + public static function getURN($base, $id) { |
|
601 | 585 | $concordance = [ |
602 | 586 | '0' => 1, |
603 | 587 | '1' => 2, |
@@ -664,8 +648,7 @@ discard block |
||
664 | 648 | * |
665 | 649 | * @return bool Is $id a valid PPN? |
666 | 650 | */ |
667 | - public static function isPPN($id) |
|
668 | - { |
|
651 | + public static function isPPN($id) { |
|
669 | 652 | return self::checkIdentifier($id, 'PPN'); |
670 | 653 | } |
671 | 654 | |
@@ -678,8 +661,7 @@ discard block |
||
678 | 661 | * |
679 | 662 | * @return mixed Session value for given key or null on failure |
680 | 663 | */ |
681 | - public static function loadFromSession($key) |
|
682 | - { |
|
664 | + public static function loadFromSession($key) { |
|
683 | 665 | // Cast to string for security reasons. |
684 | 666 | $key = (string) $key; |
685 | 667 | if (!$key) { |
@@ -711,8 +693,7 @@ discard block |
||
711 | 693 | * |
712 | 694 | * @return array Merged array |
713 | 695 | */ |
714 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
715 | - { |
|
696 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) { |
|
716 | 697 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
717 | 698 | return $original; |
718 | 699 | } |
@@ -729,8 +710,7 @@ discard block |
||
729 | 710 | * |
730 | 711 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
731 | 712 | */ |
732 | - public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
733 | - { |
|
713 | + public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) { |
|
734 | 714 | if ( |
735 | 715 | \TYPO3_MODE === 'BE' |
736 | 716 | && $GLOBALS['BE_USER']->isAdmin() |
@@ -776,8 +756,7 @@ discard block |
||
776 | 756 | * |
777 | 757 | * @return string All flash messages in the queue rendered as HTML. |
778 | 758 | */ |
779 | - public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') |
|
780 | - { |
|
759 | + public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') { |
|
781 | 760 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
782 | 761 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
783 | 762 | $flashMessages = $flashMessageQueue->getAllMessagesAndFlush(); |
@@ -796,8 +775,7 @@ discard block |
||
796 | 775 | * |
797 | 776 | * @return bool true on success, false on failure |
798 | 777 | */ |
799 | - public static function saveToSession($value, $key) |
|
800 | - { |
|
778 | + public static function saveToSession($value, $key) { |
|
801 | 779 | // Cast to string for security reasons. |
802 | 780 | $key = (string) $key; |
803 | 781 | if (!$key) { |
@@ -829,8 +807,7 @@ discard block |
||
829 | 807 | * |
830 | 808 | * @return string Localized label for $index_name |
831 | 809 | */ |
832 | - public static function translate($index_name, $table, $pid) |
|
833 | - { |
|
810 | + public static function translate($index_name, $table, $pid) { |
|
834 | 811 | // Load labels into static variable for future use. |
835 | 812 | static $labels = []; |
836 | 813 | // Sanitize input. |
@@ -953,8 +930,7 @@ discard block |
||
953 | 930 | * |
954 | 931 | * @return string Additional WHERE expression |
955 | 932 | */ |
956 | - public static function whereExpression($table, $showHidden = false) |
|
957 | - { |
|
933 | + public static function whereExpression($table, $showHidden = false) { |
|
958 | 934 | if (\TYPO3_MODE === 'FE') { |
959 | 935 | // Should we ignore the record's hidden flag? |
960 | 936 | $ignoreHide = 0; |
@@ -983,8 +959,7 @@ discard block |
||
983 | 959 | * |
984 | 960 | * @access private |
985 | 961 | */ |
986 | - private function __construct() |
|
987 | - { |
|
962 | + private function __construct() { |
|
988 | 963 | // This is a static class, thus no instances should be created. |
989 | 964 | } |
990 | 965 | } |
@@ -694,16 +694,16 @@ discard block |
||
694 | 694 | && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != null) |
695 | 695 | ) { |
696 | 696 | if (is_string($values)) { |
697 | - $metadata[$resArray['index_name'] . '_sorting'][0] = [trim((string) $values)]; |
|
697 | + $metadata[$resArray['index_name'].'_sorting'][0] = [trim((string) $values)]; |
|
698 | 698 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) { |
699 | 699 | $metadata[$resArray['index_name']] = []; |
700 | 700 | foreach ($values->data() as $value) { |
701 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $value); |
|
701 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $value); |
|
702 | 702 | } |
703 | 703 | } |
704 | 704 | } |
705 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
706 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
705 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
706 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
707 | 707 | } |
708 | 708 | } |
709 | 709 | } |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | } |
832 | 832 | } |
833 | 833 | } else { |
834 | - $this->logger->warning('Invalid structure resource @id "' . $id . '"'); |
|
834 | + $this->logger->warning('Invalid structure resource @id "'.$id.'"'); |
|
835 | 835 | return $rawText; |
836 | 836 | } |
837 | 837 | $this->rawTextArray[$id] = $rawText; |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } |
881 | 881 | } |
882 | 882 | } |
883 | - $this->logger->error('Could not load IIIF manifest from "' . $location . '"'); |
|
883 | + $this->logger->error('Could not load IIIF manifest from "'.$location.'"'); |
|
884 | 884 | return false; |
885 | 885 | } |
886 | 886 |
@@ -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 | $this->logger->error('Could not load IIIF manifest from "' . $location . '"'); |
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(); |
@@ -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, $owner) |
|
783 | - { |
|
766 | + protected function getParentDocumentUidForSaving($pid, $core, $owner) { |
|
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); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | // Load document with current plugin parameters. |
76 | 76 | $doc = $this->loadDocument($queryParams[$this->prefixId]); |
77 | - if ($doc === null) { |
|
77 | + if ($doc === NULL) { |
|
78 | 78 | return $type; |
79 | 79 | } |
80 | 80 | // Set PID for metadata definitions. |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | // Calendar plugin does not support IIIF (yet). Abort for all newspaper related types. |
86 | 86 | if ( |
87 | 87 | $doc instanceof IiifManifest |
88 | - && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== false |
|
88 | + && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== FALSE |
|
89 | 89 | ) { |
90 | 90 | return $type; |
91 | 91 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if ($doc->ready) { |
117 | 117 | return $doc; |
118 | 118 | } else { |
119 | - $this->logger->warning('Failed to load document with UID ' . $piVars['id']); |
|
119 | + $this->logger->warning('Failed to load document with UID '.$piVars['id']); |
|
120 | 120 | } |
121 | 121 | } elseif (!empty($piVars['recordId'])) { |
122 | 122 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | // Try to load document. |
138 | 138 | return $this->loadDocument(['id' => $resArray['uid']]); |
139 | 139 | } else { |
140 | - $this->logger->warning('Failed to load document with record ID "' . $piVars['recordId'] . '"'); |
|
140 | + $this->logger->warning('Failed to load document with record ID "'.$piVars['recordId'].'"'); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | } |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * @return ExpressionFunction[] An array of Function instances |
48 | 48 | */ |
49 | - public function getFunctions() |
|
50 | - { |
|
49 | + public function getFunctions() { |
|
51 | 50 | return [ |
52 | 51 | $this->getDocumentTypeFunction(), |
53 | 52 | ]; |
@@ -62,12 +61,10 @@ discard block |
||
62 | 61 | { |
63 | 62 | return new ExpressionFunction( |
64 | 63 | 'getDocumentType', |
65 | - function() |
|
66 | - { |
|
64 | + function() { |
|
67 | 65 | // Not implemented, we only use the evaluator |
68 | 66 | }, |
69 | - function($arguments, $cPid) |
|
70 | - { |
|
67 | + function($arguments, $cPid) { |
|
71 | 68 | /** @var RequestWrapper $requestWrapper */ |
72 | 69 | $requestWrapper = $arguments['request']; |
73 | 70 | $queryParams = $requestWrapper->getQueryParams(); |
@@ -107,8 +104,7 @@ discard block |
||
107 | 104 | * |
108 | 105 | * @return \Kitodo\Dlf\Common\Document Instance of the current document |
109 | 106 | */ |
110 | - protected function loadDocument(array $piVars) |
|
111 | - { |
|
107 | + protected function loadDocument(array $piVars) { |
|
112 | 108 | // Check for required variable. |
113 | 109 | if (!empty($piVars['id'])) { |
114 | 110 | // Get instance of document. |
@@ -56,9 +56,9 @@ |
||
56 | 56 | public function displayThumbnail(&$params) |
57 | 57 | { |
58 | 58 | // Simulate TCA field type "passthrough". |
59 | - $output = '<input type="hidden" name="' . $params['itemFormElName'] . '" value="' . $params['itemFormElValue'] . '" />'; |
|
59 | + $output = '<input type="hidden" name="'.$params['itemFormElName'].'" value="'.$params['itemFormElValue'].'" />'; |
|
60 | 60 | if (!empty($params['itemFormElValue'])) { |
61 | - $output .= '<img alt="Thumbnail" title="' . $params['itemFormElValue'] . '" src="' . $params['itemFormElValue'] . '" />'; |
|
61 | + $output .= '<img alt="Thumbnail" title="'.$params['itemFormElValue'].'" src="'.$params['itemFormElValue'].'" />'; |
|
62 | 62 | } |
63 | 63 | return $output; |
64 | 64 | } |
@@ -30,8 +30,7 @@ discard block |
||
30 | 30 | * @subpackage dlf |
31 | 31 | * @access public |
32 | 32 | */ |
33 | -class UserFunc implements LoggerAwareInterface |
|
34 | -{ |
|
33 | +class UserFunc implements LoggerAwareInterface { |
|
35 | 34 | use LoggerAwareTrait; |
36 | 35 | |
37 | 36 | /** |
@@ -53,8 +52,7 @@ discard block |
||
53 | 52 | * |
54 | 53 | * @return string HTML <img> tag for thumbnail |
55 | 54 | */ |
56 | - public function displayThumbnail(&$params) |
|
57 | - { |
|
55 | + public function displayThumbnail(&$params) { |
|
58 | 56 | // Simulate TCA field type "passthrough". |
59 | 57 | $output = '<input type="hidden" name="' . $params['itemFormElName'] . '" value="' . $params['itemFormElValue'] . '" />'; |
60 | 58 | if (!empty($params['itemFormElValue'])) { |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | * @subpackage dlf |
29 | 29 | * @access public |
30 | 30 | */ |
31 | -class ConfigurationForm |
|
32 | -{ |
|
31 | +class ConfigurationForm { |
|
33 | 32 | /** |
34 | 33 | * This holds the current configuration |
35 | 34 | * |
@@ -45,8 +44,7 @@ discard block |
||
45 | 44 | * |
46 | 45 | * @return string Message informing the user of success or failure |
47 | 46 | */ |
48 | - public function checkSolrConnection() |
|
49 | - { |
|
47 | + public function checkSolrConnection() { |
|
50 | 48 | $solr = Solr::getInstance(); |
51 | 49 | if ($solr->ready) { |
52 | 50 | Helper::addMessage( |
@@ -71,8 +69,7 @@ discard block |
||
71 | 69 | * |
72 | 70 | * @return string Message informing the user of success or failure |
73 | 71 | */ |
74 | - public function checkMetadataFormats() |
|
75 | - { |
|
72 | + public function checkMetadataFormats() { |
|
76 | 73 | // We need to do some bootstrapping manually as of TYPO3 9. |
77 | 74 | // Load table configuration array into $GLOBALS['TCA']. |
78 | 75 | ExtensionManagementUtility::loadBaseTca(false); |
@@ -201,8 +198,7 @@ discard block |
||
201 | 198 | * |
202 | 199 | * @return void |
203 | 200 | */ |
204 | - public function __construct() |
|
205 | - { |
|
201 | + public function __construct() { |
|
206 | 202 | // Load localization file. |
207 | 203 | $GLOBALS['LANG']->includeLLFile('EXT:dlf/Resources/Private/Language/FlashMessages.xml'); |
208 | 204 | // Get current configuration. |
@@ -75,21 +75,21 @@ discard block |
||
75 | 75 | { |
76 | 76 | // We need to do some bootstrapping manually as of TYPO3 9. |
77 | 77 | // Load table configuration array into $GLOBALS['TCA']. |
78 | - ExtensionManagementUtility::loadBaseTca(false); |
|
78 | + ExtensionManagementUtility::loadBaseTca(FALSE); |
|
79 | 79 | // Get extension configuration from dlf/ext_localconf.php. |
80 | - ExtensionManagementUtility::loadExtLocalconf(false); |
|
80 | + ExtensionManagementUtility::loadExtLocalconf(FALSE); |
|
81 | 81 | // Initialize backend user into $GLOBALS['BE_USER']. |
82 | 82 | Bootstrap::initializeBackendUser(); |
83 | 83 | // Initialize backend and ensure authenticated access. |
84 | 84 | Bootstrap::initializeBackendAuthentication(); |
85 | 85 | |
86 | 86 | $nsDefined = [ |
87 | - 'MODS' => false, |
|
88 | - 'TEIHDR' => false, |
|
89 | - 'ALTO' => false, |
|
90 | - 'IIIF1' => false, |
|
91 | - 'IIIF2' => false, |
|
92 | - 'IIIF3' => false |
|
87 | + 'MODS' => FALSE, |
|
88 | + 'TEIHDR' => FALSE, |
|
89 | + 'ALTO' => FALSE, |
|
90 | + 'IIIF1' => FALSE, |
|
91 | + 'IIIF2' => FALSE, |
|
92 | + 'IIIF3' => FALSE |
|
93 | 93 | ]; |
94 | 94 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
95 | 95 | ->getQueryBuilderForTable('tx_dlf_formats'); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ->execute(); |
105 | 105 | |
106 | 106 | while ($resArray = $result->fetch()) { |
107 | - $nsDefined[$resArray['type']] = true; |
|
107 | + $nsDefined[$resArray['type']] = TRUE; |
|
108 | 108 | } |
109 | 109 | // Build data array. |
110 | 110 | $data = []; |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | * @access public |
30 | 30 | * @abstract |
31 | 31 | */ |
32 | -abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin implements LoggerAwareInterface |
|
33 | -{ |
|
32 | +abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin implements LoggerAwareInterface { |
|
34 | 33 | use LoggerAwareTrait; |
35 | 34 | |
36 | 35 | public $extKey = 'dlf'; |
@@ -73,8 +72,7 @@ discard block |
||
73 | 72 | * |
74 | 73 | * @return void |
75 | 74 | */ |
76 | - protected function getTemplate($part = '###TEMPLATE###') |
|
77 | - { |
|
75 | + protected function getTemplate($part = '###TEMPLATE###') { |
|
78 | 76 | $this->templateService = GeneralUtility::makeInstance(MarkerBasedTemplateService::class); |
79 | 77 | if (!empty($this->conf['templateFile'])) { |
80 | 78 | // Load template file from configuration. |
@@ -98,8 +96,7 @@ discard block |
||
98 | 96 | * |
99 | 97 | * @return void |
100 | 98 | */ |
101 | - protected function init(array $conf) |
|
102 | - { |
|
99 | + protected function init(array $conf) { |
|
103 | 100 | // Read FlexForm configuration. |
104 | 101 | $flexFormConf = []; |
105 | 102 | $this->cObj->readFlexformIntoConf($this->cObj->data['pi_flexform'], $flexFormConf); |
@@ -137,8 +134,7 @@ discard block |
||
137 | 134 | * |
138 | 135 | * @return void |
139 | 136 | */ |
140 | - protected function loadDocument() |
|
141 | - { |
|
137 | + protected function loadDocument() { |
|
142 | 138 | // Check for required variable. |
143 | 139 | if ( |
144 | 140 | !empty($this->piVars['id']) |
@@ -209,8 +205,7 @@ discard block |
||
209 | 205 | * |
210 | 206 | * @return array The resulting typoscript array |
211 | 207 | */ |
212 | - protected function parseTS($string = '') |
|
213 | - { |
|
208 | + protected function parseTS($string = '') { |
|
214 | 209 | $parser = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::class); |
215 | 210 | $parser->parse($string); |
216 | 211 | return $parser->setup; |
@@ -229,8 +224,7 @@ discard block |
||
229 | 224 | * |
230 | 225 | * @return string The input string wrapped in <a> tags |
231 | 226 | */ |
232 | - public function pi_linkTP($str, $urlParameters = [], $cache = false, $altPageId = 0) |
|
233 | - { |
|
227 | + public function pi_linkTP($str, $urlParameters = [], $cache = false, $altPageId = 0) { |
|
234 | 228 | $conf = []; |
235 | 229 | if (!$cache) { |
236 | 230 | $conf['no_cache'] = true; |
@@ -253,8 +247,7 @@ discard block |
||
253 | 247 | * |
254 | 248 | * @return string HTML content wrapped, ready to return to the parent object. |
255 | 249 | */ |
256 | - public function pi_wrapInBaseClass($content) |
|
257 | - { |
|
250 | + public function pi_wrapInBaseClass($content) { |
|
258 | 251 | if (!$this->frontendController->config['config']['disableWrapInBaseClass']) { |
259 | 252 | // Use class name instead of $this->prefixId for content wrapping because $this->prefixId is the same for all plugins. |
260 | 253 | $content = '<div class="tx-dlf-' . strtolower(Helper::getUnqualifiedClassName(get_class($this))) . '">' . $content . '</div>'; |
@@ -274,8 +267,7 @@ discard block |
||
274 | 267 | * |
275 | 268 | * @return void |
276 | 269 | */ |
277 | - protected function setCache($cache = true) |
|
278 | - { |
|
270 | + protected function setCache($cache = true) { |
|
279 | 271 | if ($cache) { |
280 | 272 | // Set cObject type to "USER" (default). |
281 | 273 | $this->pi_USER_INT_obj = false; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $templateFile = $this->conf['templateFile']; |
82 | 82 | } else { |
83 | 83 | // Load default template from extension. |
84 | - $templateFile = 'EXT:' . $this->extKey . '/Resources/Private/Templates/' . Helper::getUnqualifiedClassName(get_class($this)) . '.tmpl'; |
|
84 | + $templateFile = 'EXT:'.$this->extKey.'/Resources/Private/Templates/'.Helper::getUnqualifiedClassName(get_class($this)).'.tmpl'; |
|
85 | 85 | } |
86 | 86 | // Substitute strings like "EXT:" in given template file location. |
87 | 87 | $fileResource = $GLOBALS['TSFE']->tmpl->getFileName($templateFile); |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | $conf = Helper::mergeRecursiveWithOverrule($flexFormConf, $conf); |
108 | 108 | } |
109 | 109 | // Read plugin TS configuration. |
110 | - $pluginConf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_dlf_' . strtolower(Helper::getUnqualifiedClassName(get_class($this))) . '.']; |
|
110 | + $pluginConf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_dlf_'.strtolower(Helper::getUnqualifiedClassName(get_class($this))).'.']; |
|
111 | 111 | if (is_array($pluginConf)) { |
112 | 112 | $conf = Helper::mergeRecursiveWithOverrule($pluginConf, $conf); |
113 | 113 | } |
114 | 114 | // Read general TS configuration. |
115 | - $generalConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId . '.']; |
|
115 | + $generalConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.']; |
|
116 | 116 | if (is_array($generalConf)) { |
117 | 117 | $conf = Helper::mergeRecursiveWithOverrule($generalConf, $conf); |
118 | 118 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | // Set default plugin variables. |
128 | 128 | $this->pi_setPiVarDefaults(); |
129 | 129 | // Load translation files. |
130 | - $this->pi_loadLL('EXT:' . $this->extKey . '/Resources/Private/Language/' . Helper::getUnqualifiedClassName(get_class($this)) . '.xml'); |
|
130 | + $this->pi_loadLL('EXT:'.$this->extKey.'/Resources/Private/Language/'.Helper::getUnqualifiedClassName(get_class($this)).'.xml'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | if (!$this->doc->ready) { |
152 | 152 | // Destroy the incomplete object. |
153 | 153 | $this->doc = null; |
154 | - $this->logger->error('Failed to load document with UID ' . $this->piVars['id']); |
|
154 | + $this->logger->error('Failed to load document with UID '.$this->piVars['id']); |
|
155 | 155 | } else { |
156 | 156 | // Set configuration PID. |
157 | 157 | $this->doc->cPid = $this->conf['pages']; |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | // Try to load document. |
180 | 180 | $this->loadDocument(); |
181 | 181 | } else { |
182 | - $this->logger->error('Failed to load document with record ID "' . $this->piVars['recordId'] . '"'); |
|
182 | + $this->logger->error('Failed to load document with record ID "'.$this->piVars['recordId'].'"'); |
|
183 | 183 | } |
184 | 184 | } else { |
185 | - $this->logger->error('Invalid UID ' . $this->piVars['id'] . ' or PID ' . $this->conf['pages'] . ' for document loading'); |
|
185 | + $this->logger->error('Invalid UID '.$this->piVars['id'].' or PID '.$this->conf['pages'].' for document loading'); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $conf['no_cache'] = true; |
237 | 237 | } |
238 | 238 | $conf['parameter'] = $altPageId ? : ($this->pi_tmpPageId ? : 'current'); |
239 | - $conf['additionalParams'] = $this->conf['parent.']['addParams'] . HttpUtility::buildQueryString($urlParameters, '&', true) . $this->pi_moreParams; |
|
239 | + $conf['additionalParams'] = $this->conf['parent.']['addParams'].HttpUtility::buildQueryString($urlParameters, '&', true).$this->pi_moreParams; |
|
240 | 240 | // Add additional configuration for absolute URLs. |
241 | 241 | $conf['forceAbsoluteUrl'] = !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0; |
242 | 242 | $conf['forceAbsoluteUrl.']['scheme'] = !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'; |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | { |
258 | 258 | if (!$this->frontendController->config['config']['disableWrapInBaseClass']) { |
259 | 259 | // Use class name instead of $this->prefixId for content wrapping because $this->prefixId is the same for all plugins. |
260 | - $content = '<div class="tx-dlf-' . strtolower(Helper::getUnqualifiedClassName(get_class($this))) . '">' . $content . '</div>'; |
|
260 | + $content = '<div class="tx-dlf-'.strtolower(Helper::getUnqualifiedClassName(get_class($this))).'">'.$content.'</div>'; |
|
261 | 261 | if (!$this->frontendController->config['config']['disablePrefixComment']) { |
262 | - $content = "\n\n<!-- BEGIN: Content of extension '" . $this->extKey . "', plugin '" . Helper::getUnqualifiedClassName(get_class($this)) . "' -->\n\n" . $content . "\n\n<!-- END: Content of extension '" . $this->extKey . "', plugin '" . Helper::getUnqualifiedClassName(get_class($this)) . "' -->\n\n"; |
|
262 | + $content = "\n\n<!-- BEGIN: Content of extension '".$this->extKey."', plugin '".Helper::getUnqualifiedClassName(get_class($this))."' -->\n\n".$content."\n\n<!-- END: Content of extension '".$this->extKey."', plugin '".Helper::getUnqualifiedClassName(get_class($this))."' -->\n\n"; |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | return $content; |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | public $prefixId = 'tx_dlf'; |
38 | 38 | public $scriptRelPath = 'Classes/Common/AbstractPlugin.php'; |
39 | 39 | // Plugins are cached by default (@see setCache()). |
40 | - public $pi_USER_INT_obj = false; |
|
41 | - public $pi_checkCHash = true; |
|
40 | + public $pi_USER_INT_obj = FALSE; |
|
41 | + public $pi_checkCHash = TRUE; |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * This holds the current document |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $this->doc = Document::getInstance($this->piVars['id'], $pid); |
151 | 151 | if (!$this->doc->ready) { |
152 | 152 | // Destroy the incomplete object. |
153 | - $this->doc = null; |
|
153 | + $this->doc = NULL; |
|
154 | 154 | $this->logger->error('Failed to load document with UID ' . $this->piVars['id']); |
155 | 155 | } else { |
156 | 156 | // Set configuration PID. |
@@ -229,14 +229,14 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return string The input string wrapped in <a> tags |
231 | 231 | */ |
232 | - public function pi_linkTP($str, $urlParameters = [], $cache = false, $altPageId = 0) |
|
232 | + public function pi_linkTP($str, $urlParameters = [], $cache = FALSE, $altPageId = 0) |
|
233 | 233 | { |
234 | 234 | $conf = []; |
235 | 235 | if (!$cache) { |
236 | - $conf['no_cache'] = true; |
|
236 | + $conf['no_cache'] = TRUE; |
|
237 | 237 | } |
238 | 238 | $conf['parameter'] = $altPageId ? : ($this->pi_tmpPageId ? : 'current'); |
239 | - $conf['additionalParams'] = $this->conf['parent.']['addParams'] . HttpUtility::buildQueryString($urlParameters, '&', true) . $this->pi_moreParams; |
|
239 | + $conf['additionalParams'] = $this->conf['parent.']['addParams'] . HttpUtility::buildQueryString($urlParameters, '&', TRUE) . $this->pi_moreParams; |
|
240 | 240 | // Add additional configuration for absolute URLs. |
241 | 241 | $conf['forceAbsoluteUrl'] = !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0; |
242 | 242 | $conf['forceAbsoluteUrl.']['scheme'] = !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'; |
@@ -274,20 +274,20 @@ discard block |
||
274 | 274 | * |
275 | 275 | * @return void |
276 | 276 | */ |
277 | - protected function setCache($cache = true) |
|
277 | + protected function setCache($cache = TRUE) |
|
278 | 278 | { |
279 | 279 | if ($cache) { |
280 | 280 | // Set cObject type to "USER" (default). |
281 | - $this->pi_USER_INT_obj = false; |
|
282 | - $this->pi_checkCHash = true; |
|
281 | + $this->pi_USER_INT_obj = FALSE; |
|
282 | + $this->pi_checkCHash = TRUE; |
|
283 | 283 | if (count($this->piVars)) { |
284 | 284 | // Check cHash or disable caching. |
285 | 285 | $GLOBALS['TSFE']->reqCHash(); |
286 | 286 | } |
287 | 287 | } else { |
288 | 288 | // Set cObject type to "USER_INT". |
289 | - $this->pi_USER_INT_obj = true; |
|
290 | - $this->pi_checkCHash = false; |
|
289 | + $this->pi_USER_INT_obj = TRUE; |
|
290 | + $this->pi_checkCHash = FALSE; |
|
291 | 291 | // Plugins are of type "USER" by default, so convert it to "USER_INT". |
292 | 292 | $this->cObj->convertToUserIntObject(); |
293 | 293 | } |