Passed
Pull Request — master (#98)
by
unknown
08:17
created
Classes/Common/Helper.php 2 patches
Braces   +27 added lines, -54 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
687 670
      *
688 671
      * @return bool Is $id a valid PPN?
689 672
      */
690
-    public static function isPPN($id)
691
-    {
673
+    public static function isPPN($id) {
692 674
         return self::checkIdentifier($id, 'PPN');
693 675
     }
694 676
 
@@ -699,8 +681,7 @@  discard block
 block discarded – undo
699 681
      *
700 682
      * @return bool
701 683
      */
702
-    public static function isValidHttpUrl($url)
703
-    {
684
+    public static function isValidHttpUrl($url) {
704 685
         if (!GeneralUtility::isValidUrl($url)) {
705 686
             return false;
706 687
         }
@@ -721,8 +702,7 @@  discard block
 block discarded – undo
721 702
      *
722 703
      * @return mixed Session value for given key or null on failure
723 704
      */
724
-    public static function loadFromSession($key)
725
-    {
705
+    public static function loadFromSession($key) {
726 706
         // Cast to string for security reasons.
727 707
         $key = (string) $key;
728 708
         if (!$key) {
@@ -754,8 +734,7 @@  discard block
 block discarded – undo
754 734
      *
755 735
      * @return array Merged array
756 736
      */
757
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
758
-    {
737
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) {
759 738
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
760 739
         return $original;
761 740
     }
@@ -772,8 +751,7 @@  discard block
 block discarded – undo
772 751
      *
773 752
      * @return array Array of substituted "NEW..." identifiers and their actual UIDs.
774 753
      */
775
-    public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false)
776
-    {
754
+    public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) {
777 755
         if (
778 756
             \TYPO3_MODE === 'BE'
779 757
             && $GLOBALS['BE_USER']->isAdmin()
@@ -819,8 +797,7 @@  discard block
 block discarded – undo
819 797
      *
820 798
      * @return string All flash messages in the queue rendered as HTML.
821 799
      */
822
-    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages')
823
-    {
800
+    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') {
824 801
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
825 802
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
826 803
         $flashMessages = $flashMessageQueue->getAllMessagesAndFlush();
@@ -839,8 +816,7 @@  discard block
 block discarded – undo
839 816
      *
840 817
      * @return bool true on success, false on failure
841 818
      */
842
-    public static function saveToSession($value, $key)
843
-    {
819
+    public static function saveToSession($value, $key) {
844 820
         // Cast to string for security reasons.
845 821
         $key = (string) $key;
846 822
         if (!$key) {
@@ -872,8 +848,7 @@  discard block
 block discarded – undo
872 848
      *
873 849
      * @return string Localized label for $index_name
874 850
      */
875
-    public static function translate($index_name, $table, $pid)
876
-    {
851
+    public static function translate($index_name, $table, $pid) {
877 852
         // Load labels into static variable for future use.
878 853
         static $labels = [];
879 854
         // Sanitize input.
@@ -996,8 +971,7 @@  discard block
 block discarded – undo
996 971
      *
997 972
      * @return string Additional WHERE expression
998 973
      */
999
-    public static function whereExpression($table, $showHidden = false)
1000
-    {
974
+    public static function whereExpression($table, $showHidden = false) {
1001 975
         if (\TYPO3_MODE === 'FE') {
1002 976
             // Should we ignore the record's hidden flag?
1003 977
             $ignoreHide = 0;
@@ -1026,8 +1000,7 @@  discard block
 block discarded – undo
1026 1000
      *
1027 1001
      * @access private
1028 1002
      */
1029
-    private function __construct()
1030
-    {
1003
+    private function __construct() {
1031 1004
         // This is a static class, thus no instances should be created.
1032 1005
     }
1033 1006
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
      */
264 264
     public static function digest($string)
265 265
     {
266
-        if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) {
266
+        if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) {
267 267
             self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR);
268
-            return false;
268
+            return FALSE;
269 269
         }
270 270
         // Hash string.
271 271
         $hashed = openssl_digest($string, self::$hashAlgorithm);
@@ -284,23 +284,23 @@  discard block
 block discarded – undo
284 284
     public static function encrypt($string)
285 285
     {
286 286
         if (
287
-            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
288
-            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
287
+            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE))
288
+            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))
289 289
         ) {
290 290
             self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR);
291
-            return false;
291
+            return FALSE;
292 292
         }
293 293
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
294 294
             self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR);
295
-            return false;
295
+            return FALSE;
296 296
         }
297 297
         // Generate random initialisation vector.
298 298
         $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm));
299
-        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true);
299
+        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE);
300 300
         // Encrypt data.
301 301
         $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
302 302
         // Merge initialisation vector and encrypted data.
303
-        if ($encrypted !== false) {
303
+        if ($encrypted !== FALSE) {
304 304
             $encrypted = base64_encode($iv . $encrypted);
305 305
         }
306 306
         return $encrypted;
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                 $lang = $GLOBALS['TSFE']->getLLL($isoCode, $iso639);
498 498
             }
499 499
         } elseif (\TYPO3_MODE === 'BE') {
500
-            $iso639 = $GLOBALS['LANG']->includeLLFile($file, false, true);
500
+            $iso639 = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE);
501 501
             if (!empty($iso639['default'][$isoCode])) {
502 502
                 $lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639);
503 503
             }
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
      *
525 525
      * @return string The translated string or the given key on failure
526 526
      */
527
-    public static function getMessage($key, $hsc = false, $default = '')
527
+    public static function getMessage($key, $hsc = FALSE, $default = '')
528 528
     {
529 529
         // Set initial output to default value.
530 530
         $translated = (string) $default;
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
             if (\TYPO3_MODE === 'FE') {
535 535
                 self::$messages = $GLOBALS['TSFE']->readLLfile($file);
536 536
             } elseif (\TYPO3_MODE === 'BE') {
537
-                self::$messages = $GLOBALS['LANG']->includeLLFile($file, false, true);
537
+                self::$messages = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE);
538 538
             } else {
539 539
                 self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
540 540
             }
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
     public static function isValidHttpUrl($url)
703 703
     {
704 704
         if (!GeneralUtility::isValidUrl($url)) {
705
-            return false;
705
+            return FALSE;
706 706
         }
707 707
 
708 708
         $parsed = parse_url($url);
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
      *
755 755
      * @return array Merged array
756 756
      */
757
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
757
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE)
758 758
     {
759 759
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
760 760
         return $original;
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
      *
773 773
      * @return array Array of substituted "NEW..." identifiers and their actual UIDs.
774 774
      */
775
-    public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false)
775
+    public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = FALSE, $cmdFirst = FALSE)
776 776
     {
777 777
         if (
778 778
             \TYPO3_MODE === 'BE'
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
             // Instantiate TYPO3 core engine.
782 782
             $dataHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
783 783
             // We do not use workspaces and have to bypass restrictions in DataHandler.
784
-            $dataHandler->bypassWorkspaceRestrictions = true;
784
+            $dataHandler->bypassWorkspaceRestrictions = TRUE;
785 785
             // Load data and command arrays.
786 786
             $dataHandler->start($data, $cmd);
787 787
             // Process command map first if default order is reversed.
@@ -845,19 +845,19 @@  discard block
 block discarded – undo
845 845
         $key = (string) $key;
846 846
         if (!$key) {
847 847
             self::log('Invalid key "' . $key . '" for session data saving', LOG_SEVERITY_WARNING);
848
-            return false;
848
+            return FALSE;
849 849
         }
850 850
         // Save value in session data.
851 851
         if (\TYPO3_MODE === 'FE') {
852 852
             $GLOBALS['TSFE']->fe_user->setKey('ses', $key, $value);
853 853
             $GLOBALS['TSFE']->fe_user->storeSessionData();
854
-            return true;
854
+            return TRUE;
855 855
         } elseif (\TYPO3_MODE === 'BE') {
856 856
             $GLOBALS['BE_USER']->setAndSaveSessionData($key, $value);
857
-            return true;
857
+            return TRUE;
858 858
         } else {
859 859
             self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
860
-            return false;
860
+            return FALSE;
861 861
         }
862 862
     }
863 863
 
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
             ->where(
904 904
                 $queryBuilder->expr()->eq($table . '.pid', $pid),
905 905
                 $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
906
-                self::whereExpression($table, true)
906
+                self::whereExpression($table, TRUE)
907 907
             )
908 908
             ->setMaxResults(1)
909 909
             ->execute();
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
                     $queryBuilder->expr()->eq($table . '.pid', $pid),
922 922
                     $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']),
923 923
                     $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)),
924
-                    self::whereExpression($table, true)
924
+                    self::whereExpression($table, TRUE)
925 925
                 )
926 926
                 ->setMaxResults(1)
927 927
                 ->execute();
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
                     ->where(
957 957
                         $queryBuilder->expr()->eq($table . '.pid', $pid),
958 958
                         $additionalWhere,
959
-                        self::whereExpression($table, true)
959
+                        self::whereExpression($table, TRUE)
960 960
                     )
961 961
                     ->setMaxResults(10000)
962 962
                     ->execute();
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
      *
997 997
      * @return string Additional WHERE expression
998 998
      */
999
-    public static function whereExpression($table, $showHidden = false)
999
+    public static function whereExpression($table, $showHidden = FALSE)
1000 1000
     {
1001 1001
         if (\TYPO3_MODE === 'FE') {
1002 1002
             // Should we ignore the record's hidden flag?
Please login to merge, or discard this patch.
Classes/Plugin/Eid/PageViewProxy.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage dlf
26 26
  * @access public
27 27
  */
28
-class PageViewProxy
29
-{
28
+class PageViewProxy {
30 29
     /**
31 30
      * The main method of the eID script
32 31
      *
@@ -35,8 +34,7 @@  discard block
 block discarded – undo
35 34
      * @param ServerRequestInterface $request
36 35
      * @return ResponseInterface
37 36
      */
38
-    public function main(ServerRequestInterface $request)
39
-    {
37
+    public function main(ServerRequestInterface $request) {
40 38
         // the URI to fetch data or header from
41 39
         $url = (string) $request->getQueryParams()['url'];
42 40
         if (!Helper::isValidHttpUrl($url)) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
         if (!empty($fetchedHeaderString)) {
58 58
             $fetchedHeader = explode("\n", $fetchedHeaderString);
59 59
             foreach ($fetchedHeader as $headerline) {
60
-                if (stripos($headerline, 'Last-Modified:') !== false) {
60
+                if (stripos($headerline, 'Last-Modified:') !== FALSE) {
61 61
                     $lastModified = trim(substr($headerline, strpos($headerline, ':') + 1));
62 62
                     break;
63 63
                 }
Please login to merge, or discard this patch.
Classes/Plugin/PageView.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
             $(document).ready(function() {
79 79
                 if (dlfUtils.exists(dlfViewer)) {
80 80
                     tx_dlf_viewer = new dlfViewer({
81
-                        controls: ["' . implode('", "', $this->controls) . '"],
82
-                        div: "' . $this->conf['elementId'] . '",
83
-                        images: ' . json_encode($this->images) . ',
84
-                        fulltexts: ' . json_encode($this->fulltexts) . ',
85
-                        annotationContainers: ' . json_encode($this->annotationContainers) . ',
86
-                        useInternalProxy: ' . ($this->conf['useInternalProxy'] ? 1 : 0) . '
81
+                        controls: ["' . implode('", "', $this->controls).'"],
82
+                        div: "' . $this->conf['elementId'].'",
83
+                        images: ' . json_encode($this->images).',
84
+                        fulltexts: ' . json_encode($this->fulltexts).',
85
+                        annotationContainers: ' . json_encode($this->annotationContainers).',
86
+                        useInternalProxy: ' . ($this->conf['useInternalProxy'] ? 1 : 0).'
87 87
                     });
88 88
                 }
89 89
             });
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
         $markerArray = [];
106 106
         if ($this->piVars['id']) {
107 107
             if ($this->conf['crop']) {
108
-                $markerArray['###EDITBUTTON###'] = '<a href="javascript: tx_dlf_viewer.activateSelection();" title="' . htmlspecialchars($this->pi_getLL('editMode', '')) . '">' . htmlspecialchars($this->pi_getLL('editMode', '')) . '</a>';
109
-                $markerArray['###EDITREMOVE###'] = '<a href="javascript: tx_dlf_viewer.resetCropSelection();" title="' . htmlspecialchars($this->pi_getLL('editRemove', '')) . '">' . htmlspecialchars($this->pi_getLL('editRemove', '')) . '</a>';
108
+                $markerArray['###EDITBUTTON###'] = '<a href="javascript: tx_dlf_viewer.activateSelection();" title="'.htmlspecialchars($this->pi_getLL('editMode', '')).'">'.htmlspecialchars($this->pi_getLL('editMode', '')).'</a>';
109
+                $markerArray['###EDITREMOVE###'] = '<a href="javascript: tx_dlf_viewer.resetCropSelection();" title="'.htmlspecialchars($this->pi_getLL('editRemove', '')).'">'.htmlspecialchars($this->pi_getLL('editRemove', '')).'</a>';
110 110
             } else {
111 111
                 $markerArray['###EDITBUTTON###'] = '';
112 112
                 $markerArray['###EDITREMOVE###'] = '';
113 113
             }
114 114
             if ($this->conf['magnifier']) {
115
-                $markerArray['###MAGNIFIER###'] = '<a href="javascript: tx_dlf_viewer.activateMagnifier();" title="' . htmlspecialchars($this->pi_getLL('magnifier', '')) . '">' . htmlspecialchars($this->pi_getLL('magnifier', '')) . '</a>';
115
+                $markerArray['###MAGNIFIER###'] = '<a href="javascript: tx_dlf_viewer.activateMagnifier();" title="'.htmlspecialchars($this->pi_getLL('magnifier', '')).'">'.htmlspecialchars($this->pi_getLL('magnifier', '')).'</a>';
116 116
             } else {
117 117
                 $markerArray['###MAGNIFIER###'] = '';
118 118
             }
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
                 'additionalParams' => GeneralUtility::implodeArrayForUrl($this->prefixId, $params, '', true, false),
148 148
                 'title' => $label
149 149
             ];
150
-            $output = '<form id="addToBasketForm" action="' . $this->cObj->typoLink_URL($basketConf) . '" method="post">';
151
-            $output .= '<input type="hidden" name="tx_dlf[startpage]" id="startpage" value="' . htmlspecialchars($this->piVars['page']) . '">';
152
-            $output .= '<input type="hidden" name="tx_dlf[endpage]" id="endpage" value="' . htmlspecialchars($this->piVars['page']) . '">';
150
+            $output = '<form id="addToBasketForm" action="'.$this->cObj->typoLink_URL($basketConf).'" method="post">';
151
+            $output .= '<input type="hidden" name="tx_dlf[startpage]" id="startpage" value="'.htmlspecialchars($this->piVars['page']).'">';
152
+            $output .= '<input type="hidden" name="tx_dlf[endpage]" id="endpage" value="'.htmlspecialchars($this->piVars['page']).'">';
153 153
             $output .= '<input type="hidden" name="tx_dlf[startX]" id="startX">';
154 154
             $output .= '<input type="hidden" name="tx_dlf[startY]" id="startY">';
155 155
             $output .= '<input type="hidden" name="tx_dlf[endX]" id="endX">';
156 156
             $output .= '<input type="hidden" name="tx_dlf[endY]" id="endY">';
157 157
             $output .= '<input type="hidden" name="tx_dlf[rotation]" id="rotation">';
158
-            $output .= '<button id="submitBasketForm" onclick="this.form.submit()">' . $label . '</button>';
158
+            $output .= '<button id="submitBasketForm" onclick="this.form.submit()">'.$label.'</button>';
159 159
             $output .= '</form>';
160 160
             $output .= '<script>';
161 161
             $output .= '$(document).ready(function() { $("#submitBasketForm").click(function() { $("#addToBasketForm").submit(); }); });';
@@ -191,18 +191,18 @@  discard block
 block discarded – undo
191 191
                         'parameter' => $GLOBALS['TSFE']->id,
192 192
                         'forceAbsoluteUrl' => !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0,
193 193
                         'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'],
194
-                        'additionalParams' => '&eID=tx_dlf_pageview_proxy&url=' . urlencode($image['url']) . '&uHash=' . GeneralUtility::hmac($image['url'], 'PageViewProxy'),
194
+                        'additionalParams' => '&eID=tx_dlf_pageview_proxy&url='.urlencode($image['url']).'&uHash='.GeneralUtility::hmac($image['url'], 'PageViewProxy'),
195 195
                     ];
196 196
                     $image['url'] = $this->cObj->typoLink_URL($linkConf);
197 197
                 }
198 198
                 $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrpImages]);
199 199
                 break;
200 200
             } else {
201
-                $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"');
201
+                $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"');
202 202
             }
203 203
         }
204 204
         if (empty($image)) {
205
-            $this->logger->warning('No image file found for page "' . $page . '" in fileGrps "' . $this->conf['fileGrpImages'] . '"');
205
+            $this->logger->warning('No image file found for page "'.$page.'" in fileGrps "'.$this->conf['fileGrpImages'].'"');
206 206
         }
207 207
         return $image;
208 208
     }
@@ -230,18 +230,18 @@  discard block
 block discarded – undo
230 230
                         'parameter' => $GLOBALS['TSFE']->id,
231 231
                         'forceAbsoluteUrl' => !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0,
232 232
                         'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'],
233
-                        'additionalParams' => '&eID=tx_dlf_pageview_proxy&url=' . urlencode($fulltext['url']) . '&uHash=' . GeneralUtility::hmac($fulltext['url'], 'PageViewProxy'),
233
+                        'additionalParams' => '&eID=tx_dlf_pageview_proxy&url='.urlencode($fulltext['url']).'&uHash='.GeneralUtility::hmac($fulltext['url'], 'PageViewProxy'),
234 234
                     ];
235 235
                     $fulltext['url'] = $this->cObj->typoLink_URL($linkConf);
236 236
                 }
