Passed
Pull Request — master (#15)
by
unknown
04:23
created
Classes/Plugin/OaiPmh.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         // Delete expired resumption tokens.
83 83
         $GLOBALS['TYPO3_DB']->exec_DELETEquery(
84 84
             'tx_dlf_tokens',
85
-            'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.tstamp<' . intval($GLOBALS['EXEC_TIME'] - $this->conf['expired'])
85
+            'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.tstamp<'.intval($GLOBALS['EXEC_TIME'] - $this->conf['expired'])
86 86
         );
87 87
         if ($GLOBALS['TYPO3_DB']->sql_affected_rows() === -1) {
88 88
             // Deletion failed.
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
         $oai_dc = $this->oai->createElementNS($this->formats['oai_dc']['namespace'], 'oai_dc:dc');
151 151
         $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:dc', 'http://purl.org/dc/elements/1.1/');
152 152
         $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
153
-        $oai_dc->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['oai_dc']['namespace'] . ' ' . $this->formats['oai_dc']['schema']);
153
+        $oai_dc->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['oai_dc']['namespace'].' '.$this->formats['oai_dc']['schema']);
154 154
         $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['record_id'], ENT_NOQUOTES, 'UTF-8')));
155 155
         if (!empty($metadata['purl'])) {
156 156
             $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8')));
157 157
         }
158 158
         if (!empty($metadata['prod_id'])) {
159
-            $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')));
159
+            $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')));
160 160
         }
161 161
         if (!empty($metadata['urn'])) {
162 162
             $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8')));
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         }
254 254
         // Add attributes and build XML tree.
255 255
         $epicur->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
256
-        $epicur->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['epicur']['namespace'] . ' ' . $this->formats['epicur']['schema']);
256
+        $epicur->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['epicur']['namespace'].' '.$this->formats['epicur']['schema']);
257 257
         // Do we update an URN or register a new one?
258 258
         if ($metadata['tstamp'] == $metadata['crdate']) {
259 259
             $update->setAttribute('type', 'urn_new');
@@ -300,10 +300,10 @@  discard block
 block discarded – undo
300 300
                 // Import node into \DOMDocument.
301 301
                 $mets = $this->oai->importNode($root->item(0), true);
302 302
             } else {
303
-                Helper::devLog('No METS part found in document with location "' . $metadata['location'] . '"', DEVLOG_SEVERITY_ERROR);
303
+                Helper::devLog('No METS part found in document with location "'.$metadata['location'].'"', DEVLOG_SEVERITY_ERROR);
304 304
             }
305 305
         } else {
306
-            Helper::devLog('Could not load XML file from "' . $metadata['location'] . '"', DEVLOG_SEVERITY_ERROR);
306
+            Helper::devLog('Could not load XML file from "'.$metadata['location'].'"', DEVLOG_SEVERITY_ERROR);
307 307
         }
308 308
         if ($mets === null) {
309 309
             $mets = $this->oai->createElementNS('http://kitodo.org/', 'kitodo:error', htmlspecialchars($this->pi_getLL('error', 'Error!', false), ENT_NOQUOTES, 'UTF-8'));
@@ -339,15 +339,15 @@  discard block
 block discarded – undo
339 339
             if (substr($this->conf['stylesheet'], 0, 4) == 'EXT:') {
340 340
                 list($extKey, $filePath) = explode('/', substr($this->conf['stylesheet'], 4), 2);
341 341
                 if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey)) {
342
-                    $this->conf['stylesheet'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey) . $filePath;
342
+                    $this->conf['stylesheet'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey).$filePath;
343 343
                 }
344 344
             }
345 345
             $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->conf['stylesheet']);
346 346
         } else {
347 347
             // Use default stylesheet if no custom stylesheet is given.
348
-            $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'Resources/Public/Stylesheets/OaiPmh.xsl');
348
+            $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Stylesheets/OaiPmh.xsl');
349 349
         }
350
-        $this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="' . htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8') . '"'));
350
+        $this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8').'"'));
351 351
         // Create root element.
352 352
         $root = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'OAI-PMH');
353 353
         $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
         // Send headers.
398 398
         header('HTTP/1.1 200 OK');
399 399
         header('Cache-Control: no-cache');
400
-        header('Content-Length: ' . strlen($content));
400
+        header('Content-Length: '.strlen($content));
401 401
         header('Content-Type: text/xml; charset=utf-8');
