@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | * @subpackage dlf |
| 27 | 27 | * @access public |
| 28 | 28 | */ |
| 29 | -class Collection extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 30 | -{ |
|
| 29 | +class Collection extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 31 | 30 | public $scriptRelPath = 'Classes/Plugin/Collection.php'; |
| 32 | 31 | |
| 33 | 32 | /** |
@@ -48,8 +47,7 @@ discard block |
||
| 48 | 47 | * |
| 49 | 48 | * @return string The content that is displayed on the website |
| 50 | 49 | */ |
| 51 | - public function main($content, $conf) |
|
| 52 | - { |
|
| 50 | + public function main($content, $conf) { |
|
| 53 | 51 | $this->init($conf); |
| 54 | 52 | // Turn cache on. |
| 55 | 53 | $this->setCache(true); |
@@ -77,8 +75,7 @@ discard block |
||
| 77 | 75 | * |
| 78 | 76 | * @return string The list of collections ready to output |
| 79 | 77 | */ |
| 80 | - protected function showCollectionList() |
|
| 81 | - { |
|
| 78 | + protected function showCollectionList() { |
|
| 82 | 79 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 83 | 80 | ->getQueryBuilderForTable('tx_dlf_collections'); |
| 84 | 81 | |
@@ -257,8 +254,7 @@ discard block |
||
| 257 | 254 | * |
| 258 | 255 | * @return void |
| 259 | 256 | */ |
| 260 | - protected function showSingleCollection($id) |
|
| 261 | - { |
|
| 257 | + protected function showSingleCollection($id) { |
|
| 262 | 258 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
| 263 | 259 | $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_collections'); |
| 264 | 260 | |
@@ -169,12 +169,12 @@ discard block |
||
| 169 | 169 | foreach ($collections as $collection) { |
| 170 | 170 | $solr_query = ''; |
| 171 | 171 | if ($collection['index_query'] != '') { |
| 172 | - $solr_query .= '(' . $collection['index_query'] . ')'; |
|
| 172 | + $solr_query .= '('.$collection['index_query'].')'; |
|
| 173 | 173 | } else { |
| 174 | - $solr_query .= 'collection:("' . $collection['index_name'] . '")'; |
|
| 174 | + $solr_query .= 'collection:("'.$collection['index_name'].'")'; |
|
| 175 | 175 | } |
| 176 | - $partOfNothing = $solr->search_raw($solr_query . ' AND partof:0 AND toplevel:true', $params); |
|
| 177 | - $partOfSomething = $solr->search_raw($solr_query . ' AND NOT partof:0 AND toplevel:true', $params); |
|
| 176 | + $partOfNothing = $solr->search_raw($solr_query.' AND partof:0 AND toplevel:true', $params); |
|
| 177 | + $partOfSomething = $solr->search_raw($solr_query.' AND NOT partof:0 AND toplevel:true', $params); |
|
| 178 | 178 | // Titles are all documents that are "root" elements i.e. partof == 0 |
| 179 | 179 | $collection['titles'] = []; |
| 180 | 180 | foreach ($partOfNothing as $doc) { |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | $markerArray[$_key]['###TITLE###'] = $this->cObj->typoLink(htmlspecialchars($collection['label']), $conf); |
| 213 | 213 | // Add feed link if applicable. |
| 214 | 214 | if (!empty($this->conf['targetFeed'])) { |
| 215 | - $img = '<img src="' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)) . 'Resources/Public/Icons/txdlffeeds.png" alt="' . htmlspecialchars($this->pi_getLL('feedAlt', '')) . '" title="' . htmlspecialchars($this->pi_getLL('feedTitle', '')) . '" />'; |
|
| 215 | + $img = '<img src="'.\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)).'Resources/Public/Icons/txdlffeeds.png" alt="'.htmlspecialchars($this->pi_getLL('feedAlt', '')).'" title="'.htmlspecialchars($this->pi_getLL('feedTitle', '')).'" />'; |
|
| 216 | 216 | $markerArray[$_key]['###FEED###'] = $this->pi_linkTP($img, [$this->prefixId => ['collection' => $collection['uid']]], false, $this->conf['targetFeed']); |
| 217 | 217 | } else { |
| 218 | 218 | $markerArray[$_key]['###FEED###'] = ''; |
| 219 | 219 | } |
| 220 | 220 | // Add thumbnail. |
| 221 | 221 | if (!empty($collection['thumbnail'])) { |
| 222 | - $markerArray[$_key]['###THUMBNAIL###'] = '<img alt="" title="' . htmlspecialchars($collection['label']) . '" src="' . $collection['thumbnail'] . '" />'; |
|
| 222 | + $markerArray[$_key]['###THUMBNAIL###'] = '<img alt="" title="'.htmlspecialchars($collection['label']).'" src="'.$collection['thumbnail'].'" />'; |
|
| 223 | 223 | } else { |
| 224 | 224 | $markerArray[$_key]['###THUMBNAIL###'] = ''; |
| 225 | 225 | } |
@@ -227,9 +227,9 @@ discard block |
||
| 227 | 227 | $markerArray[$_key]['###DESCRIPTION###'] = $this->pi_RTEcssText($collection['description']); |
| 228 | 228 | // Build statistic's output. |
| 229 | 229 | $labelTitles = $this->pi_getLL((count($collection['titles']) > 1 ? 'titles' : 'title'), ''); |
| 230 | - $markerArray[$_key]['###COUNT_TITLES###'] = htmlspecialchars(count($collection['titles']) . $labelTitles); |
|
| 230 | + $markerArray[$_key]['###COUNT_TITLES###'] = htmlspecialchars(count($collection['titles']).$labelTitles); |
|
| 231 | 231 | $labelVolumes = $this->pi_getLL((count($collection['volumes']) > 1 ? 'volumes' : 'volume'), ''); |
| 232 | - $markerArray[$_key]['###COUNT_VOLUMES###'] = htmlspecialchars(count($collection['volumes']) . $labelVolumes); |
|
| 232 | + $markerArray[$_key]['###COUNT_VOLUMES###'] = htmlspecialchars(count($collection['volumes']).$labelVolumes); |
|
| 233 | 233 | } |
| 234 | 234 | // Randomize sorting? |
| 235 | 235 | if (!empty($this->conf['randomize'])) { |
@@ -311,14 +311,14 @@ discard block |
||
| 311 | 311 | $collectionData = $resArray; |
| 312 | 312 | } |
| 313 | 313 | } else { |
| 314 | - Helper::devLog('No collection with UID ' . $id . ' found.', DEVLOG_SEVERITY_WARNING); |
|
| 314 | + Helper::devLog('No collection with UID '.$id.' found.', DEVLOG_SEVERITY_WARNING); |
|
| 315 | 315 | return; |
| 316 | 316 | } |
| 317 | 317 | // Fetch corresponding document UIDs from Solr. |
| 318 | 318 | if ($collectionData['index_search'] != '') { |
| 319 | - $solr_query = '(' . $collectionData['index_search'] . ')'; |
|
| 319 | + $solr_query = '('.$collectionData['index_search'].')'; |
|
| 320 | 320 | } else { |
| 321 | - $solr_query = 'collection:("' . $collectionData['index_name'] . '") AND toplevel:true'; |
|
| 321 | + $solr_query = 'collection:("'.$collectionData['index_name'].'") AND toplevel:true'; |
|
| 322 | 322 | } |
| 323 | 323 | $solr = Solr::getInstance($this->conf['solrcore']); |
| 324 | 324 | if (!$solr->ready) { |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | 'source' => 'collection', |
| 368 | 368 | 'select' => $id, |
| 369 | 369 | 'userid' => $collectionData['userid'], |
| 370 | - 'params' => ['filterquery' => [['query' => 'collection_faceting:("' . $collectionData['index_name'] . '")']]], |
|
| 370 | + 'params' => ['filterquery' => [['query' => 'collection_faceting:("'.$collectionData['index_name'].'")']]], |
|
| 371 | 371 | 'core' => '', |
| 372 | 372 | 'pid' => $this->conf['pages'], |
| 373 | 373 | 'order' => 'title', |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | 'forceAbsoluteUrl' => !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0, |
| 431 | 431 | 'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'] |
| 432 | 432 | ]; |
| 433 | - header('Location: ' . \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
| 433 | + header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
| 434 | 434 | exit; |
| 435 | 435 | } |
| 436 | 436 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | $this->init($conf); |
| 54 | 54 | // Turn cache on. |
| 55 | - $this->setCache(true); |
|
| 55 | + $this->setCache(TRUE); |
|
| 56 | 56 | // Quit without doing anything if required configuration variables are not set. |
| 57 | 57 | if (empty($this->conf['pages'])) { |
| 58 | 58 | Helper::devLog('Incomplete plugin configuration', DEVLOG_SEVERITY_WARNING); |
@@ -206,14 +206,14 @@ discard block |
||
| 206 | 206 | 'parameter' => $GLOBALS['TSFE']->id, |
| 207 | 207 | 'forceAbsoluteUrl' => !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0, |
| 208 | 208 | 'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'], |
| 209 | - 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', true, false) |
|
| 209 | + 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE) |
|
| 210 | 210 | ]; |
| 211 | 211 | // Link collection's title to list view. |
| 212 | 212 | $markerArray[$_key]['###TITLE###'] = $this->cObj->typoLink(htmlspecialchars($collection['label']), $conf); |
| 213 | 213 | // Add feed link if applicable. |
| 214 | 214 | if (!empty($this->conf['targetFeed'])) { |
| 215 | 215 | $img = '<img src="' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)) . 'Resources/Public/Icons/txdlffeeds.png" alt="' . htmlspecialchars($this->pi_getLL('feedAlt', '')) . '" title="' . htmlspecialchars($this->pi_getLL('feedTitle', '')) . '" />'; |
| 216 | - $markerArray[$_key]['###FEED###'] = $this->pi_linkTP($img, [$this->prefixId => ['collection' => $collection['uid']]], false, $this->conf['targetFeed']); |
|
| 216 | + $markerArray[$_key]['###FEED###'] = $this->pi_linkTP($img, [$this->prefixId => ['collection' => $collection['uid']]], FALSE, $this->conf['targetFeed']); |
|
| 217 | 217 | } else { |
| 218 | 218 | $markerArray[$_key]['###FEED###'] = ''; |
| 219 | 219 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | if (!empty($this->conf['randomize'])) { |
| 236 | 236 | ksort($markerArray, SORT_NUMERIC); |
| 237 | 237 | // Don't cache the output. |
| 238 | - $this->setCache(false); |
|
| 238 | + $this->setCache(FALSE); |
|
| 239 | 239 | } |
| 240 | 240 | $entry = $this->templateService->getSubpart($this->template, '###ENTRY###'); |
| 241 | 241 | foreach ($markerArray as $marker) { |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $hookObj->showCollectionList_getCustomCollectionList($this, $this->conf['templateFile'], $content, $markerArray); |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | - return $this->templateService->substituteSubpart($this->template, '###ENTRY###', $content, true); |
|
| 250 | + return $this->templateService->substituteSubpart($this->template, '###ENTRY###', $content, TRUE); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | 'core' => '', |
| 372 | 372 | 'pid' => $this->conf['pages'], |
| 373 | 373 | 'order' => 'title', |
| 374 | - 'order.asc' => true |
|
| 374 | + 'order.asc' => TRUE |
|
| 375 | 375 | ] |
| 376 | 376 | ]; |
| 377 | 377 | } |