@@ -55,7 +55,7 @@ |
||
55 | 55 | $uptimeInSeconds = floor($response->getUptime() / 1000); |
56 | 56 | $dateTimeFrom = new \DateTime('@0'); |
57 | 57 | $dateTimeTo = new \DateTime("@$uptimeInSeconds"); |
58 | - $uptime = $dateTimeFrom->diff($dateTimeTo)->format('%a ' . $GLOBALS['LANG']->getLL('flash.days') . ', %H:%I:%S'); |
|
58 | + $uptime = $dateTimeFrom->diff($dateTimeTo)->format('%a '.$GLOBALS['LANG']->getLL('flash.days').', %H:%I:%S'); |
|
59 | 59 | $numDocuments = $response->getNumberOfDocuments(); |
60 | 60 | $startTime = $response->getStartTime() ? strftime('%c', $response->getStartTime()->getTimestamp()) : 'N/A'; |
61 | 61 | $lastModified = $response->getLastModified() ? strftime('%c', $response->getLastModified()->getTimestamp()) : 'N/A'; |
@@ -24,8 +24,7 @@ |
||
24 | 24 | * @subpackage dlf |
25 | 25 | * @access public |
26 | 26 | */ |
27 | -class SolrCoreStatus extends AbstractNode |
|
28 | -{ |
|
27 | +class SolrCoreStatus extends AbstractNode { |
|
29 | 28 | /** |
30 | 29 | * Shows Solr core status for given 'index_name' |
31 | 30 | * |
@@ -23,8 +23,7 @@ |
||
23 | 23 | * @subpackage dlf |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class EditInProductionWarning extends AbstractNode |
|
27 | -{ |
|
26 | +class EditInProductionWarning extends AbstractNode { |
|
28 | 27 | /** |
29 | 28 | * Generates warning message when editing 'index_name' field |
30 | 29 | * |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $label = htmlspecialchars($this->pi_getLL('addBasket', '')); |
182 | 182 | $params = [ |
183 | 183 | 'id' => $this->piVars['id'], |
184 | - 'addToBasket' => true |
|
184 | + 'addToBasket' => TRUE |
|
185 | 185 | ]; |
186 | 186 | if (empty($this->piVars['page'])) { |
187 | 187 | $params['page'] = 1; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | 'parameter' => $this->conf['targetBasket'], |
191 | 191 | 'forceAbsoluteUrl' => !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0, |
192 | 192 | 'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'], |
193 | - 'additionalParams' => GeneralUtility::implodeArrayForUrl($this->prefixId, $params, '', true, false), |
|
193 | + 'additionalParams' => GeneralUtility::implodeArrayForUrl($this->prefixId, $params, '', TRUE, FALSE), |
|
194 | 194 | 'title' => $label |
195 | 195 | ]; |
196 | 196 | $output = '<form id="addToBasketForm" action="' . $this->cObj->typoLink_URL($basketConf) . '" method="post">'; |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | if ($iiif instanceof ManifestInterface) { |
305 | 305 | $canvas = $iiif->getContainedResourceById($canvasId); |
306 | 306 | /* @var $canvas \Ubl\Iiif\Presentation\Common\Model\Resources\CanvasInterface */ |
307 | - if ($canvas != null && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
307 | + if ($canvas != NULL && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
|
308 | 308 | $annotationContainers = []; |
309 | 309 | /* |
310 | 310 | * TODO Analyzing the annotations on the server side requires loading the annotation lists / pages |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | * On the other hand, server connections are potentially better than client connections. Downloading annotation lists |
315 | 315 | */ |
316 | 316 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
317 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
317 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
318 | 318 | foreach ($textAnnotations as $annotation) { |
319 | 319 | if ( |
320 | 320 | $annotation->getBody()->getFormat() == 'text/plain' |
321 | - && $annotation->getBody()->getChars() != null |
|
321 | + && $annotation->getBody()->getChars() != NULL |
|
322 | 322 | ) { |
323 | 323 | $annotationListData = []; |
324 | 324 | $annotationListData['uri'] = $annotationContainer->getId(); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | // Load current document. |
361 | 361 | $this->loadDocument(); |
362 | 362 | if ( |
363 | - $this->doc === null |
|
363 | + $this->doc === NULL |
|
364 | 364 | || $this->doc->numPages < 1 |
365 | 365 | ) { |
366 | 366 | // Quit without doing anything if required variables are not set. |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | * @subpackage dlf |
29 | 29 | * @access public |
30 | 30 | */ |
31 | -class PageView extends \Kitodo\Dlf\Common\AbstractPlugin |
|
32 | -{ |
|
31 | +class PageView extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
33 | 32 | public $scriptRelPath = 'Classes/Plugin/PageView.php'; |
34 | 33 | |
35 | 34 | /** |
@@ -71,8 +70,7 @@ discard block |
||
71 | 70 | * |
72 | 71 | * @return void |
73 | 72 | */ |
74 | - protected function addViewerJS() |
|
75 | - { |
|
73 | + protected function addViewerJS() { |
|
76 | 74 | // Viewer configuration. |
77 | 75 | $viewerConfiguration = ' |
78 | 76 | $(document).ready(function() { |
@@ -100,8 +98,7 @@ discard block |
||
100 | 98 | * |
101 | 99 | * @return array Marker array |
102 | 100 | */ |
103 | - protected function addInteraction() |
|
104 | - { |
|
101 | + protected function addInteraction() { |
|
105 | 102 | $markerArray = []; |
106 | 103 | if ($this->piVars['id']) { |
107 | 104 | if ($this->conf['crop']) { |
@@ -127,8 +124,7 @@ discard block |
||
127 | 124 | * |
128 | 125 | * @return array Marker array |
129 | 126 | */ |
130 | - protected function addBasketForm() |
|
131 | - { |
|
127 | + protected function addBasketForm() { |
|
132 | 128 | $markerArray = []; |
133 | 129 | // Add basket button |
134 | 130 | if ($this->conf['basketButton'] && $this->conf['targetBasket'] && $this->piVars['id']) { |
@@ -176,8 +172,7 @@ discard block |
||
176 | 172 | * |
177 | 173 | * @return array URL and MIME type of image file |
178 | 174 | */ |
179 | - protected function getImage($page) |
|
180 | - { |
|
175 | + protected function getImage($page) { |
|
181 | 176 | $image = []; |
182 | 177 | // Get @USE value of METS fileGrp. |
183 | 178 | $fileGrpsImages = GeneralUtility::trimExplode(',', $this->conf['fileGrpImages']); |
@@ -213,8 +208,7 @@ discard block |
||
213 | 208 | * |
214 | 209 | * @return array URL and MIME type of fulltext file |
215 | 210 | */ |
216 | - protected function getFulltext($page) |
|
217 | - { |
|
211 | + protected function getFulltext($page) { |
|
218 | 212 | $fulltext = []; |
219 | 213 | // Get fulltext link. |
220 | 214 | $fileGrpsFulltext = GeneralUtility::trimExplode(',', $this->conf['fileGrpFulltext']); |
@@ -250,8 +244,7 @@ discard block |
||
250 | 244 | * @return array An array containing the IRIs of the AnnotationLists / AnnotationPages as well as |
251 | 245 | * some information about the canvas. |
252 | 246 | */ |
253 | - protected function getAnnotationContainers($page) |
|
254 | - { |
|
247 | + protected function getAnnotationContainers($page) { |
|
255 | 248 | if ($this->doc instanceof IiifManifest) { |
256 | 249 | $canvasId = $this->doc->physicalStructure[$page]; |
257 | 250 | $iiif = $this->doc->getIiif(); |
@@ -308,8 +301,7 @@ discard block |
||
308 | 301 | * |
309 | 302 | * @return string The content that is displayed on the website |
310 | 303 | */ |
311 | - public function main($content, $conf) |
|
312 | - { |
|
304 | + public function main($content, $conf) { |
|
313 | 305 | $this->init($conf); |
314 | 306 | // Load current document. |
315 | 307 | $this->loadDocument(); |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $(document).ready(function() { |
79 | 79 | if (dlfUtils.exists(dlfViewer)) { |
80 | 80 | tx_dlf_viewer = new dlfViewer({ |
81 | - controls: ["' . implode('", "', $this->controls) . '"], |
|
82 | - div: "' . $this->conf['elementId'] . '", |
|
83 | - images: ' . json_encode($this->images) . ', |
|
84 | - fulltexts: ' . json_encode($this->fulltexts) . ', |
|
85 | - annotationContainers: ' . json_encode($this->annotationContainers) . ', |
|
86 | - useInternalProxy: ' . ($this->conf['useInternalProxy'] ? 1 : 0) . ' |
|
81 | + controls: ["' . implode('", "', $this->controls).'"], |
|
82 | + div: "' . $this->conf['elementId'].'", |
|
83 | + images: ' . json_encode($this->images).', |
|
84 | + fulltexts: ' . json_encode($this->fulltexts).', |
|
85 | + annotationContainers: ' . json_encode($this->annotationContainers).', |
|
86 | + useInternalProxy: ' . ($this->conf['useInternalProxy'] ? 1 : 0).' |
|
87 | 87 | }); |
88 | 88 | } |
89 | 89 | }); |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | $markerArray = []; |
106 | 106 | if ($this->piVars['id']) { |
107 | 107 | if ($this->conf['crop']) { |
108 | - $markerArray['###EDITBUTTON###'] = '<a href="javascript: tx_dlf_viewer.activateSelection();" title="' . htmlspecialchars($this->pi_getLL('editMode', '')) . '">' . htmlspecialchars($this->pi_getLL('editMode', '')) . '</a>'; |
|
109 | - $markerArray['###EDITREMOVE###'] = '<a href="javascript: tx_dlf_viewer.resetCropSelection();" title="' . htmlspecialchars($this->pi_getLL('editRemove', '')) . '">' . htmlspecialchars($this->pi_getLL('editRemove', '')) . '</a>'; |
|
108 | + $markerArray['###EDITBUTTON###'] = '<a href="javascript: tx_dlf_viewer.activateSelection();" title="'.htmlspecialchars($this->pi_getLL('editMode', '')).'">'.htmlspecialchars($this->pi_getLL('editMode', '')).'</a>'; |
|
109 | + $markerArray['###EDITREMOVE###'] = '<a href="javascript: tx_dlf_viewer.resetCropSelection();" title="'.htmlspecialchars($this->pi_getLL('editRemove', '')).'">'.htmlspecialchars($this->pi_getLL('editRemove', '')).'</a>'; |
|
110 | 110 | } else { |
111 | 111 | $markerArray['###EDITBUTTON###'] = ''; |
112 | 112 | $markerArray['###EDITREMOVE###'] = ''; |
113 | 113 | } |
114 | 114 | if ($this->conf['magnifier']) { |
115 | - $markerArray['###MAGNIFIER###'] = '<a href="javascript: tx_dlf_viewer.activateMagnifier();" title="' . htmlspecialchars($this->pi_getLL('magnifier', '')) . '">' . htmlspecialchars($this->pi_getLL('magnifier', '')) . '</a>'; |
|
115 | + $markerArray['###MAGNIFIER###'] = '<a href="javascript: tx_dlf_viewer.activateMagnifier();" title="'.htmlspecialchars($this->pi_getLL('magnifier', '')).'">'.htmlspecialchars($this->pi_getLL('magnifier', '')).'</a>'; |
|
116 | 116 | } else { |
117 | 117 | $markerArray['###MAGNIFIER###'] = ''; |
118 | 118 | } |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | 'additionalParams' => GeneralUtility::implodeArrayForUrl($this->prefixId, $params, '', true, false), |
148 | 148 | 'title' => $label |
149 | 149 | ]; |
150 | - $output = '<form id="addToBasketForm" action="' . $this->cObj->typoLink_URL($basketConf) . '" method="post">'; |
|
151 | - $output .= '<input type="hidden" name="tx_dlf[startpage]" id="startpage" value="' . htmlspecialchars($this->piVars['page']) . '">'; |
|
152 | - $output .= '<input type="hidden" name="tx_dlf[endpage]" id="endpage" value="' . htmlspecialchars($this->piVars['page']) . '">'; |
|
150 | + $output = '<form id="addToBasketForm" action="'.$this->cObj->typoLink_URL($basketConf).'" method="post">'; |
|
151 | + $output .= '<input type="hidden" name="tx_dlf[startpage]" id="startpage" value="'.htmlspecialchars($this->piVars['page']).'">'; |
|
152 | + $output .= '<input type="hidden" name="tx_dlf[endpage]" id="endpage" value="'.htmlspecialchars($this->piVars['page']).'">'; |
|
153 | 153 | $output .= '<input type="hidden" name="tx_dlf[startX]" id="startX">'; |
154 | 154 | $output .= '<input type="hidden" name="tx_dlf[startY]" id="startY">'; |
155 | 155 | $output .= '<input type="hidden" name="tx_dlf[endX]" id="endX">'; |
156 | 156 | $output .= '<input type="hidden" name="tx_dlf[endY]" id="endY">'; |
157 | 157 | $output .= '<input type="hidden" name="tx_dlf[rotation]" id="rotation">'; |
158 | - $output .= '<button id="submitBasketForm" onclick="this.form.submit()">' . $label . '</button>'; |
|
158 | + $output .= '<button id="submitBasketForm" onclick="this.form.submit()">'.$label.'</button>'; |
|
159 | 159 | $output .= '</form>'; |
160 | 160 | $output .= '<script>'; |
161 | 161 | $output .= '$(document).ready(function() { $("#submitBasketForm").click(function() { $("#addToBasketForm").submit(); }); });'; |
@@ -191,18 +191,18 @@ discard block |
||
191 | 191 | 'parameter' => $GLOBALS['TSFE']->id, |
192 | 192 | 'forceAbsoluteUrl' => !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0, |
193 | 193 | 'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'], |
194 | - 'additionalParams' => '&eID=tx_dlf_pageview_proxy&url=' . urlencode($image['url']), |
|
194 | + 'additionalParams' => '&eID=tx_dlf_pageview_proxy&url='.urlencode($image['url']), |
|
195 | 195 | ]; |
196 | 196 | $image['url'] = $this->cObj->typoLink_URL($linkConf); |
197 | 197 | } |
198 | 198 | $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrpImages]); |
199 | 199 | break; |
200 | 200 | } else { |
201 | - $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"'); |
|
201 | + $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"'); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | if (empty($image)) { |
205 | - $this->logger->warning('No image file found for page "' . $page . '" in fileGrps "' . $this->conf['fileGrpImages'] . '"'); |
|
205 | + $this->logger->warning('No image file found for page "'.$page.'" in fileGrps "'.$this->conf['fileGrpImages'].'"'); |
|
206 | 206 | } |
207 | 207 | return $image; |
208 | 208 | } |
@@ -230,18 +230,18 @@ discard block |
||
230 | 230 | 'parameter' => $GLOBALS['TSFE']->id, |
231 | 231 | 'forceAbsoluteUrl' => !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0, |
232 | 232 | 'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'], |
233 | - 'additionalParams' => '&eID=tx_dlf_pageview_proxy&url=' . urlencode($fulltext['url']), |
|
233 | + 'additionalParams' => '&eID=tx_dlf_pageview_proxy&url='.urlencode($fulltext['url']), |
|
234 | 234 | ]; |
235 | 235 | $fulltext['url'] = $this->cObj->typoLink_URL($linkConf); |
236 | 236 | } |
237 | 237 | $fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrpFulltext]); |
238 | 238 | break; |
239 | 239 | } else { |
240 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrp "' . $fileGrpFulltext . '"'); |
|
240 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrp "'.$fileGrpFulltext.'"'); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | if (empty($fulltext)) { |
244 | - $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrps "' . $this->conf['fileGrpFulltext'] . '"'); |
|
244 | + $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrps "'.$this->conf['fileGrpFulltext'].'"'); |
|
245 | 245 | } |
246 | 246 | return $fulltext; |
247 | 247 | } |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | protected function printContent() |
101 | 101 | { |
102 | 102 | $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); |
103 | - $this->doc->setModuleTemplate('EXT:' . $this->extKey . '/Resources/Private/Templates/' . Helper::getUnqualifiedClassName(get_class($this)) . '.tmpl'); |
|
103 | + $this->doc->setModuleTemplate('EXT:'.$this->extKey.'/Resources/Private/Templates/'.Helper::getUnqualifiedClassName(get_class($this)).'.tmpl'); |
|
104 | 104 | $this->doc->backPath = $GLOBALS['BACK_PATH']; |
105 | - $this->doc->bodyTagAdditions = 'class="ext-' . $this->extKey . '-modules"'; |
|
105 | + $this->doc->bodyTagAdditions = 'class="ext-'.$this->extKey.'-modules"'; |
|
106 | 106 | $this->doc->form = '<form action="" method="post" enctype="multipart/form-data">'; |
107 | 107 | // Add Javascript for function menu. |
108 | 108 | $this->doc->JScode .= '<script type="text/javascript">script_ended = 0;function jumpToUrl(URL) { document.location = URL; }</script>'; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title')); |
113 | 113 | // Set defaults for menu. |
114 | 114 | if (empty($this->markerArray['CSH'])) { |
115 | - $this->markerArray['CSH'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_' . $GLOBALS['MCONF']['name'], 'csh'); |
|
115 | + $this->markerArray['CSH'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_'.$GLOBALS['MCONF']['name'], 'csh'); |
|
116 | 116 | } |
117 | 117 | if (empty($this->markerArray['MOD_MENU'])) { |
118 | 118 | $this->markerArray['MOD_MENU'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function __construct() |
133 | 133 | { |
134 | - $GLOBALS['LANG']->includeLLFile('EXT:' . $this->extKey . '/Resources/Private/Language/' . Helper::getUnqualifiedClassName(get_class($this)) . '.xml'); |
|
134 | + $GLOBALS['LANG']->includeLLFile('EXT:'.$this->extKey.'/Resources/Private/Language/'.Helper::getUnqualifiedClassName(get_class($this)).'.xml'); |
|
135 | 135 | // Read extension configuration. |
136 | 136 | if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][$this->extKey]) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][$this->extKey])) { |
137 | 137 | $this->conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get($this->extKey); |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | * @access public |
25 | 25 | * @abstract |
26 | 26 | */ |
27 | -abstract class AbstractModule extends \TYPO3\CMS\Backend\Module\BaseScriptClass |
|
28 | -{ |
|
27 | +abstract class AbstractModule extends \TYPO3\CMS\Backend\Module\BaseScriptClass { |
|
29 | 28 | public $extKey = 'dlf'; |
30 | 29 | public $prefixId = 'tx_dlf'; |
31 | 30 | |
@@ -97,8 +96,7 @@ discard block |
||
97 | 96 | * |
98 | 97 | * @return string |
99 | 98 | */ |
100 | - protected function printContent() |
|
101 | - { |
|
99 | + protected function printContent() { |
|
102 | 100 | $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); |
103 | 101 | $this->doc->setModuleTemplate('EXT:' . $this->extKey . '/Resources/Private/Templates/' . Helper::getUnqualifiedClassName(get_class($this)) . '.tmpl'); |
104 | 102 | $this->doc->backPath = $GLOBALS['BACK_PATH']; |
@@ -129,8 +127,7 @@ discard block |
||
129 | 127 | * |
130 | 128 | * @return void |
131 | 129 | */ |
132 | - public function __construct() |
|
133 | - { |
|
130 | + public function __construct() { |
|
134 | 131 | $GLOBALS['LANG']->includeLLFile('EXT:' . $this->extKey . '/Resources/Private/Language/' . Helper::getUnqualifiedClassName(get_class($this)) . '.xml'); |
135 | 132 | // Read extension configuration. |
136 | 133 | if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][$this->extKey]) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][$this->extKey])) { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @var bool |
38 | 38 | * @access protected |
39 | 39 | */ |
40 | - protected $error = false; |
|
40 | + protected $error = FALSE; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * This holds the OAI DOM object |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function error($type) |
110 | 110 | { |
111 | - $this->error = true; |
|
111 | + $this->error = TRUE; |
|
112 | 112 | $error = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'error', htmlspecialchars($this->pi_getLL($type, $type), ENT_NOQUOTES, 'UTF-8')); |
113 | 113 | $error->setAttribute('code', $type); |
114 | 114 | return $error; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | */ |
298 | 298 | protected function getMetsData(array $metadata) |
299 | 299 | { |
300 | - $mets = null; |
|
300 | + $mets = NULL; |
|
301 | 301 | // Load METS file. |
302 | 302 | $xml = new \DOMDocument(); |
303 | 303 | if ($xml->load($metadata['location'])) { |
@@ -305,14 +305,14 @@ discard block |
||
305 | 305 | $root = $xml->getElementsByTagNameNS($this->formats['mets']['namespace'], 'mets'); |
306 | 306 | if ($root->item(0) instanceof \DOMNode) { |
307 | 307 | // Import node into \DOMDocument. |
308 | - $mets = $this->oai->importNode($root->item(0), true); |
|
308 | + $mets = $this->oai->importNode($root->item(0), TRUE); |
|
309 | 309 | } else { |
310 | 310 | $this->logger->error('No METS part found in document with location "' . $metadata['location'] . '"'); |
311 | 311 | } |
312 | 312 | } else { |
313 | 313 | $this->logger->error('Could not load XML file from "' . $metadata['location'] . '"'); |
314 | 314 | } |
315 | - if ($mets === null) { |
|
315 | + if ($mets === NULL) { |
|
316 | 316 | $mets = $this->oai->createElementNS('http://kitodo.org/', 'kitodo:error', htmlspecialchars($this->pi_getLL('error', 'Error!'), ENT_NOQUOTES, 'UTF-8')); |
317 | 317 | } |
318 | 318 | return $mets; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | // Initialize plugin. |
334 | 334 | $this->init($conf); |
335 | 335 | // Turn cache off. |
336 | - $this->setCache(false); |
|
336 | + $this->setCache(FALSE); |
|
337 | 337 | // Get GET and POST variables. |
338 | 338 | $this->getUrlParams(); |
339 | 339 | // Delete expired resumption tokens. |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | protected function generateResumptionTokenForDocumentListSet(DocumentList $documentListSet) |
1063 | 1063 | { |
1064 | 1064 | if ($documentListSet->count() !== 0) { |
1065 | - $token = uniqid('', false); |
|
1065 | + $token = uniqid('', FALSE); |
|
1066 | 1066 | |
1067 | 1067 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_dlf_tokens'); |
1068 | 1068 | $affectedRows = $queryBuilder |
@@ -27,8 +27,7 @@ discard block |
||
27 | 27 | * @subpackage dlf |
28 | 28 | * @access public |
29 | 29 | */ |
30 | -class OaiPmh extends \Kitodo\Dlf\Common\AbstractPlugin |
|
31 | -{ |
|
30 | +class OaiPmh extends \Kitodo\Dlf\Common\AbstractPlugin { |
|
32 | 31 | public $scriptRelPath = 'Classes/Plugin/OaiPmh.php'; |
33 | 32 | |
34 | 33 | /** |
@@ -78,8 +77,7 @@ discard block |
||
78 | 77 | * |
79 | 78 | * @return void |
80 | 79 | */ |
81 | - protected function deleteExpiredTokens() |
|
82 | - { |
|
80 | + protected function deleteExpiredTokens() { |
|
83 | 81 | // Delete expired resumption tokens. |
84 | 82 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_dlf_tokens'); |
85 | 83 | |
@@ -106,8 +104,7 @@ discard block |
||
106 | 104 | * |
107 | 105 | * @return \DOMElement XML node to add to the OAI response |
108 | 106 | */ |
109 | - protected function error($type) |
|
110 | - { |
|
107 | + protected function error($type) { |
|
111 | 108 | $this->error = true; |
112 | 109 | $error = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'error', htmlspecialchars($this->pi_getLL($type, $type), ENT_NOQUOTES, 'UTF-8')); |
113 | 110 | $error->setAttribute('code', $type); |
@@ -121,8 +118,7 @@ discard block |
||
121 | 118 | * |
122 | 119 | * @return void |
123 | 120 | */ |
124 | - protected function getUrlParams() |
|
125 | - { |
|
121 | + protected function getUrlParams() { |
|
126 | 122 | $allowedParams = [ |
127 | 123 | 'verb', |
128 | 124 | 'identifier', |
@@ -152,8 +148,7 @@ discard block |
||
152 | 148 | * |
153 | 149 | * @return \DOMElement XML node to add to the OAI response |
154 | 150 | */ |
155 | - protected function getDcData(array $metadata) |
|
156 | - { |
|
151 | + protected function getDcData(array $metadata) { |
|
157 | 152 | $oai_dc = $this->oai->createElementNS($this->formats['oai_dc']['namespace'], 'oai_dc:dc'); |
158 | 153 | $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
159 | 154 | $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
@@ -231,8 +226,7 @@ discard block |
||
231 | 226 | * |
232 | 227 | * @return \DOMElement XML node to add to the OAI response |
233 | 228 | */ |
234 | - protected function getEpicurData(array $metadata) |
|
235 | - { |
|
229 | + protected function getEpicurData(array $metadata) { |
|
236 | 230 | // Define all XML elements with or without qualified namespace. |
237 | 231 | if (empty($this->conf['unqualified_epicur'])) { |
238 | 232 | $epicur = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:epicur'); |
@@ -295,8 +289,7 @@ discard block |
||
295 | 289 | * |
296 | 290 | * @return \DOMElement XML node to add to the OAI response |
297 | 291 | */ |
298 | - protected function getMetsData(array $metadata) |
|
299 | - { |
|
292 | + protected function getMetsData(array $metadata) { |
|
300 | 293 | $mets = null; |
301 | 294 | // Load METS file. |
302 | 295 | $xml = new \DOMDocument(); |
@@ -328,8 +321,7 @@ discard block |
||
328 | 321 | * |
329 | 322 | * @return void |
330 | 323 | */ |
331 | - public function main($content, $conf) |
|
332 | - { |
|
324 | + public function main($content, $conf) { |
|
333 | 325 | // Initialize plugin. |
334 | 326 | $this->init($conf); |
335 | 327 | // Turn cache off. |
@@ -420,8 +412,7 @@ discard block |
||
420 | 412 | * |
421 | 413 | * @return \DOMElement XML node to add to the OAI response |
422 | 414 | */ |
423 | - protected function resume() |
|
424 | - { |
|
415 | + protected function resume() { |
|
425 | 416 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
426 | 417 | ->getQueryBuilderForTable('tx_dlf_tokens'); |
427 | 418 | |
@@ -454,8 +445,7 @@ discard block |
||
454 | 445 | * |
455 | 446 | * @return \DOMElement XML node to add to the OAI response |
456 | 447 | */ |
457 | - protected function verbGetRecord() |
|
458 | - { |
|
448 | + protected function verbGetRecord() { |
|
459 | 449 | if (count($this->piVars) !== 3 || empty($this->piVars['metadataPrefix']) || empty($this->piVars['identifier'])) { |
460 | 450 | return $this->error('badArgument'); |
461 | 451 | } |
@@ -548,8 +538,7 @@ discard block |
||
548 | 538 | * |
549 | 539 | * @return \DOMElement XML node to add to the OAI response |
550 | 540 | */ |
551 | - protected function verbIdentify() |
|
552 | - { |
|
541 | + protected function verbIdentify() { |
|
553 | 542 | // Check for invalid arguments. |
554 | 543 | if (count($this->piVars) > 1) { |
555 | 544 | return $this->error('badArgument'); |
@@ -632,8 +621,7 @@ discard block |
||
632 | 621 | * |
633 | 622 | * @return \DOMElement XML node to add to the OAI response |
634 | 623 | */ |
635 | - protected function verbListIdentifiers() |
|
636 | - { |
|
624 | + protected function verbListIdentifiers() { |
|
637 | 625 | // If we have a resumption token we can continue our work |
638 | 626 | if (!empty($this->piVars['resumptionToken'])) { |
639 | 627 | // "resumptionToken" is an exclusive argument. |
@@ -672,8 +660,7 @@ discard block |
||
672 | 660 | * |
673 | 661 | * @return \DOMElement XML node to add to the OAI response |
674 | 662 | */ |
675 | - protected function verbListMetadataFormats() |
|
676 | - { |
|
663 | + protected function verbListMetadataFormats() { |
|
677 | 664 | $resArray = []; |
678 | 665 | // Check for invalid arguments. |
679 | 666 | if (count($this->piVars) > 1) { |
@@ -731,8 +718,7 @@ discard block |
||
731 | 718 | * |
732 | 719 | * @return \DOMElement XML node to add to the OAI response |
733 | 720 | */ |
734 | - protected function verbListRecords() |
|
735 | - { |
|
721 | + protected function verbListRecords() { |
|
736 | 722 | // Check for invalid arguments. |
737 | 723 | if (!empty($this->piVars['resumptionToken'])) { |
738 | 724 | // "resumptionToken" is an exclusive argument. |
@@ -772,8 +758,7 @@ discard block |
||
772 | 758 | * |
773 | 759 | * @return \DOMElement XML node to add to the OAI response |
774 | 760 | */ |
775 | - protected function verbListSets() |
|
776 | - { |
|
761 | + protected function verbListSets() { |
|
777 | 762 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
778 | 763 | ->getQueryBuilderForTable('tx_dlf_collections'); |
779 | 764 | |
@@ -829,8 +814,7 @@ discard block |
||
829 | 814 | * @return array Array of matching records |
830 | 815 | * @throws \Exception |
831 | 816 | */ |
832 | - protected function fetchDocumentUIDs() |
|
833 | - { |
|
817 | + protected function fetchDocumentUIDs() { |
|
834 | 818 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
835 | 819 | ->getQueryBuilderForTable('tx_dlf_collections'); |
836 | 820 | |
@@ -955,8 +939,7 @@ discard block |
||
955 | 939 | * |
956 | 940 | * @return \DOMElement XML of enriched records |
957 | 941 | */ |
958 | - protected function generateOutputForDocumentList(DocumentList $documentListSet) |
|
959 | - { |
|
942 | + protected function generateOutputForDocumentList(DocumentList $documentListSet) { |
|
960 | 943 | $documentsToProcess = $documentListSet->removeRange(0, (int) $this->conf['limit']); |
961 | 944 | $verb = $this->piVars['verb']; |
962 | 945 | |
@@ -1059,8 +1042,7 @@ discard block |
||
1059 | 1042 | * |
1060 | 1043 | * @return \DOMElement XML for resumption token |
1061 | 1044 | */ |
1062 | - protected function generateResumptionTokenForDocumentListSet(DocumentList $documentListSet) |
|
1063 | - { |
|
1045 | + protected function generateResumptionTokenForDocumentListSet(DocumentList $documentListSet) { |
|
1064 | 1046 | if ($documentListSet->count() !== 0) { |
1065 | 1047 | $token = uniqid('', false); |
1066 | 1048 |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | $oai_dc = $this->oai->createElementNS($this->formats['oai_dc']['namespace'], 'oai_dc:dc'); |
160 | 160 | $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
161 | 161 | $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
162 | - $oai_dc->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['oai_dc']['namespace'] . ' ' . $this->formats['oai_dc']['schema']); |
|
162 | + $oai_dc->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['oai_dc']['namespace'].' '.$this->formats['oai_dc']['schema']); |
|
163 | 163 | $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
164 | 164 | if (!empty($metadata['purl'])) { |
165 | 165 | $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8'))); |
166 | 166 | } |
167 | 167 | if (!empty($metadata['prod_id'])) { |
168 | - $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', 'kitodo:production:' . htmlspecialchars($metadata['prod_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
168 | + $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', 'kitodo:production:'.htmlspecialchars($metadata['prod_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
169 | 169 | } |
170 | 170 | if (!empty($metadata['urn'])) { |
171 | 171 | $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8'))); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | // Add attributes and build XML tree. |
264 | 264 | $epicur->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
265 | - $epicur->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['epicur']['namespace'] . ' ' . $this->formats['epicur']['schema']); |
|
265 | + $epicur->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['epicur']['namespace'].' '.$this->formats['epicur']['schema']); |
|
266 | 266 | // Do we update an URN or register a new one? |
267 | 267 | if ($metadata['tstamp'] == $metadata['crdate']) { |
268 | 268 | $update->setAttribute('type', 'urn_new'); |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | // Import node into \DOMDocument. |
310 | 310 | $mets = $this->oai->importNode($root->item(0), true); |
311 | 311 | } else { |
312 | - $this->logger->error('No METS part found in document with location "' . $metadata['location'] . '"'); |
|
312 | + $this->logger->error('No METS part found in document with location "'.$metadata['location'].'"'); |
|
313 | 313 | } |
314 | 314 | } else { |
315 | - $this->logger->error('Could not load XML file from "' . $metadata['location'] . '"'); |
|
315 | + $this->logger->error('Could not load XML file from "'.$metadata['location'].'"'); |
|
316 | 316 | } |
317 | 317 | if ($mets === null) { |
318 | 318 | $mets = $this->oai->createElementNS('http://kitodo.org/', 'kitodo:error', htmlspecialchars($this->pi_getLL('error', 'Error!'), ENT_NOQUOTES, 'UTF-8')); |
@@ -348,15 +348,15 @@ discard block |
||
348 | 348 | if (strpos($this->conf['stylesheet'], 'EXT:') === 0) { |
349 | 349 | [$extKey, $filePath] = explode('/', substr($this->conf['stylesheet'], 4), 2); |
350 | 350 | if (ExtensionManagementUtility::isLoaded($extKey)) { |
351 | - $this->conf['stylesheet'] = PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath($extKey)) . $filePath; |
|
351 | + $this->conf['stylesheet'] = PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath($extKey)).$filePath; |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | $stylesheet = GeneralUtility::locationHeaderUrl($this->conf['stylesheet']); |
355 | 355 | } else { |
356 | 356 | // Use default stylesheet if no custom stylesheet is given. |
357 | - $stylesheet = GeneralUtility::locationHeaderUrl(PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath($this->extKey)) . 'Resources/Public/Stylesheets/OaiPmh.xsl'); |
|
357 | + $stylesheet = GeneralUtility::locationHeaderUrl(PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath($this->extKey)).'Resources/Public/Stylesheets/OaiPmh.xsl'); |
|
358 | 358 | } |
359 | - $this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="' . htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8') . '"')); |
|
359 | + $this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8').'"')); |
|
360 | 360 | // Create root element. |
361 | 361 | $root = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'OAI-PMH'); |
362 | 362 | $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
@@ -407,10 +407,10 @@ discard block |
||
407 | 407 | // Send headers. |
408 | 408 | header('HTTP/1.1 200 OK'); |
409 | 409 | header('Cache-Control: no-cache'); |
410 | - header('Content-Length: ' . strlen($content)); |
|
410 | + header('Content-Length: '.strlen($content)); |
|
411 | 411 | header('Content-Type: text/xml; charset=utf-8'); |
412 | - header('Date: ' . date('r', $GLOBALS['EXEC_TIME'])); |
|
413 | - header('Expires: ' . date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired'])); |
|
412 | + header('Date: '.date('r', $GLOBALS['EXEC_TIME'])); |
|
413 | + header('Expires: '.date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired'])); |
|
414 | 414 | echo $content; |
415 | 415 | exit; |
416 | 416 | } |
@@ -471,16 +471,16 @@ discard block |
||
471 | 471 | |
472 | 472 | $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tx_dlf_documents'); |
473 | 473 | |
474 | - $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' . |
|
475 | - 'FROM `tx_dlf_documents` ' . |
|
476 | - 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' . |
|
477 | - 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' . |
|
478 | - 'WHERE `tx_dlf_documents`.`record_id` = ? ' . |
|
479 | - 'AND `tx_dlf_documents`.`pid` = ? ' . |
|
480 | - 'AND `tx_dlf_collections`.`pid` = ? ' . |
|
481 | - 'AND `tx_dlf_relations`.`ident`="docs_colls" ' . |
|
482 | - $where . |
|
483 | - 'AND ' . Helper::whereExpression('tx_dlf_collections'); |
|
474 | + $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '. |
|
475 | + 'FROM `tx_dlf_documents` '. |
|
476 | + 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '. |
|
477 | + 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '. |
|
478 | + 'WHERE `tx_dlf_documents`.`record_id` = ? '. |
|
479 | + 'AND `tx_dlf_documents`.`pid` = ? '. |
|
480 | + 'AND `tx_dlf_collections`.`pid` = ? '. |
|
481 | + 'AND `tx_dlf_relations`.`ident`="docs_colls" '. |
|
482 | + $where. |
|
483 | + 'AND '.Helper::whereExpression('tx_dlf_collections'); |
|
484 | 484 | |
485 | 485 | $values = [ |
486 | 486 | $this->piVars['identifier'], |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | $timestamp = $resArray['tstamp']; |
608 | 608 | $earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp); |
609 | 609 | } else { |
610 | - $this->logger->notice('No records found with PID ' . $this->conf['pages']); |
|
610 | + $this->logger->notice('No records found with PID '.$this->conf['pages']); |
|
611 | 611 | } |
612 | 612 | $linkConf = [ |
613 | 613 | 'parameter' => $GLOBALS['TSFE']->id, |
@@ -868,9 +868,9 @@ discard block |
||
868 | 868 | } |
869 | 869 | $resArray = $allResults[0]; |
870 | 870 | if ($resArray['index_query'] != "") { |
871 | - $solr_query .= '(' . $resArray['index_query'] . ')'; |
|
871 | + $solr_query .= '('.$resArray['index_query'].')'; |
|
872 | 872 | } else { |
873 | - $solr_query .= 'collection:' . '"' . $resArray['index_name'] . '"'; |
|
873 | + $solr_query .= 'collection:'.'"'.$resArray['index_name'].'"'; |
|
874 | 874 | } |
875 | 875 | } else { |
876 | 876 | // If no set is specified we have to query for all collections |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | } |
879 | 879 | // Check for required fields. |
880 | 880 | foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) { |
881 | - $solr_query .= ' NOT ' . $required . ':""'; |
|
881 | + $solr_query .= ' NOT '.$required.':""'; |
|
882 | 882 | } |
883 | 883 | // toplevel="true" is always required |
884 | 884 | $solr_query .= ' AND toplevel:true'; |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | || is_array($date_array = strptime($this->piVars['from'], '%Y-%m-%d')) |
892 | 892 | ) { |
893 | 893 | $timestamp = gmmktime($date_array['tm_hour'], $date_array['tm_min'], $date_array['tm_sec'], $date_array['tm_mon'] + 1, $date_array['tm_mday'], $date_array['tm_year'] + 1900); |
894 | - $from = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) . '.000Z'; |
|
894 | + $from = date("Y-m-d", $timestamp).'T'.date("H:i:s", $timestamp).'.000Z'; |
|
895 | 895 | } else { |
896 | 896 | throw new \Exception('badArgument'); |
897 | 897 | } |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | || is_array($date_array = strptime($this->piVars['until'], '%Y-%m-%d')) |
906 | 906 | ) { |
907 | 907 | $timestamp = gmmktime($date_array['tm_hour'], $date_array['tm_min'], $date_array['tm_sec'], $date_array['tm_mon'] + 1, $date_array['tm_mday'], $date_array['tm_year'] + 1900); |
908 | - $until = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) . '.999Z'; |
|
908 | + $until = date("Y-m-d", $timestamp).'T'.date("H:i:s", $timestamp).'.999Z'; |
|
909 | 909 | if ($from != "*" && $from > $until) { |
910 | 910 | throw new \Exception('badArgument'); |
911 | 911 | } |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | throw new \Exception('badArgument'); |
923 | 923 | } |
924 | 924 | } |
925 | - $solr_query .= ' AND timestamp:[' . $from . ' TO ' . $until . ']'; |
|
925 | + $solr_query .= ' AND timestamp:['.$from.' TO '.$until.']'; |
|
926 | 926 | $documentSet = []; |
927 | 927 | $solr = Solr::getInstance($this->conf['solrcore']); |
928 | 928 | if (!$solr->ready) { |
@@ -965,16 +965,16 @@ discard block |
||
965 | 965 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
966 | 966 | ->getConnectionForTable('tx_dlf_documents'); |
967 | 967 | |
968 | - $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' . |
|
969 | - 'FROM `tx_dlf_documents` ' . |
|
970 | - 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' . |
|
971 | - 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' . |
|
972 | - 'WHERE `tx_dlf_documents`.`uid` IN ( ? ) ' . |
|
973 | - 'AND `tx_dlf_documents`.`pid` = ? ' . |
|
974 | - 'AND `tx_dlf_collections`.`pid` = ? ' . |
|
975 | - 'AND `tx_dlf_relations`.`ident`="docs_colls" ' . |
|
976 | - 'AND ' . Helper::whereExpression('tx_dlf_collections') . ' ' . |
|
977 | - 'GROUP BY `tx_dlf_documents`.`uid` ' . |
|
968 | + $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '. |
|
969 | + 'FROM `tx_dlf_documents` '. |
|
970 | + 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '. |
|
971 | + 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '. |
|
972 | + 'WHERE `tx_dlf_documents`.`uid` IN ( ? ) '. |
|
973 | + 'AND `tx_dlf_documents`.`pid` = ? '. |
|
974 | + 'AND `tx_dlf_collections`.`pid` = ? '. |
|
975 | + 'AND `tx_dlf_relations`.`ident`="docs_colls" '. |
|
976 | + 'AND '.Helper::whereExpression('tx_dlf_collections').' '. |
|
977 | + 'GROUP BY `tx_dlf_documents`.`uid` '. |
|
978 | 978 | 'LIMIT ?'; |
979 | 979 | |
980 | 980 | $values = [ |
@@ -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 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
48 | 46 | ->getQueryBuilderForTable('tx_dlf_documents'); |
49 | 47 | |
@@ -74,8 +72,7 @@ discard block |
||
74 | 72 | * |
75 | 73 | * @return string HTML input fields with current document's UID and parent ID |
76 | 74 | */ |
77 | - protected function addCurrentCollection() |
|
78 | - { |
|
75 | + protected function addCurrentCollection() { |
|
79 | 76 | // Load current collection. |
80 | 77 | $list = GeneralUtility::makeInstance(DocumentList::class); |
81 | 78 | if ( |
@@ -107,8 +104,7 @@ discard block |
||
107 | 104 | * |
108 | 105 | * @return string HTML input fields with current document's UID |
109 | 106 | */ |
110 | - protected function addCurrentDocument() |
|
111 | - { |
|
107 | + protected function addCurrentDocument() { |
|
112 | 108 | // Load current list object. |
113 | 109 | $list = GeneralUtility::makeInstance(DocumentList::class); |
114 | 110 | // Load current document. |
@@ -147,8 +143,7 @@ discard block |
||
147 | 143 | * |
148 | 144 | * @return string HTML input fields with encrypted core name and hash |
149 | 145 | */ |
150 | - protected function addEncryptedCoreName() |
|
151 | - { |
|
146 | + protected function addEncryptedCoreName() { |
|
152 | 147 | // Get core name. |
153 | 148 | $name = Helper::getIndexNameFromUid($this->conf['solrcore'], 'tx_dlf_solrcores'); |
154 | 149 | // Encrypt core name. |
@@ -170,8 +165,7 @@ discard block |
||
170 | 165 | * |
171 | 166 | * @return string The extended search form or an empty string |
172 | 167 | */ |
173 | - protected function addExtendedSearch() |
|
174 | - { |
|
168 | + protected function addExtendedSearch() { |
|
175 | 169 | $extendedSearch = ''; |
176 | 170 | // Quit without doing anything if no fields for extended search are selected. |
177 | 171 | if ( |
@@ -209,8 +203,7 @@ discard block |
||
209 | 203 | * |
210 | 204 | * @return string HTML output of facets menu |
211 | 205 | */ |
212 | - protected function addFacetsMenu() |
|
213 | - { |
|
206 | + protected function addFacetsMenu() { |
|
214 | 207 | // Check for typoscript configuration to prevent fatal error. |
215 | 208 | if (empty($this->conf['facetsConf.'])) { |
216 | 209 | $this->logger->warning('Incomplete plugin configuration'); |
@@ -244,8 +237,7 @@ discard block |
||
244 | 237 | * |
245 | 238 | * @return string HTML output of fulltext switch |
246 | 239 | */ |
247 | - protected function addFulltextSwitch($isFulltextSearch = 0) |
|
248 | - { |
|
240 | + protected function addFulltextSwitch($isFulltextSearch = 0) { |
|
249 | 241 | $output = ''; |
250 | 242 | // Check for plugin configuration. |
251 | 243 | if (!empty($this->conf['fulltext'])) { |
@@ -264,8 +256,7 @@ discard block |
||
264 | 256 | * |
265 | 257 | * @return string HTML output of logical page field |
266 | 258 | */ |
267 | - protected function addLogicalPage() |
|
268 | - { |
|
259 | + protected function addLogicalPage() { |
|
269 | 260 | $output = ''; |
270 | 261 | // Check for plugin configuration. |
271 | 262 | if (!empty($this->conf['showLogicalPageField'])) { |
@@ -288,8 +279,7 @@ discard block |
||
288 | 279 | * |
289 | 280 | * @return array The array for the facet's menu entry |
290 | 281 | */ |
291 | - protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) |
|
292 | - { |
|
282 | + protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
293 | 283 | $entryArray = []; |
294 | 284 | // Translate value. |
295 | 285 | if ($field == 'owner_faceting') { |
@@ -345,8 +335,7 @@ discard block |
||
345 | 335 | * |
346 | 336 | * @return string The content that is displayed on the website |
347 | 337 | */ |
348 | - public function main($content, $conf) |
|
349 | - { |
|
338 | + public function main($content, $conf) { |
|
350 | 339 | $this->init($conf); |
351 | 340 | // Disable caching for this plugin. |
352 | 341 | $this->setCache(false); |
@@ -553,8 +542,7 @@ discard block |
||
553 | 542 | * |
554 | 543 | * @return array HMENU array |
555 | 544 | */ |
556 | - public function makeFacetsMenuArray($content, $conf) |
|
557 | - { |
|
545 | + public function makeFacetsMenuArray($content, $conf) { |
|
558 | 546 | $this->init($conf); |
559 | 547 | $menuArray = []; |
560 | 548 | // Set default value for facet search. |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | // The string may be e.g. "{!join from=uid to=partof}uid:{!join from=uid to=partof}uid:2" OR {!join from=uid to=partof}uid:2 OR uid:2" |
127 | 127 | // or "collection_faceting:("Some Collection Title")" |
128 | 128 | foreach ($list->metadata['options']['params']['filterquery'] as $facet) { |
129 | - if (($lastUidPos = strrpos($facet['query'], 'uid:')) !== false) { |
|
129 | + if (($lastUidPos = strrpos($facet['query'], 'uid:')) !== FALSE) { |
|
130 | 130 | $facetKeyVal = explode(':', substr($facet['query'], $lastUidPos)); |
131 | 131 | if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($facetKeyVal[1])) { |
132 | 132 | $documentId = (int) $facetKeyVal[1]; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $name = Helper::encrypt($name); |
157 | 157 | } |
158 | 158 | // Add encrypted fields to search form. |
159 | - if ($name !== false) { |
|
159 | + if ($name !== FALSE) { |
|
160 | 160 | return '<input type="hidden" name="' . $this->prefixId . '[encrypted]" value="' . $name . '" />'; |
161 | 161 | } else { |
162 | 162 | return ''; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | // Get field selector options. |
189 | 189 | $fieldSelectorOptions = ''; |
190 | - $searchFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], true); |
|
190 | + $searchFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
191 | 191 | foreach ($searchFields as $searchField) { |
192 | 192 | $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>'; |
193 | 193 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | // Get facets from plugin configuration. |
224 | 224 | $facets = []; |
225 | - foreach (GeneralUtility::trimExplode(',', $this->conf['facets'], true) as $facet) { |
|
225 | + foreach (GeneralUtility::trimExplode(',', $this->conf['facets'], TRUE) as $facet) { |
|
226 | 226 | $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
227 | 227 | } |
228 | 228 | // Render facets menu. |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | // Check if facet is already selected. |
313 | 313 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
314 | 314 | $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
315 | - if ($index !== false) { |
|
315 | + if ($index !== FALSE) { |
|
316 | 316 | // Facet is selected, thus remove it from filter. |
317 | 317 | unset($queryColumn[$index]); |
318 | 318 | $queryColumn = array_values($queryColumn); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | //Reset facets |
322 | 322 | if ($this->conf['resetFacets']) { |
323 | 323 | //remove ($count) for selected facet in template |
324 | - $entryArray['count'] = false; |
|
324 | + $entryArray['count'] = FALSE; |
|
325 | 325 | //build link to delete selected facet |
326 | 326 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(['query' => $search['query'], 'fq' => $queryColumn]); |
327 | 327 | $entryArray['title'] = sprintf($this->pi_getLL('resetFacet', ''), $entryArray['title']); |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | { |
350 | 350 | $this->init($conf); |
351 | 351 | // Disable caching for this plugin. |
352 | - $this->setCache(false); |
|
352 | + $this->setCache(FALSE); |
|
353 | 353 | // Quit without doing anything if required variables are not set. |
354 | 354 | if (empty($this->conf['solrcore'])) { |
355 | 355 | $this->logger->warning('Incomplete plugin configuration'); |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | && is_array($this->piVars['extQuery']) |
429 | 429 | ) { |
430 | 430 | $allowedOperators = ['AND', 'OR', 'NOT']; |
431 | - $allowedFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], true); |
|
431 | + $allowedFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
432 | 432 | $numberOfExtQueries = count($this->piVars['extQuery']); |
433 | 433 | for ($i = 0; $i < $numberOfExtQueries; $i++) { |
434 | 434 | if (!empty($this->piVars['extQuery'][$i])) { |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | ) { |
478 | 478 | $index_name = Helper::getIndexNameFromUid($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']); |
479 | 479 | $params['filterquery'][]['query'] = 'collection_faceting:("' . Solr::escapeQuery($index_name) . '")'; |
480 | - $label .= sprintf($this->pi_getLL('in', '', true), Helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
|
480 | + $label .= sprintf($this->pi_getLL('in', '', TRUE), Helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
|
481 | 481 | } |
482 | 482 | } |
483 | 483 | // Add filter query for collection restrictions. |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | } |
537 | 537 | $linkConf['forceAbsoluteUrl'] = !empty($this->conf['forceAbsoluteUrl']) ? 1 : 0; |
538 | 538 | $linkConf['forceAbsoluteUrl.']['scheme'] = !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'; |
539 | - $linkConf['additionalParams'] = GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', true, false); |
|
539 | + $linkConf['additionalParams'] = GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE); |
|
540 | 540 | // Send headers. |
541 | 541 | header('Location: ' . GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
542 | 542 | exit; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | if ($result->rowCount() == 1) { |
63 | 63 | $pageRenderer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class); |
64 | - $pageRenderer->addJsFooterFile(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)) . 'Resources/Public/Javascript/Search/Suggester.js'); |
|
64 | + $pageRenderer->addJsFooterFile(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)).'Resources/Public/Javascript/Search/Suggester.js'); |
|
65 | 65 | } else { |
66 | 66 | $this->logger->warning('No metadata fields configured for search suggestions'); |
67 | 67 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | && $list->metadata['options']['source'] == 'collection' |
84 | 84 | ) { |
85 | 85 | // Get collection's UID. |
86 | - return '<input type="hidden" name="' . $this->prefixId . '[collection]" value="' . $list->metadata['options']['select'] . '" />'; |
|
86 | + return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$list->metadata['options']['select'].'" />'; |
|
87 | 87 | } elseif (!empty($list->metadata['options']['params']['filterquery'])) { |
88 | 88 | // Get collection's UID from search metadata. |
89 | 89 | foreach ($list->metadata['options']['params']['filterquery'] as $facet) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $collectionId = Helper::getUidFromIndexName(trim($facetKeyVal[1], '(")'), 'tx_dlf_collections'); |
96 | 96 | } |
97 | 97 | } |
98 | - return '<input type="hidden" name="' . $this->prefixId . '[collection]" value="' . $collectionId . '" />'; |
|
98 | + return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$collectionId.'" />'; |
|
99 | 99 | } |
100 | 100 | return ''; |
101 | 101 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $this->loadDocument(); |
120 | 120 | // Get document's UID |
121 | 121 | if ($this->doc->ready) { |
122 | - return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . ($this->doc->uid) . '" />'; |
|
122 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.($this->doc->uid).'" />'; |
|
123 | 123 | } |
124 | 124 | } elseif (!empty($list->metadata['options']['params']['filterquery'])) { |
125 | 125 | // Get document's UID from search metadata. |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | if (!empty($documentId)) { |
137 | - return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . $documentId . '" />'; |
|
137 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.$documentId.'" />'; |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | return ''; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | // Add encrypted fields to search form. |
159 | 159 | if ($name !== false) { |
160 | - return '<input type="hidden" name="' . $this->prefixId . '[encrypted]" value="' . $name . '" />'; |
|
160 | + return '<input type="hidden" name="'.$this->prefixId.'[encrypted]" value="'.$name.'" />'; |
|
161 | 161 | } else { |
162 | 162 | return ''; |
163 | 163 | } |
@@ -183,19 +183,19 @@ discard block |
||
183 | 183 | // Get operator options. |
184 | 184 | $operatorOptions = ''; |
185 | 185 | foreach (['AND', 'OR', 'NOT'] as $operator) { |
186 | - $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-' . $operator . '" value="' . $operator . '">' . htmlspecialchars($this->pi_getLL($operator, '')) . '</option>'; |
|
186 | + $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-'.$operator.'" value="'.$operator.'">'.htmlspecialchars($this->pi_getLL($operator, '')).'</option>'; |
|
187 | 187 | } |
188 | 188 | // Get field selector options. |
189 | 189 | $fieldSelectorOptions = ''; |
190 | 190 | $searchFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], true); |
191 | 191 | foreach ($searchFields as $searchField) { |
192 | - $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>'; |
|
192 | + $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>'; |
|
193 | 193 | } |
194 | 194 | for ($i = 0; $i < $this->conf['extendedSlotCount']; $i++) { |
195 | 195 | $markerArray = [ |
196 | - '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-' . $i . '" name="' . $this->prefixId . '[extOperator][' . $i . ']">' . $operatorOptions . '</select>', |
|
197 | - '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-' . $i . '" name="' . $this->prefixId . '[extField][' . $i . ']">' . $fieldSelectorOptions . '</select>', |
|
198 | - '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-' . $i . '" type="text" name="' . $this->prefixId . '[extQuery][' . $i . ']" />' |
|
196 | + '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-'.$i.'" name="'.$this->prefixId.'[extOperator]['.$i.']">'.$operatorOptions.'</select>', |
|
197 | + '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-'.$i.'" name="'.$this->prefixId.'[extField]['.$i.']">'.$fieldSelectorOptions.'</select>', |
|
198 | + '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-'.$i.'" type="text" name="'.$this->prefixId.'[extQuery]['.$i.']" />' |
|
199 | 199 | ]; |
200 | 200 | $extendedSearch .= $this->templateService->substituteMarkerArray($this->templateService->getSubpart($this->template, '###EXT_SEARCH_ENTRY###'), $markerArray); |
201 | 201 | } |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | // Get facets from plugin configuration. |
224 | 224 | $facets = []; |
225 | 225 | foreach (GeneralUtility::trimExplode(',', $this->conf['facets'], true) as $facet) { |
226 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
226 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
227 | 227 | } |
228 | 228 | // Render facets menu. |
229 | 229 | $TSconfig = []; |
230 | 230 | $TSconfig['special'] = 'userfunction'; |
231 | - $TSconfig['special.']['userFunc'] = \Kitodo\Dlf\Plugin\Search::class . '->makeFacetsMenuArray'; |
|
231 | + $TSconfig['special.']['userFunc'] = \Kitodo\Dlf\Plugin\Search::class.'->makeFacetsMenuArray'; |
|
232 | 232 | $TSconfig['special.']['facets'] = $facets; |
233 | 233 | $TSconfig['special.']['limit'] = max(intval($this->conf['limitFacets']), 1); |
234 | 234 | $TSconfig = Helper::mergeRecursiveWithOverrule($this->conf['facetsConf.'], $TSconfig); |
@@ -249,10 +249,10 @@ discard block |
||
249 | 249 | $output = ''; |
250 | 250 | // Check for plugin configuration. |
251 | 251 | if (!empty($this->conf['fulltext'])) { |
252 | - $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"' : '') . ' />'; |
|
253 | - $output .= ' <label for="tx-dlf-search-fulltext-no">' . htmlspecialchars($this->pi_getLL('label.inMetadata', '')) . '</label>'; |
|
254 | - $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"' : '') . '/>'; |
|
255 | - $output .= ' <label for="tx-dlf-search-fulltext-yes">' . htmlspecialchars($this->pi_getLL('label.inFulltext', '')) . '</label>'; |
|
252 | + $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"' : '').' />'; |
|
253 | + $output .= ' <label for="tx-dlf-search-fulltext-no">'.htmlspecialchars($this->pi_getLL('label.inMetadata', '')).'</label>'; |
|
254 | + $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"' : '').'/>'; |
|
255 | + $output .= ' <label for="tx-dlf-search-fulltext-yes">'.htmlspecialchars($this->pi_getLL('label.inFulltext', '')).'</label>'; |
|
256 | 256 | } |
257 | 257 | return $output; |
258 | 258 | } |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | $output = ''; |
270 | 270 | // Check for plugin configuration. |
271 | 271 | if (!empty($this->conf['showLogicalPageField'])) { |
272 | - $output .= ' <label for="tx-dlf-search-logical-page">' . htmlspecialchars($this->pi_getLL('label.logicalPage', '')) . ': </label>'; |
|
273 | - $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="' . $this->prefixId . '[logicalPage]" />'; |
|
272 | + $output .= ' <label for="tx-dlf-search-logical-page">'.htmlspecialchars($this->pi_getLL('label.logicalPage', '')).': </label>'; |
|
273 | + $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="'.$this->prefixId.'[logicalPage]" />'; |
|
274 | 274 | } |
275 | 275 | return $output; |
276 | 276 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $entryArray['doNotLinkIt'] = 0; |
312 | 312 | // Check if facet is already selected. |
313 | 313 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
314 | - $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
|
314 | + $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn); |
|
315 | 315 | if ($index !== false) { |
316 | 316 | // Facet is selected, thus remove it from filter. |
317 | 317 | unset($queryColumn[$index]); |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | } else { |
330 | 330 | // Facet is not selected, thus add it to filter. |
331 | - $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")'; |
|
331 | + $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")'; |
|
332 | 332 | $entryArray['ITEM_STATE'] = 'NO'; |
333 | 333 | } |
334 | 334 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(['query' => $search['query'], 'fq' => $queryColumn]); |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | '###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf), |
385 | 385 | '###LABEL_QUERY###' => (!empty($search['query']) ? htmlspecialchars($search['query']) : htmlspecialchars($this->pi_getLL('label.query'))), |
386 | 386 | '###LABEL_SUBMIT###' => htmlspecialchars($this->pi_getLL('label.submit')), |
387 | - '###FIELD_QUERY###' => $this->prefixId . '[query]', |
|
387 | + '###FIELD_QUERY###' => $this->prefixId.'[query]', |
|
388 | 388 | '###QUERY###' => (!empty($search['query']) ? htmlspecialchars($search['query']) : ''), |
389 | 389 | '###FULLTEXTSWITCH###' => $this->addFulltextSwitch($list->metadata['fulltextSearch']), |
390 | 390 | '###FIELD_DOC###' => ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all' ? $this->addCurrentDocument() : ''), |
@@ -411,13 +411,13 @@ discard block |
||
411 | 411 | // Set search query. |
412 | 412 | if ( |
413 | 413 | (!empty($this->conf['fulltext']) && !empty($this->piVars['fulltext'])) |
414 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($this->piVars['query']), $matches) |
|
414 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($this->piVars['query']), $matches) |
|
415 | 415 | ) { |
416 | 416 | // If the query already is a fulltext query e.g using the facets |
417 | 417 | $this->piVars['query'] = empty($matches[1]) ? $this->piVars['query'] : $matches[1]; |
418 | 418 | // Search in fulltext field if applicable. Query must not be empty! |
419 | 419 | if (!empty($this->piVars['query'])) { |
420 | - $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->piVars['query'])) . ')'; |
|
420 | + $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($this->piVars['query'])).')'; |
|
421 | 421 | } |
422 | 422 | } else { |
423 | 423 | // Retain given search field if valid. |
@@ -438,9 +438,9 @@ discard block |
||
438 | 438 | && in_array($this->piVars['extField'][$i], $allowedFields) |
439 | 439 | ) { |
440 | 440 | if (!empty($query)) { |
441 | - $query .= ' ' . $this->piVars['extOperator'][$i] . ' '; |
|
441 | + $query .= ' '.$this->piVars['extOperator'][$i].' '; |
|
442 | 442 | } |
443 | - $query .= Indexer::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']) . ':(' . Solr::escapeQuery($this->piVars['extQuery'][$i]) . ')'; |
|
443 | + $query .= Indexer::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']).':('.Solr::escapeQuery($this->piVars['extQuery'][$i]).')'; |
|
444 | 444 | } |
445 | 445 | } |
446 | 446 | } |
@@ -462,12 +462,12 @@ discard block |
||
462 | 462 | ) { |
463 | 463 | // Search in document and all subordinates (valid for up to three levels of hierarchy). |
464 | 464 | $params['filterquery'][]['query'] = '_query_:"{!join from=' |
465 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
466 | - . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
467 | - . $fields['uid'] . ':' . $this->piVars['id'] . '"' . ' OR {!join from=' |
|
468 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
469 | - . $fields['uid'] . ':' . $this->piVars['id'] . ' OR ' |
|
470 | - . $fields['uid'] . ':' . $this->piVars['id']; |
|
465 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
466 | + . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}' |
|
467 | + . $fields['uid'].':'.$this->piVars['id'].'"'.' OR {!join from=' |
|
468 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
469 | + . $fields['uid'].':'.$this->piVars['id'].' OR ' |
|
470 | + . $fields['uid'].':'.$this->piVars['id']; |
|
471 | 471 | $label .= htmlspecialchars(sprintf($this->pi_getLL('in', ''), Document::getTitle($this->piVars['id']))); |
472 | 472 | } |
473 | 473 | } |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['collection']) |
482 | 482 | ) { |
483 | 483 | $index_name = Helper::getIndexNameFromUid($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']); |
484 | - $params['filterquery'][]['query'] = 'collection_faceting:("' . Solr::escapeQuery($index_name) . '")'; |
|
484 | + $params['filterquery'][]['query'] = 'collection_faceting:("'.Solr::escapeQuery($index_name).'")'; |
|
485 | 485 | $label .= sprintf($this->pi_getLL('in', '', true), Helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
486 | 486 | } |
487 | 487 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $collIndexNames[] = Solr::escapeQuery(Helper::getIndexNameFromUid(intval($collId), 'tx_dlf_collections', $this->conf['pages'])); |
494 | 494 | } |
495 | 495 | // Last value is fake and used for distinction in $this->addCurrentCollection() |
496 | - $params['filterquery'][]['query'] = 'collection_faceting:("' . implode('" OR "', $collIndexNames) . '" OR "FakeValueForDistinction")'; |
|
496 | + $params['filterquery'][]['query'] = 'collection_faceting:("'.implode('" OR "', $collIndexNames).'" OR "FakeValueForDistinction")'; |
|
497 | 497 | } |
498 | 498 | // Set some query parameters. |
499 | 499 | $params['query'] = !empty($query) ? $query : '*'; |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $linkConf['forceAbsoluteUrl.']['scheme'] = !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'; |
544 | 544 | $linkConf['additionalParams'] = GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', true, false); |
545 | 545 | // Send headers. |
546 | - header('Location: ' . GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
546 | + header('Location: '.GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
547 | 547 | exit; |
548 | 548 | } |
549 | 549 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $fileMimeType = $this->getFileMimeType($id); |
170 | 170 | $fileLocation = $this->getFileLocation($id); |
171 | 171 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
172 | - $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation . 'info.json' : $fileLocation . '/info.json'); |
|
172 | + $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation.'info.json' : $fileLocation.'/info.json'); |
|
173 | 173 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
174 | 174 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
175 | 175 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | return $service->getImageUrl(); |
180 | 180 | } |
181 | 181 | } elseif ($fileMimeType === 'application/vnd.netfpx') { |
182 | - $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : ''); |
|
182 | + $baseURL = $fileLocation.(strpos($fileLocation, '?') === false ? '?' : ''); |
|
183 | 183 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
184 | - return $baseURL . '&CVT=jpeg'; |
|
184 | + return $baseURL.'&CVT=jpeg'; |
|
185 | 185 | } |
186 | 186 | return $fileLocation; |
187 | 187 | } |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function getFileLocation($id) |
194 | 194 | { |
195 | - $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
195 | + $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
196 | 196 | if ( |
197 | 197 | !empty($id) |
198 | 198 | && !empty($location) |
199 | 199 | ) { |
200 | 200 | return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
201 | 201 | } else { |
202 | - $this->logger->warning('There is no file node with @ID "' . $id . '"'); |
|
202 | + $this->logger->warning('There is no file node with @ID "'.$id.'"'); |
|
203 | 203 | return ''; |
204 | 204 | } |
205 | 205 | } |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function getFileMimeType($id) |
212 | 212 | { |
213 | - $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
|
213 | + $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'); |
|
214 | 214 | if ( |
215 | 215 | !empty($id) |
216 | 216 | && !empty($mimetype) |
217 | 217 | ) { |
218 | 218 | return (string) $mimetype[0]; |
219 | 219 | } else { |
220 | - $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified'); |
|
220 | + $this->logger->warning('There is no file node with @ID "'.$id.'" or no MIME type specified'); |
|
221 | 221 | return ''; |
222 | 222 | } |
223 | 223 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | return $this->logicalUnits[$id]; |
239 | 239 | } elseif (!empty($id)) { |
240 | 240 | // Get specified logical unit. |
241 | - $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]'); |
|
241 | + $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]'); |
|
242 | 242 | } else { |
243 | 243 | // Get all logical units at top level. |
244 | 244 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | // Retain current PID. |
379 | 379 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
380 | 380 | } elseif (!$cPid) { |
381 | - $this->logger->warning('Invalid PID ' . $cPid . ' for metadata definitions'); |
|
381 | + $this->logger->warning('Invalid PID '.$cPid.' for metadata definitions'); |
|
382 | 382 | return []; |
383 | 383 | } |
384 | 384 | // Get metadata from parsed metadata array if available. |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | if (!empty($this->logicalUnits[$id])) { |
420 | 420 | $dmdIds = $this->logicalUnits[$id]['dmdId']; |
421 | 421 | } else { |
422 | - $dmdIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@DMDID'); |
|
422 | + $dmdIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@DMDID'); |
|
423 | 423 | $dmdIds = (string) $dmdIds[0]; |
424 | 424 | } |
425 | 425 | if (!empty($dmdIds)) { |
@@ -445,11 +445,11 @@ discard block |
||
445 | 445 | ) { |
446 | 446 | $obj->extractMetadata($this->dmdSec[$dmdId]['xml'], $metadata); |
447 | 447 | } else { |
448 | - $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->dmdSec[$dmdId]['type'] . '"'); |
|
448 | + $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->dmdSec[$dmdId]['type'].'"'); |
|
449 | 449 | } |
450 | 450 | } |
451 | 451 | } else { |
452 | - $this->logger->notice('Unsupported metadata format "' . $this->dmdSec[$dmdId]['type'] . '" in dmdSec with @ID "' . $dmdId . '"'); |
|
452 | + $this->logger->notice('Unsupported metadata format "'.$this->dmdSec[$dmdId]['type'].'" in dmdSec with @ID "'.$dmdId.'"'); |
|
453 | 453 | // Continue searching for supported metadata with next @DMDID. |
454 | 454 | continue; |
455 | 455 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | if (!empty($this->logicalUnits[$id])) { |
458 | 458 | $metadata['type'] = [$this->logicalUnits[$id]['type']]; |
459 | 459 | } else { |
460 | - $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE'); |
|
460 | + $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
|
461 | 461 | if (!empty($struct)) { |
462 | 462 | $metadata['type'] = [(string) $struct[0]]; |
463 | 463 | } |
@@ -574,13 +574,13 @@ discard block |
||
574 | 574 | $values instanceof \DOMNodeList |
575 | 575 | && $values->length > 0 |
576 | 576 | ) { |
577 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
577 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
578 | 578 | } elseif (!($values instanceof \DOMNodeList)) { |
579 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values); |
|
579 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values); |
|
580 | 580 | } |
581 | 581 | } |
582 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
583 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
582 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
583 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | } |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | if ($hasSupportedMetadata) { |
643 | 643 | return $metadata; |
644 | 644 | } else { |
645 | - $this->logger->warning('No supported metadata found for logical structure with @ID "' . $id . '"'); |
|
645 | + $this->logger->warning('No supported metadata found for logical structure with @ID "'.$id.'"'); |
|
646 | 646 | return []; |
647 | 647 | } |
648 | 648 | } |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | */ |
673 | 673 | public function getStructureDepth($logId) |
674 | 674 | { |
675 | - $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
|
675 | + $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'); |
|
676 | 676 | if (!empty($ancestors)) { |
677 | 677 | return count($ancestors); |
678 | 678 | } else { |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | // Register namespaces. |
695 | 695 | $this->registerNamespaces($this->mets); |
696 | 696 | } else { |
697 | - $this->logger->error('No METS part found in document with UID ' . $this->uid); |
|
697 | + $this->logger->error('No METS part found in document with UID '.$this->uid); |
|
698 | 698 | } |
699 | 699 | } |
700 | 700 | |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | return true; |
723 | 723 | } |
724 | 724 | } |
725 | - $this->logger->error('Could not load XML file from "' . $location . '"'); |
|
725 | + $this->logger->error('Could not load XML file from "'.$location.'"'); |
|
726 | 726 | return false; |
727 | 727 | } |
728 | 728 | |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | { |
747 | 747 | $partof = 0; |
748 | 748 | // Get the closest ancestor of the current document which has a MPTR child. |
749 | - $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->_getToplevelId() . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
749 | + $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->_getToplevelId().'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
750 | 750 | if (!empty($parentMptr)) { |
751 | 751 | $parentLocation = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
752 | 752 | if ($parentLocation != $this->location) { |
@@ -813,15 +813,15 @@ discard block |
||
813 | 813 | $dmdIds = $this->mets->xpath('./mets:dmdSec/@ID'); |
814 | 814 | if (!empty($dmdIds)) { |
815 | 815 | foreach ($dmdIds as $dmdId) { |
816 | - if ($type = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) { |
|
816 | + if ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) { |
|
817 | 817 | if (!empty($this->formats[(string) $type[0]])) { |
818 | 818 | $type = (string) $type[0]; |
819 | - $xml = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
819 | + $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
820 | 820 | } |
821 | - } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) { |
|
821 | + } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) { |
|
822 | 822 | if (!empty($this->formats[(string) $type[0]])) { |
823 | 823 | $type = (string) $type[0]; |
824 | - $xml = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
824 | + $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
825 | 825 | } |
826 | 826 | } |
827 | 827 | if (!empty($xml)) { |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | // Retain current PID. |
1007 | 1007 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
1008 | 1008 | if (!$cPid) { |
1009 | - $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
|
1009 | + $this->logger->error('Invalid PID '.$cPid.' for structure definitions'); |
|
1010 | 1010 | $this->thumbnailLoaded = true; |
1011 | 1011 | return $this->thumbnail; |
1012 | 1012 | } |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | if (!empty($resArray['thumbnail'])) { |
1044 | 1044 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid); |
1045 | 1045 | // Check if this document has a structure element of the desired type. |
1046 | - $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
|
1046 | + $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID'); |
|
1047 | 1047 | if (!empty($strctIds)) { |
1048 | 1048 | $strctId = (string) $strctIds[0]; |
1049 | 1049 | } |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | } |
1067 | 1067 | } |
1068 | 1068 | } else { |
1069 | - $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
|
1069 | + $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database'); |
|
1070 | 1070 | } |
1071 | 1071 | $this->thumbnailLoaded = true; |
1072 | 1072 | } |
@@ -48,8 +48,7 @@ discard block |
||
48 | 48 | * @property-read string $toplevelId This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF) |
49 | 49 | * @property-read mixed $uid This holds the UID or the URL of the document |
50 | 50 | */ |
51 | -final class MetsDocument extends Document |
|
52 | -{ |
|
51 | +final class MetsDocument extends Document { |
|
53 | 52 | /** |
54 | 53 | * This holds the whole XML file as string for serialization purposes |
55 | 54 | * @see __sleep() / __wakeup() |
@@ -128,8 +127,7 @@ discard block |
||
128 | 127 | * |
129 | 128 | * @return void |
130 | 129 | */ |
131 | - public function addMetadataFromMets(&$metadata, $id) |
|
132 | - { |
|
130 | + public function addMetadataFromMets(&$metadata, $id) { |
|
133 | 131 | $details = $this->getLogicalStructure($id); |
134 | 132 | if (!empty($details)) { |
135 | 133 | $metadata['mets_order'][0] = $details['order']; |
@@ -143,8 +141,7 @@ discard block |
||
143 | 141 | * {@inheritDoc} |
144 | 142 | * @see \Kitodo\Dlf\Common\Document::establishRecordId() |
145 | 143 | */ |
146 | - protected function establishRecordId($pid) |
|
147 | - { |
|
144 | + protected function establishRecordId($pid) { |
|
148 | 145 | // Check for METS object @ID. |
149 | 146 | if (!empty($this->mets['OBJID'])) { |
150 | 147 | $this->recordId = (string) $this->mets['OBJID']; |
@@ -164,8 +161,7 @@ discard block |
||
164 | 161 | * {@inheritDoc} |
165 | 162 | * @see \Kitodo\Dlf\Common\Document::getDownloadLocation() |
166 | 163 | */ |
167 | - public function getDownloadLocation($id) |
|
168 | - { |
|
164 | + public function getDownloadLocation($id) { |
|
169 | 165 | $fileMimeType = $this->getFileMimeType($id); |
170 | 166 | $fileLocation = $this->getFileLocation($id); |
171 | 167 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
@@ -190,8 +186,7 @@ discard block |
||
190 | 186 | * {@inheritDoc} |
191 | 187 | * @see \Kitodo\Dlf\Common\Document::getFileLocation() |
192 | 188 | */ |
193 | - public function getFileLocation($id) |
|
194 | - { |
|
189 | + public function getFileLocation($id) { |
|
195 | 190 | $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
196 | 191 | if ( |
197 | 192 | !empty($id) |
@@ -208,8 +203,7 @@ discard block |
||
208 | 203 | * {@inheritDoc} |
209 | 204 | * @see \Kitodo\Dlf\Common\Document::getFileMimeType() |
210 | 205 | */ |
211 | - public function getFileMimeType($id) |
|
212 | - { |
|
206 | + public function getFileMimeType($id) { |
|
213 | 207 | $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
214 | 208 | if ( |
215 | 209 | !empty($id) |
@@ -226,8 +220,7 @@ discard block |
||
226 | 220 | * {@inheritDoc} |
227 | 221 | * @see \Kitodo\Dlf\Common\Document::getLogicalStructure() |
228 | 222 | */ |
229 | - public function getLogicalStructure($id, $recursive = false) |
|
230 | - { |
|
223 | + public function getLogicalStructure($id, $recursive = false) { |
|
231 | 224 | $details = []; |
232 | 225 | // Is the requested logical unit already loaded? |
233 | 226 | if ( |
@@ -267,8 +260,7 @@ discard block |
||
267 | 260 | * |
268 | 261 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
269 | 262 | */ |
270 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) |
|
271 | - { |
|
263 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) { |
|
272 | 264 | // Get attributes. |
273 | 265 | foreach ($structure->attributes() as $attribute => $value) { |
274 | 266 | $attributes[$attribute] = (string) $value; |
@@ -366,8 +358,7 @@ discard block |
||
366 | 358 | * {@inheritDoc} |
367 | 359 | * @see \Kitodo\Dlf\Common\Document::getMetadata() |
368 | 360 | */ |
369 | - public function getMetadata($id, $cPid = 0) |
|
370 | - { |
|
361 | + public function getMetadata($id, $cPid = 0) { |
|
371 | 362 | // Make sure $cPid is a non-negative integer. |
372 | 363 | $cPid = max(intval($cPid), 0); |
373 | 364 | // If $cPid is not given, try to get it elsewhere. |
@@ -669,8 +660,7 @@ discard block |
||
669 | 660 | * {@inheritDoc} |
670 | 661 | * @see \Kitodo\Dlf\Common\Document::getFullText() |
671 | 662 | */ |
672 | - public function getFullText($id) |
|
673 | - { |
|
663 | + public function getFullText($id) { |
|
674 | 664 | $fullText = ''; |
675 | 665 | |
676 | 666 | // Load fileGrps and check for full text files. |
@@ -685,8 +675,7 @@ discard block |
||
685 | 675 | * {@inheritDoc} |
686 | 676 | * @see Document::getStructureDepth() |
687 | 677 | */ |
688 | - public function getStructureDepth($logId) |
|
689 | - { |
|
678 | + public function getStructureDepth($logId) { |
|
690 | 679 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
691 | 680 | if (!empty($ancestors)) { |
692 | 681 | return count($ancestors); |
@@ -699,8 +688,7 @@ discard block |
||
699 | 688 | * {@inheritDoc} |
700 | 689 | * @see \Kitodo\Dlf\Common\Document::init() |
701 | 690 | */ |
702 | - protected function init() |
|
703 | - { |
|
691 | + protected function init() { |
|
704 | 692 | // Get METS node from XML file. |
705 | 693 | $this->registerNamespaces($this->xml); |
706 | 694 | $mets = $this->xml->xpath('//mets:mets'); |
@@ -717,8 +705,7 @@ discard block |
||
717 | 705 | * {@inheritDoc} |
718 | 706 | * @see \Kitodo\Dlf\Common\Document::loadLocation() |
719 | 707 | */ |
720 | - protected function loadLocation($location) |
|
721 | - { |
|
708 | + protected function loadLocation($location) { |
|
722 | 709 | $fileResource = GeneralUtility::getUrl($location); |
723 | 710 | if ($fileResource !== false) { |
724 | 711 | $xml = Helper::getXmlFileAsString($fileResource); |
@@ -736,8 +723,7 @@ discard block |
||
736 | 723 | * {@inheritDoc} |
737 | 724 | * @see \Kitodo\Dlf\Common\Document::ensureHasFulltextIsSet() |
738 | 725 | */ |
739 | - protected function ensureHasFulltextIsSet() |
|
740 | - { |
|
726 | + protected function ensureHasFulltextIsSet() { |
|
741 | 727 | // Are the fileGrps already loaded? |
742 | 728 | if (!$this->fileGrpsLoaded) { |
743 | 729 | $this->_getFileGrps(); |
@@ -748,8 +734,7 @@ discard block |
||
748 | 734 | * {@inheritDoc} |
749 | 735 | * @see Document::getParentDocumentUid() |
750 | 736 | */ |
751 | - protected function getParentDocumentUidForSaving($pid, $core, $owner) |
|
752 | - { |
|
737 | + protected function getParentDocumentUidForSaving($pid, $core, $owner) { |
|
753 | 738 | $partof = 0; |
754 | 739 | // Get the closest ancestor of the current document which has a MPTR child. |
755 | 740 | $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->_getToplevelId() . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
@@ -772,8 +757,7 @@ discard block |
||
772 | 757 | * {@inheritDoc} |
773 | 758 | * @see Document::setPreloadedDocument() |
774 | 759 | */ |
775 | - protected function setPreloadedDocument($preloadedDocument) |
|
776 | - { |
|
760 | + protected function setPreloadedDocument($preloadedDocument) { |
|
777 | 761 | |
778 | 762 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
779 | 763 | $this->xml = $preloadedDocument; |
@@ -786,8 +770,7 @@ discard block |
||
786 | 770 | * {@inheritDoc} |
787 | 771 | * @see Document::getDocument() |
788 | 772 | */ |
789 | - protected function getDocument() |
|
790 | - { |
|
773 | + protected function getDocument() { |
|
791 | 774 | return $this->mets; |
792 | 775 | } |
793 | 776 | |
@@ -798,8 +781,7 @@ discard block |
||
798 | 781 | * |
799 | 782 | * @return array Array of dmdSecs with their IDs as array key |
800 | 783 | */ |
801 | - protected function _getDmdSec() |
|
802 | - { |
|
784 | + protected function _getDmdSec() { |
|
803 | 785 | if (!$this->dmdSecLoaded) { |
804 | 786 | // Get available data formats. |
805 | 787 | $this->loadFormats(); |
@@ -837,8 +819,7 @@ discard block |
||
837 | 819 | * |
838 | 820 | * @return array Array of file use groups with file IDs |
839 | 821 | */ |
840 | - protected function _getFileGrps() |
|
841 | - { |
|
822 | + protected function _getFileGrps() { |
|
842 | 823 | if (!$this->fileGrpsLoaded) { |
843 | 824 | // Get configured USE attributes. |
844 | 825 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -883,8 +864,7 @@ discard block |
||
883 | 864 | * {@inheritDoc} |
884 | 865 | * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray() |
885 | 866 | */ |
886 | - protected function prepareMetadataArray($cPid) |
|
887 | - { |
|
867 | + protected function prepareMetadataArray($cPid) { |
|
888 | 868 | $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'); |
889 | 869 | // Get all logical structure nodes with metadata. |
890 | 870 | if (!empty($ids)) { |
@@ -902,8 +882,7 @@ discard block |
||
902 | 882 | * |
903 | 883 | * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object |
904 | 884 | */ |
905 | - protected function _getMets() |
|
906 | - { |
|
885 | + protected function _getMets() { |
|
907 | 886 | return $this->mets; |
908 | 887 | } |
909 | 888 | |
@@ -911,8 +890,7 @@ discard block |
||
911 | 890 | * {@inheritDoc} |
912 | 891 | * @see \Kitodo\Dlf\Common\Document::_getPhysicalStructure() |
913 | 892 | */ |
914 | - protected function _getPhysicalStructure() |
|
915 | - { |
|
893 | + protected function _getPhysicalStructure() { |
|
916 | 894 | // Is there no physical structure array yet? |
917 | 895 | if (!$this->physicalStructureLoaded) { |
918 | 896 | // Does the document have a structMap node of type "PHYSICAL"? |
@@ -972,8 +950,7 @@ discard block |
||
972 | 950 | * {@inheritDoc} |
973 | 951 | * @see \Kitodo\Dlf\Common\Document::_getSmLinks() |
974 | 952 | */ |
975 | - protected function _getSmLinks() |
|
976 | - { |
|
953 | + protected function _getSmLinks() { |
|
977 | 954 | if (!$this->smLinksLoaded) { |
978 | 955 | $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink'); |
979 | 956 | if (!empty($smLinks)) { |
@@ -991,8 +968,7 @@ discard block |
||
991 | 968 | * {@inheritDoc} |
992 | 969 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
993 | 970 | */ |
994 | - protected function _getThumbnail($forceReload = false) |
|
995 | - { |
|
971 | + protected function _getThumbnail($forceReload = false) { |
|
996 | 972 | if ( |
997 | 973 | !$this->thumbnailLoaded |
998 | 974 | || $forceReload |
@@ -1071,8 +1047,7 @@ discard block |
||
1071 | 1047 | * {@inheritDoc} |
1072 | 1048 | * @see \Kitodo\Dlf\Common\Document::_getToplevelId() |
1073 | 1049 | */ |
1074 | - protected function _getToplevelId() |
|
1075 | - { |
|
1050 | + protected function _getToplevelId() { |
|
1076 | 1051 | if (empty($this->toplevelId)) { |
1077 | 1052 | // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
1078 | 1053 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'); |
@@ -1104,8 +1079,7 @@ discard block |
||
1104 | 1079 | * |
1105 | 1080 | * @return array Properties to be serialized |
1106 | 1081 | */ |
1107 | - public function __sleep() |
|
1108 | - { |
|
1082 | + public function __sleep() { |
|
1109 | 1083 | // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization |
1110 | 1084 | $this->asXML = $this->xml->asXML(); |
1111 | 1085 | return ['uid', 'pid', 'recordId', 'parentId', 'asXML']; |
@@ -1118,8 +1092,7 @@ discard block |
||
1118 | 1092 | * |
1119 | 1093 | * @return string String representing the METS object |
1120 | 1094 | */ |
1121 | - public function __toString() |
|
1122 | - { |
|
1095 | + public function __toString() { |
|
1123 | 1096 | $xml = new \DOMDocument('1.0', 'utf-8'); |
1124 | 1097 | $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
1125 | 1098 | $xml->formatOutput = true; |
@@ -1134,8 +1107,7 @@ discard block |
||
1134 | 1107 | * |
1135 | 1108 | * @return void |
1136 | 1109 | */ |
1137 | - public function __wakeup() |
|
1138 | - { |
|
1110 | + public function __wakeup() { |
|
1139 | 1111 | $xml = Helper::getXmlFileAsString($this->asXML); |
1140 | 1112 | if ($xml !== false) { |
1141 | 1113 | $this->asXML = ''; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @var bool |
75 | 75 | * @access protected |
76 | 76 | */ |
77 | - protected $dmdSecLoaded = false; |
|
77 | + protected $dmdSecLoaded = FALSE; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * The extension key |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @var bool |
101 | 101 | * @access protected |
102 | 102 | */ |
103 | - protected $fileGrpsLoaded = false; |
|
103 | + protected $fileGrpsLoaded = FALSE; |
|
104 | 104 | |
105 | 105 | /** |
106 | 106 | * This holds the XML file's METS part as \SimpleXMLElement object |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
176 | 176 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
177 | 177 | $service = IiifHelper::loadIiifResource($fileLocation); |
178 | - if ($service !== null && $service instanceof AbstractImageService) { |
|
178 | + if ($service !== NULL && $service instanceof AbstractImageService) { |
|
179 | 179 | return $service->getImageUrl(); |
180 | 180 | } |
181 | 181 | } elseif ($fileMimeType === 'application/vnd.netfpx') { |
182 | - $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : ''); |
|
182 | + $baseURL = $fileLocation . (strpos($fileLocation, '?') === FALSE ? '?' : ''); |
|
183 | 183 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
184 | 184 | return $baseURL . '&CVT=jpeg'; |
185 | 185 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * {@inheritDoc} |
227 | 227 | * @see \Kitodo\Dlf\Common\Document::getLogicalStructure() |
228 | 228 | */ |
229 | - public function getLogicalStructure($id, $recursive = false) |
|
229 | + public function getLogicalStructure($id, $recursive = FALSE) |
|
230 | 230 | { |
231 | 231 | $details = []; |
232 | 232 | // Is the requested logical unit already loaded? |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
269 | 269 | */ |
270 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) |
|
270 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = FALSE) |
|
271 | 271 | { |
272 | 272 | // Get attributes. |
273 | 273 | foreach ($structure->attributes() as $attribute => $value) { |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | && array_key_exists($details['id'], $this->smLinks['l2p']) |
313 | 313 | ) { |
314 | 314 | // Link logical structure to the first corresponding physical page/track. |
315 | - $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, true)), 1); |
|
315 | + $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE)), 1); |
|
316 | 316 | $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']); |
317 | 317 | while ($fileGrpThumb = array_shift($fileGrpsThumb)) { |
318 | 318 | if (!empty($this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$fileGrpThumb])) { |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $details['children'] = []; |
357 | 357 | foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) { |
358 | 358 | // Repeat for all children. |
359 | - $details['children'][] = $this->getLogicalStructureInfo($child, true); |
|
359 | + $details['children'][] = $this->getLogicalStructureInfo($child, TRUE); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | return $details; |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | if (!empty($dmdIds)) { |
426 | 426 | // Handle multiple DMDIDs separately. |
427 | 427 | $dmdIds = explode(' ', $dmdIds); |
428 | - $hasSupportedMetadata = false; |
|
428 | + $hasSupportedMetadata = FALSE; |
|
429 | 429 | } else { |
430 | 430 | // There is no dmdSec for this structure node. |
431 | 431 | return []; |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | } |
661 | 661 | } |
662 | 662 | // Extract metadata only from first supported dmdSec. |
663 | - $hasSupportedMetadata = true; |
|
663 | + $hasSupportedMetadata = TRUE; |
|
664 | 664 | break; |
665 | 665 | } |
666 | 666 | if ($hasSupportedMetadata) { |
@@ -726,16 +726,16 @@ discard block |
||
726 | 726 | protected function loadLocation($location) |
727 | 727 | { |
728 | 728 | $fileResource = GeneralUtility::getUrl($location); |
729 | - if ($fileResource !== false) { |
|
729 | + if ($fileResource !== FALSE) { |
|
730 | 730 | $xml = Helper::getXmlFileAsString($fileResource); |
731 | 731 | // Set some basic properties. |
732 | - if ($xml !== false) { |
|
732 | + if ($xml !== FALSE) { |
|
733 | 733 | $this->xml = $xml; |
734 | - return true; |
|
734 | + return TRUE; |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | $this->logger->error('Could not load XML file from "' . $location . '"'); |
738 | - return false; |
|
738 | + return FALSE; |
|
739 | 739 | } |
740 | 740 | |
741 | 741 | /** |
@@ -783,9 +783,9 @@ discard block |
||
783 | 783 | |
784 | 784 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
785 | 785 | $this->xml = $preloadedDocument; |
786 | - return true; |
|
786 | + return TRUE; |
|
787 | 787 | } |
788 | - return false; |
|
788 | + return FALSE; |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | /** |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | } |
832 | 832 | } |
833 | 833 | } |
834 | - $this->dmdSecLoaded = true; |
|
834 | + $this->dmdSecLoaded = TRUE; |
|
835 | 835 | } |
836 | 836 | return $this->dmdSec; |
837 | 837 | } |
@@ -878,9 +878,9 @@ discard block |
||
878 | 878 | !empty($extConf['fileGrpFulltext']) |
879 | 879 | && array_intersect(GeneralUtility::trimExplode(',', $extConf['fileGrpFulltext']), $this->fileGrps) !== [] |
880 | 880 | ) { |
881 | - $this->hasFulltext = true; |
|
881 | + $this->hasFulltext = TRUE; |
|
882 | 882 | } |
883 | - $this->fileGrpsLoaded = true; |
|
883 | + $this->fileGrpsLoaded = TRUE; |
|
884 | 884 | } |
885 | 885 | return $this->fileGrps; |
886 | 886 | } |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | $this->physicalStructure = array_merge($physSeq, $elements); |
970 | 970 | } |
971 | 971 | } |
972 | - $this->physicalStructureLoaded = true; |
|
972 | + $this->physicalStructureLoaded = TRUE; |
|
973 | 973 | } |
974 | 974 | return $this->physicalStructure; |
975 | 975 | } |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | $this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from; |
989 | 989 | } |
990 | 990 | } |
991 | - $this->smLinksLoaded = true; |
|
991 | + $this->smLinksLoaded = TRUE; |
|
992 | 992 | } |
993 | 993 | return $this->smLinks; |
994 | 994 | } |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | * {@inheritDoc} |
998 | 998 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
999 | 999 | */ |
1000 | - protected function _getThumbnail($forceReload = false) |
|
1000 | + protected function _getThumbnail($forceReload = FALSE) |
|
1001 | 1001 | { |
1002 | 1002 | if ( |
1003 | 1003 | !$this->thumbnailLoaded |
@@ -1007,14 +1007,14 @@ discard block |
||
1007 | 1007 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
1008 | 1008 | if (!$cPid) { |
1009 | 1009 | $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
1010 | - $this->thumbnailLoaded = true; |
|
1010 | + $this->thumbnailLoaded = TRUE; |
|
1011 | 1011 | return $this->thumbnail; |
1012 | 1012 | } |
1013 | 1013 | // Load extension configuration. |
1014 | 1014 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
1015 | 1015 | if (empty($extConf['fileGrpThumbs'])) { |
1016 | 1016 | $this->logger->warning('No fileGrp for thumbnails specified'); |
1017 | - $this->thumbnailLoaded = true; |
|
1017 | + $this->thumbnailLoaded = TRUE; |
|
1018 | 1018 | return $this->thumbnail; |
1019 | 1019 | } |
1020 | 1020 | $strctId = $this->_getToplevelId(); |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | } else { |
1069 | 1069 | $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
1070 | 1070 | } |
1071 | - $this->thumbnailLoaded = true; |
|
1071 | + $this->thumbnailLoaded = TRUE; |
|
1072 | 1072 | } |
1073 | 1073 | return $this->thumbnail; |
1074 | 1074 | } |
@@ -1127,8 +1127,8 @@ discard block |
||
1127 | 1127 | public function __toString() |
1128 | 1128 | { |
1129 | 1129 | $xml = new \DOMDocument('1.0', 'utf-8'); |
1130 | - $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
|
1131 | - $xml->formatOutput = true; |
|
1130 | + $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE)); |
|
1131 | + $xml->formatOutput = TRUE; |
|
1132 | 1132 | return $xml->saveXML(); |
1133 | 1133 | } |
1134 | 1134 | |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | public function __wakeup() |
1144 | 1144 | { |
1145 | 1145 | $xml = Helper::getXmlFileAsString($this->asXML); |
1146 | - if ($xml !== false) { |
|
1146 | + if ($xml !== FALSE) { |
|
1147 | 1147 | $this->asXML = ''; |
1148 | 1148 | $this->xml = $xml; |
1149 | 1149 | // Rebuild the unserializable properties. |
@@ -694,16 +694,16 @@ discard block |
||
694 | 694 | && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != null) |
695 | 695 | ) { |
696 | 696 | if (is_string($values)) { |
697 | - $metadata[$resArray['index_name'] . '_sorting'][0] = [trim((string) $values)]; |
|
697 | + $metadata[$resArray['index_name'].'_sorting'][0] = [trim((string) $values)]; |
|
698 | 698 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) { |
699 | 699 | $metadata[$resArray['index_name']] = []; |
700 | 700 | foreach ($values->data() as $value) { |
701 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $value); |
|
701 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $value); |
|
702 | 702 | } |
703 | 703 | } |
704 | 704 | } |
705 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
706 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
705 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
706 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
707 | 707 | } |
708 | 708 | } |
709 | 709 | } |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | } |
832 | 832 | } |
833 | 833 | } else { |
834 | - $this->logger->warning('Invalid structure resource @id "' . $id . '"'); |
|
834 | + $this->logger->warning('Invalid structure resource @id "'.$id.'"'); |
|
835 | 835 | return $rawText; |
836 | 836 | } |
837 | 837 | $this->rawTextArray[$id] = $rawText; |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } |
881 | 881 | } |
882 | 882 | } |
883 | - $this->logger->error('Could not load IIIF manifest from "' . $location . '"'); |
|
883 | + $this->logger->error('Could not load IIIF manifest from "'.$location.'"'); |
|
884 | 884 | return false; |
885 | 885 | } |
886 | 886 |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @var bool |
88 | 88 | * @access protected |
89 | 89 | */ |
90 | - protected $hasFulltextSet = false; |
|
90 | + protected $hasFulltextSet = FALSE; |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * This holds the original manifest's parsed metadata array with their corresponding |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | protected function establishRecordId($pid) |
122 | 122 | { |
123 | - if ($this->iiif !== null) { |
|
123 | + if ($this->iiif !== NULL) { |
|
124 | 124 | /* |
125 | 125 | * FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss |
126 | 126 | * if the plugin that actually loads the manifest allows content from other pages. |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @var bool |
205 | 205 | * @access protected |
206 | 206 | */ |
207 | - protected $useGrpsLoaded = false; |
|
207 | + protected $useGrpsLoaded = FALSE; |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * Holds the configured useGrps as array. |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | if (!empty($extConf['fileGrpAudio'])) { |
247 | 247 | $this->useGrps['fileGrpAudio'] = GeneralUtility::trimExplode(',', $extConf['fileGrpAudio']); |
248 | 248 | } |
249 | - $this->useGrpsLoaded = true; |
|
249 | + $this->useGrpsLoaded = TRUE; |
|
250 | 250 | } |
251 | 251 | return array_key_exists($use, $this->useGrps) ? $this->useGrps[$use] : []; |
252 | 252 | } |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | { |
260 | 260 | // Is there no physical structure array yet? |
261 | 261 | if (!$this->physicalStructureLoaded) { |
262 | - if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
|
263 | - return null; |
|
262 | + if ($this->iiif == NULL || !($this->iiif instanceof ManifestInterface)) { |
|
263 | + return NULL; |
|
264 | 264 | } |
265 | 265 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
266 | 266 | $iiifId = $this->iiif->getId(); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $this->physicalStructureInfo[$physSeq[0]]['label'] = $this->iiif->getLabelForDisplay(); |
271 | 271 | $this->physicalStructureInfo[$physSeq[0]]['orderlabel'] = $this->iiif->getLabelForDisplay(); |
272 | 272 | $this->physicalStructureInfo[$physSeq[0]]['type'] = 'physSequence'; |
273 | - $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = null; |
|
273 | + $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = NULL; |
|
274 | 274 | $fileUseDownload = $this->getUseGroups('fileGrpDownload'); |
275 | 275 | $fileUseFulltext = $this->getUseGroups('fileGrpFulltext'); |
276 | 276 | $fileUseThumbs = $this->getUseGroups('fileGrpThumbs'); |
@@ -284,13 +284,13 @@ discard block |
||
284 | 284 | if (!empty($fileUseFulltext)) { |
285 | 285 | $iiifAlto = $this->iiif->getSeeAlsoUrlsForFormat('application/alto+xml'); |
286 | 286 | if (empty($iiifAlto)) { |
287 | - $iiifAlto = $this->iiif->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', true); |
|
287 | + $iiifAlto = $this->iiif->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', TRUE); |
|
288 | 288 | } |
289 | 289 | if (!empty($iiifAlto)) { |
290 | 290 | $this->mimeTypes[$iiifAlto[0]] = 'application/alto+xml'; |
291 | 291 | $this->physicalStructureInfo[$physSeq[0]]['files'][$fileUseFulltext[0]] = $iiifAlto[0]; |
292 | - $this->hasFulltext = true; |
|
293 | - $this->hasFulltextSet = true; |
|
292 | + $this->hasFulltext = TRUE; |
|
293 | + $this->hasFulltextSet = TRUE; |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | if (!empty($this->iiif->getDefaultCanvases())) { |
@@ -309,39 +309,39 @@ discard block |
||
309 | 309 | // populate structural metadata info |
310 | 310 | $elements[$canvasOrder] = $canvas->getId(); |
311 | 311 | $this->physicalStructureInfo[$elements[$canvasOrder]]['id'] = $canvas->getId(); |
312 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId'] = null; |
|
312 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId'] = NULL; |
|
313 | 313 | $this->physicalStructureInfo[$elements[$canvasOrder]]['label'] = $canvas->getLabelForDisplay(); |
314 | 314 | $this->physicalStructureInfo[$elements[$canvasOrder]]['orderlabel'] = $canvas->getLabelForDisplay(); |
315 | 315 | // assume that a canvas always represents a page |
316 | 316 | $this->physicalStructureInfo[$elements[$canvasOrder]]['type'] = 'page'; |
317 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds'] = null; |
|
318 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = null; |
|
317 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds'] = NULL; |
|
318 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = NULL; |
|
319 | 319 | if (!empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
320 | 320 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = []; |
321 | 321 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
322 | 322 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'][] = $annotationContainer->getId(); |
323 | 323 | if ($extConf['indexAnnotations']) { |
324 | - $this->hasFulltext = true; |
|
325 | - $this->hasFulltextSet = true; |
|
324 | + $this->hasFulltext = TRUE; |
|
325 | + $this->hasFulltextSet = TRUE; |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | } |
329 | 329 | if (!empty($fileUseFulltext)) { |
330 | 330 | $alto = $canvas->getSeeAlsoUrlsForFormat('application/alto+xml'); |
331 | 331 | if (empty($alto)) { |
332 | - $alto = $canvas->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', true); |
|
332 | + $alto = $canvas->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', TRUE); |
|
333 | 333 | } |
334 | 334 | if (!empty($alto)) { |
335 | 335 | $this->mimeTypes[$alto[0]] = 'application/alto+xml'; |
336 | 336 | $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUseFulltext[0]] = $alto[0]; |
337 | - $this->hasFulltext = true; |
|
338 | - $this->hasFulltextSet = true; |
|
337 | + $this->hasFulltext = TRUE; |
|
338 | + $this->hasFulltextSet = TRUE; |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | if (!empty($fileUses)) { |
342 | 342 | $image = $canvas->getImageAnnotations()[0]; |
343 | 343 | foreach ($fileUses as $fileUse) { |
344 | - if ($image->getBody() !== null && $image->getBody() instanceof ContentResourceInterface) { |
|
344 | + if ($image->getBody() !== NULL && $image->getBody() instanceof ContentResourceInterface) { |
|
345 | 345 | $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUse] = $image->getBody()->getId(); |
346 | 346 | } |
347 | 347 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | // Merge and re-index the array to get nice numeric indexes. |
361 | 361 | $this->physicalStructure = array_merge($physSeq, $elements); |
362 | 362 | } |
363 | - $this->physicalStructureLoaded = true; |
|
363 | + $this->physicalStructureLoaded = TRUE; |
|
364 | 364 | } |
365 | 365 | return $this->physicalStructure; |
366 | 366 | } |
@@ -385,15 +385,15 @@ discard block |
||
385 | 385 | */ |
386 | 386 | public function getFileLocation($id) |
387 | 387 | { |
388 | - if ($id == null) { |
|
389 | - return null; |
|
388 | + if ($id == NULL) { |
|
389 | + return NULL; |
|
390 | 390 | } |
391 | 391 | $resource = $this->iiif->getContainedResourceById($id); |
392 | 392 | if (isset($resource)) { |
393 | 393 | if ($resource instanceof CanvasInterface) { |
394 | - return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != null) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id; |
|
394 | + return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != NULL) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id; |
|
395 | 395 | } elseif ($resource instanceof ContentResourceInterface) { |
396 | - return $resource->getSingleService() != null && $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id; |
|
396 | + return $resource->getSingleService() != NULL && $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id; |
|
397 | 397 | } elseif ($resource instanceof AbstractImageService) { |
398 | 398 | return $resource->getId(); |
399 | 399 | } elseif ($resource instanceof AnnotationContainerInterface) { |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | } elseif ($fileResource instanceof AnnotationInterface) { |
417 | 417 | $format = "application/vnd.kitodo.iiif"; |
418 | 418 | } elseif ($fileResource instanceof ContentResourceInterface) { |
419 | - if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == null || !($fileResource->getSingleService() instanceof AbstractImageService))) { |
|
419 | + if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == NULL || !($fileResource->getSingleService() instanceof AbstractImageService))) { |
|
420 | 420 | // Support static images without an image service |
421 | 421 | return $fileResource->getFormat(); |
422 | 422 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * {@inheritDoc} |
435 | 435 | * @see Document::getLogicalStructure() |
436 | 436 | */ |
437 | - public function getLogicalStructure($id, $recursive = false) |
|
437 | + public function getLogicalStructure($id, $recursive = FALSE) |
|
438 | 438 | { |
439 | 439 | $details = []; |
440 | 440 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | // cache the ranges - they might occure multiple times in the structures "tree" - with full data as well as referenced as id |
452 | 452 | $processedStructures = []; |
453 | 453 | foreach ($logUnits as $logUnit) { |
454 | - if (array_search($logUnit->getId(), $processedStructures) == false) { |
|
455 | - $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, true, $processedStructures); |
|
454 | + if (array_search($logUnit->getId(), $processedStructures) == FALSE) { |
|
455 | + $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, TRUE, $processedStructures); |
|
456 | 456 | } |
457 | 457 | } |
458 | 458 | } |
@@ -470,13 +470,13 @@ discard block |
||
470 | 470 | * @param array $processedStructures: IIIF resources that already have been processed |
471 | 471 | * @return array Logical structure array |
472 | 472 | */ |
473 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) |
|
473 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = FALSE, &$processedStructures = []) |
|
474 | 474 | { |
475 | 475 | $details = []; |
476 | 476 | $details['id'] = $resource->getId(); |
477 | 477 | $details['dmdId'] = ''; |
478 | - $details['label'] = $resource->getLabelForDisplay() !== null ? $resource->getLabelForDisplay() : ''; |
|
479 | - $details['orderlabel'] = $resource->getLabelForDisplay() !== null ? $resource->getLabelForDisplay() : ''; |
|
478 | + $details['label'] = $resource->getLabelForDisplay() !== NULL ? $resource->getLabelForDisplay() : ''; |
|
479 | + $details['orderlabel'] = $resource->getLabelForDisplay() !== NULL ? $resource->getLabelForDisplay() : ''; |
|
480 | 480 | $details['contentIds'] = ''; |
481 | 481 | $details['volume'] = ''; |
482 | 482 | $details['pagination'] = ''; |
@@ -501,10 +501,10 @@ discard block |
||
501 | 501 | $startCanvas = $resource->getStartCanvasOrFirstCanvas(); |
502 | 502 | $canvases = $resource->getAllCanvases(); |
503 | 503 | } |
504 | - if ($startCanvas != null) { |
|
504 | + if ($startCanvas != NULL) { |
|
505 | 505 | $details['pagination'] = $startCanvas->getLabel(); |
506 | 506 | $startCanvasIndex = array_search($startCanvas, $this->iiif->getDefaultCanvases()); |
507 | - if ($startCanvasIndex !== false) { |
|
507 | + if ($startCanvasIndex !== FALSE) { |
|
508 | 508 | $details['points'] = $startCanvasIndex + 1; |
509 | 509 | } |
510 | 510 | } |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | if ($recursive) { |
519 | 519 | $processedStructures[] = $resource->getId(); |
520 | 520 | $details['children'] = []; |
521 | - if ($resource instanceof ManifestInterface && $resource->getRootRanges() != null) { |
|
521 | + if ($resource instanceof ManifestInterface && $resource->getRootRanges() != NULL) { |
|
522 | 522 | $rangesToAdd = []; |
523 | 523 | $rootRanges = []; |
524 | 524 | if (sizeof($this->iiif->getRootRanges()) == 1 && $this->iiif->getRootRanges()[0]->isTopRange()) { |
@@ -530,15 +530,15 @@ discard block |
||
530 | 530 | $rootRanges[] = $range; |
531 | 531 | } |
532 | 532 | foreach ($rootRanges as $range) { |
533 | - if ((array_search($range->getId(), $processedStructures) == false)) { |
|
534 | - $details['children'][] = $this->getLogicalStructureInfo($range, true, $processedStructures); |
|
533 | + if ((array_search($range->getId(), $processedStructures) == FALSE)) { |
|
534 | + $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures); |
|
535 | 535 | } |
536 | 536 | } |
537 | 537 | } elseif ($resource instanceof RangeInterface) { |
538 | 538 | if (!empty($resource->getAllRanges())) { |
539 | 539 | foreach ($resource->getAllRanges() as $range) { |
540 | - if ((array_search($range->getId(), $processedStructures) == false)) { |
|
541 | - $details['children'][] = $this->getLogicalStructureInfo($range, true, $processedStructures); |
|
540 | + if ((array_search($range->getId(), $processedStructures) == FALSE)) { |
|
541 | + $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures); |
|
542 | 542 | } |
543 | 543 | } |
544 | 544 | } |
@@ -563,15 +563,15 @@ discard block |
||
563 | 563 | * |
564 | 564 | * @todo This method is still in experimental; the method signature may change. |
565 | 565 | */ |
566 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) |
|
566 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = TRUE, $withRights = TRUE, $withRelated = TRUE) |
|
567 | 567 | { |
568 | 568 | if (!empty($this->originalMetadataArray[$id])) { |
569 | 569 | return $this->originalMetadataArray[$id]; |
570 | 570 | } |
571 | 571 | $iiifResource = $this->iiif->getContainedResourceById($id); |
572 | 572 | $result = []; |
573 | - if ($iiifResource != null) { |
|
574 | - if ($iiifResource->getLabel() != null && $iiifResource->getLabel() != "") { |
|
573 | + if ($iiifResource != NULL) { |
|
574 | + if ($iiifResource->getLabel() != NULL && $iiifResource->getLabel() != "") { |
|
575 | 575 | $result['label'] = $iiifResource->getLabel(); |
576 | 576 | } |
577 | 577 | if (!empty($iiifResource->getMetadata())) { |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | $iiifResource = $this->iiif->getContainedResourceById($id); |
674 | 674 | while ($resArray = $result->fetch()) { |
675 | 675 | // Set metadata field's value(s). |
676 | - if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != null) { |
|
676 | + if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != NULL) { |
|
677 | 677 | if (is_string($values)) { |
678 | 678 | $metadata[$resArray['index_name']] = [trim((string) $values)]; |
679 | 679 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) { |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | if (!empty($metadata[$resArray['index_name']]) && $resArray['is_sortable']) { |
692 | 692 | if ( |
693 | 693 | $resArray['format'] > 0 && !empty($resArray['xpath_sorting']) |
694 | - && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != null) |
|
694 | + && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != NULL) |
|
695 | 695 | ) { |
696 | 696 | if (is_string($values)) { |
697 | 697 | $metadata[$resArray['index_name'] . '_sorting'][0] = [trim((string) $values)]; |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | $this->smLinkRangeCanvasesRecursively($range); |
728 | 728 | } |
729 | 729 | } |
730 | - $this->smLinksLoaded = true; |
|
730 | + $this->smLinksLoaded = TRUE; |
|
731 | 731 | } |
732 | 732 | return $this->smLinks; |
733 | 733 | } |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | foreach ($annotationContainer->getTextAnnotations(Motivation::PAINTING) as $annotation) { |
822 | 822 | if ( |
823 | 823 | $annotation->getTargetResourceId() == $iiifResource->getId() && |
824 | - $annotation->getBody() != null && $annotation->getBody()->getChars() != null |
|
824 | + $annotation->getBody() != NULL && $annotation->getBody()->getChars() != NULL |
|
825 | 825 | ) { |
826 | 826 | $annotationTexts[] = $annotation->getBody()->getChars(); |
827 | 827 | } |
@@ -867,21 +867,21 @@ discard block |
||
867 | 867 | protected function loadLocation($location) |
868 | 868 | { |
869 | 869 | $fileResource = GeneralUtility::getUrl($location); |
870 | - if ($fileResource !== false) { |
|
870 | + if ($fileResource !== FALSE) { |
|
871 | 871 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
872 | 872 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
873 | 873 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
874 | 874 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
875 | 875 | $resource = IiifHelper::loadIiifResource($fileResource); |
876 | - if ($resource != null) { |
|
876 | + if ($resource != NULL) { |
|
877 | 877 | if ($resource instanceof ManifestInterface) { |
878 | 878 | $this->iiif = $resource; |
879 | - return true; |
|
879 | + return TRUE; |
|
880 | 880 | } |
881 | 881 | } |
882 | 882 | } |
883 | 883 | $this->logger->error('Could not load IIIF manifest from "' . $location . '"'); |
884 | - return false; |
|
884 | + return FALSE; |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | /** |
@@ -902,9 +902,9 @@ discard block |
||
902 | 902 | { |
903 | 903 | if ($preloadedDocument instanceof ManifestInterface) { |
904 | 904 | $this->iiif = $preloadedDocument; |
905 | - return true; |
|
905 | + return TRUE; |
|
906 | 906 | } |
907 | - return false; |
|
907 | + return FALSE; |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | /** |
@@ -927,22 +927,22 @@ discard block |
||
927 | 927 | !empty($canvas->getSeeAlsoUrlsForFormat("application/alto+xml")) || |
928 | 928 | !empty($canvas->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/")) |
929 | 929 | ) { |
930 | - $this->hasFulltextSet = true; |
|
931 | - $this->hasFulltext = true; |
|
930 | + $this->hasFulltextSet = TRUE; |
|
931 | + $this->hasFulltext = TRUE; |
|
932 | 932 | return; |
933 | 933 | } |
934 | 934 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
935 | 935 | if ($extConf['indexAnnotations'] == 1 && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
936 | 936 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
937 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
937 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
938 | 938 | foreach ($textAnnotations as $annotation) { |
939 | 939 | if ( |
940 | - $annotation->getBody() != null && |
|
940 | + $annotation->getBody() != NULL && |
|
941 | 941 | $annotation->getBody()->getFormat() == "text/plain" && |
942 | - $annotation->getBody()->getChars() != null |
|
942 | + $annotation->getBody()->getChars() != NULL |
|
943 | 943 | ) { |
944 | - $this->hasFulltextSet = true; |
|
945 | - $this->hasFulltext = true; |
|
944 | + $this->hasFulltextSet = TRUE; |
|
945 | + $this->hasFulltext = TRUE; |
|
946 | 946 | return; |
947 | 947 | } |
948 | 948 | } |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | } |
951 | 951 | } |
952 | 952 | } |
953 | - $this->hasFulltextSet = true; |
|
953 | + $this->hasFulltextSet = TRUE; |
|
954 | 954 | } |
955 | 955 | } |
956 | 956 | |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | * {@inheritDoc} |
959 | 959 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
960 | 960 | */ |
961 | - protected function _getThumbnail($forceReload = false) |
|
961 | + protected function _getThumbnail($forceReload = FALSE) |
|
962 | 962 | { |
963 | 963 | return $this->iiif->getThumbnailUrl(); |
964 | 964 | } |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
993 | 993 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
994 | 994 | $resource = IiifHelper::loadIiifResource($this->asJson); |
995 | - if ($resource != null && $resource instanceof ManifestInterface) { |
|
995 | + if ($resource != NULL && $resource instanceof ManifestInterface) { |
|
996 | 996 | $this->asJson = ''; |
997 | 997 | $this->iiif = $resource; |
998 | 998 | $this->init(); |
@@ -56,8 +56,7 @@ discard block |
||
56 | 56 | * @property-read string $toplevelId This holds the toplevel manifest's @id |
57 | 57 | * @property-read mixed $uid This holds the UID or the URL of the document |
58 | 58 | */ |
59 | -final class IiifManifest extends Document |
|
60 | -{ |
|
59 | +final class IiifManifest extends Document { |
|
61 | 60 | /** |
62 | 61 | * This holds the manifest file as string for serialization purposes |
63 | 62 | * @see __sleep() / __wakeup() |
@@ -118,8 +117,7 @@ discard block |
||
118 | 117 | * {@inheritDoc} |
119 | 118 | * @see Document::establishRecordId() |
120 | 119 | */ |
121 | - protected function establishRecordId($pid) |
|
122 | - { |
|
120 | + protected function establishRecordId($pid) { |
|
123 | 121 | if ($this->iiif !== null) { |
124 | 122 | /* |
125 | 123 | * FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss |
@@ -170,8 +168,7 @@ discard block |
||
170 | 168 | * {@inheritDoc} |
171 | 169 | * @see Document::getDocument() |
172 | 170 | */ |
173 | - protected function getDocument() |
|
174 | - { |
|
171 | + protected function getDocument() { |
|
175 | 172 | return $this->iiif; |
176 | 173 | } |
177 | 174 | |
@@ -184,8 +181,7 @@ discard block |
||
184 | 181 | * @return string 'IIIF1' if the resource is a Metadata API 1 resource, 'IIIF2' / 'IIIF3' if |
185 | 182 | * the resource is a Presentation API 2 / 3 resource |
186 | 183 | */ |
187 | - public function getIiifVersion() |
|
188 | - { |
|
184 | + public function getIiifVersion() { |
|
189 | 185 | if (!isset($this->iiifVersion)) { |
190 | 186 | if ($this->iiif instanceof AbstractIiifResource1) { |
191 | 187 | $this->iiifVersion = 'IIIF1'; |
@@ -226,8 +222,7 @@ discard block |
||
226 | 222 | * |
227 | 223 | * @return array|string |
228 | 224 | */ |
229 | - protected function getUseGroups($use) |
|
230 | - { |
|
225 | + protected function getUseGroups($use) { |
|
231 | 226 | if (!$this->useGrpsLoaded) { |
232 | 227 | // Get configured USE attributes. |
233 | 228 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -255,8 +250,7 @@ discard block |
||
255 | 250 | * {@inheritDoc} |
256 | 251 | * @see Document::_getPhysicalStructure() |
257 | 252 | */ |
258 | - protected function _getPhysicalStructure() |
|
259 | - { |
|
253 | + protected function _getPhysicalStructure() { |
|
260 | 254 | // Is there no physical structure array yet? |
261 | 255 | if (!$this->physicalStructureLoaded) { |
262 | 256 | if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
@@ -369,8 +363,7 @@ discard block |
||
369 | 363 | * {@inheritDoc} |
370 | 364 | * @see Document::getDownloadLocation() |
371 | 365 | */ |
372 | - public function getDownloadLocation($id) |
|
373 | - { |
|
366 | + public function getDownloadLocation($id) { |
|
374 | 367 | $fileLocation = $this->getFileLocation($id); |
375 | 368 | $resource = $this->iiif->getContainedResourceById($fileLocation); |
376 | 369 | if ($resource instanceof AbstractImageService) { |
@@ -383,8 +376,7 @@ discard block |
||
383 | 376 | * {@inheritDoc} |
384 | 377 | * @see Document::getFileLocation() |
385 | 378 | */ |
386 | - public function getFileLocation($id) |
|
387 | - { |
|
379 | + public function getFileLocation($id) { |
|
388 | 380 | if ($id == null) { |
389 | 381 | return null; |
390 | 382 | } |
@@ -408,8 +400,7 @@ discard block |
||
408 | 400 | * {@inheritDoc} |
409 | 401 | * @see Document::getFileMimeType() |
410 | 402 | */ |
411 | - public function getFileMimeType($id) |
|
412 | - { |
|
403 | + public function getFileMimeType($id) { |
|
413 | 404 | $fileResource = $this->iiif->getContainedResourceById($id); |
414 | 405 | if ($fileResource instanceof CanvasInterface) { |
415 | 406 | $format = "application/vnd.kitodo.iiif"; |
@@ -434,8 +425,7 @@ discard block |
||
434 | 425 | * {@inheritDoc} |
435 | 426 | * @see Document::getLogicalStructure() |
436 | 427 | */ |
437 | - public function getLogicalStructure($id, $recursive = false) |
|
438 | - { |
|
428 | + public function getLogicalStructure($id, $recursive = false) { |
|
439 | 429 | $details = []; |
440 | 430 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
441 | 431 | return $this->logicalUnits[$id]; |
@@ -470,8 +460,7 @@ discard block |
||
470 | 460 | * @param array $processedStructures: IIIF resources that already have been processed |
471 | 461 | * @return array Logical structure array |
472 | 462 | */ |
473 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) |
|
474 | - { |
|
463 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) { |
|
475 | 464 | $details = []; |
476 | 465 | $details['id'] = $resource->getId(); |
477 | 466 | $details['dmdId'] = ''; |
@@ -563,8 +552,7 @@ discard block |
||
563 | 552 | * |
564 | 553 | * @todo This method is still in experimental; the method signature may change. |
565 | 554 | */ |
566 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) |
|
567 | - { |
|
555 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) { |
|
568 | 556 | if (!empty($this->originalMetadataArray[$id])) { |
569 | 557 | return $this->originalMetadataArray[$id]; |
570 | 558 | } |
@@ -606,8 +594,7 @@ discard block |
||
606 | 594 | * {@inheritDoc} |
607 | 595 | * @see Document::getMetadata() |
608 | 596 | */ |
609 | - public function getMetadata($id, $cPid = 0) |
|
610 | - { |
|
597 | + public function getMetadata($id, $cPid = 0) { |
|
611 | 598 | if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) { |
612 | 599 | return $this->metadataArray[$id]; |
613 | 600 | } |
@@ -714,8 +701,7 @@ discard block |
||
714 | 701 | * {@inheritDoc} |
715 | 702 | * @see Document::_getSmLinks() |
716 | 703 | */ |
717 | - protected function _getSmLinks() |
|
718 | - { |
|
704 | + protected function _getSmLinks() { |
|
719 | 705 | if (!$this->smLinksLoaded && isset($this->iiif) && $this->iiif instanceof ManifestInterface) { |
720 | 706 | if (!empty($this->iiif->getDefaultCanvases())) { |
721 | 707 | foreach ($this->iiif->getDefaultCanvases() as $canvas) { |
@@ -739,8 +725,7 @@ discard block |
||
739 | 725 | * |
740 | 726 | * @param RangeInterface $range: Current range whose canvases shall be linked |
741 | 727 | */ |
742 | - private function smLinkRangeCanvasesRecursively(RangeInterface $range) |
|
743 | - { |
|
728 | + private function smLinkRangeCanvasesRecursively(RangeInterface $range) { |
|
744 | 729 | // map range's canvases including all child ranges' canvases |
745 | 730 | if (!$range->isTopRange()) { |
746 | 731 | foreach ($range->getAllCanvasesRecursively() as $canvas) { |
@@ -763,8 +748,7 @@ discard block |
||
763 | 748 | * @param CanvasInterface $canvas |
764 | 749 | * @param IiifResourceInterface $resource |
765 | 750 | */ |
766 | - private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) |
|
767 | - { |
|
751 | + private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) { |
|
768 | 752 | $this->smLinks['l2p'][$resource->getId()][] = $canvas->getId(); |
769 | 753 | if (!is_array($this->smLinks['p2l'][$canvas->getId()]) || !in_array($resource->getId(), $this->smLinks['p2l'][$canvas->getId()])) { |
770 | 754 | $this->smLinks['p2l'][$canvas->getId()][] = $resource->getId(); |
@@ -779,8 +763,7 @@ discard block |
||
779 | 763 | * |
780 | 764 | * @see Document::getParentDocumentUidForSaving() |
781 | 765 | */ |
782 | - protected function getParentDocumentUidForSaving($pid, $core, $owner) |
|
783 | - { |
|
766 | + protected function getParentDocumentUidForSaving($pid, $core, $owner) { |
|
784 | 767 | // Do nothing. |
785 | 768 | } |
786 | 769 | |
@@ -789,8 +772,7 @@ discard block |
||
789 | 772 | * @see Document::getFullText() |
790 | 773 | */ |
791 | 774 | //TODO: rewrite it to get full OCR |
792 | - public function getFullText($id) |
|
793 | - { |
|
775 | + public function getFullText($id) { |
|
794 | 776 | $rawText = ''; |
795 | 777 | // Get text from raw text array if available. |
796 | 778 | if (!empty($this->rawTextArray[$id])) { |
@@ -847,8 +829,7 @@ discard block |
||
847 | 829 | * |
848 | 830 | * @return IiifResourceInterface |
849 | 831 | */ |
850 | - public function getIiif() |
|
851 | - { |
|
832 | + public function getIiif() { |
|
852 | 833 | return $this->iiif; |
853 | 834 | } |
854 | 835 | |
@@ -856,8 +837,7 @@ discard block |
||
856 | 837 | * {@inheritDoc} |
857 | 838 | * @see Document::init() |
858 | 839 | */ |
859 | - protected function init() |
|
860 | - { |
|
840 | + protected function init() { |
|
861 | 841 | // Nothing to do here, at the moment |
862 | 842 | } |
863 | 843 | |
@@ -865,8 +845,7 @@ discard block |
||
865 | 845 | * {@inheritDoc} |
866 | 846 | * @see Document::loadLocation() |
867 | 847 | */ |
868 | - protected function loadLocation($location) |
|
869 | - { |
|
848 | + protected function loadLocation($location) { |
|
870 | 849 | $fileResource = GeneralUtility::getUrl($location); |
871 | 850 | if ($fileResource !== false) { |
872 | 851 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -889,8 +868,7 @@ discard block |
||
889 | 868 | * {@inheritDoc} |
890 | 869 | * @see \Kitodo\Dlf\Common\Document::prepareMetadataArray() |
891 | 870 | */ |
892 | - protected function prepareMetadataArray($cPid) |
|
893 | - { |
|
871 | + protected function prepareMetadataArray($cPid) { |
|
894 | 872 | $id = $this->iiif->getId(); |
895 | 873 | $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid); |
896 | 874 | } |
@@ -899,8 +877,7 @@ discard block |
||
899 | 877 | * {@inheritDoc} |
900 | 878 | * @see Document::setPreloadedDocument() |
901 | 879 | */ |
902 | - protected function setPreloadedDocument($preloadedDocument) |
|
903 | - { |
|
880 | + protected function setPreloadedDocument($preloadedDocument) { |
|
904 | 881 | if ($preloadedDocument instanceof ManifestInterface) { |
905 | 882 | $this->iiif = $preloadedDocument; |
906 | 883 | return true; |
@@ -912,8 +889,7 @@ discard block |
||
912 | 889 | * {@inheritDoc} |
913 | 890 | * @see Document::ensureHasFulltextIsSet() |
914 | 891 | */ |
915 | - protected function ensureHasFulltextIsSet() |
|
916 | - { |
|
892 | + protected function ensureHasFulltextIsSet() { |
|
917 | 893 | /* |
918 | 894 | * TODO Check annotations and annotation lists of canvas for ALTO documents. |
919 | 895 | * Example: |
@@ -959,8 +935,7 @@ discard block |
||
959 | 935 | * {@inheritDoc} |
960 | 936 | * @see \Kitodo\Dlf\Common\Document::_getThumbnail() |
961 | 937 | */ |
962 | - protected function _getThumbnail($forceReload = false) |
|
963 | - { |
|
938 | + protected function _getThumbnail($forceReload = false) { |
|
964 | 939 | return $this->iiif->getThumbnailUrl(); |
965 | 940 | } |
966 | 941 | |
@@ -968,8 +943,7 @@ discard block |
||
968 | 943 | * {@inheritDoc} |
969 | 944 | * @see \Kitodo\Dlf\Common\Document::_getToplevelId() |
970 | 945 | */ |
971 | - protected function _getToplevelId() |
|
972 | - { |
|
946 | + protected function _getToplevelId() { |
|
973 | 947 | if (empty($this->toplevelId)) { |
974 | 948 | if (isset($this->iiif)) { |
975 | 949 | $this->toplevelId = $this->iiif->getId(); |
@@ -986,8 +960,7 @@ discard block |
||
986 | 960 | * |
987 | 961 | * @return void |
988 | 962 | */ |
989 | - public function __wakeup() |
|
990 | - { |
|
963 | + public function __wakeup() { |
|
991 | 964 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
992 | 965 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
993 | 966 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -1006,8 +979,7 @@ discard block |
||
1006 | 979 | * |
1007 | 980 | * @return string[] |
1008 | 981 | */ |
1009 | - public function __sleep() |
|
1010 | - { |
|
982 | + public function __sleep() { |
|
1011 | 983 | // TODO implement serializiation in IIIF library |
1012 | 984 | $jsonArray = $this->iiif->getOriginalJsonArray(); |
1013 | 985 | $this->asJson = json_encode($jsonArray); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | // Load document with current plugin parameters. |
76 | 76 | $doc = $this->loadDocument($queryParams[$this->prefixId]); |
77 | - if ($doc === null) { |
|
77 | + if ($doc === NULL) { |
|
78 | 78 | return $type; |
79 | 79 | } |
80 | 80 | // Set PID for metadata definitions. |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | // Calendar plugin does not support IIIF (yet). Abort for all newspaper related types. |
86 | 86 | if ( |
87 | 87 | $doc instanceof IiifManifest |
88 | - && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== false |
|
88 | + && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== FALSE |
|
89 | 89 | ) { |
90 | 90 | return $type; |
91 | 91 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if ($doc->ready) { |
117 | 117 | return $doc; |
118 | 118 | } else { |
119 | - $this->logger->warning('Failed to load document with UID ' . $piVars['id']); |
|
119 | + $this->logger->warning('Failed to load document with UID '.$piVars['id']); |
|
120 | 120 | } |
121 | 121 | } elseif (!empty($piVars['recordId'])) { |
122 | 122 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | // Try to load document. |
138 | 138 | return $this->loadDocument(['id' => $resArray['uid']]); |
139 | 139 | } else { |
140 | - $this->logger->warning('Failed to load document with record ID "' . $piVars['recordId'] . '"'); |
|
140 | + $this->logger->warning('Failed to load document with record ID "'.$piVars['recordId'].'"'); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | } |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * @return ExpressionFunction[] An array of Function instances |
48 | 48 | */ |
49 | - public function getFunctions() |
|
50 | - { |
|
49 | + public function getFunctions() { |
|
51 | 50 | return [ |
52 | 51 | $this->getDocumentTypeFunction(), |
53 | 52 | ]; |
@@ -62,12 +61,10 @@ discard block |
||
62 | 61 | { |
63 | 62 | return new ExpressionFunction( |
64 | 63 | 'getDocumentType', |
65 | - function() |
|
66 | - { |
|
64 | + function() { |
|
67 | 65 | // Not implemented, we only use the evaluator |
68 | 66 | }, |
69 | - function($arguments, $cPid) |
|
70 | - { |
|
67 | + function($arguments, $cPid) { |
|
71 | 68 | /** @var RequestWrapper $requestWrapper */ |
72 | 69 | $requestWrapper = $arguments['request']; |
73 | 70 | $queryParams = $requestWrapper->getQueryParams(); |
@@ -107,8 +104,7 @@ discard block |
||
107 | 104 | * |
108 | 105 | * @return \Kitodo\Dlf\Common\Document Instance of the current document |
109 | 106 | */ |
110 | - protected function loadDocument(array $piVars) |
|
111 | - { |
|
107 | + protected function loadDocument(array $piVars) { |
|
112 | 108 | // Check for required variable. |
113 | 109 | if (!empty($piVars['id'])) { |
114 | 110 | // Get instance of document. |