237 237
                 $fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrpFulltext]);
238 238
                 break;
239 239
             } else {
240
-                $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrp "' . $fileGrpFulltext . '"');
240
+                $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrp "'.$fileGrpFulltext.'"');
241 241
             }
242 242
         }
243 243
         if (empty($fulltext)) {
244
-            $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrps "' . $this->conf['fileGrpFulltext'] . '"');
244
+            $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrps "'.$this->conf['fileGrpFulltext'].'"');
245 245
         }
246 246
         return $fulltext;
247 247
     }
Please login to merge, or discard this patch.
ext_localconf.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -206,22 +206,22 @@
 block discarded – undo
206 206
 );
207 207
 // Register tools for toolbox plugin.
208 208
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'] = [];
209
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_fulltexttool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.fulltexttool';
210
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_annotationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.annotationtool';
211
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_fulltextdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.fulltextdownloadtool';
212
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_imagedownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.imagedownloadtool';
213
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_imagemanipulationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.imagemanipulationtool';
214
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_pdfdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.pdfdownloadtool';
215
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_searchindocumenttool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.searchindocumenttool';
209
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_fulltexttool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.fulltexttool';
210
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_annotationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.annotationtool';
211
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_fulltextdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.fulltextdownloadtool';
212
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_imagedownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.imagedownloadtool';
213
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_imagemanipulationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.imagemanipulationtool';
214
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_pdfdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.pdfdownloadtool';
215
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_searchindocumenttool'] = 'LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tx_dlf_toolbox.searchindocumenttool';
216 216
 // Register hooks.
