@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) { |
137 | 137 | return false; |
138 | 138 | } elseif ($checksum == 10) { |
139 | - return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
|
139 | + return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD'); |
|
140 | 140 | } elseif (substr($id, -1, 1) != $checksum) { |
141 | 141 | return false; |
142 | 142 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
279 | 279 | // Merge initialisation vector and encrypted data. |
280 | 280 | if ($encrypted !== false) { |
281 | - $encrypted = base64_encode($iv . $encrypted); |
|
281 | + $encrypted = base64_encode($iv.$encrypted); |
|
282 | 282 | } |
283 | 283 | return $encrypted; |
284 | 284 | } |
@@ -332,8 +332,8 @@ discard block |
||
332 | 332 | public static function getHookObjects($scriptRelPath) |
333 | 333 | { |
334 | 334 | $hookObjects = []; |
335 | - if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
|
336 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
|
335 | + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) { |
|
336 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) { |
|
337 | 337 | $hookObjects[] = GeneralUtility::makeInstance($classRef); |
338 | 338 | } |
339 | 339 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | !$uid |
360 | 360 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
361 | 361 | ) { |
362 | - self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
362 | + self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
363 | 363 | return ''; |
364 | 364 | } |
365 | 365 | |
@@ -370,15 +370,15 @@ discard block |
||
370 | 370 | // Should we check for a specific PID, too? |
371 | 371 | if ($pid !== -1) { |
372 | 372 | $pid = max(intval($pid), 0); |
373 | - $where = $queryBuilder->expr()->eq($table . '.pid', $pid); |
|
373 | + $where = $queryBuilder->expr()->eq($table.'.pid', $pid); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | // Get index_name from database. |
377 | 377 | $result = $queryBuilder |
378 | - ->select($table . '.index_name AS index_name') |
|
378 | + ->select($table.'.index_name AS index_name') |
|
379 | 379 | ->from($table) |
380 | 380 | ->where( |
381 | - $queryBuilder->expr()->eq($table . '.uid', $uid), |
|
381 | + $queryBuilder->expr()->eq($table.'.uid', $uid), |
|
382 | 382 | $where, |
383 | 383 | self::whereExpression($table) |
384 | 384 | ) |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | if ($resArray = $result->fetch()) { |
389 | 389 | return $resArray['index_name']; |
390 | 390 | } else { |
391 | - self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
391 | + self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
392 | 392 | return ''; |
393 | 393 | } |
394 | 394 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | !$uid |
413 | 413 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
414 | 414 | ) { |
415 | - self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
415 | + self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
416 | 416 | return ''; |
417 | 417 | } |
418 | 418 | |
@@ -423,15 +423,15 @@ discard block |
||
423 | 423 | // Should we check for a specific PID, too? |
424 | 424 | if ($pid !== -1) { |
425 | 425 | $pid = max(intval($pid), 0); |
426 | - $where = $queryBuilder->expr()->eq($table . '.pid', $pid); |
|
426 | + $where = $queryBuilder->expr()->eq($table.'.pid', $pid); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | // Get label from database. |
430 | 430 | $result = $queryBuilder |
431 | - ->select($table . '.label AS label') |
|
431 | + ->select($table.'.label AS label') |
|
432 | 432 | ->from($table) |
433 | 433 | ->where( |
434 | - $queryBuilder->expr()->eq($table . '.uid', $uid), |
|
434 | + $queryBuilder->expr()->eq($table.'.uid', $uid), |
|
435 | 435 | $where, |
436 | 436 | self::whereExpression($table) |
437 | 437 | ) |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | if ($resArray = $result->fetch()) { |
442 | 442 | return $resArray['label']; |
443 | 443 | } else { |
444 | - self::log('No "label" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
444 | + self::log('No "label" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
445 | 445 | return ''; |
446 | 446 | } |
447 | 447 | } |
@@ -460,9 +460,9 @@ discard block |
||
460 | 460 | // Analyze code and set appropriate ISO table. |
461 | 461 | $isoCode = strtolower(trim($code)); |
462 | 462 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
463 | - $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-2b.xml'; |
|
463 | + $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-2b.xml'; |
|
464 | 464 | } elseif (preg_match('/^[a-z]{2}$/', $isoCode)) { |
465 | - $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-1.xml'; |
|
465 | + $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-1.xml'; |
|
466 | 466 | } else { |
467 | 467 | // No ISO code, return unchanged. |
468 | 468 | return $code; |
@@ -479,13 +479,13 @@ discard block |
||
479 | 479 | $lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639); |
480 | 480 | } |
481 | 481 | } else { |
482 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
482 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
483 | 483 | return $code; |
484 | 484 | } |
485 | 485 | if (!empty($lang)) { |
486 | 486 | return $lang; |
487 | 487 | } else { |
488 | - self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
488 | + self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
489 | 489 | return $code; |
490 | 490 | } |
491 | 491 | } |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | } elseif (\TYPO3_MODE === 'BE') { |
514 | 514 | self::$messages = $GLOBALS['LANG']->includeLLFile($file, false, true); |
515 | 515 | } else { |
516 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
516 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
517 | 517 | } |
518 | 518 | } |
519 | 519 | // Get translation. |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | } elseif (\TYPO3_MODE === 'BE') { |
524 | 524 | $translated = $GLOBALS['LANG']->getLLL($key, self::$messages); |
525 | 525 | } else { |
526 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
526 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
527 | 527 | } |
528 | 528 | } |
529 | 529 | // Escape HTML characters if applicable. |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | !$index_name |
551 | 551 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
552 | 552 | ) { |
553 | - self::log('Invalid UID ' . $index_name . ' or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
553 | + self::log('Invalid UID '.$index_name.' or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
554 | 554 | return ''; |
555 | 555 | } |
556 | 556 | |
@@ -561,14 +561,14 @@ discard block |
||
561 | 561 | // Should we check for a specific PID, too? |
562 | 562 | if ($pid !== -1) { |
563 | 563 | $pid = max(intval($pid), 0); |
564 | - $where = $queryBuilder->expr()->eq($table . '.pid', $pid); |
|
564 | + $where = $queryBuilder->expr()->eq($table.'.pid', $pid); |
|
565 | 565 | } |
566 | 566 | // Get index_name from database. |
567 | 567 | $result = $queryBuilder |
568 | - ->select($table . '.uid AS uid') |
|
568 | + ->select($table.'.uid AS uid') |
|
569 | 569 | ->from($table) |
570 | 570 | ->where( |
571 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
|
571 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)), |
|
572 | 572 | $where, |
573 | 573 | self::whereExpression($table) |
574 | 574 | ) |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | if (count($allResults) == 1) { |
581 | 581 | return $allResults[0]['uid']; |
582 | 582 | } else { |
583 | - self::log('No UID for given index_name "' . $index_name . '" and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
583 | + self::log('No UID for given index_name "'.$index_name.'" and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
584 | 584 | return ''; |
585 | 585 | } |
586 | 586 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | '-' => 39, |
639 | 639 | ':' => 17, |
640 | 640 | ]; |
641 | - $urn = strtolower($base . $id); |
|
641 | + $urn = strtolower($base.$id); |
|
642 | 642 | if (preg_match('/[^a-z0-9:-]/', $urn)) { |
643 | 643 | self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING); |
644 | 644 | return ''; |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | $checksum += ($i + 1) * intval(substr($digits, $i, 1)); |
653 | 653 | } |
654 | 654 | $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1); |
655 | - return $base . $id . $checksum; |
|
655 | + return $base.$id.$checksum; |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | /** |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | // Cast to string for security reasons. |
684 | 684 | $key = (string) $key; |
685 | 685 | if (!$key) { |
686 | - self::log('Invalid key "' . $key . '" for session data retrieval', LOG_SEVERITY_WARNING); |
|
686 | + self::log('Invalid key "'.$key.'" for session data retrieval', LOG_SEVERITY_WARNING); |
|
687 | 687 | return; |
688 | 688 | } |
689 | 689 | // Get the session data. |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | } elseif (\TYPO3_MODE === 'BE') { |
693 | 693 | return $GLOBALS['BE_USER']->getSessionData($key); |
694 | 694 | } else { |
695 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
695 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
696 | 696 | return; |
697 | 697 | } |
698 | 698 | } |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | // Cast to string for security reasons. |
802 | 802 | $key = (string) $key; |
803 | 803 | if (!$key) { |
804 | - self::log('Invalid key "' . $key . '" for session data saving', LOG_SEVERITY_WARNING); |
|
804 | + self::log('Invalid key "'.$key.'" for session data saving', LOG_SEVERITY_WARNING); |
|
805 | 805 | return false; |
806 | 806 | } |
807 | 807 | // Save value in session data. |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | $GLOBALS['BE_USER']->setAndSaveSessionData($key, $value); |
814 | 814 | return true; |
815 | 815 | } else { |
816 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
816 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
817 | 817 | return false; |
818 | 818 | } |
819 | 819 | } |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | // Sanitize input. |
837 | 837 | $pid = max(intval($pid), 0); |
838 | 838 | if (!$pid) { |
839 | - self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING); |
|
839 | + self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING); |
|
840 | 840 | return $index_name; |
841 | 841 | } |
842 | 842 | // Check if "index_name" is an UID. |
@@ -853,13 +853,13 @@ discard block |
||
853 | 853 | // First fetch the uid of the received index_name |
854 | 854 | $result = $queryBuilder |
855 | 855 | ->select( |
856 | - $table . '.uid AS uid', |
|
857 | - $table . '.l18n_parent AS l18n_parent' |
|
856 | + $table.'.uid AS uid', |
|
857 | + $table.'.l18n_parent AS l18n_parent' |
|
858 | 858 | ) |
859 | 859 | ->from($table) |
860 | 860 | ->where( |
861 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
862 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
|
861 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
862 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)), |
|
863 | 863 | self::whereExpression($table, true) |
864 | 864 | ) |
865 | 865 | ->setMaxResults(1) |
@@ -872,12 +872,12 @@ discard block |
||
872 | 872 | $resArray = $allResults[0]; |
873 | 873 | |
874 | 874 | $result = $queryBuilder |
875 | - ->select($table . '.index_name AS index_name') |
|
875 | + ->select($table.'.index_name AS index_name') |
|
876 | 876 | ->from($table) |
877 | 877 | ->where( |
878 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
879 | - $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
|
880 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)), |
|
878 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
879 | + $queryBuilder->expr()->eq($table.'.uid', $resArray['l18n_parent']), |
|
880 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)), |
|
881 | 881 | self::whereExpression($table, true) |
882 | 882 | ) |
883 | 883 | ->setMaxResults(1) |
@@ -895,14 +895,14 @@ discard block |
||
895 | 895 | if (empty($labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$index_name])) { |
896 | 896 | // Check if this table is allowed for translation. |
897 | 897 | if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) { |
898 | - $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]); |
|
898 | + $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]); |
|
899 | 899 | if ($GLOBALS['TSFE']->sys_language_content > 0) { |
900 | 900 | $additionalWhere = $queryBuilder->expr()->andX( |
901 | 901 | $queryBuilder->expr()->orX( |
902 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
903 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)) |
|
902 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
903 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)) |
|
904 | 904 | ), |
905 | - $queryBuilder->expr()->eq($table . '.l18n_parent', 0) |
|
905 | + $queryBuilder->expr()->eq($table.'.l18n_parent', 0) |
|
906 | 906 | ); |
907 | 907 | } |
908 | 908 | |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | ->select('*') |
912 | 912 | ->from($table) |
913 | 913 | ->where( |
914 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
914 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
915 | 915 | $additionalWhere, |
916 | 916 | self::whereExpression($table, true) |
917 | 917 | ) |
@@ -929,10 +929,10 @@ discard block |
||
929 | 929 | } |
930 | 930 | } |
931 | 931 | } else { |
932 | - self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
932 | + self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
933 | 933 | } |
934 | 934 | } else { |
935 | - self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
935 | + self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
936 | 936 | } |
937 | 937 | } |
938 | 938 | |
@@ -971,9 +971,9 @@ discard block |
||
971 | 971 | return GeneralUtility::makeInstance(ConnectionPool::class) |
972 | 972 | ->getQueryBuilderForTable($table) |
973 | 973 | ->expr() |
974 | - ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
974 | + ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
975 | 975 | } else { |
976 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
976 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
977 | 977 | return '1=-1'; |
978 | 978 | } |
979 | 979 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
76 | 76 | */ |
77 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
77 | + public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages') |
|
78 | 78 | { |
79 | 79 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
80 | 80 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | $checksum = 'X'; |
117 | 117 | } |
118 | 118 | if (!preg_match('/[0-9]{8}[0-9X]{1}/i', $id)) { |
119 | - return false; |
|
119 | + return FALSE; |
|
120 | 120 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
121 | - return false; |
|
121 | + return FALSE; |
|
122 | 122 | } |
123 | 123 | break; |
124 | 124 | case 'ZDB': |
@@ -126,19 +126,19 @@ discard block |
||
126 | 126 | $checksum = 'X'; |
127 | 127 | } |
128 | 128 | if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) { |
129 | - return false; |
|
129 | + return FALSE; |
|
130 | 130 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
131 | - return false; |
|
131 | + return FALSE; |
|
132 | 132 | } |
133 | 133 | break; |
134 | 134 | case 'SWD': |
135 | 135 | $checksum = 11 - $checksum; |
136 | 136 | if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) { |
137 | - return false; |
|
137 | + return FALSE; |
|
138 | 138 | } elseif ($checksum == 10) { |
139 | 139 | return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
140 | 140 | } elseif (substr($id, -1, 1) != $checksum) { |
141 | - return false; |
|
141 | + return FALSE; |
|
142 | 142 | } |
143 | 143 | break; |
144 | 144 | case 'GKD': |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | $checksum = 'X'; |
148 | 148 | } |
149 | 149 | if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) { |
150 | - return false; |
|
150 | + return FALSE; |
|
151 | 151 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
152 | - return false; |
|
152 | + return FALSE; |
|
153 | 153 | } |
154 | 154 | break; |
155 | 155 | } |
156 | - return true; |
|
156 | + return TRUE; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -168,28 +168,28 @@ discard block |
||
168 | 168 | public static function decrypt($encrypted) |
169 | 169 | { |
170 | 170 | if ( |
171 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
172 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
171 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
172 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
173 | 173 | ) { |
174 | 174 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
175 | - return false; |
|
175 | + return FALSE; |
|
176 | 176 | } |
177 | 177 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
178 | 178 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
179 | - return false; |
|
179 | + return FALSE; |
|
180 | 180 | } |
181 | 181 | if ( |
182 | 182 | empty($encrypted) |
183 | 183 | || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm) |
184 | 184 | ) { |
185 | 185 | self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR); |
186 | - return false; |
|
186 | + return FALSE; |
|
187 | 187 | } |
188 | 188 | // Split initialisation vector and encrypted data. |
189 | 189 | $binary = base64_decode($encrypted); |
190 | 190 | $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
191 | 191 | $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
192 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
192 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
193 | 193 | // Decrypt data. |
194 | 194 | $decrypted = openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
195 | 195 | return $decrypted; |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | public static function getXmlFileAsString($content) |
208 | 208 | { |
209 | 209 | // Turn off libxml's error logging. |
210 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
210 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
211 | 211 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
212 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
212 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
213 | 213 | // Try to load XML from file. |
214 | 214 | $xml = simplexml_load_string($content); |
215 | 215 | // reset entity loader setting |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public static function digest($string) |
266 | 266 | { |
267 | - if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
|
267 | + if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) { |
|
268 | 268 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
269 | - return false; |
|
269 | + return FALSE; |
|
270 | 270 | } |
271 | 271 | // Hash string. |
272 | 272 | $hashed = openssl_digest($string, self::$hashAlgorithm); |
@@ -285,23 +285,23 @@ discard block |
||
285 | 285 | public static function encrypt($string) |
286 | 286 | { |
287 | 287 | if ( |
288 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
289 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
288 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
289 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
290 | 290 | ) { |
291 | 291 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
292 | - return false; |
|
292 | + return FALSE; |
|
293 | 293 | } |
294 | 294 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
295 | 295 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
296 | - return false; |
|
296 | + return FALSE; |
|
297 | 297 | } |
298 | 298 | // Generate random initialisation vector. |
299 | 299 | $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm)); |
300 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
300 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
301 | 301 | // Encrypt data. |
302 | 302 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
303 | 303 | // Merge initialisation vector and encrypted data. |
304 | - if ($encrypted !== false) { |
|
304 | + if ($encrypted !== FALSE) { |
|
305 | 305 | $encrypted = base64_encode($iv . $encrypted); |
306 | 306 | } |
307 | 307 | return $encrypted; |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | $lang = $GLOBALS['TSFE']->getLLL($isoCode, $iso639); |
499 | 499 | } |
500 | 500 | } elseif (\TYPO3_MODE === 'BE') { |
501 | - $iso639 = $GLOBALS['LANG']->includeLLFile($file, false, true); |
|
501 | + $iso639 = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE); |
|
502 | 502 | if (!empty($iso639['default'][$isoCode])) { |
503 | 503 | $lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639); |
504 | 504 | } |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * |
526 | 526 | * @return string The translated string or the given key on failure |
527 | 527 | */ |
528 | - public static function getMessage($key, $hsc = false, $default = '') |
|
528 | + public static function getMessage($key, $hsc = FALSE, $default = '') |
|
529 | 529 | { |
530 | 530 | // Set initial output to default value. |
531 | 531 | $translated = (string) $default; |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | if (\TYPO3_MODE === 'FE') { |
536 | 536 | self::$messages = $GLOBALS['TSFE']->readLLfile($file); |
537 | 537 | } elseif (\TYPO3_MODE === 'BE') { |
538 | - self::$messages = $GLOBALS['LANG']->includeLLFile($file, false, true); |
|
538 | + self::$messages = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE); |
|
539 | 539 | } else { |
540 | 540 | self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
541 | 541 | } |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | * |
736 | 736 | * @return array Merged array |
737 | 737 | */ |
738 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
738 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE) |
|
739 | 739 | { |
740 | 740 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
741 | 741 | return $original; |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | * |
754 | 754 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
755 | 755 | */ |
756 | - public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
756 | + public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = FALSE, $cmdFirst = FALSE) |
|
757 | 757 | { |
758 | 758 | if ( |
759 | 759 | \TYPO3_MODE === 'BE' |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | // Instantiate TYPO3 core engine. |
763 | 763 | $dataHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class); |
764 | 764 | // We do not use workspaces and have to bypass restrictions in DataHandler. |
765 | - $dataHandler->bypassWorkspaceRestrictions = true; |
|
765 | + $dataHandler->bypassWorkspaceRestrictions = TRUE; |
|
766 | 766 | // Load data and command arrays. |
767 | 767 | $dataHandler->start($data, $cmd); |
768 | 768 | // Process command map first if default order is reversed. |
@@ -826,19 +826,19 @@ discard block |
||
826 | 826 | $key = (string) $key; |
827 | 827 | if (!$key) { |
828 | 828 | self::log('Invalid key "' . $key . '" for session data saving', LOG_SEVERITY_WARNING); |
829 | - return false; |
|
829 | + return FALSE; |
|
830 | 830 | } |
831 | 831 | // Save value in session data. |
832 | 832 | if (\TYPO3_MODE === 'FE') { |
833 | 833 | $GLOBALS['TSFE']->fe_user->setKey('ses', $key, $value); |
834 | 834 | $GLOBALS['TSFE']->fe_user->storeSessionData(); |
835 | - return true; |
|
835 | + return TRUE; |
|
836 | 836 | } elseif (\TYPO3_MODE === 'BE') { |
837 | 837 | $GLOBALS['BE_USER']->setAndSaveSessionData($key, $value); |
838 | - return true; |
|
838 | + return TRUE; |
|
839 | 839 | } else { |
840 | 840 | self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
841 | - return false; |
|
841 | + return FALSE; |
|
842 | 842 | } |
843 | 843 | } |
844 | 844 | |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | ->where( |
885 | 885 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
886 | 886 | $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
887 | - self::whereExpression($table, true) |
|
887 | + self::whereExpression($table, TRUE) |
|
888 | 888 | ) |
889 | 889 | ->setMaxResults(1) |
890 | 890 | ->execute(); |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
903 | 903 | $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
904 | 904 | $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)), |
905 | - self::whereExpression($table, true) |
|
905 | + self::whereExpression($table, TRUE) |
|
906 | 906 | ) |
907 | 907 | ->setMaxResults(1) |
908 | 908 | ->execute(); |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | ->where( |
938 | 938 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
939 | 939 | $additionalWhere, |
940 | - self::whereExpression($table, true) |
|
940 | + self::whereExpression($table, TRUE) |
|
941 | 941 | ) |
942 | 942 | ->setMaxResults(10000) |
943 | 943 | ->execute(); |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | * |
978 | 978 | * @return string Additional WHERE expression |
979 | 979 | */ |
980 | - public static function whereExpression($table, $showHidden = false) |
|
980 | + public static function whereExpression($table, $showHidden = FALSE) |
|
981 | 981 | { |
982 | 982 | if (\TYPO3_MODE === 'FE') { |
983 | 983 | // Should we ignore the record's hidden flag? |
@@ -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 | |
@@ -701,8 +683,7 @@ discard block |
||
701 | 683 | * |
702 | 684 | * @return mixed Session value for given key or null on failure |
703 | 685 | */ |
704 | - public static function loadFromSession($key) |
|
705 | - { |
|
686 | + public static function loadFromSession($key) { |
|
706 | 687 | // Cast to string for security reasons. |
707 | 688 | $key = (string) $key; |
708 | 689 | if (!$key) { |
@@ -734,8 +715,7 @@ discard block |
||
734 | 715 | * |
735 | 716 | * @return array Merged array |
736 | 717 | */ |
737 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
738 | - { |
|
718 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) { |
|
739 | 719 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
740 | 720 | return $original; |
741 | 721 | } |
@@ -752,8 +732,7 @@ discard block |
||
752 | 732 | * |
753 | 733 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
754 | 734 | */ |
755 | - public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
756 | - { |
|
735 | + public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) { |
|
757 | 736 | if ( |
758 | 737 | \TYPO3_MODE === 'BE' |
759 | 738 | && $GLOBALS['BE_USER']->isAdmin() |
@@ -799,8 +778,7 @@ discard block |
||
799 | 778 | * |
800 | 779 | * @return string All flash messages in the queue rendered as HTML. |
801 | 780 | */ |
802 | - public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') |
|
803 | - { |
|
781 | + public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') { |
|
804 | 782 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
805 | 783 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
806 | 784 | $flashMessages = $flashMessageQueue->getAllMessagesAndFlush(); |
@@ -819,8 +797,7 @@ discard block |
||
819 | 797 | * |
820 | 798 | * @return bool true on success, false on failure |
821 | 799 | */ |
822 | - public static function saveToSession($value, $key) |
|
823 | - { |
|
800 | + public static function saveToSession($value, $key) { |
|
824 | 801 | // Cast to string for security reasons. |
825 | 802 | $key = (string) $key; |
826 | 803 | if (!$key) { |
@@ -852,8 +829,7 @@ discard block |
||
852 | 829 | * |
853 | 830 | * @return string Localized label for $index_name |
854 | 831 | */ |
855 | - public static function translate($index_name, $table, $pid) |
|
856 | - { |
|
832 | + public static function translate($index_name, $table, $pid) { |
|
857 | 833 | // Load labels into static variable for future use. |
858 | 834 | static $labels = []; |
859 | 835 | // Sanitize input. |
@@ -976,8 +952,7 @@ discard block |
||
976 | 952 | * |
977 | 953 | * @return string Additional WHERE expression |
978 | 954 | */ |
979 | - public static function whereExpression($table, $showHidden = false) |
|
980 | - { |
|
955 | + public static function whereExpression($table, $showHidden = false) { |
|
981 | 956 | if (\TYPO3_MODE === 'FE') { |
982 | 957 | // Should we ignore the record's hidden flag? |
983 | 958 | $ignoreHide = 0; |
@@ -1006,8 +981,7 @@ discard block |
||
1006 | 981 | * |
1007 | 982 | * @access private |
1008 | 983 | */ |
1009 | - private function __construct() |
|
1010 | - { |
|
984 | + private function __construct() { |
|
1011 | 985 | // This is a static class, thus no instances should be created. |
1012 | 986 | } |
1013 | 987 | } |
@@ -120,7 +120,7 @@ |
||
120 | 120 | */ |
121 | 121 | private function getQuery($fields, $parameters) |
122 | 122 | { |
123 | - return $fields['fulltext'] . ':(' . Solr::escapeQuery((string) $parameters['q']) . ') AND ' . $fields['uid'] . ':' . $this->getUid($parameters['uid']); |
|
123 | + return $fields['fulltext'].':('.Solr::escapeQuery((string) $parameters['q']).') AND '.$fields['uid'].':'.$this->getUid($parameters['uid']); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -28,16 +28,14 @@ discard block |
||
28 | 28 | * @subpackage dlf |
29 | 29 | * @access public |
30 | 30 | */ |
31 | -class SearchInDocument |
|
32 | -{ |
|
31 | +class SearchInDocument { |
|
33 | 32 | /** |
34 | 33 | * The main method of the eID script |
35 | 34 | * |
36 | 35 | * @param ServerRequestInterface $request |
37 | 36 | * @return ResponseInterface JSON response of search suggestions |
38 | 37 | */ |
39 | - public function main(ServerRequestInterface $request) |
|
40 | - { |
|
38 | + public function main(ServerRequestInterface $request) { |
|
41 | 39 | $output = [ |
42 | 40 | 'documents' => [], |
43 | 41 | 'numFound' => 0 |
@@ -118,8 +116,7 @@ discard block |
||
118 | 116 | * |
119 | 117 | * @return string SOLR query |
120 | 118 | */ |
121 | - private function getQuery($fields, $parameters) |
|
122 | - { |
|
119 | + private function getQuery($fields, $parameters) { |
|
123 | 120 | return $fields['fulltext'] . ':(' . Solr::escapeQuery((string) $parameters['q']) . ') AND ' . $fields['uid'] . ':' . $this->getUid($parameters['uid']); |
124 | 121 | } |
125 | 122 | |
@@ -133,8 +130,7 @@ discard block |
||
133 | 130 | * |
134 | 131 | * @return int|string uid of the document |
135 | 132 | */ |
136 | - private function getUid($uid) |
|
137 | - { |
|
133 | + private function getUid($uid) { |
|
138 | 134 | return is_numeric($uid) ? intval($uid) : $uid; |
139 | 135 | } |
140 | 136 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | ]; |
45 | 45 | // Get input parameters and decrypt core name. |
46 | 46 | $parameters = $request->getParsedBody(); |
47 | - if ($parameters === null) { |
|
47 | + if ($parameters === NULL) { |
|
48 | 48 | throw new \InvalidArgumentException('No parameters passed!', 1632322297); |
49 | 49 | } |
50 | 50 | $encrypted = (string) $parameters['encrypted']; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if ($this->valid()) { |
140 | 140 | return $this->getRecord($this->elements[$this->position]); |
141 | 141 | } else { |
142 | - $this->logger->notice('Invalid position "' . $this->position . '" for list element'); |
|
142 | + $this->logger->notice('Invalid position "'.$this->position.'" for list element'); |
|
143 | 143 | return; |
144 | 144 | } |
145 | 145 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | $query = $this->solr->service->createSelect(); |
269 | 269 | // Restrict the fields to the required ones |
270 | - $query->setFields($fields['uid'] . ',' . $fields['id'] . ',' . $fields['toplevel'] . ',' . $fields['thumbnail'] . ',' . $fields['page']); |
|
270 | + $query->setFields($fields['uid'].','.$fields['id'].','.$fields['toplevel'].','.$fields['thumbnail'].','.$fields['page']); |
|
271 | 271 | foreach ($this->solrConfig as $solr_name) { |
272 | 272 | $query->addField($solr_name); |
273 | 273 | } |
@@ -280,16 +280,16 @@ discard block |
||
280 | 280 | // Extend filter query to get all documents with the same UID. |
281 | 281 | foreach ($filterQueries as $key => $value) { |
282 | 282 | if (isset($value['query'])) { |
283 | - $filterQuery[$key] = $value['query'] . ' OR ' . $fields['toplevel'] . ':true'; |
|
283 | + $filterQuery[$key] = $value['query'].' OR '.$fields['toplevel'].':true'; |
|
284 | 284 | $filterQuery = [ |
285 | 285 | 'key' => $key, |
286 | - 'query' => $value['query'] . ' OR ' . $fields['toplevel'] . ':true' |
|
286 | + 'query' => $value['query'].' OR '.$fields['toplevel'].':true' |
|
287 | 287 | ]; |
288 | 288 | $query->addFilterQuery($filterQuery); |
289 | 289 | } |
290 | 290 | } |
291 | 291 | // Add filter query to get all documents with the required uid. |
292 | - $query->createFilterQuery('uid')->setQuery($fields['uid'] . ':' . Solr::escapeQuery($record['uid'])); |
|
292 | + $query->createFilterQuery('uid')->setQuery($fields['uid'].':'.Solr::escapeQuery($record['uid'])); |
|
293 | 293 | // Add sorting. |
294 | 294 | if (is_array($this->metadata['options']['params']['sort'])) { |
295 | 295 | foreach ($this->metadata['options']['params']['sort'] as $key => $direction) { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | } |
299 | 299 | // Set query. |
300 | - $query->setQuery($this->metadata['options']['select'] . ' OR ' . $fields['toplevel'] . ':true'); |
|
300 | + $query->setQuery($this->metadata['options']['select'].' OR '.$fields['toplevel'].':true'); |
|
301 | 301 | |
302 | 302 | // If it is a fulltext search, enable highlighting. |
303 | 303 | if ($this->metadata['fulltextSearch']) { |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $position < 0 |
406 | 406 | || $position >= $this->count |
407 | 407 | ) { |
408 | - $this->logger->warning('Invalid position "' . $position . '" for element moving'); |
|
408 | + $this->logger->warning('Invalid position "'.$position.'" for element moving'); |
|
409 | 409 | return; |
410 | 410 | } |
411 | 411 | $steps = intval($steps); |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | if (($position + $steps) < 0 |
414 | 414 | || ($position + $steps) >= $this->count |
415 | 415 | ) { |
416 | - $this->logger->warning('Invalid steps "' . $steps . '" for moving element at position "' . $position . '"'); |
|
416 | + $this->logger->warning('Invalid steps "'.$steps.'" for moving element at position "'.$position.'"'); |
|
417 | 417 | return; |
418 | 418 | } |
419 | 419 | $element = $this->remove($position); |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | if ($this->offsetExists($offset)) { |
492 | 492 | return $this->getRecord($this->elements[$offset]); |
493 | 493 | } else { |
494 | - $this->logger->notice('Invalid offset "' . $offset . '" for list element'); |
|
494 | + $this->logger->notice('Invalid offset "'.$offset.'" for list element'); |
|
495 | 495 | return; |
496 | 496 | } |
497 | 497 | } |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | $position < 0 |
536 | 536 | || $position >= $this->count |
537 | 537 | ) { |
538 | - $this->logger->warning('Invalid position "' . $position . '" for element removing'); |
|
538 | + $this->logger->warning('Invalid position "'.$position.'" for element removing'); |
|
539 | 539 | return; |
540 | 540 | } |
541 | 541 | $removed = array_splice($this->elements, $position, 1); |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | $position < 0 |
561 | 561 | || $position >= $this->count |
562 | 562 | ) { |
563 | - $this->logger->warning('Invalid position "' . $position . '" for element removing'); |
|
563 | + $this->logger->warning('Invalid position "'.$position.'" for element removing'); |
|
564 | 564 | return; |
565 | 565 | } |
566 | 566 | $removed = array_splice($this->elements, $position, $length); |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | ->execute(); |
654 | 654 | |
655 | 655 | while ($resArray = $result->fetch()) { |
656 | - $this->solrConfig[$resArray['index_name']] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . 's' . ($resArray['index_indexed'] ? 'i' : 'u'); |
|
656 | + $this->solrConfig[$resArray['index_name']] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').'s'.($resArray['index_indexed'] ? 'i' : 'u'); |
|
657 | 657 | } |
658 | 658 | // Add static fields. |
659 | 659 | $this->solrConfig['type'] = 'type'; |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | foreach ($this->elements as $num => $element) { |
682 | 682 | // Is this element sortable? |
683 | 683 | if (!empty($element['s'][$by])) { |
684 | - $newOrder[$element['s'][$by] . str_pad($num, 6, '0', STR_PAD_LEFT)] = $element; |
|
684 | + $newOrder[$element['s'][$by].str_pad($num, 6, '0', STR_PAD_LEFT)] = $element; |
|
685 | 685 | } else { |
686 | 686 | $nonSortable[] = $element; |
687 | 687 | } |
@@ -819,12 +819,12 @@ discard block |
||
819 | 819 | */ |
820 | 820 | public function __get($var) |
821 | 821 | { |
822 | - $method = '_get' . ucfirst($var); |
|
822 | + $method = '_get'.ucfirst($var); |
|
823 | 823 | if ( |
824 | 824 | !property_exists($this, $var) |
825 | 825 | || !method_exists($this, $method) |
826 | 826 | ) { |
827 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
827 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
828 | 828 | return; |
829 | 829 | } else { |
830 | 830 | return $this->$method(); |
@@ -857,12 +857,12 @@ discard block |
||
857 | 857 | */ |
858 | 858 | public function __set($var, $value) |
859 | 859 | { |
860 | - $method = '_set' . ucfirst($var); |
|
860 | + $method = '_set'.ucfirst($var); |
|
861 | 861 | if ( |
862 | 862 | !property_exists($this, $var) |
863 | 863 | || !method_exists($this, $method) |
864 | 864 | ) { |
865 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
865 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
866 | 866 | } else { |
867 | 867 | $this->$method($value); |
868 | 868 | } |
@@ -104,8 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @return void |
106 | 106 | */ |
107 | - public function add(array $elements, $position = -1) |
|
108 | - { |
|
107 | + public function add(array $elements, $position = -1) { |
|
109 | 108 | $position = MathUtility::forceIntegerInRange($position, 0, $this->count, $this->count); |
110 | 109 | if (!empty($elements)) { |
111 | 110 | array_splice($this->elements, $position, 0, $elements); |
@@ -121,8 +120,7 @@ discard block |
||
121 | 120 | * |
122 | 121 | * @return int The number of elements in the list |
123 | 122 | */ |
124 | - public function count() |
|
125 | - { |
|
123 | + public function count() { |
|
126 | 124 | return $this->count; |
127 | 125 | } |
128 | 126 | |
@@ -134,8 +132,7 @@ discard block |
||
134 | 132 | * |
135 | 133 | * @return array The current element |
136 | 134 | */ |
137 | - public function current() |
|
138 | - { |
|
135 | + public function current() { |
|
139 | 136 | if ($this->valid()) { |
140 | 137 | return $this->getRecord($this->elements[$this->position]); |
141 | 138 | } else { |
@@ -153,8 +150,7 @@ discard block |
||
153 | 150 | * |
154 | 151 | * @return mixed The element's full record |
155 | 152 | */ |
156 | - protected function getRecord($element) |
|
157 | - { |
|
153 | + protected function getRecord($element) { |
|
158 | 154 | if ( |
159 | 155 | is_array($element) |
160 | 156 | && array_keys($element) == ['u', 'h', 's', 'p'] |
@@ -261,8 +257,7 @@ discard block |
||
261 | 257 | * |
262 | 258 | * @return Result |
263 | 259 | */ |
264 | - private function getSolrResult($record) |
|
265 | - { |
|
260 | + private function getSolrResult($record) { |
|
266 | 261 | $fields = Solr::getFields(); |
267 | 262 | |
268 | 263 | $query = $this->solr->service->createSelect(); |
@@ -334,8 +329,7 @@ discard block |
||
334 | 329 | * |
335 | 330 | * @return array |
336 | 331 | */ |
337 | - private function getSolrRecord($record, $result) |
|
338 | - { |
|
332 | + private function getSolrRecord($record, $result) { |
|
339 | 333 | // If it is a fulltext search, fetch the highlighting results. |
340 | 334 | if ($this->metadata['fulltextSearch']) { |
341 | 335 | $data = $result->getData(); |
@@ -382,8 +376,7 @@ discard block |
||
382 | 376 | * |
383 | 377 | * @return int The current position |
384 | 378 | */ |
385 | - public function key() |
|
386 | - { |
|
379 | + public function key() { |
|
387 | 380 | return $this->position; |
388 | 381 | } |
389 | 382 | |
@@ -397,8 +390,7 @@ discard block |
||
397 | 390 | * |
398 | 391 | * @return void |
399 | 392 | */ |
400 | - public function move($position, $steps) |
|
401 | - { |
|
393 | + public function move($position, $steps) { |
|
402 | 394 | $position = intval($position); |
403 | 395 | // Check if list position is valid. |
404 | 396 | if ( |
@@ -429,8 +421,7 @@ discard block |
||
429 | 421 | * |
430 | 422 | * @return void |
431 | 423 | */ |
432 | - public function moveUp($position) |
|
433 | - { |
|
424 | + public function moveUp($position) { |
|
434 | 425 | $this->move($position, -1); |
435 | 426 | } |
436 | 427 | |
@@ -443,8 +434,7 @@ discard block |
||
443 | 434 | * |
444 | 435 | * @return void |
445 | 436 | */ |
446 | - public function moveDown($position) |
|
447 | - { |
|
437 | + public function moveDown($position) { |
|
448 | 438 | $this->move($position, 1); |
449 | 439 | } |
450 | 440 | |
@@ -456,8 +446,7 @@ discard block |
||
456 | 446 | * |
457 | 447 | * @return void |
458 | 448 | */ |
459 | - public function next() |
|
460 | - { |
|
449 | + public function next() { |
|
461 | 450 | $this->position++; |
462 | 451 | } |
463 | 452 | |
@@ -471,8 +460,7 @@ discard block |
||
471 | 460 | * |
472 | 461 | * @return bool Does the given offset exist? |
473 | 462 | */ |
474 | - public function offsetExists($offset) |
|
475 | - { |
|
463 | + public function offsetExists($offset) { |
|
476 | 464 | return isset($this->elements[$offset]); |
477 | 465 | } |
478 | 466 | |
@@ -486,8 +474,7 @@ discard block |
||
486 | 474 | * |
487 | 475 | * @return array The element at the given offset |
488 | 476 | */ |
489 | - public function offsetGet($offset) |
|
490 | - { |
|
477 | + public function offsetGet($offset) { |
|
491 | 478 | if ($this->offsetExists($offset)) { |
492 | 479 | return $this->getRecord($this->elements[$offset]); |
493 | 480 | } else { |
@@ -507,8 +494,7 @@ discard block |
||
507 | 494 | * |
508 | 495 | * @return void |
509 | 496 | */ |
510 | - public function offsetSet($offset, $value) |
|
511 | - { |
|
497 | + public function offsetSet($offset, $value) { |
|
512 | 498 | if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($offset)) { |
513 | 499 | $this->elements[$offset] = $value; |
514 | 500 | } else { |
@@ -528,8 +514,7 @@ discard block |
||
528 | 514 | * |
529 | 515 | * @return array The removed element |
530 | 516 | */ |
531 | - public function remove($position) |
|
532 | - { |
|
517 | + public function remove($position) { |
|
533 | 518 | $position = intval($position); |
534 | 519 | if ( |
535 | 520 | $position < 0 |
@@ -553,8 +538,7 @@ discard block |
||
553 | 538 | * |
554 | 539 | * @return array The indizes of the removed elements |
555 | 540 | */ |
556 | - public function removeRange($position, $length) |
|
557 | - { |
|
541 | + public function removeRange($position, $length) { |
|
558 | 542 | $position = intval($position); |
559 | 543 | if ( |
560 | 544 | $position < 0 |
@@ -575,8 +559,7 @@ discard block |
||
575 | 559 | * |
576 | 560 | * @return void |
577 | 561 | */ |
578 | - public function reset() |
|
579 | - { |
|
562 | + public function reset() { |
|
580 | 563 | $this->elements = []; |
581 | 564 | $this->records = []; |
582 | 565 | $this->metadata = []; |
@@ -592,8 +575,7 @@ discard block |
||
592 | 575 | * |
593 | 576 | * @return void |
594 | 577 | */ |
595 | - public function rewind() |
|
596 | - { |
|
578 | + public function rewind() { |
|
597 | 579 | $this->position = 0; |
598 | 580 | } |
599 | 581 | |
@@ -606,8 +588,7 @@ discard block |
||
606 | 588 | * |
607 | 589 | * @return void |
608 | 590 | */ |
609 | - public function save($pid = 0) |
|
610 | - { |
|
591 | + public function save($pid = 0) { |
|
611 | 592 | $pid = max(intval($pid), 0); |
612 | 593 | // If no PID is given, save to the user's session instead |
613 | 594 | if ($pid > 0) { |
@@ -624,8 +605,7 @@ discard block |
||
624 | 605 | * |
625 | 606 | * @return bool true on success or false on failure |
626 | 607 | */ |
627 | - protected function solrConnect() |
|
628 | - { |
|
608 | + protected function solrConnect() { |
|
629 | 609 | // Get Solr instance. |
630 | 610 | if (!$this->solr) { |
631 | 611 | // Connect to Solr server. |
@@ -674,8 +654,7 @@ discard block |
||
674 | 654 | * |
675 | 655 | * @return void |
676 | 656 | */ |
677 | - public function sort($by, $asc = true) |
|
678 | - { |
|
657 | + public function sort($by, $asc = true) { |
|
679 | 658 | $newOrder = []; |
680 | 659 | $nonSortable = []; |
681 | 660 | foreach ($this->elements as $num => $element) { |
@@ -712,8 +691,7 @@ discard block |
||
712 | 691 | * |
713 | 692 | * @return void |
714 | 693 | */ |
715 | - public function offsetUnset($offset) |
|
716 | - { |
|
694 | + public function offsetUnset($offset) { |
|
717 | 695 | unset($this->elements[$offset]); |
718 | 696 | // Re-number the elements. |
719 | 697 | $this->elements = array_values($this->elements); |
@@ -728,8 +706,7 @@ discard block |
||
728 | 706 | * |
729 | 707 | * @return bool Is the current list position valid? |
730 | 708 | */ |
731 | - public function valid() |
|
732 | - { |
|
709 | + public function valid() { |
|
733 | 710 | return isset($this->elements[$this->position]); |
734 | 711 | } |
735 | 712 | |
@@ -740,8 +717,7 @@ discard block |
||
740 | 717 | * |
741 | 718 | * @return array The list's metadata |
742 | 719 | */ |
743 | - protected function _getMetadata() |
|
744 | - { |
|
720 | + protected function _getMetadata() { |
|
745 | 721 | return $this->metadata; |
746 | 722 | } |
747 | 723 | |
@@ -754,8 +730,7 @@ discard block |
||
754 | 730 | * |
755 | 731 | * @return void |
756 | 732 | */ |
757 | - protected function _setMetadata(array $metadata = []) |
|
758 | - { |
|
733 | + protected function _setMetadata(array $metadata = []) { |
|
759 | 734 | $this->metadata = $metadata; |
760 | 735 | } |
761 | 736 | |
@@ -769,8 +744,7 @@ discard block |
||
769 | 744 | * |
770 | 745 | * @return void |
771 | 746 | */ |
772 | - public function __construct(array $elements = [], array $metadata = []) |
|
773 | - { |
|
747 | + public function __construct(array $elements = [], array $metadata = []) { |
|
774 | 748 | if ( |
775 | 749 | empty($elements) |
776 | 750 | && empty($metadata) |
@@ -803,8 +777,7 @@ discard block |
||
803 | 777 | * |
804 | 778 | * @return void |
805 | 779 | */ |
806 | - protected function __clone() |
|
807 | - { |
|
780 | + protected function __clone() { |
|
808 | 781 | // This method is defined as protected because singleton objects should not be cloned. |
809 | 782 | } |
810 | 783 | |
@@ -817,8 +790,7 @@ discard block |
||
817 | 790 | * |
818 | 791 | * @return mixed Value of $this->$var |
819 | 792 | */ |
820 | - public function __get($var) |
|
821 | - { |
|
793 | + public function __get($var) { |
|
822 | 794 | $method = '_get' . ucfirst($var); |
823 | 795 | if ( |
824 | 796 | !property_exists($this, $var) |
@@ -840,8 +812,7 @@ discard block |
||
840 | 812 | * |
841 | 813 | * @return bool true if variable is set and not empty, false otherwise |
842 | 814 | */ |
843 | - public function __isset($var) |
|
844 | - { |
|
815 | + public function __isset($var) { |
|
845 | 816 | return !empty($this->__get($var)); |
846 | 817 | } |
847 | 818 | |
@@ -855,8 +826,7 @@ discard block |
||
855 | 826 | * |
856 | 827 | * @return void |
857 | 828 | */ |
858 | - public function __set($var, $value) |
|
859 | - { |
|
829 | + public function __set($var, $value) { |
|
860 | 830 | $method = '_set' . ucfirst($var); |
861 | 831 | if ( |
862 | 832 | !property_exists($this, $var) |
@@ -876,8 +846,7 @@ discard block |
||
876 | 846 | * |
877 | 847 | * @return array Properties to be serialized |
878 | 848 | */ |
879 | - public function __sleep() |
|
880 | - { |
|
849 | + public function __sleep() { |
|
881 | 850 | return ['elements', 'metadata']; |
882 | 851 | } |
883 | 852 | |
@@ -889,8 +858,7 @@ discard block |
||
889 | 858 | * |
890 | 859 | * @return void |
891 | 860 | */ |
892 | - public function __wakeup() |
|
893 | - { |
|
861 | + public function __wakeup() { |
|
894 | 862 | $this->count = count($this->elements); |
895 | 863 | } |
896 | 864 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | if ($resArray['uid'] == $record['uid']) { |
225 | 225 | $record['thumbnail'] = $resArray['thumbnail']; |
226 | 226 | $record['metadata'] = $metadata; |
227 | - } elseif (($key = array_search(['u' => $resArray['uid']], $record['subparts'], true)) !== false) { |
|
227 | + } elseif (($key = array_search(['u' => $resArray['uid']], $record['subparts'], TRUE)) !== FALSE) { |
|
228 | 228 | $record['subparts'][$key] = [ |
229 | 229 | 'uid' => $resArray['uid'], |
230 | 230 | 'page' => 1, |
@@ -658,10 +658,10 @@ discard block |
||
658 | 658 | // Add static fields. |
659 | 659 | $this->solrConfig['type'] = 'type'; |
660 | 660 | } else { |
661 | - return false; |
|
661 | + return FALSE; |
|
662 | 662 | } |
663 | 663 | } |
664 | - return true; |
|
664 | + return TRUE; |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | /** |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * |
675 | 675 | * @return void |
676 | 676 | */ |
677 | - public function sort($by, $asc = true) |
|
677 | + public function sort($by, $asc = TRUE) |
|
678 | 678 | { |
679 | 679 | $newOrder = []; |
680 | 680 | $nonSortable = []; |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | * @subpackage dlf |
25 | 25 | * @access public |
26 | 26 | */ |
27 | -class ResultDocument |
|
28 | -{ |
|
27 | +class ResultDocument { |
|
29 | 28 | |
30 | 29 | /** |
31 | 30 | * The identifier |
@@ -102,8 +101,7 @@ discard block |
||
102 | 101 | * |
103 | 102 | * @return void |
104 | 103 | */ |
105 | - public function __construct($record, $highlighting, $fields) |
|
106 | - { |
|
104 | + public function __construct($record, $highlighting, $fields) { |
|
107 | 105 | $this->id = $record[$fields['id']]; |
108 | 106 | $this->uid = $record[$fields['uid']]; |
109 | 107 | $this->page = $record[$fields['page']]; |
@@ -124,8 +122,7 @@ discard block |
||
124 | 122 | * |
125 | 123 | * @return string The result's record identifier |
126 | 124 | */ |
127 | - public function getId() |
|
128 | - { |
|
125 | + public function getId() { |
|
129 | 126 | return $this->id; |
130 | 127 | } |
131 | 128 | |
@@ -136,8 +133,7 @@ discard block |
||
136 | 133 | * |
137 | 134 | * @return string|null The result's record unified identifier |
138 | 135 | */ |
139 | - public function getUid() |
|
140 | - { |
|
136 | + public function getUid() { |
|
141 | 137 | return $this->uid; |
142 | 138 | } |
143 | 139 | |
@@ -148,8 +144,7 @@ discard block |
||
148 | 144 | * |
149 | 145 | * @return int The result's record page |
150 | 146 | */ |
151 | - public function getPage() |
|
152 | - { |
|
147 | + public function getPage() { |
|
153 | 148 | return $this->page; |
154 | 149 | } |
155 | 150 | |
@@ -160,8 +155,7 @@ discard block |
||
160 | 155 | * |
161 | 156 | * @return string All result's record snippets imploded to one string |
162 | 157 | */ |
163 | - public function getSnippets() |
|
164 | - { |
|
158 | + public function getSnippets() { |
|
165 | 159 | return $this->snippets; |
166 | 160 | } |
167 | 161 | |
@@ -172,8 +166,7 @@ discard block |
||
172 | 166 | * |
173 | 167 | * @return array(Page) All result's pages which contain search phrase |
174 | 168 | */ |
175 | - public function getPages() |
|
176 | - { |
|
169 | + public function getPages() { |
|
177 | 170 | return $this->pages; |
178 | 171 | } |
179 | 172 | |
@@ -184,8 +177,7 @@ discard block |
||
184 | 177 | * |
185 | 178 | * @return array(Region) All result's regions which contain search phrase |
186 | 179 | */ |
187 | - public function getRegions() |
|
188 | - { |
|
180 | + public function getRegions() { |
|
189 | 181 | return $this->regions; |
190 | 182 | } |
191 | 183 | |
@@ -196,8 +188,7 @@ discard block |
||
196 | 188 | * |
197 | 189 | * @return array(Highlight) All result's highlights of search phrase |
198 | 190 | */ |
199 | - public function getHighlights() |
|
200 | - { |
|
191 | + public function getHighlights() { |
|
201 | 192 | return $this->highlights; |
202 | 193 | } |
203 | 194 | |
@@ -208,8 +199,7 @@ discard block |
||
208 | 199 | * |
209 | 200 | * @return array(string) All result's highlights of search phrase |
210 | 201 | */ |
211 | - public function getHighlightsIds() |
|
212 | - { |
|
202 | + public function getHighlightsIds() { |
|
213 | 203 | $highlightsIds = []; |
214 | 204 | foreach ($this->highlights as $highlight) { |
215 | 205 | array_push($highlightsIds, $highlight->getId()); |
@@ -225,8 +215,7 @@ discard block |
||
225 | 215 | * |
226 | 216 | * @return void |
227 | 217 | */ |
228 | - private function parseSnippets() |
|
229 | - { |
|
218 | + private function parseSnippets() { |
|
230 | 219 | $snippetArray = $this->getArrayByIndex('text'); |
231 | 220 | |
232 | 221 | $this->snippets = !empty($snippetArray) ? implode(' [...] ', $snippetArray) : ''; |
@@ -240,8 +229,7 @@ discard block |
||
240 | 229 | * |
241 | 230 | * @return void |
242 | 231 | */ |
243 | - private function parsePages() |
|
244 | - { |
|
232 | + private function parsePages() { |
|
245 | 233 | $pageArray = $this->getArrayByIndex('pages'); |
246 | 234 | |
247 | 235 | $i = 0; |
@@ -261,8 +249,7 @@ discard block |
||
261 | 249 | * |
262 | 250 | * @return void |
263 | 251 | */ |
264 | - private function parseRegions() |
|
265 | - { |
|
252 | + private function parseRegions() { |
|
266 | 253 | $regionArray = $this->getArrayByIndex('regions'); |
267 | 254 | |
268 | 255 | $i = 0; |
@@ -282,8 +269,7 @@ discard block |
||
282 | 269 | * |
283 | 270 | * @return void |
284 | 271 | */ |
285 | - private function parseHighlights() |
|
286 | - { |
|
272 | + private function parseHighlights() { |
|
287 | 273 | $highlightArray = $this->getArrayByIndex('highlights'); |
288 | 274 | |
289 | 275 | foreach ($highlightArray as $highlights) { |
@@ -304,8 +290,7 @@ discard block |
||
304 | 290 | * |
305 | 291 | * @return array |
306 | 292 | */ |
307 | - private function getArrayByIndex($index) |
|
308 | - { |
|
293 | + private function getArrayByIndex($index) { |
|
309 | 294 | $objectArray = []; |
310 | 295 | foreach ($this->snippetsForRecord as $snippet) { |
311 | 296 | if (!empty($snippet[$index])) { |
@@ -87,7 +87,7 @@ |
||
87 | 87 | $this->xEndPosition = $highlight['lrx']; |
88 | 88 | $this->yBeginPosition = $highlight['uly']; |
89 | 89 | $this->yEndPosition = $highlight['lry']; |
90 | - $this->id = $this->xBeginPosition . '_' . $this->yBeginPosition; |
|
90 | + $this->id = $this->xBeginPosition.'_'.$this->yBeginPosition; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @subpackage dlf |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class Highlight |
|
24 | -{ |
|
23 | +class Highlight { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * The identifier in form 'w_h_x_y' |
@@ -80,8 +79,7 @@ discard block |
||
80 | 79 | * |
81 | 80 | * @return void |
82 | 81 | */ |
83 | - public function __construct($highlight) |
|
84 | - { |
|
82 | + public function __construct($highlight) { |
|
85 | 83 | $this->parentRegionId = $highlight['parentRegionIdx']; |
86 | 84 | $this->xBeginPosition = $highlight['ulx']; |
87 | 85 | $this->xEndPosition = $highlight['lrx']; |
@@ -97,8 +95,7 @@ discard block |
||
97 | 95 | * |
98 | 96 | * @return string The highlight's identifier |
99 | 97 | */ |
100 | - public function getId() |
|
101 | - { |
|
98 | + public function getId() { |
|
102 | 99 | return $this->id; |
103 | 100 | } |
104 | 101 | |
@@ -109,8 +106,7 @@ discard block |
||
109 | 106 | * |
110 | 107 | * @return int The highlight's horizontal beginning position |
111 | 108 | */ |
112 | - public function getXBeginPosition() |
|
113 | - { |
|
109 | + public function getXBeginPosition() { |
|
114 | 110 | return $this->xBeginPosition; |
115 | 111 | } |
116 | 112 | |
@@ -121,8 +117,7 @@ discard block |
||
121 | 117 | * |
122 | 118 | * @return int The highlight's horizontal ending position |
123 | 119 | */ |
124 | - public function getXEndPosition() |
|
125 | - { |
|
120 | + public function getXEndPosition() { |
|
126 | 121 | return $this->xEndPosition; |
127 | 122 | } |
128 | 123 | |
@@ -133,8 +128,7 @@ discard block |
||
133 | 128 | * |
134 | 129 | * @return int The highlight's vertical beginning position |
135 | 130 | */ |
136 | - public function getYBeginPosition() |
|
137 | - { |
|
131 | + public function getYBeginPosition() { |
|
138 | 132 | return $this->yBeginPosition; |
139 | 133 | } |
140 | 134 | |
@@ -145,8 +139,7 @@ discard block |
||
145 | 139 | * |
146 | 140 | * @return int The highlight's vertical ending position |
147 | 141 | */ |
148 | - public function getYEndPosition() |
|
149 | - { |
|
142 | + public function getYEndPosition() { |
|
150 | 143 | return $this->yEndPosition; |
151 | 144 | } |
152 | 145 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | private function getWord($attributes) |
103 | 103 | { |
104 | - return htmlspecialchars((string) $attributes['CONTENT']) . ' '; |
|
104 | + return htmlspecialchars((string) $attributes['CONTENT']).' '; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -115,6 +115,6 @@ discard block |
||
115 | 115 | */ |
116 | 116 | private function getCoordinates($attributes) |
117 | 117 | { |
118 | - return (string) $attributes['HPOS'] . ' ' . (string) $attributes['VPOS'] . ' ' . (string) $attributes['WIDTH'] . ' ' . (string) $attributes['HEIGHT']; |
|
118 | + return (string) $attributes['HPOS'].' '.(string) $attributes['VPOS'].' '.(string) $attributes['WIDTH'].' '.(string) $attributes['HEIGHT']; |
|
119 | 119 | } |
120 | 120 | } |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | * @subpackage dlf |
23 | 23 | * @access public |
24 | 24 | */ |
25 | -class Alto implements \Kitodo\Dlf\Common\FulltextInterface |
|
26 | -{ |
|
25 | +class Alto implements \Kitodo\Dlf\Common\FulltextInterface { |
|
27 | 26 | /** |
28 | 27 | * This extracts the fulltext data from ALTO XML |
29 | 28 | * |
@@ -33,8 +32,7 @@ discard block |
||
33 | 32 | * |
34 | 33 | * @return string The raw unformatted fulltext |
35 | 34 | */ |
36 | - public function getRawText(\SimpleXMLElement $xml) |
|
37 | - { |
|
35 | + public function getRawText(\SimpleXMLElement $xml) { |
|
38 | 36 | $rawText = ''; |
39 | 37 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); |
40 | 38 | // Get all (presumed) words of the text. |
@@ -54,8 +52,7 @@ discard block |
||
54 | 52 | * |
55 | 53 | * @return string The unformatted fulltext in MiniOCR format |
56 | 54 | */ |
57 | - public function getTextAsMiniOcr(\SimpleXMLElement $xml) |
|
58 | - { |
|
55 | + public function getTextAsMiniOcr(\SimpleXMLElement $xml) { |
|
59 | 56 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); |
60 | 57 | |
61 | 58 | // get all text blocks |
@@ -99,8 +96,7 @@ discard block |
||
99 | 96 | * |
100 | 97 | * @return string The parsed word extracted from attribute |
101 | 98 | */ |
102 | - private function getWord($attributes) |
|
103 | - { |
|
99 | + private function getWord($attributes) { |
|
104 | 100 | return htmlspecialchars((string) $attributes['CONTENT']) . ' '; |
105 | 101 | } |
106 | 102 | |
@@ -113,8 +109,7 @@ discard block |
||
113 | 109 | * |
114 | 110 | * @return string The parsed word coordinates extracted from attribute |
115 | 111 | */ |
116 | - private function getCoordinates($attributes) |
|
117 | - { |
|
112 | + private function getCoordinates($attributes) { |
|
118 | 113 | return (string) $attributes['HPOS'] . ' ' . (string) $attributes['VPOS'] . ' ' . (string) $attributes['WIDTH'] . ' ' . (string) $attributes['HEIGHT']; |
119 | 114 | } |
120 | 115 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | if ($parent->ready) { |
103 | 103 | $success = self::add($parent, $core); |
104 | 104 | } else { |
105 | - Helper::log('Could not load parent document with UID ' . $doc->parentId, LOG_SEVERITY_ERROR); |
|
105 | + Helper::log('Could not load parent document with UID '.$doc->parentId, LOG_SEVERITY_ERROR); |
|
106 | 106 | return false; |
107 | 107 | } |
108 | 108 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | self::$processedDocs[] = $doc->uid; |
112 | 112 | // Delete old Solr documents. |
113 | 113 | $updateQuery = self::$solr->service->createUpdate(); |
114 | - $updateQuery->addDeleteQuery('uid:' . $doc->uid); |
|
114 | + $updateQuery->addDeleteQuery('uid:'.$doc->uid); |
|
115 | 115 | self::$solr->service->update($updateQuery); |
116 | 116 | |
117 | 117 | // Index every logical unit as separate Solr document. |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | } catch (\Exception $e) { |
177 | 177 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
178 | 178 | Helper::addMessage( |
179 | - Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()), |
|
179 | + Helper::getMessage('flash.solrException', true).'<br />'.htmlspecialchars($e->getMessage()), |
|
180 | 180 | Helper::getMessage('flash.error', true), |
181 | 181 | FlashMessage::ERROR, |
182 | 182 | true, |
183 | 183 | 'core.template.flashMessages' |
184 | 184 | ); |
185 | 185 | } |
186 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
186 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | } else { |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | // Sanitize input. |
217 | 217 | $pid = max(intval($pid), 0); |
218 | 218 | if (!$pid) { |
219 | - Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR); |
|
219 | + Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR); |
|
220 | 220 | return ''; |
221 | 221 | } |
222 | 222 | // Load metadata configuration. |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u'); |
226 | 226 | $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u'); |
227 | 227 | $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u'); |
228 | - $index_name .= '_' . $suffix; |
|
228 | + $index_name .= '_'.$suffix; |
|
229 | 229 | return $index_name; |
230 | 230 | } |
231 | 231 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $updateQuery = self::$solr->service->createUpdate(); |
334 | 334 | $solrDoc = $updateQuery->createDocument(); |
335 | 335 | // Create unique identifier from document's UID and unit's XML ID. |
336 | - $solrDoc->setField('id', $doc->uid . $logicalUnit['id']); |
|
336 | + $solrDoc->setField('id', $doc->uid.$logicalUnit['id']); |
|
337 | 337 | $solrDoc->setField('uid', $doc->uid); |
338 | 338 | $solrDoc->setField('pid', $doc->pid); |
339 | 339 | if (MathUtility::canBeInterpretedAsInteger($logicalUnit['points'])) { |
@@ -374,11 +374,11 @@ discard block |
||
374 | 374 | $solrDoc->setField(self::getIndexFieldName($index_name, $doc->pid), $data, self::$fields['fieldboost'][$index_name]); |
375 | 375 | if (in_array($index_name, self::$fields['sortables'])) { |
376 | 376 | // Add sortable fields to index. |
377 | - $solrDoc->setField($index_name . '_sorting', $metadata[$index_name . '_sorting'][0]); |
|
377 | + $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]); |
|
378 | 378 | } |
379 | 379 | if (in_array($index_name, self::$fields['facets'])) { |
380 | 380 | // Add facets to index. |
381 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
381 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
382 | 382 | } |
383 | 383 | if (in_array($index_name, self::$fields['autocomplete'])) { |
384 | 384 | $autocomplete = array_merge($autocomplete, $data); |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | } catch (\Exception $e) { |
404 | 404 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
405 | 405 | Helper::addMessage( |
406 | - Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()), |
|
406 | + Helper::getMessage('flash.solrException', true).'<br />'.htmlspecialchars($e->getMessage()), |
|
407 | 407 | Helper::getMessage('flash.error', true), |
408 | 408 | FlashMessage::ERROR, |
409 | 409 | true, |
410 | 410 | 'core.template.flashMessages' |
411 | 411 | ); |
412 | 412 | } |
413 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
413 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
414 | 414 | return false; |
415 | 415 | } |
416 | 416 | } |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $updateQuery = self::$solr->service->createUpdate(); |
449 | 449 | $solrDoc = $updateQuery->createDocument(); |
450 | 450 | // Create unique identifier from document's UID and unit's XML ID. |
451 | - $solrDoc->setField('id', $doc->uid . $physicalUnit['id']); |
|
451 | + $solrDoc->setField('id', $doc->uid.$physicalUnit['id']); |
|
452 | 452 | $solrDoc->setField('uid', $doc->uid); |
453 | 453 | $solrDoc->setField('pid', $doc->pid); |
454 | 454 | $solrDoc->setField('page', $page); |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | } |
484 | 484 | } |
485 | 485 | // Add facets to index. |
486 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
486 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
487 | 487 | } |
488 | 488 | } |
489 | 489 | } |
@@ -500,14 +500,14 @@ discard block |
||
500 | 500 | } catch (\Exception $e) { |
501 | 501 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
502 | 502 | Helper::addMessage( |
503 | - Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()), |
|
503 | + Helper::getMessage('flash.solrException', true).'<br />'.htmlspecialchars($e->getMessage()), |
|
504 | 504 | Helper::getMessage('flash.error', true), |
505 | 505 | FlashMessage::ERROR, |
506 | 506 | true, |
507 | 507 | 'core.template.flashMessages' |
508 | 508 | ); |
509 | 509 | } |
510 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
510 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
511 | 511 | return false; |
512 | 512 | } |
513 | 513 | } |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | * @subpackage dlf |
29 | 29 | * @access public |
30 | 30 | */ |
31 | -class Indexer |
|
32 | -{ |
|
31 | +class Indexer { |
|
33 | 32 | /** |
34 | 33 | * The extension key |
35 | 34 | * |
@@ -90,8 +89,7 @@ discard block |
||
90 | 89 | * |
91 | 90 | * @return bool true on success or false on failure |
92 | 91 | */ |
93 | - public static function add(Document &$doc, $core = 0) |
|
94 | - { |
|
92 | + public static function add(Document &$doc, $core = 0) { |
|
95 | 93 | if (in_array($doc->uid, self::$processedDocs)) { |
96 | 94 | return true; |
97 | 95 | } elseif (self::solrConnect($core, $doc->pid)) { |
@@ -211,8 +209,7 @@ discard block |
||
211 | 209 | * |
212 | 210 | * @return string The field's dynamic index name |
213 | 211 | */ |
214 | - public static function getIndexFieldName($index_name, $pid = 0) |
|
215 | - { |
|
212 | + public static function getIndexFieldName($index_name, $pid = 0) { |
|
216 | 213 | // Sanitize input. |
217 | 214 | $pid = max(intval($pid), 0); |
218 | 215 | if (!$pid) { |
@@ -238,8 +235,7 @@ discard block |
||
238 | 235 | * |
239 | 236 | * @return void |
240 | 237 | */ |
241 | - protected static function loadIndexConf($pid) |
|
242 | - { |
|
238 | + protected static function loadIndexConf($pid) { |
|
243 | 239 | if (!self::$fieldsLoaded) { |
244 | 240 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
245 | 241 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
@@ -309,8 +305,7 @@ discard block |
||
309 | 305 | * |
310 | 306 | * @return bool true on success or false on failure |
311 | 307 | */ |
312 | - protected static function processLogical(Document &$doc, array $logicalUnit) |
|
313 | - { |
|
308 | + protected static function processLogical(Document &$doc, array $logicalUnit) { |
|
314 | 309 | $success = true; |
315 | 310 | // Get metadata for logical unit. |
316 | 311 | $metadata = $doc->metadataArray[$logicalUnit['id']]; |
@@ -439,8 +434,7 @@ discard block |
||
439 | 434 | * |
440 | 435 | * @return bool true on success or false on failure |
441 | 436 | */ |
442 | - protected static function processPhysical(Document &$doc, $page, array $physicalUnit) |
|
443 | - { |
|
437 | + protected static function processPhysical(Document &$doc, $page, array $physicalUnit) { |
|
444 | 438 | if ($doc->hasFulltext && $fullText = $doc->getFullText($physicalUnit['id'])) { |
445 | 439 | // Read extension configuration. |
446 | 440 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -524,8 +518,7 @@ discard block |
||
524 | 518 | * |
525 | 519 | * @return bool true on success or false on failure |
526 | 520 | */ |
527 | - protected static function solrConnect($core, $pid = 0) |
|
528 | - { |
|
521 | + protected static function solrConnect($core, $pid = 0) { |
|
529 | 522 | // Get Solr instance. |
530 | 523 | if (!self::$solr) { |
531 | 524 | // Connect to Solr server. |
@@ -548,8 +541,7 @@ discard block |
||
548 | 541 | * |
549 | 542 | * @access private |
550 | 543 | */ |
551 | - private function __construct() |
|
552 | - { |
|
544 | + private function __construct() { |
|
553 | 545 | // This is a static class, thus no instances should be created. |
554 | 546 | } |
555 | 547 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @var bool |
63 | 63 | * @access protected |
64 | 64 | */ |
65 | - protected static $fieldsLoaded = false; |
|
65 | + protected static $fieldsLoaded = FALSE; |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * List of already processed documents |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | public static function add(Document &$doc, $core = 0) |
94 | 94 | { |
95 | 95 | if (in_array($doc->uid, self::$processedDocs)) { |
96 | - return true; |
|
96 | + return TRUE; |
|
97 | 97 | } elseif (self::solrConnect($core, $doc->pid)) { |
98 | - $success = true; |
|
98 | + $success = TRUE; |
|
99 | 99 | // Handle multi-volume documents. |
100 | 100 | if ($doc->parentId) { |
101 | - $parent = Document::getInstance($doc->parentId, 0, true); |
|
101 | + $parent = Document::getInstance($doc->parentId, 0, TRUE); |
|
102 | 102 | if ($parent->ready) { |
103 | 103 | $success = self::add($parent, $core); |
104 | 104 | } else { |
105 | 105 | Helper::log('Could not load parent document with UID ' . $doc->parentId, LOG_SEVERITY_ERROR); |
106 | - return false; |
|
106 | + return FALSE; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | try { |
@@ -157,17 +157,17 @@ discard block |
||
157 | 157 | if ($success) { |
158 | 158 | Helper::addMessage( |
159 | 159 | htmlspecialchars(sprintf(Helper::getMessage('flash.documentIndexed'), $resArray['title'], $doc->uid)), |
160 | - Helper::getMessage('flash.done', true), |
|
160 | + Helper::getMessage('flash.done', TRUE), |
|
161 | 161 | FlashMessage::OK, |
162 | - true, |
|
162 | + TRUE, |
|
163 | 163 | 'core.template.flashMessages' |
164 | 164 | ); |
165 | 165 | } else { |
166 | 166 | Helper::addMessage( |
167 | 167 | htmlspecialchars(sprintf(Helper::getMessage('flash.documentNotIndexed'), $resArray['title'], $doc->uid)), |
168 | - Helper::getMessage('flash.error', true), |
|
168 | + Helper::getMessage('flash.error', TRUE), |
|
169 | 169 | FlashMessage::ERROR, |
170 | - true, |
|
170 | + TRUE, |
|
171 | 171 | 'core.template.flashMessages' |
172 | 172 | ); |
173 | 173 | } |
@@ -176,28 +176,28 @@ discard block |
||
176 | 176 | } catch (\Exception $e) { |
177 | 177 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
178 | 178 | Helper::addMessage( |
179 | - Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()), |
|
180 | - Helper::getMessage('flash.error', true), |
|
179 | + Helper::getMessage('flash.solrException', TRUE) . '<br />' . htmlspecialchars($e->getMessage()), |
|
180 | + Helper::getMessage('flash.error', TRUE), |
|
181 | 181 | FlashMessage::ERROR, |
182 | - true, |
|
182 | + TRUE, |
|
183 | 183 | 'core.template.flashMessages' |
184 | 184 | ); |
185 | 185 | } |
186 | 186 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
187 | - return false; |
|
187 | + return FALSE; |
|
188 | 188 | } |
189 | 189 | } else { |
190 | 190 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
191 | 191 | Helper::addMessage( |
192 | - Helper::getMessage('flash.solrNoConnection', true), |
|
193 | - Helper::getMessage('flash.warning', true), |
|
192 | + Helper::getMessage('flash.solrNoConnection', TRUE), |
|
193 | + Helper::getMessage('flash.warning', TRUE), |
|
194 | 194 | FlashMessage::WARNING, |
195 | - true, |
|
195 | + TRUE, |
|
196 | 196 | 'core.template.flashMessages' |
197 | 197 | ); |
198 | 198 | } |
199 | 199 | Helper::log('Could not connect to Apache Solr server', LOG_SEVERITY_ERROR); |
200 | - return false; |
|
200 | + return FALSE; |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
@@ -292,10 +292,10 @@ discard block |
||
292 | 292 | if ($indexing['index_boost'] > 0.0) { |
293 | 293 | self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']); |
294 | 294 | } else { |
295 | - self::$fields['fieldboost'][$indexing['index_name']] = false; |
|
295 | + self::$fields['fieldboost'][$indexing['index_name']] = FALSE; |
|
296 | 296 | } |
297 | 297 | } |
298 | - self::$fieldsLoaded = true; |
|
298 | + self::$fieldsLoaded = TRUE; |
|
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | */ |
312 | 312 | protected static function processLogical(Document &$doc, array $logicalUnit) |
313 | 313 | { |
314 | - $success = true; |
|
314 | + $success = TRUE; |
|
315 | 315 | // Get metadata for logical unit. |
316 | 316 | $metadata = $doc->metadataArray[$logicalUnit['id']]; |
317 | 317 | if (!empty($metadata)) { |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | $solrDoc->setField('root', $doc->rootId); |
349 | 349 | $solrDoc->setField('sid', $logicalUnit['id']); |
350 | 350 | // There can be only one toplevel unit per UID, independently of backend configuration |
351 | - $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? true : false); |
|
351 | + $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? TRUE : FALSE); |
|
352 | 352 | $solrDoc->setField('type', $logicalUnit['type'], self::$fields['fieldboost']['type']); |
353 | 353 | $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
354 | 354 | $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
@@ -403,15 +403,15 @@ discard block |
||
403 | 403 | } catch (\Exception $e) { |
404 | 404 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
405 | 405 | Helper::addMessage( |
406 | - Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()), |
|
407 | - Helper::getMessage('flash.error', true), |
|
406 | + Helper::getMessage('flash.solrException', TRUE) . '<br />' . htmlspecialchars($e->getMessage()), |
|
407 | + Helper::getMessage('flash.error', TRUE), |
|
408 | 408 | FlashMessage::ERROR, |
409 | - true, |
|
409 | + TRUE, |
|
410 | 410 | 'core.template.flashMessages' |
411 | 411 | ); |
412 | 412 | } |
413 | 413 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
414 | - return false; |
|
414 | + return FALSE; |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | // Check for child elements... |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $solrDoc->setField('partof', $doc->parentId); |
463 | 463 | $solrDoc->setField('root', $doc->rootId); |
464 | 464 | $solrDoc->setField('sid', $physicalUnit['id']); |
465 | - $solrDoc->setField('toplevel', false); |
|
465 | + $solrDoc->setField('toplevel', FALSE); |
|
466 | 466 | $solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']); |
467 | 467 | $solrDoc->setField('collection', $doc->metadataArray[$doc->toplevelId]['collection']); |
468 | 468 | |
@@ -500,18 +500,18 @@ discard block |
||
500 | 500 | } catch (\Exception $e) { |
501 | 501 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
502 | 502 | Helper::addMessage( |
503 | - Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()), |
|
504 | - Helper::getMessage('flash.error', true), |
|
503 | + Helper::getMessage('flash.solrException', TRUE) . '<br />' . htmlspecialchars($e->getMessage()), |
|
504 | + Helper::getMessage('flash.error', TRUE), |
|
505 | 505 | FlashMessage::ERROR, |
506 | - true, |
|
506 | + TRUE, |
|
507 | 507 | 'core.template.flashMessages' |
508 | 508 | ); |
509 | 509 | } |
510 | 510 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
511 | - return false; |
|
511 | + return FALSE; |
|
512 | 512 | } |
513 | 513 | } |
514 | - return true; |
|
514 | + return TRUE; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | /** |
@@ -537,10 +537,10 @@ discard block |
||
537 | 537 | self::loadIndexConf($pid); |
538 | 538 | } |
539 | 539 | } else { |
540 | - return false; |
|
540 | + return FALSE; |
|
541 | 541 | } |
542 | 542 | } |
543 | - return true; |
|
543 | + return TRUE; |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | /** |
@@ -671,14 +671,14 @@ discard block |
||
671 | 671 | if ($fileContent !== false) { |
672 | 672 | $textFormat = $this->getTextFormat($fileContent); |
673 | 673 | } else { |
674 | - $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"'); |
|
674 | + $this->logger->warning('Couldn\'t load full text file for structure node @ID "'.$id.'"'); |
|
675 | 675 | return $fullText; |
676 | 676 | } |
677 | 677 | break; |
678 | 678 | } |
679 | 679 | } |
680 | 680 | } else { |
681 | - $this->logger->warning('Invalid structure node @ID "' . $id . '"'); |
|
681 | + $this->logger->warning('Invalid structure node @ID "'.$id.'"'); |
|
682 | 682 | return $fullText; |
683 | 683 | } |
684 | 684 | // Is this text format supported? |
@@ -697,12 +697,12 @@ discard block |
||
697 | 697 | $textMiniOcr = $obj->getTextAsMiniOcr($ocrTextXml); |
698 | 698 | $this->rawTextArray[$id] = $textMiniOcr; |
699 | 699 | } else { |
700 | - $this->logger->warning('Invalid class/method "' . $class . '->getRawText()" for text format "' . $textFormat . '"'); |
|
700 | + $this->logger->warning('Invalid class/method "'.$class.'->getRawText()" for text format "'.$textFormat.'"'); |
|
701 | 701 | } |
702 | 702 | } |
703 | 703 | $fullText = $textMiniOcr; |
704 | 704 | } else { |
705 | - $this->logger->warning('Unsupported text format "' . $textFormat . '" in physical node with @ID "' . $id . '"'); |
|
705 | + $this->logger->warning('Unsupported text format "'.$textFormat.'" in physical node with @ID "'.$id.'"'); |
|
706 | 706 | } |
707 | 707 | return $fullText; |
708 | 708 | } |
@@ -770,10 +770,10 @@ discard block |
||
770 | 770 | $title = self::getTitle($partof, true); |
771 | 771 | } |
772 | 772 | } else { |
773 | - Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING); |
|
773 | + Helper::log('No document with UID '.$uid.' found or document not accessible', LOG_SEVERITY_WARNING); |
|
774 | 774 | } |
775 | 775 | } else { |
776 | - Helper::log('Invalid UID ' . $uid . ' for document', LOG_SEVERITY_ERROR); |
|
776 | + Helper::log('Invalid UID '.$uid.' for document', LOG_SEVERITY_ERROR); |
|
777 | 777 | } |
778 | 778 | return $title; |
779 | 779 | } |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | // the actual loading is format specific |
909 | 909 | return $this->loadLocation($location); |
910 | 910 | } else { |
911 | - $this->logger->error('Invalid file location "' . $location . '" for document loading'); |
|
911 | + $this->logger->error('Invalid file location "'.$location.'" for document loading'); |
|
912 | 912 | } |
913 | 913 | return false; |
914 | 914 | } |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | // Retain current PID. |
1019 | 1019 | $pid = $this->pid; |
1020 | 1020 | } elseif (!$pid) { |
1021 | - $this->logger->error('Invalid PID ' . $pid . ' for document saving'); |
|
1021 | + $this->logger->error('Invalid PID '.$pid.' for document saving'); |
|
1022 | 1022 | return false; |
1023 | 1023 | } |
1024 | 1024 | // Set PID for metadata definitions. |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | if ($resArray = $result->fetch()) { |
1056 | 1056 | $structure = $resArray['uid']; |
1057 | 1057 | } else { |
1058 | - $this->logger->error('Could not identify document/structure type "' . $queryBuilder->expr()->literal($metadata['type'][0]) . '"'); |
|
1058 | + $this->logger->error('Could not identify document/structure type "'.$queryBuilder->expr()->literal($metadata['type'][0]).'"'); |
|
1059 | 1059 | return false; |
1060 | 1060 | } |
1061 | 1061 | $metadata['type'][0] = $structure; |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | if ($core) { |
1305 | 1305 | return Indexer::add($this, $core); |
1306 | 1306 | } else { |
1307 | - $this->logger->notice('Invalid UID "' . $core . '" for Solr core'); |
|
1307 | + $this->logger->notice('Invalid UID "'.$core.'" for Solr core'); |
|
1308 | 1308 | return false; |
1309 | 1309 | } |
1310 | 1310 | } |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | // Set metadata definitions' PID. |
1383 | 1383 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
1384 | 1384 | if (!$cPid) { |
1385 | - $this->logger->error('Invalid PID ' . $cPid . ' for metadata definitions'); |
|
1385 | + $this->logger->error('Invalid PID '.$cPid.' for metadata definitions'); |
|
1386 | 1386 | return []; |
1387 | 1387 | } |
1388 | 1388 | if ( |
@@ -1710,7 +1710,7 @@ discard block |
||
1710 | 1710 | // Document ready! |
1711 | 1711 | $this->ready = true; |
1712 | 1712 | } else { |
1713 | - $this->logger->error('No document with UID ' . $uid . ' found or document not accessible'); |
|
1713 | + $this->logger->error('No document with UID '.$uid.' found or document not accessible'); |
|
1714 | 1714 | } |
1715 | 1715 | } |
1716 | 1716 | |
@@ -1725,12 +1725,12 @@ discard block |
||
1725 | 1725 | */ |
1726 | 1726 | public function __get($var) |
1727 | 1727 | { |
1728 | - $method = '_get' . ucfirst($var); |
|
1728 | + $method = '_get'.ucfirst($var); |
|
1729 | 1729 | if ( |
1730 | 1730 | !property_exists($this, $var) |
1731 | 1731 | || !method_exists($this, $method) |
1732 | 1732 | ) { |
1733 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
1733 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
1734 | 1734 | return; |
1735 | 1735 | } else { |
1736 | 1736 | return $this->$method(); |
@@ -1763,12 +1763,12 @@ discard block |
||
1763 | 1763 | */ |
1764 | 1764 | public function __set($var, $value) |
1765 | 1765 | { |
1766 | - $method = '_set' . ucfirst($var); |
|
1766 | + $method = '_set'.ucfirst($var); |
|
1767 | 1767 | if ( |
1768 | 1768 | !property_exists($this, $var) |
1769 | 1769 | || !method_exists($this, $method) |
1770 | 1770 | ) { |
1771 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
1771 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
1772 | 1772 | } else { |
1773 | 1773 | $this->$method($value); |
1774 | 1774 | } |
@@ -48,8 +48,7 @@ discard block |
||
48 | 48 | * @property-read mixed $uid This holds the UID or the URL of the document |
49 | 49 | * @abstract |
50 | 50 | */ |
51 | -abstract class Document |
|
52 | -{ |
|
51 | +abstract class Document { |
|
53 | 52 | /** |
54 | 53 | * This holds the logger |
55 | 54 | * |
@@ -341,8 +340,7 @@ discard block |
||
341 | 340 | * |
342 | 341 | * @return void |
343 | 342 | */ |
344 | - public static function clearRegistry() |
|
345 | - { |
|
343 | + public static function clearRegistry() { |
|
346 | 344 | // Reset registry array. |
347 | 345 | self::$registry = []; |
348 | 346 | } |
@@ -607,8 +605,7 @@ discard block |
||
607 | 605 | * |
608 | 606 | * @return int The physical page number |
609 | 607 | */ |
610 | - public function getPhysicalPage($logicalPage) |
|
611 | - { |
|
608 | + public function getPhysicalPage($logicalPage) { |
|
612 | 609 | if ( |
613 | 610 | !empty($this->lastSearchedPhysicalPage['logicalPage']) |
614 | 611 | && $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage |
@@ -653,8 +650,7 @@ discard block |
||
653 | 650 | * |
654 | 651 | * @return string The OCR full text |
655 | 652 | */ |
656 | - protected function getFullTextFromXml($id) |
|
657 | - { |
|
653 | + protected function getFullTextFromXml($id) { |
|
658 | 654 | $fullText = ''; |
659 | 655 | // Load available text formats, ... |
660 | 656 | $this->loadFormats(); |
@@ -716,8 +712,7 @@ discard block |
||
716 | 712 | * |
717 | 713 | * @return string The format of the OCR full text |
718 | 714 | */ |
719 | - private function getTextFormat($fileContent) |
|
720 | - { |
|
715 | + private function getTextFormat($fileContent) { |
|
721 | 716 | $xml = Helper::getXmlFileAsString($fileContent); |
722 | 717 | |
723 | 718 | if ($xml !== false) { |
@@ -740,8 +735,7 @@ discard block |
||
740 | 735 | * |
741 | 736 | * @return string The title of the document itself or a parent document |
742 | 737 | */ |
743 | - public static function getTitle($uid, $recursive = false) |
|
744 | - { |
|
738 | + public static function getTitle($uid, $recursive = false) { |
|
745 | 739 | $title = ''; |
746 | 740 | // Sanitize input. |
747 | 741 | $uid = max(intval($uid), 0); |
@@ -793,8 +787,7 @@ discard block |
||
793 | 787 | * |
794 | 788 | * @return array The logical structure node's / resource's parsed metadata array |
795 | 789 | */ |
796 | - public function getTitledata($cPid = 0) |
|
797 | - { |
|
790 | + public function getTitledata($cPid = 0) { |
|
798 | 791 | $titledata = $this->getMetadata($this->_getToplevelId(), $cPid); |
799 | 792 | // Add information from METS structural map to titledata array. |
800 | 793 | if ($this instanceof MetsDocument) { |
@@ -827,8 +820,7 @@ discard block |
||
827 | 820 | * @return int|bool: false if structure with $logId is not a child of this substructure, |
828 | 821 | * or the actual depth. |
829 | 822 | */ |
830 | - protected function getTreeDepth($structure, $depth, $logId) |
|
831 | - { |
|
823 | + protected function getTreeDepth($structure, $depth, $logId) { |
|
832 | 824 | foreach ($structure as $element) { |
833 | 825 | if ($element['id'] == $logId) { |
834 | 826 | return $depth; |
@@ -850,8 +842,7 @@ discard block |
||
850 | 842 | * @param string $logId: The id of the logical structure element whose depth is requested |
851 | 843 | * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC. |
852 | 844 | */ |
853 | - public function getStructureDepth($logId) |
|
854 | - { |
|
845 | + public function getStructureDepth($logId) { |
|
855 | 846 | return $this->getTreeDepth($this->_getTableOfContents(), 1, $logId); |
856 | 847 | } |
857 | 848 | |
@@ -901,8 +892,7 @@ discard block |
||
901 | 892 | * |
902 | 893 | * @return bool true on success or false on failure |
903 | 894 | */ |
904 | - protected function load($location) |
|
905 | - { |
|
895 | + protected function load($location) { |
|
906 | 896 | // Load XML / JSON-LD file. |
907 | 897 | if (GeneralUtility::isValidUrl($location)) { |
908 | 898 | // Load extension configuration |
@@ -935,8 +925,7 @@ discard block |
||
935 | 925 | * |
936 | 926 | * @return void |
937 | 927 | */ |
938 | - protected function loadFormats() |
|
939 | - { |
|
928 | + protected function loadFormats() { |
|
940 | 929 | if (!$this->formatsLoaded) { |
941 | 930 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
942 | 931 | ->getQueryBuilderForTable('tx_dlf_formats'); |
@@ -976,8 +965,7 @@ discard block |
||
976 | 965 | * |
977 | 966 | * @return void |
978 | 967 | */ |
979 | - public function registerNamespaces(&$obj) |
|
980 | - { |
|
968 | + public function registerNamespaces(&$obj) { |
|
981 | 969 | // 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. |
982 | 970 | $this->loadFormats(); |
983 | 971 | // Do we have a \SimpleXMLElement or \DOMXPath object? |
@@ -1006,8 +994,7 @@ discard block |
||
1006 | 994 | * |
1007 | 995 | * @return bool true on success or false on failure |
1008 | 996 | */ |
1009 | - public function save($pid = 0, $core = 0, $owner = null) |
|
1010 | - { |
|
997 | + public function save($pid = 0, $core = 0, $owner = null) { |
|
1011 | 998 | if (\TYPO3_MODE !== 'BE') { |
1012 | 999 | $this->logger->error('Saving a document is only allowed in the backend'); |
1013 | 1000 | return false; |
@@ -1335,8 +1322,7 @@ discard block |
||
1335 | 1322 | * |
1336 | 1323 | * @return int The PID of the metadata definitions |
1337 | 1324 | */ |
1338 | - protected function _getCPid() |
|
1339 | - { |
|
1325 | + protected function _getCPid() { |
|
1340 | 1326 | return $this->cPid; |
1341 | 1327 | } |
1342 | 1328 | |
@@ -1347,8 +1333,7 @@ discard block |
||
1347 | 1333 | * |
1348 | 1334 | * @return bool Are there any fulltext files available? |
1349 | 1335 | */ |
1350 | - protected function _getHasFulltext() |
|
1351 | - { |
|
1336 | + protected function _getHasFulltext() { |
|
1352 | 1337 | $this->ensureHasFulltextIsSet(); |
1353 | 1338 | return $this->hasFulltext; |
1354 | 1339 | } |
@@ -1360,8 +1345,7 @@ discard block |
||
1360 | 1345 | * |
1361 | 1346 | * @return string The location of the document |
1362 | 1347 | */ |
1363 | - protected function _getLocation() |
|
1364 | - { |
|
1348 | + protected function _getLocation() { |
|
1365 | 1349 | return $this->location; |
1366 | 1350 | } |
1367 | 1351 | |
@@ -1383,8 +1367,7 @@ discard block |
||
1383 | 1367 | * |
1384 | 1368 | * @return array Array of metadata with their corresponding logical structure node ID as key |
1385 | 1369 | */ |
1386 | - protected function _getMetadataArray() |
|
1387 | - { |
|
1370 | + protected function _getMetadataArray() { |
|
1388 | 1371 | // Set metadata definitions' PID. |
1389 | 1372 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
1390 | 1373 | if (!$cPid) { |
@@ -1409,8 +1392,7 @@ discard block |
||
1409 | 1392 | * |
1410 | 1393 | * @return int The total number of pages and/or tracks |
1411 | 1394 | */ |
1412 | - protected function _getNumPages() |
|
1413 | - { |
|
1395 | + protected function _getNumPages() { |
|
1414 | 1396 | $this->_getPhysicalStructure(); |
1415 | 1397 | return $this->numPages; |
1416 | 1398 | } |
@@ -1422,8 +1404,7 @@ discard block |
||
1422 | 1404 | * |
1423 | 1405 | * @return int The UID of the parent document or zero if not applicable |
1424 | 1406 | */ |
1425 | - protected function _getParentId() |
|
1426 | - { |
|
1407 | + protected function _getParentId() { |
|
1427 | 1408 | return $this->parentId; |
1428 | 1409 | } |
1429 | 1410 | |
@@ -1446,8 +1427,7 @@ discard block |
||
1446 | 1427 | * |
1447 | 1428 | * @return array Array of elements' type, label and file representations ordered by @ID attribute / Canvas order |
1448 | 1429 | */ |
1449 | - protected function _getPhysicalStructureInfo() |
|
1450 | - { |
|
1430 | + protected function _getPhysicalStructureInfo() { |
|
1451 | 1431 | // Is there no physical structure array yet? |
1452 | 1432 | if (!$this->physicalStructureLoaded) { |
1453 | 1433 | // Build physical structure array. |
@@ -1463,8 +1443,7 @@ discard block |
||
1463 | 1443 | * |
1464 | 1444 | * @return int The PID of the document or zero if not in database |
1465 | 1445 | */ |
1466 | - protected function _getPid() |
|
1467 | - { |
|
1446 | + protected function _getPid() { |
|
1468 | 1447 | return $this->pid; |
1469 | 1448 | } |
1470 | 1449 | |
@@ -1475,8 +1454,7 @@ discard block |
||
1475 | 1454 | * |
1476 | 1455 | * @return bool Is the document instantiated successfully? |
1477 | 1456 | */ |
1478 | - protected function _getReady() |
|
1479 | - { |
|
1457 | + protected function _getReady() { |
|
1480 | 1458 | return $this->ready; |
1481 | 1459 | } |
1482 | 1460 | |
@@ -1487,8 +1465,7 @@ discard block |
||
1487 | 1465 | * |
1488 | 1466 | * @return mixed The METS file's / IIIF manifest's record identifier |
1489 | 1467 | */ |
1490 | - protected function _getRecordId() |
|
1491 | - { |
|
1468 | + protected function _getRecordId() { |
|
1492 | 1469 | return $this->recordId; |
1493 | 1470 | } |
1494 | 1471 | |
@@ -1499,8 +1476,7 @@ discard block |
||
1499 | 1476 | * |
1500 | 1477 | * @return int The UID of the root document or zero if not applicable |
1501 | 1478 | */ |
1502 | - protected function _getRootId() |
|
1503 | - { |
|
1479 | + protected function _getRootId() { |
|
1504 | 1480 | if (!$this->rootIdLoaded) { |
1505 | 1481 | if ($this->parentId) { |
1506 | 1482 | $parent = self::getInstance($this->parentId, $this->pid); |
@@ -1530,8 +1506,7 @@ discard block |
||
1530 | 1506 | * |
1531 | 1507 | * @return array Array of structure nodes' id, label, type and physical page indexes/mptr / Canvas link with original hierarchy preserved |
1532 | 1508 | */ |
1533 | - protected function _getTableOfContents() |
|
1534 | - { |
|
1509 | + protected function _getTableOfContents() { |
|
1535 | 1510 | // Is there no logical structure array yet? |
1536 | 1511 | if (!$this->tableOfContentsLoaded) { |
1537 | 1512 | // Get all logical structures. |
@@ -1572,8 +1547,7 @@ discard block |
||
1572 | 1547 | * |
1573 | 1548 | * @return mixed The UID or the URL of the document |
1574 | 1549 | */ |
1575 | - protected function _getUid() |
|
1576 | - { |
|
1550 | + protected function _getUid() { |
|
1577 | 1551 | return $this->uid; |
1578 | 1552 | } |
1579 | 1553 | |
@@ -1586,8 +1560,7 @@ discard block |
||
1586 | 1560 | * |
1587 | 1561 | * @return void |
1588 | 1562 | */ |
1589 | - protected function _setCPid($value) |
|
1590 | - { |
|
1563 | + protected function _setCPid($value) { |
|
1591 | 1564 | $this->cPid = max(intval($value), 0); |
1592 | 1565 | } |
1593 | 1566 | |
@@ -1598,8 +1571,7 @@ discard block |
||
1598 | 1571 | * |
1599 | 1572 | * @return void |
1600 | 1573 | */ |
1601 | - protected function __clone() |
|
1602 | - { |
|
1574 | + protected function __clone() { |
|
1603 | 1575 | // This method is defined as protected because singleton objects should not be cloned. |
1604 | 1576 | } |
1605 | 1577 | |
@@ -1616,8 +1588,7 @@ discard block |
||
1616 | 1588 | * |
1617 | 1589 | * @return void |
1618 | 1590 | */ |
1619 | - protected function __construct($uid, $pid, $preloadedDocument) |
|
1620 | - { |
|
1591 | + protected function __construct($uid, $pid, $preloadedDocument) { |
|
1621 | 1592 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(); |
1622 | 1593 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
1623 | 1594 | ->getQueryBuilderForTable('tx_dlf_documents'); |
@@ -1730,8 +1701,7 @@ discard block |
||
1730 | 1701 | * |
1731 | 1702 | * @return mixed Value of $this->$var |
1732 | 1703 | */ |
1733 | - public function __get($var) |
|
1734 | - { |
|
1704 | + public function __get($var) { |
|
1735 | 1705 | $method = '_get' . ucfirst($var); |
1736 | 1706 | if ( |
1737 | 1707 | !property_exists($this, $var) |
@@ -1753,8 +1723,7 @@ discard block |
||
1753 | 1723 | * |
1754 | 1724 | * @return bool true if variable is set and not empty, false otherwise |
1755 | 1725 | */ |
1756 | - public function __isset($var) |
|
1757 | - { |
|
1726 | + public function __isset($var) { |
|
1758 | 1727 | return !empty($this->__get($var)); |
1759 | 1728 | } |
1760 | 1729 | |
@@ -1768,8 +1737,7 @@ discard block |
||
1768 | 1737 | * |
1769 | 1738 | * @return void |
1770 | 1739 | */ |
1771 | - public function __set($var, $value) |
|
1772 | - { |
|
1740 | + public function __set($var, $value) { |
|
1773 | 1741 | $method = '_set' . ucfirst($var); |
1774 | 1742 | if ( |
1775 | 1743 | !property_exists($this, $var) |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @var bool |
104 | 104 | * @access protected |
105 | 105 | */ |
106 | - protected $formatsLoaded = false; |
|
106 | + protected $formatsLoaded = FALSE; |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Are there any fulltext files available? This also includes IIIF text annotations |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @var bool |
114 | 114 | * @access protected |
115 | 115 | */ |
116 | - protected $hasFulltext = false; |
|
116 | + protected $hasFulltext = FALSE; |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Last searched logical and physical page |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @var array |
122 | 122 | * @access protected |
123 | 123 | */ |
124 | - protected $lastSearchedPhysicalPage = ['logicalPage' => null, 'physicalPage' => null]; |
|
124 | + protected $lastSearchedPhysicalPage = ['logicalPage' => NULL, 'physicalPage' => NULL]; |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * This holds the documents location |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @var bool |
156 | 156 | * @access protected |
157 | 157 | */ |
158 | - protected $metadataArrayLoaded = false; |
|
158 | + protected $metadataArrayLoaded = FALSE; |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * The holds the total number of pages |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @var bool |
197 | 197 | * @access protected |
198 | 198 | */ |
199 | - protected $physicalStructureLoaded = false; |
|
199 | + protected $physicalStructureLoaded = FALSE; |
|
200 | 200 | |
201 | 201 | /** |
202 | 202 | * This holds the PID of the document or zero if not in database |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @var bool |
222 | 222 | * @access protected |
223 | 223 | */ |
224 | - protected $ready = false; |
|
224 | + protected $ready = FALSE; |
|
225 | 225 | |
226 | 226 | /** |
227 | 227 | * The METS file's / IIIF manifest's record identifier |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @var bool |
256 | 256 | * @access protected |
257 | 257 | */ |
258 | - protected $rootIdLoaded = false; |
|
258 | + protected $rootIdLoaded = FALSE; |
|
259 | 259 | |
260 | 260 | /** |
261 | 261 | * This holds the smLinks between logical and physical structMap |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @var bool |
273 | 273 | * @access protected |
274 | 274 | */ |
275 | - protected $smLinksLoaded = false; |
|
275 | + protected $smLinksLoaded = FALSE; |
|
276 | 276 | |
277 | 277 | /** |
278 | 278 | * This holds the logical structure |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @var bool |
290 | 290 | * @access protected |
291 | 291 | */ |
292 | - protected $tableOfContentsLoaded = false; |
|
292 | + protected $tableOfContentsLoaded = FALSE; |
|
293 | 293 | |
294 | 294 | /** |
295 | 295 | * This holds the document's thumbnail location |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @var bool |
307 | 307 | * @access protected |
308 | 308 | */ |
309 | - protected $thumbnailLoaded = false; |
|
309 | + protected $thumbnailLoaded = FALSE; |
|
310 | 310 | |
311 | 311 | /** |
312 | 312 | * This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF) |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | * |
424 | 424 | * @return \Kitodo\Dlf\Common\Document Instance of this class, either MetsDocument or IiifManifest |
425 | 425 | */ |
426 | - public static function &getInstance($uid, $pid = 0, $forceReload = false) |
|
426 | + public static function &getInstance($uid, $pid = 0, $forceReload = FALSE) |
|
427 | 427 | { |
428 | 428 | // Sanitize input. |
429 | 429 | $pid = max(intval($pid), 0); |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | } |
464 | 464 | } |
465 | 465 | // Create new instance depending on format (METS or IIIF) ... |
466 | - $instance = null; |
|
467 | - $documentFormat = null; |
|
468 | - $xml = null; |
|
469 | - $iiif = null; |
|
466 | + $instance = NULL; |
|
467 | + $documentFormat = NULL; |
|
468 | + $xml = NULL; |
|
469 | + $iiif = NULL; |
|
470 | 470 | // Try to get document format from database |
471 | 471 | if (MathUtility::canBeInterpretedAsInteger($uid)) { |
472 | 472 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -515,17 +515,17 @@ discard block |
||
515 | 515 | @ini_set('user_agent', $extConf['useragent']); |
516 | 516 | } |
517 | 517 | $content = GeneralUtility::getUrl($location); |
518 | - if ($content !== false) { |
|
518 | + if ($content !== FALSE) { |
|
519 | 519 | $xml = Helper::getXmlFileAsString($content); |
520 | - if ($xml !== false) { |
|
520 | + if ($xml !== FALSE) { |
|
521 | 521 | /* @var $xml \SimpleXMLElement */ |
522 | 522 | $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/'); |
523 | 523 | $xpathResult = $xml->xpath('//mets:mets'); |
524 | - $documentFormat = !empty($xpathResult) ? 'METS' : null; |
|
524 | + $documentFormat = !empty($xpathResult) ? 'METS' : NULL; |
|
525 | 525 | } else { |
526 | 526 | // Try to load file as IIIF resource instead. |
527 | - $contentAsJsonArray = json_decode($content, true); |
|
528 | - if ($contentAsJsonArray !== null) { |
|
527 | + $contentAsJsonArray = json_decode($content, TRUE); |
|
528 | + if ($contentAsJsonArray !== NULL) { |
|
529 | 529 | // Load plugin configuration. |
530 | 530 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
531 | 531 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
582 | 582 | */ |
583 | - public abstract function getLogicalStructure($id, $recursive = false); |
|
583 | + public abstract function getLogicalStructure($id, $recursive = FALSE); |
|
584 | 584 | |
585 | 585 | /** |
586 | 586 | * This extracts all the metadata for a logical structure node |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | } else { |
618 | 618 | $physicalPage = 0; |
619 | 619 | foreach ($this->physicalStructureInfo as $page) { |
620 | - if (strpos($page['orderlabel'], $logicalPage) !== false) { |
|
620 | + if (strpos($page['orderlabel'], $logicalPage) !== FALSE) { |
|
621 | 621 | $this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage; |
622 | 622 | $this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage; |
623 | 623 | return $physicalPage; |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | if (!empty($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])) { |
669 | 669 | // Get full text file. |
670 | 670 | $fileContent = GeneralUtility::getUrl($this->getFileLocation($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])); |
671 | - if ($fileContent !== false) { |
|
671 | + if ($fileContent !== FALSE) { |
|
672 | 672 | $textFormat = $this->getTextFormat($fileContent); |
673 | 673 | } else { |
674 | 674 | $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"'); |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | { |
721 | 721 | $xml = Helper::getXmlFileAsString($fileContent); |
722 | 722 | |
723 | - if ($xml !== false) { |
|
723 | + if ($xml !== FALSE) { |
|
724 | 724 | // Get the root element's name as text format. |
725 | 725 | return strtoupper($xml->getName()); |
726 | 726 | } else { |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | * |
741 | 741 | * @return string The title of the document itself or a parent document |
742 | 742 | */ |
743 | - public static function getTitle($uid, $recursive = false) |
|
743 | + public static function getTitle($uid, $recursive = FALSE) |
|
744 | 744 | { |
745 | 745 | $title = ''; |
746 | 746 | // Sanitize input. |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | && intval($partof) |
774 | 774 | && $partof != $uid |
775 | 775 | ) { |
776 | - $title = self::getTitle($partof, true); |
|
776 | + $title = self::getTitle($partof, TRUE); |
|
777 | 777 | } |
778 | 778 | } else { |
779 | 779 | Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING); |
@@ -834,12 +834,12 @@ discard block |
||
834 | 834 | return $depth; |
835 | 835 | } elseif (array_key_exists('children', $element)) { |
836 | 836 | $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId); |
837 | - if ($foundInChildren !== false) { |
|
837 | + if ($foundInChildren !== FALSE) { |
|
838 | 838 | return $foundInChildren; |
839 | 839 | } |
840 | 840 | } |
841 | 841 | } |
842 | - return false; |
|
842 | + return FALSE; |
|
843 | 843 | } |
844 | 844 | |
845 | 845 | /** |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | } else { |
917 | 917 | $this->logger->error('Invalid file location "' . $location . '" for document loading'); |
918 | 918 | } |
919 | - return false; |
|
919 | + return FALSE; |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | /** |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | 'class' => $resArray['class'] |
964 | 964 | ]; |
965 | 965 | } |
966 | - $this->formatsLoaded = true; |
|
966 | + $this->formatsLoaded = TRUE; |
|
967 | 967 | } |
968 | 968 | } |
969 | 969 | |
@@ -1006,11 +1006,11 @@ discard block |
||
1006 | 1006 | * |
1007 | 1007 | * @return bool true on success or false on failure |
1008 | 1008 | */ |
1009 | - public function save($pid = 0, $core = 0, $owner = null) |
|
1009 | + public function save($pid = 0, $core = 0, $owner = NULL) |
|
1010 | 1010 | { |
1011 | 1011 | if (\TYPO3_MODE !== 'BE') { |
1012 | 1012 | $this->logger->error('Saving a document is only allowed in the backend'); |
1013 | - return false; |
|
1013 | + return FALSE; |
|
1014 | 1014 | } |
1015 | 1015 | // Make sure $pid is a non-negative integer. |
1016 | 1016 | $pid = max(intval($pid), 0); |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | $pid = $this->pid; |
1026 | 1026 | } elseif (!$pid) { |
1027 | 1027 | $this->logger->error('Invalid PID ' . $pid . ' for document saving'); |
1028 | - return false; |
|
1028 | + return FALSE; |
|
1029 | 1029 | } |
1030 | 1030 | // Set PID for metadata definitions. |
1031 | 1031 | $this->cPid = $pid; |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | // Check for record identifier. |
1039 | 1039 | if (empty($metadata['record_id'][0])) { |
1040 | 1040 | $this->logger->error('No record identifier found to avoid duplication'); |
1041 | - return false; |
|
1041 | + return FALSE; |
|
1042 | 1042 | } |
1043 | 1043 | // Load plugin configuration. |
1044 | 1044 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | $structure = $resArray['uid']; |
1063 | 1063 | } else { |
1064 | 1064 | $this->logger->error('Could not identify document/structure type "' . $queryBuilder->expr()->literal($metadata['type'][0]) . '"'); |
1065 | - return false; |
|
1065 | + return FALSE; |
|
1066 | 1066 | } |
1067 | 1067 | $metadata['type'][0] = $structure; |
1068 | 1068 | |
@@ -1122,9 +1122,9 @@ discard block |
||
1122 | 1122 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
1123 | 1123 | Helper::addMessage( |
1124 | 1124 | htmlspecialchars(sprintf(Helper::getMessage('flash.newCollection'), $collection, $substUid[$collNewUid])), |
1125 | - Helper::getMessage('flash.attention', true), |
|
1125 | + Helper::getMessage('flash.attention', TRUE), |
|
1126 | 1126 | \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
1127 | - true |
|
1127 | + TRUE |
|
1128 | 1128 | ); |
1129 | 1129 | } |
1130 | 1130 | } |
@@ -1175,9 +1175,9 @@ discard block |
||
1175 | 1175 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
1176 | 1176 | Helper::addMessage( |
1177 | 1177 | htmlspecialchars(sprintf(Helper::getMessage('flash.newLibrary'), $owner, $ownerUid)), |
1178 | - Helper::getMessage('flash.attention', true), |
|
1178 | + Helper::getMessage('flash.attention', TRUE), |
|
1179 | 1179 | \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
1180 | - true |
|
1180 | + TRUE |
|
1181 | 1181 | ); |
1182 | 1182 | } |
1183 | 1183 | } |
@@ -1265,7 +1265,7 @@ discard block |
||
1265 | 1265 | 'author' => implode('; ', $metadata['author']), |
1266 | 1266 | 'year' => implode('; ', $metadata['year']), |
1267 | 1267 | 'place' => implode('; ', $metadata['place']), |
1268 | - 'thumbnail' => $this->_getThumbnail(true), |
|
1268 | + 'thumbnail' => $this->_getThumbnail(TRUE), |
|
1269 | 1269 | 'metadata' => serialize($listed), |
1270 | 1270 | 'metadata_sorting' => serialize($sortable), |
1271 | 1271 | 'structure' => $metadata['type'][0], |
@@ -1301,9 +1301,9 @@ discard block |
||
1301 | 1301 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
1302 | 1302 | Helper::addMessage( |
1303 | 1303 | htmlspecialchars(sprintf(Helper::getMessage('flash.documentSaved'), $metadata['title'][0], $this->uid)), |
1304 | - Helper::getMessage('flash.done', true), |
|
1304 | + Helper::getMessage('flash.done', TRUE), |
|
1305 | 1305 | \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
1306 | - true |
|
1306 | + TRUE |
|
1307 | 1307 | ); |
1308 | 1308 | } |
1309 | 1309 | // Add document to index. |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | return Indexer::add($this, $core); |
1312 | 1312 | } else { |
1313 | 1313 | $this->logger->notice('Invalid UID "' . $core . '" for Solr core'); |
1314 | - return false; |
|
1314 | + return FALSE; |
|
1315 | 1315 | } |
1316 | 1316 | } |
1317 | 1317 | |
@@ -1397,7 +1397,7 @@ discard block |
||
1397 | 1397 | ) { |
1398 | 1398 | $this->prepareMetadataArray($cPid); |
1399 | 1399 | $this->metadataArray[0] = $cPid; |
1400 | - $this->metadataArrayLoaded = true; |
|
1400 | + $this->metadataArrayLoaded = TRUE; |
|
1401 | 1401 | } |
1402 | 1402 | return $this->metadataArray; |
1403 | 1403 | } |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | $parent = self::getInstance($this->parentId, $this->pid); |
1507 | 1507 | $this->rootId = $parent->rootId; |
1508 | 1508 | } |
1509 | - $this->rootIdLoaded = true; |
|
1509 | + $this->rootIdLoaded = TRUE; |
|
1510 | 1510 | } |
1511 | 1511 | return $this->rootId; |
1512 | 1512 | } |
@@ -1535,8 +1535,8 @@ discard block |
||
1535 | 1535 | // Is there no logical structure array yet? |
1536 | 1536 | if (!$this->tableOfContentsLoaded) { |
1537 | 1537 | // Get all logical structures. |
1538 | - $this->getLogicalStructure('', true); |
|
1539 | - $this->tableOfContentsLoaded = true; |
|
1538 | + $this->getLogicalStructure('', TRUE); |
|
1539 | + $this->tableOfContentsLoaded = TRUE; |
|
1540 | 1540 | } |
1541 | 1541 | return $this->tableOfContents; |
1542 | 1542 | } |
@@ -1552,7 +1552,7 @@ discard block |
||
1552 | 1552 | * |
1553 | 1553 | * @return string The document's thumbnail location |
1554 | 1554 | */ |
1555 | - protected abstract function _getThumbnail($forceReload = false); |
|
1555 | + protected abstract function _getThumbnail($forceReload = FALSE); |
|
1556 | 1556 | |
1557 | 1557 | /** |
1558 | 1558 | * This returns the ID of the toplevel logical structure node |
@@ -1634,7 +1634,7 @@ discard block |
||
1634 | 1634 | && $this->load($uid))) { |
1635 | 1635 | // Initialize core METS object. |
1636 | 1636 | $this->init(); |
1637 | - if ($this->getDocument() !== null) { |
|
1637 | + if ($this->getDocument() !== NULL) { |
|
1638 | 1638 | // Cast to string for safety reasons. |
1639 | 1639 | $location = (string) $uid; |
1640 | 1640 | $this->establishRecordId($pid); |
@@ -1692,30 +1692,30 @@ discard block |
||
1692 | 1692 | $this->parentId = $resArray['partof']; |
1693 | 1693 | $this->thumbnail = $resArray['thumbnail']; |
1694 | 1694 | $this->location = $resArray['location']; |
1695 | - $this->thumbnailLoaded = true; |
|
1695 | + $this->thumbnailLoaded = TRUE; |
|
1696 | 1696 | // Load XML file if necessary... |
1697 | 1697 | if ( |
1698 | - $this->getDocument() === null |
|
1698 | + $this->getDocument() === NULL |
|
1699 | 1699 | && $this->load($this->location) |
1700 | 1700 | ) { |
1701 | 1701 | // ...and set some basic properties. |
1702 | 1702 | $this->init(); |
1703 | 1703 | } |
1704 | 1704 | // Do we have a METS / IIIF object now? |
1705 | - if ($this->getDocument() !== null) { |
|
1705 | + if ($this->getDocument() !== NULL) { |
|
1706 | 1706 | // Set new location if necessary. |
1707 | 1707 | if (!empty($location)) { |
1708 | 1708 | $this->location = $location; |
1709 | 1709 | } |
1710 | 1710 | // Document ready! |
1711 | - $this->ready = true; |
|
1711 | + $this->ready = TRUE; |
|
1712 | 1712 | } |
1713 | - } elseif ($this->getDocument() !== null) { |
|
1713 | + } elseif ($this->getDocument() !== NULL) { |
|
1714 | 1714 | // Set location as UID for documents not in database. |
1715 | 1715 | $this->uid = $location; |
1716 | 1716 | $this->location = $location; |
1717 | 1717 | // Document ready! |
1718 | - $this->ready = true; |
|
1718 | + $this->ready = TRUE; |
|
1719 | 1719 | } else { |
1720 | 1720 | $this->logger->error('No document with UID ' . $uid . ' found or document not accessible'); |
1721 | 1721 | } |