402
-        header('Date: ' . date('r', $GLOBALS['EXEC_TIME']));
403
-        header('Expires: ' . date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
402
+        header('Date: '.date('r', $GLOBALS['EXEC_TIME']));
403
+        header('Expires: '.date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
404 404
         echo $content;
405 405
         exit;
406 406
     }
@@ -464,10 +464,10 @@  discard block
 block discarded – undo
464 464
             'tx_dlf_documents',
465 465
             'tx_dlf_relations',
466 466
             'tx_dlf_collections',
467
-            'AND tx_dlf_documents.record_id=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['identifier'], 'tx_dlf_documents')
468
-                . ' AND tx_dlf_documents.pid=' . intval($this->conf['pages'])
469
-                . ' AND tx_dlf_collections.pid=' . intval($this->conf['pages'])
470
-                . ' AND tx_dlf_relations.ident=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations')
467
+            'AND tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['identifier'], 'tx_dlf_documents')
468
+                . ' AND tx_dlf_documents.pid='.intval($this->conf['pages'])
469
+                . ' AND tx_dlf_collections.pid='.intval($this->conf['pages'])
470
+                . ' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations')
471 471
                 . $where
472 472
                 . Helper::whereClause('tx_dlf_collections'),
473 473
             '',
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
             $timestamp = $resArray['tstamp'];
585 585
             $earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
586 586
         } else {
587
-            Helper::devLog('No records found with PID ' . $this->conf['pages'], DEVLOG_SEVERITY_NOTICE);
587
+            Helper::devLog('No records found with PID '.$this->conf['pages'], DEVLOG_SEVERITY_NOTICE);
588 588
         }
589 589
         $linkConf = [
590 590
             'parameter' => $GLOBALS['TSFE']->id,
@@ -844,9 +844,9 @@  discard block
 block discarded – undo
844 844
             }
845 845
             $resArray = $allResults[0];
846 846
             if ($resArray['index_query'] != "") {
847
-                $solr_query .= '(' . $resArray['index_query'] . ')';
847
+                $solr_query .= '('.$resArray['index_query'].')';
848 848
             } else {
849
-                $solr_query .= 'collection:' . '"' . $resArray['index_name'] . '"';
849
+                $solr_query .= 'collection:'.'"'.$resArray['index_name'].'"';
850 850
             }
851 851
         } else {
852 852
             // If no set is specified we have to query for all collections
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
         }
855 855
         // Check for required fields.
856 856
         foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
857
-            $solr_query .= ' NOT ' . $required . ':""';
857
+            $solr_query .= ' NOT '.$required.':""';
858 858
         }
859 859
         // toplevel="true" is always required
860 860
         $solr_query .= ' AND toplevel:true';
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
                 || is_array($date_array = strptime($this->piVars['from'], '%Y-%m-%d'))
868 868
             ) {
869 869
                 $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);
870
-                $from = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) . '.000Z';
870
+                $from = date("Y-m-d", $timestamp).'T'.date("H:i:s", $timestamp).'.000Z';
871 871
             } else {
872 872
                 throw new \Exception('badArgument');
873 873
             }
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
                 || is_array($date_array = strptime($this->piVars['until'], '%Y-%m-%d'))
882 882
             ) {
883 883
                 $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);
884
-                $until = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) . '.999Z';
884
+                $until = date("Y-m-d", $timestamp).'T'.date("H:i:s", $timestamp).'.999Z';
885 885
                 if ($from != "*" && $from > $until) {
886 886
                     throw new \Exception('badArgument');
887 887
                 }
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
                 throw new \Exception('badArgument');
899 899
             }
900 900
         }
901
-        $solr_query .= ' AND timestamp:[' . $from . ' TO ' . $until . ']';
901
+        $solr_query .= ' AND timestamp:['.$from.' TO '.$until.']';
902 902
         $documentSet = [];
903 903
         $solr = Solr::getInstance($this->conf['solrcore']);
904 904
         if (intval($this->conf['solr_limit']) > 0) {
@@ -938,10 +938,10 @@  discard block
 block discarded – undo
938 938
             'tx_dlf_documents',
939 939
             'tx_dlf_relations',
940 940
             'tx_dlf_collections',
941
-            'AND tx_dlf_documents.uid IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($documentsToProcess)) . ')'
942
-                . ' AND tx_dlf_documents.pid=' . intval($this->conf['pages'])
943
-                . ' AND tx_dlf_collections.pid=' . intval($this->conf['pages'])
944
-                . ' AND tx_dlf_relations.ident=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations')
941
+            'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($documentsToProcess)).')'
942
+                . ' AND tx_dlf_documents.pid='.intval($this->conf['pages'])
943
+                . ' AND tx_dlf_collections.pid='.intval($this->conf['pages'])
944
+                . ' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations')
945 945
                 . Helper::whereClause('tx_dlf_collections'),
946 946
             'tx_dlf_documents.uid',
947 947
             'tx_dlf_documents.tstamp',
Please login to merge, or discard this patch.