@@ -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 | } |
@@ -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']) |
@@ -107,13 +107,13 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // sanitize date search input |
| 110 | - if(empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) { |
|
| 110 | + if (empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) { |
|
| 111 | 111 | $this->searchParams['dateFrom'] = '*'; |
| 112 | 112 | } |
| 113 | - if(empty($this->searchParams['dateTo']) && !empty($this->searchParams['dateFrom'])) { |
|
| 113 | + if (empty($this->searchParams['dateTo']) && !empty($this->searchParams['dateFrom'])) { |
|
| 114 | 114 | $this->searchParams['dateTo'] = 'NOW'; |
| 115 | 115 | } |
| 116 | - if($this->searchParams['dateFrom'] > $this->searchParams['dateTo']) { |
|
| 116 | + if ($this->searchParams['dateFrom'] > $this->searchParams['dateTo']) { |
|
| 117 | 117 | $tmpDate = $this->searchParams['dateFrom']; |
| 118 | 118 | $this->searchParams['dateFrom'] = $this->searchParams['dateTo']; |
| 119 | 119 | $this->searchParams['dateTo'] = $tmpDate; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | // Add uHash parameter to suggest parameter to make a basic protection of this form. |
| 176 | 176 | if ($this->settings['suggest']) { |
| 177 | - $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()) . Environment::getExtensionsPath(), 'SearchSuggest')); |
|
| 177 | + $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()).Environment::getExtensionsPath(), 'SearchSuggest')); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $this->view->assign('viewData', $this->viewData); |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | // Get facets from plugin configuration. |
| 198 | 198 | $facets = []; |
| 199 | 199 | foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
| 200 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
| 200 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | $this->view->assign('facetsMenu', $this->makeFacetsMenuArray($facets)); |
@@ -239,13 +239,13 @@ discard block |
||
| 239 | 239 | $searchParams = $this->searchParams; |
| 240 | 240 | if ( |
| 241 | 241 | (!empty($searchParams['fulltext'])) |
| 242 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches) |
|
| 242 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches) |
|
| 243 | 243 | ) { |
| 244 | 244 | // If the query already is a fulltext query e.g using the facets |
| 245 | 245 | $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1]; |
| 246 | 246 | // Search in fulltext field if applicable. Query must not be empty! |
| 247 | 247 | if (!empty($this->searchParams['query'])) { |
| 248 | - $search['query'] = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')'; |
|
| 248 | + $search['query'] = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')'; |
|
| 249 | 249 | } |
| 250 | 250 | } else { |
| 251 | 251 | // Retain given search field if valid. |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | // add filter query for date search |
| 258 | 258 | if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) { |
| 259 | 259 | // combine dateFrom and dateTo into filterquery as range search |
| 260 | - $search['params']['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}' . $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']'; |
|
| 260 | + $search['params']['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']'; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // Add extended search query. |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | in_array($searchParams['extOperator'][$i], $allowedOperators) |
| 276 | 276 | ) { |
| 277 | 277 | if (!empty($search['query'])) { |
| 278 | - $search['query'] .= ' ' . $searchParams['extOperator'][$i] . ' '; |
|
| 278 | + $search['query'] .= ' '.$searchParams['extOperator'][$i].' '; |
|
| 279 | 279 | } |
| 280 | - $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')'; |
|
| 280 | + $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')'; |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | } |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | $entryArray['doNotLinkIt'] = 0; |
| 404 | 404 | // Check if facet is already selected. |
| 405 | 405 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
| 406 | - $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
|
| 406 | + $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn); |
|
| 407 | 407 | if ($index !== false) { |
| 408 | 408 | // Facet is selected, thus remove it from filter. |
| 409 | 409 | unset($queryColumn[$index]); |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | } |
| 418 | 418 | } else { |
| 419 | 419 | // Facet is not selected, thus add it to filter. |
| 420 | - $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")'; |
|
| 420 | + $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")'; |
|
| 421 | 421 | $entryArray['ITEM_STATE'] = 'NO'; |
| 422 | 422 | } |
| 423 | 423 | $entryArray['queryColumn'] = $queryColumn; |
@@ -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 | $GLOBALS['TSFE']->fe_user->setKey('ses', 'search', $this->searchParams); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | // If a targetPid is given, the results will be shown by ListView on the target page. |
| 130 | 130 | if (!empty($this->settings['targetPid']) && !empty($this->searchParams) && !$listViewSearch) { |
| 131 | - $this->redirect('main', 'ListView', null, |
|
| 131 | + $this->redirect('main', 'ListView', NULL, |
|
| 132 | 132 | [ |
| 133 | 133 | 'searchParameter' => $this->searchParams, |
| 134 | 134 | 'widgetPage' => $widgetPage |
@@ -139,16 +139,16 @@ discard block |
||
| 139 | 139 | // If no search has been executed, no variables habe to be prepared. An empty form will be shown. |
| 140 | 140 | if (is_array($this->searchParams) && !empty($this->searchParams)) { |
| 141 | 141 | // get all sortable metadata records |
| 142 | - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); |
|
| 142 | + $sortableMetadata = $this->metadataRepository->findByIsSortable(TRUE); |
|
| 143 | 143 | |
| 144 | 144 | // get all metadata records to be shown in results |
| 145 | - $listedMetadata = $this->metadataRepository->findByIsListed(true); |
|
| 145 | + $listedMetadata = $this->metadataRepository->findByIsListed(TRUE); |
|
| 146 | 146 | |
| 147 | 147 | $solrResults = []; |
| 148 | 148 | $numResults = 0; |
| 149 | 149 | // Do not execute the Solr search if used together with ListView plugin. |
| 150 | 150 | if (!$listViewSearch) { |
| 151 | - $solrResults = $this->documentRepository->findSolrByCollection(null, $this->settings, $this->searchParams, $listedMetadata); |
|
| 151 | + $solrResults = $this->documentRepository->findSolrByCollection(NULL, $this->settings, $this->searchParams, $listedMetadata); |
|
| 152 | 152 | $numResults = $solrResults->getNumFound(); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | // Get facets from plugin configuration. |
| 199 | 199 | $facets = []; |
| 200 | - foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
|
| 200 | + foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], TRUE) as $facet) { |
|
| 201 | 201 | $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
| 202 | 202 | } |
| 203 | 203 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | // Check if facet is already selected. |
| 406 | 406 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
| 407 | 407 | $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
| 408 | - if ($index !== false) { |
|
| 408 | + if ($index !== FALSE) { |
|
| 409 | 409 | // Facet is selected, thus remove it from filter. |
| 410 | 410 | unset($queryColumn[$index]); |
| 411 | 411 | $queryColumn = array_values($queryColumn); |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $state = 'ACTIFSUB'; |
| 414 | 414 | // Reset facets |
| 415 | 415 | if ($this->settings['resetFacets']) { |
| 416 | - $entryArray['resetFacet'] = true; |
|
| 416 | + $entryArray['resetFacet'] = TRUE; |
|
| 417 | 417 | $entryArray['queryColumn'] = $queryColumn; |
| 418 | 418 | } |
| 419 | 419 | } else { |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | // Get field selector options. |
| 447 | - $searchFields = GeneralUtility::trimExplode(',', $this->settings['extendedFields'], true); |
|
| 447 | + $searchFields = GeneralUtility::trimExplode(',', $this->settings['extendedFields'], TRUE); |
|
| 448 | 448 | |
| 449 | 449 | $slotCountArray = []; |
| 450 | 450 | 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()); |
@@ -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; |
|
@@ -15,10 +15,10 @@ |
||
| 15 | 15 | preg_match("@.*/(?:acceptance|functional-[a-z\d]+)@", $_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 | |
@@ -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 | { |
@@ -21,9 +21,9 @@ |
||
| 21 | 21 | |
| 22 | 22 | $this->documentRepository = $this->initializeRepository(DocumentRepository::class, 20000); |
| 23 | 23 | |
| 24 | - $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.xml'); |
|
| 25 | - $this->importDataSet(__DIR__ . '/../../Fixtures/Common/pages.xml'); |
|
| 26 | - $this->importDataSet(__DIR__ . '/../../Fixtures/Common/libraries.xml'); |
|
| 24 | + $this->importDataSet(__DIR__.'/../../Fixtures/Common/documents_1.xml'); |
|
| 25 | + $this->importDataSet(__DIR__.'/../../Fixtures/Common/pages.xml'); |
|
| 26 | + $this->importDataSet(__DIR__.'/../../Fixtures/Common/libraries.xml'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -8,8 +8,7 @@ |
||
| 8 | 8 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
| 9 | 9 | use TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage; |
| 10 | 10 | |
| 11 | -class DocumentRepositoryTest extends FunctionalTestCase |
|
| 12 | -{ |
|
| 11 | +class DocumentRepositoryTest extends FunctionalTestCase { |
|
| 13 | 12 | /** |
| 14 | 13 | * @var DocumentRepository |
| 15 | 14 | */ |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | // There may be a single non-signifying space after the doc-comment asterisk, |
| 185 | 185 | // which is not included. |
| 186 | - $text .= preg_replace('#\\s*/?[*/]*\\s?(.*)$#', '$1', $line) . "\n"; |
|
| 186 | + $text .= preg_replace('#\\s*/?[*/]*\\s?(.*)$#', '$1', $line)."\n"; |
|
| 187 | 187 | } |
| 188 | 188 | $text = trim($text); |
| 189 | 189 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | RST); |
| 205 | 205 | |
| 206 | 206 | // Sort tables alphabetically |
| 207 | - usort($tables, function ($lhs, $rhs) { |
|
| 207 | + usort($tables, function($lhs, $rhs) { |
|
| 208 | 208 | return $lhs->name <=> $rhs->name; |
| 209 | 209 | }); |
| 210 | 210 | |
@@ -214,13 +214,13 @@ discard block |
||
| 214 | 214 | // Set header |
| 215 | 215 | $header = $tableInfo->name; |
| 216 | 216 | if (!empty($tableInfo->feComment)) { |
| 217 | - $header .= ': ' . $tableInfo->feComment; |
|
| 217 | + $header .= ': '.$tableInfo->feComment; |
|
| 218 | 218 | } |
| 219 | 219 | $section->setHeader($header); |
| 220 | 220 | |
| 221 | 221 | // Set introductory text of subsection |
| 222 | 222 | if ($tableInfo->modelClass) { |
| 223 | - $section->addText('Extbase domain model: ``' . $tableInfo->modelClass . '``'); |
|
| 223 | + $section->addText('Extbase domain model: ``'.$tableInfo->modelClass.'``'); |
|
| 224 | 224 | } |
| 225 | 225 | $section->addText($tableInfo->classComment); |
| 226 | 226 | $section->addText($tableInfo->sqlComment); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | 'description' => 'Description', |
| 232 | 232 | ]]; |
| 233 | 233 | |
| 234 | - $rows = array_map(function ($column) use ($page) { |
|
| 234 | + $rows = array_map(function($column) use ($page) { |
|
| 235 | 235 | return [ |
| 236 | 236 | 'field' => ( |
| 237 | 237 | $page->format($column->name, ['bold' => $column->isPrimary]) |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | * @subpackage dlf |
| 33 | 33 | * @access public |
| 34 | 34 | */ |
| 35 | -class Generator |
|
| 36 | -{ |
|
| 35 | +class Generator { |
|
| 37 | 36 | /** |
| 38 | 37 | * @var ObjectManager |
| 39 | 38 | */ |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | */ |
| 50 | 49 | protected $dataMapper; |
| 51 | 50 | |
| 52 | - public function __construct() |
|
| 53 | - { |
|
| 51 | + public function __construct() { |
|
| 54 | 52 | $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
| 55 | 53 | $this->languageService = $this->objectManager->get(LanguageService::class); |
| 56 | 54 | $this->dataMapper = $this->objectManager->get(DataMapper::class); |
@@ -167,8 +165,7 @@ discard block |
||
| 167 | 165 | return $result; |
| 168 | 166 | } |
| 169 | 167 | |
| 170 | - protected function parseDocComment($docComment) |
|
| 171 | - { |
|
| 168 | + protected function parseDocComment($docComment) { |
|
| 172 | 169 | // TODO: Consider using phpDocumentor (though that splits the docblock into summary and description) |
| 173 | 170 | |
| 174 | 171 | // Adopted from DocCommentParser in TYPO3 v9 |
@@ -193,8 +190,7 @@ discard block |
||
| 193 | 190 | /** |
| 194 | 191 | * Transform table structure into .rst page. |
| 195 | 192 | */ |
| 196 | - public function generatePage(array $tables) |
|
| 197 | - { |
|
| 193 | + public function generatePage(array $tables) { |
|
| 198 | 194 | $page = new RstSection(); |
| 199 | 195 | $page->setHeader('Database Tables'); |
| 200 | 196 | $page->addText(<<<RST |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function collectTables(): array |
| 64 | 64 | { |
| 65 | 65 | $sqlReader = $this->objectManager->get(SqlReader::class); |
| 66 | - $sqlCode = $sqlReader->getTablesDefinitionString(true); |
|
| 66 | + $sqlCode = $sqlReader->getTablesDefinitionString(TRUE); |
|
| 67 | 67 | $createTableStatements = $sqlReader->getCreateTableStatementArray($sqlCode); |
| 68 | 68 | |
| 69 | 69 | $tableToClassName = $this->getTableClassMap(); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | continue; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $className = $tableToClassName[$tableName] ?? null; |
|
| 82 | + $className = $tableToClassName[$tableName] ?? NULL; |
|
| 83 | 83 | |
| 84 | 84 | $result[] = $this->getTableInfo($table, $className); |
| 85 | 85 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $isPrimary = []; |
| 121 | 121 | if (!is_null($primaryKey = $table->getPrimaryKey())) { |
| 122 | 122 | foreach ($primaryKey->getUnquotedColumns() as $primaryColumn) { |
| 123 | - $isPrimary[$primaryColumn] = true; |
|
| 123 | + $isPrimary[$primaryColumn] = TRUE; |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
@@ -141,14 +141,14 @@ discard block |
||
| 141 | 141 | $result = (object) [ |
| 142 | 142 | 'name' => $tableName, |
| 143 | 143 | 'columns' => $columns, |
| 144 | - 'modelClass' => null, |
|
| 144 | + 'modelClass' => NULL, |
|
| 145 | 145 | 'sqlComment' => $table->getComment() ?? '', |
| 146 | 146 | 'classComment' => '', |
| 147 | 147 | 'feComment' => $this->languageService->sL($GLOBALS['TCA'][$tableName]['ctrl']['title'] ?? ''), |
| 148 | 148 | ]; |
| 149 | 149 | |
| 150 | 150 | // Integrate doc-comments from model class and its fields |
| 151 | - if ($className !== null) { |
|
| 151 | + if ($className !== NULL) { |
|
| 152 | 152 | $reflection = new ReflectionClass($className); |
| 153 | 153 | |
| 154 | 154 | $dataMap = $this->dataMapper->getDataMap($className); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | // In that case, try to guess the column name from the property name. |
| 159 | 159 | |
| 160 | 160 | $column = $dataMap->getColumnMap($property->getName()); |
| 161 | - $columnName = $column === null |
|
| 161 | + $columnName = $column === NULL |
|
| 162 | 162 | ? GeneralUtility::camelCaseToLowerCaseUnderscored($property->getName()) |
| 163 | 163 | : $column->getColumnName(); |
| 164 | 164 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $lines = explode("\n", $docComment); |
| 185 | 185 | foreach ($lines as $line) { |
| 186 | 186 | // Stop parsing at first tag |
| 187 | - if ($line !== '' && strpos($line, '@') !== false) { |
|
| 187 | + if ($line !== '' && strpos($line, '@') !== FALSE) { |
|
| 188 | 188 | break; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | This is a reference of all database tables defined by Kitodo.Presentation. |
| 209 | 209 | |
| 210 | 210 | .. tip:: This page is auto-generated. If you would like to edit it, please use doc-comments in the model class, COMMENT fields in ``ext_tables.sql`` if the table does not have one, or TCA labels. Then, you may re-generate the page by running ``composer docs:db`` inside the Kitodo.Presentation base folder. |
| 211 | -RST); |
|
| 211 | +rst); |
|
| 212 | 212 | |
| 213 | 213 | // Sort tables alphabetically |
| 214 | 214 | usort($tables, function ($lhs, $rhs) { |
@@ -243,11 +243,11 @@ discard block |
||
| 243 | 243 | 'field' => ( |
| 244 | 244 | $page->format($column->name, ['bold' => $column->isPrimary]) |
| 245 | 245 | . "\u{00a0}\u{00a0}" |
| 246 | - . $page->format($column->type->getName(), ['italic' => true]) |
|
| 246 | + . $page->format($column->type->getName(), ['italic' => TRUE]) |
|
| 247 | 247 | ), |
| 248 | 248 | |
| 249 | 249 | 'description' => $page->paragraphs([ |
| 250 | - $page->format($column->feComment, ['italic' => true]), |
|
| 250 | + $page->format($column->feComment, ['italic' => TRUE]), |
|
| 251 | 251 | $column->fieldComment, |
| 252 | 252 | $column->sqlComment, |
| 253 | 253 | ]), |