@@ -126,8 +126,8 @@ |
||
| 126 | 126 | ->select(...explode(',', $fields)) |
| 127 | 127 | ->from($table) |
| 128 | 128 | ->where( |
| 129 | - $queryBuilder->expr()->eq($table . '.pid', intval($this->storagePid)), |
|
| 130 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
| 129 | + $queryBuilder->expr()->eq($table.'.pid', intval($this->storagePid)), |
|
| 130 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
| 131 | 131 | $andWhere |
| 132 | 132 | ) |
| 133 | 133 | ->orderBy($sorting) |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | // parameters are available in $this->data['parameterArray']['fieldConf']['config']['parameters'] |
| 23 | 23 | $result = $this->initializeResultArray(); |
| 24 | 24 | if (!empty($this->data['databaseRow']['thumbnail'])) { |
| 25 | - $result['html'] = '<img alt="Thumbnail" title="" src="' . $this->data['databaseRow']['thumbnail'] . '" />'; |
|
| 25 | + $result['html'] = '<img alt="Thumbnail" title="" src="'.$this->data['databaseRow']['thumbnail'].'" />'; |
|
| 26 | 26 | } else { |
| 27 | 27 | $result['html'] = ''; |
| 28 | 28 | } |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | |
| 395 | 395 | $excludeOtherWhere = ''; |
| 396 | 396 | if ($settings['excludeOther']) { |
| 397 | - $excludeOtherWhere = 'tx_dlf_documents.pid=' . intval($settings['pages']); |
|
| 397 | + $excludeOtherWhere = 'tx_dlf_documents.pid='.intval($settings['pages']); |
|
| 398 | 398 | } |
| 399 | 399 | // Check if there are any metadata to suggest. |
| 400 | 400 | $result = $queryBuilder |
@@ -446,12 +446,12 @@ discard block |
||
| 446 | 446 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
| 447 | 447 | ->getConnectionForTable('tx_dlf_documents'); |
| 448 | 448 | |
| 449 | - $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' . |
|
| 450 | - 'FROM `tx_dlf_documents` ' . |
|
| 451 | - 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' . |
|
| 452 | - 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' . |
|
| 453 | - 'WHERE `tx_dlf_documents`.`record_id` = ? ' . |
|
| 454 | - 'AND `tx_dlf_relations`.`ident`="docs_colls" ' . |
|
| 449 | + $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '. |
|
| 450 | + 'FROM `tx_dlf_documents` '. |
|
| 451 | + 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '. |
|
| 452 | + 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '. |
|
| 453 | + 'WHERE `tx_dlf_documents`.`record_id` = ? '. |
|
| 454 | + 'AND `tx_dlf_relations`.`ident`="docs_colls" '. |
|
| 455 | 455 | $where; |
| 456 | 456 | |
| 457 | 457 | $values = [ |
@@ -481,13 +481,13 @@ discard block |
||
| 481 | 481 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
| 482 | 482 | ->getConnectionForTable('tx_dlf_documents'); |
| 483 | 483 | |
| 484 | - $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' . |
|
| 485 | - 'FROM `tx_dlf_documents` ' . |
|
| 486 | - 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' . |
|
| 487 | - 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' . |
|
| 488 | - 'WHERE `tx_dlf_documents`.`uid` IN ( ? ) ' . |
|
| 489 | - 'AND `tx_dlf_relations`.`ident`="docs_colls" ' . |
|
| 490 | - 'AND ' . Helper::whereExpression('tx_dlf_collections') . ' ' . |
|
| 484 | + $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '. |
|
| 485 | + 'FROM `tx_dlf_documents` '. |
|
| 486 | + 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '. |
|
| 487 | + 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '. |
|
| 488 | + 'WHERE `tx_dlf_documents`.`uid` IN ( ? ) '. |
|
| 489 | + 'AND `tx_dlf_relations`.`ident`="docs_colls" '. |
|
| 490 | + 'AND '.Helper::whereExpression('tx_dlf_collections').' '. |
|
| 491 | 491 | 'GROUP BY `tx_dlf_documents`.`uid` '; |
| 492 | 492 | |
| 493 | 493 | $values = [ |
@@ -569,13 +569,13 @@ discard block |
||
| 569 | 569 | // Set search query. |
| 570 | 570 | if ( |
| 571 | 571 | (!empty($searchParams['fulltext'])) |
| 572 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches) |
|
| 572 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches) |
|
| 573 | 573 | ) { |
| 574 | 574 | // If the query already is a fulltext query e.g using the facets |
| 575 | 575 | $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1]; |
| 576 | 576 | // Search in fulltext field if applicable. Query must not be empty! |
| 577 | 577 | if (!empty($searchParams['query'])) { |
| 578 | - $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')'; |
|
| 578 | + $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')'; |
|
| 579 | 579 | } |
| 580 | 580 | $params['fulltext'] = true; |
| 581 | 581 | } else { |
@@ -598,9 +598,9 @@ discard block |
||
| 598 | 598 | in_array($searchParams['extOperator'][$i], $allowedOperators) |
| 599 | 599 | ) { |
| 600 | 600 | if (!empty($query)) { |
| 601 | - $query .= ' ' . $searchParams['extOperator'][$i] . ' '; |
|
| 601 | + $query .= ' '.$searchParams['extOperator'][$i].' '; |
|
| 602 | 602 | } |
| 603 | - $query .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')'; |
|
| 603 | + $query .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')'; |
|
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | 606 | } |
@@ -620,12 +620,12 @@ discard block |
||
| 620 | 620 | ) { |
| 621 | 621 | // Search in document and all subordinates (valid for up to three levels of hierarchy). |
| 622 | 622 | $params['filterquery'][]['query'] = '_query_:"{!join from=' |
| 623 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 624 | - . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 625 | - . $fields['uid'] . ':' . $searchParams['documentId'] . '"' . ' OR {!join from=' |
|
| 626 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 627 | - . $fields['uid'] . ':' . $searchParams['documentId'] . ' OR ' |
|
| 628 | - . $fields['uid'] . ':' . $searchParams['documentId']; |
|
| 623 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
| 624 | + . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}' |
|
| 625 | + . $fields['uid'].':'.$searchParams['documentId'].'"'.' OR {!join from=' |
|
| 626 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
| 627 | + . $fields['uid'].':'.$searchParams['documentId'].' OR ' |
|
| 628 | + . $fields['uid'].':'.$searchParams['documentId']; |
|
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | // if a collection is given, we prepare the collection query string |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | $collecionsQueryString = $collection->getIndexName(); |
| 634 | 634 | $params['filterquery'][]['query'] = 'toplevel:true'; |
| 635 | 635 | $params['filterquery'][]['query'] = 'partof:0'; |
| 636 | - $params['filterquery'][]['query'] = 'collection_faceting:("' . $collecionsQueryString . '")'; |
|
| 636 | + $params['filterquery'][]['query'] = 'collection_faceting:("'.$collecionsQueryString.'")'; |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | // Set some query parameters. |
@@ -662,8 +662,8 @@ discard block |
||
| 662 | 662 | if ($listedMetadata) { |
| 663 | 663 | foreach ($listedMetadata as $metadata) { |
| 664 | 664 | if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { |
| 665 | - $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 666 | - $params['fields'] .= ',' . $listMetadataRecord; |
|
| 665 | + $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 666 | + $params['fields'] .= ','.$listMetadataRecord; |
|
| 667 | 667 | $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord; |
| 668 | 668 | } |
| 669 | 669 | } |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | if (empty($documents[$doc['uid']]['title']) && ($documents[$doc['uid']]['partOf'] > 0)) { |
| 750 | 750 | $parentDocument = $this->findByUid($documents[$doc['uid']]['partOf']); |
| 751 | 751 | if ($parentDocument) { |
| 752 | - $documents[$doc['uid']]['title'] = '[' . $parentDocument->getTitle() . ']'; |
|
| 752 | + $documents[$doc['uid']]['title'] = '['.$parentDocument->getTitle().']'; |
|
| 753 | 753 | } |
| 754 | 754 | } |
| 755 | 755 | } |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | $metadataArray = []; |
| 774 | 774 | |
| 775 | 775 | // Set some query parameters. |
| 776 | - $params['query'] = 'uid:' . $uid; |
|
| 776 | + $params['query'] = 'uid:'.$uid; |
|
| 777 | 777 | $params['start'] = 0; |
| 778 | 778 | $params['rows'] = 1; |
| 779 | 779 | $params['sort'] = ['score' => 'desc']; |
@@ -785,8 +785,8 @@ discard block |
||
| 785 | 785 | if ($listedMetadata) { |
| 786 | 786 | foreach ($listedMetadata as $metadata) { |
| 787 | 787 | if ($metadata->getIndexIndexed()) { |
| 788 | - $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . 'i'; |
|
| 789 | - $params['fields'] .= ',' . $listMetadataRecord; |
|
| 788 | + $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').'i'; |
|
| 789 | + $params['fields'] .= ','.$listMetadataRecord; |
|
| 790 | 790 | $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord; |
| 791 | 791 | } |
| 792 | 792 | } |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | $cache = null; |
| 837 | 837 | // Calculate cache identifier. |
| 838 | 838 | if ($enableCache === true) { |
| 839 | - $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true)); |
|
| 839 | + $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true)); |
|
| 840 | 840 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 841 | 841 | } |
| 842 | 842 | $resultSet = [ |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | // order by oai_name |
| 49 | 49 | $query->setOrderings( |
| 50 | - array('sorting' => QueryInterface::ORDER_ASCENDING) |
|
| 50 | + array ('sorting' => QueryInterface::ORDER_ASCENDING) |
|
| 51 | 51 | ); |
| 52 | 52 | |
| 53 | 53 | return $query->execute(); |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | |
| 99 | 99 | // order by oai_name |
| 100 | 100 | $query->setOrderings( |
| 101 | - array('oai_name' => QueryInterface::ORDER_ASCENDING) |
|
| 101 | + array ('oai_name' => QueryInterface::ORDER_ASCENDING) |
|
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | 104 | return $query->execute(); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | if ($this->document) { |
| 158 | 158 | $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
| 159 | 159 | } else { |
| 160 | - $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
|
| 160 | + $this->logger->error('Invalid UID "'.$requestData['id'].'" or PID "'.$pid.'" for document loading'); |
|
| 161 | 161 | } |
| 162 | 162 | } else if (GeneralUtility::isValidUrl($requestData['id'])) { |
| 163 | 163 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | $this->document->setLocation($requestData['id']); |
| 177 | 177 | } else { |
| 178 | - $this->logger->error('Invalid location given "' . $requestData['id'] . '" for document loading'); |
|
| 178 | + $this->logger->error('Invalid location given "'.$requestData['id'].'" for document loading'); |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | if ($this->document !== null && $doc !== null) { |
| 193 | 193 | $this->document->setDoc($doc); |
| 194 | 194 | } else { |
| 195 | - $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"'); |
|
| 195 | + $this->logger->error('Failed to load document with record ID "'.$requestData['recordId'].'"'); |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | } else { |
| 199 | - $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
|
| 199 | + $this->logger->error('Invalid UID "'.$requestData['id'].'" or PID "'.$pid.'" for document loading'); |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | // Get next available core name if none given. |
| 136 | 136 | if (empty($core)) { |
| 137 | - $core = 'dlfCore' . self::getNextCoreNumber(); |
|
| 137 | + $core = 'dlfCore'.self::getNextCoreNumber(); |
|
| 138 | 138 | } |
| 139 | 139 | // Get Solr service instance. |
| 140 | 140 | $solr = self::getInstance($core); |
@@ -230,13 +230,13 @@ discard block |
||
| 230 | 230 | ->execute(); |
| 231 | 231 | |
| 232 | 232 | while ($resArray = $result->fetch()) { |
| 233 | - $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i'; |
|
| 233 | + $fields[] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').($resArray['index_stored'] ? 's' : 'u').'i'; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // Check if queried field is valid. |
| 237 | 237 | $splitQuery = explode(':', $query, 2); |
| 238 | 238 | if (in_array($splitQuery[0], $fields)) { |
| 239 | - $query = $splitQuery[0] . ':(' . self::escapeQuery(trim($splitQuery[1], '()')) . ')'; |
|
| 239 | + $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')'; |
|
| 240 | 240 | } else { |
| 241 | 241 | $query = self::escapeQuery($query); |
| 242 | 242 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | { |
| 342 | 342 | $number = max(intval($number), 0); |
| 343 | 343 | // Check if core already exists. |
| 344 | - $solr = self::getInstance('dlfCore' . $number); |
|
| 344 | + $solr = self::getInstance('dlfCore'.$number); |
|
| 345 | 345 | if (!$solr->ready) { |
| 346 | 346 | return $number; |
| 347 | 347 | } else { |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | $parameters['start'] = 0; |
| 404 | 404 | $parameters['rows'] = $this->limit; |
| 405 | 405 | // Calculate cache identifier. |
| 406 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
| 406 | + $cacheIdentifier = Helper::digest($this->core.print_r(array_merge($this->params, $parameters), true)); |
|
| 407 | 407 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 408 | 408 | $resultSet = []; |
| 409 | 409 | if (($entry = $cache->get($cacheIdentifier)) === false) { |
@@ -534,12 +534,12 @@ discard block |
||
| 534 | 534 | */ |
| 535 | 535 | public function __get($var) |
| 536 | 536 | { |
| 537 | - $method = '_get' . ucfirst($var); |
|
| 537 | + $method = '_get'.ucfirst($var); |
|
| 538 | 538 | if ( |
| 539 | 539 | !property_exists($this, $var) |
| 540 | 540 | || !method_exists($this, $method) |
| 541 | 541 | ) { |
| 542 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
| 542 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
| 543 | 543 | return; |
| 544 | 544 | } else { |
| 545 | 545 | return $this->$method(); |
@@ -572,12 +572,12 @@ discard block |
||
| 572 | 572 | */ |
| 573 | 573 | public function __set($var, $value) |
| 574 | 574 | { |
| 575 | - $method = '_set' . ucfirst($var); |
|
| 575 | + $method = '_set'.ucfirst($var); |
|
| 576 | 576 | if ( |
| 577 | 577 | !property_exists($this, $var) |
| 578 | 578 | || !method_exists($this, $method) |
| 579 | 579 | ) { |
| 580 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
| 580 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
| 581 | 581 | } else { |
| 582 | 582 | $this->$method($value); |
| 583 | 583 | } |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | 'scheme' => $this->config['scheme'], |
| 615 | 615 | 'host' => $this->config['host'], |
| 616 | 616 | 'port' => $this->config['port'], |
| 617 | - 'path' => '/' . $this->config['path'], |
|
| 617 | + 'path' => '/'.$this->config['path'], |
|
| 618 | 618 | 'core' => $core, |
| 619 | 619 | 'username' => $this->config['username'], |
| 620 | 620 | 'password' => $this->config['password'], |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $fileMimeType = $this->getFileMimeType($id); |
| 169 | 169 | $fileLocation = $this->getFileLocation($id); |
| 170 | 170 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
| 171 | - $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation . 'info.json' : $fileLocation . '/info.json'); |
|
| 171 | + $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation.'info.json' : $fileLocation.'/info.json'); |
|
| 172 | 172 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 173 | 173 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 174 | 174 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -178,9 +178,9 @@ discard block |
||
| 178 | 178 | return $service->getImageUrl(); |
| 179 | 179 | } |
| 180 | 180 | } elseif ($fileMimeType === 'application/vnd.netfpx') { |
| 181 | - $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : ''); |
|
| 181 | + $baseURL = $fileLocation.(strpos($fileLocation, '?') === false ? '?' : ''); |
|
| 182 | 182 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
| 183 | - return $baseURL . '&CVT=jpeg'; |
|
| 183 | + return $baseURL.'&CVT=jpeg'; |
|
| 184 | 184 | } |
| 185 | 185 | return $fileLocation; |
| 186 | 186 | } |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function getFileLocation($id) |
| 193 | 193 | { |
| 194 | - $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
| 194 | + $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
| 195 | 195 | if ( |
| 196 | 196 | !empty($id) |
| 197 | 197 | && !empty($location) |
| 198 | 198 | ) { |
| 199 | 199 | return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 200 | 200 | } else { |
| 201 | - $this->logger->warning('There is no file node with @ID "' . $id . '"'); |
|
| 201 | + $this->logger->warning('There is no file node with @ID "'.$id.'"'); |
|
| 202 | 202 | return ''; |
| 203 | 203 | } |
| 204 | 204 | } |
@@ -209,14 +209,14 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function getFileMimeType($id) |
| 211 | 211 | { |
| 212 | - $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
|
| 212 | + $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'); |
|
| 213 | 213 | if ( |
| 214 | 214 | !empty($id) |
| 215 | 215 | && !empty($mimetype) |
| 216 | 216 | ) { |
| 217 | 217 | return (string) $mimetype[0]; |
| 218 | 218 | } else { |
| 219 | - $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified'); |
|
| 219 | + $this->logger->warning('There is no file node with @ID "'.$id.'" or no MIME type specified'); |
|
| 220 | 220 | return ''; |
| 221 | 221 | } |
| 222 | 222 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | return $this->logicalUnits[$id]; |
| 238 | 238 | } elseif (!empty($id)) { |
| 239 | 239 | // Get specified logical unit. |
| 240 | - $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]'); |
|
| 240 | + $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]'); |
|
| 241 | 241 | } else { |
| 242 | 242 | // Get all logical units at top level. |
| 243 | 243 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | // Retain current PID. |
| 378 | 378 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 379 | 379 | } elseif (!$cPid) { |
| 380 | - $this->logger->warning('Invalid PID ' . $cPid . ' for metadata definitions'); |
|
| 380 | + $this->logger->warning('Invalid PID '.$cPid.' for metadata definitions'); |
|
| 381 | 381 | return []; |
| 382 | 382 | } |
| 383 | 383 | // Get metadata from parsed metadata array if available. |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | if (!empty($this->logicalUnits[$id])) { |
| 419 | 419 | $dmdIds = $this->logicalUnits[$id]['dmdId']; |
| 420 | 420 | } else { |
| 421 | - $dmdIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@DMDID'); |
|
| 421 | + $dmdIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@DMDID'); |
|
| 422 | 422 | $dmdIds = (string) $dmdIds[0]; |
| 423 | 423 | } |
| 424 | 424 | if (!empty($dmdIds)) { |
@@ -444,11 +444,11 @@ discard block |
||
| 444 | 444 | ) { |
| 445 | 445 | $obj->extractMetadata($this->dmdSec[$dmdId]['xml'], $metadata); |
| 446 | 446 | } else { |
| 447 | - $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->dmdSec[$dmdId]['type'] . '"'); |
|
| 447 | + $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->dmdSec[$dmdId]['type'].'"'); |
|
| 448 | 448 | } |
| 449 | 449 | } |
| 450 | 450 | } else { |
| 451 | - $this->logger->notice('Unsupported metadata format "' . $this->dmdSec[$dmdId]['type'] . '" in dmdSec with @ID "' . $dmdId . '"'); |
|
| 451 | + $this->logger->notice('Unsupported metadata format "'.$this->dmdSec[$dmdId]['type'].'" in dmdSec with @ID "'.$dmdId.'"'); |
|
| 452 | 452 | // Continue searching for supported metadata with next @DMDID. |
| 453 | 453 | continue; |
| 454 | 454 | } |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | if (!empty($this->logicalUnits[$id])) { |
| 457 | 457 | $metadata['type'] = [$this->logicalUnits[$id]['type']]; |
| 458 | 458 | } else { |
| 459 | - $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE'); |
|
| 459 | + $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
|
| 460 | 460 | if (!empty($struct)) { |
| 461 | 461 | $metadata['type'] = [(string) $struct[0]]; |
| 462 | 462 | } |
@@ -573,13 +573,13 @@ discard block |
||
| 573 | 573 | $values instanceof \DOMNodeList |
| 574 | 574 | && $values->length > 0 |
| 575 | 575 | ) { |
| 576 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 576 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 577 | 577 | } elseif (!($values instanceof \DOMNodeList)) { |
| 578 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values); |
|
| 578 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values); |
|
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
| 582 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 581 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
| 582 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 583 | 583 | } |
| 584 | 584 | } |
| 585 | 585 | } |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | if ($hasSupportedMetadata) { |
| 596 | 596 | return $metadata; |
| 597 | 597 | } else { |
| 598 | - $this->logger->warning('No supported metadata found for logical structure with @ID "' . $id . '"'); |
|
| 598 | + $this->logger->warning('No supported metadata found for logical structure with @ID "'.$id.'"'); |
|
| 599 | 599 | return []; |
| 600 | 600 | } |
| 601 | 601 | } |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | */ |
| 623 | 623 | public function getStructureDepth($logId) |
| 624 | 624 | { |
| 625 | - $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
|
| 625 | + $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'); |
|
| 626 | 626 | if (!empty($ancestors)) { |
| 627 | 627 | return count($ancestors); |
| 628 | 628 | } else { |
@@ -646,9 +646,9 @@ discard block |
||
| 646 | 646 | $this->registerNamespaces($this->mets); |
| 647 | 647 | } else { |
| 648 | 648 | if (!empty($location)) { |
| 649 | - $this->logger->error('No METS part found in document with location "' . $location . '".'); |
|
| 649 | + $this->logger->error('No METS part found in document with location "'.$location.'".'); |
|
| 650 | 650 | } else if (!empty($this->recordId)) { |
| 651 | - $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".'); |
|
| 651 | + $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".'); |
|
| 652 | 652 | } else { |
| 653 | 653 | $this->logger->error('No METS part found in current document.'); |
| 654 | 654 | } |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | return true; |
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | - $this->logger->error('Could not load XML file from "' . $location . '"'); |
|
| 673 | + $this->logger->error('Could not load XML file from "'.$location.'"'); |
|
| 674 | 674 | return false; |
| 675 | 675 | } |
| 676 | 676 | |
@@ -725,15 +725,15 @@ discard block |
||
| 725 | 725 | $dmdIds = $this->mets->xpath('./mets:dmdSec/@ID'); |
| 726 | 726 | if (!empty($dmdIds)) { |
| 727 | 727 | foreach ($dmdIds as $dmdId) { |
| 728 | - if ($type = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) { |
|
| 728 | + if ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) { |
|
| 729 | 729 | if (!empty($this->formats[(string) $type[0]])) { |
| 730 | 730 | $type = (string) $type[0]; |
| 731 | - $xml = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 731 | + $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 732 | 732 | } |
| 733 | - } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) { |
|
| 733 | + } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) { |
|
| 734 | 734 | if (!empty($this->formats[(string) $type[0]])) { |
| 735 | 735 | $type = (string) $type[0]; |
| 736 | - $xml = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 736 | + $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 737 | 737 | } |
| 738 | 738 | } |
| 739 | 739 | if (!empty($xml)) { |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | // Retain current PID. |
| 919 | 919 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 920 | 920 | if (!$cPid) { |
| 921 | - $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
|
| 921 | + $this->logger->error('Invalid PID '.$cPid.' for structure definitions'); |
|
| 922 | 922 | $this->thumbnailLoaded = true; |
| 923 | 923 | return $this->thumbnail; |
| 924 | 924 | } |
@@ -955,7 +955,7 @@ discard block |
||
| 955 | 955 | if (!empty($resArray['thumbnail'])) { |
| 956 | 956 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid); |
| 957 | 957 | // Check if this document has a structure element of the desired type. |
| 958 | - $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
|
| 958 | + $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID'); |
|
| 959 | 959 | if (!empty($strctIds)) { |
| 960 | 960 | $strctId = (string) $strctIds[0]; |
| 961 | 961 | } |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | } |
| 979 | 979 | } |
| 980 | 980 | } else { |
| 981 | - $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
|
| 981 | + $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database'); |
|
| 982 | 982 | } |
| 983 | 983 | $this->thumbnailLoaded = true; |
| 984 | 984 | } |
@@ -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 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $updateQuery = self::$solr->service->createUpdate(); |
| 331 | 331 | $solrDoc = $updateQuery->createDocument(); |
| 332 | 332 | // Create unique identifier from document's UID and unit's XML ID. |
| 333 | - $solrDoc->setField('id', $document->getUid() . $logicalUnit['id']); |
|
| 333 | + $solrDoc->setField('id', $document->getUid().$logicalUnit['id']); |
|
| 334 | 334 | $solrDoc->setField('uid', $document->getUid()); |
| 335 | 335 | $solrDoc->setField('pid', $document->getPid()); |
| 336 | 336 | if (MathUtility::canBeInterpretedAsInteger($logicalUnit['points'])) { |
@@ -371,11 +371,11 @@ discard block |
||
| 371 | 371 | $solrDoc->setField(self::getIndexFieldName($index_name, $document->getPid()), $data, self::$fields['fieldboost'][$index_name]); |
| 372 | 372 | if (in_array($index_name, self::$fields['sortables'])) { |
| 373 | 373 | // Add sortable fields to index. |
| 374 | - $solrDoc->setField($index_name . '_sorting', $metadata[$index_name . '_sorting'][0]); |
|
| 374 | + $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]); |
|
| 375 | 375 | } |
| 376 | 376 | if (in_array($index_name, self::$fields['facets'])) { |
| 377 | 377 | // Add facets to index. |
| 378 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
| 378 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
| 379 | 379 | } |
| 380 | 380 | if (in_array($index_name, self::$fields['autocomplete'])) { |
| 381 | 381 | $autocomplete = array_merge($autocomplete, $data); |
@@ -400,14 +400,14 @@ discard block |
||
| 400 | 400 | } catch (\Exception $e) { |
| 401 | 401 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 402 | 402 | Helper::addMessage( |
| 403 | - Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 403 | + Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($e->getMessage()), |
|
| 404 | 404 | Helper::getLanguageService()->getLL('flash.error'), |
| 405 | 405 | FlashMessage::ERROR, |
| 406 | 406 | true, |
| 407 | 407 | 'core.template.flashMessages' |
| 408 | 408 | ); |
| 409 | 409 | } |
| 410 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
| 410 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
| 411 | 411 | return false; |
| 412 | 412 | } |
| 413 | 413 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | $updateQuery = self::$solr->service->createUpdate(); |
| 448 | 448 | $solrDoc = $updateQuery->createDocument(); |
| 449 | 449 | // Create unique identifier from document's UID and unit's XML ID. |
| 450 | - $solrDoc->setField('id', $document->getUid() . $physicalUnit['id']); |
|
| 450 | + $solrDoc->setField('id', $document->getUid().$physicalUnit['id']); |
|
| 451 | 451 | $solrDoc->setField('uid', $document->getUid()); |
| 452 | 452 | $solrDoc->setField('pid', $document->getPid()); |
| 453 | 453 | $solrDoc->setField('page', $page); |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | // Add facets to index. |
| 486 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
| 486 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | } |
@@ -501,14 +501,14 @@ discard block |
||
| 501 | 501 | } catch (\Exception $e) { |
| 502 | 502 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 503 | 503 | Helper::addMessage( |
| 504 | - Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 504 | + Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($e->getMessage()), |
|
| 505 | 505 | Helper::getLanguageService()->getLL('flash.error'), |
| 506 | 506 | FlashMessage::ERROR, |
| 507 | 507 | true, |
| 508 | 508 | 'core.template.flashMessages' |
| 509 | 509 | ); |
| 510 | 510 | } |
| 511 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
| 511 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
| 512 | 512 | return false; |
| 513 | 513 | } |
| 514 | 514 | } |