@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $parent->setDoc($doc); |
| 116 | 116 | $success = self::add($parent); |
| 117 | 117 | } else { |
| 118 | - Helper::log('Could not load parent document with UID ' . $document->getDoc()->parentId, LOG_SEVERITY_ERROR); |
|
| 118 | + Helper::log('Could not load parent document with UID '.$document->getDoc()->parentId, LOG_SEVERITY_ERROR); |
|
| 119 | 119 | return false; |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | self::$processedDocs[] = $document->getUid(); |
| 126 | 126 | // Delete old Solr documents. |
| 127 | 127 | $updateQuery = self::$solr->service->createUpdate(); |
| 128 | - $updateQuery->addDeleteQuery('uid:' . $document->getUid()); |
|
| 128 | + $updateQuery->addDeleteQuery('uid:'.$document->getUid()); |
|
| 129 | 129 | self::$solr->service->update($updateQuery); |
| 130 | 130 | |
| 131 | 131 | // Index every logical unit as separate Solr document. |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | } catch (\Exception $e) { |
| 175 | 175 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 176 | 176 | Helper::addMessage( |
| 177 | - Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()), |
|
| 177 | + Helper::getLanguageService()->getLL('flash.solrException').' '.htmlspecialchars($e->getMessage()), |
|
| 178 | 178 | Helper::getLanguageService()->getLL('flash.error'), |
| 179 | 179 | FlashMessage::ERROR, |
| 180 | 180 | true, |
| 181 | 181 | 'core.template.flashMessages' |
| 182 | 182 | ); |
| 183 | 183 | } |
| 184 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
| 184 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
| 185 | 185 | return false; |
| 186 | 186 | } |
| 187 | 187 | } else { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | // Sanitize input. |
| 215 | 215 | $pid = max(intval($pid), 0); |
| 216 | 216 | if (!$pid) { |
| 217 | - Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR); |
|
| 217 | + Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR); |
|
| 218 | 218 | return ''; |
| 219 | 219 | } |
| 220 | 220 | // Load metadata configuration. |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u'); |
| 224 | 224 | $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u'); |
| 225 | 225 | $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u'); |
| 226 | - $index_name .= '_' . $suffix; |
|
| 226 | + $index_name .= '_'.$suffix; |
|
| 227 | 227 | return $index_name; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
| 338 | 338 | $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
| 339 | 339 | // verify date formatting |
| 340 | - if(strtotime($metadata['date'][0])) { |
|
| 340 | + if (strtotime($metadata['date'][0])) { |
|
| 341 | 341 | // do not alter dates YYYY or YYYY-MM or YYYY-MM-DD |
| 342 | 342 | if ( |
| 343 | 343 | preg_match("/^[0-9]{4}$/", $metadata['date'][0]) |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | ) { |
| 347 | 347 | $solrDoc->setField('date', $metadata['date'][0]); |
| 348 | 348 | // change date YYYYMMDD to YYYY-MM-DD |
| 349 | - } elseif (preg_match("/^[0-9]{8}$/", $metadata['date'][0])){ |
|
| 349 | + } elseif (preg_match("/^[0-9]{8}$/", $metadata['date'][0])) { |
|
| 350 | 350 | $solrDoc->setField('date', date("Y-m-d", strtotime($metadata['date'][0]))); |
| 351 | 351 | // convert any datetime to proper ISO extended datetime format and timezone for SOLR |
| 352 | 352 | } else { |
@@ -374,11 +374,11 @@ discard block |
||
| 374 | 374 | $solrDoc->setField(self::getIndexFieldName($index_name, $document->getPid()), $data, self::$fields['fieldboost'][$index_name]); |
| 375 | 375 | if (in_array($index_name, self::$fields['sortables'])) { |
| 376 | 376 | // Add sortable fields to index. |
| 377 | - $solrDoc->setField($index_name . '_sorting', $metadata[$index_name . '_sorting'][0]); |
|
| 377 | + $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]); |
|
| 378 | 378 | } |
| 379 | 379 | if (in_array($index_name, self::$fields['facets'])) { |
| 380 | 380 | // Add facets to index. |
| 381 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
| 381 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
| 382 | 382 | } |
| 383 | 383 | if (in_array($index_name, self::$fields['autocomplete'])) { |
| 384 | 384 | $autocomplete = array_merge($autocomplete, $data); |
@@ -403,14 +403,14 @@ discard block |
||
| 403 | 403 | } catch (\Exception $e) { |
| 404 | 404 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 405 | 405 | Helper::addMessage( |
| 406 | - Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 406 | + Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($e->getMessage()), |
|
| 407 | 407 | Helper::getLanguageService()->getLL('flash.error'), |
| 408 | 408 | FlashMessage::ERROR, |
| 409 | 409 | true, |
| 410 | 410 | 'core.template.flashMessages' |
| 411 | 411 | ); |
| 412 | 412 | } |
| 413 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
| 413 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
| 414 | 414 | return false; |
| 415 | 415 | } |
| 416 | 416 | } |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | $data = self::removeAppendsFromAuthor($data); |
| 477 | 477 | } |
| 478 | 478 | // Add facets to index. |
| 479 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
| 479 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | } |
@@ -494,14 +494,14 @@ discard block |
||
| 494 | 494 | } catch (\Exception $e) { |
| 495 | 495 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 496 | 496 | Helper::addMessage( |
| 497 | - Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 497 | + Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($e->getMessage()), |
|
| 498 | 498 | Helper::getLanguageService()->getLL('flash.error'), |
| 499 | 499 | FlashMessage::ERROR, |
| 500 | 500 | true, |
| 501 | 501 | 'core.template.flashMessages' |
| 502 | 502 | ); |
| 503 | 503 | } |
| 504 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
| 504 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
| 505 | 505 | return false; |
| 506 | 506 | } |
| 507 | 507 | } |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | private static function getSolrDocument($updateQuery, $document, $unit, $fullText = '') { |
| 553 | 553 | $solrDoc = $updateQuery->createDocument(); |
| 554 | 554 | // Create unique identifier from document's UID and unit's XML ID. |
| 555 | - $solrDoc->setField('id', $document->getUid() . $unit['id']); |
|
| 555 | + $solrDoc->setField('id', $document->getUid().$unit['id']); |
|
| 556 | 556 | $solrDoc->setField('uid', $document->getUid()); |
| 557 | 557 | $solrDoc->setField('pid', $document->getPid()); |
| 558 | 558 | $solrDoc->setField('partof', $document->getPartof()); |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | * @subpackage dlf |
| 33 | 33 | * @access public |
| 34 | 34 | */ |
| 35 | -class Indexer |
|
| 36 | -{ |
|
| 35 | +class Indexer { |
|
| 37 | 36 | /** |
| 38 | 37 | * The extension key |
| 39 | 38 | * |
@@ -93,8 +92,7 @@ discard block |
||
| 93 | 92 | * |
| 94 | 93 | * @return bool true on success or false on failure |
| 95 | 94 | */ |
| 96 | - public static function add(Document $document) |
|
| 97 | - { |
|
| 95 | + public static function add(Document $document) { |
|
| 98 | 96 | if (in_array($document->getUid(), self::$processedDocs)) { |
| 99 | 97 | return true; |
| 100 | 98 | } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) { |
@@ -209,8 +207,7 @@ discard block |
||
| 209 | 207 | * |
| 210 | 208 | * @return string The field's dynamic index name |
| 211 | 209 | */ |
| 212 | - public static function getIndexFieldName($index_name, $pid = 0) |
|
| 213 | - { |
|
| 210 | + public static function getIndexFieldName($index_name, $pid = 0) { |
|
| 214 | 211 | // Sanitize input. |
| 215 | 212 | $pid = max(intval($pid), 0); |
| 216 | 213 | if (!$pid) { |
@@ -236,8 +233,7 @@ discard block |
||
| 236 | 233 | * |
| 237 | 234 | * @return void |
| 238 | 235 | */ |
| 239 | - protected static function loadIndexConf($pid) |
|
| 240 | - { |
|
| 236 | + protected static function loadIndexConf($pid) { |
|
| 241 | 237 | if (!self::$fieldsLoaded) { |
| 242 | 238 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 243 | 239 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
@@ -307,8 +303,7 @@ discard block |
||
| 307 | 303 | * |
| 308 | 304 | * @return bool true on success or false on failure |
| 309 | 305 | */ |
| 310 | - protected static function processLogical(Document $document, array $logicalUnit) |
|
| 311 | - { |
|
| 306 | + protected static function processLogical(Document $document, array $logicalUnit) { |
|
| 312 | 307 | $success = true; |
| 313 | 308 | $doc = $document->getDoc(); |
| 314 | 309 | $doc->cPid = $document->getPid(); |
@@ -346,7 +341,7 @@ discard block |
||
| 346 | 341 | ) { |
| 347 | 342 | $solrDoc->setField('date', $metadata['date'][0]); |
| 348 | 343 | // change date YYYYMMDD to YYYY-MM-DD |
| 349 | - } elseif (preg_match("/^[0-9]{8}$/", $metadata['date'][0])){ |
|
| 344 | + } elseif (preg_match("/^[0-9]{8}$/", $metadata['date'][0])) { |
|
| 350 | 345 | $solrDoc->setField('date', date("Y-m-d", strtotime($metadata['date'][0]))); |
| 351 | 346 | // convert any datetime to proper ISO extended datetime format and timezone for SOLR |
| 352 | 347 | } else { |
@@ -439,8 +434,7 @@ discard block |
||
| 439 | 434 | * |
| 440 | 435 | * @return bool true on success or false on failure |
| 441 | 436 | */ |
| 442 | - protected static function processPhysical(Document $document, $page, array $physicalUnit) |
|
| 443 | - { |
|
| 437 | + protected static function processPhysical(Document $document, $page, array $physicalUnit) { |
|
| 444 | 438 | $doc = $document->getDoc(); |
| 445 | 439 | $doc->cPid = $document->getPid(); |
| 446 | 440 | if ($doc->hasFulltext && $fullText = $doc->getFullText($physicalUnit['id'])) { |
@@ -518,8 +512,7 @@ discard block |
||
| 518 | 512 | * |
| 519 | 513 | * @return bool true on success or false on failure |
| 520 | 514 | */ |
| 521 | - protected static function solrConnect($core, $pid = 0) |
|
| 522 | - { |
|
| 515 | + protected static function solrConnect($core, $pid = 0) { |
|
| 523 | 516 | // Get Solr instance. |
| 524 | 517 | if (!self::$solr) { |
| 525 | 518 | // Connect to Solr server. |
@@ -588,8 +581,7 @@ discard block |
||
| 588 | 581 | * |
| 589 | 582 | * @access private |
| 590 | 583 | */ |
| 591 | - private function __construct() |
|
| 592 | - { |
|
| 584 | + private function __construct() { |
|
| 593 | 585 | // This is a static class, thus no instances should be created. |
| 594 | 586 | } |
| 595 | 587 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @var bool |
| 67 | 67 | * @access protected |
| 68 | 68 | */ |
| 69 | - protected static $fieldsLoaded = false; |
|
| 69 | + protected static $fieldsLoaded = FALSE; |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * List of already processed documents |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | public static function add(Document $document) |
| 97 | 97 | { |
| 98 | 98 | if (in_array($document->getUid(), self::$processedDocs)) { |
| 99 | - return true; |
|
| 99 | + return TRUE; |
|
| 100 | 100 | } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) { |
| 101 | - $success = true; |
|
| 101 | + $success = TRUE; |
|
| 102 | 102 | Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf'); |
| 103 | 103 | // Handle multi-volume documents. |
| 104 | 104 | if ($parentId = $document->getPartof()) { |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | $parent = $documentRepository->findByUid($parentId); |
| 111 | 111 | if ($parent) { |
| 112 | 112 | // get XML document of parent |
| 113 | - $doc = Doc::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], true); |
|
| 114 | - if ($doc !== null) { |
|
| 113 | + $doc = Doc::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], TRUE); |
|
| 114 | + if ($doc !== NULL) { |
|
| 115 | 115 | $parent->setDoc($doc); |
| 116 | 116 | $success = self::add($parent); |
| 117 | 117 | } else { |
| 118 | 118 | Helper::log('Could not load parent document with UID ' . $document->getDoc()->parentId, LOG_SEVERITY_ERROR); |
| 119 | - return false; |
|
| 119 | + return FALSE; |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | sprintf(Helper::getLanguageService()->getLL('flash.documentIndexed'), $document->getTitle(), $document->getUid()), |
| 158 | 158 | Helper::getLanguageService()->getLL('flash.done'), |
| 159 | 159 | FlashMessage::OK, |
| 160 | - true, |
|
| 160 | + TRUE, |
|
| 161 | 161 | 'core.template.flashMessages' |
| 162 | 162 | ); |
| 163 | 163 | } else { |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | sprintf(Helper::getLanguageService()->getLL('flash.documentNotIndexed'), $document->getTitle(), $document->getUid()), |
| 166 | 166 | Helper::getLanguageService()->getLL('flash.error'), |
| 167 | 167 | FlashMessage::ERROR, |
| 168 | - true, |
|
| 168 | + TRUE, |
|
| 169 | 169 | 'core.template.flashMessages' |
| 170 | 170 | ); |
| 171 | 171 | } |
@@ -177,12 +177,12 @@ discard block |
||
| 177 | 177 | Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()), |
| 178 | 178 | Helper::getLanguageService()->getLL('flash.error'), |
| 179 | 179 | FlashMessage::ERROR, |
| 180 | - true, |
|
| 180 | + TRUE, |
|
| 181 | 181 | 'core.template.flashMessages' |
| 182 | 182 | ); |
| 183 | 183 | } |
| 184 | 184 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
| 185 | - return false; |
|
| 185 | + return FALSE; |
|
| 186 | 186 | } |
| 187 | 187 | } else { |
| 188 | 188 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | Helper::getLanguageService()->getLL('flash.solrNoConnection'), |
| 191 | 191 | Helper::getLanguageService()->getLL('flash.warning'), |
| 192 | 192 | FlashMessage::WARNING, |
| 193 | - true, |
|
| 193 | + TRUE, |
|
| 194 | 194 | 'core.template.flashMessages' |
| 195 | 195 | ); |
| 196 | 196 | } |
| 197 | 197 | Helper::log('Could not connect to Apache Solr server', LOG_SEVERITY_ERROR); |
| 198 | - return false; |
|
| 198 | + return FALSE; |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | if ($indexing['index_boost'] > 0.0) { |
| 291 | 291 | self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']); |
| 292 | 292 | } else { |
| 293 | - self::$fields['fieldboost'][$indexing['index_name']] = false; |
|
| 293 | + self::$fields['fieldboost'][$indexing['index_name']] = FALSE; |
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | - self::$fieldsLoaded = true; |
|
| 296 | + self::$fieldsLoaded = TRUE; |
|
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | protected static function processLogical(Document $document, array $logicalUnit) |
| 311 | 311 | { |
| 312 | - $success = true; |
|
| 312 | + $success = TRUE; |
|
| 313 | 313 | $doc = $document->getDoc(); |
| 314 | 314 | $doc->cPid = $document->getPid(); |
| 315 | 315 | // Get metadata for logical unit. |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $solrDoc->setField('thumbnail', $doc->getFileLocation($logicalUnit['thumbnailId'])); |
| 334 | 334 | } |
| 335 | 335 | // There can be only one toplevel unit per UID, independently of backend configuration |
| 336 | - $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? true : false); |
|
| 336 | + $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? TRUE : FALSE); |
|
| 337 | 337 | $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
| 338 | 338 | $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
| 339 | 339 | // verify date formatting |
@@ -406,12 +406,12 @@ discard block |
||
| 406 | 406 | Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
| 407 | 407 | Helper::getLanguageService()->getLL('flash.error'), |
| 408 | 408 | FlashMessage::ERROR, |
| 409 | - true, |
|
| 409 | + TRUE, |
|
| 410 | 410 | 'core.template.flashMessages' |
| 411 | 411 | ); |
| 412 | 412 | } |
| 413 | 413 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
| 414 | - return false; |
|
| 414 | + return FALSE; |
|
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | // Check for child elements... |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | break; |
| 458 | 458 | } |
| 459 | 459 | } |
| 460 | - $solrDoc->setField('toplevel', false); |
|
| 460 | + $solrDoc->setField('toplevel', FALSE); |
|
| 461 | 461 | $solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']); |
| 462 | 462 | $solrDoc->setField('collection', $doc->metadataArray[$doc->toplevelId]['collection']); |
| 463 | 463 | |
@@ -497,15 +497,15 @@ discard block |
||
| 497 | 497 | Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
| 498 | 498 | Helper::getLanguageService()->getLL('flash.error'), |
| 499 | 499 | FlashMessage::ERROR, |
| 500 | - true, |
|
| 500 | + TRUE, |
|
| 501 | 501 | 'core.template.flashMessages' |
| 502 | 502 | ); |
| 503 | 503 | } |
| 504 | 504 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
| 505 | - return false; |
|
| 505 | + return FALSE; |
|
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | - return true; |
|
| 508 | + return TRUE; |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | /** |
@@ -531,10 +531,10 @@ discard block |
||
| 531 | 531 | self::loadIndexConf($pid); |
| 532 | 532 | } |
| 533 | 533 | } else { |
| 534 | - return false; |
|
| 534 | + return FALSE; |
|
| 535 | 535 | } |
| 536 | 536 | } |
| 537 | - return true; |
|
| 537 | + return TRUE; |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | /** |
@@ -23,8 +23,7 @@ discard block |
||
| 23 | 23 | * @subpackage dlf |
| 24 | 24 | * @access public |
| 25 | 25 | */ |
| 26 | -class NavigationController extends AbstractController |
|
| 27 | -{ |
|
| 26 | +class NavigationController extends AbstractController { |
|
| 28 | 27 | /** |
| 29 | 28 | * Method to get the page select values and use them with chash |
| 30 | 29 | * @param \Kitodo\Dlf\Domain\Model\PageSelectForm|NULL $pageSelectForm |
@@ -53,8 +52,7 @@ discard block |
||
| 53 | 52 | * |
| 54 | 53 | * @return void |
| 55 | 54 | */ |
| 56 | - public function mainAction() |
|
| 57 | - { |
|
| 55 | + public function mainAction() { |
|
| 58 | 56 | // Load current document. |
| 59 | 57 | $this->loadDocument($this->requestData); |
| 60 | 58 | if ( |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
| 74 | 74 | |
| 75 | - $collection = null; |
|
| 75 | + $collection = NULL; |
|
| 76 | 76 | if ($this->searchParams['collection'] && MathUtility::canBeInterpretedAsInteger($this->searchParams['collection'])) { |
| 77 | 77 | $collection = $this->collectionRepository->findByUid($this->searchParams['collection']); |
| 78 | 78 | } |
@@ -84,15 +84,15 @@ discard block |
||
| 84 | 84 | $GLOBALS['TSFE']->fe_user->setKey('ses', 'widgetPage', $widgetPage); |
| 85 | 85 | |
| 86 | 86 | // get all sortable metadata records |
| 87 | - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); |
|
| 87 | + $sortableMetadata = $this->metadataRepository->findByIsSortable(TRUE); |
|
| 88 | 88 | |
| 89 | 89 | // get all metadata records to be shown in results |
| 90 | - $listedMetadata = $this->metadataRepository->findByIsListed(true); |
|
| 90 | + $listedMetadata = $this->metadataRepository->findByIsListed(TRUE); |
|
| 91 | 91 | |
| 92 | 92 | $solrResults = []; |
| 93 | 93 | $numResults = 0; |
| 94 | 94 | if (is_array($this->searchParams) && !empty($this->searchParams)) { |
| 95 | - $solrResults = $this->documentRepository->findSolrByCollection($collection ? : null, $this->settings, $this->searchParams, $listedMetadata); |
|
| 95 | + $solrResults = $this->documentRepository->findSolrByCollection($collection ? : NULL, $this->settings, $this->searchParams, $listedMetadata); |
|
| 96 | 96 | $numResults = $solrResults->getNumFound(); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | if (!preg_match('/\d{8}-\d{1}/i', $id)) { |
| 144 | 144 | return false; |
| 145 | 145 | } elseif ($checksum == 10) { |
| 146 | - return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
|
| 146 | + return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD'); |
|
| 147 | 147 | } elseif (substr($id, -1, 1) != $checksum) { |
| 148 | 148 | return false; |
| 149 | 149 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 316 | 316 | // Merge initialisation vector and encrypted data. |
| 317 | 317 | if ($encrypted !== false) { |
| 318 | - $encrypted = base64_encode($iv . $encrypted); |
|
| 318 | + $encrypted = base64_encode($iv.$encrypted); |
|
| 319 | 319 | } |
| 320 | 320 | return $encrypted; |
| 321 | 321 | } |
@@ -369,8 +369,8 @@ discard block |
||
| 369 | 369 | public static function getHookObjects($scriptRelPath) |
| 370 | 370 | { |
| 371 | 371 | $hookObjects = []; |
| 372 | - if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
|
| 373 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
|
| 372 | + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) { |
|
| 373 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) { |
|
| 374 | 374 | $hookObjects[] = GeneralUtility::makeInstance($classRef); |
| 375 | 375 | } |
| 376 | 376 | } |
@@ -397,12 +397,12 @@ discard block |
||
| 397 | 397 | // NOTE: Only use tables that don't have too many entries! |
| 398 | 398 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
| 399 | 399 | ) { |
| 400 | - self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
| 400 | + self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
| 401 | 401 | return ''; |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - $makeCacheKey = function ($pid, $uid) { |
|
| 405 | - return $pid . '.' . $uid; |
|
| 404 | + $makeCacheKey = function($pid, $uid) { |
|
| 405 | + return $pid.'.'.$uid; |
|
| 406 | 406 | }; |
| 407 | 407 | |
| 408 | 408 | static $cache = []; |
@@ -412,9 +412,9 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | $result = $queryBuilder |
| 414 | 414 | ->select( |
| 415 | - $table . '.index_name AS index_name', |
|
| 416 | - $table . '.uid AS uid', |
|
| 417 | - $table . '.pid AS pid', |
|
| 415 | + $table.'.index_name AS index_name', |
|
| 416 | + $table.'.uid AS uid', |
|
| 417 | + $table.'.pid AS pid', |
|
| 418 | 418 | ) |
| 419 | 419 | ->from($table) |
| 420 | 420 | ->execute(); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $result = $cache[$table][$cacheKey] ?? ''; |
| 433 | 433 | |
| 434 | 434 | if ($result === '') { |
| 435 | - self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
| 435 | + self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | return $result; |
@@ -459,11 +459,11 @@ discard block |
||
| 459 | 459 | // No ISO code, return unchanged. |
| 460 | 460 | return $code; |
| 461 | 461 | } |
| 462 | - $lang = LocalizationUtility::translate('LLL:' . $file . ':' . $code); |
|
| 462 | + $lang = LocalizationUtility::translate('LLL:'.$file.':'.$code); |
|
| 463 | 463 | if (!empty($lang)) { |
| 464 | 464 | return $lang; |
| 465 | 465 | } else { |
| 466 | - self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
| 466 | + self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
| 467 | 467 | return $code; |
| 468 | 468 | } |
| 469 | 469 | } |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | '-' => 39, |
| 561 | 561 | ':' => 17, |
| 562 | 562 | ]; |
| 563 | - $urn = strtolower($base . $id); |
|
| 563 | + $urn = strtolower($base.$id); |
|
| 564 | 564 | if (preg_match('/[^a-z0-9:-]/', $urn)) { |
| 565 | 565 | self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING); |
| 566 | 566 | return ''; |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | $checksum += ($i + 1) * intval(substr($digits, $i, 1)); |
| 575 | 575 | } |
| 576 | 576 | $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1); |
| 577 | - return $base . $id . $checksum; |
|
| 577 | + return $base.$id.$checksum; |
|
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | /** |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | // Sanitize input. |
| 669 | 669 | $pid = max(intval($pid), 0); |
| 670 | 670 | if (!$pid) { |
| 671 | - self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING); |
|
| 671 | + self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING); |
|
| 672 | 672 | return $index_name; |
| 673 | 673 | } |
| 674 | 674 | /** @var \TYPO3\CMS\Frontend\Page\PageRepository $pageRepository */ |
@@ -690,13 +690,13 @@ discard block |
||
| 690 | 690 | // First fetch the uid of the received index_name |
| 691 | 691 | $result = $queryBuilder |
| 692 | 692 | ->select( |
| 693 | - $table . '.uid AS uid', |
|
| 694 | - $table . '.l18n_parent AS l18n_parent' |
|
| 693 | + $table.'.uid AS uid', |
|
| 694 | + $table.'.l18n_parent AS l18n_parent' |
|
| 695 | 695 | ) |
| 696 | 696 | ->from($table) |
| 697 | 697 | ->where( |
| 698 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 699 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
|
| 698 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 699 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)), |
|
| 700 | 700 | self::whereExpression($table, true) |
| 701 | 701 | ) |
| 702 | 702 | ->setMaxResults(1) |
@@ -709,12 +709,12 @@ discard block |
||
| 709 | 709 | $resArray = $allResults[0]; |
| 710 | 710 | |
| 711 | 711 | $result = $queryBuilder |
| 712 | - ->select($table . '.index_name AS index_name') |
|
| 712 | + ->select($table.'.index_name AS index_name') |
|
| 713 | 713 | ->from($table) |
| 714 | 714 | ->where( |
| 715 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 716 | - $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
|
| 717 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())), |
|
| 715 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 716 | + $queryBuilder->expr()->eq($table.'.uid', $resArray['l18n_parent']), |
|
| 717 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId())), |
|
| 718 | 718 | self::whereExpression($table, true) |
| 719 | 719 | ) |
| 720 | 720 | ->setMaxResults(1) |
@@ -732,14 +732,14 @@ discard block |
||
| 732 | 732 | if (empty($labels[$table][$pid][$languageAspect->getContentId()][$index_name])) { |
| 733 | 733 | // Check if this table is allowed for translation. |
| 734 | 734 | if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) { |
| 735 | - $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]); |
|
| 735 | + $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]); |
|
| 736 | 736 | if ($languageAspect->getContentId() > 0) { |
| 737 | 737 | $additionalWhere = $queryBuilder->expr()->andX( |
| 738 | 738 | $queryBuilder->expr()->orX( |
| 739 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
| 740 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())) |
|
| 739 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
| 740 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId())) |
|
| 741 | 741 | ), |
| 742 | - $queryBuilder->expr()->eq($table . '.l18n_parent', 0) |
|
| 742 | + $queryBuilder->expr()->eq($table.'.l18n_parent', 0) |
|
| 743 | 743 | ); |
| 744 | 744 | } |
| 745 | 745 | |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | ->select('*') |
| 749 | 749 | ->from($table) |
| 750 | 750 | ->where( |
| 751 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 751 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 752 | 752 | $additionalWhere, |
| 753 | 753 | self::whereExpression($table, true) |
| 754 | 754 | ) |
@@ -766,10 +766,10 @@ discard block |
||
| 766 | 766 | } |
| 767 | 767 | } |
| 768 | 768 | } else { |
| 769 | - self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
| 769 | + self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
| 770 | 770 | } |
| 771 | 771 | } else { |
| 772 | - self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
| 772 | + self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | |
@@ -811,9 +811,9 @@ discard block |
||
| 811 | 811 | return GeneralUtility::makeInstance(ConnectionPool::class) |
| 812 | 812 | ->getQueryBuilderForTable($table) |
| 813 | 813 | ->expr() |
| 814 | - ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
| 814 | + ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
| 815 | 815 | } else { |
| 816 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
| 816 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
| 817 | 817 | return '1=-1'; |
| 818 | 818 | } |
| 819 | 819 | } |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | */ |
| 853 | 853 | public static function polyfillExtbaseClassesForTYPO3v9() |
| 854 | 854 | { |
| 855 | - $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php'; |
|
| 855 | + $classes = require __DIR__.'/../../Configuration/Extbase/Persistence/Classes.php'; |
|
| 856 | 856 | |
| 857 | 857 | $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
| 858 | 858 | $configurationManager = $objectManager->get(ConfigurationManager::class); |
@@ -908,10 +908,10 @@ discard block |
||
| 908 | 908 | try { |
| 909 | 909 | $response = $requestFactory->request($url, 'GET', $configuration); |
| 910 | 910 | } catch (\Exception $e) { |
| 911 | - self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
|
| 911 | + self::log('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.', LOG_SEVERITY_WARNING); |
|
| 912 | 912 | return false; |
| 913 | 913 | } |
| 914 | - $content = $response->getBody()->getContents(); |
|
| 914 | + $content = $response->getBody()->getContents(); |
|
| 915 | 915 | |
| 916 | 916 | return $content; |
| 917 | 917 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
| 83 | 83 | */ |
| 84 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
| 84 | + public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages') |
|
| 85 | 85 | { |
| 86 | 86 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 87 | 87 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
@@ -123,9 +123,9 @@ discard block |
||
| 123 | 123 | $checksum = 'X'; |
| 124 | 124 | } |
| 125 | 125 | if (!preg_match('/\d{8}[0-9X]{1}/i', $id)) { |
| 126 | - return false; |
|
| 126 | + return FALSE; |
|
| 127 | 127 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 128 | - return false; |
|
| 128 | + return FALSE; |
|
| 129 | 129 | } |
| 130 | 130 | break; |
| 131 | 131 | case 'ZDB': |
@@ -133,19 +133,19 @@ discard block |
||
| 133 | 133 | $checksum = 'X'; |
| 134 | 134 | } |
| 135 | 135 | if (!preg_match('/\d{8}-[0-9X]{1}/i', $id)) { |
| 136 | - return false; |
|
| 136 | + return FALSE; |
|
| 137 | 137 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 138 | - return false; |
|
| 138 | + return FALSE; |
|
| 139 | 139 | } |
| 140 | 140 | break; |
| 141 | 141 | case 'SWD': |
| 142 | 142 | $checksum = 11 - $checksum; |
| 143 | 143 | if (!preg_match('/\d{8}-\d{1}/i', $id)) { |
| 144 | - return false; |
|
| 144 | + return FALSE; |
|
| 145 | 145 | } elseif ($checksum == 10) { |
| 146 | 146 | return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
| 147 | 147 | } elseif (substr($id, -1, 1) != $checksum) { |
| 148 | - return false; |
|
| 148 | + return FALSE; |
|
| 149 | 149 | } |
| 150 | 150 | break; |
| 151 | 151 | case 'GKD': |
@@ -154,13 +154,13 @@ discard block |
||
| 154 | 154 | $checksum = 'X'; |
| 155 | 155 | } |
| 156 | 156 | if (!preg_match('/\d{8}-[0-9X]{1}/i', $id)) { |
| 157 | - return false; |
|
| 157 | + return FALSE; |
|
| 158 | 158 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 159 | - return false; |
|
| 159 | + return FALSE; |
|
| 160 | 160 | } |
| 161 | 161 | break; |
| 162 | 162 | } |
| 163 | - return true; |
|
| 163 | + return TRUE; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -175,28 +175,28 @@ discard block |
||
| 175 | 175 | public static function decrypt($encrypted) |
| 176 | 176 | { |
| 177 | 177 | if ( |
| 178 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
| 179 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
| 178 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
| 179 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
| 180 | 180 | ) { |
| 181 | 181 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
| 182 | - return false; |
|
| 182 | + return FALSE; |
|
| 183 | 183 | } |
| 184 | 184 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
| 185 | 185 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
| 186 | - return false; |
|
| 186 | + return FALSE; |
|
| 187 | 187 | } |
| 188 | 188 | if ( |
| 189 | 189 | empty($encrypted) |
| 190 | 190 | || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm) |
| 191 | 191 | ) { |
| 192 | 192 | self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR); |
| 193 | - return false; |
|
| 193 | + return FALSE; |
|
| 194 | 194 | } |
| 195 | 195 | // Split initialisation vector and encrypted data. |
| 196 | 196 | $binary = base64_decode($encrypted); |
| 197 | 197 | $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 198 | 198 | $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 199 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
| 199 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
| 200 | 200 | // Decrypt data. |
| 201 | 201 | $decrypted = openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 202 | 202 | return $decrypted; |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | // Don't make simplexml_load_string throw (when $content is an array |
| 218 | 218 | // or object) |
| 219 | 219 | if (!is_string($content)) { |
| 220 | - return false; |
|
| 220 | + return FALSE; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | // Turn off libxml's error logging. |
| 224 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
| 224 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
| 225 | 225 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
| 226 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
| 226 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
| 227 | 227 | // Try to load XML from file. |
| 228 | 228 | $xml = simplexml_load_string($content); |
| 229 | 229 | // reset entity loader setting |
@@ -277,9 +277,9 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public static function digest($string) |
| 279 | 279 | { |
| 280 | - if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
|
| 280 | + if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) { |
|
| 281 | 281 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
| 282 | - return false; |
|
| 282 | + return FALSE; |
|
| 283 | 283 | } |
| 284 | 284 | // Hash string. |
| 285 | 285 | $hashed = openssl_digest($string, self::$hashAlgorithm); |
@@ -298,23 +298,23 @@ discard block |
||
| 298 | 298 | public static function encrypt($string) |
| 299 | 299 | { |
| 300 | 300 | if ( |
| 301 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
| 302 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
| 301 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
| 302 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
| 303 | 303 | ) { |
| 304 | 304 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
| 305 | - return false; |
|
| 305 | + return FALSE; |
|
| 306 | 306 | } |
| 307 | 307 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
| 308 | 308 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
| 309 | - return false; |
|
| 309 | + return FALSE; |
|
| 310 | 310 | } |
| 311 | 311 | // Generate random initialisation vector. |
| 312 | 312 | $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 313 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
| 313 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
| 314 | 314 | // Encrypt data. |
| 315 | 315 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 316 | 316 | // Merge initialisation vector and encrypted data. |
| 317 | - if ($encrypted !== false) { |
|
| 317 | + if ($encrypted !== FALSE) { |
|
| 318 | 318 | $encrypted = base64_encode($iv . $encrypted); |
| 319 | 319 | } |
| 320 | 320 | return $encrypted; |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | public static function isValidHttpUrl($url) |
| 602 | 602 | { |
| 603 | 603 | if (!GeneralUtility::isValidUrl($url)) { |
| 604 | - return false; |
|
| 604 | + return FALSE; |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | $parsed = parse_url($url); |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | * |
| 626 | 626 | * @return array Merged array |
| 627 | 627 | */ |
| 628 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
| 628 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE) |
|
| 629 | 629 | { |
| 630 | 630 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 631 | 631 | return $original; |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | ->where( |
| 698 | 698 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 699 | 699 | $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
| 700 | - self::whereExpression($table, true) |
|
| 700 | + self::whereExpression($table, TRUE) |
|
| 701 | 701 | ) |
| 702 | 702 | ->setMaxResults(1) |
| 703 | 703 | ->execute(); |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 716 | 716 | $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
| 717 | 717 | $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())), |
| 718 | - self::whereExpression($table, true) |
|
| 718 | + self::whereExpression($table, TRUE) |
|
| 719 | 719 | ) |
| 720 | 720 | ->setMaxResults(1) |
| 721 | 721 | ->execute(); |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | ->where( |
| 751 | 751 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 752 | 752 | $additionalWhere, |
| 753 | - self::whereExpression($table, true) |
|
| 753 | + self::whereExpression($table, TRUE) |
|
| 754 | 754 | ) |
| 755 | 755 | ->setMaxResults(10000) |
| 756 | 756 | ->execute(); |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | * |
| 791 | 791 | * @return string Additional WHERE expression |
| 792 | 792 | */ |
| 793 | - public static function whereExpression($table, $showHidden = false) |
|
| 793 | + public static function whereExpression($table, $showHidden = FALSE) |
|
| 794 | 794 | { |
| 795 | 795 | if (\TYPO3_MODE === 'FE') { |
| 796 | 796 | // Should we ignore the record's hidden flag? |
@@ -859,13 +859,13 @@ discard block |
||
| 859 | 859 | $frameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); |
| 860 | 860 | |
| 861 | 861 | $extbaseClassmap = &$frameworkConfiguration['persistence']['classes']; |
| 862 | - if ($extbaseClassmap === null) { |
|
| 862 | + if ($extbaseClassmap === NULL) { |
|
| 863 | 863 | $extbaseClassmap = []; |
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | foreach ($classes as $className => $classConfig) { |
| 867 | 867 | $extbaseClass = &$extbaseClassmap[$className]; |
| 868 | - if ($extbaseClass === null) { |
|
| 868 | + if ($extbaseClass === NULL) { |
|
| 869 | 869 | $extbaseClass = []; |
| 870 | 870 | } |
| 871 | 871 | if (!isset($extbaseClass['mapping'])) { |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | public static function getUrl(string $url) |
| 892 | 892 | { |
| 893 | 893 | if (!Helper::isValidHttpUrl($url)) { |
| 894 | - return false; |
|
| 894 | + return FALSE; |
|
| 895 | 895 | } |
| 896 | 896 | |
| 897 | 897 | // Get extension configuration. |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | $response = $requestFactory->request($url, 'GET', $configuration); |
| 910 | 910 | } catch (\Exception $e) { |
| 911 | 911 | self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
| 912 | - return false; |
|
| 912 | + return FALSE; |
|
| 913 | 913 | } |
| 914 | 914 | $content = $response->getBody()->getContents(); |
| 915 | 915 | |