@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class Region |
|
24 | -{ |
|
23 | +class Region { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * @access private |
@@ -87,8 +86,7 @@ discard block |
||
87 | 86 | * |
88 | 87 | * @return void |
89 | 88 | */ |
90 | - public function __construct(int $id, array $region) |
|
91 | - { |
|
89 | + public function __construct(int $id, array $region) { |
|
92 | 90 | $this->id = $id; |
93 | 91 | $this->pageId = $region['pageIdx'] ?? null; |
94 | 92 | $this->xBeginPosition = $region['ulx']; |
@@ -90,7 +90,7 @@ |
||
90 | 90 | public function __construct(int $id, array $region) |
91 | 91 | { |
92 | 92 | $this->id = $id; |
93 | - $this->pageId = $region['pageIdx'] ?? null; |
|
93 | + $this->pageId = $region['pageIdx'] ?? NULL; |
|
94 | 94 | $this->xBeginPosition = $region['ulx']; |
95 | 95 | $this->xEndPosition = $region['lrx']; |
96 | 96 | $this->yBeginPosition = $region['uly']; |
@@ -38,8 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @access public |
40 | 40 | */ |
41 | -class Helper |
|
42 | -{ |
|
41 | +class Helper { |
|
43 | 42 | /** |
44 | 43 | * @access public |
45 | 44 | * @static |
@@ -199,8 +198,7 @@ discard block |
||
199 | 198 | * |
200 | 199 | * @return mixed The decrypted value or false on error |
201 | 200 | */ |
202 | - public static function decrypt(string $encrypted) |
|
203 | - { |
|
201 | + public static function decrypt(string $encrypted) { |
|
204 | 202 | if ( |
205 | 203 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
206 | 204 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -240,8 +238,7 @@ discard block |
||
240 | 238 | * |
241 | 239 | * @return \SimpleXMLElement|false |
242 | 240 | */ |
243 | - public static function getXmlFileAsString($content) |
|
244 | - { |
|
241 | + public static function getXmlFileAsString($content) { |
|
245 | 242 | // Don't make simplexml_load_string throw (when $content is an array |
246 | 243 | // or object) |
247 | 244 | if (!is_string($content)) { |
@@ -313,8 +310,7 @@ discard block |
||
313 | 310 | * |
314 | 311 | * @return mixed Hashed string or false on error |
315 | 312 | */ |
316 | - public static function digest(string $string) |
|
317 | - { |
|
313 | + public static function digest(string $string) { |
|
318 | 314 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
319 | 315 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
320 | 316 | return false; |
@@ -334,8 +330,7 @@ discard block |
||
334 | 330 | * |
335 | 331 | * @return mixed Encrypted string or false on error |
336 | 332 | */ |
337 | - public static function encrypt(string $string) |
|
338 | - { |
|
333 | + public static function encrypt(string $string) { |
|
339 | 334 | if ( |
340 | 335 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
341 | 336 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -578,8 +573,7 @@ discard block |
||
578 | 573 | * |
579 | 574 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
580 | 575 | */ |
581 | - public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
582 | - { |
|
576 | + public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) { |
|
583 | 577 | $context = GeneralUtility::makeInstance(Context::class); |
584 | 578 | |
585 | 579 | if ( |
@@ -818,8 +812,7 @@ discard block |
||
818 | 812 | * |
819 | 813 | * @return void |
820 | 814 | */ |
821 | - private function __construct() |
|
822 | - { |
|
815 | + private function __construct() { |
|
823 | 816 | // This is a static class, thus no instances should be created. |
824 | 817 | } |
825 | 818 | |
@@ -850,8 +843,7 @@ discard block |
||
850 | 843 | * |
851 | 844 | * @return string|bool |
852 | 845 | */ |
853 | - public static function getUrl(string $url) |
|
854 | - { |
|
846 | + public static function getUrl(string $url) { |
|
855 | 847 | if (!Helper::isValidHttpUrl($url)) { |
856 | 848 | return false; |
857 | 849 | } |
@@ -932,8 +924,7 @@ discard block |
||
932 | 924 | * |
933 | 925 | * @return mixed |
934 | 926 | */ |
935 | - private static function getLocalConfigurationByPath(string $path) |
|
936 | - { |
|
927 | + private static function getLocalConfigurationByPath(string $path) { |
|
937 | 928 | $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class); |
938 | 929 | |
939 | 930 | if (array_key_exists(strtok($path, '/'), $configurationManager->getLocalConfiguration())) { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } elseif ($checksum == 10) { |
152 | 152 | //TODO: Binary operation "+" between string and 1 results in an error. |
153 | 153 | // @phpstan-ignore-next-line |
154 | - return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
|
154 | + return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD'); |
|
155 | 155 | } elseif (substr($id, -1, 1) != $checksum) { |
156 | 156 | return false; |
157 | 157 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
358 | 358 | // Merge initialization vector and encrypted data. |
359 | 359 | if ($encrypted !== false) { |
360 | - $encrypted = base64_encode($iv . $encrypted); |
|
360 | + $encrypted = base64_encode($iv.$encrypted); |
|
361 | 361 | } |
362 | 362 | return $encrypted; |
363 | 363 | } |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | public static function getHookObjects(string $scriptRelPath): array |
400 | 400 | { |
401 | 401 | $hookObjects = []; |
402 | - if (is_array(self::getOptions()[self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
|
403 | - foreach (self::getOptions()[self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
|
402 | + if (is_array(self::getOptions()[self::$extKey.'/'.$scriptRelPath]['hookClass'])) { |
|
403 | + foreach (self::getOptions()[self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) { |
|
404 | 404 | $hookObjects[] = GeneralUtility::makeInstance($classRef); |
405 | 405 | } |
406 | 406 | } |
@@ -429,12 +429,12 @@ discard block |
||
429 | 429 | // NOTE: Only use tables that don't have too many entries! |
430 | 430 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_metadatasubentries', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
431 | 431 | ) { |
432 | - self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
432 | + self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
433 | 433 | return ''; |
434 | 434 | } |
435 | 435 | |
436 | - $makeCacheKey = function ($pid, $uid) { |
|
437 | - return $pid . '.' . $uid; |
|
436 | + $makeCacheKey = function($pid, $uid) { |
|
437 | + return $pid.'.'.$uid; |
|
438 | 438 | }; |
439 | 439 | |
440 | 440 | static $cache = []; |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | |
445 | 445 | $result = $queryBuilder |
446 | 446 | ->select( |
447 | - $table . '.index_name AS index_name', |
|
448 | - $table . '.uid AS uid', |
|
449 | - $table . '.pid AS pid', |
|
447 | + $table.'.index_name AS index_name', |
|
448 | + $table.'.uid AS uid', |
|
449 | + $table.'.pid AS pid', |
|
450 | 450 | ) |
451 | 451 | ->from($table) |
452 | 452 | ->execute(); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $result = $cache[$table][$cacheKey] ?? ''; |
465 | 465 | |
466 | 466 | if ($result === '') { |
467 | - self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
467 | + self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | return $result; |
@@ -493,11 +493,11 @@ discard block |
||
493 | 493 | // No ISO code, return unchanged. |
494 | 494 | return $code; |
495 | 495 | } |
496 | - $lang = LocalizationUtility::translate('LLL:' . $file . ':' . $code); |
|
496 | + $lang = LocalizationUtility::translate('LLL:'.$file.':'.$code); |
|
497 | 497 | if (!empty($lang)) { |
498 | 498 | return $lang; |
499 | 499 | } else { |
500 | - self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
500 | + self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
501 | 501 | return $code; |
502 | 502 | } |
503 | 503 | } |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | // Sanitize input. |
662 | 662 | $pid = max((int) $pid, 0); |
663 | 663 | if (!$pid) { |
664 | - self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING); |
|
664 | + self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING); |
|
665 | 665 | return $indexName; |
666 | 666 | } |
667 | 667 | /** @var PageRepository $pageRepository */ |
@@ -684,13 +684,13 @@ discard block |
||
684 | 684 | // First fetch the uid of the received index_name |
685 | 685 | $result = $queryBuilder |
686 | 686 | ->select( |
687 | - $table . '.uid AS uid', |
|
688 | - $table . '.l18n_parent AS l18n_parent' |
|
687 | + $table.'.uid AS uid', |
|
688 | + $table.'.l18n_parent AS l18n_parent' |
|
689 | 689 | ) |
690 | 690 | ->from($table) |
691 | 691 | ->where( |
692 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
693 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($indexName)), |
|
692 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
693 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($indexName)), |
|
694 | 694 | self::whereExpression($table, true) |
695 | 695 | ) |
696 | 696 | ->setMaxResults(1) |
@@ -701,12 +701,12 @@ discard block |
||
701 | 701 | if ($row) { |
702 | 702 | // Now we use the uid of the l18_parent to fetch the index_name of the translated content element. |
703 | 703 | $result = $queryBuilder |
704 | - ->select($table . '.index_name AS index_name') |
|
704 | + ->select($table.'.index_name AS index_name') |
|
705 | 705 | ->from($table) |
706 | 706 | ->where( |
707 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
708 | - $queryBuilder->expr()->eq($table . '.uid', $row['l18n_parent']), |
|
709 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId), |
|
707 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
708 | + $queryBuilder->expr()->eq($table.'.uid', $row['l18n_parent']), |
|
709 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', (int) $languageContentId), |
|
710 | 710 | self::whereExpression($table, true) |
711 | 711 | ) |
712 | 712 | ->setMaxResults(1) |
@@ -724,14 +724,14 @@ discard block |
||
724 | 724 | if (empty($labels[$table][$pid][$languageContentId][$indexName])) { |
725 | 725 | // Check if this table is allowed for translation. |
726 | 726 | if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_metadatasubentries', 'tx_dlf_structures'])) { |
727 | - $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]); |
|
727 | + $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]); |
|
728 | 728 | if ($languageContentId > 0) { |
729 | 729 | $additionalWhere = $queryBuilder->expr()->andX( |
730 | 730 | $queryBuilder->expr()->orX( |
731 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
732 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId) |
|
731 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
732 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', (int) $languageContentId) |
|
733 | 733 | ), |
734 | - $queryBuilder->expr()->eq($table . '.l18n_parent', 0) |
|
734 | + $queryBuilder->expr()->eq($table.'.l18n_parent', 0) |
|
735 | 735 | ); |
736 | 736 | } |
737 | 737 | |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | ->select('*') |
741 | 741 | ->from($table) |
742 | 742 | ->where( |
743 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
743 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
744 | 744 | $additionalWhere, |
745 | 745 | self::whereExpression($table, true) |
746 | 746 | ) |
@@ -758,10 +758,10 @@ discard block |
||
758 | 758 | } |
759 | 759 | } |
760 | 760 | } else { |
761 | - self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
761 | + self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
762 | 762 | } |
763 | 763 | } else { |
764 | - self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
764 | + self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
765 | 765 | } |
766 | 766 | } |
767 | 767 | |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | return GeneralUtility::makeInstance(ConnectionPool::class) |
806 | 806 | ->getQueryBuilderForTable($table) |
807 | 807 | ->expr() |
808 | - ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
808 | + ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
809 | 809 | } else { |
810 | 810 | self::log('Unexpected application type (neither frontend or backend)', LOG_SEVERITY_ERROR); |
811 | 811 | return '1=-1'; |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | try { |
872 | 872 | $response = $requestFactory->request($url, 'GET', $configuration); |
873 | 873 | } catch (\Exception $e) { |
874 | - self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
|
874 | + self::log('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.', LOG_SEVERITY_WARNING); |
|
875 | 875 | return false; |
876 | 876 | } |
877 | 877 | return $response->getBody()->getContents(); |
@@ -963,9 +963,9 @@ discard block |
||
963 | 963 | $mimeTypeCollection = GeneralUtility::makeInstance(MimeTypeCollection::class); |
964 | 964 | $mimeTypes = array_filter( |
965 | 965 | $mimeTypeCollection->getMimeTypes(), |
966 | - function ($mimeType) use ($categories) { |
|
966 | + function($mimeType) use ($categories) { |
|
967 | 967 | foreach ($categories as $category) { |
968 | - if (strpos($mimeType, $category . '/') === 0) { |
|
968 | + if (strpos($mimeType, $category.'/') === 0) { |
|
969 | 969 | return true; |
970 | 970 | } |
971 | 971 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return FlashMessageQueue The queue the message was added to |
92 | 92 | */ |
93 | - public static function addMessage(string $message, string $title, int $severity, bool $session = false, string $queue = 'kitodo.default.flashMessages'): FlashMessageQueue |
|
93 | + public static function addMessage(string $message, string $title, int $severity, bool $session = FALSE, string $queue = 'kitodo.default.flashMessages'): FlashMessageQueue |
|
94 | 94 | { |
95 | 95 | $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class); |
96 | 96 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | $checksum = 'X'; |
130 | 130 | } |
131 | 131 | if (!preg_match('/\d{8}[\dX]{1}/i', $id)) { |
132 | - return false; |
|
132 | + return FALSE; |
|
133 | 133 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
134 | - return false; |
|
134 | + return FALSE; |
|
135 | 135 | } |
136 | 136 | break; |
137 | 137 | case 'ZDB': |
@@ -139,21 +139,21 @@ discard block |
||
139 | 139 | $checksum = 'X'; |
140 | 140 | } |
141 | 141 | if (!preg_match('/\d{8}-[\dX]{1}/i', $id)) { |
142 | - return false; |
|
142 | + return FALSE; |
|
143 | 143 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
144 | - return false; |
|
144 | + return FALSE; |
|
145 | 145 | } |
146 | 146 | break; |
147 | 147 | case 'SWD': |
148 | 148 | $checksum = 11 - $checksum; |
149 | 149 | if (!preg_match('/\d{8}-\d{1}/i', $id)) { |
150 | - return false; |
|
150 | + return FALSE; |
|
151 | 151 | } elseif ($checksum == 10) { |
152 | 152 | //TODO: Binary operation "+" between string and 1 results in an error. |
153 | 153 | // @phpstan-ignore-next-line |
154 | 154 | return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
155 | 155 | } elseif (substr($id, -1, 1) != $checksum) { |
156 | - return false; |
|
156 | + return FALSE; |
|
157 | 157 | } |
158 | 158 | break; |
159 | 159 | case 'GKD': |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | $checksum = 'X'; |
163 | 163 | } |
164 | 164 | if (!preg_match('/\d{8}-[\dX]{1}/i', $id)) { |
165 | - return false; |
|
165 | + return FALSE; |
|
166 | 166 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
167 | - return false; |
|
167 | + return FALSE; |
|
168 | 168 | } |
169 | 169 | break; |
170 | 170 | } |
171 | - return true; |
|
171 | + return TRUE; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -205,28 +205,28 @@ discard block |
||
205 | 205 | public static function decrypt(string $encrypted) |
206 | 206 | { |
207 | 207 | if ( |
208 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
209 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
208 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
209 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
210 | 210 | ) { |
211 | 211 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
212 | - return false; |
|
212 | + return FALSE; |
|
213 | 213 | } |
214 | 214 | if (empty(self::getEncryptionKey())) { |
215 | 215 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
216 | - return false; |
|
216 | + return FALSE; |
|
217 | 217 | } |
218 | 218 | if ( |
219 | 219 | empty($encrypted) |
220 | 220 | || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm) |
221 | 221 | ) { |
222 | 222 | self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR); |
223 | - return false; |
|
223 | + return FALSE; |
|
224 | 224 | } |
225 | 225 | // Split initialisation vector and encrypted data. |
226 | 226 | $binary = base64_decode($encrypted); |
227 | 227 | $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
228 | 228 | $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
229 | - $key = openssl_digest(self::getEncryptionKey(), self::$hashAlgorithm, true); |
|
229 | + $key = openssl_digest(self::getEncryptionKey(), self::$hashAlgorithm, TRUE); |
|
230 | 230 | // Decrypt data. |
231 | 231 | return openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
232 | 232 | } |
@@ -248,15 +248,15 @@ discard block |
||
248 | 248 | // Don't make simplexml_load_string throw (when $content is an array |
249 | 249 | // or object) |
250 | 250 | if (!is_string($content)) { |
251 | - return false; |
|
251 | + return FALSE; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | // Turn off libxml's error logging. |
255 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
255 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
256 | 256 | |
257 | 257 | if (\PHP_VERSION_ID < 80000) { |
258 | 258 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
259 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
259 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | // Try to load XML from file. |
@@ -318,9 +318,9 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public static function digest(string $string) |
320 | 320 | { |
321 | - if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
|
321 | + if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) { |
|
322 | 322 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
323 | - return false; |
|
323 | + return FALSE; |
|
324 | 324 | } |
325 | 325 | // Hash string. |
326 | 326 | return openssl_digest($string, self::$hashAlgorithm); |
@@ -340,23 +340,23 @@ discard block |
||
340 | 340 | public static function encrypt(string $string) |
341 | 341 | { |
342 | 342 | if ( |
343 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
344 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
343 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
344 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
345 | 345 | ) { |
346 | 346 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
347 | - return false; |
|
347 | + return FALSE; |
|
348 | 348 | } |
349 | 349 | if (empty(self::getEncryptionKey())) { |
350 | 350 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
351 | - return false; |
|
351 | + return FALSE; |
|
352 | 352 | } |
353 | 353 | // Generate random initialization vector. |
354 | 354 | $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm)); |
355 | - $key = openssl_digest(self::getEncryptionKey(), self::$hashAlgorithm, true); |
|
355 | + $key = openssl_digest(self::getEncryptionKey(), self::$hashAlgorithm, TRUE); |
|
356 | 356 | // Encrypt data. |
357 | 357 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
358 | 358 | // Merge initialization vector and encrypted data. |
359 | - if ($encrypted !== false) { |
|
359 | + if ($encrypted !== FALSE) { |
|
360 | 360 | $encrypted = base64_encode($iv . $encrypted); |
361 | 361 | } |
362 | 362 | return $encrypted; |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | public static function isValidHttpUrl(string $url): bool |
558 | 558 | { |
559 | 559 | if (!GeneralUtility::isValidUrl($url)) { |
560 | - return false; |
|
560 | + return FALSE; |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | try { |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | return !empty($uri->getScheme()); |
566 | 566 | } catch (\InvalidArgumentException $e) { |
567 | 567 | self::log($e->getMessage(), LOG_SEVERITY_ERROR); |
568 | - return false; |
|
568 | + return FALSE; |
|
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * |
582 | 582 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
583 | 583 | */ |
584 | - public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
584 | + public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = FALSE, $cmdFirst = FALSE) |
|
585 | 585 | { |
586 | 586 | $context = GeneralUtility::makeInstance(Context::class); |
587 | 587 | |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | // Instantiate TYPO3 core engine. |
593 | 593 | $dataHandler = GeneralUtility::makeInstance(DataHandler::class); |
594 | 594 | // We do not use workspaces and have to bypass restrictions in DataHandler. |
595 | - $dataHandler->bypassWorkspaceRestrictions = true; |
|
595 | + $dataHandler->bypassWorkspaceRestrictions = TRUE; |
|
596 | 596 | // Load data and command arrays. |
597 | 597 | $dataHandler->start($data, $cmd); |
598 | 598 | // Process command map first if default order is reversed. |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | ->where( |
692 | 692 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
693 | 693 | $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($indexName)), |
694 | - self::whereExpression($table, true) |
|
694 | + self::whereExpression($table, TRUE) |
|
695 | 695 | ) |
696 | 696 | ->setMaxResults(1) |
697 | 697 | ->execute(); |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
708 | 708 | $queryBuilder->expr()->eq($table . '.uid', $row['l18n_parent']), |
709 | 709 | $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId), |
710 | - self::whereExpression($table, true) |
|
710 | + self::whereExpression($table, TRUE) |
|
711 | 711 | ) |
712 | 712 | ->setMaxResults(1) |
713 | 713 | ->execute(); |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | ->where( |
743 | 743 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
744 | 744 | $additionalWhere, |
745 | - self::whereExpression($table, true) |
|
745 | + self::whereExpression($table, TRUE) |
|
746 | 746 | ) |
747 | 747 | ->setMaxResults(10000) |
748 | 748 | ->execute(); |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | * |
785 | 785 | * @return string Additional WHERE expression |
786 | 786 | */ |
787 | - public static function whereExpression(string $table, bool $showHidden = false): string |
|
787 | + public static function whereExpression(string $table, bool $showHidden = FALSE): string |
|
788 | 788 | { |
789 | 789 | if (!Environment::isCli() && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend()) { |
790 | 790 | // Should we ignore the record's hidden flag? |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | public static function getUrl(string $url) |
855 | 855 | { |
856 | 856 | if (!Helper::isValidHttpUrl($url)) { |
857 | - return false; |
|
857 | + return FALSE; |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | // Get extension configuration. |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | $response = $requestFactory->request($url, 'GET', $configuration); |
873 | 873 | } catch (\Exception $e) { |
874 | 874 | self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
875 | - return false; |
|
875 | + return FALSE; |
|
876 | 876 | } |
877 | 877 | return $response->getBody()->getContents(); |
878 | 878 | } |
@@ -966,10 +966,10 @@ discard block |
||
966 | 966 | function ($mimeType) use ($categories) { |
967 | 967 | foreach ($categories as $category) { |
968 | 968 | if (strpos($mimeType, $category . '/') === 0) { |
969 | - return true; |
|
969 | + return TRUE; |
|
970 | 970 | } |
971 | 971 | } |
972 | - return false; |
|
972 | + return FALSE; |
|
973 | 973 | } |
974 | 974 | ); |
975 | 975 | |
@@ -986,6 +986,6 @@ discard block |
||
986 | 986 | if (is_array($file) && isset($file[$mimeTypeKey])) { |
987 | 987 | return in_array($file[$mimeTypeKey], $mimeTypes) || in_array($file[$mimeTypeKey], $filteredDlfMimeTypes); |
988 | 988 | } |
989 | - return false; |
|
989 | + return FALSE; |
|
990 | 990 | } |
991 | 991 | } |
@@ -59,8 +59,8 @@ |
||
59 | 59 | |
60 | 60 | // Text field for document URL |
61 | 61 | $fieldName = 'doc'; |
62 | - $fieldId = 'task_' . $fieldName; |
|
63 | - $fieldHtml = '<input type="text" name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '" value="' . $taskInfo[$fieldName] . '" >'; |
|
62 | + $fieldId = 'task_'.$fieldName; |
|
63 | + $fieldHtml = '<input type="text" name="tx_scheduler['.$fieldName.']" id="'.$fieldId.'" value="'.$taskInfo[$fieldName].'" >'; |
|
64 | 64 | $additionalFields[$fieldId] = [ |
65 | 65 | 'code' => $fieldHtml, |
66 | 66 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.doc', |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class IndexAdditionalFieldProvider extends BaseAdditionalFieldProvider |
|
27 | -{ |
|
26 | +class IndexAdditionalFieldProvider extends BaseAdditionalFieldProvider { |
|
28 | 27 | /** |
29 | 28 | * Gets additional fields to render in the form to add/edit a task |
30 | 29 | * |
@@ -33,8 +32,7 @@ discard block |
||
33 | 32 | * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the scheduler backend module |
34 | 33 | * @return array A two dimensional array, array('Identifier' => array('fieldId' => array('code' => '', 'label' => '', 'cshKey' => '', 'cshLabel' => '')) |
35 | 34 | */ |
36 | - public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) |
|
37 | - { |
|
35 | + public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) { |
|
38 | 36 | $currentSchedulerModuleAction = $schedulerModule->getCurrentAction(); |
39 | 37 | |
40 | 38 | /** @var BaseTask $task */ |
@@ -46,12 +46,12 @@ |
||
46 | 46 | $taskInfo['owner'] = $task->getOwner(); |
47 | 47 | $taskInfo['softCommit'] = $task->isSoftCommit(); |
48 | 48 | } else { |
49 | - $taskInfo['dryRun'] = false; |
|
49 | + $taskInfo['dryRun'] = FALSE; |
|
50 | 50 | $taskInfo['doc'] = 'https://'; |
51 | 51 | $taskInfo['pid'] = - 1; |
52 | 52 | $taskInfo['solr'] = - 1; |
53 | 53 | $taskInfo['owner'] = ''; |
54 | - $taskInfo['softCommit'] = false; |
|
54 | + $taskInfo['softCommit'] = FALSE; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $additionalFields = []; |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | |
66 | 66 | // Text field for library |
67 | 67 | $fieldName = 'lib'; |
68 | - $fieldId = 'task_' . $fieldName; |
|
68 | + $fieldId = 'task_'.$fieldName; |
|
69 | 69 | |
70 | 70 | $allLibraries = $this->getLibraries($taskInfo['pid']); |
71 | 71 | $options = []; |
72 | 72 | $options[] = '<option value="-1"></option>'; |
73 | 73 | foreach ($allLibraries as $label => $uid) { |
74 | - $options[] = '<option value="' . $uid . '" ' . ($taskInfo['lib'] == $uid ? 'selected' : '') . ' >' . $label . '</option>'; |
|
74 | + $options[] = '<option value="'.$uid.'" '.($taskInfo['lib'] == $uid ? 'selected' : '').' >'.$label.'</option>'; |
|
75 | 75 | } |
76 | 76 | |
77 | - $fieldHtml = '<select name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '">' . implode("\n", $options) . '</select>'; |
|
77 | + $fieldHtml = '<select name="tx_scheduler['.$fieldName.']" id="'.$fieldId.'">'.implode("\n", $options).'</select>'; |
|
78 | 78 | $additionalFields[$fieldId] = [ |
79 | 79 | 'code' => $fieldHtml, |
80 | 80 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.lib', |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | |
91 | 91 | // Text field for from |
92 | 92 | $fieldName = 'from'; |
93 | - $fieldId = 'task_' . $fieldName; |
|
94 | - $fieldHtml = '<input type="date" name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '" value="' . $taskInfo[$fieldName] . '" >'; |
|
93 | + $fieldId = 'task_'.$fieldName; |
|
94 | + $fieldHtml = '<input type="date" name="tx_scheduler['.$fieldName.']" id="'.$fieldId.'" value="'.$taskInfo[$fieldName].'" >'; |
|
95 | 95 | $additionalFields[$fieldId] = [ |
96 | 96 | 'code' => $fieldHtml, |
97 | 97 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.from', |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | |
102 | 102 | // Text field for until |
103 | 103 | $fieldName = 'until'; |
104 | - $fieldId = 'task_' . $fieldName; |
|
105 | - $fieldHtml = '<input type="date" name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '" value="' . $taskInfo[$fieldName] . '" >'; |
|
104 | + $fieldId = 'task_'.$fieldName; |
|
105 | + $fieldHtml = '<input type="date" name="tx_scheduler['.$fieldName.']" id="'.$fieldId.'" value="'.$taskInfo[$fieldName].'" >'; |
|
106 | 106 | $additionalFields[$fieldId] = [ |
107 | 107 | 'code' => $fieldHtml, |
108 | 108 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.until', |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | |
113 | 113 | // Text field for set |
114 | 114 | $fieldName = 'set'; |
115 | - $fieldId = 'task_' . $fieldName; |
|
116 | - $fieldHtml = '<input type="text" name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '" value="' . $taskInfo[$fieldName] . '" >'; |
|
115 | + $fieldId = 'task_'.$fieldName; |
|
116 | + $fieldHtml = '<input type="text" name="tx_scheduler['.$fieldName.']" id="'.$fieldId.'" value="'.$taskInfo[$fieldName].'" >'; |
|
117 | 117 | $additionalFields[$fieldId] = [ |
118 | 118 | 'code' => $fieldHtml, |
119 | 119 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.set', |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @access public |
27 | 27 | */ |
28 | -class HarvestAdditionalFieldProvider extends BaseAdditionalFieldProvider |
|
29 | -{ |
|
28 | +class HarvestAdditionalFieldProvider extends BaseAdditionalFieldProvider { |
|
30 | 29 | /** |
31 | 30 | * Gets additional fields to render in the form to add/edit a task |
32 | 31 | * |
@@ -35,8 +34,7 @@ discard block |
||
35 | 34 | * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the scheduler backend module |
36 | 35 | * @return array A two dimensional array, array('Identifier' => array('fieldId' => array('code' => '', 'label' => '', 'cshKey' => '', 'cshLabel' => '')) |
37 | 36 | */ |
38 | - public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) |
|
39 | - { |
|
37 | + public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) { |
|
40 | 38 | $currentSchedulerModuleAction = $schedulerModule->getCurrentAction(); |
41 | 39 | |
42 | 40 | /** @var BaseTask $task */ |
@@ -50,14 +50,14 @@ |
||
50 | 50 | $taskInfo['set'] = $task->getSet(); |
51 | 51 | $taskInfo['softCommit'] = $task->isSoftCommit(); |
52 | 52 | } else { |
53 | - $taskInfo['dryRun'] = false; |
|
53 | + $taskInfo['dryRun'] = FALSE; |
|
54 | 54 | $taskInfo['lib'] = - 1; |
55 | 55 | $taskInfo['pid'] = - 1; |
56 | 56 | $taskInfo['solr'] = - 1; |
57 | 57 | $taskInfo['from'] = ''; |
58 | 58 | $taskInfo['until'] = ''; |
59 | 59 | $taskInfo['set'] = ''; |
60 | - $taskInfo['softCommit'] = false; |
|
60 | + $taskInfo['softCommit'] = FALSE; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $additionalFields = []; |
@@ -23,10 +23,8 @@ |
||
23 | 23 | * |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class ReindexTask extends BaseTask |
|
27 | -{ |
|
28 | - public function execute() |
|
29 | - { |
|
26 | +class ReindexTask extends BaseTask { |
|
27 | + public function execute() { |
|
30 | 28 | $inputArray = []; |
31 | 29 | if ($this->dryRun) { |
32 | 30 | $inputArray['--dry-run'] = true; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $inputArray = []; |
31 | 31 | if ($this->dryRun) { |
32 | - $inputArray['--dry-run'] = true; |
|
32 | + $inputArray['--dry-run'] = TRUE; |
|
33 | 33 | } |
34 | 34 | if (count($this->coll)) { |
35 | 35 | $inputArray['-c'] = implode(',', $this->coll); |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | $inputArray['-o'] = $this->owner; |
41 | 41 | } |
42 | 42 | if ($this->all) { |
43 | - $inputArray['--all'] = true; |
|
43 | + $inputArray['--all'] = TRUE; |
|
44 | 44 | } |
45 | 45 | if (!empty($this->softCommit)) { |
46 | - $inputArray['--softCommit'] = true; |
|
46 | + $inputArray['--softCommit'] = TRUE; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $reindexCommand = GeneralUtility::makeInstance(\Kitodo\Dlf\Command\ReindexCommand::class); |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @access public |
31 | 31 | */ |
32 | -class BaseAdditionalFieldProvider implements AdditionalFieldProviderInterface |
|
33 | -{ |
|
32 | +class BaseAdditionalFieldProvider implements AdditionalFieldProviderInterface { |
|
34 | 33 | /** |
35 | 34 | * Gets additional fields to render in the form to add/edit a task |
36 | 35 | * |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the scheduler backend module |
40 | 39 | * @return array A two dimensional array, array('Identifier' => array('fieldId' => array('code' => '', 'label' => '', 'cshKey' => '', 'cshLabel' => '')) |
41 | 40 | */ |
42 | - public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) |
|
43 | - { |
|
41 | + public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) { |
|
44 | 42 | return []; |
45 | 43 | } |
46 | 44 | |
@@ -51,8 +49,7 @@ discard block |
||
51 | 49 | * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the scheduler backend module |
52 | 50 | * @return bool TRUE if validation was ok (or selected class is not relevant), FALSE otherwise |
53 | 51 | */ |
54 | - public function validateAdditionalFields(array &$submittedData, SchedulerModuleController $schedulerModule) |
|
55 | - { |
|
52 | + public function validateAdditionalFields(array &$submittedData, SchedulerModuleController $schedulerModule) { |
|
56 | 53 | $fieldsValid = true; |
57 | 54 | |
58 | 55 | Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_tasks.xlf'); |
@@ -130,8 +127,7 @@ discard block |
||
130 | 127 | * @param BaseTask $task Reference to the scheduler backend module |
131 | 128 | * @return void |
132 | 129 | */ |
133 | - public function saveAdditionalFields(array $submittedData, AbstractTask $task) |
|
134 | - { |
|
130 | + public function saveAdditionalFields(array $submittedData, AbstractTask $task) { |
|
135 | 131 | /** @var BaseTask $task */ |
136 | 132 | $task->setDryRun(!empty($submittedData['dryRun'])); |
137 | 133 | if (isset($submittedData['doc'])) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | if (isset($submittedData['doc']) && empty($submittedData['doc'])) { |
64 | 64 | Helper::addMessage( |
65 | - Helper::getLanguageService()->getLL('additionalFields.doc') . ' ' . Helper::getLanguageService()->getLL('additionalFields.valid'), |
|
65 | + Helper::getLanguageService()->getLL('additionalFields.doc').' '.Helper::getLanguageService()->getLL('additionalFields.valid'), |
|
66 | 66 | $messageTitle, |
67 | 67 | $messageSeverity, |
68 | 68 | true, |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | if ((isset($submittedData['pid']) && (int) $submittedData['pid'] <= 0)) { |
75 | 75 | Helper::addMessage( |
76 | - Helper::getLanguageService()->getLL('additionalFields.pid') . ' ' . Helper::getLanguageService()->getLL('additionalFields.valid'), |
|
76 | + Helper::getLanguageService()->getLL('additionalFields.pid').' '.Helper::getLanguageService()->getLL('additionalFields.valid'), |
|
77 | 77 | $messageTitle, |
78 | 78 | $messageSeverity, |
79 | 79 | true, |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | if ((isset($submittedData['lib']) && (int) $submittedData['lib'] <= 0)) { |
102 | 102 | Helper::addMessage( |
103 | - Helper::getLanguageService()->getLL('additionalFields.lib') . ' ' . Helper::getLanguageService()->getLL('additionalFields.valid'), |
|
103 | + Helper::getLanguageService()->getLL('additionalFields.lib').' '.Helper::getLanguageService()->getLL('additionalFields.valid'), |
|
104 | 104 | $messageTitle, |
105 | 105 | $messageSeverity, |
106 | 106 | true, |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | if ((isset($submittedData['solr']) && (int) $submittedData['solr'] <= 0) || !isset($submittedData['solr'])) { |
113 | 113 | Helper::addMessage( |
114 | - Helper::getLanguageService()->getLL('additionalFields.solr') . ' ' . Helper::getLanguageService()->getLL('additionalFields.valid'), |
|
114 | + Helper::getLanguageService()->getLL('additionalFields.solr').' '.Helper::getLanguageService()->getLL('additionalFields.valid'), |
|
115 | 115 | $messageTitle, |
116 | 116 | $messageSeverity, |
117 | 117 | true, |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | protected function getDryRunField(bool $dryRun): array |
193 | 193 | { |
194 | 194 | $fieldName = 'dryRun'; |
195 | - $fieldId = 'task_' . $fieldName; |
|
196 | - $fieldHtml = '<input type="checkbox" name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '" value="1"' . ($dryRun ? ' checked="checked"' : '') . '>'; |
|
195 | + $fieldId = 'task_'.$fieldName; |
|
196 | + $fieldHtml = '<input type="checkbox" name="tx_scheduler['.$fieldName.']" id="'.$fieldId.'" value="1"'.($dryRun ? ' checked="checked"' : '').'>'; |
|
197 | 197 | return [ |
198 | 198 | 'code' => $fieldHtml, |
199 | 199 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.dryRun', |
@@ -215,15 +215,15 @@ discard block |
||
215 | 215 | protected function getSolrField(int $solr, int $pid = null): array |
216 | 216 | { |
217 | 217 | $fieldName = 'solr'; |
218 | - $fieldId = 'task_' . $fieldName; |
|
218 | + $fieldId = 'task_'.$fieldName; |
|
219 | 219 | |
220 | 220 | $allSolrCores = $this->getSolrCores($pid); |
221 | 221 | $options = []; |
222 | 222 | $options[] = '<option value="-1"></option>'; |
223 | 223 | foreach ($allSolrCores as $label => $uid) { |
224 | - $options[] = '<option value="' . $uid . '" ' . ($solr == $uid ? 'selected' : '') . ' >' . $label . '</option>'; |
|
224 | + $options[] = '<option value="'.$uid.'" '.($solr == $uid ? 'selected' : '').' >'.$label.'</option>'; |
|
225 | 225 | }; |
226 | - $fieldHtml = '<select name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '">' . implode("\n", $options) . '</select>'; |
|
226 | + $fieldHtml = '<select name="tx_scheduler['.$fieldName.']" id="'.$fieldId.'">'.implode("\n", $options).'</select>'; |
|
227 | 227 | return [ |
228 | 228 | 'code' => $fieldHtml, |
229 | 229 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.solr', |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | protected function getPidField(int $pid): array |
245 | 245 | { |
246 | 246 | $fieldName = 'pid'; |
247 | - $fieldId = 'task_' . $fieldName; |
|
247 | + $fieldId = 'task_'.$fieldName; |
|
248 | 248 | |
249 | 249 | $pageRepository = GeneralUtility::makeInstance(PageTreeRepository::class); |
250 | 250 | $pages = $pageRepository->getTree(0); |
@@ -252,11 +252,11 @@ discard block |
||
252 | 252 | $options = []; |
253 | 253 | foreach ($pages['_children'] as $page) { |
254 | 254 | if ($page['doktype'] == 254) { |
255 | - $options[] = '<option value="' . $page['uid'] . '" ' . ($pid == $page['uid'] ? 'selected' : '') . ' >' . $page['title'] . '</option>'; |
|
255 | + $options[] = '<option value="'.$page['uid'].'" '.($pid == $page['uid'] ? 'selected' : '').' >'.$page['title'].'</option>'; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | - $fieldHtml = '<select name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '">' . implode("\n", $options) . '</select>'; |
|
259 | + $fieldHtml = '<select name="tx_scheduler['.$fieldName.']" id="'.$fieldId.'">'.implode("\n", $options).'</select>'; |
|
260 | 260 | return [ |
261 | 261 | 'code' => $fieldHtml, |
262 | 262 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.pid', |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | protected function getOwnerField(string $owner): array |
278 | 278 | { |
279 | 279 | $fieldName = 'owner'; |
280 | - $fieldId = 'task_' . $fieldName; |
|
281 | - $fieldHtml = '<input type="text" name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '" value="' . $owner . '" >'; |
|
280 | + $fieldId = 'task_'.$fieldName; |
|
281 | + $fieldHtml = '<input type="text" name="tx_scheduler['.$fieldName.']" id="'.$fieldId.'" value="'.$owner.'" >'; |
|
282 | 282 | return [ |
283 | 283 | 'code' => $fieldHtml, |
284 | 284 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.owner', |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $result = $queryBuilder->execute(); |
313 | 313 | |
314 | 314 | while ($record = $result->fetchAssociative()) { |
315 | - $solrCores[$record['label'] . ' (' . $record['index_name'] . ')'] = $record['uid']; |
|
315 | + $solrCores[$record['label'].' ('.$record['index_name'].')'] = $record['uid']; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | return $solrCores; |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | protected function getSoftCommitField(bool $softCommit): array |
331 | 331 | { |
332 | 332 | $fieldName = 'softCommit'; |
333 | - $fieldId = 'task_' . $fieldName; |
|
334 | - $fieldHtml = '<input type="checkbox" name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '" value="1"' . ($softCommit ? ' checked="checked"' : '') . '>'; |
|
333 | + $fieldId = 'task_'.$fieldName; |
|
334 | + $fieldHtml = '<input type="checkbox" name="tx_scheduler['.$fieldName.']" id="'.$fieldId.'" value="1"'.($softCommit ? ' checked="checked"' : '').'>'; |
|
335 | 335 | return [ |
336 | 336 | 'code' => $fieldHtml, |
337 | 337 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.softCommit', |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function validateAdditionalFields(array &$submittedData, SchedulerModuleController $schedulerModule) |
55 | 55 | { |
56 | - $fieldsValid = true; |
|
56 | + $fieldsValid = TRUE; |
|
57 | 57 | |
58 | 58 | Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_tasks.xlf'); |
59 | 59 | |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | Helper::getLanguageService()->getLL('additionalFields.doc') . ' ' . Helper::getLanguageService()->getLL('additionalFields.valid'), |
66 | 66 | $messageTitle, |
67 | 67 | $messageSeverity, |
68 | - true, |
|
68 | + TRUE, |
|
69 | 69 | 'core.template.flashMessages' |
70 | 70 | ); |
71 | - $fieldsValid = false; |
|
71 | + $fieldsValid = FALSE; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | if ((isset($submittedData['pid']) && (int) $submittedData['pid'] <= 0)) { |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | Helper::getLanguageService()->getLL('additionalFields.pid') . ' ' . Helper::getLanguageService()->getLL('additionalFields.valid'), |
77 | 77 | $messageTitle, |
78 | 78 | $messageSeverity, |
79 | - true, |
|
79 | + TRUE, |
|
80 | 80 | 'core.template.flashMessages' |
81 | 81 | ); |
82 | - $fieldsValid = false; |
|
82 | + $fieldsValid = FALSE; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | if (!isset($submittedData['commit']) && !isset($submittedData['optimize']) && !isset($submittedData['pid']) && ($submittedData['class'] != 'Kitodo\Dlf\Task\SuggestBuildTask')) { |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | Helper::getLanguageService()->getLL('additionalFields.commitOrOptimize'), |
88 | 88 | $messageTitle, |
89 | 89 | $messageSeverity, |
90 | - true, |
|
90 | + TRUE, |
|
91 | 91 | 'core.template.flashMessages' |
92 | 92 | ); |
93 | - $fieldsValid = false; |
|
93 | + $fieldsValid = FALSE; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | if (!$submittedData['uid']) { |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | Helper::getLanguageService()->getLL('additionalFields.lib') . ' ' . Helper::getLanguageService()->getLL('additionalFields.valid'), |
104 | 104 | $messageTitle, |
105 | 105 | $messageSeverity, |
106 | - true, |
|
106 | + TRUE, |
|
107 | 107 | 'core.template.flashMessages' |
108 | 108 | ); |
109 | - $fieldsValid = $messageSeverity === FlashMessage::ERROR ? false : $fieldsValid; |
|
109 | + $fieldsValid = $messageSeverity === FlashMessage::ERROR ? FALSE : $fieldsValid; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | if ((isset($submittedData['solr']) && (int) $submittedData['solr'] <= 0) || !isset($submittedData['solr'])) { |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | Helper::getLanguageService()->getLL('additionalFields.solr') . ' ' . Helper::getLanguageService()->getLL('additionalFields.valid'), |
115 | 115 | $messageTitle, |
116 | 116 | $messageSeverity, |
117 | - true, |
|
117 | + TRUE, |
|
118 | 118 | 'core.template.flashMessages' |
119 | 119 | ); |
120 | - $fieldsValid = $messageSeverity === FlashMessage::ERROR ? false : $fieldsValid; |
|
120 | + $fieldsValid = $messageSeverity === FlashMessage::ERROR ? FALSE : $fieldsValid; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | if (((isset($submittedData['coll']) && isset($submittedData['all'])) || (!isset($submittedData['coll']) && !isset($submittedData['all']))) |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | Helper::getLanguageService()->getLL('additionalFields.collOrAll'), |
127 | 127 | $messageTitle, |
128 | 128 | $messageSeverity, |
129 | - true, |
|
129 | + TRUE, |
|
130 | 130 | 'core.template.flashMessages' |
131 | 131 | ); |
132 | - $fieldsValid = $messageSeverity === FlashMessage::ERROR ? false : $fieldsValid; |
|
132 | + $fieldsValid = $messageSeverity === FlashMessage::ERROR ? FALSE : $fieldsValid; |
|
133 | 133 | } |
134 | 134 | return $fieldsValid; |
135 | 135 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @return array additional field solr dropdown |
214 | 214 | */ |
215 | - protected function getSolrField(int $solr, int $pid = null): array |
|
215 | + protected function getSolrField(int $solr, int $pid = NULL): array |
|
216 | 216 | { |
217 | 217 | $fieldName = 'solr'; |
218 | 218 | $fieldId = 'task_' . $fieldName; |
@@ -296,14 +296,14 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @return array Array of valid Solr cores |
298 | 298 | */ |
299 | - private function getSolrCores(int $pid = null): array |
|
299 | + private function getSolrCores(int $pid = NULL): array |
|
300 | 300 | { |
301 | 301 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_dlf_solrcores'); |
302 | 302 | |
303 | 303 | $solrCores = []; |
304 | 304 | $result = $queryBuilder->select('uid', 'label', 'index_name') |
305 | 305 | ->from('tx_dlf_solrcores'); |
306 | - if ($pid !== null) { |
|
306 | + if ($pid !== NULL) { |
|
307 | 307 | $queryBuilder->where( |
308 | 308 | $queryBuilder->expr() |
309 | 309 | ->eq('pid', $queryBuilder->createNamedParameter((int) $pid, Connection::PARAM_INT)) |
@@ -23,10 +23,8 @@ |
||
23 | 23 | * |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class HarvestTask extends BaseTask |
|
27 | -{ |
|
28 | - public function execute() |
|
29 | - { |
|
26 | +class HarvestTask extends BaseTask { |
|
27 | + public function execute() { |
|
30 | 28 | $inputArray = []; |
31 | 29 | if ($this->dryRun) { |
32 | 30 | $inputArray['--dry-run'] = true; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $inputArray = []; |
31 | 31 | if ($this->dryRun) { |
32 | - $inputArray['--dry-run'] = true; |
|
32 | + $inputArray['--dry-run'] = TRUE; |
|
33 | 33 | } |
34 | 34 | $inputArray['-l'] = $this->lib; |
35 | 35 | $inputArray['-p'] = $this->pid; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $inputArray['--set'] = $this->set; |
45 | 45 | } |
46 | 46 | if (!empty($this->softCommit)) { |
47 | - $inputArray['--softCommit'] = true; |
|
47 | + $inputArray['--softCommit'] = TRUE; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | $harvestCommand = GeneralUtility::makeInstance(\Kitodo\Dlf\Command\HarvestCommand::class); |
@@ -23,10 +23,8 @@ |
||
23 | 23 | * |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class IndexTask extends BaseTask |
|
27 | -{ |
|
28 | - public function execute() |
|
29 | - { |
|
26 | +class IndexTask extends BaseTask { |
|
27 | + public function execute() { |
|
30 | 28 | $inputArray = []; |
31 | 29 | if ($this->dryRun) { |
32 | 30 | $inputArray['--dry-run'] = true; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $inputArray = []; |
31 | 31 | if ($this->dryRun) { |
32 | - $inputArray['--dry-run'] = true; |
|
32 | + $inputArray['--dry-run'] = TRUE; |
|
33 | 33 | } |
34 | 34 | $inputArray['-d'] = $this->doc; |
35 | 35 | $inputArray['-p'] = $this->pid; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $inputArray['-o'] = $this->owner; |
39 | 39 | } |
40 | 40 | if (!empty($this->softCommit)) { |
41 | - $inputArray['--softCommit'] = true; |
|
41 | + $inputArray['--softCommit'] = TRUE; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $indexCommand = GeneralUtility::makeInstance(\Kitodo\Dlf\Command\IndexCommand::class); |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | |
64 | 64 | // Select for collection(s) |
65 | 65 | $fieldName = 'coll'; |
66 | - $fieldId = 'task_' . $fieldName; |
|
66 | + $fieldId = 'task_'.$fieldName; |
|
67 | 67 | $options = $this->getCollOptions($taskInfo['coll'], $taskInfo['pid']); |
68 | 68 | ; |
69 | - $fieldHtml = '<select name="tx_scheduler[' . $fieldName . '][]" id="' . $fieldId . '" size="10" multiple="multiple">' . implode("\n", $options) . '</select>'; |
|
69 | + $fieldHtml = '<select name="tx_scheduler['.$fieldName.'][]" id="'.$fieldId.'" size="10" multiple="multiple">'.implode("\n", $options).'</select>'; |
|
70 | 70 | $additionalFields[$fieldId] = [ |
71 | 71 | 'code' => $fieldHtml, |
72 | 72 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.coll', |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | |
86 | 86 | // Checkbox for all |
87 | 87 | $fieldName = 'all'; |
88 | - $fieldId = 'task_' . $fieldName; |
|
89 | - $fieldHtml = '<input type="checkbox" name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '" value="1"' . |
|
90 | - ($taskInfo['all'] ? ' checked="checked"' : '') . '>'; |
|
88 | + $fieldId = 'task_'.$fieldName; |
|
89 | + $fieldHtml = '<input type="checkbox" name="tx_scheduler['.$fieldName.']" id="'.$fieldId.'" value="1"'. |
|
90 | + ($taskInfo['all'] ? ' checked="checked"' : '').'>'; |
|
91 | 91 | $additionalFields[$fieldId] = [ |
92 | 92 | 'code' => $fieldHtml, |
93 | 93 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.all', |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $options = []; |
112 | 112 | $collections = $this->getCollections($pid); |
113 | 113 | foreach ($collections as $label => $uid) { |
114 | - $options[] = '<option value="' . $uid . '" ' . (in_array($uid, $coll) ? 'selected' : '') . ' >' . $label . '</option>'; |
|
114 | + $options[] = '<option value="'.$uid.'" '.(in_array($uid, $coll) ? 'selected' : '').' >'.$label.'</option>'; |
|
115 | 115 | } |
116 | 116 | return $options; |
117 | 117 | } |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @access public |
27 | 27 | */ |
28 | -class ReindexAdditionalFieldProvider extends BaseAdditionalFieldProvider |
|
29 | -{ |
|
28 | +class ReindexAdditionalFieldProvider extends BaseAdditionalFieldProvider { |
|
30 | 29 | /** |
31 | 30 | * Gets additional fields to render in the form to add/edit a task |
32 | 31 | * |
@@ -35,8 +34,7 @@ discard block |
||
35 | 34 | * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the scheduler backend module |
36 | 35 | * @return array A two dimensional array, array('Identifier' => array('fieldId' => array('code' => '', 'label' => '', 'cshKey' => '', 'cshLabel' => '')) |
37 | 36 | */ |
38 | - public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) |
|
39 | - { |
|
37 | + public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) { |
|
40 | 38 | $currentSchedulerModuleAction = $schedulerModule->getCurrentAction(); |
41 | 39 | |
42 | 40 | /** @var BaseTask $task */ |
@@ -49,13 +49,13 @@ |
||
49 | 49 | $taskInfo['all'] = $task->isAll(); |
50 | 50 | $taskInfo['softCommit'] = $task->isSoftCommit(); |
51 | 51 | } else { |
52 | - $taskInfo['dryRun'] = false; |
|
52 | + $taskInfo['dryRun'] = FALSE; |
|
53 | 53 | $taskInfo['coll'] = []; |
54 | 54 | $taskInfo['pid'] = - 1; |
55 | 55 | $taskInfo['solr'] = - 1; |
56 | 56 | $taskInfo['owner'] = ''; |
57 | - $taskInfo['all'] = false; |
|
58 | - $taskInfo['softCommit'] = false; |
|
57 | + $taskInfo['all'] = FALSE; |
|
58 | + $taskInfo['softCommit'] = FALSE; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | $additionalFields = []; |