@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | * @subpackage dlf |
| 25 | 25 | * @access public |
| 26 | 26 | */ |
| 27 | -class SearchInDocumentTool extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 28 | -{ |
|
| 27 | +class SearchInDocumentTool extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 29 | 28 | public $scriptRelPath = 'Classes/Plugin/Tools/SearchInDocumentTool.php'; |
| 30 | 29 | |
| 31 | 30 | /** |
@@ -38,8 +37,7 @@ discard block |
||
| 38 | 37 | * |
| 39 | 38 | * @return string The content that is displayed on the website |
| 40 | 39 | */ |
| 41 | - public function main($content, $conf) |
|
| 42 | - { |
|
| 40 | + public function main($content, $conf) { |
|
| 43 | 41 | |
| 44 | 42 | $this->init($conf); |
| 45 | 43 | |
@@ -122,8 +120,7 @@ discard block |
||
| 122 | 120 | * |
| 123 | 121 | * @return void |
| 124 | 122 | */ |
| 125 | - protected function addSearchInDocumentJS() |
|
| 126 | - { |
|
| 123 | + protected function addSearchInDocumentJS() { |
|
| 127 | 124 | $pageRenderer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class); |
| 128 | 125 | $pageRenderer->addJsFooterFile(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)) . 'Resources/Public/Javascript/Search/SearchInDocument.js'); |
| 129 | 126 | } |
@@ -135,8 +132,7 @@ discard block |
||
| 135 | 132 | * |
| 136 | 133 | * @return string with encrypted core name |
| 137 | 134 | */ |
| 138 | - protected function getEncryptedCoreName() |
|
| 139 | - { |
|
| 135 | + protected function getEncryptedCoreName() { |
|
| 140 | 136 | // Get core name. |
| 141 | 137 | $name = Helper::getIndexNameFromUid($this->conf['solrcore'], 'tx_dlf_solrcores'); |
| 142 | 138 | // Encrypt core name. |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | * @subpackage dlf |
| 25 | 25 | * @access public |
| 26 | 26 | */ |
| 27 | -class Helper |
|
| 28 | -{ |
|
| 27 | +class Helper { |
|
| 29 | 28 | /** |
| 30 | 29 | * The extension key |
| 31 | 30 | * |
@@ -73,8 +72,7 @@ discard block |
||
| 73 | 72 | * |
| 74 | 73 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
| 75 | 74 | */ |
| 76 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
| 77 | - { |
|
| 75 | + public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') { |
|
| 78 | 76 | $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 79 | 77 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 80 | 78 | $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
@@ -99,8 +97,7 @@ discard block |
||
| 99 | 97 | * |
| 100 | 98 | * @return bool Is $id a valid GNL identifier of the given $type? |
| 101 | 99 | */ |
| 102 | - public static function checkIdentifier($id, $type) |
|
| 103 | - { |
|
| 100 | + public static function checkIdentifier($id, $type) { |
|
| 104 | 101 | $digits = substr($id, 0, 8); |
| 105 | 102 | $checksum = 0; |
| 106 | 103 | for ($i = 0, $j = strlen($digits); $i < $j; $i++) { |
@@ -164,8 +161,7 @@ discard block |
||
| 164 | 161 | * |
| 165 | 162 | * @return mixed The decrypted value or false on error |
| 166 | 163 | */ |
| 167 | - public static function decrypt($encrypted) |
|
| 168 | - { |
|
| 164 | + public static function decrypt($encrypted) { |
|
| 169 | 165 | if ( |
| 170 | 166 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 171 | 167 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -205,8 +201,7 @@ discard block |
||
| 205 | 201 | * |
| 206 | 202 | * @return void |
| 207 | 203 | */ |
| 208 | - public static function devLog($message, $severity = 0) |
|
| 209 | - { |
|
| 204 | + public static function devLog($message, $severity = 0) { |
|
| 210 | 205 | if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog'])) { |
| 211 | 206 | $stacktrace = debug_backtrace(0, 2); |
| 212 | 207 | // Set some defaults. |
@@ -246,8 +241,7 @@ discard block |
||
| 246 | 241 | * |
| 247 | 242 | * @return mixed Hashed string or false on error |
| 248 | 243 | */ |
| 249 | - public static function digest($string) |
|
| 250 | - { |
|
| 244 | + public static function digest($string) { |
|
| 251 | 245 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
| 252 | 246 | self::devLog('OpenSSL library doesn\'t support hash algorithm', DEVLOG_SEVERITY_ERROR); |
| 253 | 247 | return false; |
@@ -266,8 +260,7 @@ discard block |
||
| 266 | 260 | * |
| 267 | 261 | * @return mixed Encrypted string or false on error |
| 268 | 262 | */ |
| 269 | - public static function encrypt($string) |
|
| 270 | - { |
|
| 263 | + public static function encrypt($string) { |
|
| 271 | 264 | if ( |
| 272 | 265 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 273 | 266 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -300,8 +293,7 @@ discard block |
||
| 300 | 293 | * |
| 301 | 294 | * @return string The unqualified class name |
| 302 | 295 | */ |
| 303 | - public static function getUnqualifiedClassName($qualifiedClassname) |
|
| 304 | - { |
|
| 296 | + public static function getUnqualifiedClassName($qualifiedClassname) { |
|
| 305 | 297 | $nameParts = explode('\\', $qualifiedClassname); |
| 306 | 298 | return end($nameParts); |
| 307 | 299 | } |
@@ -315,8 +307,7 @@ discard block |
||
| 315 | 307 | * |
| 316 | 308 | * @return string The cleaned up string |
| 317 | 309 | */ |
| 318 | - public static function getCleanString($string) |
|
| 319 | - { |
|
| 310 | + public static function getCleanString($string) { |
|
| 320 | 311 | // Convert to lowercase. |
| 321 | 312 | $string = strtolower($string); |
| 322 | 313 | // Remove non-alphanumeric characters. |
@@ -337,8 +328,7 @@ discard block |
||
| 337 | 328 | * |
| 338 | 329 | * @return array Array of hook objects for the class |
| 339 | 330 | */ |
| 340 | - public static function getHookObjects($scriptRelPath) |
|
| 341 | - { |
|
| 331 | + public static function getHookObjects($scriptRelPath) { |
|
| 342 | 332 | $hookObjects = []; |
| 343 | 333 | if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
| 344 | 334 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
@@ -359,8 +349,7 @@ discard block |
||
| 359 | 349 | * |
| 360 | 350 | * @return string "index_name" for the given UID |
| 361 | 351 | */ |
| 362 | - public static function getIndexNameFromUid($uid, $table, $pid = -1) |
|
| 363 | - { |
|
| 352 | + public static function getIndexNameFromUid($uid, $table, $pid = -1) { |
|
| 364 | 353 | // Sanitize input. |
| 365 | 354 | $uid = max(intval($uid), 0); |
| 366 | 355 | if ( |
@@ -410,8 +399,7 @@ discard block |
||
| 410 | 399 | * |
| 411 | 400 | * @return string Localized full name of language or unchanged input |
| 412 | 401 | */ |
| 413 | - public static function getLanguageName($code) |
|
| 414 | - { |
|
| 402 | + public static function getLanguageName($code) { |
|
| 415 | 403 | // Analyze code and set appropriate ISO table. |
| 416 | 404 | $isoCode = strtolower(trim($code)); |
| 417 | 405 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
@@ -456,8 +444,7 @@ discard block |
||
| 456 | 444 | * |
| 457 | 445 | * @return string The translated string or the given key on failure |
| 458 | 446 | */ |
| 459 | - public static function getMessage($key, $hsc = false, $default = '') |
|
| 460 | - { |
|
| 447 | + public static function getMessage($key, $hsc = false, $default = '') { |
|
| 461 | 448 | // Set initial output to default value. |
| 462 | 449 | $translated = (string) $default; |
| 463 | 450 | // Load common messages file. |
@@ -499,8 +486,7 @@ discard block |
||
| 499 | 486 | * |
| 500 | 487 | * @return string "uid" for the given index_name |
| 501 | 488 | */ |
| 502 | - public static function getUidFromIndexName($index_name, $table, $pid = -1) |
|
| 503 | - { |
|
| 489 | + public static function getUidFromIndexName($index_name, $table, $pid = -1) { |
|
| 504 | 490 | if ( |
| 505 | 491 | !$index_name |
| 506 | 492 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
@@ -551,8 +537,7 @@ discard block |
||
| 551 | 537 | * |
| 552 | 538 | * @return string Uniform Resource Name as string |
| 553 | 539 | */ |
| 554 | - public static function getURN($base, $id) |
|
| 555 | - { |
|
| 540 | + public static function getURN($base, $id) { |
|
| 556 | 541 | $concordance = [ |
| 557 | 542 | '0' => 1, |
| 558 | 543 | '1' => 2, |
@@ -619,8 +604,7 @@ discard block |
||
| 619 | 604 | * |
| 620 | 605 | * @return bool Is $id a valid PPN? |
| 621 | 606 | */ |
| 622 | - public static function isPPN($id) |
|
| 623 | - { |
|
| 607 | + public static function isPPN($id) { |
|
| 624 | 608 | return self::checkIdentifier($id, 'PPN'); |
| 625 | 609 | } |
| 626 | 610 | |
@@ -633,8 +617,7 @@ discard block |
||
| 633 | 617 | * |
| 634 | 618 | * @return mixed Session value for given key or null on failure |
| 635 | 619 | */ |
| 636 | - public static function loadFromSession($key) |
|
| 637 | - { |
|
| 620 | + public static function loadFromSession($key) { |
|
| 638 | 621 | // Cast to string for security reasons. |
| 639 | 622 | $key = (string) $key; |
| 640 | 623 | if (!$key) { |
@@ -666,8 +649,7 @@ discard block |
||
| 666 | 649 | * |
| 667 | 650 | * @return array Merged array |
| 668 | 651 | */ |
| 669 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
| 670 | - { |
|
| 652 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) { |
|
| 671 | 653 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 672 | 654 | return $original; |
| 673 | 655 | } |
@@ -684,8 +666,7 @@ discard block |
||
| 684 | 666 | * |
| 685 | 667 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
| 686 | 668 | */ |
| 687 | - public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
| 688 | - { |
|
| 669 | + public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) { |
|
| 689 | 670 | if ( |
| 690 | 671 | \TYPO3_MODE === 'BE' |
| 691 | 672 | && $GLOBALS['BE_USER']->isAdmin() |
@@ -731,8 +712,7 @@ discard block |
||
| 731 | 712 | * |
| 732 | 713 | * @return string All flash messages in the queue rendered as HTML. |
| 733 | 714 | */ |
| 734 | - public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') |
|
| 735 | - { |
|
| 715 | + public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') { |
|
| 736 | 716 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 737 | 717 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 738 | 718 | $flashMessages = $flashMessageQueue->getAllMessagesAndFlush(); |
@@ -751,8 +731,7 @@ discard block |
||
| 751 | 731 | * |
| 752 | 732 | * @return bool true on success, false on failure |
| 753 | 733 | */ |
| 754 | - public static function saveToSession($value, $key) |
|
| 755 | - { |
|
| 734 | + public static function saveToSession($value, $key) { |
|
| 756 | 735 | // Cast to string for security reasons. |
| 757 | 736 | $key = (string) $key; |
| 758 | 737 | if (!$key) { |
@@ -784,8 +763,7 @@ discard block |
||
| 784 | 763 | * |
| 785 | 764 | * @return string Localized label for $index_name |
| 786 | 765 | */ |
| 787 | - public static function translate($index_name, $table, $pid) |
|
| 788 | - { |
|
| 766 | + public static function translate($index_name, $table, $pid) { |
|
| 789 | 767 | // Load labels into static variable for future use. |
| 790 | 768 | static $labels = []; |
| 791 | 769 | // Sanitize input. |
@@ -908,8 +886,7 @@ discard block |
||
| 908 | 886 | * |
| 909 | 887 | * @return string Additional WHERE expression |
| 910 | 888 | */ |
| 911 | - public static function whereExpression($table, $showHidden = false) |
|
| 912 | - { |
|
| 889 | + public static function whereExpression($table, $showHidden = false) { |
|
| 913 | 890 | if (\TYPO3_MODE === 'FE') { |
| 914 | 891 | // Should we ignore the record's hidden flag? |
| 915 | 892 | $ignoreHide = 0; |
@@ -938,8 +915,7 @@ discard block |
||
| 938 | 915 | * |
| 939 | 916 | * @access private |
| 940 | 917 | */ |
| 941 | - private function __construct() |
|
| 942 | - { |
|
| 918 | + private function __construct() { |
|
| 943 | 919 | // This is a static class, thus no instances should be created. |
| 944 | 920 | } |
| 945 | 921 | } |