@@ -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' |
@@ -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'])) { |
@@ -73,8 +71,7 @@ discard block |
||
| 73 | 71 | * |
| 74 | 72 | * @return string The type of the current document or 'undefined' |
| 75 | 73 | */ |
| 76 | - public function getDocumentType(int $cPid) |
|
| 77 | - { |
|
| 74 | + public function getDocumentType(int $cPid) { |
|
| 78 | 75 | $type = 'undefined'; |
| 79 | 76 | // Load document with current plugin parameters. |
| 80 | 77 | $doc = $this->loadDocument(GeneralUtility::_GPmerged($this->prefixId)); |
@@ -105,8 +102,7 @@ discard block |
||
| 105 | 102 | * |
| 106 | 103 | * @return \Kitodo\Dlf\Common\Document Instance of the current document |
| 107 | 104 | */ |
| 108 | - protected function loadDocument(array $piVars) |
|
| 109 | - { |
|
| 105 | + protected function loadDocument(array $piVars) { |
|
| 110 | 106 | // Check for required variable. |
| 111 | 107 | if (!empty($piVars['id'])) { |
| 112 | 108 | // Get instance of document. |
@@ -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) |
@@ -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 | // Get next available core name if none given. |
| 136 | 134 | if (empty($core)) { |
| 137 | 135 | $core = 'dlfCore' . self::getNextCoreNumber(); |
@@ -178,8 +176,7 @@ discard block |
||
| 178 | 176 | * |
| 179 | 177 | * @return string The escaped query string |
| 180 | 178 | */ |
| 181 | - public static function escapeQuery($query) |
|
| 182 | - { |
|
| 179 | + public static function escapeQuery($query) { |
|
| 183 | 180 | $helper = GeneralUtility::makeInstance(\Solarium\Core\Query\Helper::class); |
| 184 | 181 | // Escape query phrase or term. |
| 185 | 182 | if (preg_match('/^".*"$/', $query)) { |
@@ -202,8 +199,7 @@ discard block |
||
| 202 | 199 | * |
| 203 | 200 | * @return string The escaped query string |
| 204 | 201 | */ |
| 205 | - public static function escapeQueryKeepField($query, $pid) |
|
| 206 | - { |
|
| 202 | + public static function escapeQueryKeepField($query, $pid) { |
|
| 207 | 203 | // Is there a field query? |
| 208 | 204 | if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(?.*\)?$/', $query)) { |
| 209 | 205 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -255,8 +251,7 @@ discard block |
||
| 255 | 251 | * |
| 256 | 252 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
| 257 | 253 | */ |
| 258 | - public static function getInstance($core = null) |
|
| 259 | - { |
|
| 254 | + public static function getInstance($core = null) { |
|
| 260 | 255 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); |
| 261 | 256 | |
| 262 | 257 | // Get core name if UID is given. |
@@ -298,8 +293,7 @@ discard block |
||
| 298 | 293 | * |
| 299 | 294 | * @return int First unused core number found |
| 300 | 295 | */ |
| 301 | - public static function getNextCoreNumber($number = 0) |
|
| 302 | - { |
|
| 296 | + public static function getNextCoreNumber($number = 0) { |
|
| 303 | 297 | $number = max(intval($number), 0); |
| 304 | 298 | // Check if core already exists. |
| 305 | 299 | $solr = self::getInstance('dlfCore' . $number); |
@@ -317,8 +311,7 @@ discard block |
||
| 317 | 311 | * |
| 318 | 312 | * @return void |
| 319 | 313 | */ |
| 320 | - protected function loadSolrConnectionInfo() |
|
| 321 | - { |
|
| 314 | + protected function loadSolrConnectionInfo() { |
|
| 322 | 315 | if (empty($this->config)) { |
| 323 | 316 | $config = []; |
| 324 | 317 | // Extract extension configuration. |
@@ -356,8 +349,7 @@ discard block |
||
| 356 | 349 | * |
| 357 | 350 | * @return \Kitodo\Dlf\Common\DocumentList The result list |
| 358 | 351 | */ |
| 359 | - public function search() |
|
| 360 | - { |
|
| 352 | + public function search() { |
|
| 361 | 353 | $toplevel = []; |
| 362 | 354 | // Take over query parameters. |
| 363 | 355 | $params = $this->params; |
@@ -426,8 +418,7 @@ discard block |
||
| 426 | 418 | * |
| 427 | 419 | * @return array The Apache Solr Documents that were fetched |
| 428 | 420 | */ |
| 429 | - public function search_raw($query = '', $parameters = []) |
|
| 430 | - { |
|
| 421 | + public function search_raw($query = '', $parameters = []) { |
|
| 431 | 422 | // Set additional query parameters. |
| 432 | 423 | $parameters['start'] = 0; |
| 433 | 424 | $parameters['rows'] = $this->limit; |
@@ -459,8 +450,7 @@ discard block |
||
| 459 | 450 | * |
| 460 | 451 | * @return string|null The core name of the current query endpoint or null if core admin endpoint |
| 461 | 452 | */ |
| 462 | - protected function _getCore() |
|
| 463 | - { |
|
| 453 | + protected function _getCore() { |
|
| 464 | 454 | return $this->core; |
| 465 | 455 | } |
| 466 | 456 | |
@@ -471,8 +461,7 @@ discard block |
||
| 471 | 461 | * |
| 472 | 462 | * @return int The max number of results |
| 473 | 463 | */ |
| 474 | - protected function _getLimit() |
|
| 475 | - { |
|
| 464 | + protected function _getLimit() { |
|
| 476 | 465 | return $this->limit; |
| 477 | 466 | } |
| 478 | 467 | |
@@ -483,8 +472,7 @@ discard block |
||
| 483 | 472 | * |
| 484 | 473 | * @return int Total number of hits for last search |
| 485 | 474 | */ |
| 486 | - protected function _getNumberOfHits() |
|
| 487 | - { |
|
| 475 | + protected function _getNumberOfHits() { |
|
| 488 | 476 | return $this->numberOfHits; |
| 489 | 477 | } |
| 490 | 478 | |
@@ -495,8 +483,7 @@ discard block |
||
| 495 | 483 | * |
| 496 | 484 | * @return bool Is the search instantiated successfully? |
| 497 | 485 | */ |
| 498 | - protected function _getReady() |
|
| 499 | - { |
|
| 486 | + protected function _getReady() { |
|
| 500 | 487 | return $this->ready; |
| 501 | 488 | } |
| 502 | 489 | |
@@ -507,8 +494,7 @@ discard block |
||
| 507 | 494 | * |
| 508 | 495 | * @return \Solarium\Client Apache Solr service object |
| 509 | 496 | */ |
| 510 | - protected function _getService() |
|
| 511 | - { |
|
| 497 | + protected function _getService() { |
|
| 512 | 498 | return $this->service; |
| 513 | 499 | } |
| 514 | 500 | |
@@ -521,8 +507,7 @@ discard block |
||
| 521 | 507 | * |
| 522 | 508 | * @return void |
| 523 | 509 | */ |
| 524 | - protected function _setCPid($value) |
|
| 525 | - { |
|
| 510 | + protected function _setCPid($value) { |
|
| 526 | 511 | $this->cPid = max(intval($value), 0); |
| 527 | 512 | } |
| 528 | 513 | |
@@ -535,8 +520,7 @@ discard block |
||
| 535 | 520 | * |
| 536 | 521 | * @return void |
| 537 | 522 | */ |
| 538 | - protected function _setLimit($value) |
|
| 539 | - { |
|
| 523 | + protected function _setLimit($value) { |
|
| 540 | 524 | $this->limit = max(intval($value), 0); |
| 541 | 525 | } |
| 542 | 526 | |
@@ -549,8 +533,7 @@ discard block |
||
| 549 | 533 | * |
| 550 | 534 | * @return void |
| 551 | 535 | */ |
| 552 | - protected function _setParams(array $value) |
|
| 553 | - { |
|
| 536 | + protected function _setParams(array $value) { |
|
| 554 | 537 | $this->params = $value; |
| 555 | 538 | } |
| 556 | 539 | |
@@ -563,8 +546,7 @@ discard block |
||
| 563 | 546 | * |
| 564 | 547 | * @return mixed Value of $this->$var |
| 565 | 548 | */ |
| 566 | - public function __get($var) |
|
| 567 | - { |
|
| 549 | + public function __get($var) { |
|
| 568 | 550 | $method = '_get' . ucfirst($var); |
| 569 | 551 | if ( |
| 570 | 552 | !property_exists($this, $var) |
@@ -586,8 +568,7 @@ discard block |
||
| 586 | 568 | * |
| 587 | 569 | * @return bool true if variable is set and not empty, false otherwise |
| 588 | 570 | */ |
| 589 | - public function __isset($var) |
|
| 590 | - { |
|
| 571 | + public function __isset($var) { |
|
| 591 | 572 | return !empty($this->__get($var)); |
| 592 | 573 | } |
| 593 | 574 | |
@@ -601,8 +582,7 @@ discard block |
||
| 601 | 582 | * |
| 602 | 583 | * @return void |
| 603 | 584 | */ |
| 604 | - public function __set($var, $value) |
|
| 605 | - { |
|
| 585 | + public function __set($var, $value) { |
|
| 606 | 586 | $method = '_set' . ucfirst($var); |
| 607 | 587 | if ( |
| 608 | 588 | !property_exists($this, $var) |
@@ -623,8 +603,7 @@ discard block |
||
| 623 | 603 | * |
| 624 | 604 | * @return void |
| 625 | 605 | */ |
| 626 | - protected function __construct($core) |
|
| 627 | - { |
|
| 606 | + protected function __construct($core) { |
|
| 628 | 607 | // Get Solr connection parameters from configuration. |
| 629 | 608 | $this->loadSolrConnectionInfo(); |
| 630 | 609 | // Configure connection adapter. |
@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | * @subpackage dlf |
| 30 | 30 | * @access public |
| 31 | 31 | */ |
| 32 | -class Indexer |
|
| 33 | -{ |
|
| 32 | +class Indexer { |
|
| 34 | 33 | /** |
| 35 | 34 | * The extension key |
| 36 | 35 | * |
@@ -91,8 +90,7 @@ discard block |
||
| 91 | 90 | * |
| 92 | 91 | * @return int 0 on success or 1 on failure |
| 93 | 92 | */ |
| 94 | - public static function add(Document &$doc, $core = 0) |
|
| 95 | - { |
|
| 93 | + public static function add(Document &$doc, $core = 0) { |
|
| 96 | 94 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); |
| 97 | 95 | |
| 98 | 96 | if (in_array($doc->uid, self::$processedDocs)) { |
@@ -213,8 +211,7 @@ discard block |
||
| 213 | 211 | * |
| 214 | 212 | * @return string The field's dynamic index name |
| 215 | 213 | */ |
| 216 | - public static function getIndexFieldName($index_name, $pid = 0) |
|
| 217 | - { |
|
| 214 | + public static function getIndexFieldName($index_name, $pid = 0) { |
|
| 218 | 215 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); |
| 219 | 216 | |
| 220 | 217 | // Sanitize input. |
@@ -242,8 +239,7 @@ discard block |
||
| 242 | 239 | * |
| 243 | 240 | * @return void |
| 244 | 241 | */ |
| 245 | - protected static function loadIndexConf($pid) |
|
| 246 | - { |
|
| 242 | + protected static function loadIndexConf($pid) { |
|
| 247 | 243 | if (!self::$fieldsLoaded) { |
| 248 | 244 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 249 | 245 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
@@ -313,8 +309,7 @@ discard block |
||
| 313 | 309 | * |
| 314 | 310 | * @return int 0 on success or 1 on failure |
| 315 | 311 | */ |
| 316 | - protected static function processLogical(Document &$doc, array $logicalUnit) |
|
| 317 | - { |
|
| 312 | + protected static function processLogical(Document &$doc, array $logicalUnit) { |
|
| 318 | 313 | $errors = 0; |
| 319 | 314 | // Get metadata for logical unit. |
| 320 | 315 | $metadata = $doc->metadataArray[$logicalUnit['id']]; |
@@ -434,8 +429,7 @@ discard block |
||
| 434 | 429 | * |
| 435 | 430 | * @return int 0 on success or 1 on failure |
| 436 | 431 | */ |
| 437 | - protected static function processPhysical(Document &$doc, $page, array $physicalUnit) |
|
| 438 | - { |
|
| 432 | + protected static function processPhysical(Document &$doc, $page, array $physicalUnit) { |
|
| 439 | 433 | if ( |
| 440 | 434 | $doc->hasFulltext |
| 441 | 435 | && $fulltext = $doc->getRawText($physicalUnit['id']) |
@@ -520,8 +514,7 @@ discard block |
||
| 520 | 514 | * |
| 521 | 515 | * @return bool true on success or false on failure |
| 522 | 516 | */ |
| 523 | - protected static function solrConnect($core, $pid = 0) |
|
| 524 | - { |
|
| 517 | + protected static function solrConnect($core, $pid = 0) { |
|
| 525 | 518 | // Get Solr instance. |
| 526 | 519 | if (!self::$solr) { |
| 527 | 520 | // Connect to Solr server. |
@@ -544,8 +537,7 @@ discard block |
||
| 544 | 537 | * |
| 545 | 538 | * @access private |
| 546 | 539 | */ |
| 547 | - private function __construct() |
|
| 548 | - { |
|
| 540 | + private function __construct() { |
|
| 549 | 541 | // This is a static class, thus no instances should be created. |
| 550 | 542 | } |
| 551 | 543 | } |
@@ -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 ( |
@@ -402,8 +391,7 @@ discard block |
||
| 402 | 391 | * |
| 403 | 392 | * @return string Localized full name of language or unchanged input |
| 404 | 393 | */ |
| 405 | - public static function getLanguageName($code) |
|
| 406 | - { |
|
| 394 | + public static function getLanguageName($code) { |
|
| 407 | 395 | // Analyze code and set appropriate ISO table. |
| 408 | 396 | $isoCode = strtolower(trim($code)); |
| 409 | 397 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
@@ -448,8 +436,7 @@ discard block |
||
| 448 | 436 | * |
| 449 | 437 | * @return string The translated string or the given key on failure |
| 450 | 438 | */ |
| 451 | - public static function getMessage($key, $hsc = false, $default = '') |
|
| 452 | - { |
|
| 439 | + public static function getMessage($key, $hsc = false, $default = '') { |
|
| 453 | 440 | // Set initial output to default value. |
| 454 | 441 | $translated = (string) $default; |
| 455 | 442 | // Load common messages file. |
@@ -491,8 +478,7 @@ discard block |
||
| 491 | 478 | * |
| 492 | 479 | * @return string "uid" for the given index_name |
| 493 | 480 | */ |
| 494 | - public static function getUidFromIndexName($index_name, $table, $pid = -1) |
|
| 495 | - { |
|
| 481 | + public static function getUidFromIndexName($index_name, $table, $pid = -1) { |
|
| 496 | 482 | if ( |
| 497 | 483 | !$index_name |
| 498 | 484 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
@@ -543,8 +529,7 @@ discard block |
||
| 543 | 529 | * |
| 544 | 530 | * @return string Uniform Resource Name as string |
| 545 | 531 | */ |
| 546 | - public static function getURN($base, $id) |
|
| 547 | - { |
|
| 532 | + public static function getURN($base, $id) { |
|
| 548 | 533 | $concordance = [ |
| 549 | 534 | '0' => 1, |
| 550 | 535 | '1' => 2, |
@@ -611,8 +596,7 @@ discard block |
||
| 611 | 596 | * |
| 612 | 597 | * @return bool Is $id a valid PPN? |
| 613 | 598 | */ |
| 614 | - public static function isPPN($id) |
|
| 615 | - { |
|
| 599 | + public static function isPPN($id) { |
|
| 616 | 600 | return self::checkIdentifier($id, 'PPN'); |
| 617 | 601 | } |
| 618 | 602 | |
@@ -625,8 +609,7 @@ discard block |
||
| 625 | 609 | * |
| 626 | 610 | * @return mixed Session value for given key or null on failure |
| 627 | 611 | */ |
| 628 | - public static function loadFromSession($key) |
|
| 629 | - { |
|
| 612 | + public static function loadFromSession($key) { |
|
| 630 | 613 | // Cast to string for security reasons. |
| 631 | 614 | $key = (string) $key; |
| 632 | 615 | if (!$key) { |
@@ -658,8 +641,7 @@ discard block |
||
| 658 | 641 | * |
| 659 | 642 | * @return array Merged array |
| 660 | 643 | */ |
| 661 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
| 662 | - { |
|
| 644 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) { |
|
| 663 | 645 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 664 | 646 | return $original; |
| 665 | 647 | } |
@@ -676,8 +658,7 @@ discard block |
||
| 676 | 658 | * |
| 677 | 659 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
| 678 | 660 | */ |
| 679 | - public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
| 680 | - { |
|
| 661 | + public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) { |
|
| 681 | 662 | if ( |
| 682 | 663 | \TYPO3_MODE === 'BE' |
| 683 | 664 | && $GLOBALS['BE_USER']->isAdmin() |
@@ -723,8 +704,7 @@ discard block |
||
| 723 | 704 | * |
| 724 | 705 | * @return string All flash messages in the queue rendered as HTML. |
| 725 | 706 | */ |
| 726 | - public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') |
|
| 727 | - { |
|
| 707 | + public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') { |
|
| 728 | 708 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 729 | 709 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 730 | 710 | $flashMessages = $flashMessageQueue->getAllMessagesAndFlush(); |
@@ -743,8 +723,7 @@ discard block |
||
| 743 | 723 | * |
| 744 | 724 | * @return bool true on success, false on failure |
| 745 | 725 | */ |
| 746 | - public static function saveToSession($value, $key) |
|
| 747 | - { |
|
| 726 | + public static function saveToSession($value, $key) { |
|
| 748 | 727 | // Cast to string for security reasons. |
| 749 | 728 | $key = (string) $key; |
| 750 | 729 | if (!$key) { |
@@ -776,8 +755,7 @@ discard block |
||
| 776 | 755 | * |
| 777 | 756 | * @return string Localized label for $index_name |
| 778 | 757 | */ |
| 779 | - public static function translate($index_name, $table, $pid) |
|
| 780 | - { |
|
| 758 | + public static function translate($index_name, $table, $pid) { |
|
| 781 | 759 | // Load labels into static variable for future use. |
| 782 | 760 | static $labels = []; |
| 783 | 761 | // Sanitize input. |
@@ -900,8 +878,7 @@ discard block |
||
| 900 | 878 | * |
| 901 | 879 | * @return string Additional WHERE expression |
| 902 | 880 | */ |
| 903 | - public static function whereExpression($table, $showHidden = false) |
|
| 904 | - { |
|
| 881 | + public static function whereExpression($table, $showHidden = false) { |
|
| 905 | 882 | if (\TYPO3_MODE === 'FE') { |
| 906 | 883 | // Should we ignore the record's hidden flag? |
| 907 | 884 | $ignoreHide = 0; |
@@ -930,8 +907,7 @@ discard block |
||
| 930 | 907 | * |
| 931 | 908 | * @access private |
| 932 | 909 | */ |
| 933 | - private function __construct() |
|
| 934 | - { |
|
| 910 | + private function __construct() { |
|
| 935 | 911 | // This is a static class, thus no instances should be created. |
| 936 | 912 | } |
| 937 | 913 | } |
@@ -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 | // Remove when we don't need to support TYPO3 8.7 anymore. |
| 235 | 229 | if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version(), '9.0.0', '<')) { |
| 236 | 230 | return $this->pi_linkTP_fallback($str, $urlParameters, $cache, $altPageId); |
@@ -263,8 +257,7 @@ discard block |
||
| 263 | 257 | * |
| 264 | 258 | * @return string The input string wrapped in <a> tags |
| 265 | 259 | */ |
| 266 | - public function pi_linkTP_fallback($str, $urlParameters = [], $cache = false, $altPageId = 0) |
|
| 267 | - { |
|
| 260 | + public function pi_linkTP_fallback($str, $urlParameters = [], $cache = false, $altPageId = 0) { |
|
| 268 | 261 | $conf = []; |
| 269 | 262 | $conf['useCacheHash'] = $this->pi_USER_INT_obj ? 0 : $cache; |
| 270 | 263 | $conf['no_cache'] = $this->pi_USER_INT_obj ? 0 : !$cache; |
@@ -286,8 +279,7 @@ discard block |
||
| 286 | 279 | * |
| 287 | 280 | * @return string HTML content wrapped, ready to return to the parent object. |
| 288 | 281 | */ |
| 289 | - public function pi_wrapInBaseClass($content) |
|
| 290 | - { |
|
| 282 | + public function pi_wrapInBaseClass($content) { |
|
| 291 | 283 | if (!$this->frontendController->config['config']['disableWrapInBaseClass']) { |
| 292 | 284 | // Use class name instead of $this->prefixId for content wrapping because $this->prefixId is the same for all plugins. |
| 293 | 285 | $content = '<div class="tx-dlf-' . strtolower(Helper::getUnqualifiedClassName(get_class($this))) . '">' . $content . '</div>'; |
@@ -307,8 +299,7 @@ discard block |
||
| 307 | 299 | * |
| 308 | 300 | * @return void |
| 309 | 301 | */ |
| 310 | - protected function setCache($cache = true) |
|
| 311 | - { |
|
| 302 | + protected function setCache($cache = true) { |
|
| 312 | 303 | if ($cache) { |
| 313 | 304 | // Set cObject type to "USER" (default). |
| 314 | 305 | $this->pi_USER_INT_obj = false; |