We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -41,10 +41,10 @@ |
||
| 41 | 41 | $url = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('url'); |
| 42 | 42 | $fetchedData = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($url, \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($header, 0, 2, 0)); |
| 43 | 43 | // Add some header tags |
| 44 | - header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . 'GMT'); |
|
| 44 | + header('Last-Modified: '.gmdate("D, d M Y H:i:s").'GMT'); |
|
| 45 | 45 | header('Cache-Control: max-age=3600, must-revalidate'); |
| 46 | - header('Content-Length: ' . strlen($fetchedData)); |
|
| 47 | - header('Content-Type: ' . finfo_buffer(finfo_open(FILEINFO_MIME), $fetchedData)); |
|
| 46 | + header('Content-Length: '.strlen($fetchedData)); |
|
| 47 | + header('Content-Type: '.finfo_buffer(finfo_open(FILEINFO_MIME), $fetchedData)); |
|
| 48 | 48 | // Get last modified date from request header |
| 49 | 49 | $fetchedHeader = explode("\n", \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($url, 2)); |
| 50 | 50 | foreach ($fetchedHeader as $headerline) { |
@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | * @subpackage dlf |
| 21 | 21 | * @access public |
| 22 | 22 | */ |
| 23 | -class PageViewProxy extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin |
|
| 24 | -{ |
|
| 23 | +class PageViewProxy extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { |
|
| 25 | 24 | public $scriptRelPath = 'Classes/Plugin/Eid/PageViewProxy.php'; |
| 26 | 25 | |
| 27 | 26 | /** |
@@ -34,8 +33,7 @@ discard block |
||
| 34 | 33 | * |
| 35 | 34 | * @return string |
| 36 | 35 | */ |
| 37 | - public function main($content = '', $conf = []) |
|
| 38 | - { |
|
| 36 | + public function main($content = '', $conf = []) { |
|
| 39 | 37 | $this->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); |
| 40 | 38 | $header = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('header'); |
| 41 | 39 | $url = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('url'); |
@@ -47,9 +47,9 @@ |
||
| 47 | 47 | $core = Helper::decrypt(GeneralUtility::_GP('encrypted'), GeneralUtility::_GP('hashed')); |
| 48 | 48 | } |
| 49 | 49 | if (!empty($core)) { |
| 50 | - $url = trim(Solr::getSolrUrl($core), '/') . '/select?wt=json&q=fulltext:(' . Solr::escapeQuery(GeneralUtility::_GP('q')) . ')%20AND%20uid:' . GeneralUtility::_GP('uid') |
|
| 50 | + $url = trim(Solr::getSolrUrl($core), '/').'/select?wt=json&q=fulltext:('.Solr::escapeQuery(GeneralUtility::_GP('q')).')%20AND%20uid:'.GeneralUtility::_GP('uid') |
|
| 51 | 51 | . '&hl=on&hl.fl=fulltext&fl=uid,id,page&hl.method=fastVector' |
| 52 | - . '&start=' . GeneralUtility::_GP('start') . '&rows=20'; |
|
| 52 | + . '&start='.GeneralUtility::_GP('start').'&rows=20'; |
|
| 53 | 53 | $output = GeneralUtility::getUrl($url); |
| 54 | 54 | } |
| 55 | 55 | echo $output; |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | * @subpackage dlf |
| 25 | 25 | * @access public |
| 26 | 26 | */ |
| 27 | -class SearchInDocument extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin |
|
| 28 | -{ |
|
| 27 | +class SearchInDocument extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { |
|
| 29 | 28 | public $scriptRelPath = 'Classes/Plugin/Eid/SearchInDocument.php'; |
| 30 | 29 | |
| 31 | 30 | /** |
@@ -38,8 +37,7 @@ discard block |
||
| 38 | 37 | * |
| 39 | 38 | * @return string JSON response of search suggestions |
| 40 | 39 | */ |
| 41 | - public function main($content = '', $conf = []) |
|
| 42 | - { |
|
| 40 | + public function main($content = '', $conf = []) { |
|
| 43 | 41 | if ( |
| 44 | 42 | GeneralUtility::_GP('encrypted') != '' |
| 45 | 43 | && GeneralUtility::_GP('hashed') != '' |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | $core = Helper::decrypt(GeneralUtility::_GP('encrypted'), GeneralUtility::_GP('hashed')); |
| 49 | 49 | } |
| 50 | 50 | if (!empty($core)) { |
| 51 | - $url = trim(Solr::getSolrUrl($core), '/') . '/suggest/?wt=xml&q=' . Solr::escapeQuery(GeneralUtility::_GP('q')); |
|
| 51 | + $url = trim(Solr::getSolrUrl($core), '/').'/suggest/?wt=xml&q='.Solr::escapeQuery(GeneralUtility::_GP('q')); |
|
| 52 | 52 | $output = GeneralUtility::getUrl($url); |
| 53 | 53 | } |
| 54 | 54 | echo $output; |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage dlf |
| 26 | 26 | * @access public |
| 27 | 27 | */ |
| 28 | -class SearchSuggest extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin |
|
| 29 | -{ |
|
| 28 | +class SearchSuggest extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { |
|
| 30 | 29 | public $scriptRelPath = 'Classes/Plugin/Eid/SearchSuggest.php'; |
| 31 | 30 | |
| 32 | 31 | /** |
@@ -39,8 +38,7 @@ discard block |
||
| 39 | 38 | * |
| 40 | 39 | * @return string XML response of search suggestions |
| 41 | 40 | */ |
| 42 | - public function main($content = '', $conf = []) |
|
| 43 | - { |
|
| 41 | + public function main($content = '', $conf = []) { |
|
| 44 | 42 | if ( |
| 45 | 43 | GeneralUtility::_GP('encrypted') != '' |
| 46 | 44 | && GeneralUtility::_GP('hashed') != '' |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | array_unshift($metadata, $data); |
| 132 | 132 | } |
| 133 | 133 | if (empty($metadata)) { |
| 134 | - Helper::devLog('No metadata found for document with UID ' . $this->doc->uid, DEVLOG_SEVERITY_WARNING); |
|
| 134 | + Helper::devLog('No metadata found for document with UID '.$this->doc->uid, DEVLOG_SEVERITY_WARNING); |
|
| 135 | 135 | return $content; |
| 136 | 136 | } |
| 137 | 137 | ksort($metadata); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $cObjData = $this->cObj->data; |
| 184 | 184 | foreach ($metadataArray as $metadata) { |
| 185 | 185 | foreach ($metadata as $key => $group) { |
| 186 | - $markerArray['###METADATA###'] = '<span class="tx-dlf-metadata-group">' . $this->pi_getLL($key) . '</span>'; |
|
| 186 | + $markerArray['###METADATA###'] = '<span class="tx-dlf-metadata-group">'.$this->pi_getLL($key).'</span>'; |
|
| 187 | 187 | // Reset content object's data array. |
| 188 | 188 | $this->cObj->data = $cObjData; |
| 189 | 189 | if (!is_array($group)) { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | if (empty($value) && $this->conf['getTitle'] && $this->doc->parentId) { |
| 313 | 313 | $superiorTitle = Document::getTitle($this->doc->parentId, TRUE); |
| 314 | 314 | if (!empty($superiorTitle)) { |
| 315 | - $value = '[' . $superiorTitle . ']'; |
|
| 315 | + $value = '['.$superiorTitle.']'; |
|
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | if (!empty($value)) { |
@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | * @subpackage dlf |
| 30 | 30 | * @access public |
| 31 | 31 | */ |
| 32 | -class Metadata extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 33 | -{ |
|
| 32 | +class Metadata extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 34 | 33 | public $scriptRelPath = 'Classes/Plugin/Metadata.php'; |
| 35 | 34 | |
| 36 | 35 | /** |
@@ -51,8 +50,7 @@ discard block |
||
| 51 | 50 | * |
| 52 | 51 | * @return string The content that is displayed on the website |
| 53 | 52 | */ |
| 54 | - public function main($content, $conf) |
|
| 55 | - { |
|
| 53 | + public function main($content, $conf) { |
|
| 56 | 54 | $this->init($conf); |
| 57 | 55 | // Turn cache on. |
| 58 | 56 | $this->setCache(TRUE); |
@@ -157,8 +155,7 @@ discard block |
||
| 157 | 155 | * |
| 158 | 156 | * @return string The metadata array ready for output |
| 159 | 157 | */ |
| 160 | - protected function printMetadata(array $metadataArray, $useOriginalIiifManifestMetadata = FALSE) |
|
| 161 | - { |
|
| 158 | + protected function printMetadata(array $metadataArray, $useOriginalIiifManifestMetadata = FALSE) { |
|
| 162 | 159 | // Load template file. |
| 163 | 160 | $this->getTemplate(); |
| 164 | 161 | $output = ''; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(['page' => $entry['points']], TRUE, FALSE, $this->conf['targetPid']); |
| 65 | 65 | $entryArray['doNotLinkIt'] = 0; |
| 66 | 66 | if ($this->conf['basketButton']) { |
| 67 | - $entryArray['basketButtonHref'] = '<a href="' . $this->pi_linkTP_keepPIvars_url(['addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['points']], TRUE, FALSE, $this->conf['targetBasket']) . '">' . $this->pi_getLL('basketButton', '', TRUE) . '</a>'; |
|
| 67 | + $entryArray['basketButtonHref'] = '<a href="'.$this->pi_linkTP_keepPIvars_url(['addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['points']], TRUE, FALSE, $this->conf['targetBasket']).'">'.$this->pi_getLL('basketButton', '', TRUE).'</a>'; |
|
| 68 | 68 | } |
| 69 | 69 | } elseif ( |
| 70 | 70 | !empty($entry['points']) |
@@ -73,13 +73,13 @@ discard block |
||
| 73 | 73 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(['id' => $entry['points'], 'page' => 1], TRUE, FALSE, $this->conf['targetPid']); |
| 74 | 74 | $entryArray['doNotLinkIt'] = 0; |
| 75 | 75 | if ($this->conf['basketButton']) { |
| 76 | - $entryArray['basketButtonHref'] = '<a href="' . $this->pi_linkTP_keepPIvars_url(['addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['points']], TRUE, FALSE, $this->conf['targetBasket']) . '">' . $this->pi_getLL('basketButton', '', TRUE) . '</a>'; |
|
| 76 | + $entryArray['basketButtonHref'] = '<a href="'.$this->pi_linkTP_keepPIvars_url(['addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['points']], TRUE, FALSE, $this->conf['targetBasket']).'">'.$this->pi_getLL('basketButton', '', TRUE).'</a>'; |
|
| 77 | 77 | } |
| 78 | 78 | } elseif (!empty($entry['targetUid'])) { |
| 79 | 79 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(['id' => $entry['targetUid'], 'page' => 1], TRUE, FALSE, $this->conf['targetPid']); |
| 80 | 80 | $entryArray['doNotLinkIt'] = 0; |
| 81 | 81 | if ($this->conf['basketButton']) { |
| 82 | - $entryArray['basketButtonHref'] = '<a href="' . $this->pi_linkTP_keepPIvars_url(['addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['targetUid']], TRUE, FALSE, $this->conf['targetBasket']) . '">' . $this->pi_getLL('basketButton', '', TRUE) . '</a>'; |
|
| 82 | + $entryArray['basketButtonHref'] = '<a href="'.$this->pi_linkTP_keepPIvars_url(['addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['targetUid']], TRUE, FALSE, $this->conf['targetBasket']).'">'.$this->pi_getLL('basketButton', '', TRUE).'</a>'; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | // Set "ITEM_STATE" to "CUR" if this entry points to current page. |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | // Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries. |
| 115 | - $entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'] . 'IFSUB'); |
|
| 115 | + $entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'].'IFSUB'); |
|
| 116 | 116 | } |
| 117 | 117 | return $entryArray; |
| 118 | 118 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $this->getTemplate(); |
| 140 | 140 | $TSconfig = []; |
| 141 | 141 | $TSconfig['special'] = 'userfunction'; |
| 142 | - $TSconfig['special.']['userFunc'] = \Kitodo\Dlf\Plugin\TableOfContents::class . '->makeMenuArray'; |
|
| 142 | + $TSconfig['special.']['userFunc'] = \Kitodo\Dlf\Plugin\TableOfContents::class.'->makeMenuArray'; |
|
| 143 | 143 | $TSconfig = Helper::mergeRecursiveWithOverrule($this->conf['menuConf.'], $TSconfig); |
| 144 | 144 | $markerArray['###TOCMENU###'] = $this->cObj->cObjGetSingle('HMENU', $TSconfig); |
| 145 | 145 | $content .= $this->templateService->substituteMarkerArray($this->template, $markerArray); |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | $menuArray[] = $this->getMenuEntry($entry, FALSE); |
| 212 | 212 | } |
| 213 | 213 | // Get all child documents from database. |
| 214 | - $whereClause = 'tx_dlf_documents.partof=' . intval($this->doc->uid) . ' AND tx_dlf_documents.structure=tx_dlf_structures.uid AND tx_dlf_structures.pid=' . $this->doc->pid . Helper::whereClause('tx_dlf_documents') . Helper::whereClause('tx_dlf_structures'); |
|
| 214 | + $whereClause = 'tx_dlf_documents.partof='.intval($this->doc->uid).' AND tx_dlf_documents.structure=tx_dlf_structures.uid AND tx_dlf_structures.pid='.$this->doc->pid.Helper::whereClause('tx_dlf_documents').Helper::whereClause('tx_dlf_structures'); |
|
| 215 | 215 | if ($this->conf['excludeOther']) { |
| 216 | - $whereClause .= ' AND tx_dlf_documents.pid=' . intval($this->conf['pages']); |
|
| 216 | + $whereClause .= ' AND tx_dlf_documents.pid='.intval($this->conf['pages']); |
|
| 217 | 217 | } |
| 218 | 218 | // Build table of contents from database. |
| 219 | 219 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
@@ -22,8 +22,7 @@ discard block |
||
| 22 | 22 | * @subpackage dlf |
| 23 | 23 | * @access public |
| 24 | 24 | */ |
| 25 | -class TableOfContents extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 26 | -{ |
|
| 25 | +class TableOfContents extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 27 | 26 | public $scriptRelPath = 'Classes/Plugin/TableOfContents.php'; |
| 28 | 27 | |
| 29 | 28 | /** |
@@ -44,8 +43,7 @@ discard block |
||
| 44 | 43 | * |
| 45 | 44 | * @return array HMENU array for menu entry |
| 46 | 45 | */ |
| 47 | - protected function getMenuEntry(array $entry, $recursive = FALSE) |
|
| 48 | - { |
|
| 46 | + protected function getMenuEntry(array $entry, $recursive = FALSE) { |
|
| 49 | 47 | $entryArray = []; |
| 50 | 48 | // Set "title", "volume", "type" and "pagination" from $entry array. |
| 51 | 49 | $entryArray['title'] = !empty($entry['label']) ? $entry['label'] : $entry['orderlabel']; |
@@ -127,8 +125,7 @@ discard block |
||
| 127 | 125 | * |
| 128 | 126 | * @return string The content that is displayed on the website |
| 129 | 127 | */ |
| 130 | - public function main($content, $conf) |
|
| 131 | - { |
|
| 128 | + public function main($content, $conf) { |
|
| 132 | 129 | $this->init($conf); |
| 133 | 130 | // Check for typoscript configuration to prevent fatal error. |
| 134 | 131 | if (empty($this->conf['menuConf.'])) { |
@@ -156,8 +153,7 @@ discard block |
||
| 156 | 153 | * |
| 157 | 154 | * @return array HMENU array |
| 158 | 155 | */ |
| 159 | - public function makeMenuArray($content, $conf) |
|
| 160 | - { |
|
| 156 | + public function makeMenuArray($content, $conf) { |
|
| 161 | 157 | $this->init($conf); |
| 162 | 158 | // Load current document. |
| 163 | 159 | $this->loadDocument(); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | if ($result->rowCount() == 1) { |
| 64 | 64 | $pageRenderer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class); |
| 65 | - $pageRenderer->addJsFooterFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'Resources/Public/Javascript/Search/Suggester.js'); |
|
| 65 | + $pageRenderer->addJsFooterFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/Search/Suggester.js'); |
|
| 66 | 66 | } else { |
| 67 | 67 | Helper::devLog('No metadata fields configured for search suggestions', DEVLOG_SEVERITY_WARNING); |
| 68 | 68 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | && $list->metadata['options']['source'] == 'collection' |
| 85 | 85 | ) { |
| 86 | 86 | // Get collection's UID. |
| 87 | - return '<input type="hidden" name="' . $this->prefixId . '[collection]" value="' . $list->metadata['options']['select'] . '" />'; |
|
| 87 | + return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$list->metadata['options']['select'].'" />'; |
|
| 88 | 88 | } elseif (!empty($list->metadata['options']['params']['filterquery'])) { |
| 89 | 89 | // Get collection's UID from search metadata. |
| 90 | 90 | foreach ($list->metadata['options']['params']['filterquery'] as $facet) { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $collectionId = Helper::getUidFromIndexName(trim($facetKeyVal[1], '(")'), 'tx_dlf_collections'); |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | - return '<input type="hidden" name="' . $this->prefixId . '[collection]" value="' . $collectionId . '" />'; |
|
| 99 | + return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$collectionId.'" />'; |
|
| 100 | 100 | } |
| 101 | 101 | return ''; |
| 102 | 102 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $this->loadDocument(); |
| 121 | 121 | // Get document's UID or parent ID. |
| 122 | 122 | if ($this->doc->ready) { |
| 123 | - return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . ($this->doc->parentId > 0 ? $this->doc->parentId : $this->doc->uid) . '" />'; |
|
| 123 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.($this->doc->parentId > 0 ? $this->doc->parentId : $this->doc->uid).'" />'; |
|
| 124 | 124 | } |
| 125 | 125 | } elseif (!empty($list->metadata['options']['params']['filterquery'])) { |
| 126 | 126 | // Get document's UID from search metadata. |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $documentId = (int) substr($facetKeyVal[1], 1, strpos($facetKeyVal[1], ')')); |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | - return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . $documentId . '" />'; |
|
| 133 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.$documentId.'" />'; |
|
| 134 | 134 | } |
| 135 | 135 | return ''; |
| 136 | 136 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | // Add encrypted fields to search form. |
| 154 | 154 | if (is_array($name)) { |
| 155 | - return '<input type="hidden" name="' . $this->prefixId . '[encrypted]" value="' . $name['encrypted'] . '" /><input type="hidden" name="' . $this->prefixId . '[hashed]" value="' . $name['hash'] . '" />'; |
|
| 155 | + return '<input type="hidden" name="'.$this->prefixId.'[encrypted]" value="'.$name['encrypted'].'" /><input type="hidden" name="'.$this->prefixId.'[hashed]" value="'.$name['hash'].'" />'; |
|
| 156 | 156 | } else { |
| 157 | 157 | return ''; |
| 158 | 158 | } |
@@ -178,19 +178,19 @@ discard block |
||
| 178 | 178 | // Get operator options. |
| 179 | 179 | $operatorOptions = ''; |
| 180 | 180 | foreach (['AND', 'OR', 'NOT'] as $operator) { |
| 181 | - $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-' . $operator . '" value="' . $operator . '">' . $this->pi_getLL($operator, '', TRUE) . '</option>'; |
|
| 181 | + $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-'.$operator.'" value="'.$operator.'">'.$this->pi_getLL($operator, '', TRUE).'</option>'; |
|
| 182 | 182 | } |
| 183 | 183 | // Get field selector options. |
| 184 | 184 | $fieldSelectorOptions = ''; |
| 185 | 185 | $searchFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
| 186 | 186 | foreach ($searchFields as $searchField) { |
| 187 | - $fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-' . $searchField . '" value="' . $searchField . '">' . Helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']) . '</option>'; |
|
| 187 | + $fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-'.$searchField.'" value="'.$searchField.'">'.Helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']).'</option>'; |
|
| 188 | 188 | } |
| 189 | 189 | for ($i = 0; $i < $this->conf['extendedSlotCount']; $i++) { |
| 190 | 190 | $markerArray = [ |
| 191 | - '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-' . $i . '" name="' . $this->prefixId . '[extOperator][' . $i . ']">' . $operatorOptions . '</select>', |
|
| 192 | - '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-' . $i . '" name="' . $this->prefixId . '[extField][' . $i . ']">' . $fieldSelectorOptions . '</select>', |
|
| 193 | - '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-' . $i . '" type="text" name="' . $this->prefixId . '[extQuery][' . $i . ']" />' |
|
| 191 | + '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-'.$i.'" name="'.$this->prefixId.'[extOperator]['.$i.']">'.$operatorOptions.'</select>', |
|
| 192 | + '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-'.$i.'" name="'.$this->prefixId.'[extField]['.$i.']">'.$fieldSelectorOptions.'</select>', |
|
| 193 | + '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-'.$i.'" type="text" name="'.$this->prefixId.'[extQuery]['.$i.']" />' |
|
| 194 | 194 | ]; |
| 195 | 195 | $extendedSearch .= $this->templateService->substituteMarkerArray($this->templateService->getSubpart($this->template, '###EXT_SEARCH_ENTRY###'), $markerArray); |
| 196 | 196 | } |
@@ -218,12 +218,12 @@ discard block |
||
| 218 | 218 | // Get facets from plugin configuration. |
| 219 | 219 | $facets = []; |
| 220 | 220 | foreach (GeneralUtility::trimExplode(',', $this->conf['facets'], TRUE) as $facet) { |
| 221 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
| 221 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
| 222 | 222 | } |
| 223 | 223 | // Render facets menu. |
| 224 | 224 | $TSconfig = []; |
| 225 | 225 | $TSconfig['special'] = 'userfunction'; |
| 226 | - $TSconfig['special.']['userFunc'] = \Kitodo\Dlf\Plugin\Search::class . '->makeFacetsMenuArray'; |
|
| 226 | + $TSconfig['special.']['userFunc'] = \Kitodo\Dlf\Plugin\Search::class.'->makeFacetsMenuArray'; |
|
| 227 | 227 | $TSconfig['special.']['facets'] = $facets; |
| 228 | 228 | $TSconfig['special.']['limit'] = max(intval($this->conf['limitFacets']), 1); |
| 229 | 229 | $TSconfig = Helper::mergeRecursiveWithOverrule($this->conf['facetsConf.'], $TSconfig); |
@@ -244,10 +244,10 @@ discard block |
||
| 244 | 244 | $output = ''; |
| 245 | 245 | // Check for plugin configuration. |
| 246 | 246 | if (!empty($this->conf['fulltext'])) { |
| 247 | - $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-no" type="radio" name="' . $this->prefixId . '[fulltext]" value="0" ' . ($isFulltextSearch == 0 ? 'checked="checked"' : '') . ' />'; |
|
| 248 | - $output .= ' <label for="tx-dlf-search-fulltext-no">' . $this->pi_getLL('label.inMetadata', '') . '</label>'; |
|
| 249 | - $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-yes" type="radio" name="' . $this->prefixId . '[fulltext]" value="1" ' . ($isFulltextSearch == 1 ? 'checked="checked"' : '') . '/>'; |
|
| 250 | - $output .= ' <label for="tx-dlf-search-fulltext-yes">' . $this->pi_getLL('label.inFulltext', '') . '</label>'; |
|
| 247 | + $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-no" type="radio" name="'.$this->prefixId.'[fulltext]" value="0" '.($isFulltextSearch == 0 ? 'checked="checked"' : '').' />'; |
|
| 248 | + $output .= ' <label for="tx-dlf-search-fulltext-no">'.$this->pi_getLL('label.inMetadata', '').'</label>'; |
|
| 249 | + $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-yes" type="radio" name="'.$this->prefixId.'[fulltext]" value="1" '.($isFulltextSearch == 1 ? 'checked="checked"' : '').'/>'; |
|
| 250 | + $output .= ' <label for="tx-dlf-search-fulltext-yes">'.$this->pi_getLL('label.inFulltext', '').'</label>'; |
|
| 251 | 251 | } |
| 252 | 252 | return $output; |
| 253 | 253 | } |
@@ -264,8 +264,8 @@ discard block |
||
| 264 | 264 | $output = ''; |
| 265 | 265 | // Check for plugin configuration. |
| 266 | 266 | if (!empty($this->conf['showLogicalPageField'])) { |
| 267 | - $output .= ' <label for="tx-dlf-search-logical-page">' . $this->pi_getLL('label.logicalPage', '') . ': </label>'; |
|
| 268 | - $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="' . $this->prefixId . '[logicalPage]" />'; |
|
| 267 | + $output .= ' <label for="tx-dlf-search-logical-page">'.$this->pi_getLL('label.logicalPage', '').': </label>'; |
|
| 268 | + $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="'.$this->prefixId.'[logicalPage]" />'; |
|
| 269 | 269 | } |
| 270 | 270 | return $output; |
| 271 | 271 | } |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $entryArray['doNotLinkIt'] = 0; |
| 307 | 307 | // Check if facet is already selected. |
| 308 | 308 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
| 309 | - $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
|
| 309 | + $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn); |
|
| 310 | 310 | if ($index !== FALSE) { |
| 311 | 311 | // Facet is selected, thus remove it from filter. |
| 312 | 312 | unset($queryColumn[$index]); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | } else { |
| 325 | 325 | // Facet is not selected, thus add it to filter. |
| 326 | - $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")'; |
|
| 326 | + $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")'; |
|
| 327 | 327 | $entryArray['ITEM_STATE'] = 'NO'; |
| 328 | 328 | } |
| 329 | 329 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(['query' => $search['query'], 'fq' => $queryColumn]); |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | '###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf), |
| 378 | 378 | '###LABEL_QUERY###' => (!empty($search['query']) ? htmlspecialchars($search['query']) : $this->pi_getLL('label.query')), |
| 379 | 379 | '###LABEL_SUBMIT###' => $this->pi_getLL('label.submit'), |
| 380 | - '###FIELD_QUERY###' => $this->prefixId . '[query]', |
|
| 380 | + '###FIELD_QUERY###' => $this->prefixId.'[query]', |
|
| 381 | 381 | '###QUERY###' => (!empty($search['query']) ? $search['query'] : ''), |
| 382 | 382 | '###FULLTEXTSWITCH###' => $this->addFulltextSwitch($list->metadata['fulltextSearch']), |
| 383 | 383 | '###FIELD_DOC###' => ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all' ? $this->addCurrentDocument() : ''), |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | $this->piVars['query'] = empty($matches[1]) ? $this->piVars['query'] : $matches[1]; |
| 409 | 409 | // Search in fulltext field if applicable. query must not be empty! |
| 410 | 410 | if (!empty($this->piVars['query'])) { |
| 411 | - $query = 'fulltext:(' . Solr::escapeQuery(trim($this->piVars['query'])) . ')'; |
|
| 411 | + $query = 'fulltext:('.Solr::escapeQuery(trim($this->piVars['query'])).')'; |
|
| 412 | 412 | } |
| 413 | 413 | } else { |
| 414 | 414 | // Retain given search field if valid. |
@@ -428,9 +428,9 @@ discard block |
||
| 428 | 428 | && in_array($this->piVars['extField'][$i], $allowedFields) |
| 429 | 429 | ) { |
| 430 | 430 | if (!empty($query)) { |
| 431 | - $query .= ' ' . $this->piVars['extOperator'][$i] . ' '; |
|
| 431 | + $query .= ' '.$this->piVars['extOperator'][$i].' '; |
|
| 432 | 432 | } |
| 433 | - $query .= Indexer::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']) . ':(' . Solr::escapeQuery($this->piVars['extQuery'][$i]) . ')'; |
|
| 433 | + $query .= Indexer::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']).':('.Solr::escapeQuery($this->piVars['extQuery'][$i]).')'; |
|
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | 436 | } |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | !empty($this->piVars['id']) |
| 451 | 451 | && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id']) |
| 452 | 452 | ) { |
| 453 | - $params['filterquery'][]['query'] = 'uid:(' . $this->piVars['id'] . ') OR partof:(' . $this->piVars['id'] . ')'; |
|
| 453 | + $params['filterquery'][]['query'] = 'uid:('.$this->piVars['id'].') OR partof:('.$this->piVars['id'].')'; |
|
| 454 | 454 | $label .= htmlspecialchars(sprintf($this->pi_getLL('in', ''), Document::getTitle($this->piVars['id']))); |
| 455 | 455 | } |
| 456 | 456 | } |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['collection']) |
| 465 | 465 | ) { |
| 466 | 466 | $index_name = Helper::getIndexNameFromUid($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']); |
| 467 | - $params['filterquery'][]['query'] = 'collection_faceting:("' . Solr::escapeQuery($index_name) . '")'; |
|
| 467 | + $params['filterquery'][]['query'] = 'collection_faceting:("'.Solr::escapeQuery($index_name).'")'; |
|
| 468 | 468 | $label .= sprintf($this->pi_getLL('in', '', TRUE), Helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
| 469 | 469 | } |
| 470 | 470 | } |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | $collIndexNames[] = Solr::escapeQuery(Helper::getIndexNameFromUid(intval($collId), 'tx_dlf_collections', $this->conf['pages'])); |
| 477 | 477 | } |
| 478 | 478 | // Last value is fake and used for distinction in $this->addCurrentCollection() |
| 479 | - $params['filterquery'][]['query'] = 'collection_faceting:("' . implode('" OR "', $collIndexNames) . '" OR "FakeValueForDistinction")'; |
|
| 479 | + $params['filterquery'][]['query'] = 'collection_faceting:("'.implode('" OR "', $collIndexNames).'" OR "FakeValueForDistinction")'; |
|
| 480 | 480 | } |
| 481 | 481 | // Set some query parameters. |
| 482 | 482 | $params['query'] = $query; |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | $linkConf['additionalParams'] = GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE); |
| 526 | 526 | // Send headers. |
| 527 | - header('Location: ' . GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
| 527 | + header('Location: '.GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
| 528 | 528 | exit; |
| 529 | 529 | } |
| 530 | 530 | } |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | * @subpackage dlf |
| 32 | 32 | * @access public |
| 33 | 33 | */ |
| 34 | -class Search extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 35 | -{ |
|
| 34 | +class Search extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 36 | 35 | public $scriptRelPath = 'Classes/Plugin/Search.php'; |
| 37 | 36 | |
| 38 | 37 | /** |
@@ -42,8 +41,7 @@ discard block |
||
| 42 | 41 | * |
| 43 | 42 | * @return void |
| 44 | 43 | */ |
| 45 | - protected function addAutocompleteJS() |
|
| 46 | - { |
|
| 44 | + protected function addAutocompleteJS() { |
|
| 47 | 45 | /** @var QueryBuilder $queryBuilder */ |
| 48 | 46 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 49 | 47 | ->getQueryBuilderForTable('tx_dlf_documents'); |
@@ -75,8 +73,7 @@ discard block |
||
| 75 | 73 | * |
| 76 | 74 | * @return string HTML input fields with current document's UID and parent ID |
| 77 | 75 | */ |
| 78 | - protected function addCurrentCollection() |
|
| 79 | - { |
|
| 76 | + protected function addCurrentCollection() { |
|
| 80 | 77 | // Load current collection. |
| 81 | 78 | $list = GeneralUtility::makeInstance(DocumentList::class); |
| 82 | 79 | if ( |
@@ -108,8 +105,7 @@ discard block |
||
| 108 | 105 | * |
| 109 | 106 | * @return string HTML input fields with current document's UID and parent ID |
| 110 | 107 | */ |
| 111 | - protected function addCurrentDocument() |
|
| 112 | - { |
|
| 108 | + protected function addCurrentDocument() { |
|
| 113 | 109 | // Load current list object. |
| 114 | 110 | $list = GeneralUtility::makeInstance(DocumentList::class); |
| 115 | 111 | // Load current document. |
@@ -142,8 +138,7 @@ discard block |
||
| 142 | 138 | * |
| 143 | 139 | * @return string HTML input fields with encrypted core name and hash |
| 144 | 140 | */ |
| 145 | - protected function addEncryptedCoreName() |
|
| 146 | - { |
|
| 141 | + protected function addEncryptedCoreName() { |
|
| 147 | 142 | // Get core name. |
| 148 | 143 | $name = Helper::getIndexNameFromUid($this->conf['solrcore'], 'tx_dlf_solrcores'); |
| 149 | 144 | // Encrypt core name. |
@@ -165,8 +160,7 @@ discard block |
||
| 165 | 160 | * |
| 166 | 161 | * @return string The extended search form or an empty string |
| 167 | 162 | */ |
| 168 | - protected function addExtendedSearch() |
|
| 169 | - { |
|
| 163 | + protected function addExtendedSearch() { |
|
| 170 | 164 | $extendedSearch = ''; |
| 171 | 165 | // Quit without doing anything if no fields for extended search are selected. |
| 172 | 166 | if ( |
@@ -204,8 +198,7 @@ discard block |
||
| 204 | 198 | * |
| 205 | 199 | * @return string HTML output of facets menu |
| 206 | 200 | */ |
| 207 | - protected function addFacetsMenu() |
|
| 208 | - { |
|
| 201 | + protected function addFacetsMenu() { |
|
| 209 | 202 | // Check for typoscript configuration to prevent fatal error. |
| 210 | 203 | if (empty($this->conf['facetsConf.'])) { |
| 211 | 204 | Helper::devLog('Incomplete plugin configuration', DEVLOG_SEVERITY_WARNING); |
@@ -239,8 +232,7 @@ discard block |
||
| 239 | 232 | * |
| 240 | 233 | * @return string HTML output of fulltext switch |
| 241 | 234 | */ |
| 242 | - protected function addFulltextSwitch($isFulltextSearch = 0) |
|
| 243 | - { |
|
| 235 | + protected function addFulltextSwitch($isFulltextSearch = 0) { |
|
| 244 | 236 | $output = ''; |
| 245 | 237 | // Check for plugin configuration. |
| 246 | 238 | if (!empty($this->conf['fulltext'])) { |
@@ -259,8 +251,7 @@ discard block |
||
| 259 | 251 | * |
| 260 | 252 | * @return string HTML output of logical page field |
| 261 | 253 | */ |
| 262 | - protected function addLogicalPage() |
|
| 263 | - { |
|
| 254 | + protected function addLogicalPage() { |
|
| 264 | 255 | $output = ''; |
| 265 | 256 | // Check for plugin configuration. |
| 266 | 257 | if (!empty($this->conf['showLogicalPageField'])) { |
@@ -283,8 +274,7 @@ discard block |
||
| 283 | 274 | * |
| 284 | 275 | * @return array The array for the facet's menu entry |
| 285 | 276 | */ |
| 286 | - protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) |
|
| 287 | - { |
|
| 277 | + protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
| 288 | 278 | $entryArray = []; |
| 289 | 279 | // Translate value. |
| 290 | 280 | if ($field == 'owner_faceting') { |
@@ -340,8 +330,7 @@ discard block |
||
| 340 | 330 | * |
| 341 | 331 | * @return string The content that is displayed on the website |
| 342 | 332 | */ |
| 343 | - public function main($content, $conf) |
|
| 344 | - { |
|
| 333 | + public function main($content, $conf) { |
|
| 345 | 334 | $this->init($conf); |
| 346 | 335 | // Disable caching for this plugin. |
| 347 | 336 | $this->setCache(FALSE); |
@@ -539,8 +528,7 @@ discard block |
||
| 539 | 528 | * |
| 540 | 529 | * @return array HMENU array |
| 541 | 530 | */ |
| 542 | - public function makeFacetsMenuArray($content, $conf) |
|
| 543 | - { |
|
| 531 | + public function makeFacetsMenuArray($content, $conf) { |
|
| 544 | 532 | $this->init($conf); |
| 545 | 533 | $menuArray = []; |
| 546 | 534 | // Set default value for facet search. |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | $separator = $this->pi_getLL('separator', ' - ', TRUE); |
| 86 | 86 | // Add link to previous page. |
| 87 | 87 | if ($this->piVars['pointer'] > 0) { |
| 88 | - $output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '<', TRUE), ['pointer' => $this->piVars['pointer'] - 1], TRUE) . $separator; |
|
| 88 | + $output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '<', TRUE), ['pointer' => $this->piVars['pointer'] - 1], TRUE).$separator; |
|
| 89 | 89 | } else { |
| 90 | - $output = $this->pi_getLL('prevPage', '<', TRUE) . $separator; |
|
| 90 | + $output = $this->pi_getLL('prevPage', '<', TRUE).$separator; |
|
| 91 | 91 | } |
| 92 | 92 | $i = 0; |
| 93 | 93 | $skip = NULL; |
@@ -95,13 +95,13 @@ discard block |
||
| 95 | 95 | while ($i < $maxPages) { |
| 96 | 96 | if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) { |
| 97 | 97 | if ($this->piVars['pointer'] != $i) { |
| 98 | - $output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1), ['pointer' => $i], TRUE) . $separator; |
|
| 98 | + $output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1), ['pointer' => $i], TRUE).$separator; |
|
| 99 | 99 | } else { |
| 100 | - $output .= sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1) . $separator; |
|
| 100 | + $output .= sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1).$separator; |
|
| 101 | 101 | } |
| 102 | 102 | $skip = TRUE; |
| 103 | 103 | } elseif ($skip === TRUE) { |
| 104 | - $output .= $this->pi_getLL('skip', '...', TRUE) . $separator; |
|
| 104 | + $output .= $this->pi_getLL('skip', '...', TRUE).$separator; |
|
| 105 | 105 | $skip = FALSE; |
| 106 | 106 | } |
| 107 | 107 | $i++; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | if (empty($value) && $this->conf['getTitle']) { |
| 148 | 148 | $superiorTitle = Document::getTitle($this->list[$number]['uid'], TRUE); |
| 149 | 149 | if (!empty($superiorTitle)) { |
| 150 | - $value = '[' . $superiorTitle . ']'; |
|
| 150 | + $value = '['.$superiorTitle.']'; |
|
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | // Set fake title if still not present. |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | // Add thumbnail. |
| 193 | 193 | if (!empty($this->list[$number]['thumbnail'])) { |
| 194 | - $markerArray['###THUMBNAIL###'] = '<img alt="' . $imgAlt . '" src="' . $this->list[$number]['thumbnail'] . '" />'; |
|
| 194 | + $markerArray['###THUMBNAIL###'] = '<img alt="'.$imgAlt.'" src="'.$this->list[$number]['thumbnail'].'" />'; |
|
| 195 | 195 | } |
| 196 | 196 | // Add preview. |
| 197 | 197 | if (!empty($this->list[$number]['preview'])) { |
@@ -257,28 +257,28 @@ discard block |
||
| 257 | 257 | $linkConf['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, ['logicalPage' => $this->piVars['logicalPage']], '', TRUE, FALSE); |
| 258 | 258 | } |
| 259 | 259 | // Build HTML form. |
| 260 | - $sorting = '<form action="' . $this->cObj->typoLink_URL($linkConf) . '" method="get"><div><input type="hidden" name="id" value="' . $GLOBALS['TSFE']->id . '" />'; |
|
| 260 | + $sorting = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />'; |
|
| 261 | 261 | foreach ($this->piVars as $piVar => $value) { |
| 262 | 262 | if ($piVar != 'order' && $piVar != 'DATA' && !empty($value)) { |
| 263 | - $sorting .= '<input type="hidden" name="' . $this->prefixId . '[' . $piVar . ']" value="' . $value . '" />'; |
|
| 263 | + $sorting .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />'; |
|
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | // Select sort field. |
| 267 | - $uniqId = uniqid($prefix . '-'); |
|
| 268 | - $sorting .= '<label for="' . $uniqId . '">' . $this->pi_getLL('orderBy', '', TRUE) . '</label><select id="' . $uniqId . '" name="' . $this->prefixId . '[order]" onchange="javascript:this.form.submit();">'; |
|
| 267 | + $uniqId = uniqid($prefix.'-'); |
|
| 268 | + $sorting .= '<label for="'.$uniqId.'">'.$this->pi_getLL('orderBy', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[order]" onchange="javascript:this.form.submit();">'; |
|
| 269 | 269 | // Add relevance sorting if this is a search result list. |
| 270 | 270 | if ($this->list->metadata['options']['source'] == 'search') { |
| 271 | - $sorting .= '<option value="score"' . (($this->list->metadata['options']['order'] == 'score') ? ' selected="selected"' : '') . '>' . $this->pi_getLL('relevance', '', TRUE) . '</option>'; |
|
| 271 | + $sorting .= '<option value="score"'.(($this->list->metadata['options']['order'] == 'score') ? ' selected="selected"' : '').'>'.$this->pi_getLL('relevance', '', TRUE).'</option>'; |
|
| 272 | 272 | } |
| 273 | 273 | foreach ($this->sortables as $index_name => $label) { |
| 274 | - $sorting .= '<option value="' . $index_name . '"' . (($this->list->metadata['options']['order'] == $index_name) ? ' selected="selected"' : '') . '>' . htmlspecialchars($label) . '</option>'; |
|
| 274 | + $sorting .= '<option value="'.$index_name.'"'.(($this->list->metadata['options']['order'] == $index_name) ? ' selected="selected"' : '').'>'.htmlspecialchars($label).'</option>'; |
|
| 275 | 275 | } |
| 276 | 276 | $sorting .= '</select>'; |
| 277 | 277 | // Select sort direction. |
| 278 | - $uniqId = uniqid($prefix . '-'); |
|
| 279 | - $sorting .= '<label for="' . $uniqId . '">' . $this->pi_getLL('direction', '', TRUE) . '</label><select id="' . $uniqId . '" name="' . $this->prefixId . '[asc]" onchange="javascript:this.form.submit();">'; |
|
| 280 | - $sorting .= '<option value="1" ' . ($this->list->metadata['options']['order.asc'] ? ' selected="selected"' : '') . '>' . $this->pi_getLL('direction.asc', '', TRUE) . '</option>'; |
|
| 281 | - $sorting .= '<option value="0" ' . (!$this->list->metadata['options']['order.asc'] ? ' selected="selected"' : '') . '>' . $this->pi_getLL('direction.desc', '', TRUE) . '</option>'; |
|
| 278 | + $uniqId = uniqid($prefix.'-'); |
|
| 279 | + $sorting .= '<label for="'.$uniqId.'">'.$this->pi_getLL('direction', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[asc]" onchange="javascript:this.form.submit();">'; |
|
| 280 | + $sorting .= '<option value="1" '.($this->list->metadata['options']['order.asc'] ? ' selected="selected"' : '').'>'.$this->pi_getLL('direction.asc', '', TRUE).'</option>'; |
|
| 281 | + $sorting .= '<option value="0" '.(!$this->list->metadata['options']['order.asc'] ? ' selected="selected"' : '').'>'.$this->pi_getLL('direction.desc', '', TRUE).'</option>'; |
|
| 282 | 282 | $sorting .= '</select></div></form>'; |
| 283 | 283 | return $sorting; |
| 284 | 284 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | if (empty($value) && $this->conf['getTitle']) { |
| 315 | 315 | $superiorTitle = Document::getTitle($subpart['uid'], TRUE); |
| 316 | 316 | if (!empty($superiorTitle)) { |
| 317 | - $value = '[' . $superiorTitle . ']'; |
|
| 317 | + $value = '['.$superiorTitle.']'; |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | // Set fake title if still not present. |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | $value = htmlspecialchars(Helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
| 345 | 345 | // Add page number for single pages. |
| 346 | 346 | if ($_value == 'page') { |
| 347 | - $value .= ' ' . intval($subpart['page']); |
|
| 347 | + $value .= ' '.intval($subpart['page']); |
|
| 348 | 348 | } |
| 349 | 349 | } elseif ($index_name == 'language' && !empty($value)) { // Translate ISO 639 language code. |
| 350 | 350 | $value = htmlspecialchars(Helper::getLanguageName($value)); |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | } |
| 365 | 365 | // Add thumbnail. |
| 366 | 366 | if (!empty($subpart['thumbnail'])) { |
| 367 | - $markerArray['###SUBTHUMBNAIL###'] = '<img alt="' . $imgAlt . '" src="' . $subpart['thumbnail'] . '" />'; |
|
| 367 | + $markerArray['###SUBTHUMBNAIL###'] = '<img alt="'.$imgAlt.'" src="'.$subpart['thumbnail'].'" />'; |
|
| 368 | 368 | } |
| 369 | 369 | // Add preview. |
| 370 | 370 | if (!empty($subpart['preview'])) { |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | || (isset($this->piVars['asc']) && $this->piVars['asc'] != $listMetadata['options']['order.asc']) |
| 478 | 478 | ) { |
| 479 | 479 | // Update list's metadata. |
| 480 | - $listMetadata['options']['params']['sort'] = [$this->piVars['order'] . "_sorting" => (bool) $this->piVars['asc'] ? 'asc' : 'desc']; |
|
| 480 | + $listMetadata['options']['params']['sort'] = [$this->piVars['order']."_sorting" => (bool) $this->piVars['asc'] ? 'asc' : 'desc']; |
|
| 481 | 481 | $listMetadata['options']['order'] = $this->piVars['order']; |
| 482 | 482 | $listMetadata['options']['order.asc'] = (bool) $this->piVars['asc']; |
| 483 | 483 | // Reset pointer. |
@@ -495,13 +495,13 @@ discard block |
||
| 495 | 495 | return $content; |
| 496 | 496 | } |
| 497 | 497 | // Set search parameters. |
| 498 | - $solr->cPid = $listMetadata['options']['pid']; |
|
| 498 | + $solr->cPid = $listMetadata['options']['pid']; |
|
| 499 | 499 | $solr->params = $listMetadata['options']['params']; |
| 500 | 500 | // Perform search. |
| 501 | 501 | $this->list = $solr->search(); |
| 502 | 502 | } |
| 503 | 503 | // Add list description |
| 504 | - $listMetadata['description'] = '<p class="tx-dlf-search-numHits">' . htmlspecialchars(sprintf($this->pi_getLL('hits', ''), $this->list->metadata['options']['numberOfHits'], $this->list->metadata['options']['numberOfToplevelHits'])) . '</p>'; |
|
| 504 | + $listMetadata['description'] = '<p class="tx-dlf-search-numHits">'.htmlspecialchars(sprintf($this->pi_getLL('hits', ''), $this->list->metadata['options']['numberOfHits'], $this->list->metadata['options']['numberOfToplevelHits'])).'</p>'; |
|
| 505 | 505 | $this->list->metadata = $listMetadata; |
| 506 | 506 | // Save updated list. |
| 507 | 507 | $this->list->save(); |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | $markerArray['###LISTTITLE###'] = $this->list->metadata['label']; |
| 531 | 531 | $markerArray['###LISTDESCRIPTION###'] = $this->list->metadata['description']; |
| 532 | 532 | if (!empty($this->list->metadata['thumbnail'])) { |
| 533 | - $markerArray['###LISTTHUMBNAIL###'] = '<img alt="" src="' . $this->list->metadata['thumbnail'] . '" />'; |
|
| 533 | + $markerArray['###LISTTHUMBNAIL###'] = '<img alt="" src="'.$this->list->metadata['thumbnail'].'" />'; |
|
| 534 | 534 | } else { |
| 535 | 535 | $markerArray['###LISTTHUMBNAIL###'] = ''; |
| 536 | 536 | } |
@@ -30,8 +30,7 @@ discard block |
||
| 30 | 30 | * @subpackage dlf |
| 31 | 31 | * @access public |
| 32 | 32 | */ |
| 33 | -class ListView extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 34 | -{ |
|
| 33 | +class ListView extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 35 | 34 | public $scriptRelPath = 'Classes/Plugin/ListView.php'; |
| 36 | 35 | |
| 37 | 36 | /** |
@@ -73,8 +72,7 @@ discard block |
||
| 73 | 72 | * |
| 74 | 73 | * @return string The rendered page browser ready for output |
| 75 | 74 | */ |
| 76 | - protected function getPageBrowser() |
|
| 77 | - { |
|
| 75 | + protected function getPageBrowser() { |
|
| 78 | 76 | // Get overall number of pages. |
| 79 | 77 | $maxPages = intval(ceil($this->list->metadata['options']['numberOfToplevelHits'] / $this->conf['limit'])); |
| 80 | 78 | // Return empty pagebrowser if there is just one page. |
@@ -125,8 +123,7 @@ discard block |
||
| 125 | 123 | * |
| 126 | 124 | * @return string The rendered entry ready for output |
| 127 | 125 | */ |
| 128 | - protected function getEntry($number, $template) |
|
| 129 | - { |
|
| 126 | + protected function getEntry($number, $template) { |
|
| 130 | 127 | $markerArray['###NUMBER###'] = $number + 1; |
| 131 | 128 | $markerArray['###METADATA###'] = ''; |
| 132 | 129 | $markerArray['###THUMBNAIL###'] = ''; |
@@ -168,11 +165,14 @@ discard block |
||
| 168 | 165 | 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE) |
| 169 | 166 | ]; |
| 170 | 167 | $value = $this->cObj->typoLink(htmlspecialchars($value), $conf); |
| 171 | - } elseif ($index_name == 'owner' && !empty($value)) { // Translate name of holding library. |
|
| 168 | + } elseif ($index_name == 'owner' && !empty($value)) { |
|
| 169 | +// Translate name of holding library. |
|
| 172 | 170 | $value = htmlspecialchars(Helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
| 173 | - } elseif ($index_name == 'type' && !empty($value)) { // Translate document type. |
|
| 171 | + } elseif ($index_name == 'type' && !empty($value)) { |
|
| 172 | +// Translate document type. |
|
| 174 | 173 | $value = htmlspecialchars(Helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
| 175 | - } elseif ($index_name == 'language' && !empty($value)) { // Translate ISO 639 language code. |
|
| 174 | + } elseif ($index_name == 'language' && !empty($value)) { |
|
| 175 | +// Translate ISO 639 language code. |
|
| 176 | 176 | $value = htmlspecialchars(Helper::getLanguageName($value)); |
| 177 | 177 | } elseif (!empty($value)) { |
| 178 | 178 | $value = htmlspecialchars($value); |
@@ -225,8 +225,7 @@ discard block |
||
| 225 | 225 | * |
| 226 | 226 | * @return array The parsed fieldwrap |
| 227 | 227 | */ |
| 228 | - private function getFieldWrap($index_name, $wrap) |
|
| 229 | - { |
|
| 228 | + private function getFieldWrap($index_name, $wrap) { |
|
| 230 | 229 | if (isset($this->fieldwrap[$index_name])) { |
| 231 | 230 | return $this->fieldwrap[$index_name]; |
| 232 | 231 | } else { |
@@ -241,8 +240,7 @@ discard block |
||
| 241 | 240 | * |
| 242 | 241 | * @return string The rendered sorting dialog ready for output |
| 243 | 242 | */ |
| 244 | - protected function getSortingForm() |
|
| 245 | - { |
|
| 243 | + protected function getSortingForm() { |
|
| 246 | 244 | // Return nothing if there are no sortable metadata fields. |
| 247 | 245 | if (!count($this->sortables)) { |
| 248 | 246 | return ''; |
@@ -293,8 +291,7 @@ discard block |
||
| 293 | 291 | * |
| 294 | 292 | * @return string The rendered entries ready for output |
| 295 | 293 | */ |
| 296 | - protected function getSubEntries($number, $template) |
|
| 297 | - { |
|
| 294 | + protected function getSubEntries($number, $template) { |
|
| 298 | 295 | $content = ''; |
| 299 | 296 | $noTitle = $this->pi_getLL('noTitle'); |
| 300 | 297 | $highlight_word = preg_replace('/\s\s+/', ';', $this->list->metadata['searchString']); |
@@ -337,16 +334,19 @@ discard block |
||
| 337 | 334 | 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE) |
| 338 | 335 | ]; |
| 339 | 336 | $value = $this->cObj->typoLink(htmlspecialchars($value), $conf); |
| 340 | - } elseif ($index_name == 'owner' && !empty($value)) { // Translate name of holding library. |
|
| 337 | + } elseif ($index_name == 'owner' && !empty($value)) { |
|
| 338 | +// Translate name of holding library. |
|
| 341 | 339 | $value = htmlspecialchars(Helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
| 342 | - } elseif ($index_name == 'type' && !empty($value)) { // Translate document type. |
|
| 340 | + } elseif ($index_name == 'type' && !empty($value)) { |
|
| 341 | +// Translate document type. |
|
| 343 | 342 | $_value = $value; |
| 344 | 343 | $value = htmlspecialchars(Helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
| 345 | 344 | // Add page number for single pages. |
| 346 | 345 | if ($_value == 'page') { |
| 347 | 346 | $value .= ' ' . intval($subpart['page']); |
| 348 | 347 | } |
| 349 | - } elseif ($index_name == 'language' && !empty($value)) { // Translate ISO 639 language code. |
|
| 348 | + } elseif ($index_name == 'language' && !empty($value)) { |
|
| 349 | +// Translate ISO 639 language code. |
|
| 350 | 350 | $value = htmlspecialchars(Helper::getLanguageName($value)); |
| 351 | 351 | } elseif (!empty($value)) { |
| 352 | 352 | $value = htmlspecialchars($value); |
@@ -394,8 +394,7 @@ discard block |
||
| 394 | 394 | * |
| 395 | 395 | * @return void |
| 396 | 396 | */ |
| 397 | - protected function loadConfig() |
|
| 398 | - { |
|
| 397 | + protected function loadConfig() { |
|
| 399 | 398 | /** @var QueryBuilder $queryBuilder */ |
| 400 | 399 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 401 | 400 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
@@ -442,8 +441,7 @@ discard block |
||
| 442 | 441 | * |
| 443 | 442 | * @return string The content that is displayed on the website |
| 444 | 443 | */ |
| 445 | - public function main($content, $conf) |
|
| 446 | - { |
|
| 444 | + public function main($content, $conf) { |
|
| 447 | 445 | $this->init($conf); |
| 448 | 446 | // Don't cache the output. |
| 449 | 447 | $this->setCache(FALSE); |
@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | * @subpackage dlf |
| 21 | 21 | * @access public |
| 22 | 22 | */ |
| 23 | -class Validator extends \Kitodo\Dlf\Common\AbstractPlugin |
|
| 24 | -{ |
|
| 23 | +class Validator extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
| 25 | 24 | public $scriptRelPath = 'Classes/Plugin/Validator.php'; |
| 26 | 25 | |
| 27 | 26 | /** |
@@ -34,8 +33,7 @@ discard block |
||
| 34 | 33 | * |
| 35 | 34 | * @return string The content that is displayed on the website |
| 36 | 35 | */ |
| 37 | - public function main($content, $conf) |
|
| 38 | - { |
|
| 36 | + public function main($content, $conf) { |
|
| 39 | 37 | $this->init($conf); |
| 40 | 38 | // Disable caching for this plugin. |
| 41 | 39 | $this->setCache(FALSE); |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | } |
| 83 | 83 | // Append "valueURI" to name using Unicode unit separator. |
| 84 | 84 | if (isset($authors[$i]['valueURI'])) { |
| 85 | - $metadata['author'][$i] .= chr(31) . (string) $authors[$i]['valueURI']; |
|
| 85 | + $metadata['author'][$i] .= chr(31).(string) $authors[$i]['valueURI']; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | * @subpackage dlf |
| 21 | 21 | * @access public |
| 22 | 22 | */ |
| 23 | -class Mods implements \Kitodo\Dlf\Common\MetadataInterface |
|
| 24 | -{ |
|
| 23 | +class Mods implements \Kitodo\Dlf\Common\MetadataInterface { |
|
| 25 | 24 | /** |
| 26 | 25 | * This extracts the essential MODS metadata from XML |
| 27 | 26 | * |
@@ -32,8 +31,7 @@ discard block |
||
| 32 | 31 | * |
| 33 | 32 | * @return void |
| 34 | 33 | */ |
| 35 | - public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) |
|
| 36 | - { |
|
| 34 | + public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) { |
|
| 37 | 35 | $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); |
| 38 | 36 | // Get "author" and "author_sorting". |
| 39 | 37 | $authors = $xml->xpath('./mods:name[./mods:role/mods:roleTerm[@type="code" and @authority="marcrelator"]="aut"]'); |