@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage dlf |
| 26 | 26 | * @access public |
| 27 | 27 | */ |
| 28 | -class Navigation extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 29 | -{ |
|
| 28 | +class Navigation extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 30 | 29 | public $scriptRelPath = 'Classes/Plugin/Navigation.php'; |
| 31 | 30 | |
| 32 | 31 | /** |
@@ -36,8 +35,7 @@ discard block |
||
| 36 | 35 | * |
| 37 | 36 | * @return string Link to the list view ready to output |
| 38 | 37 | */ |
| 39 | - protected function getLinkToListview() |
|
| 40 | - { |
|
| 38 | + protected function getLinkToListview() { |
|
| 41 | 39 | if (!empty($this->conf['targetPid'])) { |
| 42 | 40 | // Load the list. |
| 43 | 41 | $list = GeneralUtility::makeInstance(DocumentList::class); |
@@ -63,8 +61,7 @@ discard block |
||
| 63 | 61 | * |
| 64 | 62 | * @return string Page selector ready to output |
| 65 | 63 | */ |
| 66 | - protected function getPageSelector() |
|
| 67 | - { |
|
| 64 | + protected function getPageSelector() { |
|
| 68 | 65 | // Configure @action URL for form. |
| 69 | 66 | $linkConf = [ |
| 70 | 67 | 'parameter' => $GLOBALS['TSFE']->id, |
@@ -98,8 +95,7 @@ discard block |
||
| 98 | 95 | * |
| 99 | 96 | * @return string The content that is displayed on the website |
| 100 | 97 | */ |
| 101 | - public function main($content, $conf) |
|
| 102 | - { |
|
| 98 | + public function main($content, $conf) { |
|
| 103 | 99 | $this->init($conf); |
| 104 | 100 | // Turn cache on. |
| 105 | 101 | $this->setCache(true); |
@@ -214,8 +210,7 @@ discard block |
||
| 214 | 210 | * |
| 215 | 211 | * @return string Typolink ready to output |
| 216 | 212 | */ |
| 217 | - protected function makeLink($label, array $overrulePIvars = [], $aTagParams = '') |
|
| 218 | - { |
|
| 213 | + protected function makeLink($label, array $overrulePIvars = [], $aTagParams = '') { |
|
| 219 | 214 | // Merge plugin variables with new set of values. |
| 220 | 215 | if (is_array($this->piVars)) { |
| 221 | 216 | $piVars = $this->piVars; |
@@ -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? |
@@ -1006,8 +995,7 @@ discard block |
||
| 1006 | 995 | * |
| 1007 | 996 | * @return bool true on success or false on failure |
| 1008 | 997 | */ |
| 1009 | - public function save($pid = 0, $core = 0) |
|
| 1010 | - { |
|
| 998 | + public function save($pid = 0, $core = 0) { |
|
| 1011 | 999 | if (\TYPO3_MODE !== 'BE') { |
| 1012 | 1000 | $this->logger->error('Saving a document is only allowed in the backend'); |
| 1013 | 1001 | return false; |
@@ -1328,8 +1316,7 @@ discard block |
||
| 1328 | 1316 | * |
| 1329 | 1317 | * @return bool Are there any fulltext files available? |
| 1330 | 1318 | */ |
| 1331 | - protected function _getHasFulltext() |
|
| 1332 | - { |
|
| 1319 | + protected function _getHasFulltext() { |
|
| 1333 | 1320 | $this->ensureHasFulltextIsSet(); |
| 1334 | 1321 | return $this->hasFulltext; |
| 1335 | 1322 | } |
@@ -1341,8 +1328,7 @@ discard block |
||
| 1341 | 1328 | * |
| 1342 | 1329 | * @return string The location of the document |
| 1343 | 1330 | */ |
| 1344 | - protected function _getLocation() |
|
| 1345 | - { |
|
| 1331 | + protected function _getLocation() { |
|
| 1346 | 1332 | return $this->location; |
| 1347 | 1333 | } |
| 1348 | 1334 | |
@@ -1364,8 +1350,7 @@ discard block |
||
| 1364 | 1350 | * |
| 1365 | 1351 | * @return array Array of metadata with their corresponding logical structure node ID as key |
| 1366 | 1352 | */ |
| 1367 | - protected function _getMetadataArray() |
|
| 1368 | - { |
|
| 1353 | + protected function _getMetadataArray() { |
|
| 1369 | 1354 | // Set metadata definitions' PID. |
| 1370 | 1355 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 1371 | 1356 | if (!$cPid) { |
@@ -1390,8 +1375,7 @@ discard block |
||
| 1390 | 1375 | * |
| 1391 | 1376 | * @return int The total number of pages and/or tracks |
| 1392 | 1377 | */ |
| 1393 | - protected function _getNumPages() |
|
| 1394 | - { |
|
| 1378 | + protected function _getNumPages() { |
|
| 1395 | 1379 | $this->_getPhysicalStructure(); |
| 1396 | 1380 | return $this->numPages; |
| 1397 | 1381 | } |
@@ -1403,8 +1387,7 @@ discard block |
||
| 1403 | 1387 | * |
| 1404 | 1388 | * @return int The UID of the parent document or zero if not applicable |
| 1405 | 1389 | */ |
| 1406 | - protected function _getParentId() |
|
| 1407 | - { |
|
| 1390 | + protected function _getParentId() { |
|
| 1408 | 1391 | return $this->parentId; |
| 1409 | 1392 | } |
| 1410 | 1393 | |
@@ -1427,8 +1410,7 @@ discard block |
||
| 1427 | 1410 | * |
| 1428 | 1411 | * @return array Array of elements' type, label and file representations ordered by @ID attribute / Canvas order |
| 1429 | 1412 | */ |
| 1430 | - protected function _getPhysicalStructureInfo() |
|
| 1431 | - { |
|
| 1413 | + protected function _getPhysicalStructureInfo() { |
|
| 1432 | 1414 | // Is there no physical structure array yet? |
| 1433 | 1415 | if (!$this->physicalStructureLoaded) { |
| 1434 | 1416 | // Build physical structure array. |
@@ -1444,8 +1426,7 @@ discard block |
||
| 1444 | 1426 | * |
| 1445 | 1427 | * @return int The PID of the document or zero if not in database |
| 1446 | 1428 | */ |
| 1447 | - protected function _getPid() |
|
| 1448 | - { |
|
| 1429 | + protected function _getPid() { |
|
| 1449 | 1430 | return $this->pid; |
| 1450 | 1431 | } |
| 1451 | 1432 | |
@@ -1456,8 +1437,7 @@ discard block |
||
| 1456 | 1437 | * |
| 1457 | 1438 | * @return bool Is the document instantiated successfully? |
| 1458 | 1439 | */ |
| 1459 | - protected function _getReady() |
|
| 1460 | - { |
|
| 1440 | + protected function _getReady() { |
|
| 1461 | 1441 | return $this->ready; |
| 1462 | 1442 | } |
| 1463 | 1443 | |
@@ -1468,8 +1448,7 @@ discard block |
||
| 1468 | 1448 | * |
| 1469 | 1449 | * @return mixed The METS file's / IIIF manifest's record identifier |
| 1470 | 1450 | */ |
| 1471 | - protected function _getRecordId() |
|
| 1472 | - { |
|
| 1451 | + protected function _getRecordId() { |
|
| 1473 | 1452 | return $this->recordId; |
| 1474 | 1453 | } |
| 1475 | 1454 | |
@@ -1480,8 +1459,7 @@ discard block |
||
| 1480 | 1459 | * |
| 1481 | 1460 | * @return int The UID of the root document or zero if not applicable |
| 1482 | 1461 | */ |
| 1483 | - protected function _getRootId() |
|
| 1484 | - { |
|
| 1462 | + protected function _getRootId() { |
|
| 1485 | 1463 | if (!$this->rootIdLoaded) { |
| 1486 | 1464 | if ($this->parentId) { |
| 1487 | 1465 | $parent = self::getInstance($this->parentId, $this->pid); |
@@ -1511,8 +1489,7 @@ discard block |
||
| 1511 | 1489 | * |
| 1512 | 1490 | * @return array Array of structure nodes' id, label, type and physical page indexes/mptr / Canvas link with original hierarchy preserved |
| 1513 | 1491 | */ |
| 1514 | - protected function _getTableOfContents() |
|
| 1515 | - { |
|
| 1492 | + protected function _getTableOfContents() { |
|
| 1516 | 1493 | // Is there no logical structure array yet? |
| 1517 | 1494 | if (!$this->tableOfContentsLoaded) { |
| 1518 | 1495 | // Get all logical structures. |
@@ -1553,8 +1530,7 @@ discard block |
||
| 1553 | 1530 | * |
| 1554 | 1531 | * @return mixed The UID or the URL of the document |
| 1555 | 1532 | */ |
| 1556 | - protected function _getUid() |
|
| 1557 | - { |
|
| 1533 | + protected function _getUid() { |
|
| 1558 | 1534 | return $this->uid; |
| 1559 | 1535 | } |
| 1560 | 1536 | |
@@ -1567,8 +1543,7 @@ discard block |
||
| 1567 | 1543 | * |
| 1568 | 1544 | * @return void |
| 1569 | 1545 | */ |
| 1570 | - protected function _setCPid($value) |
|
| 1571 | - { |
|
| 1546 | + protected function _setCPid($value) { |
|
| 1572 | 1547 | $this->cPid = max(intval($value), 0); |
| 1573 | 1548 | } |
| 1574 | 1549 | |
@@ -1579,8 +1554,7 @@ discard block |
||
| 1579 | 1554 | * |
| 1580 | 1555 | * @return void |
| 1581 | 1556 | */ |
| 1582 | - protected function __clone() |
|
| 1583 | - { |
|
| 1557 | + protected function __clone() { |
|
| 1584 | 1558 | // This method is defined as protected because singleton objects should not be cloned. |
| 1585 | 1559 | } |
| 1586 | 1560 | |
@@ -1597,8 +1571,7 @@ discard block |
||
| 1597 | 1571 | * |
| 1598 | 1572 | * @return void |
| 1599 | 1573 | */ |
| 1600 | - protected function __construct($uid, $pid, $preloadedDocument) |
|
| 1601 | - { |
|
| 1574 | + protected function __construct($uid, $pid, $preloadedDocument) { |
|
| 1602 | 1575 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 1603 | 1576 | ->getQueryBuilderForTable('tx_dlf_documents'); |
| 1604 | 1577 | $location = ''; |
@@ -1710,8 +1683,7 @@ discard block |
||
| 1710 | 1683 | * |
| 1711 | 1684 | * @return mixed Value of $this->$var |
| 1712 | 1685 | */ |
| 1713 | - public function __get($var) |
|
| 1714 | - { |
|
| 1686 | + public function __get($var) { |
|
| 1715 | 1687 | $method = '_get' . ucfirst($var); |
| 1716 | 1688 | if ( |
| 1717 | 1689 | !property_exists($this, $var) |
@@ -1733,8 +1705,7 @@ discard block |
||
| 1733 | 1705 | * |
| 1734 | 1706 | * @return bool true if variable is set and not empty, false otherwise |
| 1735 | 1707 | */ |
| 1736 | - public function __isset($var) |
|
| 1737 | - { |
|
| 1708 | + public function __isset($var) { |
|
| 1738 | 1709 | return !empty($this->__get($var)); |
| 1739 | 1710 | } |
| 1740 | 1711 | |
@@ -1748,8 +1719,7 @@ discard block |
||
| 1748 | 1719 | * |
| 1749 | 1720 | * @return void |
| 1750 | 1721 | */ |
| 1751 | - public function __set($var, $value) |
|
| 1752 | - { |
|
| 1722 | + public function __set($var, $value) { |
|
| 1753 | 1723 | $method = '_set' . ucfirst($var); |
| 1754 | 1724 | if ( |
| 1755 | 1725 | !property_exists($this, $var) |