@@ -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)) |
@@ -204,8 +200,7 @@ discard block |
||
| 204 | 200 | * |
| 205 | 201 | * @return mixed |
| 206 | 202 | */ |
| 207 | - public static function getXmlFileAsString($content) |
|
| 208 | - { |
|
| 203 | + public static function getXmlFileAsString($content) { |
|
| 209 | 204 | // Turn off libxml's error logging. |
| 210 | 205 | $libxmlErrors = libxml_use_internal_errors(true); |
| 211 | 206 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
@@ -230,8 +225,7 @@ discard block |
||
| 230 | 225 | * |
| 231 | 226 | * @return void |
| 232 | 227 | */ |
| 233 | - public static function log($message, $severity = 0) |
|
| 234 | - { |
|
| 228 | + public static function log($message, $severity = 0) { |
|
| 235 | 229 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_called_class()); |
| 236 | 230 | |
| 237 | 231 | switch ($severity) { |
@@ -261,8 +255,7 @@ discard block |
||
| 261 | 255 | * |
| 262 | 256 | * @return mixed Hashed string or false on error |
| 263 | 257 | */ |
| 264 | - public static function digest($string) |
|
| 265 | - { |
|
| 258 | + public static function digest($string) { |
|
| 266 | 259 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
| 267 | 260 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
| 268 | 261 | return false; |
@@ -281,8 +274,7 @@ discard block |
||
| 281 | 274 | * |
| 282 | 275 | * @return mixed Encrypted string or false on error |
| 283 | 276 | */ |
| 284 | - public static function encrypt($string) |
|
| 285 | - { |
|
| 277 | + public static function encrypt($string) { |
|
| 286 | 278 | if ( |
| 287 | 279 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 288 | 280 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -315,8 +307,7 @@ discard block |
||
| 315 | 307 | * |
| 316 | 308 | * @return string The unqualified class name |
| 317 | 309 | */ |
| 318 | - public static function getUnqualifiedClassName($qualifiedClassname) |
|
| 319 | - { |
|
| 310 | + public static function getUnqualifiedClassName($qualifiedClassname) { |
|
| 320 | 311 | $nameParts = explode('\\', $qualifiedClassname); |
| 321 | 312 | return end($nameParts); |
| 322 | 313 | } |
@@ -330,8 +321,7 @@ discard block |
||
| 330 | 321 | * |
| 331 | 322 | * @return string The cleaned up string |
| 332 | 323 | */ |
| 333 | - public static function getCleanString($string) |
|
| 334 | - { |
|
| 324 | + public static function getCleanString($string) { |
|
| 335 | 325 | // Convert to lowercase. |
| 336 | 326 | $string = strtolower($string); |
| 337 | 327 | // Remove non-alphanumeric characters. |
@@ -352,8 +342,7 @@ discard block |
||
| 352 | 342 | * |
| 353 | 343 | * @return array Array of hook objects for the class |
| 354 | 344 | */ |
| 355 | - public static function getHookObjects($scriptRelPath) |
|
| 356 | - { |
|
| 345 | + public static function getHookObjects($scriptRelPath) { |
|
| 357 | 346 | $hookObjects = []; |
| 358 | 347 | if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
| 359 | 348 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
@@ -374,8 +363,7 @@ discard block |
||
| 374 | 363 | * |
| 375 | 364 | * @return string "index_name" for the given UID |
| 376 | 365 | */ |
| 377 | - public static function getIndexNameFromUid($uid, $table, $pid = -1) |
|
| 378 | - { |
|
| 366 | + public static function getIndexNameFromUid($uid, $table, $pid = -1) { |
|
| 379 | 367 | // Sanitize input. |
| 380 | 368 | $uid = max(intval($uid), 0); |
| 381 | 369 | if ( |
@@ -427,8 +415,7 @@ discard block |
||
| 427 | 415 | * |
| 428 | 416 | * @return string "label" for the given UID |
| 429 | 417 | */ |
| 430 | - public static function getLabelFromUid($uid, $table, $pid = -1) |
|
| 431 | - { |
|
| 418 | + public static function getLabelFromUid($uid, $table, $pid = -1) { |
|
| 432 | 419 | // Sanitize input. |
| 433 | 420 | $uid = max(intval($uid), 0); |
| 434 | 421 | if ( |
@@ -478,8 +465,7 @@ discard block |
||
| 478 | 465 | * |
| 479 | 466 | * @return string Localized full name of language or unchanged input |
| 480 | 467 | */ |
| 481 | - public static function getLanguageName($code) |
|
| 482 | - { |
|
| 468 | + public static function getLanguageName($code) { |
|
| 483 | 469 | // Analyze code and set appropriate ISO table. |
| 484 | 470 | $isoCode = strtolower(trim($code)); |
| 485 | 471 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
@@ -524,8 +510,7 @@ discard block |
||
| 524 | 510 | * |
| 525 | 511 | * @return string The translated string or the given key on failure |
| 526 | 512 | */ |
| 527 | - public static function getMessage($key, $hsc = false, $default = '') |
|
| 528 | - { |
|
| 513 | + public static function getMessage($key, $hsc = false, $default = '') { |
|
| 529 | 514 | // Set initial output to default value. |
| 530 | 515 | $translated = (string) $default; |
| 531 | 516 | // Load common messages file. |
@@ -567,8 +552,7 @@ discard block |
||
| 567 | 552 | * |
| 568 | 553 | * @return string "uid" for the given index_name |
| 569 | 554 | */ |
| 570 | - public static function getUidFromIndexName($index_name, $table, $pid = -1) |
|
| 571 | - { |
|
| 555 | + public static function getUidFromIndexName($index_name, $table, $pid = -1) { |
|
| 572 | 556 | if ( |
| 573 | 557 | !$index_name |
| 574 | 558 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
@@ -619,8 +603,7 @@ discard block |
||
| 619 | 603 | * |
| 620 | 604 | * @return string Uniform Resource Name as string |
| 621 | 605 | */ |
| 622 | - public static function getURN($base, $id) |
|
| 623 | - { |
|
| 606 | + public static function getURN($base, $id) { |
|
| 624 | 607 | $concordance = [ |
| 625 | 608 | '0' => 1, |
| 626 | 609 | '1' => 2, |
@@ -687,8 +670,7 @@ discard block |
||
| 687 | 670 | * |
| 688 | 671 | * @return bool Is $id a valid PPN? |
| 689 | 672 | */ |
| 690 | - public static function isPPN($id) |
|
| 691 | - { |
|
| 673 | + public static function isPPN($id) { |
|
| 692 | 674 | return self::checkIdentifier($id, 'PPN'); |
| 693 | 675 | } |
| 694 | 676 | |
@@ -699,8 +681,7 @@ discard block |
||
| 699 | 681 | * |
| 700 | 682 | * @return bool |
| 701 | 683 | */ |
| 702 | - public static function isValidHttpUrl($url) |
|
| 703 | - { |
|
| 684 | + public static function isValidHttpUrl($url) { |
|
| 704 | 685 | if (!GeneralUtility::isValidUrl($url)) { |
| 705 | 686 | return false; |
| 706 | 687 | } |
@@ -721,8 +702,7 @@ discard block |
||
| 721 | 702 | * |
| 722 | 703 | * @return mixed Session value for given key or null on failure |
| 723 | 704 | */ |
| 724 | - public static function loadFromSession($key) |
|
| 725 | - { |
|
| 705 | + public static function loadFromSession($key) { |
|
| 726 | 706 | // Cast to string for security reasons. |
| 727 | 707 | $key = (string) $key; |
| 728 | 708 | if (!$key) { |
@@ -754,8 +734,7 @@ discard block |
||
| 754 | 734 | * |
| 755 | 735 | * @return array Merged array |
| 756 | 736 | */ |
| 757 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
| 758 | - { |
|
| 737 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) { |
|
| 759 | 738 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 760 | 739 | return $original; |
| 761 | 740 | } |
@@ -772,8 +751,7 @@ discard block |
||
| 772 | 751 | * |
| 773 | 752 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
| 774 | 753 | */ |
| 775 | - public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
| 776 | - { |
|
| 754 | + public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) { |
|
| 777 | 755 | if ( |
| 778 | 756 | \TYPO3_MODE === 'BE' |
| 779 | 757 | && $GLOBALS['BE_USER']->isAdmin() |
@@ -819,8 +797,7 @@ discard block |
||
| 819 | 797 | * |
| 820 | 798 | * @return string All flash messages in the queue rendered as HTML. |
| 821 | 799 | */ |
| 822 | - public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') |
|
| 823 | - { |
|
| 800 | + public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') { |
|
| 824 | 801 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 825 | 802 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 826 | 803 | $flashMessages = $flashMessageQueue->getAllMessagesAndFlush(); |
@@ -839,8 +816,7 @@ discard block |
||
| 839 | 816 | * |
| 840 | 817 | * @return bool true on success, false on failure |
| 841 | 818 | */ |
| 842 | - public static function saveToSession($value, $key) |
|
| 843 | - { |
|
| 819 | + public static function saveToSession($value, $key) { |
|
| 844 | 820 | // Cast to string for security reasons. |
| 845 | 821 | $key = (string) $key; |
| 846 | 822 | if (!$key) { |
@@ -872,8 +848,7 @@ discard block |
||
| 872 | 848 | * |
| 873 | 849 | * @return string Localized label for $index_name |
| 874 | 850 | */ |
| 875 | - public static function translate($index_name, $table, $pid) |
|
| 876 | - { |
|
| 851 | + public static function translate($index_name, $table, $pid) { |
|
| 877 | 852 | // Load labels into static variable for future use. |
| 878 | 853 | static $labels = []; |
| 879 | 854 | // Sanitize input. |
@@ -996,8 +971,7 @@ discard block |
||
| 996 | 971 | * |
| 997 | 972 | * @return string Additional WHERE expression |
| 998 | 973 | */ |
| 999 | - public static function whereExpression($table, $showHidden = false) |
|
| 1000 | - { |
|
| 974 | + public static function whereExpression($table, $showHidden = false) { |
|
| 1001 | 975 | if (\TYPO3_MODE === 'FE') { |
| 1002 | 976 | // Should we ignore the record's hidden flag? |
| 1003 | 977 | $ignoreHide = 0; |
@@ -1026,8 +1000,7 @@ discard block |
||
| 1026 | 1000 | * |
| 1027 | 1001 | * @access private |
| 1028 | 1002 | */ |
| 1029 | - private function __construct() |
|
| 1030 | - { |
|
| 1003 | + private function __construct() { |
|
| 1031 | 1004 | // This is a static class, thus no instances should be created. |
| 1032 | 1005 | } |
| 1033 | 1006 | } |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage dlf |
| 26 | 26 | * @access public |
| 27 | 27 | */ |
| 28 | -class PageViewProxy |
|
| 29 | -{ |
|
| 28 | +class PageViewProxy { |
|
| 30 | 29 | /** |
| 31 | 30 | * The main method of the eID script |
| 32 | 31 | * |
@@ -35,8 +34,7 @@ discard block |
||
| 35 | 34 | * @param ServerRequestInterface $request |
| 36 | 35 | * @return ResponseInterface |
| 37 | 36 | */ |
| 38 | - public function main(ServerRequestInterface $request) |
|
| 39 | - { |
|
| 37 | + public function main(ServerRequestInterface $request) { |
|
| 40 | 38 | // the URI to fetch data or header from |
| 41 | 39 | $url = (string) $request->getQueryParams()['url']; |
| 42 | 40 | if (!Helper::isValidHttpUrl($url)) { |