@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | * @subpackage dlf |
| 27 | 27 | * @access public |
| 28 | 28 | */ |
| 29 | -class AudioPlayer extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 30 | -{ |
|
| 29 | +class AudioPlayer extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 31 | 30 | public $scriptRelPath = 'Classes/Plugin/AudioPlayer.php'; |
| 32 | 31 | |
| 33 | 32 | /** |
@@ -45,8 +44,7 @@ discard block |
||
| 45 | 44 | * |
| 46 | 45 | * @return void |
| 47 | 46 | */ |
| 48 | - protected function addPlayerJS() |
|
| 49 | - { |
|
| 47 | + protected function addPlayerJS() { |
|
| 50 | 48 | // Inline CSS. |
| 51 | 49 | $inlineCSS = '#tx-dlf-audio { width: 100px; height: 100px; }'; |
| 52 | 50 | |
@@ -80,8 +78,7 @@ discard block |
||
| 80 | 78 | * |
| 81 | 79 | * @return string The content that is displayed on the website |
| 82 | 80 | */ |
| 83 | - public function main($content, $conf) |
|
| 84 | - { |
|
| 81 | + public function main($content, $conf) { |
|
| 85 | 82 | $this->init($conf); |
| 86 | 83 | // Load current document. |
| 87 | 84 | $this->loadDocument(); |
@@ -28,8 +28,7 @@ discard block |
||
| 28 | 28 | * @subpackage dlf |
| 29 | 29 | * @access public |
| 30 | 30 | */ |
| 31 | -class PageView extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 32 | -{ |
|
| 31 | +class PageView extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 33 | 32 | public $scriptRelPath = 'Classes/Plugin/PageView.php'; |
| 34 | 33 | |
| 35 | 34 | /** |
@@ -71,8 +70,7 @@ discard block |
||
| 71 | 70 | * |
| 72 | 71 | * @return void |
| 73 | 72 | */ |
| 74 | - protected function addViewerJS() |
|
| 75 | - { |
|
| 73 | + protected function addViewerJS() { |
|
| 76 | 74 | // Viewer configuration. |
| 77 | 75 | $viewerConfiguration = ' |
| 78 | 76 | $(document).ready(function() { |
@@ -100,8 +98,7 @@ discard block |
||
| 100 | 98 | * |
| 101 | 99 | * @return array Marker array |
| 102 | 100 | */ |
| 103 | - protected function addInteraction() |
|
| 104 | - { |
|
| 101 | + protected function addInteraction() { |
|
| 105 | 102 | $markerArray = []; |
| 106 | 103 | if ($this->piVars['id']) { |
| 107 | 104 | if ($this->conf['crop']) { |
@@ -127,8 +124,7 @@ discard block |
||
| 127 | 124 | * |
| 128 | 125 | * @return array Marker array |
| 129 | 126 | */ |
| 130 | - protected function addBasketForm() |
|
| 131 | - { |
|
| 127 | + protected function addBasketForm() { |
|
| 132 | 128 | $markerArray = []; |
| 133 | 129 | // Add basket button |
| 134 | 130 | if ($this->conf['basketButton'] && $this->conf['targetBasket'] && $this->piVars['id']) { |
@@ -176,8 +172,7 @@ discard block |
||
| 176 | 172 | * |
| 177 | 173 | * @return array URL and MIME type of image file |
| 178 | 174 | */ |
| 179 | - protected function getImage($page) |
|
| 180 | - { |
|
| 175 | + protected function getImage($page) { |
|
| 181 | 176 | $image = []; |
| 182 | 177 | // Get @USE value of METS fileGrp. |
| 183 | 178 | $fileGrpsImages = GeneralUtility::trimExplode(',', $this->conf['fileGrpImages']); |
@@ -213,8 +208,7 @@ discard block |
||
| 213 | 208 | * |
| 214 | 209 | * @return array URL and MIME type of fulltext file |
| 215 | 210 | */ |
| 216 | - protected function getFulltext($page) |
|
| 217 | - { |
|
| 211 | + protected function getFulltext($page) { |
|
| 218 | 212 | $fulltext = []; |
| 219 | 213 | // Get fulltext link. |
| 220 | 214 | $fileGrpsFulltext = GeneralUtility::trimExplode(',', $this->conf['fileGrpFulltext']); |
@@ -250,8 +244,7 @@ discard block |
||
| 250 | 244 | * @return array An array containing the IRIs of the AnnotationLists / AnnotationPages as well as |
| 251 | 245 | * some information about the canvas. |
| 252 | 246 | */ |
| 253 | - protected function getAnnotationContainers($page) |
|
| 254 | - { |
|
| 247 | + protected function getAnnotationContainers($page) { |
|
| 255 | 248 | if ($this->doc instanceof IiifManifest) { |
| 256 | 249 | $canvasId = $this->doc->physicalStructure[$page]; |
| 257 | 250 | $iiif = $this->doc->getIiif(); |
@@ -308,8 +301,7 @@ discard block |
||
| 308 | 301 | * |
| 309 | 302 | * @return string The content that is displayed on the website |
| 310 | 303 | */ |
| 311 | - public function main($content, $conf) |
|
| 312 | - { |
|
| 304 | + public function main($content, $conf) { |
|
| 313 | 305 | $this->init($conf); |
| 314 | 306 | // Load current document. |
| 315 | 307 | $this->loadDocument(); |
@@ -48,8 +48,7 @@ discard block |
||
| 48 | 48 | * @property-read string $toplevelId This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF) |
| 49 | 49 | * @property-read mixed $uid This holds the UID or the URL of the document |
| 50 | 50 | */ |
| 51 | -final class MetsDocument extends Document |
|
| 52 | -{ |
|
| 51 | +final class MetsDocument extends Document { |
|
| 53 | 52 | /** |
| 54 | 53 | * This holds the whole XML file as string for serialization purposes |
| 55 | 54 | * @see __sleep() / __wakeup() |
@@ -128,8 +127,7 @@ discard block |
||
| 128 | 127 | * |
| 129 | 128 | * @return void |
| 130 | 129 | */ |
| 131 | - public function addMetadataFromMets(&$metadata, $id) |
|
| 132 | - { |
|
| 130 | + public function addMetadataFromMets(&$metadata, $id) { |
|
| 133 | 131 | $details = $this->getLogicalStructure($id); |
| 134 | 132 | if (!empty($details)) { |
| 135 | 133 | $metadata['mets_order'][0] = $details['order']; |
@@ -143,8 +141,7 @@ discard block |
||
| 143 | 141 | * {@inheritDoc} |
| 144 | 142 | * @see \Kitodo\Dlf\Common\Document::establishRecordId() |
| 145 | 143 | */ |
| 146 | - protected function establishRecordId($pid) |
|
| 147 | - { |
|
| 144 | + protected function establishRecordId($pid) { |
|
| 148 | 145 | // Check for METS object @ID. |
| 149 | 146 | if (!empty($this->mets['OBJID'])) { |
| 150 | 147 | $this->recordId = (string) $this->mets['OBJID']; |
@@ -164,8 +161,7 @@ discard block |
||
| 164 | 161 | * {@inheritDoc} |
| 165 | 162 | * @see \Kitodo\Dlf\Common\Document::getDownloadLocation() |
| 166 | 163 | */ |
| 167 | - public function getDownloadLocation($id) |
|
| 168 | - { |
|
| 164 | + public function getDownloadLocation($id) { |
|
| 169 | 165 | $fileMimeType = $this->getFileMimeType($id); |
| 170 | 166 | $fileLocation = $this->getFileLocation($id); |
| 171 | 167 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
@@ -190,8 +186,7 @@ discard block |
||
| 190 | 186 | * {@inheritDoc} |
| 191 | 187 | * @see \Kitodo\Dlf\Common\Document::getFileLocation() |
| 192 | 188 | */ |
| 193 | - public function getFileLocation($id) |
|
| 194 | - { |
|
| 189 | + public function getFileLocation($id) { |
|
| 195 | 190 | $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
| 196 | 191 | if ( |
| 197 | 192 | !empty($id) |
@@ -208,8 +203,7 @@ discard block |
||
| 208 | 203 | * {@inheritDoc} |
| 209 | 204 | * @see \Kitodo\Dlf\Common\Document::getFileMimeType() |
| 210 | 205 | */ |
| 211 | - public function getFileMimeType($id) |
|
| 212 | - { |
|
| 206 | + public function getFileMimeType($id) { |
|
| 213 | 207 | $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
| 214 | 208 | if ( |
| 215 | 209 | !empty($id) |
@@ -226,8 +220,7 @@ discard block |
||
| 226 | 220 | * {@inheritDoc} |
| 227 | 221 | * @see \Kitodo\Dlf\Common\Document::getLogicalStructure() |
| 228 | 222 | */ |
| 229 | - public function getLogicalStructure($id, $recursive = false) |
|
| 230 | - { |
|
| 223 | + public function getLogicalStructure($id, $recursive = false) { |
|
| 231 | 224 | $details = []; |
| 232 | 225 | // Is the requested logical unit already loaded? |
| 233 | 226 | if ( |
@@ -267,8 +260,7 @@ discard block |
||
| 267 | 260 | * |
| 268 | 261 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
| 269 | 262 | */ |
| 270 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) |
|
| 271 | - { |
|
| 263 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) { |
|
| 272 | 264 | // Get attributes. |
| 273 | 265 | foreach ($structure->attributes() as $attribute => $value) { |
| 274 | 266 | $attributes[$attribute] = (string) $value; |
@@ -366,8 +358,7 @@ discard block |
||
| 366 | 358 | * {@inheritDoc} |
| 367 | 359 | * @see \Kitodo\Dlf\Common\Document::getMetadata() |
| 368 | 360 | */ |
| 369 | - public function getMetadata($id, $cPid = 0) |
|
| 370 | - { |
|
| 361 | + public function getMetadata($id, $cPid = 0) { |
|
| 371 | 362 | // Make sure $cPid is a non-negative integer. |
| 372 | 363 | $cPid = max(intval($cPid), 0); |
| 373 | 364 | // If $cPid is not given, try to get it elsewhere. |
@@ -651,8 +642,7 @@ discard block |
||
| 651 | 642 | * {@inheritDoc} |
| 652 | 643 | * @see \Kitodo\Dlf\Common\Document::getRawText() |
| 653 | 644 | */ |
| 654 | - public function getRawText($id) |
|
| 655 | - { |
|
| 645 | + public function getRawText($id) { |
|
| 656 | 646 | $rawText = ''; |
| 657 | 647 | // Get text from raw text array if available. |
| 658 | 648 | if (!empty($this->rawTextArray[$id])) { |
@@ -670,8 +660,7 @@ discard block |
||
| 670 | 660 | * {@inheritDoc} |
| 671 | 661 | * @see Document::getStructureDepth() |
| 672 | 662 | */ |
| 673 | - public function getStructureDepth($logId) |
|
| 674 | - { |
|
| 663 | + public function getStructureDepth($logId) { |
|
| 675 | 664 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
| 676 | 665 | if (!empty($ancestors)) { |
| 677 | 666 | return count($ancestors); |
@@ -684,8 +673,7 @@ discard block |
||
| 684 | 673 | * {@inheritDoc} |
| 685 | 674 | * @see \Kitodo\Dlf\Common\Document::init() |
| 686 | 675 | */ |
| 687 | - protected function init() |
|
| 688 | - { |
|
| 676 | + protected function init() { |
|
| 689 | 677 | // Get METS node from XML file. |
| 690 | 678 | $this->registerNamespaces($this->xml); |
| 691 | 679 | $mets = $this->xml->xpath('//mets:mets'); |
@@ -702,8 +690,7 @@ discard block |
||
| 702 | 690 | * {@inheritDoc} |
| 703 | 691 | * @see \Kitodo\Dlf\Common\Document::loadLocation() |
| 704 | 692 | */ |
| 705 | - protected function loadLocation($location) |
|
| 706 | - { |
|
| 693 | + protected function loadLocation($location) { |
|
| 707 | 694 | $fileResource = GeneralUtility::getUrl($location); |
| 708 | 695 | if ($fileResource !== false) { |
| 709 | 696 | // Turn off libxml's error logging. |
@@ -730,8 +717,7 @@ discard block |
||
| 730 | 717 | * {@inheritDoc} |
| 731 | 718 | * @see \Kitodo\Dlf\Common\Document::ensureHasFulltextIsSet() |
| 732 | 719 | */ |
| 733 | - protected function ensureHasFulltextIsSet() |
|
| 734 | - { |
|
| 720 | + protected function ensureHasFulltextIsSet() { |
|
| 735 | 721 | // Are the fileGrps already loaded? |
| 736 | 722 | if (!$this->fileGrpsLoaded) { |
| 737 | 723 | $this->_getFileGrps(); |
@@ -742,8 +728,7 @@ discard block |
||
| 742 | 728 | * {@inheritDoc} |
| 743 | 729 | * @see Document::getParentDocumentUid() |
| 744 | 730 | */ |
| 745 | - protected function getParentDocumentUidForSaving($pid, $core) |
|
| 746 | - { |
|
| 731 | + protected function getParentDocumentUidForSaving($pid, $core) { |
|
| 747 | 732 | $partof = 0; |
| 748 | 733 | // Get the closest ancestor of the current document which has a MPTR child. |
| 749 | 734 | $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->_getToplevelId() . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
@@ -766,8 +751,7 @@ discard block |
||
| 766 | 751 | * {@inheritDoc} |
| 767 | 752 | * @see Document::setPreloadedDocument() |
| 768 | 753 | */ |
| 769 | - protected function setPreloadedDocument($preloadedDocument) |
|
| 770 | - { |
|
| 754 | + protected function setPreloadedDocument($preloadedDocument) { |
|
| 771 | 755 | |
| 772 | 756 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
| 773 | 757 | $this->xml = $preloadedDocument; |
@@ -780,8 +764,7 @@ discard block |
||
| 780 | 764 | * {@inheritDoc} |
| 781 | 765 | * @see Document::getDocument() |
| 782 | 766 | */ |
| 783 | - protected function getDocument() |
|
| 784 | - { |
|
| 767 | + protected function getDocument() { |
|
| 785 | 768 | return $this->mets; |
| 786 | 769 | } |
| 787 | 770 | |
@@ -792,8 +775,7 @@ discard block |
||
| 792 | 775 | * |
| 793 | 776 | * @return int The PID of the metadata definitions |
| 794 | 777 | */ |
| 795 | - protected function _getCPid() |
|
| 796 | - { |
|
| 778 | + protected function _getCPid() { |
|
| 797 | 779 | return $this->cPid; |
| 798 | 780 | } |
| 799 | 781 | |
@@ -804,8 +786,7 @@ discard block |
||
| 804 | 786 | * |
| 805 | 787 | * @return array Array of dmdSecs with their IDs as array key |
| 806 | 788 | */ |
| 807 | - protected function _getDmdSec() |
|
| 808 | - { |
|
| 789 | + protected function _getDmdSec() { |
|
| 809 | 790 | if (!$this->dmdSecLoaded) { |
| 810 | 791 | // Get available data formats. |
| 811 | 792 | $this->loadFormats(); |
@@ -843,8 +824,7 @@ discard block |
||
| 843 | 824 | * |
| 844 | 825 | * @return array Array of file use groups with file IDs |
| 845 | 826 | */ |
| 846 | - protected function _getFileGrps() |
|
| 847 | - { |
|
| 827 | + protected function _getFileGrps() { |
|
| 848 | 828 | if (!$this->fileGrpsLoaded) { |
| 849 | 829 | // Get configured USE attributes. |
| 850 | 830 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -889,8 +869,7 @@ discard block |
||
| 889 | 869 | * {@inheritDoc} |
| 890 | 870 | * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray() |
| 891 | 871 | */ |
| 892 | - protected function prepareMetadataArray($cPid) |
|
| 893 | - { |
|
| 872 | + protected function prepareMetadataArray($cPid) { |
|
| 894 | 873 | $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'); |
| 895 | 874 | // Get all logical structure nodes with metadata. |
| 896 | 875 | if (!empty($ids)) { |
@@ -908,8 +887,7 @@ discard block |
||
| 908 | 887 | * |
| 909 | 888 | * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object |
| 910 | 889 | */ |
| 911 | - protected function _getMets() |
|
| 912 | - { |
|
| 890 | + protected function _getMets() { |
|
| 913 | 891 | return $this->mets; |
| 914 | 892 | } |
| 915 | 893 | |
@@ -917,8 +895,7 @@ discard block |
||
| 917 | 895 | * {@inheritDoc} |
| 918 | 896 | * @see \Kitodo\Dlf\Common\Document::_getPhysicalStructure() |
| 919 | 897 | */ |
| 920 | - protected function _getPhysicalStructure() |
|
| 921 | - { |
|
| 898 | + protected function _getPhysicalStructure() { |
|
| 922 | 899 | // Is there no physical structure array yet? |
| 923 | 900 | if (!$this->physicalStructureLoaded) { |
| 924 | 901 | // Does the document have a structMap node of type "PHYSICAL"? |
@@ -978,8 +955,7 @@ discard block |
||
| 978 | 955 | * {@inheritDoc} |
| 979 | 956 | * @see \Kitodo\Dlf\Common\Document::_getSmLinks() |
| 980 | 957 | */ |
| 981 | - protected function _getSmLinks() |
|
| 982 | - { |
|
| 958 | + protected function _getSmLinks() { |
|
| 983 | 959 | if (!$this->smLinksLoaded) { |
| 984 | 960 | $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink'); |
| 985 | 961 | if (!empty($smLinks)) { |
@@ -997,8 +973,7 @@ discard block |
||
| 997 | 973 | * {@inheritDoc} |
| 998 | 974 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
| 999 | 975 | */ |
| 1000 | - protected function _getThumbnail($forceReload = false) |
|
| 1001 | - { |
|
| 976 | + protected function _getThumbnail($forceReload = false) { |
|
| 1002 | 977 | if ( |
| 1003 | 978 | !$this->thumbnailLoaded |
| 1004 | 979 | || $forceReload |
@@ -1077,8 +1052,7 @@ discard block |
||
| 1077 | 1052 | * {@inheritDoc} |
| 1078 | 1053 | * @see \Kitodo\Dlf\Common\Document::_getToplevelId() |
| 1079 | 1054 | */ |
| 1080 | - protected function _getToplevelId() |
|
| 1081 | - { |
|
| 1055 | + protected function _getToplevelId() { |
|
| 1082 | 1056 | if (empty($this->toplevelId)) { |
| 1083 | 1057 | // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
| 1084 | 1058 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'); |
@@ -1110,8 +1084,7 @@ discard block |
||
| 1110 | 1084 | * |
| 1111 | 1085 | * @return array Properties to be serialized |
| 1112 | 1086 | */ |
| 1113 | - public function __sleep() |
|
| 1114 | - { |
|
| 1087 | + public function __sleep() { |
|
| 1115 | 1088 | // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization |
| 1116 | 1089 | $this->asXML = $this->xml->asXML(); |
| 1117 | 1090 | return ['uid', 'pid', 'recordId', 'parentId', 'asXML']; |
@@ -1124,8 +1097,7 @@ discard block |
||
| 1124 | 1097 | * |
| 1125 | 1098 | * @return string String representing the METS object |
| 1126 | 1099 | */ |
| 1127 | - public function __toString() |
|
| 1128 | - { |
|
| 1100 | + public function __toString() { |
|
| 1129 | 1101 | $xml = new \DOMDocument('1.0', 'utf-8'); |
| 1130 | 1102 | $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
| 1131 | 1103 | $xml->formatOutput = true; |
@@ -1140,8 +1112,7 @@ discard block |
||
| 1140 | 1112 | * |
| 1141 | 1113 | * @return void |
| 1142 | 1114 | */ |
| 1143 | - public function __wakeup() |
|
| 1144 | - { |
|
| 1115 | + public function __wakeup() { |
|
| 1145 | 1116 | // Turn off libxml's error logging. |
| 1146 | 1117 | $libxmlErrors = libxml_use_internal_errors(true); |
| 1147 | 1118 | // Reload XML from string. |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | * @property-read string $toplevelId This holds the toplevel manifest's @id |
| 57 | 57 | * @property-read mixed $uid This holds the UID or the URL of the document |
| 58 | 58 | */ |
| 59 | -final class IiifManifest extends Document |
|
| 60 | -{ |
|
| 59 | +final class IiifManifest extends Document { |
|
| 61 | 60 | /** |
| 62 | 61 | * This holds the manifest file as string for serialization purposes |
| 63 | 62 | * @see __sleep() / __wakeup() |
@@ -118,8 +117,7 @@ discard block |
||
| 118 | 117 | * {@inheritDoc} |
| 119 | 118 | * @see Document::establishRecordId() |
| 120 | 119 | */ |
| 121 | - protected function establishRecordId($pid) |
|
| 122 | - { |
|
| 120 | + protected function establishRecordId($pid) { |
|
| 123 | 121 | if ($this->iiif !== null) { |
| 124 | 122 | /* |
| 125 | 123 | * FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss |
@@ -170,8 +168,7 @@ discard block |
||
| 170 | 168 | * {@inheritDoc} |
| 171 | 169 | * @see Document::getDocument() |
| 172 | 170 | */ |
| 173 | - protected function getDocument() |
|
| 174 | - { |
|
| 171 | + protected function getDocument() { |
|
| 175 | 172 | return $this->iiif; |
| 176 | 173 | } |
| 177 | 174 | |
@@ -184,8 +181,7 @@ discard block |
||
| 184 | 181 | * @return string 'IIIF1' if the resource is a Metadata API 1 resource, 'IIIF2' / 'IIIF3' if |
| 185 | 182 | * the resource is a Presentation API 2 / 3 resource |
| 186 | 183 | */ |
| 187 | - public function getIiifVersion() |
|
| 188 | - { |
|
| 184 | + public function getIiifVersion() { |
|
| 189 | 185 | if (!isset($this->iiifVersion)) { |
| 190 | 186 | if ($this->iiif instanceof AbstractIiifResource1) { |
| 191 | 187 | $this->iiifVersion = 'IIIF1'; |
@@ -226,8 +222,7 @@ discard block |
||
| 226 | 222 | * |
| 227 | 223 | * @return array|string |
| 228 | 224 | */ |
| 229 | - protected function getUseGroups($use) |
|
| 230 | - { |
|
| 225 | + protected function getUseGroups($use) { |
|
| 231 | 226 | if (!$this->useGrpsLoaded) { |
| 232 | 227 | // Get configured USE attributes. |
| 233 | 228 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -255,8 +250,7 @@ discard block |
||
| 255 | 250 | * {@inheritDoc} |
| 256 | 251 | * @see Document::_getPhysicalStructure() |
| 257 | 252 | */ |
| 258 | - protected function _getPhysicalStructure() |
|
| 259 | - { |
|
| 253 | + protected function _getPhysicalStructure() { |
|
| 260 | 254 | // Is there no physical structure array yet? |
| 261 | 255 | if (!$this->physicalStructureLoaded) { |
| 262 | 256 | if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
@@ -369,8 +363,7 @@ discard block |
||
| 369 | 363 | * {@inheritDoc} |
| 370 | 364 | * @see Document::getDownloadLocation() |
| 371 | 365 | */ |
| 372 | - public function getDownloadLocation($id) |
|
| 373 | - { |
|
| 366 | + public function getDownloadLocation($id) { |
|
| 374 | 367 | $fileLocation = $this->getFileLocation($id); |
| 375 | 368 | $resource = $this->iiif->getContainedResourceById($fileLocation); |
| 376 | 369 | if ($resource instanceof AbstractImageService) { |
@@ -383,8 +376,7 @@ discard block |
||
| 383 | 376 | * {@inheritDoc} |
| 384 | 377 | * @see Document::getFileLocation() |
| 385 | 378 | */ |
| 386 | - public function getFileLocation($id) |
|
| 387 | - { |
|
| 379 | + public function getFileLocation($id) { |
|
| 388 | 380 | if ($id == null) { |
| 389 | 381 | return null; |
| 390 | 382 | } |
@@ -408,8 +400,7 @@ discard block |
||
| 408 | 400 | * {@inheritDoc} |
| 409 | 401 | * @see Document::getFileMimeType() |
| 410 | 402 | */ |
| 411 | - public function getFileMimeType($id) |
|
| 412 | - { |
|
| 403 | + public function getFileMimeType($id) { |
|
| 413 | 404 | $fileResource = $this->iiif->getContainedResourceById($id); |
| 414 | 405 | if ($fileResource instanceof CanvasInterface) { |
| 415 | 406 | $format = "application/vnd.kitodo.iiif"; |
@@ -434,8 +425,7 @@ discard block |
||
| 434 | 425 | * {@inheritDoc} |
| 435 | 426 | * @see Document::getLogicalStructure() |
| 436 | 427 | */ |
| 437 | - public function getLogicalStructure($id, $recursive = false) |
|
| 438 | - { |
|
| 428 | + public function getLogicalStructure($id, $recursive = false) { |
|
| 439 | 429 | $details = []; |
| 440 | 430 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
| 441 | 431 | return $this->logicalUnits[$id]; |
@@ -470,8 +460,7 @@ discard block |
||
| 470 | 460 | * @param array $processedStructures: IIIF resources that already have been processed |
| 471 | 461 | * @return array Logical structure array |
| 472 | 462 | */ |
| 473 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) |
|
| 474 | - { |
|
| 463 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) { |
|
| 475 | 464 | $details = []; |
| 476 | 465 | $details['id'] = $resource->getId(); |
| 477 | 466 | $details['dmdId'] = ''; |
@@ -563,8 +552,7 @@ discard block |
||
| 563 | 552 | * |
| 564 | 553 | * @todo This method is still in experimental; the method signature may change. |
| 565 | 554 | */ |
| 566 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) |
|
| 567 | - { |
|
| 555 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) { |
|
| 568 | 556 | if (!empty($this->originalMetadataArray[$id])) { |
| 569 | 557 | return $this->originalMetadataArray[$id]; |
| 570 | 558 | } |
@@ -606,8 +594,7 @@ discard block |
||
| 606 | 594 | * {@inheritDoc} |
| 607 | 595 | * @see Document::getMetadata() |
| 608 | 596 | */ |
| 609 | - public function getMetadata($id, $cPid = 0) |
|
| 610 | - { |
|
| 597 | + public function getMetadata($id, $cPid = 0) { |
|
| 611 | 598 | if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) { |
| 612 | 599 | return $this->metadataArray[$id]; |
| 613 | 600 | } |
@@ -714,8 +701,7 @@ discard block |
||
| 714 | 701 | * {@inheritDoc} |
| 715 | 702 | * @see Document::_getSmLinks() |
| 716 | 703 | */ |
| 717 | - protected function _getSmLinks() |
|
| 718 | - { |
|
| 704 | + protected function _getSmLinks() { |
|
| 719 | 705 | if (!$this->smLinksLoaded && isset($this->iiif) && $this->iiif instanceof ManifestInterface) { |
| 720 | 706 | if (!empty($this->iiif->getDefaultCanvases())) { |
| 721 | 707 | foreach ($this->iiif->getDefaultCanvases() as $canvas) { |
@@ -739,8 +725,7 @@ discard block |
||
| 739 | 725 | * |
| 740 | 726 | * @param RangeInterface $range: Current range whose canvases shall be linked |
| 741 | 727 | */ |
| 742 | - private function smLinkRangeCanvasesRecursively(RangeInterface $range) |
|
| 743 | - { |
|
| 728 | + private function smLinkRangeCanvasesRecursively(RangeInterface $range) { |
|
| 744 | 729 | // map range's canvases including all child ranges' canvases |
| 745 | 730 | if (!$range->isTopRange()) { |
| 746 | 731 | foreach ($range->getAllCanvasesRecursively() as $canvas) { |
@@ -763,8 +748,7 @@ discard block |
||
| 763 | 748 | * @param CanvasInterface $canvas |
| 764 | 749 | * @param IiifResourceInterface $resource |
| 765 | 750 | */ |
| 766 | - private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) |
|
| 767 | - { |
|
| 751 | + private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) { |
|
| 768 | 752 | $this->smLinks['l2p'][$resource->getId()][] = $canvas->getId(); |
| 769 | 753 | if (!is_array($this->smLinks['p2l'][$canvas->getId()]) || !in_array($resource->getId(), $this->smLinks['p2l'][$canvas->getId()])) { |
| 770 | 754 | $this->smLinks['p2l'][$canvas->getId()][] = $resource->getId(); |
@@ -779,8 +763,7 @@ discard block |
||
| 779 | 763 | * |
| 780 | 764 | * @see Document::getParentDocumentUidForSaving() |
| 781 | 765 | */ |
| 782 | - protected function getParentDocumentUidForSaving($pid, $core) |
|
| 783 | - { |
|
| 766 | + protected function getParentDocumentUidForSaving($pid, $core) { |
|
| 784 | 767 | // Do nothing. |
| 785 | 768 | } |
| 786 | 769 | |
@@ -788,8 +771,7 @@ discard block |
||
| 788 | 771 | * {@inheritDoc} |
| 789 | 772 | * @see Document::getRawText() |
| 790 | 773 | */ |
| 791 | - public function getRawText($id) |
|
| 792 | - { |
|
| 774 | + public function getRawText($id) { |
|
| 793 | 775 | $rawText = ''; |
| 794 | 776 | // Get text from raw text array if available. |
| 795 | 777 | if (!empty($this->rawTextArray[$id])) { |
@@ -846,8 +828,7 @@ discard block |
||
| 846 | 828 | * |
| 847 | 829 | * @return IiifResourceInterface |
| 848 | 830 | */ |
| 849 | - public function getIiif() |
|
| 850 | - { |
|
| 831 | + public function getIiif() { |
|
| 851 | 832 | return $this->iiif; |
| 852 | 833 | } |
| 853 | 834 | |
@@ -855,8 +836,7 @@ discard block |
||
| 855 | 836 | * {@inheritDoc} |
| 856 | 837 | * @see Document::init() |
| 857 | 838 | */ |
| 858 | - protected function init() |
|
| 859 | - { |
|
| 839 | + protected function init() { |
|
| 860 | 840 | // Nothing to do here, at the moment |
| 861 | 841 | } |
| 862 | 842 | |
@@ -864,8 +844,7 @@ discard block |
||
| 864 | 844 | * {@inheritDoc} |
| 865 | 845 | * @see Document::loadLocation() |
| 866 | 846 | */ |
| 867 | - protected function loadLocation($location) |
|
| 868 | - { |
|
| 847 | + protected function loadLocation($location) { |
|
| 869 | 848 | $fileResource = GeneralUtility::getUrl($location); |
| 870 | 849 | if ($fileResource !== false) { |
| 871 | 850 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -888,8 +867,7 @@ discard block |
||
| 888 | 867 | * {@inheritDoc} |
| 889 | 868 | * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray() |
| 890 | 869 | */ |
| 891 | - protected function prepareMetadataArray($cPid) |
|
| 892 | - { |
|
| 870 | + protected function prepareMetadataArray($cPid) { |
|
| 893 | 871 | $id = $this->iiif->getId(); |
| 894 | 872 | $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid); |
| 895 | 873 | } |
@@ -898,8 +876,7 @@ discard block |
||
| 898 | 876 | * {@inheritDoc} |
| 899 | 877 | * @see Document::setPreloadedDocument() |
| 900 | 878 | */ |
| 901 | - protected function setPreloadedDocument($preloadedDocument) |
|
| 902 | - { |
|
| 879 | + protected function setPreloadedDocument($preloadedDocument) { |
|
| 903 | 880 | if ($preloadedDocument instanceof ManifestInterface) { |
| 904 | 881 | $this->iiif = $preloadedDocument; |
| 905 | 882 | return true; |
@@ -911,8 +888,7 @@ discard block |
||
| 911 | 888 | * {@inheritDoc} |
| 912 | 889 | * @see Document::ensureHasFulltextIsSet() |
| 913 | 890 | */ |
| 914 | - protected function ensureHasFulltextIsSet() |
|
| 915 | - { |
|
| 891 | + protected function ensureHasFulltextIsSet() { |
|
| 916 | 892 | /* |
| 917 | 893 | * TODO Check annotations and annotation lists of canvas for ALTO documents. |
| 918 | 894 | * Example: |
@@ -958,8 +934,7 @@ discard block |
||
| 958 | 934 | * {@inheritDoc} |
| 959 | 935 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
| 960 | 936 | */ |
| 961 | - protected function _getThumbnail($forceReload = false) |
|
| 962 | - { |
|
| 937 | + protected function _getThumbnail($forceReload = false) { |
|
| 963 | 938 | return $this->iiif->getThumbnailUrl(); |
| 964 | 939 | } |
| 965 | 940 | |
@@ -967,8 +942,7 @@ discard block |
||
| 967 | 942 | * {@inheritDoc} |
| 968 | 943 | * @see \Kitodo\Dlf\Common\Document::_getToplevelId() |
| 969 | 944 | */ |
| 970 | - protected function _getToplevelId() |
|
| 971 | - { |
|
| 945 | + protected function _getToplevelId() { |
|
| 972 | 946 | if (empty($this->toplevelId)) { |
| 973 | 947 | if (isset($this->iiif)) { |
| 974 | 948 | $this->toplevelId = $this->iiif->getId(); |
@@ -985,8 +959,7 @@ discard block |
||
| 985 | 959 | * |
| 986 | 960 | * @return void |
| 987 | 961 | */ |
| 988 | - public function __wakeup() |
|
| 989 | - { |
|
| 962 | + public function __wakeup() { |
|
| 990 | 963 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 991 | 964 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 992 | 965 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -1005,8 +978,7 @@ discard block |
||
| 1005 | 978 | * |
| 1006 | 979 | * @return string[] |
| 1007 | 980 | */ |
| 1008 | - public function __sleep() |
|
| 1009 | - { |
|
| 981 | + public function __sleep() { |
|
| 1010 | 982 | // TODO implement serializiation in IIIF library |
| 1011 | 983 | $jsonArray = $this->iiif->getOriginalJsonArray(); |
| 1012 | 984 | $this->asJson = json_encode($jsonArray); |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | * @access public |
| 25 | 25 | * @abstract |
| 26 | 26 | */ |
| 27 | -abstract class AbstractModule extends \TYPO3\CMS\Backend\Module\BaseScriptClass |
|
| 28 | -{ |
|
| 27 | +abstract class AbstractModule extends \TYPO3\CMS\Backend\Module\BaseScriptClass { |
|
| 29 | 28 | public $extKey = 'dlf'; |
| 30 | 29 | public $prefixId = 'tx_dlf'; |
| 31 | 30 | |
@@ -97,8 +96,7 @@ discard block |
||
| 97 | 96 | * |
| 98 | 97 | * @return string |
| 99 | 98 | */ |
| 100 | - protected function printContent() |
|
| 101 | - { |
|
| 99 | + protected function printContent() { |
|
| 102 | 100 | $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); |
| 103 | 101 | $this->doc->setModuleTemplate('EXT:' . $this->extKey . '/Resources/Private/Templates/' . Helper::getUnqualifiedClassName(get_class($this)) . '.tmpl'); |
| 104 | 102 | $this->doc->backPath = $GLOBALS['BACK_PATH']; |
@@ -129,8 +127,7 @@ discard block |
||
| 129 | 127 | * |
| 130 | 128 | * @return void |
| 131 | 129 | */ |
| 132 | - public function __construct() |
|
| 133 | - { |
|
| 130 | + public function __construct() { |
|
| 134 | 131 | $GLOBALS['LANG']->includeLLFile('EXT:' . $this->extKey . '/Resources/Private/Language/' . Helper::getUnqualifiedClassName(get_class($this)) . '.xml'); |
| 135 | 132 | // Read extension configuration. |
| 136 | 133 | if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][$this->extKey]) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][$this->extKey])) { |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | * @subpackage dlf |
| 32 | 32 | * @access public |
| 33 | 33 | */ |
| 34 | -class DataHandler implements LoggerAwareInterface |
|
| 35 | -{ |
|
| 34 | +class DataHandler implements LoggerAwareInterface { |
|
| 36 | 35 | use LoggerAwareTrait; |
| 37 | 36 | |
| 38 | 37 | /** |
@@ -47,8 +46,7 @@ discard block |
||
| 47 | 46 | * |
| 48 | 47 | * @return void |
| 49 | 48 | */ |
| 50 | - public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray) |
|
| 51 | - { |
|
| 49 | + public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray) { |
|
| 52 | 50 | if ($status == 'new') { |
| 53 | 51 | switch ($table) { |
| 54 | 52 | // Field post-processing for table "tx_dlf_documents". |
@@ -179,8 +177,7 @@ discard block |
||
| 179 | 177 | * |
| 180 | 178 | * @return void |
| 181 | 179 | */ |
| 182 | - public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray) |
|
| 183 | - { |
|
| 180 | + public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray) { |
|
| 184 | 181 | if ($status == 'update') { |
| 185 | 182 | switch ($table) { |
| 186 | 183 | // After database operations for table "tx_dlf_documents". |
@@ -260,8 +257,7 @@ discard block |
||
| 260 | 257 | * |
| 261 | 258 | * @return void |
| 262 | 259 | */ |
| 263 | - public function processCmdmap_postProcess($command, $table, $id) |
|
| 264 | - { |
|
| 260 | + public function processCmdmap_postProcess($command, $table, $id) { |
|
| 265 | 261 | if ( |
| 266 | 262 | in_array($command, ['move', 'delete', 'undelete']) |
| 267 | 263 | && $table == 'tx_dlf_documents' |
@@ -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 | ]; |
@@ -102,8 +101,7 @@ discard block |
||
| 102 | 101 | * |
| 103 | 102 | * @return \Kitodo\Dlf\Common\Document Instance of the current document |
| 104 | 103 | */ |
| 105 | - protected function loadDocument(array $piVars) |
|
| 106 | - { |
|
| 104 | + protected function loadDocument(array $piVars) { |
|
| 107 | 105 | // Check for required variable. |
| 108 | 106 | if (!empty($piVars['id'])) { |
| 109 | 107 | // Get instance of document. |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | * @subpackage dlf |
| 32 | 32 | * @access public |
| 33 | 33 | */ |
| 34 | -class Search extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 35 | -{ |
|
| 34 | +class Search extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 36 | 35 | public $scriptRelPath = 'Classes/Plugin/Search.php'; |
| 37 | 36 | |
| 38 | 37 | /** |
@@ -42,8 +41,7 @@ discard block |
||
| 42 | 41 | * |
| 43 | 42 | * @return void |
| 44 | 43 | */ |
| 45 | - protected function addAutocompleteJS() |
|
| 46 | - { |
|
| 44 | + protected function addAutocompleteJS() { |
|
| 47 | 45 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 48 | 46 | ->getQueryBuilderForTable('tx_dlf_documents'); |
| 49 | 47 | |
@@ -74,8 +72,7 @@ discard block |
||
| 74 | 72 | * |
| 75 | 73 | * @return string HTML input fields with current document's UID and parent ID |
| 76 | 74 | */ |
| 77 | - protected function addCurrentCollection() |
|
| 78 | - { |
|
| 75 | + protected function addCurrentCollection() { |
|
| 79 | 76 | // Load current collection. |
| 80 | 77 | $list = GeneralUtility::makeInstance(DocumentList::class); |
| 81 | 78 | if ( |
@@ -107,8 +104,7 @@ discard block |
||
| 107 | 104 | * |
| 108 | 105 | * @return string HTML input fields with current document's UID |
| 109 | 106 | */ |
| 110 | - protected function addCurrentDocument() |
|
| 111 | - { |
|
| 107 | + protected function addCurrentDocument() { |
|
| 112 | 108 | // Load current list object. |
| 113 | 109 | $list = GeneralUtility::makeInstance(DocumentList::class); |
| 114 | 110 | // Load current document. |
@@ -147,8 +143,7 @@ discard block |
||
| 147 | 143 | * |
| 148 | 144 | * @return string HTML input fields with encrypted core name and hash |
| 149 | 145 | */ |
| 150 | - protected function addEncryptedCoreName() |
|
| 151 | - { |
|
| 146 | + protected function addEncryptedCoreName() { |
|
| 152 | 147 | // Get core name. |
| 153 | 148 | $name = Helper::getIndexNameFromUid($this->conf['solrcore'], 'tx_dlf_solrcores'); |
| 154 | 149 | // Encrypt core name. |
@@ -170,8 +165,7 @@ discard block |
||
| 170 | 165 | * |
| 171 | 166 | * @return string The extended search form or an empty string |
| 172 | 167 | */ |
| 173 | - protected function addExtendedSearch() |
|
| 174 | - { |
|
| 168 | + protected function addExtendedSearch() { |
|
| 175 | 169 | $extendedSearch = ''; |
| 176 | 170 | // Quit without doing anything if no fields for extended search are selected. |
| 177 | 171 | if ( |
@@ -209,8 +203,7 @@ discard block |
||
| 209 | 203 | * |
| 210 | 204 | * @return string HTML output of facets menu |
| 211 | 205 | */ |
| 212 | - protected function addFacetsMenu() |
|
| 213 | - { |
|
| 206 | + protected function addFacetsMenu() { |
|
| 214 | 207 | // Check for typoscript configuration to prevent fatal error. |
| 215 | 208 | if (empty($this->conf['facetsConf.'])) { |
| 216 | 209 | $this->logger->warning('Incomplete plugin configuration'); |
@@ -244,8 +237,7 @@ discard block |
||
| 244 | 237 | * |
| 245 | 238 | * @return string HTML output of fulltext switch |
| 246 | 239 | */ |
| 247 | - protected function addFulltextSwitch($isFulltextSearch = 0) |
|
| 248 | - { |
|
| 240 | + protected function addFulltextSwitch($isFulltextSearch = 0) { |
|
| 249 | 241 | $output = ''; |
| 250 | 242 | // Check for plugin configuration. |
| 251 | 243 | if (!empty($this->conf['fulltext'])) { |
@@ -264,8 +256,7 @@ discard block |
||
| 264 | 256 | * |
| 265 | 257 | * @return string HTML output of logical page field |
| 266 | 258 | */ |
| 267 | - protected function addLogicalPage() |
|
| 268 | - { |
|
| 259 | + protected function addLogicalPage() { |
|
| 269 | 260 | $output = ''; |
| 270 | 261 | // Check for plugin configuration. |
| 271 | 262 | if (!empty($this->conf['showLogicalPageField'])) { |
@@ -288,8 +279,7 @@ discard block |
||
| 288 | 279 | * |
| 289 | 280 | * @return array The array for the facet's menu entry |
| 290 | 281 | */ |
| 291 | - protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) |
|
| 292 | - { |
|
| 282 | + protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
| 293 | 283 | $entryArray = []; |
| 294 | 284 | // Translate value. |
| 295 | 285 | if ($field == 'owner_faceting') { |
@@ -345,8 +335,7 @@ discard block |
||
| 345 | 335 | * |
| 346 | 336 | * @return string The content that is displayed on the website |
| 347 | 337 | */ |
| 348 | - public function main($content, $conf) |
|
| 349 | - { |
|
| 338 | + public function main($content, $conf) { |
|
| 350 | 339 | $this->init($conf); |
| 351 | 340 | // Disable caching for this plugin. |
| 352 | 341 | $this->setCache(false); |
@@ -553,8 +542,7 @@ discard block |
||
| 553 | 542 | * |
| 554 | 543 | * @return array HMENU array |
| 555 | 544 | */ |
| 556 | - public function makeFacetsMenuArray($content, $conf) |
|
| 557 | - { |
|
| 545 | + public function makeFacetsMenuArray($content, $conf) { |
|
| 558 | 546 | $this->init($conf); |
| 559 | 547 | $menuArray = []; |
| 560 | 548 | // Set default value for facet search. |
@@ -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 (\TYPO3\CMS\Core\Utility\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) |