@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function getDescription(): string |
| 56 | 56 | { |
| 57 | - return 'This wizard migrates existing front end plugins of the extension Kitodo.Presentation (dlf) to' . |
|
| 58 | - ' make use of the Extbase naming scheme. Therefore it updates the field values' . |
|
| 57 | + return 'This wizard migrates existing front end plugins of the extension Kitodo.Presentation (dlf) to'. |
|
| 58 | + ' make use of the Extbase naming scheme. Therefore it updates the field values'. |
|
| 59 | 59 | ' "pi_flexform" within the tt_content table'; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | foreach ($fields as $field) { |
| 171 | 171 | // change the index attribute if it doesn't start with 'settings.' yet |
| 172 | 172 | if (strpos($field['index'], 'settings.') === false) { |
| 173 | - $field['index'] = 'settings.' . $field['index']; |
|
| 173 | + $field['index'] = 'settings.'.$field['index']; |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | * Class MigrateSettings |
| 24 | 24 | * @internal |
| 25 | 25 | */ |
| 26 | -class MigrateSettings implements UpgradeWizardInterface |
|
| 27 | -{ |
|
| 26 | +class MigrateSettings implements UpgradeWizardInterface { |
|
| 28 | 27 | |
| 29 | 28 | /** |
| 30 | 29 | * Return the identifier for this wizard |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | // exit if at least one update statement is not successful |
| 99 | 99 | if (!((bool) $updateResult)) { |
| 100 | - return false; |
|
| 100 | + return FALSE; |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - return true; |
|
| 104 | + return TRUE; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function updateNecessary(): bool |
| 115 | 115 | { |
| 116 | - $oldSettingsFound = false; |
|
| 116 | + $oldSettingsFound = FALSE; |
|
| 117 | 117 | |
| 118 | 118 | $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tt_content'); |
| 119 | 119 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | // Update the found record sets |
| 132 | 132 | while ($record = $statement->fetch()) { |
| 133 | 133 | $oldSettingsFound = $this->checkForOldSettings($record['pi_flexform']); |
| 134 | - if ($oldSettingsFound === true) { |
|
| 134 | + if ($oldSettingsFound === TRUE) { |
|
| 135 | 135 | // We found at least one field to be updated --> break here |
| 136 | 136 | break; |
| 137 | 137 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | foreach ($fields as $field) { |
| 171 | 171 | // change the index attribute if it doesn't start with 'settings.' yet |
| 172 | - if (strpos($field['index'], 'settings.') === false) { |
|
| 172 | + if (strpos($field['index'], 'settings.') === FALSE) { |
|
| 173 | 173 | $field['index'] = 'settings.' . $field['index']; |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -172,9 +172,9 @@ discard block |
||
| 172 | 172 | $queryBuilder->createNamedParameter('', \PDO::PARAM_STR) |
| 173 | 173 | ), |
| 174 | 174 | $queryBuilder->expr()->comparison( |
| 175 | - 'CAST(CAST(' . $queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]) . ' AS DECIMAL) AS CHAR)', |
|
| 175 | + 'CAST(CAST('.$queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]).' AS DECIMAL) AS CHAR)', |
|
| 176 | 176 | ExpressionBuilder::NEQ, |
| 177 | - 'CAST(' . $queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]) . ' AS CHAR)' |
|
| 177 | + 'CAST('.$queryBuilder->quoteIdentifier($this->fieldsToMigrate[$table]).' AS CHAR)' |
|
| 178 | 178 | ) |
| 179 | 179 | ) |
| 180 | 180 | ->orderBy('uid') |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | } catch (DBALException $e) { |
| 189 | 189 | throw new \RuntimeException( |
| 190 | - 'Database query failed. Error was: ' . $e->getPrevious()->getMessage(), |
|
| 190 | + 'Database query failed. Error was: '.$e->getPrevious()->getMessage(), |
|
| 191 | 191 | 1511950673 |
| 192 | 192 | ); |
| 193 | 193 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
| 247 | 247 | |
| 248 | 248 | $fileUid = null; |
| 249 | - $sourcePath = Environment::getPublicPath() . '/' . $fieldItem; |
|
| 249 | + $sourcePath = Environment::getPublicPath().'/'.$fieldItem; |
|
| 250 | 250 | |
| 251 | 251 | // maybe the file was already moved, so check if the original file still exists |
| 252 | 252 | if (file_exists($sourcePath)) { |
@@ -153,8 +153,7 @@ discard block |
||
| 153 | 153 | * @return array|int |
| 154 | 154 | * @throws \RuntimeException |
| 155 | 155 | */ |
| 156 | - protected function getRecordsFromTable($countOnly = false) |
|
| 157 | - { |
|
| 156 | + protected function getRecordsFromTable($countOnly = false) { |
|
| 158 | 157 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
| 159 | 158 | $allResults = []; |
| 160 | 159 | $numResults = 0; |
@@ -234,8 +233,7 @@ discard block |
||
| 234 | 233 | * @param array $row |
| 235 | 234 | * @throws \Exception |
| 236 | 235 | */ |
| 237 | - protected function migrateField($table, $row) |
|
| 238 | - { |
|
| 236 | + protected function migrateField($table, $row) { |
|
| 239 | 237 | $fieldItem = trim($row[$this->fieldsToMigrate[$table]]); |
| 240 | 238 | |
| 241 | 239 | if (empty($fieldItem) || is_numeric($fieldItem)) { |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function updateNecessary(): bool |
| 99 | 99 | { |
| 100 | - $numRecords = $this->getRecordsFromTable(true); |
|
| 100 | + $numRecords = $this->getRecordsFromTable(TRUE); |
|
| 101 | 101 | if ($numRecords > 0) { |
| 102 | - return true; |
|
| 102 | + return TRUE; |
|
| 103 | 103 | } |
| 104 | - return false; |
|
| 104 | + return FALSE; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -131,15 +131,15 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function executeUpdate(): bool |
| 133 | 133 | { |
| 134 | - $result = true; |
|
| 134 | + $result = TRUE; |
|
| 135 | 135 | try { |
| 136 | - $numRecords = $this->getRecordsFromTable(true); |
|
| 136 | + $numRecords = $this->getRecordsFromTable(TRUE); |
|
| 137 | 137 | if ($numRecords > 0) { |
| 138 | 138 | $this->performUpdate(); |
| 139 | 139 | } |
| 140 | 140 | } catch (\Exception $e) { |
| 141 | 141 | // If something goes wrong, migrateField() logs an error |
| 142 | - $result = false; |
|
| 142 | + $result = FALSE; |
|
| 143 | 143 | } |
| 144 | 144 | return $result; |
| 145 | 145 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @return array|int |
| 154 | 154 | * @throws \RuntimeException |
| 155 | 155 | */ |
| 156 | - protected function getRecordsFromTable($countOnly = false) |
|
| 156 | + protected function getRecordsFromTable($countOnly = FALSE) |
|
| 157 | 157 | { |
| 158 | 158 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
| 159 | 159 | $allResults = []; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | ->orderBy('uid') |
| 181 | 181 | ->execute() |
| 182 | 182 | ->fetchAll(); |
| 183 | - if ($countOnly === true) { |
|
| 183 | + if ($countOnly === TRUE) { |
|
| 184 | 184 | $numResults += count($result); |
| 185 | 185 | } else { |
| 186 | 186 | $allResults[$table] = $result; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - if ($countOnly === true) { |
|
| 196 | + if ($countOnly === TRUE) { |
|
| 197 | 197 | return $numResults; |
| 198 | 198 | } else { |
| 199 | 199 | return $allResults; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | protected function performUpdate(): bool |
| 210 | 210 | { |
| 211 | - $result = true; |
|
| 211 | + $result = TRUE; |
|
| 212 | 212 | |
| 213 | 213 | try { |
| 214 | 214 | $storages = GeneralUtility::makeInstance(StorageRepository::class)->findAll(); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | } catch (\Exception $e) { |
| 224 | - $result = false; |
|
| 224 | + $result = FALSE; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | return $result; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $storageUid = (int) $this->storage->getUid(); |
| 246 | 246 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
| 247 | 247 | |
| 248 | - $fileUid = null; |
|
| 248 | + $fileUid = NULL; |
|
| 249 | 249 | $sourcePath = Environment::getPublicPath() . '/' . $fieldItem; |
| 250 | 250 | |
| 251 | 251 | // maybe the file was already moved, so check if the original file still exists |
@@ -19,13 +19,11 @@ |
||
| 19 | 19 | /** |
| 20 | 20 | * Add inline JavaScript code to footer * |
| 21 | 21 | */ |
| 22 | -class JsFooterViewHelper extends AbstractViewHelper |
|
| 23 | -{ |
|
| 22 | +class JsFooterViewHelper extends AbstractViewHelper { |
|
| 24 | 23 | /** |
| 25 | 24 | * Initialize arguments. |
| 26 | 25 | */ |
| 27 | - public function initializeArguments() |
|
| 28 | - { |
|
| 26 | + public function initializeArguments() { |
|
| 29 | 27 | parent::initializeArguments(); |
| 30 | 28 | $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', true); |
| 31 | 29 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | public function initializeArguments() |
| 28 | 28 | { |
| 29 | 29 | parent::initializeArguments(); |
| 30 | - $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', true); |
|
| 30 | + $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', TRUE); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | * @subpackage dlf |
| 27 | 27 | * @access public |
| 28 | 28 | */ |
| 29 | -class PageViewController extends AbstractController |
|
| 30 | -{ |
|
| 29 | +class PageViewController extends AbstractController { |
|
| 31 | 30 | /** |
| 32 | 31 | * Holds the controls to add to the map |
| 33 | 32 | * |
@@ -65,8 +64,7 @@ discard block |
||
| 65 | 64 | * |
| 66 | 65 | * @return void |
| 67 | 66 | */ |
| 68 | - public function mainAction() |
|
| 69 | - { |
|
| 67 | + public function mainAction() { |
|
| 70 | 68 | // Load current document. |
| 71 | 69 | $this->loadDocument($this->requestData); |
| 72 | 70 | if ( |
@@ -121,8 +119,7 @@ discard block |
||
| 121 | 119 | * |
| 122 | 120 | * @return array URL and MIME type of fulltext file |
| 123 | 121 | */ |
| 124 | - protected function getFulltext($page) |
|
| 125 | - { |
|
| 122 | + protected function getFulltext($page) { |
|
| 126 | 123 | $fulltext = []; |
| 127 | 124 | // Get fulltext link. |
| 128 | 125 | $fileGrpsFulltext = GeneralUtility::trimExplode(',', $this->extConf['fileGrpFulltext']); |
@@ -162,8 +159,7 @@ discard block |
||
| 162 | 159 | * |
| 163 | 160 | * @return void |
| 164 | 161 | */ |
| 165 | - protected function addViewerJS() |
|
| 166 | - { |
|
| 162 | + protected function addViewerJS() { |
|
| 167 | 163 | // Viewer configuration. |
| 168 | 164 | $viewerConfiguration = '$(document).ready(function() { |
| 169 | 165 | if (dlfUtils.exists(dlfViewer)) { |
@@ -189,8 +185,7 @@ discard block |
||
| 189 | 185 | * @return array An array containing the IRIs of the AnnotationLists / AnnotationPages as well as |
| 190 | 186 | * some information about the canvas. |
| 191 | 187 | */ |
| 192 | - protected function getAnnotationContainers($page) |
|
| 193 | - { |
|
| 188 | + protected function getAnnotationContainers($page) { |
|
| 194 | 189 | if ($this->document->getDoc() instanceof IiifManifest) { |
| 195 | 190 | $canvasId = $this->document->getDoc()->physicalStructure[$page]; |
| 196 | 191 | $iiif = $this->document->getDoc()->getIiif(); |
@@ -246,8 +241,7 @@ discard block |
||
| 246 | 241 | * |
| 247 | 242 | * @return array URL and MIME type of image file |
| 248 | 243 | */ |
| 249 | - protected function getImage($page) |
|
| 250 | - { |
|
| 244 | + protected function getImage($page) { |
|
| 251 | 245 | $image = []; |
| 252 | 246 | // Get @USE value of METS fileGrp. |
| 253 | 247 | $fileGrpsImages = GeneralUtility::trimExplode(',', $this->extConf['fileGrpImages']); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | // Load current document. |
| 71 | 71 | $this->loadDocument($this->requestData); |
| 72 | 72 | if ( |
| 73 | - $this->document === null |
|
| 73 | + $this->document === NULL |
|
| 74 | 74 | || $this->document->getDoc()->numPages < 1 |
| 75 | 75 | ) { |
| 76 | 76 | // Quit without doing anything if required variables are not set. |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | // Configure @action URL for form. |
| 134 | 134 | $uri = $this->uriBuilder->reset() |
| 135 | 135 | ->setTargetPageUid($GLOBALS['TSFE']->id) |
| 136 | - ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? true : false) |
|
| 136 | + ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE) |
|
| 137 | 137 | ->setArguments([ |
| 138 | 138 | 'eID' => 'tx_dlf_pageview_proxy', |
| 139 | 139 | 'url' => $fulltext['url'], |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | if ($iiif instanceof ManifestInterface) { |
| 198 | 198 | $canvas = $iiif->getContainedResourceById($canvasId); |
| 199 | 199 | /* @var $canvas \Ubl\Iiif\Presentation\Common\Model\Resources\CanvasInterface */ |
| 200 | - if ($canvas != null && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
| 200 | + if ($canvas != NULL && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
| 201 | 201 | $annotationContainers = []; |
| 202 | 202 | /* |
| 203 | 203 | * TODO Analyzing the annotations on the server side requires loading the annotation lists / pages |
@@ -207,11 +207,11 @@ discard block |
||
| 207 | 207 | * On the other hand, server connections are potentially better than client connections. Downloading annotation lists |
| 208 | 208 | */ |
| 209 | 209 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 210 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
| 210 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
| 211 | 211 | foreach ($textAnnotations as $annotation) { |
| 212 | 212 | if ( |
| 213 | 213 | $annotation->getBody()->getFormat() == 'text/plain' |
| 214 | - && $annotation->getBody()->getChars() != null |
|
| 214 | + && $annotation->getBody()->getChars() != NULL |
|
| 215 | 215 | ) { |
| 216 | 216 | $annotationListData = []; |
| 217 | 217 | $annotationListData['uri'] = $annotationContainer->getId(); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | // Configure @action URL for form. |
| 260 | 260 | $uri = $this->uriBuilder->reset() |
| 261 | 261 | ->setTargetPageUid($GLOBALS['TSFE']->id) |
| 262 | - ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? true : false) |
|
| 262 | + ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE) |
|
| 263 | 263 | ->setArguments([ |
| 264 | 264 | 'eID' => 'tx_dlf_pageview_proxy', |
| 265 | 265 | 'url' => $image['url'], |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | $fulltext['mimetype'] = $this->document->getDoc()->getFileMimeType($this->document->getDoc()->physicalStructureInfo[$this->document->getDoc()->physicalStructure[$page]]['files'][$fileGrpFulltext]); |
| 147 | 147 | break; |
| 148 | 148 | } else { |
| 149 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrp "' . $fileGrpFulltext . '"'); |
|
| 149 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrp "'.$fileGrpFulltext.'"'); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | if (empty($fulltext)) { |
| 153 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrps "' . $this->extConf['fileGrpFulltext'] . '"'); |
|
| 153 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrps "'.$this->extConf['fileGrpFulltext'].'"'); |
|
| 154 | 154 | } |
| 155 | 155 | return $fulltext; |
| 156 | 156 | } |
@@ -168,13 +168,13 @@ discard block |
||
| 168 | 168 | $viewerConfiguration = '$(document).ready(function() { |
| 169 | 169 | if (dlfUtils.exists(dlfViewer)) { |
| 170 | 170 | tx_dlf_viewer = new dlfViewer({ |
| 171 | - controls: ["' . implode('", "', $this->controls) . '"], |
|
| 172 | - div: "' . $this->settings['elementId'] . '", |
|
| 173 | - progressElementId: "' . $this->settings['progressElementId'] . '", |
|
| 174 | - images: ' . json_encode($this->images) . ', |
|
| 175 | - fulltexts: ' . json_encode($this->fulltexts) . ', |
|
| 176 | - annotationContainers: ' . json_encode($this->annotationContainers) . ', |
|
| 177 | - useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0) . ' |
|
| 171 | + controls: ["' . implode('", "', $this->controls).'"], |
|
| 172 | + div: "' . $this->settings['elementId'].'", |
|
| 173 | + progressElementId: "' . $this->settings['progressElementId'].'", |
|
| 174 | + images: ' . json_encode($this->images).', |
|
| 175 | + fulltexts: ' . json_encode($this->fulltexts).', |
|
| 176 | + annotationContainers: ' . json_encode($this->annotationContainers).', |
|
| 177 | + useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0).' |
|
| 178 | 178 | }); |
| 179 | 179 | } |
| 180 | 180 | });'; |
@@ -275,11 +275,11 @@ discard block |
||
| 275 | 275 | } |
| 276 | 276 | break; |
| 277 | 277 | } else { |
| 278 | - $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"'); |
|
| 278 | + $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"'); |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | if (empty($image)) { |
| 282 | - $this->logger->warning('No image file found for page "' . $page . '" in fileGrps "' . $this->extConf['fileGrpImages'] . '"'); |
|
| 282 | + $this->logger->warning('No image file found for page "'.$page.'" in fileGrps "'.$this->extConf['fileGrpImages'].'"'); |
|
| 283 | 283 | } |
| 284 | 284 | return $image; |
| 285 | 285 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | // Add uHash parameter to suggest parameter to make a basic protection of this form. |
| 163 | 163 | if ($this->settings['suggest']) { |
| 164 | - $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()) . Environment::getExtensionsPath(), 'SearchSuggest')); |
|
| 164 | + $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()).Environment::getExtensionsPath(), 'SearchSuggest')); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $this->view->assign('viewData', $this->viewData); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | // Get facets from plugin configuration. |
| 185 | 185 | $facets = []; |
| 186 | 186 | foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
| 187 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
| 187 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $this->view->assign('facetsMenu', $this->makeFacetsMenuArray($facets)); |
@@ -226,13 +226,13 @@ discard block |
||
| 226 | 226 | $searchParams = $this->searchParams; |
| 227 | 227 | if ( |
| 228 | 228 | (!empty($searchParams['fulltext'])) |
| 229 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches) |
|
| 229 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches) |
|
| 230 | 230 | ) { |
| 231 | 231 | // If the query already is a fulltext query e.g using the facets |
| 232 | 232 | $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1]; |
| 233 | 233 | // Search in fulltext field if applicable. Query must not be empty! |
| 234 | 234 | if (!empty($this->searchParams['query'])) { |
| 235 | - $search['query'] = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')'; |
|
| 235 | + $search['query'] = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')'; |
|
| 236 | 236 | } |
| 237 | 237 | } else { |
| 238 | 238 | // Retain given search field if valid. |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | in_array($searchParams['extOperator'][$i], $allowedOperators) |
| 257 | 257 | ) { |
| 258 | 258 | if (!empty($search['query'])) { |
| 259 | - $search['query'] .= ' ' . $searchParams['extOperator'][$i] . ' '; |
|
| 259 | + $search['query'] .= ' '.$searchParams['extOperator'][$i].' '; |
|
| 260 | 260 | } |
| 261 | - $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')'; |
|
| 261 | + $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')'; |
|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | $entryArray['doNotLinkIt'] = 0; |
| 384 | 384 | // Check if facet is already selected. |
| 385 | 385 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
| 386 | - $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
|
| 386 | + $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn); |
|
| 387 | 387 | if ($index !== false) { |
| 388 | 388 | // Facet is selected, thus remove it from filter. |
| 389 | 389 | unset($queryColumn[$index]); |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | } |
| 398 | 398 | } else { |
| 399 | 399 | // Facet is not selected, thus add it to filter. |
| 400 | - $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")'; |
|
| 400 | + $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")'; |
|
| 401 | 401 | $entryArray['ITEM_STATE'] = 'NO'; |
| 402 | 402 | } |
| 403 | 403 | $entryArray['queryColumn'] = $queryColumn; |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | * @subpackage dlf |
| 33 | 33 | * @access public |
| 34 | 34 | */ |
| 35 | -class SearchController extends AbstractController |
|
| 36 | -{ |
|
| 35 | +class SearchController extends AbstractController { |
|
| 37 | 36 | /** |
| 38 | 37 | * @var CollectionRepository |
| 39 | 38 | */ |
@@ -42,8 +41,7 @@ discard block |
||
| 42 | 41 | /** |
| 43 | 42 | * @param CollectionRepository $collectionRepository |
| 44 | 43 | */ |
| 45 | - public function injectCollectionRepository(CollectionRepository $collectionRepository) |
|
| 46 | - { |
|
| 44 | + public function injectCollectionRepository(CollectionRepository $collectionRepository) { |
|
| 47 | 45 | $this->collectionRepository = $collectionRepository; |
| 48 | 46 | } |
| 49 | 47 | |
@@ -55,8 +53,7 @@ discard block |
||
| 55 | 53 | /** |
| 56 | 54 | * @param MetadataRepository $metadataRepository |
| 57 | 55 | */ |
| 58 | - public function injectMetadataRepository(MetadataRepository $metadataRepository) |
|
| 59 | - { |
|
| 56 | + public function injectMetadataRepository(MetadataRepository $metadataRepository) { |
|
| 60 | 57 | $this->metadataRepository = $metadataRepository; |
| 61 | 58 | } |
| 62 | 59 | |
@@ -71,8 +68,7 @@ discard block |
||
| 71 | 68 | * |
| 72 | 69 | * @return void |
| 73 | 70 | */ |
| 74 | - public function searchAction() |
|
| 75 | - { |
|
| 71 | + public function searchAction() { |
|
| 76 | 72 | // if search was triggered, get search parameters from POST variables |
| 77 | 73 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
| 78 | 74 | |
@@ -87,8 +83,7 @@ discard block |
||
| 87 | 83 | * |
| 88 | 84 | * @return void |
| 89 | 85 | */ |
| 90 | - public function mainAction() |
|
| 91 | - { |
|
| 86 | + public function mainAction() { |
|
| 92 | 87 | $listViewSearch = false; |
| 93 | 88 | // Quit without doing anything if required variables are not set. |
| 94 | 89 | if (empty($this->settings['solrcore'])) { |
@@ -174,8 +169,7 @@ discard block |
||
| 174 | 169 | * |
| 175 | 170 | * @return string HTML output of facets menu |
| 176 | 171 | */ |
| 177 | - protected function addFacetsMenu() |
|
| 178 | - { |
|
| 172 | + protected function addFacetsMenu() { |
|
| 179 | 173 | // Quit without doing anything if no facets are configured. |
| 180 | 174 | if (empty($this->settings['facets']) && empty($this->settings['facetCollections'])) { |
| 181 | 175 | return ''; |
@@ -200,8 +194,7 @@ discard block |
||
| 200 | 194 | * |
| 201 | 195 | * @return array HMENU array |
| 202 | 196 | */ |
| 203 | - public function makeFacetsMenuArray($facets) |
|
| 204 | - { |
|
| 197 | + public function makeFacetsMenuArray($facets) { |
|
| 205 | 198 | $menuArray = []; |
| 206 | 199 | // Set default value for facet search. |
| 207 | 200 | $search = [ |
@@ -360,8 +353,7 @@ discard block |
||
| 360 | 353 | * |
| 361 | 354 | * @return array The array for the facet's menu entry |
| 362 | 355 | */ |
| 363 | - protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) |
|
| 364 | - { |
|
| 356 | + protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
| 365 | 357 | $entryArray = []; |
| 366 | 358 | // Translate value. |
| 367 | 359 | if ($field == 'owner_faceting') { |
@@ -412,8 +404,7 @@ discard block |
||
| 412 | 404 | * |
| 413 | 405 | * @return string The extended search form or an empty string |
| 414 | 406 | */ |
| 415 | - protected function addExtendedSearch() |
|
| 416 | - { |
|
| 407 | + protected function addExtendedSearch() { |
|
| 417 | 408 | // Quit without doing anything if no fields for extended search are selected. |
| 418 | 409 | if ( |
| 419 | 410 | empty($this->settings['extendedSlotCount']) |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
| 78 | 78 | |
| 79 | 79 | // output is done by main action |
| 80 | - $this->forward('main', null, null, ['searchParameter' => $this->searchParams]); |
|
| 80 | + $this->forward('main', NULL, NULL, ['searchParameter' => $this->searchParams]); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function mainAction() |
| 91 | 91 | { |
| 92 | - $listViewSearch = false; |
|
| 92 | + $listViewSearch = FALSE; |
|
| 93 | 93 | // Quit without doing anything if required variables are not set. |
| 94 | 94 | if (empty($this->settings['solrcore'])) { |
| 95 | 95 | $this->logger->warning('Incomplete plugin configuration'); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | if (isset($listRequestData['searchParameter']) && is_array($listRequestData['searchParameter'])) { |
| 105 | 105 | $this->searchParams = array_merge($this->searchParams ? : [], $listRequestData['searchParameter']); |
| 106 | - $listViewSearch = true; |
|
| 106 | + $listViewSearch = TRUE; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // Pagination of Results: Pass the currentPage to the fluid template to calculate current index of search result. |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | // If a targetPid is given, the results will be shown by ListView on the target page. |
| 116 | 116 | if (!empty($this->settings['targetPid']) && !empty($this->searchParams) && !$listViewSearch) { |
| 117 | - $this->redirect('main', 'ListView', null, |
|
| 117 | + $this->redirect('main', 'ListView', NULL, |
|
| 118 | 118 | [ |
| 119 | 119 | 'searchParameter' => $this->searchParams, |
| 120 | 120 | 'widgetPage' => $widgetPage |
@@ -125,16 +125,16 @@ discard block |
||
| 125 | 125 | // If no search has been executed, no variables habe to be prepared. An empty form will be shown. |
| 126 | 126 | if (is_array($this->searchParams) && !empty($this->searchParams)) { |
| 127 | 127 | // get all sortable metadata records |
| 128 | - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); |
|
| 128 | + $sortableMetadata = $this->metadataRepository->findByIsSortable(TRUE); |
|
| 129 | 129 | |
| 130 | 130 | // get all metadata records to be shown in results |
| 131 | - $listedMetadata = $this->metadataRepository->findByIsListed(true); |
|
| 131 | + $listedMetadata = $this->metadataRepository->findByIsListed(TRUE); |
|
| 132 | 132 | |
| 133 | 133 | $solrResults = []; |
| 134 | 134 | $numResults = 0; |
| 135 | 135 | // Do not execute the Solr search if used together with ListView plugin. |
| 136 | 136 | if (!$listViewSearch) { |
| 137 | - $solrResults = $this->documentRepository->findSolrByCollection(null, $this->settings, $this->searchParams, $listedMetadata); |
|
| 137 | + $solrResults = $this->documentRepository->findSolrByCollection(NULL, $this->settings, $this->searchParams, $listedMetadata); |
|
| 138 | 138 | $numResults = $solrResults->getNumFound(); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | // Get facets from plugin configuration. |
| 185 | 185 | $facets = []; |
| 186 | - foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
|
| 186 | + foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], TRUE) as $facet) { |
|
| 187 | 187 | $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | // Check if facet is already selected. |
| 385 | 385 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
| 386 | 386 | $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
| 387 | - if ($index !== false) { |
|
| 387 | + if ($index !== FALSE) { |
|
| 388 | 388 | // Facet is selected, thus remove it from filter. |
| 389 | 389 | unset($queryColumn[$index]); |
| 390 | 390 | $queryColumn = array_values($queryColumn); |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $state = 'ACTIFSUB'; |
| 393 | 393 | // Reset facets |
| 394 | 394 | if ($this->settings['resetFacets']) { |
| 395 | - $entryArray['resetFacet'] = true; |
|
| 395 | + $entryArray['resetFacet'] = TRUE; |
|
| 396 | 396 | $entryArray['queryColumn'] = $queryColumn; |
| 397 | 397 | } |
| 398 | 398 | } else { |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | // Get field selector options. |
| 426 | - $searchFields = GeneralUtility::trimExplode(',', $this->settings['extendedFields'], true); |
|
| 426 | + $searchFields = GeneralUtility::trimExplode(',', $this->settings['extendedFields'], TRUE); |
|
| 427 | 427 | |
| 428 | 428 | $slotCountArray = []; |
| 429 | 429 | for ($i = 0; $i < $this->settings['extendedSlotCount']; $i++) { |
@@ -5,10 +5,8 @@ |
||
| 5 | 5 | use Kitodo\Dlf\Common\Helper; |
| 6 | 6 | use TYPO3\TestingFramework\Core\Unit\UnitTestCase; |
| 7 | 7 | |
| 8 | -class HelperTest extends UnitTestCase |
|
| 9 | -{ |
|
| 10 | - public function assertInvalidXml($xml) |
|
| 11 | - { |
|
| 8 | +class HelperTest extends UnitTestCase { |
|
| 9 | + public function assertInvalidXml($xml) { |
|
| 12 | 10 | $result = Helper::getXmlFileAsString($xml); |
| 13 | 11 | $this->assertEquals(false, $result); |
| 14 | 12 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | public function assertInvalidXml($xml) |
| 11 | 11 | { |
| 12 | 12 | $result = Helper::getXmlFileAsString($xml); |
| 13 | - $this->assertEquals(false, $result); |
|
| 13 | + $this->assertEquals(FALSE, $result); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function invalidXmlYieldsFalse(): void |
| 21 | 21 | { |
| 22 | - $this->assertInvalidXml(false); |
|
| 23 | - $this->assertInvalidXml(null); |
|
| 22 | + $this->assertInvalidXml(FALSE); |
|
| 23 | + $this->assertInvalidXml(NULL); |
|
| 24 | 24 | $this->assertInvalidXml(1); |
| 25 | 25 | $this->assertInvalidXml([]); |
| 26 | 26 | $this->assertInvalidXml(new \stdClass()); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | <root> |
| 41 | 41 | <single /> |
| 42 | 42 | </root> |
| 43 | -XML; |
|
| 43 | +xml; |
|
| 44 | 44 | $node = Helper::getXmlFileAsString($xml); |
| 45 | 45 | $this->assertIsObject($node); |
| 46 | 46 | $this->assertEquals('root', $node->getName()); |
@@ -15,10 +15,10 @@ |
||
| 15 | 15 | preg_match("@.*/(?:acceptance|functional-[a-z0-9]+)@", $_SERVER['REQUEST_URI'], $matches); |
| 16 | 16 | |
| 17 | 17 | if (!empty($matches)) { |
| 18 | - $root = realpath($_SERVER['DOCUMENT_ROOT'] . $matches[0]); |
|
| 18 | + $root = realpath($_SERVER['DOCUMENT_ROOT'].$matches[0]); |
|
| 19 | 19 | if ($root !== false) { |
| 20 | - putenv('TYPO3_PATH_ROOT=' . $root); |
|
| 21 | - putenv('TYPO3_PATH_APP=' . $root); |
|
| 20 | + putenv('TYPO3_PATH_ROOT='.$root); |
|
| 21 | + putenv('TYPO3_PATH_APP='.$root); |
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
@@ -16,10 +16,10 @@ |
||
| 16 | 16 | |
| 17 | 17 | if (!empty($matches)) { |
| 18 | 18 | $root = realpath($_SERVER['DOCUMENT_ROOT'] . $matches[0]); |
| 19 | - if ($root !== false) { |
|
| 19 | + if ($root !== FALSE) { |
|
| 20 | 20 | putenv('TYPO3_PATH_ROOT=' . $root); |
| 21 | 21 | putenv('TYPO3_PATH_APP=' . $root); |
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -return false; |
|
| 25 | +return FALSE; |
|
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | ]); |
| 78 | 78 | |
| 79 | 79 | $this->assertEquals(200, $response->getStatusCode()); |
| 80 | - $this->assertEquals('This is some plain text test file.' . "\n", (string) $response->getBody()); |
|
| 80 | + $this->assertEquals('This is some plain text test file.'."\n", (string) $response->getBody()); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -6,19 +6,16 @@ |
||
| 6 | 6 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
| 7 | 7 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
| 8 | 8 | |
| 9 | -class PageViewProxyTest extends FunctionalTestCase |
|
| 10 | -{ |
|
| 9 | +class PageViewProxyTest extends FunctionalTestCase { |
|
| 11 | 10 | protected $disableJsonWrappedResponse = true; |
| 12 | 11 | |
| 13 | - protected function getDlfConfiguration() |
|
| 14 | - { |
|
| 12 | + protected function getDlfConfiguration() { |
|
| 15 | 13 | return array_merge(parent::getDlfConfiguration(), [ |
| 16 | 14 | 'enableInternalProxy' => true, |
| 17 | 15 | ]); |
| 18 | 16 | } |
| 19 | 17 | |
| 20 | - protected function queryProxy(array $query, string $method = 'GET') |
|
| 21 | - { |
|
| 18 | + protected function queryProxy(array $query, string $method = 'GET') { |
|
| 22 | 19 | $query['eID'] = 'tx_dlf_pageview_proxy'; |
| 23 | 20 | |
| 24 | 21 | return $this->httpClient->request($method, '', [ |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageViewProxyTest extends FunctionalTestCase |
| 10 | 10 | { |
| 11 | - protected $disableJsonWrappedResponse = true; |
|
| 11 | + protected $disableJsonWrappedResponse = TRUE; |
|
| 12 | 12 | |
| 13 | 13 | protected function getDlfConfiguration() |
| 14 | 14 | { |
| 15 | 15 | return array_merge(parent::getDlfConfiguration(), [ |
| 16 | - 'enableInternalProxy' => true, |
|
| 16 | + 'enableInternalProxy' => TRUE, |
|
| 17 | 17 | ]); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -5,12 +5,10 @@ |
||
| 5 | 5 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
| 6 | 6 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
| 7 | 7 | |
| 8 | -class PageViewProxyDisabledTest extends FunctionalTestCase |
|
| 9 | -{ |
|
| 8 | +class PageViewProxyDisabledTest extends FunctionalTestCase { |
|
| 10 | 9 | protected $disableJsonWrappedResponse = true; |
| 11 | 10 | |
| 12 | - protected function queryProxy(array $query, string $method = 'GET') |
|
| 13 | - { |
|
| 11 | + protected function queryProxy(array $query, string $method = 'GET') { |
|
| 14 | 12 | $query['eID'] = 'tx_dlf_pageview_proxy'; |
| 15 | 13 | |
| 16 | 14 | return $this->httpClient->request($method, '', [ |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | |
| 8 | 8 | class PageViewProxyDisabledTest extends FunctionalTestCase |
| 9 | 9 | { |
| 10 | - protected $disableJsonWrappedResponse = true; |
|
| 10 | + protected $disableJsonWrappedResponse = TRUE; |
|
| 11 | 11 | |
| 12 | 12 | protected function queryProxy(array $query, string $method = 'GET') |
| 13 | 13 | { |