217 217
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \Kitodo\Dlf\Hooks\DataHandler::class;
218 218
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = \Kitodo\Dlf\Hooks\DataHandler::class;
219 219
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Common/MetsDocument.php']['hookClass'][] = \Kitodo\Dlf\Hooks\KitodoProductionHacks::class;
220 220
 // Register AJAX eID handlers.
221
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_search_suggest'] = \Kitodo\Dlf\Plugin\Eid\SearchSuggest::class . '::main';
222
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_search_in_document'] = \Kitodo\Dlf\Plugin\Eid\SearchInDocument::class . '::main';
221
+$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_search_suggest'] = \Kitodo\Dlf\Plugin\Eid\SearchSuggest::class.'::main';
222
+$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_search_in_document'] = \Kitodo\Dlf\Plugin\Eid\SearchInDocument::class.'::main';
223 223
 if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['dlf']['enableInternalProxy'] ?? false) {
224
-    $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_pageview_proxy'] = \Kitodo\Dlf\Plugin\Eid\PageViewProxy::class . '::main';
224
+    $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_pageview_proxy'] = \Kitodo\Dlf\Plugin\Eid\PageViewProxy::class.'::main';
225 225
 }
226 226
 // Use Caching Framework for Solr queries
227 227
 if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr'])) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@
 block discarded – undo
220 220
 // Register AJAX eID handlers.
221 221
 $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_search_suggest'] = \Kitodo\Dlf\Plugin\Eid\SearchSuggest::class . '::main';
222 222
 $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_search_in_document'] = \Kitodo\Dlf\Plugin\Eid\SearchInDocument::class . '::main';
223
-if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['dlf']['enableInternalProxy'] ?? false) {
223
+if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['dlf']['enableInternalProxy'] ?? FALSE) {
224 224
     $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_pageview_proxy'] = \Kitodo\Dlf\Plugin\Eid\PageViewProxy::class . '::main';
225 225
 }
226 226
 // Use Caching Framework for Solr queries
Please login to merge, or discard this patch.