We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -19,24 +19,24 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_alto implements tx_dlf_fulltext { |
21 | 21 | |
22 | - /** |
|
23 | - * This extracts the fulltext data from ALTO XML |
|
24 | - * |
|
25 | - * @access public |
|
26 | - * |
|
27 | - * @param SimpleXMLElement $xml: The XML to extract the metadata from |
|
28 | - * |
|
29 | - * @return string The raw unformatted fulltext |
|
30 | - */ |
|
31 | - public static function getRawText(SimpleXMLElement $xml) { |
|
22 | + /** |
|
23 | + * This extracts the fulltext data from ALTO XML |
|
24 | + * |
|
25 | + * @access public |
|
26 | + * |
|
27 | + * @param SimpleXMLElement $xml: The XML to extract the metadata from |
|
28 | + * |
|
29 | + * @return string The raw unformatted fulltext |
|
30 | + */ |
|
31 | + public static function getRawText(SimpleXMLElement $xml) { |
|
32 | 32 | |
33 | - $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); |
|
33 | + $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); |
|
34 | 34 | |
35 | - // Get all (presumed) words of the text. |
|
36 | - $words = $xml->xpath('./alto:Layout/alto:Page/alto:PrintSpace//alto:TextBlock/alto:TextLine/alto:String/@CONTENT'); |
|
35 | + // Get all (presumed) words of the text. |
|
36 | + $words = $xml->xpath('./alto:Layout/alto:Page/alto:PrintSpace//alto:TextBlock/alto:TextLine/alto:String/@CONTENT'); |
|
37 | 37 | |
38 | - return implode(' ', $words); |
|
38 | + return implode(' ', $words); |
|
39 | 39 | |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | 42 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | if (TYPO3_MODE === 'FE') { |
76 | 76 | |
77 | - /* |
|
77 | + /* |
|
78 | 78 | * docTypeCheck user function to use in Typoscript |
79 | 79 | * |
80 | 80 | * @access public |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return boolean TRUE if document type matches, FALSE if not |
90 | 90 | **/ |
91 | - function user_dlf_docTypeCheck($type) { |
|
91 | + function user_dlf_docTypeCheck($type) { |
|
92 | 92 | |
93 | - $hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_doctype'); |
|
93 | + $hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_doctype'); |
|
94 | 94 | |
95 | - return ($hook->getDocType() === $type); |
|
95 | + return ($hook->getDocType() === $type); |
|
96 | 96 | |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | 99 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * LICENSE.txt file that was distributed with this source code. |
10 | 10 | */ |
11 | 11 | |
12 | -if (!defined ('TYPO3_MODE')) die ('Access denied.'); |
|
12 | +if (!defined('TYPO3_MODE')) die ('Access denied.'); |
|
13 | 13 | |
14 | 14 | // Register plugins. |
15 | 15 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43($_EXTKEY, 'plugins/audioplayer/class.tx_dlf_audioplayer.php', '_audioplayer', 'list_type', TRUE); |
@@ -9,7 +9,9 @@ |
||
9 | 9 | * LICENSE.txt file that was distributed with this source code. |
10 | 10 | */ |
11 | 11 | |
12 | -if (!defined ('TYPO3_MODE')) die ('Access denied.'); |
|
12 | +if (!defined ('TYPO3_MODE')) { |
|
13 | + die ('Access denied.'); |
|
14 | +} |
|
13 | 15 | |
14 | 16 | // Register plugins. |
15 | 17 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43($_EXTKEY, 'plugins/audioplayer/class.tx_dlf_audioplayer.php', '_audioplayer', 'list_type', TRUE); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | if (!defined('TYPO3_cliMode')) { |
13 | 13 | |
14 | - die('You cannot run this script directly!'); |
|
14 | + die('You cannot run this script directly!'); |
|
15 | 15 | |
16 | 16 | } |
17 | 17 | |
@@ -25,208 +25,208 @@ discard block |
||
25 | 25 | */ |
26 | 26 | class tx_dlf_cli extends \TYPO3\CMS\Core\Controller\CommandLineController { |
27 | 27 | |
28 | - /** |
|
29 | - * This is the return code. |
|
30 | - * |
|
31 | - * @var integer |
|
32 | - * @access protected |
|
33 | - */ |
|
34 | - protected $return = 0; |
|
28 | + /** |
|
29 | + * This is the return code. |
|
30 | + * |
|
31 | + * @var integer |
|
32 | + * @access protected |
|
33 | + */ |
|
34 | + protected $return = 0; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Main function of the script. |
|
38 | - * |
|
39 | - * @access public |
|
40 | - * |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - public function main() { |
|
36 | + /** |
|
37 | + * Main function of the script. |
|
38 | + * |
|
39 | + * @access public |
|
40 | + * |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + public function main() { |
|
44 | 44 | |
45 | - switch ((string) $this->cli_args['_DEFAULT'][1]) { |
|
45 | + switch ((string) $this->cli_args['_DEFAULT'][1]) { |
|
46 | 46 | |
47 | - // (Re-)Index a single document. |
|
48 | - case 'index': |
|
47 | + // (Re-)Index a single document. |
|
48 | + case 'index': |
|
49 | 49 | |
50 | - // Add command line arguments. |
|
51 | - $this->cli_options[] = array ('-doc UID/URL', 'UID or (properly encoded) URL of the document.'); |
|
50 | + // Add command line arguments. |
|
51 | + $this->cli_options[] = array ('-doc UID/URL', 'UID or (properly encoded) URL of the document.'); |
|
52 | 52 | |
53 | - $this->cli_options[] = array ('-pid UID', 'UID of the page the document should be added to.'); |
|
53 | + $this->cli_options[] = array ('-pid UID', 'UID of the page the document should be added to.'); |
|
54 | 54 | |
55 | - $this->cli_options[] = array ('-core UID', 'UID of the Solr core the document should be added to.'); |
|
55 | + $this->cli_options[] = array ('-core UID', 'UID of the Solr core the document should be added to.'); |
|
56 | 56 | |
57 | - // Check the command line arguments. |
|
58 | - $this->cli_validateArgs(); |
|
57 | + // Check the command line arguments. |
|
58 | + $this->cli_validateArgs(); |
|
59 | 59 | |
60 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-doc'][0]) |
|
61 | - && !\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($this->cli_args['-doc'][0])) { |
|
60 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-doc'][0]) |
|
61 | + && !\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($this->cli_args['-doc'][0])) { |
|
62 | 62 | |
63 | - $this->cli_echo('ERROR: "'.$this->cli_args['-doc'][0].'" is not a valid document UID or URL.'.LF, TRUE); |
|
63 | + $this->cli_echo('ERROR: "'.$this->cli_args['-doc'][0].'" is not a valid document UID or URL.'.LF, TRUE); |
|
64 | 64 | |
65 | - $this->return = 1; |
|
65 | + $this->return = 1; |
|
66 | 66 | |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-pid'][0])) { |
|
69 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-pid'][0])) { |
|
70 | 70 | |
71 | - $this->cli_echo('ERROR: "'.$this->cli_args['-pid'][0].'" is not a valid page UID.'.LF, TRUE); |
|
71 | + $this->cli_echo('ERROR: "'.$this->cli_args['-pid'][0].'" is not a valid page UID.'.LF, TRUE); |
|
72 | 72 | |
73 | - $this->return = 1; |
|
73 | + $this->return = 1; |
|
74 | 74 | |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-core'][0])) { |
|
77 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-core'][0])) { |
|
78 | 78 | |
79 | - $this->cli_echo('ERROR: "'.$this->cli_args['-core'][0].'" is not a valid core UID.'.LF, TRUE); |
|
79 | + $this->cli_echo('ERROR: "'.$this->cli_args['-core'][0].'" is not a valid core UID.'.LF, TRUE); |
|
80 | 80 | |
81 | - $this->return = 1; |
|
81 | + $this->return = 1; |
|
82 | 82 | |
83 | - } |
|
83 | + } |
|
84 | 84 | |
85 | - if ($this->return > 0) { |
|
85 | + if ($this->return > 0) { |
|
86 | 86 | |
87 | - break; |
|
87 | + break; |
|
88 | 88 | |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | - // Get the document... |
|
92 | - $doc =& tx_dlf_document::getInstance($this->cli_args['-doc'][0], $this->cli_args['-pid'][0], TRUE); |
|
91 | + // Get the document... |
|
92 | + $doc =& tx_dlf_document::getInstance($this->cli_args['-doc'][0], $this->cli_args['-pid'][0], TRUE); |
|
93 | 93 | |
94 | - if ($doc->ready) { |
|
94 | + if ($doc->ready) { |
|
95 | 95 | |
96 | - // ...and save it to the database... |
|
97 | - if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) { |
|
96 | + // ...and save it to the database... |
|
97 | + if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) { |
|
98 | 98 | |
99 | - $this->cli_echo('ERROR: Document "'.$this->cli_args['-doc'][0].'" not saved and indexed.'.LF, TRUE); |
|
99 | + $this->cli_echo('ERROR: Document "'.$this->cli_args['-doc'][0].'" not saved and indexed.'.LF, TRUE); |
|
100 | 100 | |
101 | - $this->return = 1; |
|
101 | + $this->return = 1; |
|
102 | 102 | |
103 | - } |
|
103 | + } |
|
104 | 104 | |
105 | - } else { |
|
105 | + } else { |
|
106 | 106 | |
107 | - $this->cli_echo('ERROR: Document "'.$this->cli_args['-doc'][0].'" could not be loaded.'.LF, TRUE); |
|
107 | + $this->cli_echo('ERROR: Document "'.$this->cli_args['-doc'][0].'" could not be loaded.'.LF, TRUE); |
|
108 | 108 | |
109 | - $this->return = 1; |
|
109 | + $this->return = 1; |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | - break; |
|
113 | + break; |
|
114 | 114 | |
115 | - // Re-index all documents of a collection. |
|
116 | - case 'reindex': |
|
115 | + // Re-index all documents of a collection. |
|
116 | + case 'reindex': |
|
117 | 117 | |
118 | - // Add command line arguments. |
|
119 | - $this->cli_options[] = array ('-coll UID', 'UID of the collection.'); |
|
118 | + // Add command line arguments. |
|
119 | + $this->cli_options[] = array ('-coll UID', 'UID of the collection.'); |
|
120 | 120 | |
121 | - $this->cli_options[] = array ('-pid UID', 'UID of the page the document should be added to.'); |
|
121 | + $this->cli_options[] = array ('-pid UID', 'UID of the page the document should be added to.'); |
|
122 | 122 | |
123 | - $this->cli_options[] = array ('-core UID', 'UID of the Solr core the document should be added to.'); |
|
123 | + $this->cli_options[] = array ('-core UID', 'UID of the Solr core the document should be added to.'); |
|
124 | 124 | |
125 | - // Check the command line arguments. |
|
126 | - $this->cli_validateArgs(); |
|
125 | + // Check the command line arguments. |
|
126 | + $this->cli_validateArgs(); |
|
127 | 127 | |
128 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-coll'][0])) { |
|
128 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-coll'][0])) { |
|
129 | 129 | |
130 | - $this->cli_echo('ERROR: "'.$this->cli_args['-coll'][0].'" is not a valid collection UID.'.LF, TRUE); |
|
130 | + $this->cli_echo('ERROR: "'.$this->cli_args['-coll'][0].'" is not a valid collection UID.'.LF, TRUE); |
|
131 | 131 | |
132 | - $this->return = 1; |
|
132 | + $this->return = 1; |
|
133 | 133 | |
134 | - } |
|
134 | + } |
|
135 | 135 | |
136 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-pid'][0])) { |
|
136 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-pid'][0])) { |
|
137 | 137 | |
138 | - $this->cli_echo('ERROR: "'.$this->cli_args['-pid'][0].'" is not a valid page UID.'.LF, TRUE); |
|
138 | + $this->cli_echo('ERROR: "'.$this->cli_args['-pid'][0].'" is not a valid page UID.'.LF, TRUE); |
|
139 | 139 | |
140 | - $this->return = 1; |
|
140 | + $this->return = 1; |
|
141 | 141 | |
142 | - } |
|
142 | + } |
|
143 | 143 | |
144 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-core'][0])) { |
|
144 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-core'][0])) { |
|
145 | 145 | |
146 | - $this->cli_echo('ERROR: "'.$this->cli_args['-core'][0].'" is not a valid core UID.'.LF, TRUE); |
|
146 | + $this->cli_echo('ERROR: "'.$this->cli_args['-core'][0].'" is not a valid core UID.'.LF, TRUE); |
|
147 | 147 | |
148 | - $this->return = 1; |
|
148 | + $this->return = 1; |
|
149 | 149 | |
150 | - } |
|
150 | + } |
|
151 | 151 | |
152 | - if ($this->return > 0) { |
|
152 | + if ($this->return > 0) { |
|
153 | 153 | |
154 | - break; |
|
154 | + break; |
|
155 | 155 | |
156 | - } |
|
156 | + } |
|
157 | 157 | |
158 | - // Get the collection. |
|
159 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
160 | - 'tx_dlf_documents.uid AS uid', |
|
161 | - 'tx_dlf_documents', |
|
162 | - 'tx_dlf_relations', |
|
163 | - 'tx_dlf_collections', |
|
164 | - 'AND tx_dlf_collections.uid='.intval($this->cli_args['-coll'][0]).' AND tx_dlf_collections.pid='.intval($this->cli_args['-pid'][0]).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
165 | - '', |
|
166 | - '', |
|
167 | - '' |
|
168 | - ); |
|
158 | + // Get the collection. |
|
159 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
160 | + 'tx_dlf_documents.uid AS uid', |
|
161 | + 'tx_dlf_documents', |
|
162 | + 'tx_dlf_relations', |
|
163 | + 'tx_dlf_collections', |
|
164 | + 'AND tx_dlf_collections.uid='.intval($this->cli_args['-coll'][0]).' AND tx_dlf_collections.pid='.intval($this->cli_args['-pid'][0]).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
165 | + '', |
|
166 | + '', |
|
167 | + '' |
|
168 | + ); |
|
169 | 169 | |
170 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
170 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
171 | 171 | |
172 | - // Get the document... |
|
173 | - $doc =& tx_dlf_document::getInstance($resArray['uid'], $this->cli_args['-pid'][0], TRUE); |
|
172 | + // Get the document... |
|
173 | + $doc =& tx_dlf_document::getInstance($resArray['uid'], $this->cli_args['-pid'][0], TRUE); |
|
174 | 174 | |
175 | - if ($doc->ready) { |
|
175 | + if ($doc->ready) { |
|
176 | 176 | |
177 | - // ...and save it to the database... |
|
178 | - if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) { |
|
177 | + // ...and save it to the database... |
|
178 | + if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) { |
|
179 | 179 | |
180 | - $this->cli_echo('ERROR: Document "'.$resArray['uid'].'" not saved and indexed.'.LF, TRUE); |
|
180 | + $this->cli_echo('ERROR: Document "'.$resArray['uid'].'" not saved and indexed.'.LF, TRUE); |
|
181 | 181 | |
182 | - $this->return = 1; |
|
182 | + $this->return = 1; |
|
183 | 183 | |
184 | - } |
|
184 | + } |
|
185 | 185 | |
186 | - } else { |
|
186 | + } else { |
|
187 | 187 | |
188 | - $this->cli_echo('ERROR: Document "'.$resArray['uid'].'" could not be loaded.'.LF, TRUE); |
|
188 | + $this->cli_echo('ERROR: Document "'.$resArray['uid'].'" could not be loaded.'.LF, TRUE); |
|
189 | 189 | |
190 | - $this->return = 1; |
|
190 | + $this->return = 1; |
|
191 | 191 | |
192 | - } |
|
192 | + } |
|
193 | 193 | |
194 | - // Clear document registry to prevent memory exhaustion. |
|
195 | - tx_dlf_document::clearRegistry(); |
|
194 | + // Clear document registry to prevent memory exhaustion. |
|
195 | + tx_dlf_document::clearRegistry(); |
|
196 | 196 | |
197 | - } |
|
197 | + } |
|
198 | 198 | |
199 | - break; |
|
199 | + break; |
|
200 | 200 | |
201 | - default: |
|
201 | + default: |
|
202 | 202 | |
203 | - $this->cli_help(); |
|
203 | + $this->cli_help(); |
|
204 | 204 | |
205 | - break; |
|
205 | + break; |
|
206 | 206 | |
207 | - } |
|
207 | + } |
|
208 | 208 | |
209 | - exit ($this->return); |
|
209 | + exit ($this->return); |
|
210 | 210 | |
211 | - } |
|
211 | + } |
|
212 | 212 | |
213 | - public function __construct() { |
|
213 | + public function __construct() { |
|
214 | 214 | |
215 | - // Set basic information about the script. |
|
216 | - $this->cli_help = array ( |
|
217 | - 'name' => 'Command Line Interface for Kitodo.Presentation', |
|
218 | - 'synopsis' => '###OPTIONS###', |
|
219 | - 'description' => 'Currently the only tasks available are "index" and "reindex".'.LF.'Try "/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK" for more options.', |
|
220 | - 'examples' => '/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK -ARG1=VALUE1 -ARG2=VALUE2', |
|
221 | - 'options' => '', |
|
222 | - 'license' => 'GNU GPL - free software!', |
|
223 | - 'author' => 'Kitodo. Key to digital objects e.V. <[email protected]>', |
|
224 | - ); |
|
215 | + // Set basic information about the script. |
|
216 | + $this->cli_help = array ( |
|
217 | + 'name' => 'Command Line Interface for Kitodo.Presentation', |
|
218 | + 'synopsis' => '###OPTIONS###', |
|
219 | + 'description' => 'Currently the only tasks available are "index" and "reindex".'.LF.'Try "/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK" for more options.', |
|
220 | + 'examples' => '/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK -ARG1=VALUE1 -ARG2=VALUE2', |
|
221 | + 'options' => '', |
|
222 | + 'license' => 'GNU GPL - free software!', |
|
223 | + 'author' => 'Kitodo. Key to digital objects e.V. <[email protected]>', |
|
224 | + ); |
|
225 | 225 | |
226 | - // Run parent constructor. |
|
227 | - parent::__construct(); |
|
226 | + // Run parent constructor. |
|
227 | + parent::__construct(); |
|
228 | 228 | |
229 | - } |
|
229 | + } |
|
230 | 230 | |
231 | 231 | } |
232 | 232 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | // Get the document... |
92 | - $doc =& tx_dlf_document::getInstance($this->cli_args['-doc'][0], $this->cli_args['-pid'][0], TRUE); |
|
92 | + $doc = & tx_dlf_document::getInstance($this->cli_args['-doc'][0], $this->cli_args['-pid'][0], TRUE); |
|
93 | 93 | |
94 | 94 | if ($doc->ready) { |
95 | 95 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
171 | 171 | |
172 | 172 | // Get the document... |
173 | - $doc =& tx_dlf_document::getInstance($resArray['uid'], $this->cli_args['-pid'][0], TRUE); |
|
173 | + $doc = & tx_dlf_document::getInstance($resArray['uid'], $this->cli_args['-pid'][0], TRUE); |
|
174 | 174 | |
175 | 175 | if ($doc->ready) { |
176 | 176 |