Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 39ad46...5c2c02 )
by Sebastian
16s
created
common/class.tx_dlf_document.php 4 patches
Indentation   +1834 added lines, -1834 removed lines patch added patch discarded remove patch
@@ -20,2666 +20,2666 @@
 block discarded – undo
20 20
  */
21 21
 final class tx_dlf_document {
22 22
 
23
-	/**
24
-	 * This holds the whole XML file as string for serialization purposes
25
-	 * @see __sleep() / __wakeup()
26
-	 *
27
-	 * @var	string
28
-	 * @access protected
29
-	 */
30
-	protected $asXML = '';
31
-
32
-	/**
33
-	 * This holds the PID for the configuration
34
-	 *
35
-	 * @var	integer
36
-	 * @access protected
37
-	 */
38
-	protected $cPid = 0;
39
-
40
-	/**
41
-	 * This holds the XML file's dmdSec parts with their IDs as array key
42
-	 *
43
-	 * @var	array
44
-	 * @access protected
45
-	 */
46
-	protected $dmdSec = array ();
47
-
48
-	/**
49
-	 * Are the METS file's dmdSecs loaded?
50
-	 * @see $dmdSec
51
-	 *
52
-	 * @var	boolean
53
-	 * @access protected
54
-	 */
55
-	protected $dmdSecLoaded = FALSE;
56
-
57
-	/**
58
-	 * The extension key
59
-	 *
60
-	 * @var	string
61
-	 * @access public
62
-	 */
63
-	public static $extKey = 'dlf';
64
-
65
-	/**
66
-	 * This holds the file ID -> USE concordance
67
-	 * @see _getFileGrps()
68
-	 *
69
-	 * @var	array
70
-	 * @access protected
71
-	 */
72
-	protected $fileGrps = array ();
73
-
74
-	/**
75
-	 * Are the file groups loaded?
76
-	 * @see $fileGrps
77
-	 *
78
-	 * @var	boolean
79
-	 * @access protected
80
-	 */
81
-	protected $fileGrpsLoaded = FALSE;
82
-
83
-	/**
84
-	 * This holds the configuration for all supported metadata encodings
85
-	 * @see loadFormats()
86
-	 *
87
-	 * @var	array
88
-	 * @access protected
89
-	 */
90
-	protected $formats = array (
91
-		'OAI' => array (
92
-			'rootElement' => 'OAI-PMH',
93
-			'namespaceURI' => 'http://www.openarchives.org/OAI/2.0/',
94
-		),
95
-		'METS' => array (
96
-			'rootElement' => 'mets',
97
-			'namespaceURI' => 'http://www.loc.gov/METS/',
98
-		),
99
-		'XLINK' => array (
100
-			'rootElement' => 'xlink',
101
-			'namespaceURI' => 'http://www.w3.org/1999/xlink',
102
-		)
103
-	);
104
-
105
-	/**
106
-	 * Are the available metadata formats loaded?
107
-	 * @see $formats
108
-	 *
109
-	 * @var	boolean
110
-	 * @access protected
111
-	 */
112
-	protected $formatsLoaded = FALSE;
113
-
114
-	/**
115
-	 * Are there any fulltext files available?
116
-	 *
117
-	 * @var boolean
118
-	 * @access protected
119
-	 */
120
-	protected $hasFulltext = FALSE;
121
-
122
-	/**
123
-	 * Last searched logical and physical page
124
-	 *
125
-	 * @var	array
126
-	 * @access protected
127
-	 */
128
-	protected $lastSearchedPhysicalPage = array ('logicalPage' => NULL, 'physicalPage' => NULL);
129
-
130
-	/**
131
-	 * This holds the documents location
132
-	 *
133
-	 * @var	string
134
-	 * @access protected
135
-	 */
136
-	protected $location = '';
137
-
138
-	/**
139
-	 * This holds the logical units
140
-	 *
141
-	 * @var	array
142
-	 * @access protected
143
-	 */
144
-	protected $logicalUnits = array ();
145
-
146
-	/**
147
-	 * This holds the documents' parsed metadata array with their corresponding structMap//div's ID as array key
148
-	 *
149
-	 * @var	array
150
-	 * @access protected
151
-	 */
152
-	protected $metadataArray = array ();
153
-
154
-	/**
155
-	 * Is the metadata array loaded?
156
-	 * @see $metadataArray
157
-	 *
158
-	 * @var	boolean
159
-	 * @access protected
160
-	 */
161
-	protected $metadataArrayLoaded = FALSE;
162
-
163
-	/**
164
-	 * This holds the XML file's METS part as SimpleXMLElement object
165
-	 *
166
-	 * @var	SimpleXMLElement
167
-	 * @access protected
168
-	 */
169
-	protected $mets;
170
-
171
-	/**
172
-	 * The holds the total number of pages
173
-	 *
174
-	 * @var	integer
175
-	 * @access protected
176
-	 */
177
-	protected $numPages = 0;
178
-
179
-	/**
180
-	 * This holds the UID of the parent document or zero if not multi-volumed
181
-	 *
182
-	 * @var	integer
183
-	 * @access protected
184
-	 */
185
-	protected $parentId = 0;
186
-
187
-	/**
188
-	 * This holds the physical structure
189
-	 *
190
-	 * @var	array
191
-	 * @access protected
192
-	 */
193
-	protected $physicalStructure = array ();
194
-
195
-	/**
196
-	 * This holds the physical structure metadata
197
-	 *
198
-	 * @var	array
199
-	 * @access protected
200
-	 */
201
-	protected $physicalStructureInfo = array ();
202
-
203
-	/**
204
-	 * Is the physical structure loaded?
205
-	 * @see $physicalStructure
206
-	 *
207
-	 * @var	boolean
208
-	 * @access protected
209
-	 */
210
-	protected $physicalStructureLoaded = FALSE;
211
-
212
-	/**
213
-	 * This holds the PID of the document or zero if not in database
214
-	 *
215
-	 * @var	integer
216
-	 * @access protected
217
-	 */
218
-	protected $pid = 0;
219
-
220
-	/**
221
-	 * Is the document instantiated successfully?
222
-	 *
223
-	 * @var	boolean
224
-	 * @access protected
225
-	 */
226
-	protected $ready = FALSE;
227
-
228
-	/**
229
-	 * The METS file's record identifier
230
-	 *
231
-	 * @var	string
232
-	 * @access protected
233
-	 */
234
-	protected $recordId;
235
-
236
-	/**
237
-	 * This holds the singleton object of the document
238
-	 *
239
-	 * @var	array (tx_dlf_document)
240
-	 * @access protected
241
-	 */
242
-	protected static $registry = array ();
243
-
244
-	/**
245
-	 * This holds the UID of the root document or zero if not multi-volumed
246
-	 *
247
-	 * @var	integer
248
-	 * @access protected
249
-	 */
250
-	protected $rootId = 0;
251
-
252
-	/**
253
-	 * Is the root id loaded?
254
-	 * @see $rootId
255
-	 *
256
-	 * @var	boolean
257
-	 * @access protected
258
-	 */
259
-	protected $rootIdLoaded = FALSE;
260
-
261
-	/**
262
-	 * This holds the smLinks between logical and physical structMap
263
-	 *
264
-	 * @var	array
265
-	 * @access protected
266
-	 */
267
-	protected $smLinks = array ('l2p' => array (), 'p2l' => array ());
268
-
269
-	/**
270
-	 * Are the smLinks loaded?
271
-	 * @see $smLinks
272
-	 *
273
-	 * @var	boolean
274
-	 * @access protected
275
-	 */
276
-	protected $smLinksLoaded = FALSE;
277
-
278
-	/**
279
-	 * This holds the logical structure
280
-	 *
281
-	 * @var	array
282
-	 * @access protected
283
-	 */
284
-	protected $tableOfContents = array ();
285
-
286
-	/**
287
-	 * Is the table of contents loaded?
288
-	 * @see $tableOfContents
289
-	 *
290
-	 * @var	boolean
291
-	 * @access protected
292
-	 */
293
-	protected $tableOfContentsLoaded = FALSE;
294
-
295
-	/**
296
-	 * This holds the document's thumbnail location.
297
-	 *
298
-	 * @var	string
299
-	 * @access protected
300
-	 */
301
-	protected $thumbnail = '';
302
-
303
-	/**
304
-	 * Is the document's thumbnail location loaded?
305
-	 * @see $thumbnail
306
-	 *
307
-	 * @var	boolean
308
-	 * @access protected
309
-	 */
310
-	protected $thumbnailLoaded = FALSE;
311
-
312
-	/**
313
-	 * This holds the toplevel structure's @ID
314
-	 *
315
-	 * @var	string
316
-	 * @access protected
317
-	 */
318
-	protected $toplevelId = '';
319
-
320
-	/**
321
-	 * This holds the UID or the URL of the document
322
-	 *
323
-	 * @var	mixed
324
-	 * @access protected
325
-	 */
326
-	protected $uid = 0;
327
-
328
-	/**
329
-	 * This holds the whole XML file as SimpleXMLElement object
330
-	 *
331
-	 * @var	SimpleXMLElement
332
-	 * @access protected
333
-	 */
334
-	protected $xml;
335
-
336
-	/**
337
-	 * This clears the static registry to prevent memory exhaustion
338
-	 *
339
-	 * @access	public
340
-	 *
341
-	 * @return	void
342
-	 */
343
-	public static function clearRegistry() {
344
-
345
-		// Reset registry array.
346
-		self::$registry = array ();
347
-
348
-	}
349
-
350
-	/**
351
-	 * This gets the location of a file representing a physical page or track
352
-	 *
353
-	 * @access	public
354
-	 *
355
-	 * @param	string		$id: The @ID attribute of the file node
356
-	 *
357
-	 * @return	string		The file's location as URL
358
-	 */
359
-	public function getFileLocation($id) {
23
+    /**
24
+     * This holds the whole XML file as string for serialization purposes
25
+     * @see __sleep() / __wakeup()
26
+     *
27
+     * @var	string
28
+     * @access protected
29
+     */
30
+    protected $asXML = '';
31
+
32
+    /**
33
+     * This holds the PID for the configuration
34
+     *
35
+     * @var	integer
36
+     * @access protected
37
+     */
38
+    protected $cPid = 0;
39
+
40
+    /**
41
+     * This holds the XML file's dmdSec parts with their IDs as array key
42
+     *
43
+     * @var	array
44
+     * @access protected
45
+     */
46
+    protected $dmdSec = array ();
47
+
48
+    /**
49
+     * Are the METS file's dmdSecs loaded?
50
+     * @see $dmdSec
51
+     *
52
+     * @var	boolean
53
+     * @access protected
54
+     */
55
+    protected $dmdSecLoaded = FALSE;
56
+
57
+    /**
58
+     * The extension key
59
+     *
60
+     * @var	string
61
+     * @access public
62
+     */
63
+    public static $extKey = 'dlf';
64
+
65
+    /**
66
+     * This holds the file ID -> USE concordance
67
+     * @see _getFileGrps()
68
+     *
69
+     * @var	array
70
+     * @access protected
71
+     */
72
+    protected $fileGrps = array ();
73
+
74
+    /**
75
+     * Are the file groups loaded?
76
+     * @see $fileGrps
77
+     *
78
+     * @var	boolean
79
+     * @access protected
80
+     */
81
+    protected $fileGrpsLoaded = FALSE;
82
+
83
+    /**
84
+     * This holds the configuration for all supported metadata encodings
85
+     * @see loadFormats()
86
+     *
87
+     * @var	array
88
+     * @access protected
89
+     */
90
+    protected $formats = array (
91
+        'OAI' => array (
92
+            'rootElement' => 'OAI-PMH',
93
+            'namespaceURI' => 'http://www.openarchives.org/OAI/2.0/',
94
+        ),
95
+        'METS' => array (
96
+            'rootElement' => 'mets',
97
+            'namespaceURI' => 'http://www.loc.gov/METS/',
98
+        ),
99
+        'XLINK' => array (
100
+            'rootElement' => 'xlink',
101
+            'namespaceURI' => 'http://www.w3.org/1999/xlink',
102
+        )
103
+    );
104
+
105
+    /**
106
+     * Are the available metadata formats loaded?
107
+     * @see $formats
108
+     *
109
+     * @var	boolean
110
+     * @access protected
111
+     */
112
+    protected $formatsLoaded = FALSE;
113
+
114
+    /**
115
+     * Are there any fulltext files available?
116
+     *
117
+     * @var boolean
118
+     * @access protected
119
+     */
120
+    protected $hasFulltext = FALSE;
121
+
122
+    /**
123
+     * Last searched logical and physical page
124
+     *
125
+     * @var	array
126
+     * @access protected
127
+     */
128
+    protected $lastSearchedPhysicalPage = array ('logicalPage' => NULL, 'physicalPage' => NULL);
129
+
130
+    /**
131
+     * This holds the documents location
132
+     *
133
+     * @var	string
134
+     * @access protected
135
+     */
136
+    protected $location = '';
137
+
138
+    /**
139
+     * This holds the logical units
140
+     *
141
+     * @var	array
142
+     * @access protected
143
+     */
144
+    protected $logicalUnits = array ();
145
+
146
+    /**
147
+     * This holds the documents' parsed metadata array with their corresponding structMap//div's ID as array key
148
+     *
149
+     * @var	array
150
+     * @access protected
151
+     */
152
+    protected $metadataArray = array ();
153
+
154
+    /**
155
+     * Is the metadata array loaded?
156
+     * @see $metadataArray
157
+     *
158
+     * @var	boolean
159
+     * @access protected
160
+     */
161
+    protected $metadataArrayLoaded = FALSE;
162
+
163
+    /**
164
+     * This holds the XML file's METS part as SimpleXMLElement object
165
+     *
166
+     * @var	SimpleXMLElement
167
+     * @access protected
168
+     */
169
+    protected $mets;
170
+
171
+    /**
172
+     * The holds the total number of pages
173
+     *
174
+     * @var	integer
175
+     * @access protected
176
+     */
177
+    protected $numPages = 0;
178
+
179
+    /**
180
+     * This holds the UID of the parent document or zero if not multi-volumed
181
+     *
182
+     * @var	integer
183
+     * @access protected
184
+     */
185
+    protected $parentId = 0;
186
+
187
+    /**
188
+     * This holds the physical structure
189
+     *
190
+     * @var	array
191
+     * @access protected
192
+     */
193
+    protected $physicalStructure = array ();
194
+
195
+    /**
196
+     * This holds the physical structure metadata
197
+     *
198
+     * @var	array
199
+     * @access protected
200
+     */
201
+    protected $physicalStructureInfo = array ();
202
+
203
+    /**
204
+     * Is the physical structure loaded?
205
+     * @see $physicalStructure
206
+     *
207
+     * @var	boolean
208
+     * @access protected
209
+     */
210
+    protected $physicalStructureLoaded = FALSE;
211
+
212
+    /**
213
+     * This holds the PID of the document or zero if not in database
214
+     *
215
+     * @var	integer
216
+     * @access protected
217
+     */
218
+    protected $pid = 0;
219
+
220
+    /**
221
+     * Is the document instantiated successfully?
222
+     *
223
+     * @var	boolean
224
+     * @access protected
225
+     */
226
+    protected $ready = FALSE;
227
+
228
+    /**
229
+     * The METS file's record identifier
230
+     *
231
+     * @var	string
232
+     * @access protected
233
+     */
234
+    protected $recordId;
235
+
236
+    /**
237
+     * This holds the singleton object of the document
238
+     *
239
+     * @var	array (tx_dlf_document)
240
+     * @access protected
241
+     */
242
+    protected static $registry = array ();
243
+
244
+    /**
245
+     * This holds the UID of the root document or zero if not multi-volumed
246
+     *
247
+     * @var	integer
248
+     * @access protected
249
+     */
250
+    protected $rootId = 0;
251
+
252
+    /**
253
+     * Is the root id loaded?
254
+     * @see $rootId
255
+     *
256
+     * @var	boolean
257
+     * @access protected
258
+     */
259
+    protected $rootIdLoaded = FALSE;
260
+
261
+    /**
262
+     * This holds the smLinks between logical and physical structMap
263
+     *
264
+     * @var	array
265
+     * @access protected
266
+     */
267
+    protected $smLinks = array ('l2p' => array (), 'p2l' => array ());
268
+
269
+    /**
270
+     * Are the smLinks loaded?
271
+     * @see $smLinks
272
+     *
273
+     * @var	boolean
274
+     * @access protected
275
+     */
276
+    protected $smLinksLoaded = FALSE;
277
+
278
+    /**
279
+     * This holds the logical structure
280
+     *
281
+     * @var	array
282
+     * @access protected
283
+     */
284
+    protected $tableOfContents = array ();
285
+
286
+    /**
287
+     * Is the table of contents loaded?
288
+     * @see $tableOfContents
289
+     *
290
+     * @var	boolean
291
+     * @access protected
292
+     */
293
+    protected $tableOfContentsLoaded = FALSE;
294
+
295
+    /**
296
+     * This holds the document's thumbnail location.
297
+     *
298
+     * @var	string
299
+     * @access protected
300
+     */
301
+    protected $thumbnail = '';
302
+
303
+    /**
304
+     * Is the document's thumbnail location loaded?
305
+     * @see $thumbnail
306
+     *
307
+     * @var	boolean
308
+     * @access protected
309
+     */
310
+    protected $thumbnailLoaded = FALSE;
311
+
312
+    /**
313
+     * This holds the toplevel structure's @ID
314
+     *
315
+     * @var	string
316
+     * @access protected
317
+     */
318
+    protected $toplevelId = '';
319
+
320
+    /**
321
+     * This holds the UID or the URL of the document
322
+     *
323
+     * @var	mixed
324
+     * @access protected
325
+     */
326
+    protected $uid = 0;
327
+
328
+    /**
329
+     * This holds the whole XML file as SimpleXMLElement object
330
+     *
331
+     * @var	SimpleXMLElement
332
+     * @access protected
333
+     */
334
+    protected $xml;
335
+
336
+    /**
337
+     * This clears the static registry to prevent memory exhaustion
338
+     *
339
+     * @access	public
340
+     *
341
+     * @return	void
342
+     */
343
+    public static function clearRegistry() {
344
+
345
+        // Reset registry array.
346
+        self::$registry = array ();
347
+
348
+    }
349
+
350
+    /**
351
+     * This gets the location of a file representing a physical page or track
352
+     *
353
+     * @access	public
354
+     *
355
+     * @param	string		$id: The @ID attribute of the file node
356
+     *
357
+     * @return	string		The file's location as URL
358
+     */
359
+    public function getFileLocation($id) {
360 360
 
361
-		if (!empty($id) && ($location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'))) {
361
+        if (!empty($id) && ($location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'))) {
362 362
 
363
-			return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href;
363
+            return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href;
364 364
 
365
-		} else {
365
+        } else {
366 366
 
367
-			if (TYPO3_DLOG) {
367
+            if (TYPO3_DLOG) {
368 368
 
369
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getFileLocation('.$id.')] There is no file node with @ID "'.$id.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
369
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getFileLocation('.$id.')] There is no file node with @ID "'.$id.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
370 370
 
371
-			}
371
+            }
372 372
 
373
-			return '';
373
+            return '';
374 374
 
375
-		}
375
+        }
376 376
 
377
-	}
377
+    }
378 378
 
379
-	/**
380
-	 * This gets the MIME type of a file representing a physical page or track
381
-	 *
382
-	 * @access	public
383
-	 *
384
-	 * @param	string		$id: The @ID attribute of the file node
385
-	 *
386
-	 * @return	string		The file's MIME type
387
-	 */
388
-	public function getFileMimeType($id) {
379
+    /**
380
+     * This gets the MIME type of a file representing a physical page or track
381
+     *
382
+     * @access	public
383
+     *
384
+     * @param	string		$id: The @ID attribute of the file node
385
+     *
386
+     * @return	string		The file's MIME type
387
+     */
388
+    public function getFileMimeType($id) {
389 389
 
390
-		if (!empty($id) && ($mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'))) {
390
+        if (!empty($id) && ($mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'))) {
391 391
 
392
-			return (string) $mimetype[0];
392
+            return (string) $mimetype[0];
393 393
 
394
-		} else {
394
+        } else {
395 395
 
396
-			if (TYPO3_DLOG) {
396
+            if (TYPO3_DLOG) {
397 397
 
398
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getFileMimeType('.$id.')] There is no file node with @ID "'.$id.'" or no MIME type specified', self::$extKey, SYSLOG_SEVERITY_WARNING);
398
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getFileMimeType('.$id.')] There is no file node with @ID "'.$id.'" or no MIME type specified', self::$extKey, SYSLOG_SEVERITY_WARNING);
399 399
 
400
-			}
400
+            }
401 401
 
402
-			return '';
402
+            return '';
403 403
 
404
-		}
404
+        }
405 405
 
406
-	}
406
+    }
407 407
 
408
-	/**
409
-	 * This is a singleton class, thus an instance must be created by this method
410
-	 *
411
-	 * @access	public
412
-	 *
413
-	 * @param	mixed		$uid: The unique identifier of the document to parse or URL of XML file
414
-	 * @param	integer		$pid: If > 0, then only document with this PID gets loaded
415
-	 * @param	boolean		$forceReload: Force reloading the document instead of returning the cached instance
416
-	 *
417
-	 * @return	&tx_dlf_document		Instance of this class
418
-	 */
419
-	public static function &getInstance($uid, $pid = 0, $forceReload = FALSE) {
408
+    /**
409
+     * This is a singleton class, thus an instance must be created by this method
410
+     *
411
+     * @access	public
412
+     *
413
+     * @param	mixed		$uid: The unique identifier of the document to parse or URL of XML file
414
+     * @param	integer		$pid: If > 0, then only document with this PID gets loaded
415
+     * @param	boolean		$forceReload: Force reloading the document instead of returning the cached instance
416
+     *
417
+     * @return	&tx_dlf_document		Instance of this class
418
+     */
419
+    public static function &getInstance($uid, $pid = 0, $forceReload = FALSE) {
420 420
 
421
-		// Sanitize input.
422
-		$pid = max(intval($pid), 0);
421
+        // Sanitize input.
422
+        $pid = max(intval($pid), 0);
423 423
 
424
-		if (!$forceReload) {
424
+        if (!$forceReload) {
425 425
 
426
-			$regObj = md5($uid);
426
+            $regObj = md5($uid);
427 427
 
428
-			if (is_object(self::$registry[$regObj]) && self::$registry[$regObj] instanceof self) {
428
+            if (is_object(self::$registry[$regObj]) && self::$registry[$regObj] instanceof self) {
429 429
 
430
-				// Check if instance has given PID.
431
-				if (!$pid || !self::$registry[$regObj]->pid || $pid == self::$registry[$regObj]->pid) {
430
+                // Check if instance has given PID.
431
+                if (!$pid || !self::$registry[$regObj]->pid || $pid == self::$registry[$regObj]->pid) {
432 432
 
433
-					// Return singleton instance if available.
434
-					return self::$registry[$regObj];
433
+                    // Return singleton instance if available.
434
+                    return self::$registry[$regObj];
435 435
 
436
-				}
436
+                }
437 437
 
438
-			} else {
438
+            } else {
439 439
 
440
-				// Check the user's session...
441
-				$sessionData = tx_dlf_helper::loadFromSession(get_called_class());
440
+                // Check the user's session...
441
+                $sessionData = tx_dlf_helper::loadFromSession(get_called_class());
442 442
 
443
-				if (is_object($sessionData[$regObj]) && $sessionData[$regObj] instanceof self) {
443
+                if (is_object($sessionData[$regObj]) && $sessionData[$regObj] instanceof self) {
444 444
 
445
-					// Check if instance has given PID.
446
-					if (!$pid || !$sessionData[$regObj]->pid || $pid == $sessionData[$regObj]->pid) {
445
+                    // Check if instance has given PID.
446
+                    if (!$pid || !$sessionData[$regObj]->pid || $pid == $sessionData[$regObj]->pid) {
447 447
 
448
-						// ...and restore registry.
449
-						self::$registry[$regObj] = $sessionData[$regObj];
448
+                        // ...and restore registry.
449
+                        self::$registry[$regObj] = $sessionData[$regObj];
450 450
 
451
-						return self::$registry[$regObj];
451
+                        return self::$registry[$regObj];
452 452
 
453
-					}
453
+                    }
454 454
 
455
-				}
455
+                }
456 456
 
457
-			}
457
+            }
458 458
 
459
-		}
459
+        }
460 460
 
461
-		// Create new instance...
462
-		$instance = new self($uid, $pid);
461
+        // Create new instance...
462
+        $instance = new self($uid, $pid);
463 463
 
464
-		// ...and save it to registry.
465
-		if ($instance->ready) {
464
+        // ...and save it to registry.
465
+        if ($instance->ready) {
466 466
 
467
-			self::$registry[md5($instance->uid)] = $instance;
467
+            self::$registry[md5($instance->uid)] = $instance;
468 468
 
469
-			if ($instance->uid != $instance->location) {
469
+            if ($instance->uid != $instance->location) {
470 470
 
471
-				self::$registry[md5($instance->location)] = $instance;
471
+                self::$registry[md5($instance->location)] = $instance;
472 472
 
473
-			}
473
+            }
474 474
 
475
-			// Load extension configuration
476
-			$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']);
475
+            // Load extension configuration
476
+            $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']);
477 477
 
478
-			// Save registry to session if caching is enabled.
479
-			if (!empty($extConf['caching'])) {
478
+            // Save registry to session if caching is enabled.
479
+            if (!empty($extConf['caching'])) {
480 480
 
481
-				tx_dlf_helper::saveToSession(self::$registry, get_class($instance));
481
+                tx_dlf_helper::saveToSession(self::$registry, get_class($instance));
482 482
 
483
-			}
483
+            }
484 484
 
485
-		}
485
+        }
486 486
 
487
-		// Return new instance.
488
-		return $instance;
487
+        // Return new instance.
488
+        return $instance;
489 489
 
490
-	}
490
+    }
491 491
 
492
-	/**
493
-	 * This gets details about a logical structure element
494
-	 *
495
-	 * @access	public
496
-	 *
497
-	 * @param	string		$id: The @ID attribute of the logical structure node
498
-	 * @param	boolean		$recursive: Whether to include the child elements
499
-	 *
500
-	 * @return	array		Array of the element's id, label, type and physical page indexes/mptr link
501
-	 */
502
-	public function getLogicalStructure($id, $recursive = FALSE) {
492
+    /**
493
+     * This gets details about a logical structure element
494
+     *
495
+     * @access	public
496
+     *
497
+     * @param	string		$id: The @ID attribute of the logical structure node
498
+     * @param	boolean		$recursive: Whether to include the child elements
499
+     *
500
+     * @return	array		Array of the element's id, label, type and physical page indexes/mptr link
501
+     */
502
+    public function getLogicalStructure($id, $recursive = FALSE) {
503 503
 
504
-		$details = array ();
504
+        $details = array ();
505 505
 
506
-		// Is the requested logical unit already loaded?
507
-		if (!$recursive && !empty($this->logicalUnits[$id])) {
506
+        // Is the requested logical unit already loaded?
507
+        if (!$recursive && !empty($this->logicalUnits[$id])) {
508 508
 
509
-			// Yes. Return it.
510
-			return $this->logicalUnits[$id];
509
+            // Yes. Return it.
510
+            return $this->logicalUnits[$id];
511 511
 
512
-		} elseif (!empty($id)) {
512
+        } elseif (!empty($id)) {
513 513
 
514
-			// Get specified logical unit.
515
-			$divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]');
514
+            // Get specified logical unit.
515
+            $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]');
516 516
 
517
-		} else {
517
+        } else {
518 518
 
519
-			// Get all logical units at top level.
520
-			$divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div');
519
+            // Get all logical units at top level.
520
+            $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div');
521 521
 
522
-		}
522
+        }
523 523
 
524
-		if (!empty($divs)) {
524
+        if (!empty($divs)) {
525 525
 
526
-			if (!$recursive) {
526
+            if (!$recursive) {
527 527
 
528
-				// Get the details for the first xpath hit.
529
-				$details = $this->getLogicalStructureInfo($divs[0]);
528
+                // Get the details for the first xpath hit.
529
+                $details = $this->getLogicalStructureInfo($divs[0]);
530 530
 
531
-			} else {
531
+            } else {
532 532
 
533
-				// Walk the logical structure recursively and fill the whole table of contents.
534
-				foreach ($divs as $div) {
533
+                // Walk the logical structure recursively and fill the whole table of contents.
534
+                foreach ($divs as $div) {
535 535
 
536
-					$this->tableOfContents[] = $this->getLogicalStructureInfo($div, TRUE);
536
+                    $this->tableOfContents[] = $this->getLogicalStructureInfo($div, TRUE);
537 537
 
538
-				}
538
+                }
539 539
 
540
-			}
540
+            }
541 541
 
542
-		}
542
+        }
543 543
 
544
-		return $details;
544
+        return $details;
545 545
 
546
-	}
546
+    }
547 547
 
548
-	/**
549
-	 * This gets details about a logical structure element
550
-	 *
551
-	 * @access	protected
552
-	 *
553
-	 * @param	SimpleXMLElement		$structure: The logical structure node
554
-	 * @param	boolean		$recursive: Whether to include the child elements
555
-	 *
556
-	 * @return	array		Array of the element's id, label, type and physical page indexes/mptr link
557
-	 */
558
-	protected function getLogicalStructureInfo(SimpleXMLElement $structure, $recursive = FALSE) {
548
+    /**
549
+     * This gets details about a logical structure element
550
+     *
551
+     * @access	protected
552
+     *
553
+     * @param	SimpleXMLElement		$structure: The logical structure node
554
+     * @param	boolean		$recursive: Whether to include the child elements
555
+     *
556
+     * @return	array		Array of the element's id, label, type and physical page indexes/mptr link
557
+     */
558
+    protected function getLogicalStructureInfo(SimpleXMLElement $structure, $recursive = FALSE) {
559 559
 
560
-		// Get attributes.
561
-		foreach ($structure->attributes() as $attribute => $value) {
560
+        // Get attributes.
561
+        foreach ($structure->attributes() as $attribute => $value) {
562 562
 
563
-			$attributes[$attribute] = (string) $value;
563
+            $attributes[$attribute] = (string) $value;
564 564
 
565
-		}
565
+        }
566 566
 
567
-		// Load plugin configuration.
568
-		$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
567
+        // Load plugin configuration.
568
+        $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
569 569
 
570
-		// Extract identity information.
571
-		$details = array ();
570
+        // Extract identity information.
571
+        $details = array ();
572 572
 
573
-		$details['id'] = $attributes['ID'];
573
+        $details['id'] = $attributes['ID'];
574 574
 
575
-		$details['dmdId'] = (isset($attributes['DMDID']) ?  $attributes['DMDID'] : '');
575
+        $details['dmdId'] = (isset($attributes['DMDID']) ?  $attributes['DMDID'] : '');
576 576
 
577
-		$details['label'] = (isset($attributes['LABEL']) ? $attributes['LABEL'] : '');
577
+        $details['label'] = (isset($attributes['LABEL']) ? $attributes['LABEL'] : '');
578 578
 
579
-		$details['orderlabel'] = (isset($attributes['ORDERLABEL']) ? $attributes['ORDERLABEL'] : '');
579
+        $details['orderlabel'] = (isset($attributes['ORDERLABEL']) ? $attributes['ORDERLABEL'] : '');
580 580
 
581
-		$details['contentIds'] = (isset($attributes['CONTENTIDS']) ? $attributes['CONTENTIDS'] : '');
581
+        $details['contentIds'] = (isset($attributes['CONTENTIDS']) ? $attributes['CONTENTIDS'] : '');
582 582
 
583
-		$details['volume'] = '';
583
+        $details['volume'] = '';
584 584
 
585
-		// Set volume information only if no label is set and this is the toplevel structure element.
586
-		if (empty($details['label']) && $details['id'] == $this->_getToplevelId()) {
585
+        // Set volume information only if no label is set and this is the toplevel structure element.
586
+        if (empty($details['label']) && $details['id'] == $this->_getToplevelId()) {
587 587
 
588
-			$metadata = $this->getMetadata($details['id']);
588
+            $metadata = $this->getMetadata($details['id']);
589 589
 
590
-			if (!empty($metadata['volume'][0])) {
590
+            if (!empty($metadata['volume'][0])) {
591 591
 
592
-				$details['volume'] = $metadata['volume'][0];
592
+                $details['volume'] = $metadata['volume'][0];
593 593
 
594
-			}
594
+            }
595 595
 
596
-		}
596
+        }
597 597
 
598
-		$details['pagination'] = '';
598
+        $details['pagination'] = '';
599 599
 
600
-		$details['type'] = $attributes['TYPE'];
600
+        $details['type'] = $attributes['TYPE'];
601 601
 
602
-		$details['thumbnailId'] = '';
602
+        $details['thumbnailId'] = '';
603 603
 
604
-		// Load smLinks.
605
-		$this->_getSmLinks();
604
+        // Load smLinks.
605
+        $this->_getSmLinks();
606 606
 
607
-		// Load physical structure.
608
-		$this->_getPhysicalStructure();
607
+        // Load physical structure.
608
+        $this->_getPhysicalStructure();
609 609
 
610
-		// Get the physical page or external file this structure element is pointing at.
611
-		$details['points'] = '';
610
+        // Get the physical page or external file this structure element is pointing at.
611
+        $details['points'] = '';
612 612
 
613
-		// Is there a mptr node?
614
-		if (count($structure->children('http://www.loc.gov/METS/')->mptr)) {
613
+        // Is there a mptr node?
614
+        if (count($structure->children('http://www.loc.gov/METS/')->mptr)) {
615 615
 
616
-			// Yes. Get the file reference.
617
-			$details['points'] = (string) $structure->children('http://www.loc.gov/METS/')->mptr[0]->attributes('http://www.w3.org/1999/xlink')->href;
616
+            // Yes. Get the file reference.
617
+            $details['points'] = (string) $structure->children('http://www.loc.gov/METS/')->mptr[0]->attributes('http://www.w3.org/1999/xlink')->href;
618 618
 
619
-		// Are there any physical elements and is this logical unit linked to at least one of them?
620
-		} elseif (!empty($this->physicalStructure) && array_key_exists($details['id'], $this->smLinks['l2p'])) {
619
+        // Are there any physical elements and is this logical unit linked to at least one of them?
620
+        } elseif (!empty($this->physicalStructure) && array_key_exists($details['id'], $this->smLinks['l2p'])) {
621 621
 
622
-			$details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE)), 1);
622
+            $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE)), 1);
623 623
 
624
-			if (!empty($this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$extConf['fileGrpThumbs']])) {
624
+            if (!empty($this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$extConf['fileGrpThumbs']])) {
625 625
 
626
-				$details['thumbnailId'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$extConf['fileGrpThumbs']];
626
+                $details['thumbnailId'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$extConf['fileGrpThumbs']];
627 627
 
628
-			}
628
+            }
629 629
 
630
-			// Get page/track number of the first page/track related to this structure element.
631
-			$details['pagination'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['orderlabel'];
630
+            // Get page/track number of the first page/track related to this structure element.
631
+            $details['pagination'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['orderlabel'];
632 632
 
633
-		// Is this the toplevel structure element?
634
-		} elseif ($details['id'] == $this->_getToplevelId()) {
633
+        // Is this the toplevel structure element?
634
+        } elseif ($details['id'] == $this->_getToplevelId()) {
635 635
 
636
-			// Yes. Point to itself.
637
-			$details['points'] = 1;
636
+            // Yes. Point to itself.
637
+            $details['points'] = 1;
638 638
 
639
-			if (!empty($this->physicalStructure) && !empty($this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$extConf['fileGrpThumbs']])) {
639
+            if (!empty($this->physicalStructure) && !empty($this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$extConf['fileGrpThumbs']])) {
640 640
 
641
-				$details['thumbnailId'] = $this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$extConf['fileGrpThumbs']];
641
+                $details['thumbnailId'] = $this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$extConf['fileGrpThumbs']];
642 642
 
643
-			}
643
+            }
644 644
 
645
-		}
645
+        }
646 646
 
647
-		// Get the files this structure element is pointing at.
648
-		$details['files'] = array ();
647
+        // Get the files this structure element is pointing at.
648
+        $details['files'] = array ();
649 649
 
650
-		$fileUse = $this->_getFileGrps();
650
+        $fileUse = $this->_getFileGrps();
651 651
 
652
-		// Get the file representations from fileSec node.
653
-		foreach ($structure->children('http://www.loc.gov/METS/')->fptr as $fptr) {
652
+        // Get the file representations from fileSec node.
653
+        foreach ($structure->children('http://www.loc.gov/METS/')->fptr as $fptr) {
654 654
 
655
-			// Check if file has valid @USE attribute.
656
-			if (!empty($fileUse[(string) $fptr->attributes()->FILEID])) {
655
+            // Check if file has valid @USE attribute.
656
+            if (!empty($fileUse[(string) $fptr->attributes()->FILEID])) {
657 657
 
658
-				$details['files'][$fileUse[(string) $fptr->attributes()->FILEID]] = (string) $fptr->attributes()->FILEID;
658
+                $details['files'][$fileUse[(string) $fptr->attributes()->FILEID]] = (string) $fptr->attributes()->FILEID;
659 659
 
660
-			}
660
+            }
661 661
 
662
-		}
662
+        }
663 663
 
664
-		// Keep for later usage.
665
-		$this->logicalUnits[$details['id']] = $details;
664
+        // Keep for later usage.
665
+        $this->logicalUnits[$details['id']] = $details;
666 666
 
667
-		// Walk the structure recursively? And are there any children of the current element?
668
-		if ($recursive && count($structure->children('http://www.loc.gov/METS/')->div)) {
667
+        // Walk the structure recursively? And are there any children of the current element?
668
+        if ($recursive && count($structure->children('http://www.loc.gov/METS/')->div)) {
669 669
 
670
-			$details['children'] = array ();
670
+            $details['children'] = array ();
671 671
 
672
-			foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) {
672
+            foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) {
673 673
 
674
-				// Repeat for all children.
675
-				$details['children'][] = $this->getLogicalStructureInfo($child, TRUE);
674
+                // Repeat for all children.
675
+                $details['children'][] = $this->getLogicalStructureInfo($child, TRUE);
676 676
 
677
-			}
677
+            }
678 678
 
679
-		}
679
+        }
680 680
 
681
-		return $details;
681
+        return $details;
682 682
 
683
-	}
683
+    }
684 684
 
685
-	/**
686
-	 * This extracts all the metadata for a logical structure node
687
-	 *
688
-	 * @access	public
689
-	 *
690
-	 * @param	string		$id: The @ID attribute of the logical structure node
691
-	 * @param	integer		$cPid: The PID for the metadata definitions
692
-	 * 						(defaults to $this->cPid or $this->pid)
693
-	 *
694
-	 * @return	array		The logical structure node's parsed metadata array
695
-	 */
696
-	public function getMetadata($id, $cPid = 0) {
685
+    /**
686
+     * This extracts all the metadata for a logical structure node
687
+     *
688
+     * @access	public
689
+     *
690
+     * @param	string		$id: The @ID attribute of the logical structure node
691
+     * @param	integer		$cPid: The PID for the metadata definitions
692
+     * 						(defaults to $this->cPid or $this->pid)
693
+     *
694
+     * @return	array		The logical structure node's parsed metadata array
695
+     */
696
+    public function getMetadata($id, $cPid = 0) {
697 697
 
698
-		// Save parameter for logging purposes.
699
-		$_cPid = $cPid;
698
+        // Save parameter for logging purposes.
699
+        $_cPid = $cPid;
700 700
 
701
-		// Make sure $cPid is a non-negative integer.
702
-		$cPid = max(intval($cPid), 0);
701
+        // Make sure $cPid is a non-negative integer.
702
+        $cPid = max(intval($cPid), 0);
703 703
 
704
-		// If $cPid is not given, try to get it elsewhere.
705
-		if (!$cPid && ($this->cPid || $this->pid)) {
704
+        // If $cPid is not given, try to get it elsewhere.
705
+        if (!$cPid && ($this->cPid || $this->pid)) {
706 706
 
707
-			// Retain current PID.
708
-			$cPid = ($this->cPid ? $this->cPid : $this->pid);
707
+            // Retain current PID.
708
+            $cPid = ($this->cPid ? $this->cPid : $this->pid);
709 709
 
710
-		} elseif (!$cPid) {
710
+        } elseif (!$cPid) {
711 711
 
712
-			if (TYPO3_DLOG) {
712
+            if (TYPO3_DLOG) {
713 713
 
714
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getMetadata('.$id.', '.$_cPid.')] Invalid PID "'.$cPid.'" for metadata definitions', self::$extKey, SYSLOG_SEVERITY_ERROR);
714
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getMetadata('.$id.', '.$_cPid.')] Invalid PID "'.$cPid.'" for metadata definitions', self::$extKey, SYSLOG_SEVERITY_ERROR);
715 715
 
716
-			}
716
+            }
717 717
 
718
-			return array ();
718
+            return array ();
719 719
 
720
-		}
720
+        }
721 721
 
722
-		// Get metadata from parsed metadata array if available.
723
-		if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) {
722
+        // Get metadata from parsed metadata array if available.
723
+        if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) {
724 724
 
725
-			return $this->metadataArray[$id];
725
+            return $this->metadataArray[$id];
726 726
 
727
-		}
727
+        }
728 728
 
729
-		// Initialize metadata array with empty values.
730
-		$metadata = array (
731
-			'title' => array (),
732
-			'title_sorting' => array (),
733
-			'author' => array (),
734
-			'place' => array (),
735
-			'year' => array (),
736
-			'prod_id' => array (),
737
-			'record_id' => array (),
738
-			'opac_id' => array (),
739
-			'union_id' => array (),
740
-			'urn' => array (),
741
-			'purl' => array (),
742
-			'type' => array (),
743
-			'volume' => array (),
744
-			'volume_sorting' => array (),
745
-			'collection' => array (),
746
-			'owner' => array (),
747
-		);
729
+        // Initialize metadata array with empty values.
730
+        $metadata = array (
731
+            'title' => array (),
732
+            'title_sorting' => array (),
733
+            'author' => array (),
734
+            'place' => array (),
735
+            'year' => array (),
736
+            'prod_id' => array (),
737
+            'record_id' => array (),
738
+            'opac_id' => array (),
739
+            'union_id' => array (),
740
+            'urn' => array (),
741
+            'purl' => array (),
742
+            'type' => array (),
743
+            'volume' => array (),
744
+            'volume_sorting' => array (),
745
+            'collection' => array (),
746
+            'owner' => array (),
747
+        );
748 748
 
749
-		// Get the logical structure node's DMDID.
750
-		if (!empty($this->logicalUnits[$id])) {
749
+        // Get the logical structure node's DMDID.
750
+        if (!empty($this->logicalUnits[$id])) {
751 751
 
752
-			$dmdId = $this->logicalUnits[$id]['dmdId'];
752
+            $dmdId = $this->logicalUnits[$id]['dmdId'];
753 753
 
754
-		} else {
754
+        } else {
755 755
 
756
-			$dmdId = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@DMDID');
756
+            $dmdId = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@DMDID');
757 757
 
758
-			$dmdId = (string) $dmdId[0];
758
+            $dmdId = (string) $dmdId[0];
759 759
 
760
-		}
760
+        }
761 761
 
762
-		if (!empty($dmdId)) {
762
+        if (!empty($dmdId)) {
763 763
 
764
-			// Load available metadata formats and dmdSecs.
765
-			$this->loadFormats();
764
+            // Load available metadata formats and dmdSecs.
765
+            $this->loadFormats();
766 766
 
767
-			$this->_getDmdSec();
767
+            $this->_getDmdSec();
768 768
 
769
-			// Is this metadata format supported?
770
-			if (!empty($this->formats[$this->dmdSec[$dmdId]['type']])) {
769
+            // Is this metadata format supported?
770
+            if (!empty($this->formats[$this->dmdSec[$dmdId]['type']])) {
771 771
 
772
-				if (!empty($this->formats[$this->dmdSec[$dmdId]['type']]['class'])) {
772
+                if (!empty($this->formats[$this->dmdSec[$dmdId]['type']]['class'])) {
773 773
 
774
-					$class = $this->formats[$this->dmdSec[$dmdId]['type']]['class'];
774
+                    $class = $this->formats[$this->dmdSec[$dmdId]['type']]['class'];
775 775
 
776
-					// Get the metadata from class.
777
-					if (class_exists($class) && ($obj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($class)) instanceof tx_dlf_format) {
776
+                    // Get the metadata from class.
777
+                    if (class_exists($class) && ($obj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($class)) instanceof tx_dlf_format) {
778 778
 
779
-						$obj->extractMetadata($this->dmdSec[$dmdId]['xml'], $metadata);
779
+                        $obj->extractMetadata($this->dmdSec[$dmdId]['xml'], $metadata);
780 780
 
781
-					} else {
781
+                    } else {
782 782
 
783
-						if (TYPO3_DLOG) {
783
+                        if (TYPO3_DLOG) {
784 784
 
785
-							\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getMetadata('.$id.', '.$_cPid.')] Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->dmdSec[$dmdId]['type'].'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
785
+                            \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getMetadata('.$id.', '.$_cPid.')] Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->dmdSec[$dmdId]['type'].'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
786 786
 
787
-						}
787
+                        }
788 788
 
789
-					}
789
+                    }
790 790
 
791
-				}
791
+                }
792 792
 
793
-			} else {
793
+            } else {
794 794
 
795
-				if (TYPO3_DLOG) {
795
+                if (TYPO3_DLOG) {
796 796
 
797
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getMetadata('.$id.', '.$_cPid.')] Unsupported metadata format "'.$this->dmdSec[$dmdId]['type'].'" in dmdSec with @ID "'.$dmdId.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
797
+                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getMetadata('.$id.', '.$_cPid.')] Unsupported metadata format "'.$this->dmdSec[$dmdId]['type'].'" in dmdSec with @ID "'.$dmdId.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
798 798
 
799
-				}
799
+                }
800 800
 
801
-				return array ();
801
+                return array ();
802 802
 
803
-			}
803
+            }
804 804
 
805
-			// Get the structure's type.
806
-			if (!empty($this->logicalUnits[$id])) {
805
+            // Get the structure's type.
806
+            if (!empty($this->logicalUnits[$id])) {
807 807
 
808
-				$metadata['type'] = array ($this->logicalUnits[$id]['type']);
808
+                $metadata['type'] = array ($this->logicalUnits[$id]['type']);
809 809
 
810
-			} else {
810
+            } else {
811 811
 
812
-				$struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE');
812
+                $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE');
813 813
 
814
-				$metadata['type'] = array ((string) $struct[0]);
814
+                $metadata['type'] = array ((string) $struct[0]);
815 815
 
816
-			}
816
+            }
817 817
 
818
-			// Get the additional metadata from database.
819
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
820
-				'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadataformat.xpath AS xpath,tx_dlf_metadataformat.xpath_sorting AS xpath_sorting,tx_dlf_metadata.is_sortable AS is_sortable,tx_dlf_metadata.default_value AS default_value,tx_dlf_metadata.format AS format',
821
-				'tx_dlf_metadata,tx_dlf_metadataformat,tx_dlf_formats',
822
-				'tx_dlf_metadata.pid='.$cPid.' AND tx_dlf_metadataformat.pid='.$cPid.' AND ((tx_dlf_metadata.uid=tx_dlf_metadataformat.parent_id AND tx_dlf_metadataformat.encoded=tx_dlf_formats.uid AND tx_dlf_formats.type='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->dmdSec[$dmdId]['type'], 'tx_dlf_formats').') OR tx_dlf_metadata.format=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata', TRUE).tx_dlf_helper::whereClause('tx_dlf_metadataformat').tx_dlf_helper::whereClause('tx_dlf_formats'),
823
-				'',
824
-				'',
825
-				''
826
-			);
818
+            // Get the additional metadata from database.
819
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
820
+                'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadataformat.xpath AS xpath,tx_dlf_metadataformat.xpath_sorting AS xpath_sorting,tx_dlf_metadata.is_sortable AS is_sortable,tx_dlf_metadata.default_value AS default_value,tx_dlf_metadata.format AS format',
821
+                'tx_dlf_metadata,tx_dlf_metadataformat,tx_dlf_formats',
822
+                'tx_dlf_metadata.pid='.$cPid.' AND tx_dlf_metadataformat.pid='.$cPid.' AND ((tx_dlf_metadata.uid=tx_dlf_metadataformat.parent_id AND tx_dlf_metadataformat.encoded=tx_dlf_formats.uid AND tx_dlf_formats.type='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->dmdSec[$dmdId]['type'], 'tx_dlf_formats').') OR tx_dlf_metadata.format=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata', TRUE).tx_dlf_helper::whereClause('tx_dlf_metadataformat').tx_dlf_helper::whereClause('tx_dlf_formats'),
823
+                '',
824
+                '',
825
+                ''
826
+            );
827 827
 
828
-			// We need a DOMDocument here, because SimpleXML doesn't support XPath functions properly.
829
-			$domNode = dom_import_simplexml($this->dmdSec[$dmdId]['xml']);
828
+            // We need a DOMDocument here, because SimpleXML doesn't support XPath functions properly.
829
+            $domNode = dom_import_simplexml($this->dmdSec[$dmdId]['xml']);
830 830
 
831
-			$domXPath = new DOMXPath($domNode->ownerDocument);
831
+            $domXPath = new DOMXPath($domNode->ownerDocument);
832 832
 
833
-			$this->registerNamespaces($domXPath);
833
+            $this->registerNamespaces($domXPath);
834 834
 
835
-			// OK, now make the XPath queries.
836
-			while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
835
+            // OK, now make the XPath queries.
836
+            while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
837 837
 
838
-				// Set metadata field's value(s).
839
-				if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $domXPath->evaluate($resArray['xpath'], $domNode))) {
838
+                // Set metadata field's value(s).
839
+                if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $domXPath->evaluate($resArray['xpath'], $domNode))) {
840 840
 
841
-					if ($values instanceof DOMNodeList && $values->length > 0) {
841
+                    if ($values instanceof DOMNodeList && $values->length > 0) {
842 842
 
843
-						$metadata[$resArray['index_name']] = array ();
843
+                        $metadata[$resArray['index_name']] = array ();
844 844
 
845
-						foreach ($values as $value) {
845
+                        foreach ($values as $value) {
846 846
 
847
-							$metadata[$resArray['index_name']][] = trim((string) $value->nodeValue);
847
+                            $metadata[$resArray['index_name']][] = trim((string) $value->nodeValue);
848 848
 
849
-						}
849
+                        }
850 850
 
851
-					} elseif (!($values instanceof DOMNodeList)) {
851
+                    } elseif (!($values instanceof DOMNodeList)) {
852 852
 
853
-						$metadata[$resArray['index_name']] = array (trim((string) $values));
853
+                        $metadata[$resArray['index_name']] = array (trim((string) $values));
854 854
 
855
-					}
855
+                    }
856 856
 
857
-				}
857
+                }
858 858
 
859
-				// Set default value if applicable.
860
-				if (empty($metadata[$resArray['index_name']][0])) {
859
+                // Set default value if applicable.
860
+                if (empty($metadata[$resArray['index_name']][0])) {
861 861
 
862
-					$metadata[$resArray['index_name']] = array ($resArray['default_value']);
862
+                    $metadata[$resArray['index_name']] = array ($resArray['default_value']);
863 863
 
864
-				}
864
+                }
865 865
 
866
-				// Set sorting value if applicable.
867
-				if (!empty($metadata[$resArray['index_name']]) && $resArray['is_sortable']) {
866
+                // Set sorting value if applicable.
867
+                if (!empty($metadata[$resArray['index_name']]) && $resArray['is_sortable']) {
868 868
 
869
-					if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting']) && ($values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode))) {
869
+                    if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting']) && ($values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode))) {
870 870
 
871
-						if ($values instanceof DOMNodeList && $values->length > 0) {
871
+                        if ($values instanceof DOMNodeList && $values->length > 0) {
872 872
 
873
-							$metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue);
873
+                            $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue);
874 874
 
875
-						} elseif (!($values instanceof DOMNodeList)) {
875
+                        } elseif (!($values instanceof DOMNodeList)) {
876 876
 
877
-							$metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values);
877
+                            $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values);
878 878
 
879
-						}
879
+                        }
880 880
 
881
-					}
881
+                    }
882 882
 
883
-					if (empty($metadata[$resArray['index_name'].'_sorting'][0])) {
883
+                    if (empty($metadata[$resArray['index_name'].'_sorting'][0])) {
884 884
 
885
-						$metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0];
885
+                        $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0];
886 886
 
887
-					}
887
+                    }
888 888
 
889
-				}
889
+                }
890 890
 
891
-			}
891
+            }
892 892
 
893
-			// Set title to empty string if not present.
894
-			if (empty($metadata['title'][0])) {
893
+            // Set title to empty string if not present.
894
+            if (empty($metadata['title'][0])) {
895 895
 
896
-				$metadata['title'][0] = '';
896
+                $metadata['title'][0] = '';
897 897
 
898
-				$metadata['title_sorting'][0] = '';
898
+                $metadata['title_sorting'][0] = '';
899 899
 
900
-			}
900
+            }
901 901
 
902
-		} else {
902
+        } else {
903 903
 
904
-			// There is no dmdSec for this structure node.
905
-			return array ();
904
+            // There is no dmdSec for this structure node.
905
+            return array ();
906 906
 
907
-		}
907
+        }
908 908
 
909
-		return $metadata;
909
+        return $metadata;
910 910
 
911
-	}
911
+    }
912 912
 
913
-	/**
914
-	 * This returns the first corresponding physical page number of a given logical page label
915
-	 *
916
-	 * @access	public
917
-	 *
918
-	 * @param	string		$logicalPage: The label (or a part of the label) of the logical page
919
-	 *
920
-	 * @return	integer		The physical page number
921
-	 */
922
-	public function getPhysicalPage($logicalPage) {
913
+    /**
914
+     * This returns the first corresponding physical page number of a given logical page label
915
+     *
916
+     * @access	public
917
+     *
918
+     * @param	string		$logicalPage: The label (or a part of the label) of the logical page
919
+     *
920
+     * @return	integer		The physical page number
921
+     */
922
+    public function getPhysicalPage($logicalPage) {
923 923
 
924
-		if(!empty( $this->lastSearchedPhysicalPage['logicalPage']) &&  $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage) {
924
+        if(!empty( $this->lastSearchedPhysicalPage['logicalPage']) &&  $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage) {
925 925
 
926
-			return $this->lastSearchedPhysicalPage['physicalPage'];
926
+            return $this->lastSearchedPhysicalPage['physicalPage'];
927 927
 
928
-		} else {
928
+        } else {
929 929
 
930
-			$physicalPage = 0;
930
+            $physicalPage = 0;
931 931
 
932
-			foreach($this->physicalStructureInfo as $page) {
932
+            foreach($this->physicalStructureInfo as $page) {
933 933
 
934
-				if(strpos($page['orderlabel'], $logicalPage) !== false){
934
+                if(strpos($page['orderlabel'], $logicalPage) !== false){
935 935
 
936
-					$this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage;
937
-					$this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage;
936
+                    $this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage;
937
+                    $this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage;
938 938
 
939
-					return $physicalPage;
939
+                    return $physicalPage;
940 940
 
941
-				}
941
+                }
942 942
 
943
-				$physicalPage++;
943
+                $physicalPage++;
944 944
 
945
-			}
945
+            }
946 946
 
947
-		}
947
+        }
948 948
 
949
-		return 1;
949
+        return 1;
950 950
 
951
-	}
951
+    }
952 952
 
953
-	/**
954
-	 * This determines a title for the given document
955
-	 *
956
-	 * @access	public
957
-	 *
958
-	 * @param	integer		$uid: The UID of the document
959
-	 * @param	boolean		$recursive: Search superior documents for a title, too?
960
-	 *
961
-	 * @return	string		The title of the document itself or a parent document
962
-	 */
963
-	public static function getTitle($uid, $recursive = FALSE) {
953
+    /**
954
+     * This determines a title for the given document
955
+     *
956
+     * @access	public
957
+     *
958
+     * @param	integer		$uid: The UID of the document
959
+     * @param	boolean		$recursive: Search superior documents for a title, too?
960
+     *
961
+     * @return	string		The title of the document itself or a parent document
962
+     */
963
+    public static function getTitle($uid, $recursive = FALSE) {
964 964
 
965
-		// Save parameter for logging purposes.
966
-		$_uid = $uid;
965
+        // Save parameter for logging purposes.
966
+        $_uid = $uid;
967 967
 
968
-		$title = '';
968
+        $title = '';
969 969
 
970
-		// Sanitize input.
971
-		$uid = max(intval($uid), 0);
970
+        // Sanitize input.
971
+        $uid = max(intval($uid), 0);
972 972
 
973
-		if ($uid) {
973
+        if ($uid) {
974 974
 
975
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
976
-				'tx_dlf_documents.title,tx_dlf_documents.partof',
977
-				'tx_dlf_documents',
978
-				'tx_dlf_documents.uid='.$uid.tx_dlf_helper::whereClause('tx_dlf_documents'),
979
-				'',
980
-				'',
981
-				'1'
982
-			);
975
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
976
+                'tx_dlf_documents.title,tx_dlf_documents.partof',
977
+                'tx_dlf_documents',
978
+                'tx_dlf_documents.uid='.$uid.tx_dlf_helper::whereClause('tx_dlf_documents'),
979
+                '',
980
+                '',
981
+                '1'
982
+            );
983 983
 
984
-			if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
984
+            if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
985 985
 
986
-				// Get title information.
987
-				list ($title, $partof) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
986
+                // Get title information.
987
+                list ($title, $partof) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
988 988
 
989
-				// Search parent documents recursively for a title?
990
-				if ($recursive && empty($title) && intval($partof) && $partof != $uid) {
989
+                // Search parent documents recursively for a title?
990
+                if ($recursive && empty($title) && intval($partof) && $partof != $uid) {
991 991
 
992
-					$title = self::getTitle($partof, TRUE);
992
+                    $title = self::getTitle($partof, TRUE);
993 993
 
994
-				}
994
+                }
995 995
 
996
-			} else {
996
+            } else {
997 997
 
998
-				if (TYPO3_DLOG) {
998
+                if (TYPO3_DLOG) {
999 999
 
1000
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getTitle('.$_uid.', ['.($recursive ? 'TRUE' : 'FALSE').'])] No document with UID "'.$uid.'" found or document not accessible', self::$extKey, SYSLOG_SEVERITY_WARNING);
1000
+                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getTitle('.$_uid.', ['.($recursive ? 'TRUE' : 'FALSE').'])] No document with UID "'.$uid.'" found or document not accessible', self::$extKey, SYSLOG_SEVERITY_WARNING);
1001 1001
 
1002
-				}
1002
+                }
1003 1003
 
1004
-			}
1004
+            }
1005 1005
 
1006
-		} else {
1006
+        } else {
1007 1007
 
1008
-			if (TYPO3_DLOG) {
1008
+            if (TYPO3_DLOG) {
1009 1009
 
1010
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getTitle('.$_uid.', ['.($recursive ? 'TRUE' : 'FALSE').'])] Invalid UID "'.$uid.'" for document', self::$extKey, SYSLOG_SEVERITY_ERROR);
1010
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getTitle('.$_uid.', ['.($recursive ? 'TRUE' : 'FALSE').'])] Invalid UID "'.$uid.'" for document', self::$extKey, SYSLOG_SEVERITY_ERROR);
1011 1011
 
1012
-			}
1012
+            }
1013 1013
 
1014
-		}
1014
+        }
1015 1015
 
1016
-		return $title;
1016
+        return $title;
1017 1017
 
1018
-	}
1018
+    }
1019 1019
 
1020
-	/**
1021
-	 * This extracts all the metadata for the toplevel logical structure node
1022
-	 *
1023
-	 * @access	public
1024
-	 *
1025
-	 * @param	integer		$cPid: The PID for the metadata definitions
1026
-	 *
1027
-	 * @return	array		The logical structure node's parsed metadata array
1028
-	 */
1029
-	public function getTitledata($cPid = 0) {
1020
+    /**
1021
+     * This extracts all the metadata for the toplevel logical structure node
1022
+     *
1023
+     * @access	public
1024
+     *
1025
+     * @param	integer		$cPid: The PID for the metadata definitions
1026
+     *
1027
+     * @return	array		The logical structure node's parsed metadata array
1028
+     */
1029
+    public function getTitledata($cPid = 0) {
1030 1030
 
1031
-		$titledata = $this->getMetadata($this->_getToplevelId(), $cPid);
1031
+        $titledata = $this->getMetadata($this->_getToplevelId(), $cPid);
1032 1032
 
1033
-		// Set record identifier for METS file if not present.
1034
-		if (is_array($titledata) && array_key_exists('record_id', $titledata)) {
1033
+        // Set record identifier for METS file if not present.
1034
+        if (is_array($titledata) && array_key_exists('record_id', $titledata)) {
1035 1035
 
1036
-			if (!empty($this->recordId) && !in_array($this->recordId, $titledata['record_id'])) {
1036
+            if (!empty($this->recordId) && !in_array($this->recordId, $titledata['record_id'])) {
1037 1037
 
1038
-				array_unshift($titledata['record_id'], $this->recordId);
1038
+                array_unshift($titledata['record_id'], $this->recordId);
1039 1039
 
1040
-			}
1040
+            }
1041 1041
 
1042
-		};
1042
+        };
1043 1043
 
1044
-		return $titledata;
1044
+        return $titledata;
1045 1045
 
1046
-	}
1046
+    }
1047 1047
 
1048
-	/**
1049
-	 * This sets some basic class properties
1050
-	 *
1051
-	 * @access	protected
1052
-	 *
1053
-	 * @return	void
1054
-	 */
1055
-	protected function init() {
1048
+    /**
1049
+     * This sets some basic class properties
1050
+     *
1051
+     * @access	protected
1052
+     *
1053
+     * @return	void
1054
+     */
1055
+    protected function init() {
1056 1056
 
1057
-		// Get METS node from XML file.
1058
-		$this->registerNamespaces($this->xml);
1057
+        // Get METS node from XML file.
1058
+        $this->registerNamespaces($this->xml);
1059 1059
 
1060
-		$mets = $this->xml->xpath('//mets:mets');
1060
+        $mets = $this->xml->xpath('//mets:mets');
1061 1061
 
1062
-		if ($mets) {
1062
+        if ($mets) {
1063 1063
 
1064
-			$this->mets = $mets[0];
1064
+            $this->mets = $mets[0];
1065 1065
 
1066
-			// Register namespaces.
1067
-			$this->registerNamespaces($this->mets);
1066
+            // Register namespaces.
1067
+            $this->registerNamespaces($this->mets);
1068 1068
 
1069
-		} else {
1069
+        } else {
1070 1070
 
1071
-			if (TYPO3_DLOG) {
1071
+            if (TYPO3_DLOG) {
1072 1072
 
1073
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->init()] No METS part found in document with UID "'.$this->uid.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
1073
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->init()] No METS part found in document with UID "'.$this->uid.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
1074 1074
 
1075
-			}
1075
+            }
1076 1076
 
1077
-		}
1077
+        }
1078 1078
 
1079
-	}
1079
+    }
1080 1080
 
1081
-	/**
1082
-	 * Load XML file from URL
1083
-	 *
1084
-	 * @access	protected
1085
-	 *
1086
-	 * @param	string		$location: The URL of the file to load
1087
-	 *
1088
-	 * @return	boolean		TRUE on success or FALSE on failure
1089
-	 */
1090
-	protected function load($location) {
1081
+    /**
1082
+     * Load XML file from URL
1083
+     *
1084
+     * @access	protected
1085
+     *
1086
+     * @param	string		$location: The URL of the file to load
1087
+     *
1088
+     * @return	boolean		TRUE on success or FALSE on failure
1089
+     */
1090
+    protected function load($location) {
1091 1091
 
1092
-		// Load XML file.
1093
-		if (\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($location)) {
1092
+        // Load XML file.
1093
+        if (\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($location)) {
1094 1094
 
1095
-			// Load extension configuration
1096
-			$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']);
1095
+            // Load extension configuration
1096
+            $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']);
1097 1097
 
1098
-			// Set user-agent to identify self when fetching XML data.
1099
-			if (!empty($extConf['useragent'])) {
1098
+            // Set user-agent to identify self when fetching XML data.
1099
+            if (!empty($extConf['useragent'])) {
1100 1100
 
1101
-				@ini_set('user_agent', $extConf['useragent']);
1101
+                @ini_set('user_agent', $extConf['useragent']);
1102 1102
 
1103
-			}
1103
+            }
1104 1104
 
1105
-			// Turn off libxml's error logging.
1106
-			$libxmlErrors = libxml_use_internal_errors(TRUE);
1105
+            // Turn off libxml's error logging.
1106
+            $libxmlErrors = libxml_use_internal_errors(TRUE);
1107 1107
 
1108
-			// Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept
1109
-			$previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE);
1108
+            // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept
1109
+            $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE);
1110 1110
 
1111
-			// Load XML from file.
1112
-			$xml = simplexml_load_string(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($location));
1111
+            // Load XML from file.
1112
+            $xml = simplexml_load_string(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($location));
1113 1113
 
1114
-			// reset entity loader setting
1115
-			libxml_disable_entity_loader($previousValueOfEntityLoader);
1114
+            // reset entity loader setting
1115
+            libxml_disable_entity_loader($previousValueOfEntityLoader);
1116 1116
 
1117
-			// Reset libxml's error logging.
1118
-			libxml_use_internal_errors($libxmlErrors);
1117
+            // Reset libxml's error logging.
1118
+            libxml_use_internal_errors($libxmlErrors);
1119 1119
 
1120
-			// Set some basic properties.
1121
-			if ($xml !== FALSE) {
1120
+            // Set some basic properties.
1121
+            if ($xml !== FALSE) {
1122 1122
 
1123
-				$this->xml = $xml;
1123
+                $this->xml = $xml;
1124 1124
 
1125
-				return TRUE;
1125
+                return TRUE;
1126 1126
 
1127
-			} else {
1127
+            } else {
1128 1128
 
1129
-				if (TYPO3_DLOG) {
1129
+                if (TYPO3_DLOG) {
1130 1130
 
1131
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->load('.$location.')] Could not load XML file from "'.$location.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
1131
+                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->load('.$location.')] Could not load XML file from "'.$location.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
1132 1132
 
1133
-				}
1133
+                }
1134 1134
 
1135
-			}
1135
+            }
1136 1136
 
1137
-		} else {
1137
+        } else {
1138 1138
 
1139
-			if (TYPO3_DLOG) {
1139
+            if (TYPO3_DLOG) {
1140 1140
 
1141
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->load('.$location.')] Invalid file location "'.$location.'" for document loading', self::$extKey, SYSLOG_SEVERITY_ERROR);
1141
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->load('.$location.')] Invalid file location "'.$location.'" for document loading', self::$extKey, SYSLOG_SEVERITY_ERROR);
1142 1142
 
1143
-			}
1143
+            }
1144 1144
 
1145
-		}
1145
+        }
1146 1146
 
1147
-		return FALSE;
1147
+        return FALSE;
1148 1148
 
1149
-	}
1149
+    }
1150 1150
 
1151
-	/**
1152
-	 * Register all available data formats
1153
-	 *
1154
-	 * @access	protected
1155
-	 *
1156
-	 * @return	void
1157
-	 */
1158
-	protected function loadFormats() {
1151
+    /**
1152
+     * Register all available data formats
1153
+     *
1154
+     * @access	protected
1155
+     *
1156
+     * @return	void
1157
+     */
1158
+    protected function loadFormats() {
1159 1159
 
1160
-		if (!$this->formatsLoaded) {
1160
+        if (!$this->formatsLoaded) {
1161 1161
 
1162
-			// Get available data formats from database.
1163
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1164
-				'tx_dlf_formats.type AS type,tx_dlf_formats.root AS root,tx_dlf_formats.namespace AS namespace,tx_dlf_formats.class AS class',
1165
-				'tx_dlf_formats',
1166
-				'tx_dlf_formats.pid=0'.tx_dlf_helper::whereClause('tx_dlf_formats'),
1167
-				'',
1168
-				'',
1169
-				''
1170
-			);
1162
+            // Get available data formats from database.
1163
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1164
+                'tx_dlf_formats.type AS type,tx_dlf_formats.root AS root,tx_dlf_formats.namespace AS namespace,tx_dlf_formats.class AS class',
1165
+                'tx_dlf_formats',
1166
+                'tx_dlf_formats.pid=0'.tx_dlf_helper::whereClause('tx_dlf_formats'),
1167
+                '',
1168
+                '',
1169
+                ''
1170
+            );
1171 1171
 
1172
-			while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1172
+            while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1173 1173
 
1174
-				// Update format registry.
1175
-				$this->formats[$resArray['type']] = array (
1176
-					'rootElement' => $resArray['root'],
1177
-					'namespaceURI' => $resArray['namespace'],
1178
-					'class' => $resArray['class']
1179
-				);
1174
+                // Update format registry.
1175
+                $this->formats[$resArray['type']] = array (
1176
+                    'rootElement' => $resArray['root'],
1177
+                    'namespaceURI' => $resArray['namespace'],
1178
+                    'class' => $resArray['class']
1179
+                );
1180 1180
 
1181
-			}
1181
+            }
1182 1182
 
1183
-			$this->formatsLoaded = TRUE;
1183
+            $this->formatsLoaded = TRUE;
1184 1184
 
1185
-		}
1185
+        }
1186 1186
 
1187
-	}
1187
+    }
1188 1188
 
1189
-	/**
1190
-	 * Register all available namespaces for a SimpleXMLElement object
1191
-	 *
1192
-	 * @access	public
1193
-	 *
1194
-	 * @param	SimpleXMLElement|DOMXPath		&$obj: SimpleXMLElement or DOMXPath object
1195
-	 *
1196
-	 * @return	void
1197
-	 */
1198
-	public function registerNamespaces(&$obj) {
1189
+    /**
1190
+     * Register all available namespaces for a SimpleXMLElement object
1191
+     *
1192
+     * @access	public
1193
+     *
1194
+     * @param	SimpleXMLElement|DOMXPath		&$obj: SimpleXMLElement or DOMXPath object
1195
+     *
1196
+     * @return	void
1197
+     */
1198
+    public function registerNamespaces(&$obj) {
1199 1199
 
1200
-		$this->loadFormats();
1200
+        $this->loadFormats();
1201 1201
 
1202
-		// Do we have a SimpleXMLElement or DOMXPath object?
1203
-		if ($obj instanceof SimpleXMLElement) {
1202
+        // Do we have a SimpleXMLElement or DOMXPath object?
1203
+        if ($obj instanceof SimpleXMLElement) {
1204 1204
 
1205
-			$method = 'registerXPathNamespace';
1205
+            $method = 'registerXPathNamespace';
1206 1206
 
1207
-		} elseif ($obj instanceof DOMXPath) {
1207
+        } elseif ($obj instanceof DOMXPath) {
1208 1208
 
1209
-			$method = 'registerNamespace';
1209
+            $method = 'registerNamespace';
1210 1210
 
1211
-		} else {
1211
+        } else {
1212 1212
 
1213
-			if (TYPO3_DLOG) {
1213
+            if (TYPO3_DLOG) {
1214 1214
 
1215
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->registerNamespaces(['.get_class($obj).'])] Given object is neither a SimpleXMLElement nor a DOMXPath instance', self::$extKey, SYSLOG_SEVERITY_ERROR);
1215
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->registerNamespaces(['.get_class($obj).'])] Given object is neither a SimpleXMLElement nor a DOMXPath instance', self::$extKey, SYSLOG_SEVERITY_ERROR);
1216 1216
 
1217
-			}
1217
+            }
1218 1218
 
1219
-			return;
1219
+            return;
1220 1220
 
1221
-		}
1221
+        }
1222 1222
 
1223
-		// Register metadata format's namespaces.
1224
-		foreach ($this->formats as $enc => $conf) {
1223
+        // Register metadata format's namespaces.
1224
+        foreach ($this->formats as $enc => $conf) {
1225 1225
 
1226
-			$obj->$method(strtolower($enc), $conf['namespaceURI']);
1226
+            $obj->$method(strtolower($enc), $conf['namespaceURI']);
1227 1227
 
1228
-		}
1228
+        }
1229 1229
 
1230
-	}
1230
+    }
1231 1231
 
1232
-	/**
1233
-	 * This saves the document to the database and index
1234
-	 *
1235
-	 * @access	public
1236
-	 *
1237
-	 * @param	integer		$pid: The PID of the saved record
1238
-	 * @param	integer		$core: The UID of the Solr core for indexing
1239
-	 *
1240
-	 * @return	boolean		TRUE on success or FALSE on failure
1241
-	 */
1242
-	public function save($pid = 0, $core = 0) {
1232
+    /**
1233
+     * This saves the document to the database and index
1234
+     *
1235
+     * @access	public
1236
+     *
1237
+     * @param	integer		$pid: The PID of the saved record
1238
+     * @param	integer		$core: The UID of the Solr core for indexing
1239
+     *
1240
+     * @return	boolean		TRUE on success or FALSE on failure
1241
+     */
1242
+    public function save($pid = 0, $core = 0) {
1243 1243
 
1244
-		// Save parameters for logging purposes.
1245
-		$_pid = $pid;
1244
+        // Save parameters for logging purposes.
1245
+        $_pid = $pid;
1246 1246
 
1247
-		$_core = $core;
1247
+        $_core = $core;
1248 1248
 
1249
-		if (TYPO3_MODE !== 'BE') {
1249
+        if (TYPO3_MODE !== 'BE') {
1250 1250
 
1251
-			if (TYPO3_DLOG) {
1251
+            if (TYPO3_DLOG) {
1252 1252
 
1253
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Saving a document is only allowed in the backend', self::$extKey, SYSLOG_SEVERITY_ERROR);
1253
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Saving a document is only allowed in the backend', self::$extKey, SYSLOG_SEVERITY_ERROR);
1254 1254
 
1255
-			}
1255
+            }
1256 1256
 
1257
-			return FALSE;
1257
+            return FALSE;
1258 1258
 
1259
-		}
1259
+        }
1260 1260
 
1261
-		// Make sure $pid is a non-negative integer.
1262
-		$pid = max(intval($pid), 0);
1261
+        // Make sure $pid is a non-negative integer.
1262
+        $pid = max(intval($pid), 0);
1263 1263
 
1264
-		// Make sure $core is a non-negative integer.
1265
-		$core = max(intval($core), 0);
1264
+        // Make sure $core is a non-negative integer.
1265
+        $core = max(intval($core), 0);
1266 1266
 
1267
-		// If $pid is not given, try to get it elsewhere.
1268
-		if (!$pid && $this->pid) {
1267
+        // If $pid is not given, try to get it elsewhere.
1268
+        if (!$pid && $this->pid) {
1269 1269
 
1270
-			// Retain current PID.
1271
-			$pid = $this->pid;
1270
+            // Retain current PID.
1271
+            $pid = $this->pid;
1272 1272
 
1273
-		} elseif (!$pid) {
1273
+        } elseif (!$pid) {
1274 1274
 
1275
-			if (TYPO3_DLOG) {
1275
+            if (TYPO3_DLOG) {
1276 1276
 
1277
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Invalid PID "'.$pid.'" for document saving', self::$extKey, SYSLOG_SEVERITY_ERROR);
1277
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Invalid PID "'.$pid.'" for document saving', self::$extKey, SYSLOG_SEVERITY_ERROR);
1278 1278
 
1279
-			}
1279
+            }
1280 1280
 
1281
-			return FALSE;
1281
+            return FALSE;
1282 1282
 
1283
-		}
1283
+        }
1284 1284
 
1285
-		// Set PID for metadata definitions.
1286
-		$this->cPid = $pid;
1285
+        // Set PID for metadata definitions.
1286
+        $this->cPid = $pid;
1287 1287
 
1288
-		// Set UID placeholder if not updating existing record.
1289
-		if ($pid != $this->pid) {
1288
+        // Set UID placeholder if not updating existing record.
1289
+        if ($pid != $this->pid) {
1290 1290
 
1291
-			$this->uid = uniqid('NEW');
1291
+            $this->uid = uniqid('NEW');
1292 1292
 
1293
-		}
1293
+        }
1294 1294
 
1295
-		// Get metadata array.
1296
-		$metadata = $this->getTitledata($pid);
1295
+        // Get metadata array.
1296
+        $metadata = $this->getTitledata($pid);
1297 1297
 
1298
-		// Check for record identifier.
1299
-		if (empty($metadata['record_id'][0])) {
1298
+        // Check for record identifier.
1299
+        if (empty($metadata['record_id'][0])) {
1300 1300
 
1301
-			if (TYPO3_DLOG) {
1301
+            if (TYPO3_DLOG) {
1302 1302
 
1303
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] No record identifier found to avoid duplication', self::$extKey, SYSLOG_SEVERITY_ERROR);
1303
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] No record identifier found to avoid duplication', self::$extKey, SYSLOG_SEVERITY_ERROR);
1304 1304
 
1305
-			}
1305
+            }
1306 1306
 
1307
-			return FALSE;
1307
+            return FALSE;
1308 1308
 
1309
-		}
1309
+        }
1310 1310
 
1311
-		// Load plugin configuration.
1312
-		$conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
1311
+        // Load plugin configuration.
1312
+        $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
1313 1313
 
1314
-		// Get UID for user "_cli_dlf".
1315
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1316
-			'be_users.uid AS uid',
1317
-			'be_users',
1318
-			'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_users').\TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('be_users').\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_users'),
1319
-			'',
1320
-			'',
1321
-			'1'
1322
-		);
1314
+        // Get UID for user "_cli_dlf".
1315
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1316
+            'be_users.uid AS uid',
1317
+            'be_users',
1318
+            'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_users').\TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('be_users').\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_users'),
1319
+            '',
1320
+            '',
1321
+            '1'
1322
+        );
1323 1323
 
1324
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1324
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1325 1325
 
1326
-			list ($be_user) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
1326
+            list ($be_user) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
1327 1327
 
1328
-		} else {
1328
+        } else {
1329 1329
 
1330
-			if (TYPO3_DLOG) {
1330
+            if (TYPO3_DLOG) {
1331 1331
 
1332
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Backend user "_cli_dlf" not found or disabled', self::$extKey, SYSLOG_SEVERITY_ERROR);
1332
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Backend user "_cli_dlf" not found or disabled', self::$extKey, SYSLOG_SEVERITY_ERROR);
1333 1333
 
1334
-			}
1334
+            }
1335 1335
 
1336
-			return FALSE;
1336
+            return FALSE;
1337 1337
 
1338
-		}
1338
+        }
1339 1339
 
1340
-		// Get UID for structure type.
1341
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1342
-			'tx_dlf_structures.uid AS uid',
1343
-			'tx_dlf_structures',
1344
-			'tx_dlf_structures.pid='.intval($pid).' AND tx_dlf_structures.index_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($metadata['type'][0], 'tx_dlf_structures').tx_dlf_helper::whereClause('tx_dlf_structures'),
1345
-			'',
1346
-			'',
1347
-			'1'
1348
-		);
1340
+        // Get UID for structure type.
1341
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1342
+            'tx_dlf_structures.uid AS uid',
1343
+            'tx_dlf_structures',
1344
+            'tx_dlf_structures.pid='.intval($pid).' AND tx_dlf_structures.index_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($metadata['type'][0], 'tx_dlf_structures').tx_dlf_helper::whereClause('tx_dlf_structures'),
1345
+            '',
1346
+            '',
1347
+            '1'
1348
+        );
1349 1349
 
1350
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1350
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1351 1351
 
1352
-			list ($structure) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
1352
+            list ($structure) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
1353 1353
 
1354
-		} else {
1354
+        } else {
1355 1355
 
1356
-			if (TYPO3_DLOG) {
1356
+            if (TYPO3_DLOG) {
1357 1357
 
1358
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Could not identify document/structure type ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($metadata['type'][0], 'tx_dlf_structures'),
1359
-									       self::$extKey, SYSLOG_SEVERITY_ERROR);
1358
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Could not identify document/structure type ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($metadata['type'][0], 'tx_dlf_structures'),
1359
+                                            self::$extKey, SYSLOG_SEVERITY_ERROR);
1360 1360
 
1361
-			}
1361
+            }
1362 1362
 
1363
-			return FALSE;
1363
+            return FALSE;
1364 1364
 
1365
-		}
1365
+        }
1366 1366
 
1367
-		$metadata['type'][0] = $structure;
1367
+        $metadata['type'][0] = $structure;
1368 1368
 
1369
-		// Get UIDs for collections.
1370
-		$collections = array ();
1369
+        // Get UIDs for collections.
1370
+        $collections = array ();
1371 1371
 
1372
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1373
-			'tx_dlf_collections.index_name AS index_name,tx_dlf_collections.uid AS uid',
1374
-			'tx_dlf_collections',
1375
-			'tx_dlf_collections.pid='.intval($pid).' AND tx_dlf_collections.cruser_id='.intval($be_user).' AND tx_dlf_collections.fe_cruser_id=0'.tx_dlf_helper::whereClause('tx_dlf_collections'),
1376
-			'',
1377
-			'',
1378
-			''
1379
-		);
1372
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1373
+            'tx_dlf_collections.index_name AS index_name,tx_dlf_collections.uid AS uid',
1374
+            'tx_dlf_collections',
1375
+            'tx_dlf_collections.pid='.intval($pid).' AND tx_dlf_collections.cruser_id='.intval($be_user).' AND tx_dlf_collections.fe_cruser_id=0'.tx_dlf_helper::whereClause('tx_dlf_collections'),
1376
+            '',
1377
+            '',
1378
+            ''
1379
+        );
1380 1380
 
1381
-		for ($i = 0, $j = $GLOBALS['TYPO3_DB']->sql_num_rows($result); $i < $j; $i++) {
1381
+        for ($i = 0, $j = $GLOBALS['TYPO3_DB']->sql_num_rows($result); $i < $j; $i++) {
1382 1382
 
1383
-			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
1383
+            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
1384 1384
 
1385
-			$collUid[$resArray['index_name']] = $resArray['uid'];
1385
+            $collUid[$resArray['index_name']] = $resArray['uid'];
1386 1386
 
1387
-		}
1387
+        }
1388 1388
 
1389
-		foreach ($metadata['collection'] as $collection) {
1389
+        foreach ($metadata['collection'] as $collection) {
1390 1390
 
1391
-			if (!empty($collUid[$collection])) {
1391
+            if (!empty($collUid[$collection])) {
1392 1392
 
1393
-				// Add existing collection's UID.
1394
-				$collections[] = $collUid[$collection];
1393
+                // Add existing collection's UID.
1394
+                $collections[] = $collUid[$collection];
1395 1395
 
1396
-			} else {
1396
+            } else {
1397 1397
 
1398
-				// Insert new collection.
1399
-				$collNewUid = uniqid('NEW');
1398
+                // Insert new collection.
1399
+                $collNewUid = uniqid('NEW');
1400 1400
 
1401
-				$collData['tx_dlf_collections'][$collNewUid] = array (
1402
-					'pid' => $pid,
1403
-					'label' => $collection,
1404
-					'index_name' => $collection,
1405
-					'oai_name' => (!empty($conf['publishNewCollections']) ? $collection : ''),
1406
-					'description' => '',
1407
-					'documents' => 0,
1408
-					'owner' => 0,
1409
-					'status' => 0,
1410
-				);
1401
+                $collData['tx_dlf_collections'][$collNewUid] = array (
1402
+                    'pid' => $pid,
1403
+                    'label' => $collection,
1404
+                    'index_name' => $collection,
1405
+                    'oai_name' => (!empty($conf['publishNewCollections']) ? $collection : ''),
1406
+                    'description' => '',
1407
+                    'documents' => 0,
1408
+                    'owner' => 0,
1409
+                    'status' => 0,
1410
+                );
1411 1411
 
1412
-				$substUid = tx_dlf_helper::processDB($collData);
1412
+                $substUid = tx_dlf_helper::processDB($collData);
1413 1413
 
1414
-				// Prevent double insertion.
1415
-				unset ($collData);
1414
+                // Prevent double insertion.
1415
+                unset ($collData);
1416 1416
 
1417
-				// Add new collection's UID.
1418
-				$collections[] = $substUid[$collNewUid];
1417
+                // Add new collection's UID.
1418
+                $collections[] = $substUid[$collNewUid];
1419 1419
 
1420
-				if (!defined('TYPO3_cliMode')) {
1420
+                if (!defined('TYPO3_cliMode')) {
1421 1421
 
1422
-					$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1423
-						'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
1424
-						htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.newCollection'), $collection, $substUid[$collNewUid])),
1425
-						tx_dlf_helper::getLL('flash.attention', TRUE),
1426
-						\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
1427
-						TRUE
1428
-					);
1422
+                    $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1423
+                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
1424
+                        htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.newCollection'), $collection, $substUid[$collNewUid])),
1425
+                        tx_dlf_helper::getLL('flash.attention', TRUE),
1426
+                        \TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
1427
+                        TRUE
1428
+                    );
1429 1429
 
1430
-					tx_dlf_helper::addMessage($message);
1430
+                    tx_dlf_helper::addMessage($message);
1431 1431
 
1432
-				}
1432
+                }
1433 1433
 
1434
-			}
1434
+            }
1435 1435
 
1436
-		}
1436
+        }
1437 1437
 
1438
-		// Preserve user-defined collections.
1439
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
1440
-			'tx_dlf_collections.uid AS uid',
1441
-			'tx_dlf_documents',
1442
-			'tx_dlf_relations',
1443
-			'tx_dlf_collections',
1444
-			'AND tx_dlf_documents.pid='.intval($pid).' AND tx_dlf_collections.pid='.intval($pid).' AND tx_dlf_documents.uid='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->uid, 'tx_dlf_documents').' AND NOT (tx_dlf_collections.cruser_id='.intval($be_user).' AND tx_dlf_collections.fe_cruser_id=0) AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations'),
1445
-			'',
1446
-			'',
1447
-			''
1448
-		);
1438
+        // Preserve user-defined collections.
1439
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
1440
+            'tx_dlf_collections.uid AS uid',
1441
+            'tx_dlf_documents',
1442
+            'tx_dlf_relations',
1443
+            'tx_dlf_collections',
1444
+            'AND tx_dlf_documents.pid='.intval($pid).' AND tx_dlf_collections.pid='.intval($pid).' AND tx_dlf_documents.uid='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->uid, 'tx_dlf_documents').' AND NOT (tx_dlf_collections.cruser_id='.intval($be_user).' AND tx_dlf_collections.fe_cruser_id=0) AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations'),
1445
+            '',
1446
+            '',
1447
+            ''
1448
+        );
1449 1449
 
1450
-		for ($i = 0, $j = $GLOBALS['TYPO3_DB']->sql_num_rows($result); $i < $j; $i++) {
1450
+        for ($i = 0, $j = $GLOBALS['TYPO3_DB']->sql_num_rows($result); $i < $j; $i++) {
1451 1451
 
1452
-			list ($collections[]) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
1452
+            list ($collections[]) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
1453 1453
 
1454
-		}
1454
+        }
1455 1455
 
1456
-		$metadata['collection'] = $collections;
1456
+        $metadata['collection'] = $collections;
1457 1457
 
1458
-		// Get UID for owner.
1459
-		$owner = !empty($metadata['owner'][0]) ? $metadata['owner'][0] : 'default';
1458
+        // Get UID for owner.
1459
+        $owner = !empty($metadata['owner'][0]) ? $metadata['owner'][0] : 'default';
1460 1460
 
1461
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1462
-			'tx_dlf_libraries.uid AS uid',
1463
-			'tx_dlf_libraries',
1464
-			'tx_dlf_libraries.pid='.intval($pid).' AND tx_dlf_libraries.index_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($owner, 'tx_dlf_libraries').tx_dlf_helper::whereClause('tx_dlf_libraries'),
1465
-			'',
1466
-			'',
1467
-			'1'
1468
-		);
1461
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1462
+            'tx_dlf_libraries.uid AS uid',
1463
+            'tx_dlf_libraries',
1464
+            'tx_dlf_libraries.pid='.intval($pid).' AND tx_dlf_libraries.index_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($owner, 'tx_dlf_libraries').tx_dlf_helper::whereClause('tx_dlf_libraries'),
1465
+            '',
1466
+            '',
1467
+            '1'
1468
+        );
1469 1469
 
1470
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1470
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1471 1471
 
1472
-			list ($ownerUid) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
1472
+            list ($ownerUid) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
1473 1473
 
1474
-		} else {
1474
+        } else {
1475 1475
 
1476
-			// Insert new library.
1477
-			$libNewUid = uniqid('NEW');
1476
+            // Insert new library.
1477
+            $libNewUid = uniqid('NEW');
1478 1478
 
1479
-			$libData['tx_dlf_libraries'][$libNewUid] = array (
1480
-				'pid' => $pid,
1481
-				'label' => $owner,
1482
-				'index_name' => $owner,
1483
-				'website' => '',
1484
-				'contact' => '',
1485
-				'image' => '',
1486
-				'oai_label' => '',
1487
-				'oai_base' => '',
1488
-				'opac_label' => '',
1489
-				'opac_base' => '',
1490
-				'union_label' => '',
1491
-				'union_base' => '',
1492
-			);
1479
+            $libData['tx_dlf_libraries'][$libNewUid] = array (
1480
+                'pid' => $pid,
1481
+                'label' => $owner,
1482
+                'index_name' => $owner,
1483
+                'website' => '',
1484
+                'contact' => '',
1485
+                'image' => '',
1486
+                'oai_label' => '',
1487
+                'oai_base' => '',
1488
+                'opac_label' => '',
1489
+                'opac_base' => '',
1490
+                'union_label' => '',
1491
+                'union_base' => '',
1492
+            );
1493 1493
 
1494
-			$substUid = tx_dlf_helper::processDB($libData);
1494
+            $substUid = tx_dlf_helper::processDB($libData);
1495 1495
 
1496
-			// Add new library's UID.
1497
-			$ownerUid = $substUid[$libNewUid];
1496
+            // Add new library's UID.
1497
+            $ownerUid = $substUid[$libNewUid];
1498 1498
 
1499
-			if (!defined('TYPO3_cliMode')) {
1499
+            if (!defined('TYPO3_cliMode')) {
1500 1500
 
1501
-				$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1502
-					'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
1503
-					htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.newLibrary'), $owner, $ownerUid)),
1504
-					tx_dlf_helper::getLL('flash.attention', TRUE),
1505
-					\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
1506
-					TRUE
1507
-				);
1501
+                $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1502
+                    'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
1503
+                    htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.newLibrary'), $owner, $ownerUid)),
1504
+                    tx_dlf_helper::getLL('flash.attention', TRUE),
1505
+                    \TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
1506
+                    TRUE
1507
+                );
1508 1508
 
1509
-				tx_dlf_helper::addMessage($message);
1509
+                tx_dlf_helper::addMessage($message);
1510 1510
 
1511
-			}
1511
+            }
1512 1512
 
1513
-		}
1513
+        }
1514 1514
 
1515
-		$metadata['owner'][0] = $ownerUid;
1515
+        $metadata['owner'][0] = $ownerUid;
1516 1516
 
1517
-		// Get UID of parent document.
1518
-		$partof = 0;
1517
+        // Get UID of parent document.
1518
+        $partof = 0;
1519 1519
 
1520
-		// Get the closest ancestor of the current document which has a MPTR child.
1521
-		$parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->_getToplevelId().'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr');
1520
+        // Get the closest ancestor of the current document which has a MPTR child.
1521
+        $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->_getToplevelId().'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr');
1522 1522
 
1523
-		if (!empty($parentMptr[0])) {
1523
+        if (!empty($parentMptr[0])) {
1524 1524
 
1525
-			$parentLocation = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href;
1525
+            $parentLocation = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href;
1526 1526
 
1527
-			if ($parentLocation != $this->location) {
1527
+            if ($parentLocation != $this->location) {
1528 1528
 
1529
-				$parentDoc =& tx_dlf_document::getInstance($parentLocation, $pid);
1529
+                $parentDoc =& tx_dlf_document::getInstance($parentLocation, $pid);
1530 1530
 
1531
-				if ($parentDoc->ready) {
1531
+                if ($parentDoc->ready) {
1532 1532
 
1533
-					if ($parentDoc->pid != $pid) {
1533
+                    if ($parentDoc->pid != $pid) {
1534 1534
 
1535
-						$parentDoc->save($pid, $core);
1535
+                        $parentDoc->save($pid, $core);
1536 1536
 
1537
-					}
1537
+                    }
1538 1538
 
1539
-					$partof = $parentDoc->uid;
1539
+                    $partof = $parentDoc->uid;
1540 1540
 
1541
-				}
1541
+                }
1542 1542
 
1543
-			}
1543
+            }
1544 1544
 
1545
-		}
1545
+        }
1546 1546
 
1547
-		// Use the date of publication or title as alternative sorting metric for parts of multi-part works.
1548
-		if (!empty($partof)) {
1547
+        // Use the date of publication or title as alternative sorting metric for parts of multi-part works.
1548
+        if (!empty($partof)) {
1549 1549
 
1550
-			if (empty($metadata['volume'][0]) && !empty($metadata['year'][0])) {
1550
+            if (empty($metadata['volume'][0]) && !empty($metadata['year'][0])) {
1551 1551
 
1552
-				$metadata['volume'] = $metadata['year'];
1552
+                $metadata['volume'] = $metadata['year'];
1553 1553
 
1554
-			}
1554
+            }
1555 1555
 
1556
-			if (empty($metadata['volume_sorting'][0])) {
1556
+            if (empty($metadata['volume_sorting'][0])) {
1557 1557
 
1558
-				if (!empty($metadata['year_sorting'][0])) {
1558
+                if (!empty($metadata['year_sorting'][0])) {
1559 1559
 
1560
-					$metadata['volume_sorting'][0] = $metadata['year_sorting'][0];
1560
+                    $metadata['volume_sorting'][0] = $metadata['year_sorting'][0];
1561 1561
 
1562
-				} elseif (!empty($metadata['year'][0])) {
1562
+                } elseif (!empty($metadata['year'][0])) {
1563 1563
 
1564
-					$metadata['volume_sorting'][0] = $metadata['year'][0];
1564
+                    $metadata['volume_sorting'][0] = $metadata['year'][0];
1565 1565
 
1566
-				}
1566
+                }
1567 1567
 
1568
-			}
1568
+            }
1569 1569
 
1570
-			// If volume_sorting is still empty, try to use title_sorting finally (workaround for newspapers)
1571
-			if (empty($metadata['volume_sorting'][0])) {
1570
+            // If volume_sorting is still empty, try to use title_sorting finally (workaround for newspapers)
1571
+            if (empty($metadata['volume_sorting'][0])) {
1572 1572
 
1573
-				if (!empty($metadata['title_sorting'][0])) {
1573
+                if (!empty($metadata['title_sorting'][0])) {
1574 1574
 
1575
-					$metadata['volume_sorting'][0] = $metadata['title_sorting'][0];
1575
+                    $metadata['volume_sorting'][0] = $metadata['title_sorting'][0];
1576 1576
 
1577
-				}
1578
-			}
1577
+                }
1578
+            }
1579 1579
 
1580
-		}
1580
+        }
1581 1581
 
1582
-		// Get metadata for lists and sorting.
1583
-		$listed = array ();
1582
+        // Get metadata for lists and sorting.
1583
+        $listed = array ();
1584 1584
 
1585
-		$sortable = array ();
1585
+        $sortable = array ();
1586 1586
 
1587
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1588
-			'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.is_sortable AS is_sortable',
1589
-			'tx_dlf_metadata',
1590
-			'(tx_dlf_metadata.is_listed=1 OR tx_dlf_metadata.is_sortable=1) AND tx_dlf_metadata.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_metadata'),
1591
-			'',
1592
-			'',
1593
-			''
1594
-		);
1587
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1588
+            'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.is_sortable AS is_sortable',
1589
+            'tx_dlf_metadata',
1590
+            '(tx_dlf_metadata.is_listed=1 OR tx_dlf_metadata.is_sortable=1) AND tx_dlf_metadata.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_metadata'),
1591
+            '',
1592
+            '',
1593
+            ''
1594
+        );
1595 1595
 
1596
-		while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1596
+        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1597 1597
 
1598
-			if (!empty($metadata[$resArray['index_name']])) {
1598
+            if (!empty($metadata[$resArray['index_name']])) {
1599 1599
 
1600
-				if ($resArray['is_listed']) {
1600
+                if ($resArray['is_listed']) {
1601 1601
 
1602
-					$listed[$resArray['index_name']] = $metadata[$resArray['index_name']];
1602
+                    $listed[$resArray['index_name']] = $metadata[$resArray['index_name']];
1603 1603
 
1604
-				}
1604
+                }
1605 1605
 
1606
-				if ($resArray['is_sortable']) {
1606
+                if ($resArray['is_sortable']) {
1607 1607
 
1608
-					$sortable[$resArray['index_name']] = $metadata[$resArray['index_name']][0];
1608
+                    $sortable[$resArray['index_name']] = $metadata[$resArray['index_name']][0];
1609 1609
 
1610
-				}
1610
+                }
1611 1611
 
1612
-			}
1612
+            }
1613 1613
 
1614
-		}
1614
+        }
1615 1615
 
1616
-		// Fill data array.
1617
-		$data['tx_dlf_documents'][$this->uid] = array (
1618
-			'pid' => $pid,
1619
-			$GLOBALS['TCA']['tx_dlf_documents']['ctrl']['enablecolumns']['starttime'] => 0,
1620
-			$GLOBALS['TCA']['tx_dlf_documents']['ctrl']['enablecolumns']['endtime'] => 0,
1621
-			'prod_id' => $metadata['prod_id'][0],
1622
-			'location' => $this->location,
1623
-			'record_id' => $metadata['record_id'][0],
1624
-			'opac_id' => $metadata['opac_id'][0],
1625
-			'union_id' => $metadata['union_id'][0],
1626
-			'urn' => $metadata['urn'][0],
1627
-			'purl' => $metadata['purl'][0],
1628
-			'title' => $metadata['title'][0],
1629
-			'title_sorting' => $metadata['title_sorting'][0],
1630
-			'author' => implode('; ', $metadata['author']),
1631
-			'year' => implode('; ', $metadata['year']),
1632
-			'place' => implode('; ', $metadata['place']),
1633
-			'thumbnail' => $this->_getThumbnail(TRUE),
1634
-			'metadata' => serialize($listed),
1635
-			'metadata_sorting' => serialize($sortable),
1636
-			'structure' => $metadata['type'][0],
1637
-			'partof' => $partof,
1638
-			'volume' => $metadata['volume'][0],
1639
-			'volume_sorting' => $metadata['volume_sorting'][0],
1640
-			'collections' => $metadata['collection'],
1641
-			'owner' => $metadata['owner'][0],
1642
-			'solrcore' => $core,
1643
-			'status' => 0,
1644
-		);
1616
+        // Fill data array.
1617
+        $data['tx_dlf_documents'][$this->uid] = array (
1618
+            'pid' => $pid,
1619
+            $GLOBALS['TCA']['tx_dlf_documents']['ctrl']['enablecolumns']['starttime'] => 0,
1620
+            $GLOBALS['TCA']['tx_dlf_documents']['ctrl']['enablecolumns']['endtime'] => 0,
1621
+            'prod_id' => $metadata['prod_id'][0],
1622
+            'location' => $this->location,
1623
+            'record_id' => $metadata['record_id'][0],
1624
+            'opac_id' => $metadata['opac_id'][0],
1625
+            'union_id' => $metadata['union_id'][0],
1626
+            'urn' => $metadata['urn'][0],
1627
+            'purl' => $metadata['purl'][0],
1628
+            'title' => $metadata['title'][0],
1629
+            'title_sorting' => $metadata['title_sorting'][0],
1630
+            'author' => implode('; ', $metadata['author']),
1631
+            'year' => implode('; ', $metadata['year']),
1632
+            'place' => implode('; ', $metadata['place']),
1633
+            'thumbnail' => $this->_getThumbnail(TRUE),
1634
+            'metadata' => serialize($listed),
1635
+            'metadata_sorting' => serialize($sortable),
1636
+            'structure' => $metadata['type'][0],
1637
+            'partof' => $partof,
1638
+            'volume' => $metadata['volume'][0],
1639
+            'volume_sorting' => $metadata['volume_sorting'][0],
1640
+            'collections' => $metadata['collection'],
1641
+            'owner' => $metadata['owner'][0],
1642
+            'solrcore' => $core,
1643
+            'status' => 0,
1644
+        );
1645 1645
 
1646
-		// Unhide hidden documents.
1647
-		if (!empty($conf['unhideOnIndex'])) {
1646
+        // Unhide hidden documents.
1647
+        if (!empty($conf['unhideOnIndex'])) {
1648 1648
 
1649
-			$data['tx_dlf_documents'][$this->uid][$GLOBALS['TCA']['tx_dlf_documents']['ctrl']['enablecolumns']['disabled']] = 0;
1649
+            $data['tx_dlf_documents'][$this->uid][$GLOBALS['TCA']['tx_dlf_documents']['ctrl']['enablecolumns']['disabled']] = 0;
1650 1650
 
1651
-		}
1651
+        }
1652 1652
 
1653
-		// Process data.
1654
-		$newIds = tx_dlf_helper::processDB($data);
1653
+        // Process data.
1654
+        $newIds = tx_dlf_helper::processDB($data);
1655 1655
 
1656
-		// Replace placeholder with actual UID.
1657
-		if (strpos($this->uid, 'NEW') === 0) {
1656
+        // Replace placeholder with actual UID.
1657
+        if (strpos($this->uid, 'NEW') === 0) {
1658 1658
 
1659
-			$this->uid = $newIds[$this->uid];
1659
+            $this->uid = $newIds[$this->uid];
1660 1660
 
1661
-			$this->pid = $pid;
1661
+            $this->pid = $pid;
1662 1662
 
1663
-			$this->parentId = $partof;
1663
+            $this->parentId = $partof;
1664 1664
 
1665
-		}
1665
+        }
1666 1666
 
1667
-		if (!defined('TYPO3_cliMode')) {
1667
+        if (!defined('TYPO3_cliMode')) {
1668 1668
 
1669
-			$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1670
-				'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
1671
-				htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentSaved'), $metadata['title'][0], $this->uid)),
1672
-				tx_dlf_helper::getLL('flash.done', TRUE),
1673
-				\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
1674
-				TRUE
1675
-			);
1669
+            $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1670
+                'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
1671
+                htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentSaved'), $metadata['title'][0], $this->uid)),
1672
+                tx_dlf_helper::getLL('flash.done', TRUE),
1673
+                \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
1674
+                TRUE
1675
+            );
1676 1676
 
1677
-			tx_dlf_helper::addMessage($message);
1677
+            tx_dlf_helper::addMessage($message);
1678 1678
 
1679
-		}
1679
+        }
1680 1680
 
1681
-		// Add document to index.
1682
-		if ($core) {
1681
+        // Add document to index.
1682
+        if ($core) {
1683 1683
 
1684
-			tx_dlf_indexing::add($this, $core);
1684
+            tx_dlf_indexing::add($this, $core);
1685 1685
 
1686
-		} else {
1686
+        } else {
1687 1687
 
1688
-			if (TYPO3_DLOG) {
1688
+            if (TYPO3_DLOG) {
1689 1689
 
1690
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Invalid UID "'.$core.'" for Solr core', self::$extKey, SYSLOG_SEVERITY_NOTICE);
1690
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Invalid UID "'.$core.'" for Solr core', self::$extKey, SYSLOG_SEVERITY_NOTICE);
1691 1691
 
1692
-			}
1692
+            }
1693 1693
 
1694
-		}
1694
+        }
1695 1695
 
1696
-		return TRUE;
1696
+        return TRUE;
1697 1697
 
1698
-	}
1698
+    }
1699 1699
 
1700
-	/**
1701
-	 * This returns $this->cPid via __get()
1702
-	 *
1703
-	 * @access	protected
1704
-	 *
1705
-	 * @return	integer		The PID of the metadata definitions
1706
-	 */
1707
-	protected function _getCPid() {
1700
+    /**
1701
+     * This returns $this->cPid via __get()
1702
+     *
1703
+     * @access	protected
1704
+     *
1705
+     * @return	integer		The PID of the metadata definitions
1706
+     */
1707
+    protected function _getCPid() {
1708 1708
 
1709
-		return $this->cPid;
1709
+        return $this->cPid;
1710 1710
 
1711
-	}
1711
+    }
1712 1712
 
1713
-	/**
1714
-	 * This builds an array of the document's dmdSecs
1715
-	 *
1716
-	 * @access	protected
1717
-	 *
1718
-	 * @return	array		Array of dmdSecs with their IDs as array key
1719
-	 */
1720
-	protected function _getDmdSec() {
1713
+    /**
1714
+     * This builds an array of the document's dmdSecs
1715
+     *
1716
+     * @access	protected
1717
+     *
1718
+     * @return	array		Array of dmdSecs with their IDs as array key
1719
+     */
1720
+    protected function _getDmdSec() {
1721 1721
 
1722
-		if (!$this->dmdSecLoaded) {
1722
+        if (!$this->dmdSecLoaded) {
1723 1723
 
1724
-			// Get available data formats.
1725
-			$this->loadFormats();
1724
+            // Get available data formats.
1725
+            $this->loadFormats();
1726 1726
 
1727
-			// Get dmdSec nodes from METS.
1728
-			$dmdIds = $this->mets->xpath('./mets:dmdSec/@ID');
1727
+            // Get dmdSec nodes from METS.
1728
+            $dmdIds = $this->mets->xpath('./mets:dmdSec/@ID');
1729 1729
 
1730
-			foreach ($dmdIds as $dmdId) {
1730
+            foreach ($dmdIds as $dmdId) {
1731 1731
 
1732
-				if ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) {
1732
+                if ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) {
1733 1733
 
1734
-					if (!empty($this->formats[(string) $type[0]])) {
1734
+                    if (!empty($this->formats[(string) $type[0]])) {
1735 1735
 
1736
-						$type = (string) $type[0];
1736
+                        $type = (string) $type[0];
1737 1737
 
1738
-						$xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']);
1738
+                        $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']);
1739 1739
 
1740
-					}
1740
+                    }
1741 1741
 
1742
-				} elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) {
1742
+                } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) {
1743 1743
 
1744
-					if (!empty($this->formats[(string) $type[0]])) {
1744
+                    if (!empty($this->formats[(string) $type[0]])) {
1745 1745
 
1746
-						$type = (string) $type[0];
1746
+                        $type = (string) $type[0];
1747 1747
 
1748
-						$xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']);
1748
+                        $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']);
1749 1749
 
1750
-					}
1750
+                    }
1751 1751
 
1752
-				}
1752
+                }
1753 1753
 
1754
-				if ($xml) {
1754
+                if ($xml) {
1755 1755
 
1756
-					$this->dmdSec[(string) $dmdId]['type'] = $type;
1756
+                    $this->dmdSec[(string) $dmdId]['type'] = $type;
1757 1757
 
1758
-					$this->dmdSec[(string) $dmdId]['xml'] = $xml[0];
1758
+                    $this->dmdSec[(string) $dmdId]['xml'] = $xml[0];
1759 1759
 
1760
-					$this->registerNamespaces($this->dmdSec[(string) $dmdId]['xml']);
1760
+                    $this->registerNamespaces($this->dmdSec[(string) $dmdId]['xml']);
1761 1761
 
1762
-				}
1762
+                }
1763 1763
 
1764
-			}
1764
+            }
1765 1765
 
1766
-			$this->dmdSecLoaded = TRUE;
1766
+            $this->dmdSecLoaded = TRUE;
1767 1767
 
1768
-		}
1768
+        }
1769 1769
 
1770
-		return $this->dmdSec;
1770
+        return $this->dmdSec;
1771 1771
 
1772
-	}
1772
+    }
1773 1773
 
1774
-	/**
1775
-	 * This builds the file ID -> USE concordance
1776
-	 *
1777
-	 * @access	protected
1778
-	 *
1779
-	 * @return	array		Array of file use groups with file IDs
1780
-	 */
1781
-	protected function _getFileGrps() {
1774
+    /**
1775
+     * This builds the file ID -> USE concordance
1776
+     *
1777
+     * @access	protected
1778
+     *
1779
+     * @return	array		Array of file use groups with file IDs
1780
+     */
1781
+    protected function _getFileGrps() {
1782 1782
 
1783
-		if (!$this->fileGrpsLoaded) {
1783
+        if (!$this->fileGrpsLoaded) {
1784 1784
 
1785
-			// Get configured USE attributes.
1786
-			$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
1785
+            // Get configured USE attributes.
1786
+            $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
1787 1787
 
1788
-			$useGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $extConf['fileGrps']);
1788
+            $useGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $extConf['fileGrps']);
1789 1789
 
1790
-			if (!empty($extConf['fileGrpThumbs'])) {
1790
+            if (!empty($extConf['fileGrpThumbs'])) {
1791 1791
 
1792
-				$useGrps[] = $extConf['fileGrpThumbs'];
1792
+                $useGrps[] = $extConf['fileGrpThumbs'];
1793 1793
 
1794
-			}
1794
+            }
1795 1795
 
1796
-			if (!empty($extConf['fileGrpDownload'])) {
1796
+            if (!empty($extConf['fileGrpDownload'])) {
1797 1797
 
1798
-				$useGrps[] = $extConf['fileGrpDownload'];
1798
+                $useGrps[] = $extConf['fileGrpDownload'];
1799 1799
 
1800
-			}
1800
+            }
1801 1801
 
1802
-			if (!empty($extConf['fileGrpFulltext'])) {
1802
+            if (!empty($extConf['fileGrpFulltext'])) {
1803 1803
 
1804
-				$useGrps[] = $extConf['fileGrpFulltext'];
1804
+                $useGrps[] = $extConf['fileGrpFulltext'];
1805 1805
 
1806
-			}
1806
+            }
1807 1807
 
1808
-			if (!empty($extConf['fileGrpAudio'])) {
1808
+            if (!empty($extConf['fileGrpAudio'])) {
1809 1809
 
1810
-				$useGrps[] = $extConf['fileGrpAudio'];
1810
+                $useGrps[] = $extConf['fileGrpAudio'];
1811 1811
 
1812
-			}
1812
+            }
1813 1813
 
1814
-			// Get all file groups.
1815
-			$fileGrps = $this->mets->xpath('./mets:fileSec/mets:fileGrp');
1814
+            // Get all file groups.
1815
+            $fileGrps = $this->mets->xpath('./mets:fileSec/mets:fileGrp');
1816 1816
 
1817
-			// Build concordance for configured USE attributes.
1818
-			foreach ($fileGrps as $fileGrp) {
1817
+            // Build concordance for configured USE attributes.
1818
+            foreach ($fileGrps as $fileGrp) {
1819 1819
 
1820
-				if (in_array((string) $fileGrp['USE'], $useGrps)) {
1820
+                if (in_array((string) $fileGrp['USE'], $useGrps)) {
1821 1821
 
1822
-					foreach ($fileGrp->children('http://www.loc.gov/METS/')->file as $file) {
1822
+                    foreach ($fileGrp->children('http://www.loc.gov/METS/')->file as $file) {
1823 1823
 
1824
-						$this->fileGrps[(string) $file->attributes()->ID] = (string) $fileGrp['USE'];
1824
+                        $this->fileGrps[(string) $file->attributes()->ID] = (string) $fileGrp['USE'];
1825 1825
 
1826
-					}
1826
+                    }
1827 1827
 
1828
-				}
1828
+                }
1829 1829
 
1830
-			}
1830
+            }
1831 1831
 
1832
-			// Are there any fulltext files available?
1833
-			if (!empty($extConf['fileGrpFulltext']) && in_array($extConf['fileGrpFulltext'], $this->fileGrps)) {
1832
+            // Are there any fulltext files available?
1833
+            if (!empty($extConf['fileGrpFulltext']) && in_array($extConf['fileGrpFulltext'], $this->fileGrps)) {
1834 1834
 
1835
-				$this->hasFulltext = TRUE;
1835
+                $this->hasFulltext = TRUE;
1836 1836
 
1837
-			}
1837
+            }
1838 1838
 
1839
-			$this->fileGrpsLoaded = TRUE;
1839
+            $this->fileGrpsLoaded = TRUE;
1840 1840
 
1841
-		}
1841
+        }
1842 1842
 
1843
-		return $this->fileGrps;
1843
+        return $this->fileGrps;
1844 1844
 
1845
-	}
1845
+    }
1846 1846
 
1847
-	/**
1848
-	 * This returns $this->hasFulltext via __get()
1849
-	 *
1850
-	 * @access	protected
1851
-	 *
1852
-	 * @return	boolean		Are there any fulltext files available?
1853
-	 */
1854
-	protected function _getHasFulltext() {
1847
+    /**
1848
+     * This returns $this->hasFulltext via __get()
1849
+     *
1850
+     * @access	protected
1851
+     *
1852
+     * @return	boolean		Are there any fulltext files available?
1853
+     */
1854
+    protected function _getHasFulltext() {
1855 1855
 
1856
-		// Are the fileGrps already loaded?
1857
-		if (!$this->fileGrpsLoaded) {
1856
+        // Are the fileGrps already loaded?
1857
+        if (!$this->fileGrpsLoaded) {
1858 1858
 
1859
-			$this->_getFileGrps();
1859
+            $this->_getFileGrps();
1860 1860
 
1861
-		}
1861
+        }
1862 1862
 
1863
-		return $this->hasFulltext;
1863
+        return $this->hasFulltext;
1864 1864
 
1865
-	}
1865
+    }
1866 1866
 
1867
-	/**
1868
-	 * This returns $this->location via __get()
1869
-	 *
1870
-	 * @access	protected
1871
-	 *
1872
-	 * @return	string		The location of the document
1873
-	 */
1874
-	protected function _getLocation() {
1867
+    /**
1868
+     * This returns $this->location via __get()
1869
+     *
1870
+     * @access	protected
1871
+     *
1872
+     * @return	string		The location of the document
1873
+     */
1874
+    protected function _getLocation() {
1875 1875
 
1876
-		return $this->location;
1876
+        return $this->location;
1877 1877
 
1878
-	}
1878
+    }
1879 1879
 
1880
-	/**
1881
-	 * This builds an array of the document's metadata
1882
-	 *
1883
-	 * @access	protected
1884
-	 *
1885
-	 * @return	array		Array of metadata with their corresponding logical structure node ID as key
1886
-	 */
1887
-	protected function _getMetadataArray() {
1880
+    /**
1881
+     * This builds an array of the document's metadata
1882
+     *
1883
+     * @access	protected
1884
+     *
1885
+     * @return	array		Array of metadata with their corresponding logical structure node ID as key
1886
+     */
1887
+    protected function _getMetadataArray() {
1888 1888
 
1889
-		// Set metadata definitions' PID.
1890
-		$cPid = ($this->cPid ? $this->cPid : $this->pid);
1889
+        // Set metadata definitions' PID.
1890
+        $cPid = ($this->cPid ? $this->cPid : $this->pid);
1891 1891
 
1892
-		if (!$cPid) {
1892
+        if (!$cPid) {
1893 1893
 
1894
-			if (TYPO3_DLOG) {
1894
+            if (TYPO3_DLOG) {
1895 1895
 
1896
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getMetadataArray()] Invalid PID "'.$cPid.'" for metadata definitions', self::$extKey, SYSLOG_SEVERITY_ERROR);
1896
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getMetadataArray()] Invalid PID "'.$cPid.'" for metadata definitions', self::$extKey, SYSLOG_SEVERITY_ERROR);
1897 1897
 
1898
-			}
1898
+            }
1899 1899
 
1900
-			return array ();
1900
+            return array ();
1901 1901
 
1902
-		}
1902
+        }
1903 1903
 
1904
-		if (!$this->metadataArrayLoaded || $this->metadataArray[0] != $cPid) {
1904
+        if (!$this->metadataArrayLoaded || $this->metadataArray[0] != $cPid) {
1905 1905
 
1906
-			// Get all logical structure nodes with metadata.
1907
-			if (($ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'))) {
1906
+            // Get all logical structure nodes with metadata.
1907
+            if (($ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'))) {
1908 1908
 
1909
-				foreach ($ids as $id) {
1909
+                foreach ($ids as $id) {
1910 1910
 
1911
-					$this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid);
1911
+                    $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid);
1912 1912
 
1913
-				}
1913
+                }
1914 1914
 
1915
-			}
1915
+            }
1916 1916
 
1917
-			// Set current PID for metadata definitions.
1918
-			$this->metadataArray[0] = $cPid;
1917
+            // Set current PID for metadata definitions.
1918
+            $this->metadataArray[0] = $cPid;
1919 1919
 
1920
-			$this->metadataArrayLoaded = TRUE;
1920
+            $this->metadataArrayLoaded = TRUE;
1921 1921
 
1922
-		}
1922
+        }
1923 1923
 
1924
-		return $this->metadataArray;
1924
+        return $this->metadataArray;
1925 1925
 
1926
-	}
1926
+    }
1927 1927
 
1928
-	/**
1929
-	 * This returns $this->mets via __get()
1930
-	 *
1931
-	 * @access	protected
1932
-	 *
1933
-	 * @return	SimpleXMLElement		The XML's METS part as SimpleXMLElement object
1934
-	 */
1935
-	protected function _getMets() {
1928
+    /**
1929
+     * This returns $this->mets via __get()
1930
+     *
1931
+     * @access	protected
1932
+     *
1933
+     * @return	SimpleXMLElement		The XML's METS part as SimpleXMLElement object
1934
+     */
1935
+    protected function _getMets() {
1936 1936
 
1937
-		return $this->mets;
1937
+        return $this->mets;
1938 1938
 
1939
-	}
1939
+    }
1940 1940
 
1941
-	/**
1942
-	 * This returns $this->numPages via __get()
1943
-	 *
1944
-	 * @access	protected
1945
-	 *
1946
-	 * @return	integer		The total number of pages and/or tracks
1947
-	 */
1948
-	protected function _getNumPages() {
1941
+    /**
1942
+     * This returns $this->numPages via __get()
1943
+     *
1944
+     * @access	protected
1945
+     *
1946
+     * @return	integer		The total number of pages and/or tracks
1947
+     */
1948
+    protected function _getNumPages() {
1949 1949
 
1950
-		$this->_getPhysicalStructure();
1950
+        $this->_getPhysicalStructure();
1951 1951
 
1952
-		return $this->numPages;
1952
+        return $this->numPages;
1953 1953
 
1954
-	}
1954
+    }
1955 1955
 
1956
-	/**
1957
-	 * This returns $this->parentId via __get()
1958
-	 *
1959
-	 * @access	protected
1960
-	 *
1961
-	 * @return	integer		The UID of the parent document or zero if not applicable
1962
-	 */
1963
-	protected function _getParentId() {
1956
+    /**
1957
+     * This returns $this->parentId via __get()
1958
+     *
1959
+     * @access	protected
1960
+     *
1961
+     * @return	integer		The UID of the parent document or zero if not applicable
1962
+     */
1963
+    protected function _getParentId() {
1964 1964
 
1965
-		return $this->parentId;
1965
+        return $this->parentId;
1966 1966
 
1967
-	}
1967
+    }
1968 1968
 
1969
-	/**
1970
-	 * This builds an array of the document's physical structure
1971
-	 *
1972
-	 * @access	protected
1973
-	 *
1974
-	 * @return	array		Array of physical elements' id, type, label and file representations ordered by @ORDER attribute
1975
-	 */
1976
-	protected function _getPhysicalStructure() {
1969
+    /**
1970
+     * This builds an array of the document's physical structure
1971
+     *
1972
+     * @access	protected
1973
+     *
1974
+     * @return	array		Array of physical elements' id, type, label and file representations ordered by @ORDER attribute
1975
+     */
1976
+    protected function _getPhysicalStructure() {
1977 1977
 
1978
-		// Is there no physical structure array yet?
1979
-		if (!$this->physicalStructureLoaded) {
1978
+        // Is there no physical structure array yet?
1979
+        if (!$this->physicalStructureLoaded) {
1980 1980
 
1981
-			// Does the document have a structMap node of type "PHYSICAL"?
1982
-			$elementNodes = $this->mets->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]/mets:div');
1981
+            // Does the document have a structMap node of type "PHYSICAL"?
1982
+            $elementNodes = $this->mets->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]/mets:div');
1983 1983
 
1984
-			if ($elementNodes) {
1984
+            if ($elementNodes) {
1985 1985
 
1986
-				// Get file groups.
1987
-				$fileUse = $this->_getFileGrps();
1986
+                // Get file groups.
1987
+                $fileUse = $this->_getFileGrps();
1988 1988
 
1989
-				// Get the physical sequence's metadata.
1990
-				$physNode = $this->mets->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]');
1989
+                // Get the physical sequence's metadata.
1990
+                $physNode = $this->mets->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]');
1991 1991
 
1992
-				$physSeq[0] = (string) $physNode[0]['ID'];
1992
+                $physSeq[0] = (string) $physNode[0]['ID'];
1993 1993
 
1994
-				$this->physicalStructureInfo[$physSeq[0]]['id'] = $physNode[0]['ID'];
1994
+                $this->physicalStructureInfo[$physSeq[0]]['id'] = $physNode[0]['ID'];
1995 1995
 
1996
-				$this->physicalStructureInfo[$physSeq[0]]['dmdId'] = (isset($physNode[0]['DMDID']) ? (string) $physNode[0]['DMDID'] : '');
1996
+                $this->physicalStructureInfo[$physSeq[0]]['dmdId'] = (isset($physNode[0]['DMDID']) ? (string) $physNode[0]['DMDID'] : '');
1997 1997
 
1998
-				$this->physicalStructureInfo[$physSeq[0]]['label'] = (isset($physNode[0]['LABEL']) ? (string) $physNode[0]['LABEL'] : '');
1998
+                $this->physicalStructureInfo[$physSeq[0]]['label'] = (isset($physNode[0]['LABEL']) ? (string) $physNode[0]['LABEL'] : '');
1999 1999
 
2000
-				$this->physicalStructureInfo[$physSeq[0]]['orderlabel'] = (isset($physNode[0]['ORDERLABEL']) ? (string) $physNode[0]['ORDERLABEL'] : '');
2000
+                $this->physicalStructureInfo[$physSeq[0]]['orderlabel'] = (isset($physNode[0]['ORDERLABEL']) ? (string) $physNode[0]['ORDERLABEL'] : '');
2001 2001
 
2002
-				$this->physicalStructureInfo[$physSeq[0]]['type'] = (string) $physNode[0]['TYPE'];
2002
+                $this->physicalStructureInfo[$physSeq[0]]['type'] = (string) $physNode[0]['TYPE'];
2003 2003
 
2004
-				$this->physicalStructureInfo[$physSeq[0]]['contentIds'] = (isset($physNode[0]['CONTENTIDS']) ? (string) $physNode[0]['CONTENTIDS'] : '');
2004
+                $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = (isset($physNode[0]['CONTENTIDS']) ? (string) $physNode[0]['CONTENTIDS'] : '');
2005 2005
 
2006
-				// Get the file representations from fileSec node.
2007
-				foreach ($physNode[0]->children('http://www.loc.gov/METS/')->fptr as $fptr) {
2006
+                // Get the file representations from fileSec node.
2007
+                foreach ($physNode[0]->children('http://www.loc.gov/METS/')->fptr as $fptr) {
2008 2008
 
2009
-					// Check if file has valid @USE attribute.
2010
-					if (!empty($fileUse[(string) $fptr->attributes()->FILEID])) {
2009
+                    // Check if file has valid @USE attribute.
2010
+                    if (!empty($fileUse[(string) $fptr->attributes()->FILEID])) {
2011 2011
 
2012
-						$this->physicalStructureInfo[$physSeq[0]]['files'][$fileUse[(string) $fptr->attributes()->FILEID]] = (string) $fptr->attributes()->FILEID;
2012
+                        $this->physicalStructureInfo[$physSeq[0]]['files'][$fileUse[(string) $fptr->attributes()->FILEID]] = (string) $fptr->attributes()->FILEID;
2013 2013
 
2014
-					}
2014
+                    }
2015 2015
 
2016
-				}
2016
+                }
2017 2017
 
2018
-				// Build the physical elements' array from the physical structMap node.
2019
-				foreach ($elementNodes as $elementNode) {
2018
+                // Build the physical elements' array from the physical structMap node.
2019
+                foreach ($elementNodes as $elementNode) {
2020 2020
 
2021
-					$elements[(int) $elementNode['ORDER']] = (string) $elementNode['ID'];
2021
+                    $elements[(int) $elementNode['ORDER']] = (string) $elementNode['ID'];
2022 2022
 
2023
-					$this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['id'] = $elementNode['ID'];
2023
+                    $this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['id'] = $elementNode['ID'];
2024 2024
 
2025
-					$this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['dmdId'] = (isset($elementNode['DMDID']) ? (string) $elementNode['DMDID'] : '');
2025
+                    $this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['dmdId'] = (isset($elementNode['DMDID']) ? (string) $elementNode['DMDID'] : '');
2026 2026
 
2027
-					$this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['label'] = (isset($elementNode['LABEL']) ? (string) $elementNode['LABEL'] : '');
2027
+                    $this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['label'] = (isset($elementNode['LABEL']) ? (string) $elementNode['LABEL'] : '');
2028 2028
 
2029
-					$this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['orderlabel'] = (isset($elementNode['ORDERLABEL']) ? (string) $elementNode['ORDERLABEL'] : '');
2029
+                    $this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['orderlabel'] = (isset($elementNode['ORDERLABEL']) ? (string) $elementNode['ORDERLABEL'] : '');
2030 2030
 
2031
-					$this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['type'] = (string) $elementNode['TYPE'];
2031
+                    $this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['type'] = (string) $elementNode['TYPE'];
2032 2032
 
2033
-					$this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['contentIds'] = (isset($elementNode['CONTENTIDS']) ? (string) $elementNode['CONTENTIDS'] : '');
2033
+                    $this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['contentIds'] = (isset($elementNode['CONTENTIDS']) ? (string) $elementNode['CONTENTIDS'] : '');
2034 2034
 
2035
-					// Get the file representations from fileSec node.
2036
-					foreach ($elementNode->children('http://www.loc.gov/METS/')->fptr as $fptr) {
2035
+                    // Get the file representations from fileSec node.
2036
+                    foreach ($elementNode->children('http://www.loc.gov/METS/')->fptr as $fptr) {
2037 2037
 
2038
-						// Check if file has valid @USE attribute.
2039
-						if (!empty($fileUse[(string) $fptr->attributes()->FILEID])) {
2038
+                        // Check if file has valid @USE attribute.
2039
+                        if (!empty($fileUse[(string) $fptr->attributes()->FILEID])) {
2040 2040
 
2041
-							$this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['files'][$fileUse[(string) $fptr->attributes()->FILEID]] = (string) $fptr->attributes()->FILEID;
2041
+                            $this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['files'][$fileUse[(string) $fptr->attributes()->FILEID]] = (string) $fptr->attributes()->FILEID;
2042 2042
 
2043
-						}
2043
+                        }
2044 2044
 
2045
-					}
2045
+                    }
2046 2046
 
2047
-				}
2047
+                }
2048 2048
 
2049
-				// Sort array by keys (= @ORDER).
2050
-				if (ksort($elements)) {
2049
+                // Sort array by keys (= @ORDER).
2050
+                if (ksort($elements)) {
2051 2051
 
2052
-					// Set total number of pages/tracks.
2053
-					$this->numPages = count($elements);
2052
+                    // Set total number of pages/tracks.
2053
+                    $this->numPages = count($elements);
2054 2054
 
2055
-					// Merge and re-index the array to get nice numeric indexes.
2056
-					$this->physicalStructure = array_merge($physSeq, $elements);
2055
+                    // Merge and re-index the array to get nice numeric indexes.
2056
+                    $this->physicalStructure = array_merge($physSeq, $elements);
2057 2057
 
2058
-				}
2058
+                }
2059 2059
 
2060
-			}
2060
+            }
2061 2061
 
2062
-			$this->physicalStructureLoaded = TRUE;
2062
+            $this->physicalStructureLoaded = TRUE;
2063 2063
 
2064
-		}
2064
+        }
2065 2065
 
2066
-		return $this->physicalStructure;
2066
+        return $this->physicalStructure;
2067 2067
 
2068
-	}
2068
+    }
2069 2069
 
2070
-	/**
2071
-	 * This gives an array of the document's physical structure metadata
2072
-	 *
2073
-	 * @access	protected
2074
-	 *
2075
-	 * @return	array		Array of elements' type, label and file representations ordered by @ID attribute
2076
-	 */
2077
-	protected function _getPhysicalStructureInfo() {
2070
+    /**
2071
+     * This gives an array of the document's physical structure metadata
2072
+     *
2073
+     * @access	protected
2074
+     *
2075
+     * @return	array		Array of elements' type, label and file representations ordered by @ID attribute
2076
+     */
2077
+    protected function _getPhysicalStructureInfo() {
2078 2078
 
2079
-		// Is there no physical structure array yet?
2080
-		if (!$this->physicalStructureLoaded) {
2079
+        // Is there no physical structure array yet?
2080
+        if (!$this->physicalStructureLoaded) {
2081 2081
 
2082
-			// Build physical structure array.
2083
-			$this->_getPhysicalStructure();
2082
+            // Build physical structure array.
2083
+            $this->_getPhysicalStructure();
2084 2084
 
2085
-		}
2085
+        }
2086 2086
 
2087
-		return $this->physicalStructureInfo;
2087
+        return $this->physicalStructureInfo;
2088 2088
 
2089
-	}
2089
+    }
2090 2090
 
2091
-	/**
2092
-	 * This returns $this->pid via __get()
2093
-	 *
2094
-	 * @access	protected
2095
-	 *
2096
-	 * @return	integer		The PID of the document or zero if not in database
2097
-	 */
2098
-	protected function _getPid() {
2091
+    /**
2092
+     * This returns $this->pid via __get()
2093
+     *
2094
+     * @access	protected
2095
+     *
2096
+     * @return	integer		The PID of the document or zero if not in database
2097
+     */
2098
+    protected function _getPid() {
2099 2099
 
2100
-		return $this->pid;
2100
+        return $this->pid;
2101 2101
 
2102
-	}
2102
+    }
2103 2103
 
2104
-	/**
2105
-	 * This returns $this->ready via __get()
2106
-	 *
2107
-	 * @access	protected
2108
-	 *
2109
-	 * @return	boolean		Is the document instantiated successfully?
2110
-	 */
2111
-	protected function _getReady() {
2104
+    /**
2105
+     * This returns $this->ready via __get()
2106
+     *
2107
+     * @access	protected
2108
+     *
2109
+     * @return	boolean		Is the document instantiated successfully?
2110
+     */
2111
+    protected function _getReady() {
2112 2112
 
2113
-		return $this->ready;
2113
+        return $this->ready;
2114 2114
 
2115
-	}
2115
+    }
2116 2116
 
2117
-	/**
2118
-	 * This returns $this->recordId via __get()
2119
-	 *
2120
-	 * @access	protected
2121
-	 *
2122
-	 * @return	mixed		The METS file's record identifier
2123
-	 */
2124
-	protected function _getRecordId() {
2117
+    /**
2118
+     * This returns $this->recordId via __get()
2119
+     *
2120
+     * @access	protected
2121
+     *
2122
+     * @return	mixed		The METS file's record identifier
2123
+     */
2124
+    protected function _getRecordId() {
2125 2125
 
2126
-		return $this->recordId;
2126
+        return $this->recordId;
2127 2127
 
2128
-	}
2128
+    }
2129 2129
 
2130
-	/**
2131
-	 * This returns $this->rootId via __get()
2132
-	 *
2133
-	 * @access	protected
2134
-	 *
2135
-	 * @return	integer		The UID of the root document or zero if not applicable
2136
-	 */
2137
-	protected function _getRootId() {
2130
+    /**
2131
+     * This returns $this->rootId via __get()
2132
+     *
2133
+     * @access	protected
2134
+     *
2135
+     * @return	integer		The UID of the root document or zero if not applicable
2136
+     */
2137
+    protected function _getRootId() {
2138 2138
 
2139
-		if (!$this->rootIdLoaded) {
2139
+        if (!$this->rootIdLoaded) {
2140 2140
 
2141
-			if ($this->parentId) {
2141
+            if ($this->parentId) {
2142 2142
 
2143
-				$parent = self::getInstance($this->parentId, $this->pid);
2143
+                $parent = self::getInstance($this->parentId, $this->pid);
2144 2144
 
2145
-				$this->rootId = $parent->rootId;
2145
+                $this->rootId = $parent->rootId;
2146 2146
 
2147
-			}
2147
+            }
2148 2148
 
2149
-			$this->rootIdLoaded = TRUE;
2149
+            $this->rootIdLoaded = TRUE;
2150 2150
 
2151
-		}
2151
+        }
2152 2152
 
2153
-		return $this->rootId;
2153
+        return $this->rootId;
2154 2154
 
2155
-	}
2155
+    }
2156 2156
 
2157
-	/**
2158
-	 * This returns the smLinks between logical and physical structMap
2159
-	 *
2160
-	 * @access	protected
2161
-	 *
2162
-	 * @return	array		The links between logical and physical nodes
2163
-	 */
2164
-	protected function _getSmLinks() {
2157
+    /**
2158
+     * This returns the smLinks between logical and physical structMap
2159
+     *
2160
+     * @access	protected
2161
+     *
2162
+     * @return	array		The links between logical and physical nodes
2163
+     */
2164
+    protected function _getSmLinks() {
2165 2165
 
2166
-		if (!$this->smLinksLoaded) {
2166
+        if (!$this->smLinksLoaded) {
2167 2167
 
2168
-			$smLinks = $this->mets->xpath('./mets:structLink/mets:smLink');
2168
+            $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink');
2169 2169
 
2170
-			foreach ($smLinks as $smLink) {
2170
+            foreach ($smLinks as $smLink) {
2171 2171
 
2172
-				$this->smLinks['l2p'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->to;
2172
+                $this->smLinks['l2p'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->to;
2173 2173
 
2174
-				$this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from;
2174
+                $this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from;
2175 2175
 
2176
-			}
2176
+            }
2177 2177
 
2178
-			$this->smLinksLoaded = TRUE;
2178
+            $this->smLinksLoaded = TRUE;
2179 2179
 
2180
-		}
2180
+        }
2181 2181
 
2182
-		return $this->smLinks;
2182
+        return $this->smLinks;
2183 2183
 
2184
-	}
2184
+    }
2185 2185
 
2186
-	/**
2187
-	 * This builds an array of the document's logical structure
2188
-	 *
2189
-	 * @access	protected
2190
-	 *
2191
-	 * @return	array		Array of structure nodes' id, label, type and physical page indexes/mptr link with original hierarchy preserved
2192
-	 */
2193
-	protected function _getTableOfContents() {
2186
+    /**
2187
+     * This builds an array of the document's logical structure
2188
+     *
2189
+     * @access	protected
2190
+     *
2191
+     * @return	array		Array of structure nodes' id, label, type and physical page indexes/mptr link with original hierarchy preserved
2192
+     */
2193
+    protected function _getTableOfContents() {
2194 2194
 
2195
-		// Is there no logical structure array yet?
2196
-		if (!$this->tableOfContentsLoaded) {
2195
+        // Is there no logical structure array yet?
2196
+        if (!$this->tableOfContentsLoaded) {
2197 2197
 
2198
-			// Get all logical structures.
2199
-			$this->getLogicalStructure('', TRUE);
2198
+            // Get all logical structures.
2199
+            $this->getLogicalStructure('', TRUE);
2200 2200
 
2201
-			$this->tableOfContentsLoaded = TRUE;
2201
+            $this->tableOfContentsLoaded = TRUE;
2202 2202
 
2203
-		}
2203
+        }
2204 2204
 
2205
-		return $this->tableOfContents;
2205
+        return $this->tableOfContents;
2206 2206
 
2207
-	}
2207
+    }
2208 2208
 
2209
-	/**
2210
-	 * This returns the document's thumbnail location
2211
-	 *
2212
-	 * @access	protected
2213
-	 *
2214
-	 * @param	boolean		$forceReload: Force reloading the thumbnail instead of returning the cached value
2215
-	 *
2216
-	 * @return	string		The document's thumbnail location
2217
-	 */
2218
-	protected function _getThumbnail($forceReload = FALSE) {
2209
+    /**
2210
+     * This returns the document's thumbnail location
2211
+     *
2212
+     * @access	protected
2213
+     *
2214
+     * @param	boolean		$forceReload: Force reloading the thumbnail instead of returning the cached value
2215
+     *
2216
+     * @return	string		The document's thumbnail location
2217
+     */
2218
+    protected function _getThumbnail($forceReload = FALSE) {
2219 2219
 
2220
-		if (!$this->thumbnailLoaded || $forceReload) {
2220
+        if (!$this->thumbnailLoaded || $forceReload) {
2221 2221
 
2222
-			// Retain current PID.
2223
-			$cPid = ($this->cPid ? $this->cPid : $this->pid);
2222
+            // Retain current PID.
2223
+            $cPid = ($this->cPid ? $this->cPid : $this->pid);
2224 2224
 
2225
-			if (!$cPid) {
2225
+            if (!$cPid) {
2226 2226
 
2227
-				if (TYPO3_DLOG) {
2227
+                if (TYPO3_DLOG) {
2228 2228
 
2229
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->_getThumbnail()] Invalid PID "'.$cPid.'" for structure definitions', self::$extKey, SYSLOG_SEVERITY_ERROR);
2229
+                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->_getThumbnail()] Invalid PID "'.$cPid.'" for structure definitions', self::$extKey, SYSLOG_SEVERITY_ERROR);
2230 2230
 
2231
-				}
2231
+                }
2232 2232
 
2233
-				$this->thumbnailLoaded = TRUE;
2233
+                $this->thumbnailLoaded = TRUE;
2234 2234
 
2235
-				return $this->thumbnail;
2235
+                return $this->thumbnail;
2236 2236
 
2237
-			}
2237
+            }
2238 2238
 
2239
-			// Load extension configuration.
2240
-			$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
2239
+            // Load extension configuration.
2240
+            $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
2241 2241
 
2242
-			if (empty($extConf['fileGrpThumbs'])) {
2242
+            if (empty($extConf['fileGrpThumbs'])) {
2243 2243
 
2244
-				if (TYPO3_DLOG) {
2244
+                if (TYPO3_DLOG) {
2245 2245
 
2246
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->_getThumbnail()] No fileGrp for thumbnails specified', self::$extKey, SYSLOG_SEVERITY_WARNING);
2246
+                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->_getThumbnail()] No fileGrp for thumbnails specified', self::$extKey, SYSLOG_SEVERITY_WARNING);
2247 2247
 
2248
-				}
2248
+                }
2249 2249
 
2250
-				$this->thumbnailLoaded = TRUE;
2250
+                $this->thumbnailLoaded = TRUE;
2251 2251
 
2252
-				return $this->thumbnail;
2252
+                return $this->thumbnail;
2253 2253
 
2254
-			}
2254
+            }
2255 2255
 
2256
-			$strctId = $this->_getToplevelId();
2256
+            $strctId = $this->_getToplevelId();
2257 2257
 
2258
-			$metadata = $this->getTitledata($cPid);
2258
+            $metadata = $this->getTitledata($cPid);
2259 2259
 
2260
-			// Get structure element to get thumbnail from.
2261
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
2262
-				'tx_dlf_structures.thumbnail AS thumbnail',
2263
-				'tx_dlf_structures',
2264
-				'tx_dlf_structures.pid='.intval($cPid).' AND tx_dlf_structures.index_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($metadata['type'][0], 'tx_dlf_structures').tx_dlf_helper::whereClause('tx_dlf_structures'),
2265
-				'',
2266
-				'',
2267
-				'1'
2268
-			);
2260
+            // Get structure element to get thumbnail from.
2261
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
2262
+                'tx_dlf_structures.thumbnail AS thumbnail',
2263
+                'tx_dlf_structures',
2264
+                'tx_dlf_structures.pid='.intval($cPid).' AND tx_dlf_structures.index_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($metadata['type'][0], 'tx_dlf_structures').tx_dlf_helper::whereClause('tx_dlf_structures'),
2265
+                '',
2266
+                '',
2267
+                '1'
2268
+            );
2269 2269
 
2270
-			if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
2270
+            if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
2271 2271
 
2272
-				$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
2272
+                $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
2273 2273
 
2274
-				// Get desired thumbnail structure if not the toplevel structure itself.
2275
-				if (!empty($resArray['thumbnail'])) {
2274
+                // Get desired thumbnail structure if not the toplevel structure itself.
2275
+                if (!empty($resArray['thumbnail'])) {
2276 2276
 
2277
-					$strctType = tx_dlf_helper::getIndexName($resArray['thumbnail'], 'tx_dlf_structures', $cPid);
2277
+                    $strctType = tx_dlf_helper::getIndexName($resArray['thumbnail'], 'tx_dlf_structures', $cPid);
2278 2278
 
2279
-					// Check if this document has a structure element of the desired type.
2280
-					$strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID');
2279
+                    // Check if this document has a structure element of the desired type.
2280
+                    $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID');
2281 2281
 
2282
-					if (!empty($strctIds)) {
2282
+                    if (!empty($strctIds)) {
2283 2283
 
2284
-						$strctId = (string) $strctIds[0];
2284
+                        $strctId = (string) $strctIds[0];
2285 2285
 
2286
-					}
2286
+                    }
2287 2287
 
2288
-				}
2288
+                }
2289 2289
 
2290
-				// Load smLinks.
2291
-				$this->_getSmLinks();
2290
+                // Load smLinks.
2291
+                $this->_getSmLinks();
2292 2292
 
2293
-				// Get thumbnail location.
2294
-				if ($this->_getPhysicalStructure() && !empty($this->smLinks['l2p'][$strctId])) {
2293
+                // Get thumbnail location.
2294
+                if ($this->_getPhysicalStructure() && !empty($this->smLinks['l2p'][$strctId])) {
2295 2295
 
2296
-					$this->thumbnail = $this->getFileLocation($this->physicalStructureInfo[$this->smLinks['l2p'][$strctId][0]]['files'][$extConf['fileGrpThumbs']]);
2296
+                    $this->thumbnail = $this->getFileLocation($this->physicalStructureInfo[$this->smLinks['l2p'][$strctId][0]]['files'][$extConf['fileGrpThumbs']]);
2297 2297
 
2298
-				} else {
2298
+                } else {
2299 2299
 
2300
-					$this->thumbnail = $this->getFileLocation($this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$extConf['fileGrpThumbs']]);
2300
+                    $this->thumbnail = $this->getFileLocation($this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$extConf['fileGrpThumbs']]);
2301 2301
 
2302
-				}
2302
+                }
2303 2303
 
2304
-			} elseif (TYPO3_DLOG) {
2304
+            } elseif (TYPO3_DLOG) {
2305 2305
 
2306
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->_getThumbnail()] No structure of type "'.$metadata['type'][0].'" found in database', self::$extKey, SYSLOG_SEVERITY_ERROR);
2306
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->_getThumbnail()] No structure of type "'.$metadata['type'][0].'" found in database', self::$extKey, SYSLOG_SEVERITY_ERROR);
2307 2307
 
2308
-			}
2308
+            }
2309 2309
 
2310
-			$this->thumbnailLoaded = TRUE;
2310
+            $this->thumbnailLoaded = TRUE;
2311 2311
 
2312
-		}
2312
+        }
2313 2313
 
2314
-		return $this->thumbnail;
2314
+        return $this->thumbnail;
2315 2315
 
2316
-	}
2316
+    }
2317 2317
 
2318
-	/**
2319
-	 * This returns the ID of the toplevel logical structure node
2320
-	 *
2321
-	 * @access	protected
2322
-	 *
2323
-	 * @return	string		The logical structure node's ID
2324
-	 */
2325
-	protected function _getToplevelId() {
2318
+    /**
2319
+     * This returns the ID of the toplevel logical structure node
2320
+     *
2321
+     * @access	protected
2322
+     *
2323
+     * @return	string		The logical structure node's ID
2324
+     */
2325
+    protected function _getToplevelId() {
2326 2326
 
2327
-		if (empty($this->toplevelId)) {
2327
+        if (empty($this->toplevelId)) {
2328 2328
 
2329
-			// Get all logical structure nodes with metadata, but without associated METS-Pointers.
2330
-			if (($divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) {
2329
+            // Get all logical structure nodes with metadata, but without associated METS-Pointers.
2330
+            if (($divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) {
2331 2331
 
2332
-				// Load smLinks.
2333
-				$this->_getSmLinks();
2332
+                // Load smLinks.
2333
+                $this->_getSmLinks();
2334 2334
 
2335
-				foreach ($divs as $div) {
2335
+                foreach ($divs as $div) {
2336 2336
 
2337
-					$id = (string) $div['ID'];
2337
+                    $id = (string) $div['ID'];
2338 2338
 
2339
-					// Are there physical structure nodes for this logical structure?
2340
-					if (array_key_exists($id, $this->smLinks['l2p'])) {
2339
+                    // Are there physical structure nodes for this logical structure?
2340
+                    if (array_key_exists($id, $this->smLinks['l2p'])) {
2341 2341
 
2342
-						// Yes. That's what we're looking for.
2343
-						$this->toplevelId = $id;
2342
+                        // Yes. That's what we're looking for.
2343
+                        $this->toplevelId = $id;
2344 2344
 
2345
-						break;
2345
+                        break;
2346 2346
 
2347
-					} elseif (empty($this->toplevelId)) {
2347
+                    } elseif (empty($this->toplevelId)) {
2348 2348
 
2349
-						// No. Remember this anyway, but keep looking for a better one.
2350
-						$this->toplevelId = $id;
2349
+                        // No. Remember this anyway, but keep looking for a better one.
2350
+                        $this->toplevelId = $id;
2351 2351
 
2352
-					}
2352
+                    }
2353 2353
 
2354
-				}
2354
+                }
2355 2355
 
2356
-			}
2356
+            }
2357 2357
 
2358
-		}
2358
+        }
2359 2359
 
2360
-		return $this->toplevelId;
2360
+        return $this->toplevelId;
2361 2361
 
2362
-	}
2362
+    }
2363 2363
 
2364
-	/**
2365
-	 * This returns $this->uid via __get()
2366
-	 *
2367
-	 * @access	protected
2368
-	 *
2369
-	 * @return	mixed		The UID or the URL of the document
2370
-	 */
2371
-	protected function _getUid() {
2364
+    /**
2365
+     * This returns $this->uid via __get()
2366
+     *
2367
+     * @access	protected
2368
+     *
2369
+     * @return	mixed		The UID or the URL of the document
2370
+     */
2371
+    protected function _getUid() {
2372 2372
 
2373
-		return $this->uid;
2373
+        return $this->uid;
2374 2374
 
2375
-	}
2375
+    }
2376 2376
 
2377
-	/**
2378
-	 * This sets $this->cPid via __set()
2379
-	 *
2380
-	 * @access	protected
2381
-	 *
2382
-	 * @param	integer		$value: The new PID for the metadata definitions
2383
-	 *
2384
-	 * @return	void
2385
-	 */
2386
-	protected function _setCPid($value) {
2377
+    /**
2378
+     * This sets $this->cPid via __set()
2379
+     *
2380
+     * @access	protected
2381
+     *
2382
+     * @param	integer		$value: The new PID for the metadata definitions
2383
+     *
2384
+     * @return	void
2385
+     */
2386
+    protected function _setCPid($value) {
2387 2387
 
2388
-		$this->cPid = max(intval($value), 0);
2388
+        $this->cPid = max(intval($value), 0);
2389 2389
 
2390
-	}
2390
+    }
2391 2391
 
2392
-	/**
2393
-	 * This magic method is invoked each time a clone is called on the object variable
2394
-	 * (This method is defined as private/protected because singleton objects should not be cloned)
2395
-	 *
2396
-	 * @access	protected
2397
-	 *
2398
-	 * @return	void
2399
-	 */
2400
-	protected function __clone() {}
2392
+    /**
2393
+     * This magic method is invoked each time a clone is called on the object variable
2394
+     * (This method is defined as private/protected because singleton objects should not be cloned)
2395
+     *
2396
+     * @access	protected
2397
+     *
2398
+     * @return	void
2399
+     */
2400
+    protected function __clone() {}
2401 2401
 
2402
-	/**
2403
-	 * This is a singleton class, thus the constructor should be private/protected
2404
-	 *
2405
-	 * @access	protected
2406
-	 *
2407
-	 * @param	integer		$uid: The UID of the document to parse or URL to XML file
2408
-	 * @param	integer		$pid: If > 0, then only document with this PID gets loaded
2409
-	 *
2410
-	 * @return	void
2411
-	 */
2412
-	protected function __construct($uid, $pid) {
2402
+    /**
2403
+     * This is a singleton class, thus the constructor should be private/protected
2404
+     *
2405
+     * @access	protected
2406
+     *
2407
+     * @param	integer		$uid: The UID of the document to parse or URL to XML file
2408
+     * @param	integer		$pid: If > 0, then only document with this PID gets loaded
2409
+     *
2410
+     * @return	void
2411
+     */
2412
+    protected function __construct($uid, $pid) {
2413 2413
 
2414
-		// Prepare to check database for the requested document.
2415
-		if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($uid)) {
2414
+        // Prepare to check database for the requested document.
2415
+        if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($uid)) {
2416 2416
 
2417
-			$whereClause = 'tx_dlf_documents.uid='.intval($uid).tx_dlf_helper::whereClause('tx_dlf_documents');
2417
+            $whereClause = 'tx_dlf_documents.uid='.intval($uid).tx_dlf_helper::whereClause('tx_dlf_documents');
2418 2418
 
2419
-		} else {
2419
+        } else {
2420 2420
 
2421
-			// Cast to string for safety reasons.
2422
-			$location = (string) $uid;
2421
+            // Cast to string for safety reasons.
2422
+            $location = (string) $uid;
2423 2423
 
2424
-			// Try to load METS file.
2425
-			if (\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($location) && $this->load($location)) {
2424
+            // Try to load METS file.
2425
+            if (\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($location) && $this->load($location)) {
2426 2426
 
2427
-				// Initialize core METS object.
2428
-				$this->init();
2427
+                // Initialize core METS object.
2428
+                $this->init();
2429 2429
 
2430
-				if ($this->mets !== NULL) {
2430
+                if ($this->mets !== NULL) {
2431 2431
 
2432
-					// Check for METS object @ID.
2433
-					if (!empty($this->mets['OBJID'])) {
2432
+                    // Check for METS object @ID.
2433
+                    if (!empty($this->mets['OBJID'])) {
2434 2434
 
2435
-						$this->recordId = (string) $this->mets['OBJID'];
2435
+                        $this->recordId = (string) $this->mets['OBJID'];
2436 2436
 
2437
-					}
2437
+                    }
2438 2438
 
2439
-					// Get hook objects.
2440
-					$hookObjects = tx_dlf_helper::getHookObjects('common/class.tx_dlf_document.php');
2439
+                    // Get hook objects.
2440
+                    $hookObjects = tx_dlf_helper::getHookObjects('common/class.tx_dlf_document.php');
2441 2441
 
2442
-					// Apply hooks.
2443
-					foreach($hookObjects as $hookObj) {
2442
+                    // Apply hooks.
2443
+                    foreach($hookObjects as $hookObj) {
2444 2444
 
2445
-						if (method_exists($hookObj, 'construct_postProcessRecordId')) {
2445
+                        if (method_exists($hookObj, 'construct_postProcessRecordId')) {
2446 2446
 
2447
-							$hookObj->construct_postProcessRecordId($this->xml, $this->recordId);
2447
+                            $hookObj->construct_postProcessRecordId($this->xml, $this->recordId);
2448 2448
 
2449
-						}
2449
+                        }
2450 2450
 
2451
-					}
2451
+                    }
2452 2452
 
2453
-				} else {
2453
+                } else {
2454 2454
 
2455
-					// No METS part found.
2456
-					return;
2455
+                    // No METS part found.
2456
+                    return;
2457 2457
 
2458
-				}
2458
+                }
2459 2459
 
2460
-			} else {
2460
+            } else {
2461 2461
 
2462
-				// Loading failed.
2463
-				return;
2462
+                // Loading failed.
2463
+                return;
2464 2464
 
2465
-			}
2465
+            }
2466 2466
 
2467
-			if (!empty($this->recordId)) {
2467
+            if (!empty($this->recordId)) {
2468 2468
 
2469
-				$whereClause = 'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->recordId, 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents');
2469
+                $whereClause = 'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->recordId, 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents');
2470 2470
 
2471
-			} else {
2471
+            } else {
2472 2472
 
2473
-				// There is no record identifier and there should be no hit in the database.
2474
-				$whereClause = '1=-1';
2473
+                // There is no record identifier and there should be no hit in the database.
2474
+                $whereClause = '1=-1';
2475 2475
 
2476
-			}
2476
+            }
2477 2477
 
2478
-		}
2478
+        }
2479 2479
 
2480
-		// Check for PID if needed.
2481
-		if ($pid) {
2480
+        // Check for PID if needed.
2481
+        if ($pid) {
2482 2482
 
2483
-			$whereClause .= ' AND tx_dlf_documents.pid='.intval($pid);
2483
+            $whereClause .= ' AND tx_dlf_documents.pid='.intval($pid);
2484 2484
 
2485
-		}
2485
+        }
2486 2486
 
2487
-		// Get document PID and location from database.
2488
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
2489
-			'tx_dlf_documents.uid AS uid,tx_dlf_documents.pid AS pid,tx_dlf_documents.record_id AS record_id,tx_dlf_documents.partof AS partof,tx_dlf_documents.thumbnail AS thumbnail,tx_dlf_documents.location AS location',
2490
-			'tx_dlf_documents',
2491
-			$whereClause,
2492
-			'',
2493
-			'',
2494
-			'1'
2495
-		);
2487
+        // Get document PID and location from database.
2488
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
2489
+            'tx_dlf_documents.uid AS uid,tx_dlf_documents.pid AS pid,tx_dlf_documents.record_id AS record_id,tx_dlf_documents.partof AS partof,tx_dlf_documents.thumbnail AS thumbnail,tx_dlf_documents.location AS location',
2490
+            'tx_dlf_documents',
2491
+            $whereClause,
2492
+            '',
2493
+            '',
2494
+            '1'
2495
+        );
2496 2496
 
2497
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
2497
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
2498 2498
 
2499
-			list ($this->uid, $this->pid, $this->recordId, $this->parentId, $this->thumbnail, $this->location) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
2499
+            list ($this->uid, $this->pid, $this->recordId, $this->parentId, $this->thumbnail, $this->location) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
2500 2500
 
2501
-			$this->thumbnailLoaded = TRUE;
2501
+            $this->thumbnailLoaded = TRUE;
2502 2502
 
2503
-			// Load XML file if necessary...
2504
-			if ($this->mets === NULL && $this->load($this->location)) {
2503
+            // Load XML file if necessary...
2504
+            if ($this->mets === NULL && $this->load($this->location)) {
2505 2505
 
2506
-				// ...and set some basic properties.
2507
-				$this->init();
2506
+                // ...and set some basic properties.
2507
+                $this->init();
2508 2508
 
2509
-			}
2509
+            }
2510 2510
 
2511
-			// Do we have a METS object now?
2512
-			if ($this->mets !== NULL) {
2511
+            // Do we have a METS object now?
2512
+            if ($this->mets !== NULL) {
2513 2513
 
2514
-				// Set new location if necessary.
2515
-				if (!empty($location)) {
2514
+                // Set new location if necessary.
2515
+                if (!empty($location)) {
2516 2516
 
2517
-					$this->location = $location;
2517
+                    $this->location = $location;
2518 2518
 
2519
-				}
2519
+                }
2520 2520
 
2521
-				// Document ready!
2522
-				$this->ready = TRUE;
2521
+                // Document ready!
2522
+                $this->ready = TRUE;
2523 2523
 
2524
-			}
2524
+            }
2525 2525
 
2526
-		} elseif ($this->mets !== NULL) {
2526
+        } elseif ($this->mets !== NULL) {
2527 2527
 
2528
-			// Set location as UID for documents not in database.
2529
-			$this->uid = $location;
2528
+            // Set location as UID for documents not in database.
2529
+            $this->uid = $location;
2530 2530
 
2531
-			$this->location = $location;
2531
+            $this->location = $location;
2532 2532
 
2533
-			// Document ready!
2534
-			$this->ready = TRUE;
2533
+            // Document ready!
2534
+            $this->ready = TRUE;
2535 2535
 
2536
-		} else {
2536
+        } else {
2537 2537
 
2538
-			if (TYPO3_DLOG) {
2538
+            if (TYPO3_DLOG) {
2539 2539
 
2540
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->__construct('.$uid.', '.$pid.')] No document with UID "'.$uid.'" found or document not accessible', self::$extKey, SYSLOG_SEVERITY_ERROR);
2540
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->__construct('.$uid.', '.$pid.')] No document with UID "'.$uid.'" found or document not accessible', self::$extKey, SYSLOG_SEVERITY_ERROR);
2541 2541
 
2542
-			}
2542
+            }
2543 2543
 
2544
-		}
2544
+        }
2545 2545
 
2546
-	}
2546
+    }
2547 2547
 
2548
-	/**
2549
-	 * This magic method is called each time an invisible property is referenced from the object
2550
-	 *
2551
-	 * @access	public
2552
-	 *
2553
-	 * @param	string		$var: Name of variable to get
2554
-	 *
2555
-	 * @return	mixed		Value of $this->$var
2556
-	 */
2557
-	public function __get($var) {
2548
+    /**
2549
+     * This magic method is called each time an invisible property is referenced from the object
2550
+     *
2551
+     * @access	public
2552
+     *
2553
+     * @param	string		$var: Name of variable to get
2554
+     *
2555
+     * @return	mixed		Value of $this->$var
2556
+     */
2557
+    public function __get($var) {
2558 2558
 
2559
-		$method = '_get'.ucfirst($var);
2559
+        $method = '_get'.ucfirst($var);
2560 2560
 
2561
-		if (!property_exists($this, $var) || !method_exists($this, $method)) {
2561
+        if (!property_exists($this, $var) || !method_exists($this, $method)) {
2562 2562
 
2563
-			if (TYPO3_DLOG) {
2563
+            if (TYPO3_DLOG) {
2564 2564
 
2565
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->__get('.$var.')] There is no getter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
2565
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->__get('.$var.')] There is no getter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
2566 2566
 
2567
-			}
2567
+            }
2568 2568
 
2569
-			return;
2569
+            return;
2570 2570
 
2571
-		} else {
2571
+        } else {
2572 2572
 
2573
-			return $this->$method();
2573
+            return $this->$method();
2574 2574
 
2575
-		}
2575
+        }
2576 2576
 
2577
-	}
2577
+    }
2578 2578
 
2579
-	/**
2580
-	 * This magic method is called each time an invisible property is referenced from the object
2581
-	 *
2582
-	 * @access	public
2583
-	 *
2584
-	 * @param	string		$var: Name of variable to set
2585
-	 * @param	mixed		$value: New value of variable
2586
-	 *
2587
-	 * @return	void
2588
-	 */
2589
-	public function __set($var, $value) {
2579
+    /**
2580
+     * This magic method is called each time an invisible property is referenced from the object
2581
+     *
2582
+     * @access	public
2583
+     *
2584
+     * @param	string		$var: Name of variable to set
2585
+     * @param	mixed		$value: New value of variable
2586
+     *
2587
+     * @return	void
2588
+     */
2589
+    public function __set($var, $value) {
2590 2590
 
2591
-		$method = '_set'.ucfirst($var);
2591
+        $method = '_set'.ucfirst($var);
2592 2592
 
2593
-		if (!property_exists($this, $var) || !method_exists($this, $method)) {
2593
+        if (!property_exists($this, $var) || !method_exists($this, $method)) {
2594 2594
 
2595
-			if (TYPO3_DLOG) {
2595
+            if (TYPO3_DLOG) {
2596 2596
 
2597
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->__set('.$var.', '.$value.')] There is no setter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
2597
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->__set('.$var.', '.$value.')] There is no setter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
2598 2598
 
2599
-			}
2599
+            }
2600 2600
 
2601
-		} else {
2601
+        } else {
2602 2602
 
2603
-			$this->$method($value);
2603
+            $this->$method($value);
2604 2604
 
2605
-		}
2605
+        }
2606 2606
 
2607
-	}
2607
+    }
2608 2608
 
2609
-	/**
2610
-	 * This magic method is executed prior to any serialization of the object
2611
-	 * @see __wakeup()
2612
-	 *
2613
-	 * @access	public
2614
-	 *
2615
-	 * @return	array		Properties to be serialized
2616
-	 */
2617
-	public function __sleep() {
2609
+    /**
2610
+     * This magic method is executed prior to any serialization of the object
2611
+     * @see __wakeup()
2612
+     *
2613
+     * @access	public
2614
+     *
2615
+     * @return	array		Properties to be serialized
2616
+     */
2617
+    public function __sleep() {
2618 2618
 
2619
-		// SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization
2620
-		$this->asXML = $this->xml->asXML();
2619
+        // SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization
2620
+        $this->asXML = $this->xml->asXML();
2621 2621
 
2622
-		return array ('uid', 'pid', 'recordId', 'parentId', 'asXML');
2622
+        return array ('uid', 'pid', 'recordId', 'parentId', 'asXML');
2623 2623
 
2624
-	}
2624
+    }
2625 2625
 
2626
-	/**
2627
-	 * This magic method is used for setting a string value for the object
2628
-	 *
2629
-	 * @access	public
2630
-	 *
2631
-	 * @return	string		String representing the METS object
2632
-	 */
2633
-	public function __toString() {
2626
+    /**
2627
+     * This magic method is used for setting a string value for the object
2628
+     *
2629
+     * @access	public
2630
+     *
2631
+     * @return	string		String representing the METS object
2632
+     */
2633
+    public function __toString() {
2634 2634
 
2635
-		$xml = new DOMDocument('1.0', 'utf-8');
2635
+        $xml = new DOMDocument('1.0', 'utf-8');
2636 2636
 
2637
-		$xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE));
2637
+        $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE));
2638 2638
 
2639
-		$xml->formatOutput = TRUE;
2639
+        $xml->formatOutput = TRUE;
2640 2640
 
2641
-		return $xml->saveXML();
2641
+        return $xml->saveXML();
2642 2642
 
2643
-	}
2643
+    }
2644 2644
 
2645
-	/**
2646
-	 * This magic method is executed after the object is deserialized
2647
-	 * @see __sleep()
2648
-	 *
2649
-	 * @access	public
2650
-	 *
2651
-	 * @return	void
2652
-	 */
2653
-	public function __wakeup() {
2645
+    /**
2646
+     * This magic method is executed after the object is deserialized
2647
+     * @see __sleep()
2648
+     *
2649
+     * @access	public
2650
+     *
2651
+     * @return	void
2652
+     */
2653
+    public function __wakeup() {
2654 2654
 
2655
-		// Turn off libxml's error logging.
2656
-		$libxmlErrors = libxml_use_internal_errors(TRUE);
2655
+        // Turn off libxml's error logging.
2656
+        $libxmlErrors = libxml_use_internal_errors(TRUE);
2657 2657
 
2658
-		// Reload XML from string.
2659
-		$xml = @simplexml_load_string($this->asXML);
2658
+        // Reload XML from string.
2659
+        $xml = @simplexml_load_string($this->asXML);
2660 2660
 
2661
-		// Reset libxml's error logging.
2662
-		libxml_use_internal_errors($libxmlErrors);
2661
+        // Reset libxml's error logging.
2662
+        libxml_use_internal_errors($libxmlErrors);
2663 2663
 
2664
-		if ($xml !== FALSE) {
2664
+        if ($xml !== FALSE) {
2665 2665
 
2666
-			$this->asXML = '';
2666
+            $this->asXML = '';
2667 2667
 
2668
-			$this->xml = $xml;
2668
+            $this->xml = $xml;
2669 2669
 
2670
-			// Rebuild the unserializable properties.
2671
-			$this->init();
2670
+            // Rebuild the unserializable properties.
2671
+            $this->init();
2672 2672
 
2673
-		} else {
2673
+        } else {
2674 2674
 
2675
-			if (TYPO3_DLOG) {
2675
+            if (TYPO3_DLOG) {
2676 2676
 
2677
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->__wakeup()] Could not load XML after deserialization', self::$extKey, SYSLOG_SEVERITY_ERROR);
2677
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->__wakeup()] Could not load XML after deserialization', self::$extKey, SYSLOG_SEVERITY_ERROR);
2678 2678
 
2679
-			}
2679
+            }
2680 2680
 
2681
-		}
2681
+        }
2682 2682
 
2683
-	}
2683
+    }
2684 2684
 
2685 2685
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 
569 569
 		$details['id'] = $attributes['ID'];
570 570
 
571
-		$details['dmdId'] = (isset($attributes['DMDID']) ?  $attributes['DMDID'] : '');
571
+		$details['dmdId'] = (isset($attributes['DMDID']) ? $attributes['DMDID'] : '');
572 572
 
573 573
 		$details['label'] = (isset($attributes['LABEL']) ? $attributes['LABEL'] : '');
574 574
 
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 	 */
918 918
 	public function getPhysicalPage($logicalPage) {
919 919
 
920
-		if(!empty( $this->lastSearchedPhysicalPage['logicalPage']) &&  $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage) {
920
+		if (!empty($this->lastSearchedPhysicalPage['logicalPage']) && $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage) {
921 921
 
922 922
 			return $this->lastSearchedPhysicalPage['physicalPage'];
923 923
 
@@ -925,9 +925,9 @@  discard block
 block discarded – undo
925 925
 
926 926
 			$physicalPage = 0;
927 927
 
928
-			foreach($this->physicalStructureInfo as $page) {
928
+			foreach ($this->physicalStructureInfo as $page) {
929 929
 
930
-				if(strpos($page['orderlabel'], $logicalPage) !== false){
930
+				if (strpos($page['orderlabel'], $logicalPage) !== false) {
931 931
 
932 932
 					$this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage;
933 933
 					$this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage;
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 
1352 1352
 			if (TYPO3_DLOG) {
1353 1353
 
1354
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Could not identify document/structure type ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($metadata['type'][0], 'tx_dlf_structures'),
1354
+				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Could not identify document/structure type '.$GLOBALS['TYPO3_DB']->fullQuoteStr($metadata['type'][0], 'tx_dlf_structures'),
1355 1355
 									       self::$extKey, SYSLOG_SEVERITY_ERROR);
1356 1356
 
1357 1357
 			}
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
 
1523 1523
 			if ($parentLocation != $this->location) {
1524 1524
 
1525
-				$parentDoc =& tx_dlf_document::getInstance($parentLocation, $pid);
1525
+				$parentDoc = & tx_dlf_document::getInstance($parentLocation, $pid);
1526 1526
 
1527 1527
 				if ($parentDoc->ready) {
1528 1528
 
@@ -2436,7 +2436,7 @@  discard block
 block discarded – undo
2436 2436
 					$hookObjects = tx_dlf_helper::getHookObjects('common/class.tx_dlf_document.php');
2437 2437
 
2438 2438
 					// Apply hooks.
2439
-					foreach($hookObjects as $hookObj) {
2439
+					foreach ($hookObjects as $hookObj) {
2440 2440
 
2441 2441
 						if (method_exists($hookObj, 'construct_postProcessRecordId')) {
2442 2442
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -927,7 +927,7 @@
 block discarded – undo
927 927
 
928 928
 			foreach($this->physicalStructureInfo as $page) {
929 929
 
930
-				if(strpos($page['orderlabel'], $logicalPage) !== false){
930
+				if(strpos($page['orderlabel'], $logicalPage) !== false) {
931 931
 
932 932
 					$this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage;
933 933
 					$this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -927,7 +927,7 @@
 block discarded – undo
927 927
 
928 928
 			foreach($this->physicalStructureInfo as $page) {
929 929
 
930
-				if(strpos($page['orderlabel'], $logicalPage) !== false){
930
+				if(strpos($page['orderlabel'], $logicalPage) !== FALSE){
931 931
 
932 932
 					$this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage;
933 933
 					$this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage;
Please login to merge, or discard this patch.
common/class.tx_dlf_indexing.php 2 patches
Indentation   +553 added lines, -553 removed lines patch added patch discarded remove patch
@@ -19,860 +19,860 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_indexing {
21 21
 
22
-	/**
23
-	 * The extension key
24
-	 *
25
-	 * @var	string
26
-	 * @access public
27
-	 */
28
-	public static $extKey = 'dlf';
29
-
30
-	/**
31
-	 * Array of metadata fields' configuration
32
-	 * @see loadIndexConf()
33
-	 *
34
-	 * @var	array
35
-	 * @access protected
36
-	 */
37
-	protected static $fields = array (
38
-		'autocomplete' => array (),
39
-		'facets' => array (),
40
-		'sortables' => array (),
41
-		'indexed' => array (),
42
-		'stored' => array (),
43
-		'tokenized' => array (),
44
-		'fieldboost' => array ()
45
-	);
22
+    /**
23
+     * The extension key
24
+     *
25
+     * @var	string
26
+     * @access public
27
+     */
28
+    public static $extKey = 'dlf';
29
+
30
+    /**
31
+     * Array of metadata fields' configuration
32
+     * @see loadIndexConf()
33
+     *
34
+     * @var	array
35
+     * @access protected
36
+     */
37
+    protected static $fields = array (
38
+        'autocomplete' => array (),
39
+        'facets' => array (),
40
+        'sortables' => array (),
41
+        'indexed' => array (),
42
+        'stored' => array (),
43
+        'tokenized' => array (),
44
+        'fieldboost' => array ()
45
+    );
46 46
 
47
-	/**
48
-	 * Is the index configuration loaded?
49
-	 * @see $fields
50
-	 *
51
-	 * @var	boolean
52
-	 * @access protected
53
-	 */
54
-	protected static $fieldsLoaded = FALSE;
47
+    /**
48
+     * Is the index configuration loaded?
49
+     * @see $fields
50
+     *
51
+     * @var	boolean
52
+     * @access protected
53
+     */
54
+    protected static $fieldsLoaded = FALSE;
55 55
 
56
-	/**
57
-	 * List of already processed documents
58
-	 *
59
-	 * @var	array
60
-	 * @access protected
61
-	 */
62
-	protected static $processedDocs = array ();
56
+    /**
57
+     * List of already processed documents
58
+     *
59
+     * @var	array
60
+     * @access protected
61
+     */
62
+    protected static $processedDocs = array ();
63 63
 
64
-	/**
65
-	 * Instance of Apache_Solr_Service class
66
-	 *
67
-	 * @var	Apache_Solr_Service
68
-	 * @access protected
69
-	 */
70
-	protected static $solr;
64
+    /**
65
+     * Instance of Apache_Solr_Service class
66
+     *
67
+     * @var	Apache_Solr_Service
68
+     * @access protected
69
+     */
70
+    protected static $solr;
71 71
 
72
-	/**
73
-	 * Array of toplevel structure elements
74
-	 * @see loadIndexConf()
75
-	 *
76
-	 * @var	array
77
-	 * @access protected
78
-	 */
79
-	protected static $toplevel = array ();
72
+    /**
73
+     * Array of toplevel structure elements
74
+     * @see loadIndexConf()
75
+     *
76
+     * @var	array
77
+     * @access protected
78
+     */
79
+    protected static $toplevel = array ();
80 80
 
81
-	/**
82
-	 * Insert given document into Solr index
83
-	 *
84
-	 * @access	public
85
-	 *
86
-	 * @param	tx_dlf_document		&$doc: The document to add
87
-	 * @param	integer		$core: UID of the Solr core to use
88
-	 *
89
-	 * @return	integer		0 on success or 1 on failure
90
-	 */
91
-	public static function add(tx_dlf_document &$doc, $core = 0) {
81
+    /**
82
+     * Insert given document into Solr index
83
+     *
84
+     * @access	public
85
+     *
86
+     * @param	tx_dlf_document		&$doc: The document to add
87
+     * @param	integer		$core: UID of the Solr core to use
88
+     *
89
+     * @return	integer		0 on success or 1 on failure
90
+     */
91
+    public static function add(tx_dlf_document &$doc, $core = 0) {
92 92
 
93
-		if (in_array($doc->uid, self::$processedDocs)) {
93
+        if (in_array($doc->uid, self::$processedDocs)) {
94 94
 
95
-			return 0;
95
+            return 0;
96 96
 
97
-		} elseif (self::solrConnect($core, $doc->pid)) {
97
+        } elseif (self::solrConnect($core, $doc->pid)) {
98 98
 
99
-			$errors = 0;
99
+            $errors = 0;
100 100
 
101
-			// Handle multi-volume documents.
102
-			if ($doc->parentId) {
101
+            // Handle multi-volume documents.
102
+            if ($doc->parentId) {
103 103
 
104
-				$parent =& tx_dlf_document::getInstance($doc->parentId, 0, TRUE);
104
+                $parent =& tx_dlf_document::getInstance($doc->parentId, 0, TRUE);
105 105
 
106
-				if ($parent->ready) {
106
+                if ($parent->ready) {
107 107
 
108
-					$errors = self::add($parent, $core);
108
+                    $errors = self::add($parent, $core);
109 109
 
110
-				} else {
110
+                } else {
111 111
 
112
-					if (TYPO3_DLOG) {
112
+                    if (TYPO3_DLOG) {
113 113
 
114
-						\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Could not load parent document with UID "'.$doc->parentId.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
114
+                        \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Could not load parent document with UID "'.$doc->parentId.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
115 115
 
116
-					}
116
+                    }
117 117
 
118
-					return 1;
118
+                    return 1;
119 119
 
120
-				}
120
+                }
121 121
 
122
-			}
122
+            }
123 123
 
124
-			try {
124
+            try {
125 125
 
126
-				// Add document to list of processed documents.
127
-				self::$processedDocs[] = $doc->uid;
126
+                // Add document to list of processed documents.
127
+                self::$processedDocs[] = $doc->uid;
128 128
 
129
-				// Delete old Solr documents.
130
-				self::$solr->service->deleteByQuery('uid:'.$doc->uid);
129
+                // Delete old Solr documents.
130
+                self::$solr->service->deleteByQuery('uid:'.$doc->uid);
131 131
 
132
-				// Index every logical unit as separate Solr document.
133
-				foreach ($doc->tableOfContents as $logicalUnit) {
132
+                // Index every logical unit as separate Solr document.
133
+                foreach ($doc->tableOfContents as $logicalUnit) {
134 134
 
135
-					if (!$errors) {
135
+                    if (!$errors) {
136 136
 
137
-						$errors = self::processLogical($doc, $logicalUnit);
137
+                        $errors = self::processLogical($doc, $logicalUnit);
138 138
 
139
-					} else {
139
+                    } else {
140 140
 
141
-						break;
141
+                        break;
142 142
 
143
-					}
143
+                    }
144 144
 
145
-				}
145
+                }
146 146
 
147
-				// Index fulltext files if available.
148
-				if ($doc->hasFulltext) {
147
+                // Index fulltext files if available.
148
+                if ($doc->hasFulltext) {
149 149
 
150
-					foreach ($doc->physicalStructure as $pageNumber => $xmlId) {
150
+                    foreach ($doc->physicalStructure as $pageNumber => $xmlId) {
151 151
 
152
-						if (!$errors) {
152
+                        if (!$errors) {
153 153
 
154
-							$errors = self::processPhysical($doc, $pageNumber, $doc->physicalStructureInfo[$xmlId]);
154
+                            $errors = self::processPhysical($doc, $pageNumber, $doc->physicalStructureInfo[$xmlId]);
155 155
 
156
-						} else {
156
+                        } else {
157 157
 
158
-							break;
158
+                            break;
159 159
 
160
-						}
160
+                        }
161 161
 
162
-					}
162
+                    }
163 163
 
164
-				}
164
+                }
165 165
 
166
-				self::$solr->service->commit();
166
+                self::$solr->service->commit();
167 167
 
168
-				// Get document title from database.
169
-				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
170
-					'tx_dlf_documents.title AS title',
171
-					'tx_dlf_documents',
172
-					'tx_dlf_documents.uid='.intval($doc->uid).tx_dlf_helper::whereClause('tx_dlf_documents'),
173
-					'',
174
-					'',
175
-					'1'
176
-				);
168
+                // Get document title from database.
169
+                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
170
+                    'tx_dlf_documents.title AS title',
171
+                    'tx_dlf_documents',
172
+                    'tx_dlf_documents.uid='.intval($doc->uid).tx_dlf_helper::whereClause('tx_dlf_documents'),
173
+                    '',
174
+                    '',
175
+                    '1'
176
+                );
177 177
 
178
-				$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
178
+                $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
179 179
 
180
-				if (!defined('TYPO3_cliMode')) {
180
+                if (!defined('TYPO3_cliMode')) {
181 181
 
182
-					if (!$errors) {
182
+                    if (!$errors) {
183 183
 
184
-						$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
185
-							'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
186
-							htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentIndexed'), $resArray['title'], $doc->uid)),
187
-							tx_dlf_helper::getLL('flash.done', TRUE),
188
-							\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
189
-							TRUE
190
-						);
184
+                        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
185
+                            'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
186
+                            htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentIndexed'), $resArray['title'], $doc->uid)),
187
+                            tx_dlf_helper::getLL('flash.done', TRUE),
188
+                            \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
189
+                            TRUE
190
+                        );
191 191
 
192
-					} else {
192
+                    } else {
193 193
 
194
-						$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
195
-							'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
196
-							htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentNotIndexed'), $resArray['title'], $doc->uid)),
197
-							tx_dlf_helper::getLL('flash.error', TRUE),
198
-							\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
199
-							TRUE
200
-						);
194
+                        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
195
+                            'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
196
+                            htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentNotIndexed'), $resArray['title'], $doc->uid)),
197
+                            tx_dlf_helper::getLL('flash.error', TRUE),
198
+                            \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
199
+                            TRUE
200
+                        );
201 201
 
202
-					}
202
+                    }
203 203
 
204
-					tx_dlf_helper::addMessage($message);
204
+                    tx_dlf_helper::addMessage($message);
205 205
 
206
-				}
206
+                }
207 207
 
208
-				return $errors;
208
+                return $errors;
209 209
 
210
-			} catch (Exception $e) {
210
+            } catch (Exception $e) {
211 211
 
212
-				if (!defined('TYPO3_cliMode')) {
212
+                if (!defined('TYPO3_cliMode')) {
213 213
 
214
-					$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
215
-						'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
216
-						tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
217
-						tx_dlf_helper::getLL('flash.error', TRUE),
218
-						\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
219
-						TRUE
220
-					);
214
+                    $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
215
+                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
216
+                        tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
217
+                        tx_dlf_helper::getLL('flash.error', TRUE),
218
+                        \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
219
+                        TRUE
220
+                    );
221 221
 
222
-					tx_dlf_helper::addMessage($message);
222
+                    tx_dlf_helper::addMessage($message);
223 223
 
224
-				}
224
+                }
225 225
 
226
-				if (TYPO3_DLOG) {
226
+                if (TYPO3_DLOG) {
227 227
 
228
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Apache Solr threw exception: "'.$e->getMessage().'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
228
+                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Apache Solr threw exception: "'.$e->getMessage().'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
229 229
 
230
-				}
230
+                }
231 231
 
232
-				return 1;
232
+                return 1;
233 233
 
234
-			}
234
+            }
235 235
 
236
-		} else {
236
+        } else {
237 237
 
238
-			if (!defined('TYPO3_cliMode')) {
238
+            if (!defined('TYPO3_cliMode')) {
239 239
 
240
-				$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
241
-					'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
242
-					tx_dlf_helper::getLL('flash.solrNoConnection', TRUE),
243
-					tx_dlf_helper::getLL('flash.warning', TRUE),
244
-					\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
245
-					TRUE
246
-				);
240
+                $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
241
+                    'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
242
+                    tx_dlf_helper::getLL('flash.solrNoConnection', TRUE),
243
+                    tx_dlf_helper::getLL('flash.warning', TRUE),
244
+                    \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
245
+                    TRUE
246
+                );
247 247
 
248
-				tx_dlf_helper::addMessage($message);
248
+                tx_dlf_helper::addMessage($message);
249 249
 
250
-			}
250
+            }
251 251
 
252
-			if (TYPO3_DLOG) {
252
+            if (TYPO3_DLOG) {
253 253
 
254
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR);
254
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR);
255 255
 
256
-			}
256
+            }
257 257
 
258
-			return 1;
258
+            return 1;
259 259
 
260
-		}
260
+        }
261 261
 
262
-	}
262
+    }
263 263
 
264
-	/**
265
-	 * Delete document from Solr index
266
-	 *
267
-	 * @access	public
268
-	 *
269
-	 * @param	integer		$uid: UID of the document to delete
270
-	 *
271
-	 * @return	integer		0 on success or 1 on failure
272
-	 */
273
-	public static function delete($uid) {
264
+    /**
265
+     * Delete document from Solr index
266
+     *
267
+     * @access	public
268
+     *
269
+     * @param	integer		$uid: UID of the document to delete
270
+     *
271
+     * @return	integer		0 on success or 1 on failure
272
+     */
273
+    public static function delete($uid) {
274 274
 
275
-		// Save parameter for logging purposes.
276
-		$_uid = $uid;
275
+        // Save parameter for logging purposes.
276
+        $_uid = $uid;
277 277
 
278
-		// Sanitize input.
279
-		$uid = max(intval($uid), 0);
278
+        // Sanitize input.
279
+        $uid = max(intval($uid), 0);
280 280
 
281
-		// Get Solr core for document.
282
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
283
-			'tx_dlf_solrcores.uid AS uid,tx_dlf_documents.title AS title',
284
-			'tx_dlf_solrcores,tx_dlf_documents',
285
-			'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.$uid.tx_dlf_helper::whereClause('tx_dlf_solrcores'),
286
-			'',
287
-			'',
288
-			'1'
289
-		);
281
+        // Get Solr core for document.
282
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
283
+            'tx_dlf_solrcores.uid AS uid,tx_dlf_documents.title AS title',
284
+            'tx_dlf_solrcores,tx_dlf_documents',
285
+            'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.$uid.tx_dlf_helper::whereClause('tx_dlf_solrcores'),
286
+            '',
287
+            '',
288
+            '1'
289
+        );
290 290
 
291
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
291
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
292 292
 
293
-			list ($core, $title) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
293
+            list ($core, $title) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
294 294
 
295
-			// Establish Solr connection.
296
-			if (self::solrConnect($core)) {
295
+            // Establish Solr connection.
296
+            if (self::solrConnect($core)) {
297 297
 
298
-				try {
298
+                try {
299 299
 
300
-					// Delete Solr document.
301
-					self::$solr->service->deleteByQuery('uid:'.$uid);
300
+                    // Delete Solr document.
301
+                    self::$solr->service->deleteByQuery('uid:'.$uid);
302 302
 
303
-					self::$solr->service->commit();
303
+                    self::$solr->service->commit();
304 304
 
305
-				} catch (Exception $e) {
305
+                } catch (Exception $e) {
306 306
 
307
-					if (!defined('TYPO3_cliMode')) {
307
+                    if (!defined('TYPO3_cliMode')) {
308 308
 
309
-						$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
310
-							'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
311
-							tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
312
-							tx_dlf_helper::getLL('flash.error', TRUE),
313
-							\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
314
-							TRUE
315
-						);
309
+                        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
310
+                            'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
311
+                            tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
312
+                            tx_dlf_helper::getLL('flash.error', TRUE),
313
+                            \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
314
+                            TRUE
315
+                        );
316 316
 
317
-						tx_dlf_helper::addMessage($message);
317
+                        tx_dlf_helper::addMessage($message);
318 318
 
319
-					}
319
+                    }
320 320
 
321
-					if (TYPO3_DLOG) {
321
+                    if (TYPO3_DLOG) {
322 322
 
323
-						\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->delete('.$_uid.')] Apache Solr threw exception: "'.$e->getMessage().'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
323
+                        \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->delete('.$_uid.')] Apache Solr threw exception: "'.$e->getMessage().'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
324 324
 
325
-					}
325
+                    }
326 326
 
327
-					return 1;
327
+                    return 1;
328 328
 
329
-				}
329
+                }
330 330
 
331
-			} else {
331
+            } else {
332 332
 
333
-				if (!defined('TYPO3_cliMode')) {
333
+                if (!defined('TYPO3_cliMode')) {
334 334
 
335
-					$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
336
-						'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
337
-						tx_dlf_helper::getLL('flash.solrNoConnection', TRUE),
338
-						tx_dlf_helper::getLL('flash.error', TRUE),
339
-						\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
340
-						TRUE
341
-					);
335
+                    $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
336
+                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
337
+                        tx_dlf_helper::getLL('flash.solrNoConnection', TRUE),
338
+                        tx_dlf_helper::getLL('flash.error', TRUE),
339
+                        \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
340
+                        TRUE
341
+                    );
342 342
 
343
-					tx_dlf_helper::addMessage($message);
343
+                    tx_dlf_helper::addMessage($message);
344 344
 
345
-				}
345
+                }
346 346
 
347
-				if (TYPO3_DLOG) {
347
+                if (TYPO3_DLOG) {
348 348
 
349
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->delete('.$_uid.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR);
349
+                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->delete('.$_uid.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR);
350 350
 
351
-				}
351
+                }
352 352
 
353
-				return 1;
353
+                return 1;
354 354
 
355
-			}
355
+            }
356 356
 
357
-			if (!defined('TYPO3_cliMode')) {
357
+            if (!defined('TYPO3_cliMode')) {
358 358
 
359
-				$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
360
-					'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
361
-					htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentDeleted'), $title, $uid)),
362
-					tx_dlf_helper::getLL('flash.done', TRUE),
363
-					\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
364
-					TRUE
365
-				);
359
+                $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
360
+                    'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
361
+                    htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentDeleted'), $title, $uid)),
362
+                    tx_dlf_helper::getLL('flash.done', TRUE),
363
+                    \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
364
+                    TRUE
365
+                );
366 366
 
367
-				tx_dlf_helper::addMessage($message);
367
+                tx_dlf_helper::addMessage($message);
368 368
 
369
-			}
369
+            }
370 370
 
371
-			return 0;
371
+            return 0;
372 372
 
373
-		} else {
373
+        } else {
374 374
 
375
-			if (TYPO3_DLOG) {
375
+            if (TYPO3_DLOG) {
376 376
 
377
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->delete('.$_uid.')] Invalid UID "'.$uid.'" for document deletion', self::$extKey, SYSLOG_SEVERITY_ERROR);
377
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->delete('.$_uid.')] Invalid UID "'.$uid.'" for document deletion', self::$extKey, SYSLOG_SEVERITY_ERROR);
378 378
 
379
-			}
379
+            }
380 380
 
381
-			return 1;
381
+            return 1;
382 382
 
383
-		}
383
+        }
384 384
 
385
-	}
385
+    }
386 386
 
387
-	/**
388
-	 * Returns the dynamic index field name for the given metadata field.
389
-	 *
390
-	 * @access	public
391
-	 *
392
-	 * @param	string		$index_name: The metadata field's name in database
393
-	 * @param	integer		$pid: UID of the configuration page
394
-	 *
395
-	 * @return	string		The field's dynamic index name
396
-	 */
397
-	public static function getIndexFieldName($index_name, $pid = 0) {
387
+    /**
388
+     * Returns the dynamic index field name for the given metadata field.
389
+     *
390
+     * @access	public
391
+     *
392
+     * @param	string		$index_name: The metadata field's name in database
393
+     * @param	integer		$pid: UID of the configuration page
394
+     *
395
+     * @return	string		The field's dynamic index name
396
+     */
397
+    public static function getIndexFieldName($index_name, $pid = 0) {
398 398
 
399
-		// Save parameter for logging purposes.
400
-		$_pid = $pid;
399
+        // Save parameter for logging purposes.
400
+        $_pid = $pid;
401 401
 
402
-		// Sanitize input.
403
-		$pid = max(intval($pid), 0);
402
+        // Sanitize input.
403
+        $pid = max(intval($pid), 0);
404 404
 
405
-		if (!$pid) {
405
+        if (!$pid) {
406 406
 
407
-			if (TYPO3_DLOG) {
407
+            if (TYPO3_DLOG) {
408 408
 
409
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->getIndexFieldName('.$index_name.', '.$_pid.')] Invalid PID "'.$pid.'" for metadata configuration', self::$extKey, SYSLOG_SEVERITY_ERROR);
409
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->getIndexFieldName('.$index_name.', '.$_pid.')] Invalid PID "'.$pid.'" for metadata configuration', self::$extKey, SYSLOG_SEVERITY_ERROR);
410 410
 
411
-			}
411
+            }
412 412
 
413
-			return '';
413
+            return '';
414 414
 
415
-		}
415
+        }
416 416
 
417
-		// Load metadata configuration.
418
-		self::loadIndexConf($pid);
417
+        // Load metadata configuration.
418
+        self::loadIndexConf($pid);
419 419
 
420
-		// Build field's suffix.
421
-		$suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u');
420
+        // Build field's suffix.
421
+        $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u');
422 422
 
423
-		$suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u');
423
+        $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u');
424 424
 
425
-		$suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u');
425
+        $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u');
426 426
 
427
-		$index_name .= '_'.$suffix;
427
+        $index_name .= '_'.$suffix;
428 428
 
429
-		return $index_name;
429
+        return $index_name;
430 430
 
431
-	}
431
+    }
432 432
 
433
-	/**
434
-	 * Load indexing configuration
435
-	 *
436
-	 * @access	protected
437
-	 *
438
-	 * @param	integer		$pid: The configuration page's UID
439
-	 *
440
-	 * @return	void
441
-	 */
442
-	protected static function loadIndexConf($pid) {
433
+    /**
434
+     * Load indexing configuration
435
+     *
436
+     * @access	protected
437
+     *
438
+     * @param	integer		$pid: The configuration page's UID
439
+     *
440
+     * @return	void
441
+     */
442
+    protected static function loadIndexConf($pid) {
443 443
 
444
-		if (!self::$fieldsLoaded) {
444
+        if (!self::$fieldsLoaded) {
445 445
 
446
-			// Get the list of toplevel structures.
447
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
448
-				'tx_dlf_structures.index_name AS index_name',
449
-				'tx_dlf_structures',
450
-				'tx_dlf_structures.toplevel=1 AND tx_dlf_structures.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_structures'),
451
-				'',
452
-				'',
453
-				''
454
-			);
446
+            // Get the list of toplevel structures.
447
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
448
+                'tx_dlf_structures.index_name AS index_name',
449
+                'tx_dlf_structures',
450
+                'tx_dlf_structures.toplevel=1 AND tx_dlf_structures.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_structures'),
451
+                '',
452
+                '',
453
+                ''
454
+            );
455 455
 
456
-			while ($toplevel = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
456
+            while ($toplevel = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
457 457
 
458
-				self::$toplevel[] = $toplevel['index_name'];
458
+                self::$toplevel[] = $toplevel['index_name'];
459 459
 
460
-			}
460
+            }
461 461
 
462
-			// Get the metadata indexing options.
463
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
464
-				'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.index_tokenized AS index_tokenized,tx_dlf_metadata.index_stored AS index_stored,tx_dlf_metadata.index_indexed AS index_indexed,tx_dlf_metadata.is_sortable AS is_sortable,tx_dlf_metadata.is_facet AS is_facet,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.index_autocomplete AS index_autocomplete,tx_dlf_metadata.index_boost AS index_boost',
465
-				'tx_dlf_metadata',
466
-				'tx_dlf_metadata.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_metadata'),
467
-				'',
468
-				'',
469
-				''
470
-			);
462
+            // Get the metadata indexing options.
463
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
464
+                'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.index_tokenized AS index_tokenized,tx_dlf_metadata.index_stored AS index_stored,tx_dlf_metadata.index_indexed AS index_indexed,tx_dlf_metadata.is_sortable AS is_sortable,tx_dlf_metadata.is_facet AS is_facet,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.index_autocomplete AS index_autocomplete,tx_dlf_metadata.index_boost AS index_boost',
465
+                'tx_dlf_metadata',
466
+                'tx_dlf_metadata.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_metadata'),
467
+                '',
468
+                '',
469
+                ''
470
+            );
471 471
 
472
-			while ($indexing = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
472
+            while ($indexing = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
473 473
 
474
-				if ($indexing['index_tokenized']) {
474
+                if ($indexing['index_tokenized']) {
475 475
 
476
-					self::$fields['tokenized'][] = $indexing['index_name'];
476
+                    self::$fields['tokenized'][] = $indexing['index_name'];
477 477
 
478
-				}
478
+                }
479 479
 
480
-				if ($indexing['index_stored'] || $indexing['is_listed']) {
480
+                if ($indexing['index_stored'] || $indexing['is_listed']) {
481 481
 
482
-					self::$fields['stored'][] = $indexing['index_name'];
482
+                    self::$fields['stored'][] = $indexing['index_name'];
483 483
 
484
-				}
484
+                }
485 485
 
486
-				if ($indexing['index_indexed'] || $indexing['index_autocomplete']) {
486
+                if ($indexing['index_indexed'] || $indexing['index_autocomplete']) {
487 487
 
488
-					self::$fields['indexed'][] = $indexing['index_name'];
488
+                    self::$fields['indexed'][] = $indexing['index_name'];
489 489
 
490
-				}
490
+                }
491 491
 
492
-				if ($indexing['is_sortable']) {
492
+                if ($indexing['is_sortable']) {
493 493
 
494
-					self::$fields['sortables'][] = $indexing['index_name'];
494
+                    self::$fields['sortables'][] = $indexing['index_name'];
495 495
 
496
-				}
496
+                }
497 497
 
498
-				if ($indexing['is_facet']) {
498
+                if ($indexing['is_facet']) {
499 499
 
500
-					self::$fields['facets'][] = $indexing['index_name'];
500
+                    self::$fields['facets'][] = $indexing['index_name'];
501 501
 
502
-				}
502
+                }
503 503
 
504
-				if ($indexing['index_autocomplete']) {
504
+                if ($indexing['index_autocomplete']) {
505 505
 
506
-					self::$fields['autocomplete'][] = $indexing['index_name'];
506
+                    self::$fields['autocomplete'][] = $indexing['index_name'];
507 507
 
508
-				}
508
+                }
509 509
 
510
-				if ($indexing['index_boost'] > 0.0) {
510
+                if ($indexing['index_boost'] > 0.0) {
511 511
 
512
-					self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']);
512
+                    self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']);
513 513
 
514
-				} else {
514
+                } else {
515 515
 
516
-					self::$fields['fieldboost'][$indexing['index_name']] = FALSE;
516
+                    self::$fields['fieldboost'][$indexing['index_name']] = FALSE;
517 517
 
518
-				}
518
+                }
519 519
 
520
-			}
520
+            }
521 521
 
522
-			self::$fieldsLoaded = TRUE;
522
+            self::$fieldsLoaded = TRUE;
523 523
 
524
-		}
524
+        }
525 525
 
526
-	}
526
+    }
527 527
 
528
-	/**
529
-	 * Processes a logical unit (and its children) for the Solr index
530
-	 *
531
-	 * @access	protected
532
-	 *
533
-	 * @param	tx_dlf_document		&$doc: The METS document
534
-	 * @param	array		$logicalUnit: Array of the logical unit to process
535
-	 *
536
-	 * @return	integer		0 on success or 1 on failure
537
-	 */
538
-	protected static function processLogical(tx_dlf_document &$doc, array $logicalUnit) {
528
+    /**
529
+     * Processes a logical unit (and its children) for the Solr index
530
+     *
531
+     * @access	protected
532
+     *
533
+     * @param	tx_dlf_document		&$doc: The METS document
534
+     * @param	array		$logicalUnit: Array of the logical unit to process
535
+     *
536
+     * @return	integer		0 on success or 1 on failure
537
+     */
538
+    protected static function processLogical(tx_dlf_document &$doc, array $logicalUnit) {
539 539
 
540
-		$errors = 0;
540
+        $errors = 0;
541 541
 
542
-		// Get metadata for logical unit.
543
-		$metadata = $doc->metadataArray[$logicalUnit['id']];
542
+        // Get metadata for logical unit.
543
+        $metadata = $doc->metadataArray[$logicalUnit['id']];
544 544
 
545
-		if (!empty($metadata)) {
545
+        if (!empty($metadata)) {
546 546
 
547
-			// Load class.
548
-			if (!class_exists('Apache_Solr_Document')) {
547
+            // Load class.
548
+            if (!class_exists('Apache_Solr_Document')) {
549 549
 
550
-				require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Document.php'));
550
+                require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Document.php'));
551 551
 
552
-			}
552
+            }
553 553
 
554
-			// Create new Solr document.
555
-			$solrDoc = new Apache_Solr_Document();
554
+            // Create new Solr document.
555
+            $solrDoc = new Apache_Solr_Document();
556 556
 
557
-			// Create unique identifier from document's UID and unit's XML ID.
558
-			$solrDoc->setField('id', $doc->uid.$logicalUnit['id']);
557
+            // Create unique identifier from document's UID and unit's XML ID.
558
+            $solrDoc->setField('id', $doc->uid.$logicalUnit['id']);
559 559
 
560
-			$solrDoc->setField('uid', $doc->uid);
560
+            $solrDoc->setField('uid', $doc->uid);
561 561
 
562
-			$solrDoc->setField('pid', $doc->pid);
562
+            $solrDoc->setField('pid', $doc->pid);
563 563
 
564
-			if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($logicalUnit['points'])) {
564
+            if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($logicalUnit['points'])) {
565 565
 
566
-				$solrDoc->setField('page', $logicalUnit['points']);
566
+                $solrDoc->setField('page', $logicalUnit['points']);
567 567
 
568
-			}
568
+            }
569 569
 
570
-			if ($logicalUnit['id'] == $doc->toplevelId) {
570
+            if ($logicalUnit['id'] == $doc->toplevelId) {
571 571
 
572
-				$solrDoc->setField('thumbnail', $doc->thumbnail);
572
+                $solrDoc->setField('thumbnail', $doc->thumbnail);
573 573
 
574
-			} elseif (!empty($logicalUnit['thumbnailId'])) {
574
+            } elseif (!empty($logicalUnit['thumbnailId'])) {
575 575
 
576
-				$solrDoc->setField('thumbnail', $doc->getFileLocation($logicalUnit['thumbnailId']));
576
+                $solrDoc->setField('thumbnail', $doc->getFileLocation($logicalUnit['thumbnailId']));
577 577
 
578
-			}
578
+            }
579 579
 
580
-			$solrDoc->setField('partof', $doc->parentId);
580
+            $solrDoc->setField('partof', $doc->parentId);
581 581
 
582
-			$solrDoc->setField('root', $doc->rootId);
582
+            $solrDoc->setField('root', $doc->rootId);
583 583
 
584
-			$solrDoc->setField('sid', $logicalUnit['id']);
584
+            $solrDoc->setField('sid', $logicalUnit['id']);
585 585
 
586
-			$solrDoc->setField('toplevel', in_array($logicalUnit['type'], self::$toplevel));
586
+            $solrDoc->setField('toplevel', in_array($logicalUnit['type'], self::$toplevel));
587 587
 
588
-			$solrDoc->setField('type', $logicalUnit['type'], self::$fields['fieldboost']['type']);
588
+            $solrDoc->setField('type', $logicalUnit['type'], self::$fields['fieldboost']['type']);
589 589
 
590
-			$solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']);
590
+            $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']);
591 591
 
592
-			$solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']);
592
+            $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']);
593 593
 
594
-			$autocomplete = array ();
594
+            $autocomplete = array ();
595 595
 
596
-			foreach ($metadata as $index_name => $data) {
596
+            foreach ($metadata as $index_name => $data) {
597 597
 
598
-				if (!empty($data) && substr($index_name, -8) !== '_sorting') {
598
+                if (!empty($data) && substr($index_name, -8) !== '_sorting') {
599 599
 
600
-					$solrDoc->setField(self::getIndexFieldName($index_name, $doc->pid), $data, self::$fields['fieldboost'][$index_name]);
600
+                    $solrDoc->setField(self::getIndexFieldName($index_name, $doc->pid), $data, self::$fields['fieldboost'][$index_name]);
601 601
 
602
-					if (in_array($index_name, self::$fields['sortables'])) {
602
+                    if (in_array($index_name, self::$fields['sortables'])) {
603 603
 
604
-						// Add sortable fields to index.
605
-						$solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]);
604
+                        // Add sortable fields to index.
605
+                        $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]);
606 606
 
607
-					}
607
+                    }
608 608
 
609
-					if (in_array($index_name, self::$fields['facets'])) {
609
+                    if (in_array($index_name, self::$fields['facets'])) {
610 610
 
611
-						// Add facets to index.
612
-						$solrDoc->setField($index_name.'_faceting', $data);
611
+                        // Add facets to index.
612
+                        $solrDoc->setField($index_name.'_faceting', $data);
613 613
 
614
-					}
614
+                    }
615 615
 
616
-					if (in_array($index_name, self::$fields['autocomplete'])) {
616
+                    if (in_array($index_name, self::$fields['autocomplete'])) {
617 617
 
618
-						$autocomplete = array_merge($autocomplete, $data);
618
+                        $autocomplete = array_merge($autocomplete, $data);
619 619
 
620
-					}
620
+                    }
621 621
 
622
-				}
622
+                }
623 623
 
624
-			}
624
+            }
625 625
 
626
-			// Add autocomplete values to index.
627
-			if (!empty($autocomplete)) {
626
+            // Add autocomplete values to index.
627
+            if (!empty($autocomplete)) {
628 628
 
629
-				$solrDoc->setField('autocomplete', $autocomplete);
629
+                $solrDoc->setField('autocomplete', $autocomplete);
630 630
 
631
-			}
631
+            }
632 632
 
633
-			// Add collection information to logical sub-elements if applicable.
634
-			if (in_array('collection', self::$fields['facets'])
635
-				&& empty($metadata['collection'])
636
-				&& !empty($doc->metadataArray[$doc->toplevelId]['collection'])) {
633
+            // Add collection information to logical sub-elements if applicable.
634
+            if (in_array('collection', self::$fields['facets'])
635
+                && empty($metadata['collection'])
636
+                && !empty($doc->metadataArray[$doc->toplevelId]['collection'])) {
637 637
 
638
-				$solrDoc->setField('collection_faceting', $doc->metadataArray[$doc->toplevelId]['collection']);
638
+                $solrDoc->setField('collection_faceting', $doc->metadataArray[$doc->toplevelId]['collection']);
639 639
 
640
-			}
640
+            }
641 641
 
642
-			try {
642
+            try {
643 643
 
644
-				self::$solr->service->addDocument($solrDoc);
644
+                self::$solr->service->addDocument($solrDoc);
645 645
 
646
-			} catch (Exception $e) {
646
+            } catch (Exception $e) {
647 647
 
648
-				if (!defined('TYPO3_cliMode')) {
648
+                if (!defined('TYPO3_cliMode')) {
649 649
 
650
-					$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
651
-						'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
652
-						tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
653
-						tx_dlf_helper::getLL('flash.error', TRUE),
654
-						\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
655
-						TRUE
656
-					);
650
+                    $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
651
+                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
652
+                        tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
653
+                        tx_dlf_helper::getLL('flash.error', TRUE),
654
+                        \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
655
+                        TRUE
656
+                    );
657 657
 
658
-					tx_dlf_helper::addMessage($message);
658
+                    tx_dlf_helper::addMessage($message);
659 659
 
660
-				}
660
+                }
661 661
 
662
-				return 1;
662
+                return 1;
663 663
 
664
-			}
664
+            }
665 665
 
666
-		}
666
+        }
667 667
 
668
-		// Check for child elements...
669
-		if (!empty($logicalUnit['children'])) {
668
+        // Check for child elements...
669
+        if (!empty($logicalUnit['children'])) {
670 670
 
671
-			foreach ($logicalUnit['children'] as $child) {
671
+            foreach ($logicalUnit['children'] as $child) {
672 672
 
673
-				if (!$errors) {
673
+                if (!$errors) {
674 674
 
675
-					// ...and process them, too.
676
-					$errors = self::processLogical($doc, $child);
675
+                    // ...and process them, too.
676
+                    $errors = self::processLogical($doc, $child);
677 677
 
678
-				} else {
678
+                } else {
679 679
 
680
-					break;
680
+                    break;
681 681
 
682
-				}
682
+                }
683 683
 
684
-			}
684
+            }
685 685
 
686
-		}
686
+        }
687 687
 
688
-		return $errors;
688
+        return $errors;
689 689
 
690
-	}
690
+    }
691 691
 
692
-	/**
693
-	 * Processes a physical unit for the Solr index
694
-	 *
695
-	 * @access	protected
696
-	 *
697
-	 * @param	tx_dlf_document		&$doc: The METS document
698
-	 * @param	integer		$page: The page number
699
-	 * @param	array		$physicalUnit: Array of the physical unit to process
700
-	 *
701
-	 * @return	integer		0 on success or 1 on failure
702
-	 */
703
-	protected static function processPhysical(tx_dlf_document &$doc, $page, array $physicalUnit) {
692
+    /**
693
+     * Processes a physical unit for the Solr index
694
+     *
695
+     * @access	protected
696
+     *
697
+     * @param	tx_dlf_document		&$doc: The METS document
698
+     * @param	integer		$page: The page number
699
+     * @param	array		$physicalUnit: Array of the physical unit to process
700
+     *
701
+     * @return	integer		0 on success or 1 on failure
702
+     */
703
+    protected static function processPhysical(tx_dlf_document &$doc, $page, array $physicalUnit) {
704 704
 
705
-		$errors = 0;
705
+        $errors = 0;
706 706
 
707
-		// Read extension configuration.
708
-		$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
707
+        // Read extension configuration.
708
+        $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
709 709
 
710
-		if (!empty($physicalUnit['files'][$extConf['fileGrpFulltext']])) {
710
+        if (!empty($physicalUnit['files'][$extConf['fileGrpFulltext']])) {
711 711
 
712
-			$file = $doc->getFileLocation($physicalUnit['files'][$extConf['fileGrpFulltext']]);
712
+            $file = $doc->getFileLocation($physicalUnit['files'][$extConf['fileGrpFulltext']]);
713 713
 
714
-			// Load XML file.
715
-			if (\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($file)) {
714
+            // Load XML file.
715
+            if (\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($file)) {
716 716
 
717
-				// Set user-agent to identify self when fetching XML data.
718
-				if (!empty($extConf['useragent'])) {
717
+                // Set user-agent to identify self when fetching XML data.
718
+                if (!empty($extConf['useragent'])) {
719 719
 
720
-					@ini_set('user_agent', $extConf['useragent']);
720
+                    @ini_set('user_agent', $extConf['useragent']);
721 721
 
722
-				}
722
+                }
723 723
 
724
-				// Turn off libxml's error logging.
725
-				$libxmlErrors = libxml_use_internal_errors(TRUE);
724
+                // Turn off libxml's error logging.
725
+                $libxmlErrors = libxml_use_internal_errors(TRUE);
726 726
 
727
-				// disable entity loading
728
-				$previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE);
727
+                // disable entity loading
728
+                $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE);
729 729
 
730
-				// Load XML from file.
731
-				$xml = simplexml_load_string(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($file));
730
+                // Load XML from file.
731
+                $xml = simplexml_load_string(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($file));
732 732
 
733
-				// reset entity loader setting
734
-				libxml_disable_entity_loader($previousValueOfEntityLoader);
733
+                // reset entity loader setting
734
+                libxml_disable_entity_loader($previousValueOfEntityLoader);
735 735
 
736
-				// Reset libxml's error logging.
737
-				libxml_use_internal_errors($libxmlErrors);
736
+                // Reset libxml's error logging.
737
+                libxml_use_internal_errors($libxmlErrors);
738 738
 
739
-				if ($xml === FALSE) {
739
+                if ($xml === FALSE) {
740 740
 
741
-					return 1;
741
+                    return 1;
742 742
 
743
-				}
743
+                }
744 744
 
745
-			} else {
745
+            } else {
746 746
 
747
-				return 1;
747
+                return 1;
748 748
 
749
-			}
749
+            }
750 750
 
751
-			// Load class.
752
-			if (!class_exists('Apache_Solr_Document')) {
751
+            // Load class.
752
+            if (!class_exists('Apache_Solr_Document')) {
753 753
 
754
-				require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Document.php'));
754
+                require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Document.php'));
755 755
 
756
-			}
756
+            }
757 757
 
758
-			// Create new Solr document.
759
-			$solrDoc = new Apache_Solr_Document();
758
+            // Create new Solr document.
759
+            $solrDoc = new Apache_Solr_Document();
760 760
 
761
-			// Create unique identifier from document's UID and unit's XML ID.
762
-			$solrDoc->setField('id', $doc->uid.$physicalUnit['id']);
761
+            // Create unique identifier from document's UID and unit's XML ID.
762
+            $solrDoc->setField('id', $doc->uid.$physicalUnit['id']);
763 763
 
764
-			$solrDoc->setField('uid', $doc->uid);
764
+            $solrDoc->setField('uid', $doc->uid);
765 765
 
766
-			$solrDoc->setField('pid', $doc->pid);
766
+            $solrDoc->setField('pid', $doc->pid);
767 767
 
768
-			$solrDoc->setField('page', $page);
768
+            $solrDoc->setField('page', $page);
769 769
 
770
-			if (!empty($physicalUnit['files'][$extConf['fileGrpThumbs']])) {
770
+            if (!empty($physicalUnit['files'][$extConf['fileGrpThumbs']])) {
771 771
 
772
-				$solrDoc->setField('thumbnail', $doc->getFileLocation($physicalUnit['files'][$extConf['fileGrpThumbs']]));
772
+                $solrDoc->setField('thumbnail', $doc->getFileLocation($physicalUnit['files'][$extConf['fileGrpThumbs']]));
773 773
 
774
-			}
774
+            }
775 775
 
776
-			$solrDoc->setField('partof', $doc->parentId);
776
+            $solrDoc->setField('partof', $doc->parentId);
777 777
 
778
-			$solrDoc->setField('root', $doc->rootId);
778
+            $solrDoc->setField('root', $doc->rootId);
779 779
 
780
-			$solrDoc->setField('sid', $physicalUnit['id']);
780
+            $solrDoc->setField('sid', $physicalUnit['id']);
781 781
 
782
-			$solrDoc->setField('toplevel', FALSE);
782
+            $solrDoc->setField('toplevel', FALSE);
783 783
 
784
-			$solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']);
784
+            $solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']);
785 785
 
786
-			$solrDoc->setField('fulltext', tx_dlf_alto::getRawText($xml));
786
+            $solrDoc->setField('fulltext', tx_dlf_alto::getRawText($xml));
787 787
 
788
-			// Add faceting information to physical sub-elements if applicable.
789
-			foreach ($doc->metadataArray[$doc->toplevelId] as $index_name => $data) {
788
+            // Add faceting information to physical sub-elements if applicable.
789
+            foreach ($doc->metadataArray[$doc->toplevelId] as $index_name => $data) {
790 790
 
791
-				if (!empty($data) && substr($index_name, -8) !== '_sorting') {
791
+                if (!empty($data) && substr($index_name, -8) !== '_sorting') {
792 792
 
793
-					if (in_array($index_name, self::$fields['facets'])) {
793
+                    if (in_array($index_name, self::$fields['facets'])) {
794 794
 
795
-						// Add facets to index.
796
-						$solrDoc->setField($index_name.'_faceting', $data);
795
+                        // Add facets to index.
796
+                        $solrDoc->setField($index_name.'_faceting', $data);
797 797
 
798
-					}
798
+                    }
799 799
 
800
-				}
800
+                }
801 801
 
802
-			}
802
+            }
803 803
 
804
-			try {
804
+            try {
805 805
 
806
-				self::$solr->service->addDocument($solrDoc);
806
+                self::$solr->service->addDocument($solrDoc);
807 807
 
808
-			} catch (Exception $e) {
808
+            } catch (Exception $e) {
809 809
 
810
-				if (!defined('TYPO3_cliMode')) {
810
+                if (!defined('TYPO3_cliMode')) {
811 811
 
812
-					$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
813
-						'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
814
-						tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
815
-						tx_dlf_helper::getLL('flash.error', TRUE),
816
-						\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
817
-						TRUE
818
-					);
812
+                    $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
813
+                        'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
814
+                        tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
815
+                        tx_dlf_helper::getLL('flash.error', TRUE),
816
+                        \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
817
+                        TRUE
818
+                    );
819 819
 
820
-					tx_dlf_helper::addMessage($message);
820
+                    tx_dlf_helper::addMessage($message);
821 821
 
822
-				}
822
+                }
823 823
 
824
-				return 1;
824
+                return 1;
825 825
 
826
-			}
826
+            }
827 827
 
828
-		}
828
+        }
829 829
 
830
-		return $errors;
830
+        return $errors;
831 831
 
832
-	}
832
+    }
833 833
 
834
-	/**
835
-	 * Connects to Solr server.
836
-	 *
837
-	 * @access	protected
838
-	 *
839
-	 * @param	integer		$core: UID of the Solr core
840
-	 * @param	integer		$pid: UID of the configuration page
841
-	 *
842
-	 * @return	boolean		TRUE on success or FALSE on failure
843
-	 */
844
-	protected static function solrConnect($core, $pid = 0) {
834
+    /**
835
+     * Connects to Solr server.
836
+     *
837
+     * @access	protected
838
+     *
839
+     * @param	integer		$core: UID of the Solr core
840
+     * @param	integer		$pid: UID of the configuration page
841
+     *
842
+     * @return	boolean		TRUE on success or FALSE on failure
843
+     */
844
+    protected static function solrConnect($core, $pid = 0) {
845 845
 
846
-		// Get Solr instance.
847
-		if (!self::$solr) {
846
+        // Get Solr instance.
847
+        if (!self::$solr) {
848 848
 
849
-			// Connect to Solr server.
850
-			if (self::$solr = tx_dlf_solr::getInstance($core)) {
849
+            // Connect to Solr server.
850
+            if (self::$solr = tx_dlf_solr::getInstance($core)) {
851 851
 
852
-				// Load indexing configuration if needed.
853
-				if ($pid) {
852
+                // Load indexing configuration if needed.
853
+                if ($pid) {
854 854
 
855
-					self::loadIndexConf($pid);
855
+                    self::loadIndexConf($pid);
856 856
 
857
-				}
857
+                }
858 858
 
859
-			} else {
859
+            } else {
860 860
 
861
-				return FALSE;
861
+                return FALSE;
862 862
 
863
-			}
863
+            }
864 864
 
865
-		}
865
+        }
866 866
 
867
-		return TRUE;
867
+        return TRUE;
868 868
 
869
-	}
869
+    }
870 870
 
871
-	/**
872
-	 * This is a static class, thus no instances should be created
873
-	 *
874
-	 * @access private
875
-	 */
876
-	private function __construct() {}
871
+    /**
872
+     * This is a static class, thus no instances should be created
873
+     *
874
+     * @access private
875
+     */
876
+    private function __construct() {}
877 877
 
878 878
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return	integer		0 on success or 1 on failure
90 90
 	 */
91
-	public static function add(tx_dlf_document &$doc, $core = 0) {
91
+	public static function add(tx_dlf_document & $doc, $core = 0) {
92 92
 
93 93
 		if (in_array($doc->uid, self::$processedDocs)) {
94 94
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 			// Handle multi-volume documents.
102 102
 			if ($doc->parentId) {
103 103
 
104
-				$parent =& tx_dlf_document::getInstance($doc->parentId, 0, TRUE);
104
+				$parent = & tx_dlf_document::getInstance($doc->parentId, 0, TRUE);
105 105
 
106 106
 				if ($parent->ready) {
107 107
 
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	 *
536 536
 	 * @return	integer		0 on success or 1 on failure
537 537
 	 */
538
-	protected static function processLogical(tx_dlf_document &$doc, array $logicalUnit) {
538
+	protected static function processLogical(tx_dlf_document & $doc, array $logicalUnit) {
539 539
 
540 540
 		$errors = 0;
541 541
 
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	 *
701 701
 	 * @return	integer		0 on success or 1 on failure
702 702
 	 */
703
-	protected static function processPhysical(tx_dlf_document &$doc, $page, array $physicalUnit) {
703
+	protected static function processPhysical(tx_dlf_document & $doc, $page, array $physicalUnit) {
704 704
 
705 705
 		$errors = 0;
706 706
 
Please login to merge, or discard this patch.
common/class.tx_dlf_solr.php 2 patches
Indentation   +514 added lines, -514 removed lines patch added patch discarded remove patch
@@ -20,711 +20,711 @@
 block discarded – undo
20 20
  */
21 21
 class tx_dlf_solr {
22 22
 
23
-	/**
24
-	 * This holds the core name
25
-	 *
26
-	 * @var	string
27
-	 * @access protected
28
-	 */
29
-	protected $core = '';
30
-
31
-	/**
32
-	 * This holds the PID for the configuration
33
-	 *
34
-	 * @var	integer
35
-	 * @access protected
36
-	 */
37
-	protected $cPid = 0;
38
-
39
-	/**
40
-	 * The extension key
41
-	 *
42
-	 * @var	string
43
-	 * @access public
44
-	 */
45
-	public static $extKey = 'dlf';
46
-
47
-	/**
48
-	 * This holds the max results
49
-	 *
50
-	 * @var	integer
51
-	 * @access protected
52
-	 */
53
-	protected $limit = 50000;
54
-
55
-	/**
56
-	 * This holds the number of hits for last search
57
-	 *
58
-	 * @var	integer
59
-	 * @access protected
60
-	 */
61
-	protected $numberOfHits = 0;
62
-
63
-	/**
64
-	 * This holds the additional query parameters
65
-	 *
66
-	 * @var	array
67
-	 * @access protected
68
-	 */
69
-	protected $params = array ();
70
-
71
-	/**
72
-	 * Is the search instantiated successfully?
73
-	 *
74
-	 * @var	boolean
75
-	 * @access protected
76
-	 */
77
-	protected $ready = FALSE;
78
-
79
-	/**
80
-	 * This holds the singleton search objects with their core as array key
81
-	 *
82
-	 * @var	array(tx_dlf_solr)
83
-	 * @access protected
84
-	 */
85
-	protected static $registry = array ();
86
-
87
-	/**
88
-	 * This holds the Solr service object
89
-	 *
90
-	 * @var	Apache_Solr_Service
91
-	 * @access protected
92
-	 */
93
-	protected $service;
94
-
95
-	/**
96
-	 * Escape all special characters in a query string
97
-	 *
98
-	 * @access	public
99
-	 *
100
-	 * @param	string		$query: The query string
101
-	 *
102
-	 * @return	string		The escaped query string
103
-	 */
104
-	public static function escapeQuery($query) {
105
-
106
-		// Load class.
107
-		if (!class_exists('Apache_Solr_Service')) {
108
-
109
-			require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Service.php'));
110
-
111
-		}
112
-
113
-		// Escape query phrase or term.
114
-		if (preg_match('/^".*"$/', $query)) {
115
-
116
-			return '"'.Apache_Solr_Service::escapePhrase(trim($query, '"')).'"';
23
+    /**
24
+     * This holds the core name
25
+     *
26
+     * @var	string
27
+     * @access protected
28
+     */
29
+    protected $core = '';
30
+
31
+    /**
32
+     * This holds the PID for the configuration
33
+     *
34
+     * @var	integer
35
+     * @access protected
36
+     */
37
+    protected $cPid = 0;
38
+
39
+    /**
40
+     * The extension key
41
+     *
42
+     * @var	string
43
+     * @access public
44
+     */
45
+    public static $extKey = 'dlf';
46
+
47
+    /**
48
+     * This holds the max results
49
+     *
50
+     * @var	integer
51
+     * @access protected
52
+     */
53
+    protected $limit = 50000;
54
+
55
+    /**
56
+     * This holds the number of hits for last search
57
+     *
58
+     * @var	integer
59
+     * @access protected
60
+     */
61
+    protected $numberOfHits = 0;
62
+
63
+    /**
64
+     * This holds the additional query parameters
65
+     *
66
+     * @var	array
67
+     * @access protected
68
+     */
69
+    protected $params = array ();
70
+
71
+    /**
72
+     * Is the search instantiated successfully?
73
+     *
74
+     * @var	boolean
75
+     * @access protected
76
+     */
77
+    protected $ready = FALSE;
78
+
79
+    /**
80
+     * This holds the singleton search objects with their core as array key
81
+     *
82
+     * @var	array(tx_dlf_solr)
83
+     * @access protected
84
+     */
85
+    protected static $registry = array ();
86
+
87
+    /**
88
+     * This holds the Solr service object
89
+     *
90
+     * @var	Apache_Solr_Service
91
+     * @access protected
92
+     */
93
+    protected $service;
94
+
95
+    /**
96
+     * Escape all special characters in a query string
97
+     *
98
+     * @access	public
99
+     *
100
+     * @param	string		$query: The query string
101
+     *
102
+     * @return	string		The escaped query string
103
+     */
104
+    public static function escapeQuery($query) {
105
+
106
+        // Load class.
107
+        if (!class_exists('Apache_Solr_Service')) {
108
+
109
+            require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Service.php'));
110
+
111
+        }
112
+
113
+        // Escape query phrase or term.
114
+        if (preg_match('/^".*"$/', $query)) {
115
+
116
+            return '"'.Apache_Solr_Service::escapePhrase(trim($query, '"')).'"';
117 117
 
118
-		} else {
118
+        } else {
119 119
 
120
-			return Apache_Solr_Service::escape($query);
120
+            return Apache_Solr_Service::escape($query);
121 121
 
122
-		}
122
+        }
123 123
 
124
-	}
124
+    }
125 125
 
126
-	/**
127
-	 * Escape all special characters in a query string while retaining valid field queries
128
-	 *
129
-	 * @access	public
130
-	 *
131
-	 * @param	string		$query: The query string
132
-	 * @param	integer		$pid: The PID for the field configuration
133
-	 *
134
-	 * @return	string		The escaped query string
135
-	 */
136
-	public static function escapeQueryKeepField($query, $pid) {
126
+    /**
127
+     * Escape all special characters in a query string while retaining valid field queries
128
+     *
129
+     * @access	public
130
+     *
131
+     * @param	string		$query: The query string
132
+     * @param	integer		$pid: The PID for the field configuration
133
+     *
134
+     * @return	string		The escaped query string
135
+     */
136
+    public static function escapeQueryKeepField($query, $pid) {
137 137
 
138
-		// Is there a field query?
139
-		if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(.*\)$/', $query)) {
138
+        // Is there a field query?
139
+        if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(.*\)$/', $query)) {
140 140
 
141
-			// Get all indexed fields.
142
-			$fields = array();
141
+            // Get all indexed fields.
142
+            $fields = array();
143 143
 
144
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
145
-				'tx_dlf_metadata.index_name,tx_dlf_metadata.index_tokenized,tx_dlf_metadata.index_stored',
146
-				'tx_dlf_metadata',
147
-				'tx_dlf_metadata.index_indexed=1 AND tx_dlf_metadata.pid=' . intval($pid) . ' AND (tx_dlf_metadata.sys_language_uid IN (-1,0) OR tx_dlf_metadata.l18n_parent=0)' . tx_dlf_helper::whereClause('tx_dlf_metadata'),
148
-				'',
149
-				'',
150
-				''
151
-			);
144
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
145
+                'tx_dlf_metadata.index_name,tx_dlf_metadata.index_tokenized,tx_dlf_metadata.index_stored',
146
+                'tx_dlf_metadata',
147
+                'tx_dlf_metadata.index_indexed=1 AND tx_dlf_metadata.pid=' . intval($pid) . ' AND (tx_dlf_metadata.sys_language_uid IN (-1,0) OR tx_dlf_metadata.l18n_parent=0)' . tx_dlf_helper::whereClause('tx_dlf_metadata'),
148
+                '',
149
+                '',
150
+                ''
151
+            );
152 152
 
153
-			if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
153
+            if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
154 154
 
155
-				while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
155
+                while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
156 156
 
157
-					$fields[] = $resArray[0].'_'.($resArray[1] ? 't' : 'u').($resArray[2] ? 's' : 'u').'i';
157
+                    $fields[] = $resArray[0].'_'.($resArray[1] ? 't' : 'u').($resArray[2] ? 's' : 'u').'i';
158 158
 
159
-				}
159
+                }
160 160
 
161
-			}
161
+            }
162 162
 
163
-			// Check if queried field is valid.
164
-			$splitQuery = explode(':', $query, 2);
163
+            // Check if queried field is valid.
164
+            $splitQuery = explode(':', $query, 2);
165 165
 
166
-			if (in_array($splitQuery[0], $fields)) {
166
+            if (in_array($splitQuery[0], $fields)) {
167 167
 
168
-				$query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')';
168
+                $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')';
169 169
 
170
-			} else {
170
+            } else {
171 171
 
172
-				$query = self::escapeQuery($query);
172
+                $query = self::escapeQuery($query);
173 173
 
174
-			}
174
+            }
175 175
 
176
-		} elseif (!empty($query) && $query !== '*') {
176
+        } elseif (!empty($query) && $query !== '*') {
177 177
 
178
-			// Don't escape plain asterisk search.
179
-			$query = self::escapeQuery($query);
178
+            // Don't escape plain asterisk search.
179
+            $query = self::escapeQuery($query);
180 180
 
181
-		}
181
+        }
182 182
 
183
-		return $query;
183
+        return $query;
184 184
 
185
-	}
185
+    }
186 186
 
187
-	/**
188
-	 * This is a singleton class, thus instances must be created by this method
189
-	 *
190
-	 * @access	public
191
-	 *
192
-	 * @param	mixed		$core: Name or UID of the core to load
193
-	 *
194
-	 * @return	tx_dlf_solr		Instance of this class
195
-	 */
196
-	public static function getInstance($core) {
187
+    /**
188
+     * This is a singleton class, thus instances must be created by this method
189
+     *
190
+     * @access	public
191
+     *
192
+     * @param	mixed		$core: Name or UID of the core to load
193
+     *
194
+     * @return	tx_dlf_solr		Instance of this class
195
+     */
196
+    public static function getInstance($core) {
197 197
 
198
-		// Save parameter for logging purposes.
199
-		$_core = $core;
198
+        // Save parameter for logging purposes.
199
+        $_core = $core;
200 200
 
201
-		// Get core name if UID is given.
202
-		if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($core)) {
201
+        // Get core name if UID is given.
202
+        if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($core)) {
203 203
 
204
-			$core = tx_dlf_helper::getIndexName($core, 'tx_dlf_solrcores');
204
+            $core = tx_dlf_helper::getIndexName($core, 'tx_dlf_solrcores');
205 205
 
206
-		}
206
+        }
207 207
 
208
-		// Check if core is set.
209
-		if (empty($core)) {
208
+        // Check if core is set.
209
+        if (empty($core)) {
210 210
 
211
-			if (TYPO3_DLOG) {
211
+            if (TYPO3_DLOG) {
212 212
 
213
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->getInstance('.$_core.')] Invalid core name "'.$core.'" for Apache Solr', self::$extKey, SYSLOG_SEVERITY_ERROR);
213
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->getInstance('.$_core.')] Invalid core name "'.$core.'" for Apache Solr', self::$extKey, SYSLOG_SEVERITY_ERROR);
214 214
 
215
-			}
215
+            }
216 216
 
217
-			return;
217
+            return;
218 218
 
219
-		}
219
+        }
220 220
 
221
-		// Check if there is an instance in the registry already.
222
-		if (is_object(self::$registry[$core]) && self::$registry[$core] instanceof self) {
221
+        // Check if there is an instance in the registry already.
222
+        if (is_object(self::$registry[$core]) && self::$registry[$core] instanceof self) {
223 223
 
224
-			// Return singleton instance if available.
225
-			return self::$registry[$core];
224
+            // Return singleton instance if available.
225
+            return self::$registry[$core];
226 226
 
227
-		}
227
+        }
228 228
 
229
-		// Create new instance...
230
-		$instance = new self($core);
229
+        // Create new instance...
230
+        $instance = new self($core);
231 231
 
232
-		// ...and save it to registry.
233
-		if ($instance->ready) {
232
+        // ...and save it to registry.
233
+        if ($instance->ready) {
234 234
 
235
-			self::$registry[$core] = $instance;
235
+            self::$registry[$core] = $instance;
236 236
 
237
-			// Return new instance.
238
-			return $instance;
237
+            // Return new instance.
238
+            return $instance;
239 239
 
240
-		} else {
240
+        } else {
241 241
 
242
-			if (TYPO3_DLOG) {
242
+            if (TYPO3_DLOG) {
243 243
 
244
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->getInstance('.$_core.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR);
244
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->getInstance('.$_core.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR);
245 245
 
246
-			}
246
+            }
247 247
 
248
-			return;
248
+            return;
249 249
 
250
-		}
250
+        }
251 251
 
252
-	}
252
+    }
253 253
 
254
-	/**
255
-	 * Returns the connection information a specific Solr core
256
-	 *
257
-	 * @access	public
258
-	 *
259
-	 * @param	string		$core: Name of the core to load
260
-	 *
261
-	 * @return	string		The connection parameters for a specific Solr core
262
-	 */
263
-	public static function getSolrConnectionInfo($core = '') {
254
+    /**
255
+     * Returns the connection information a specific Solr core
256
+     *
257
+     * @access	public
258
+     *
259
+     * @param	string		$core: Name of the core to load
260
+     *
261
+     * @return	string		The connection parameters for a specific Solr core
262
+     */
263
+    public static function getSolrConnectionInfo($core = '') {
264 264
 
265
-		$solrInfo = array ();
265
+        $solrInfo = array ();
266 266
 
267
-		// Extract extension configuration.
268
-		$conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
267
+        // Extract extension configuration.
268
+        $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
269 269
 
270
-		// Derive Solr host name.
271
-		$solrInfo['host'] = ($conf['solrHost'] ? $conf['solrHost'] : '127.0.0.1');
270
+        // Derive Solr host name.
271
+        $solrInfo['host'] = ($conf['solrHost'] ? $conf['solrHost'] : '127.0.0.1');
272 272
 
273
-		// Prepend username and password to hostname.
274
-		if ($conf['solrUser'] && $conf['solrPass']) {
273
+        // Prepend username and password to hostname.
274
+        if ($conf['solrUser'] && $conf['solrPass']) {
275 275
 
276
-			$solrInfo['host'] = $conf['solrUser'].':'.$conf['solrPass'].'@'.$solrInfo['host'];
276
+            $solrInfo['host'] = $conf['solrUser'].':'.$conf['solrPass'].'@'.$solrInfo['host'];
277 277
 
278
-		}
278
+        }
279 279
 
280
-		// Set port if not set.
281
-		$solrInfo['port'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($conf['solrPort'], 1, 65535, 8180);
280
+        // Set port if not set.
281
+        $solrInfo['port'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($conf['solrPort'], 1, 65535, 8180);
282 282
 
283
-		// Append core name to path.
284
-		$solrInfo['path'] = trim($conf['solrPath'], '/').'/'.$core;
283
+        // Append core name to path.
284
+        $solrInfo['path'] = trim($conf['solrPath'], '/').'/'.$core;
285 285
 
286
-		return $solrInfo;
286
+        return $solrInfo;
287 287
 
288
-	}
288
+    }
289 289
 
290
-	/**
291
-	 * Returns the request URL for a specific Solr core
292
-	 *
293
-	 * @access	public
294
-	 *
295
-	 * @param	string		$core: Name of the core to load
296
-	 *
297
-	 * @return	string		The request URL for a specific Solr core
298
-	 */
299
-	public static function getSolrUrl($core = '') {
290
+    /**
291
+     * Returns the request URL for a specific Solr core
292
+     *
293
+     * @access	public
294
+     *
295
+     * @param	string		$core: Name of the core to load
296
+     *
297
+     * @return	string		The request URL for a specific Solr core
298
+     */
299
+    public static function getSolrUrl($core = '') {
300 300
 
301
-		// Get Solr connection information.
302
-		$solrInfo = self::getSolrConnectionInfo($core);
301
+        // Get Solr connection information.
302
+        $solrInfo = self::getSolrConnectionInfo($core);
303 303
 
304
-		// Return entire request URL.
305
-		return 'http://'.$solrInfo['host'].':'.$solrInfo['port'].'/'.$solrInfo['path'];
304
+        // Return entire request URL.
305
+        return 'http://'.$solrInfo['host'].':'.$solrInfo['port'].'/'.$solrInfo['path'];
306 306
 
307
-	}
307
+    }
308 308
 
309
-	/**
310
-	 * Get next unused Solr core number
311
-	 *
312
-	 * @access	public
313
-	 *
314
-	 * @param	integer		$start: Number to start with
315
-	 *
316
-	 * @return	integer		First unused core number found
317
-	 */
318
-	public static function solrGetCoreNumber($start = 0) {
309
+    /**
310
+     * Get next unused Solr core number
311
+     *
312
+     * @access	public
313
+     *
314
+     * @param	integer		$start: Number to start with
315
+     *
316
+     * @return	integer		First unused core number found
317
+     */
318
+    public static function solrGetCoreNumber($start = 0) {
319 319
 
320
-		$start = max(intval($start), 0);
320
+        $start = max(intval($start), 0);
321 321
 
322
-		// Check if core already exists.
323
-		if (self::getInstance('dlfCore'.$start) === NULL) {
322
+        // Check if core already exists.
323
+        if (self::getInstance('dlfCore'.$start) === NULL) {
324 324
 
325
-			return $start;
325
+            return $start;
326 326
 
327
-		} else {
327
+        } else {
328 328
 
329
-			return self::solrGetCoreNumber($start + 1);
329
+            return self::solrGetCoreNumber($start + 1);
330 330
 
331
-		}
331
+        }
332 332
 
333
-	}
333
+    }
334 334
 
335
-	/**
336
-	 * Processes a search request.
337
-	 *
338
-	 * @access	public
339
-	 *
340
-	 * @param	string		$query: The search query
341
-	 *
342
-	 * @return	tx_dlf_list		The result list
343
-	 */
344
-	public function search($query = '') {
335
+    /**
336
+     * Processes a search request.
337
+     *
338
+     * @access	public
339
+     *
340
+     * @param	string		$query: The search query
341
+     *
342
+     * @return	tx_dlf_list		The result list
343
+     */
344
+    public function search($query = '') {
345 345
 
346
-		// Perform search.
347
-		$results = $this->service->search((string) $query, 0, $this->limit, $this->params);
346
+        // Perform search.
347
+        $results = $this->service->search((string) $query, 0, $this->limit, $this->params);
348 348
 
349
-		$this->numberOfHits = count($results->response->docs);
349
+        $this->numberOfHits = count($results->response->docs);
350 350
 
351
-		$toplevel = array ();
351
+        $toplevel = array ();
352 352
 
353
-		$checks = array ();
353
+        $checks = array ();
354 354
 
355
-		// Get metadata configuration.
356
-		if ($this->numberOfHits > 0) {
355
+        // Get metadata configuration.
356
+        if ($this->numberOfHits > 0) {
357 357
 
358
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
359
-				'tx_dlf_metadata.index_name AS index_name',
360
-				'tx_dlf_metadata',
361
-				'tx_dlf_metadata.is_sortable=1 AND tx_dlf_metadata.pid='.intval($this->cPid).tx_dlf_helper::whereClause('tx_dlf_metadata'),
362
-				'',
363
-				'',
364
-				''
365
-			);
358
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
359
+                'tx_dlf_metadata.index_name AS index_name',
360
+                'tx_dlf_metadata',
361
+                'tx_dlf_metadata.is_sortable=1 AND tx_dlf_metadata.pid='.intval($this->cPid).tx_dlf_helper::whereClause('tx_dlf_metadata'),
362
+                '',
363
+                '',
364
+                ''
365
+            );
366 366
 
367
-			$sorting = array ();
367
+            $sorting = array ();
368 368
 
369
-			while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
369
+            while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
370 370
 
371
-				$sorting[$resArray['index_name']] = $resArray['index_name'].'_sorting';
371
+                $sorting[$resArray['index_name']] = $resArray['index_name'].'_sorting';
372 372
 
373
-			}
373
+            }
374 374
 
375
-		}
375
+        }
376 376
 
377
-		// Keep track of relevance.
378
-		$i = 0;
377
+        // Keep track of relevance.
378
+        $i = 0;
379 379
 
380
-		// Process results.
381
-		foreach ($results->response->docs as $doc) {
380
+        // Process results.
381
+        foreach ($results->response->docs as $doc) {
382 382
 
383
-			// Split toplevel documents from subparts.
384
-			if ($doc->toplevel == 1) {
383
+            // Split toplevel documents from subparts.
384
+            if ($doc->toplevel == 1) {
385 385
 
386
-				// Prepare document's metadata for sorting.
387
-				$docSorting = array ();
386
+                // Prepare document's metadata for sorting.
387
+                $docSorting = array ();
388 388
 
389
-				foreach ($sorting as $index_name => $solr_name) {
389
+                foreach ($sorting as $index_name => $solr_name) {
390 390
 
391
-					if (!empty($doc->$solr_name)) {
391
+                    if (!empty($doc->$solr_name)) {
392 392
 
393
-						$docSorting[$index_name] = (is_array($doc->$solr_name) ? $doc->$solr_name[0] : $doc->$solr_name);
393
+                        $docSorting[$index_name] = (is_array($doc->$solr_name) ? $doc->$solr_name[0] : $doc->$solr_name);
394 394
 
395
-					}
395
+                    }
396 396
 
397
-				}
397
+                }
398 398
 
399
-				// Preserve relevance ranking.
400
-				if (!empty($toplevel[$doc->uid]['s']['relevance'])) {
399
+                // Preserve relevance ranking.
400
+                if (!empty($toplevel[$doc->uid]['s']['relevance'])) {
401 401
 
402
-					$docSorting['relevance'] = $toplevel[$doc->uid]['s']['relevance'];
402
+                    $docSorting['relevance'] = $toplevel[$doc->uid]['s']['relevance'];
403 403
 
404
-				}
404
+                }
405 405
 
406
-				$toplevel[$doc->uid] = array (
407
-					'u' => $doc->uid,
408
-					'h' => '',
409
-					's' => $docSorting,
410
-					'p' => (!empty($toplevel[$doc->uid]['p']) ? $toplevel[$doc->uid]['p'] : array ())
411
-				);
406
+                $toplevel[$doc->uid] = array (
407
+                    'u' => $doc->uid,
408
+                    'h' => '',
409
+                    's' => $docSorting,
410
+                    'p' => (!empty($toplevel[$doc->uid]['p']) ? $toplevel[$doc->uid]['p'] : array ())
411
+                );
412 412
 
413
-			} else {
413
+            } else {
414 414
 
415
-				$toplevel[$doc->uid]['p'][] = array (
416
-					'u' => $doc->id,
417
-					'h' => (!empty($results->highlighting->{$doc->id}->fulltext) ? $results->highlighting->{$doc->id}->fulltext[0] : '')
418
-				);
415
+                $toplevel[$doc->uid]['p'][] = array (
416
+                    'u' => $doc->id,
417
+                    'h' => (!empty($results->highlighting->{$doc->id}->fulltext) ? $results->highlighting->{$doc->id}->fulltext[0] : '')
418
+                );
419 419
 
420
-				if (!in_array($doc->uid, $checks)) {
420
+                if (!in_array($doc->uid, $checks)) {
421 421
 
422
-					$checks[] = $doc->uid;
422
+                    $checks[] = $doc->uid;
423 423
 
424
-				}
424
+                }
425 425
 
426
-			}
426
+            }
427 427
 
428
-			// Add relevance to sorting values.
429
-			if (empty($toplevel[$doc->uid]['s']['relevance'])) {
428
+            // Add relevance to sorting values.
429
+            if (empty($toplevel[$doc->uid]['s']['relevance'])) {
430 430
 
431
-				$toplevel[$doc->uid]['s']['relevance'] = str_pad($i, 6, '0', STR_PAD_LEFT);
431
+                $toplevel[$doc->uid]['s']['relevance'] = str_pad($i, 6, '0', STR_PAD_LEFT);
432 432
 
433
-			}
433
+            }
434 434
 
435
-			$i++;
435
+            $i++;
436 436
 
437
-		}
437
+        }
438 438
 
439
-		// Check if the toplevel documents have metadata.
440
-		foreach ($checks as $check) {
439
+        // Check if the toplevel documents have metadata.
440
+        foreach ($checks as $check) {
441 441
 
442
-			if (empty($toplevel[$check]['u'])) {
442
+            if (empty($toplevel[$check]['u'])) {
443 443
 
444
-				// Get information for toplevel document.
445
-				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
446
-					'tx_dlf_documents.uid AS uid,tx_dlf_documents.metadata_sorting AS metadata_sorting',
447
-					'tx_dlf_documents',
448
-					'tx_dlf_documents.uid='.intval($check).tx_dlf_helper::whereClause('tx_dlf_documents'),
449
-					'',
450
-					'',
451
-					'1'
452
-				);
444
+                // Get information for toplevel document.
445
+                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
446
+                    'tx_dlf_documents.uid AS uid,tx_dlf_documents.metadata_sorting AS metadata_sorting',
447
+                    'tx_dlf_documents',
448
+                    'tx_dlf_documents.uid='.intval($check).tx_dlf_helper::whereClause('tx_dlf_documents'),
449
+                    '',
450
+                    '',
451
+                    '1'
452
+                );
453 453
 
454
-				// Process results.
455
-				if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
454
+                // Process results.
455
+                if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
456 456
 
457
-					$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
457
+                    $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
458 458
 
459
-					// Prepare document's metadata for sorting.
460
-					$sorting = unserialize($resArray['metadata_sorting']);
459
+                    // Prepare document's metadata for sorting.
460
+                    $sorting = unserialize($resArray['metadata_sorting']);
461 461
 
462
-					if (!empty($sorting['type']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['type'])) {
462
+                    if (!empty($sorting['type']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['type'])) {
463 463
 
464
-						$sorting['type'] = tx_dlf_helper::getIndexName($sorting['type'], 'tx_dlf_structures', $this->cPid);
464
+                        $sorting['type'] = tx_dlf_helper::getIndexName($sorting['type'], 'tx_dlf_structures', $this->cPid);
465 465
 
466
-					}
466
+                    }
467 467
 
468
-					if (!empty($sorting['owner']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['owner'])) {
468
+                    if (!empty($sorting['owner']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['owner'])) {
469 469
 
470
-						$sorting['owner'] = tx_dlf_helper::getIndexName($sorting['owner'], 'tx_dlf_libraries', $this->cPid);
470
+                        $sorting['owner'] = tx_dlf_helper::getIndexName($sorting['owner'], 'tx_dlf_libraries', $this->cPid);
471 471
 
472
-					}
472
+                    }
473 473
 
474
-					if (!empty($sorting['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['collection'])) {
474
+                    if (!empty($sorting['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['collection'])) {
475 475
 
476
-						$sorting['collection'] = tx_dlf_helper::getIndexName($sorting['collection'], 'tx_dlf_collections', $this->cPid);
476
+                        $sorting['collection'] = tx_dlf_helper::getIndexName($sorting['collection'], 'tx_dlf_collections', $this->cPid);
477 477
 
478
-					}
478
+                    }
479 479
 
480
-					// Preserve relevance ranking.
481
-					if (!empty($toplevel[$check]['s']['relevance'])) {
480
+                    // Preserve relevance ranking.
481
+                    if (!empty($toplevel[$check]['s']['relevance'])) {
482 482
 
483
-						$sorting['relevance'] = $toplevel[$check]['s']['relevance'];
483
+                        $sorting['relevance'] = $toplevel[$check]['s']['relevance'];
484 484
 
485
-					}
485
+                    }
486 486
 
487
-					$toplevel[$check] = array (
488
-						'u' => $resArray['uid'],
489
-						'h' => '',
490
-						's' => $sorting,
491
-						'p' => $toplevel[$check]['p']
492
-					);
487
+                    $toplevel[$check] = array (
488
+                        'u' => $resArray['uid'],
489
+                        'h' => '',
490
+                        's' => $sorting,
491
+                        'p' => $toplevel[$check]['p']
492
+                    );
493 493
 
494
-				} else {
494
+                } else {
495 495
 
496
-					// Clear entry if there is no (accessible) toplevel document.
497
-					unset ($toplevel[$check]);
496
+                    // Clear entry if there is no (accessible) toplevel document.
497
+                    unset ($toplevel[$check]);
498 498
 
499
-				}
499
+                }
500 500
 
501
-			}
501
+            }
502 502
 
503
-		}
503
+        }
504 504
 
505
-		// Save list of documents.
506
-		$list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
505
+        // Save list of documents.
506
+        $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
507 507
 
508
-		$list->reset();
508
+        $list->reset();
509 509
 
510
-		$list->add(array_values($toplevel));
510
+        $list->add(array_values($toplevel));
511 511
 
512
-		// Set metadata for search.
513
-		$list->metadata = array (
514
-			'label' => '',
515
-			'description' => '',
516
-			'options' => array (
517
-				'source' => 'search',
518
-				'engine' => 'solr',
519
-				'select' => $query,
520
-				'userid' => 0,
521
-				'params' => $this->params,
522
-				'core' => $this->core,
523
-				'pid' => $this->cPid,
524
-				'order' => 'relevance',
525
-				'order.asc' => TRUE,
526
-			)
527
-		);
512
+        // Set metadata for search.
513
+        $list->metadata = array (
514
+            'label' => '',
515
+            'description' => '',
516
+            'options' => array (
517
+                'source' => 'search',
518
+                'engine' => 'solr',
519
+                'select' => $query,
520
+                'userid' => 0,
521
+                'params' => $this->params,
522
+                'core' => $this->core,
523
+                'pid' => $this->cPid,
524
+                'order' => 'relevance',
525
+                'order.asc' => TRUE,
526
+            )
527
+        );
528 528
 
529
-		return $list;
529
+        return $list;
530 530
 
531
-	}
531
+    }
532 532
 
533
-	/**
534
-	 * This returns $this->limit via __get()
535
-	 *
536
-	 * @access	protected
537
-	 *
538
-	 * @return	integer		The max number of results
539
-	 */
540
-	protected function _getLimit() {
533
+    /**
534
+     * This returns $this->limit via __get()
535
+     *
536
+     * @access	protected
537
+     *
538
+     * @return	integer		The max number of results
539
+     */
540
+    protected function _getLimit() {
541 541
 
542
-		return $this->limit;
542
+        return $this->limit;
543 543
 
544
-	}
544
+    }
545 545
 
546
-	/**
547
-	 * This returns $this->numberOfHits via __get()
548
-	 *
549
-	 * @access	protected
550
-	 *
551
-	 * @return	integer		Total number of hits for last search
552
-	 */
553
-	protected function _getNumberOfHits() {
546
+    /**
547
+     * This returns $this->numberOfHits via __get()
548
+     *
549
+     * @access	protected
550
+     *
551
+     * @return	integer		Total number of hits for last search
552
+     */
553
+    protected function _getNumberOfHits() {
554 554
 
555
-		return $this->numberOfHits;
555
+        return $this->numberOfHits;
556 556
 
557
-	}
557
+    }
558 558
 
559
-	/**
560
-	 * This returns $this->ready via __get()
561
-	 *
562
-	 * @access	protected
563
-	 *
564
-	 * @return	boolean		Is the search instantiated successfully?
565
-	 */
566
-	protected function _getReady() {
559
+    /**
560
+     * This returns $this->ready via __get()
561
+     *
562
+     * @access	protected
563
+     *
564
+     * @return	boolean		Is the search instantiated successfully?
565
+     */
566
+    protected function _getReady() {
567 567
 
568
-		return $this->ready;
568
+        return $this->ready;
569 569
 
570
-	}
570
+    }
571 571
 
572
-	/**
573
-	 * This returns $this->service via __get()
574
-	 *
575
-	 * @access	protected
576
-	 *
577
-	 * @return	Apache_Solr_Service		Apache Solr service object
578
-	 */
579
-	protected function _getService() {
572
+    /**
573
+     * This returns $this->service via __get()
574
+     *
575
+     * @access	protected
576
+     *
577
+     * @return	Apache_Solr_Service		Apache Solr service object
578
+     */
579
+    protected function _getService() {
580 580
 
581
-		return $this->service;
581
+        return $this->service;
582 582
 
583
-	}
583
+    }
584 584
 
585
-	/**
586
-	 * This sets $this->cPid via __set()
587
-	 *
588
-	 * @access	protected
589
-	 *
590
-	 * @param	integer		$value: The new PID for the metadata definitions
591
-	 *
592
-	 * @return	void
593
-	 */
594
-	protected function _setCPid($value) {
585
+    /**
586
+     * This sets $this->cPid via __set()
587
+     *
588
+     * @access	protected
589
+     *
590
+     * @param	integer		$value: The new PID for the metadata definitions
591
+     *
592
+     * @return	void
593
+     */
594
+    protected function _setCPid($value) {
595 595
 
596
-		$this->cPid = max(intval($value), 0);
596
+        $this->cPid = max(intval($value), 0);
597 597
 
598
-	}
598
+    }
599 599
 
600
-	/**
601
-	 * This sets $this->limit via __set()
602
-	 *
603
-	 * @access	protected
604
-	 *
605
-	 * @param	integer		$value: The max number of results
606
-	 *
607
-	 * @return	void
608
-	 */
609
-	protected function _setLimit($value) {
600
+    /**
601
+     * This sets $this->limit via __set()
602
+     *
603
+     * @access	protected
604
+     *
605
+     * @param	integer		$value: The max number of results
606
+     *
607
+     * @return	void
608
+     */
609
+    protected function _setLimit($value) {
610 610
 
611
-		$this->limit = max(intval($value), 0);
611
+        $this->limit = max(intval($value), 0);
612 612
 
613
-	}
613
+    }
614 614
 
615
-	/**
616
-	 * This sets $this->params via __set()
617
-	 *
618
-	 * @access	protected
619
-	 *
620
-	 * @param	array		$value: The query parameters
621
-	 *
622
-	 * @return	void
623
-	 */
624
-	protected function _setParams(array $value) {
615
+    /**
616
+     * This sets $this->params via __set()
617
+     *
618
+     * @access	protected
619
+     *
620
+     * @param	array		$value: The query parameters
621
+     *
622
+     * @return	void
623
+     */
624
+    protected function _setParams(array $value) {
625 625
 
626
-		$this->params = $value;
626
+        $this->params = $value;
627 627
 
628
-	}
628
+    }
629 629
 
630
-	/**
631
-	 * This magic method is called each time an invisible property is referenced from the object
632
-	 *
633
-	 * @access	public
634
-	 *
635
-	 * @param	string		$var: Name of variable to get
636
-	 *
637
-	 * @return	mixed		Value of $this->$var
638
-	 */
639
-	public function __get($var) {
630
+    /**
631
+     * This magic method is called each time an invisible property is referenced from the object
632
+     *
633
+     * @access	public
634
+     *
635
+     * @param	string		$var: Name of variable to get
636
+     *
637
+     * @return	mixed		Value of $this->$var
638
+     */
639
+    public function __get($var) {
640 640
 
641
-		$method = '_get'.ucfirst($var);
641
+        $method = '_get'.ucfirst($var);
642 642
 
643
-		if (!property_exists($this, $var) || !method_exists($this, $method)) {
643
+        if (!property_exists($this, $var) || !method_exists($this, $method)) {
644 644
 
645
-			if (TYPO3_DLOG) {
645
+            if (TYPO3_DLOG) {
646 646
 
647
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->__get('.$var.')] There is no getter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
647
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->__get('.$var.')] There is no getter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
648 648
 
649
-			}
649
+            }
650 650
 
651
-			return;
651
+            return;
652 652
 
653
-		} else {
653
+        } else {
654 654
 
655
-			return $this->$method();
655
+            return $this->$method();
656 656
 
657
-		}
657
+        }
658 658
 
659
-	}
659
+    }
660 660
 
661
-	/**
662
-	 * This magic method is called each time an invisible property is referenced from the object
663
-	 *
664
-	 * @access	public
665
-	 *
666
-	 * @param	string		$var: Name of variable to set
667
-	 * @param	mixed		$value: New value of variable
668
-	 *
669
-	 * @return	void
670
-	 */
671
-	public function __set($var, $value) {
661
+    /**
662
+     * This magic method is called each time an invisible property is referenced from the object
663
+     *
664
+     * @access	public
665
+     *
666
+     * @param	string		$var: Name of variable to set
667
+     * @param	mixed		$value: New value of variable
668
+     *
669
+     * @return	void
670
+     */
671
+    public function __set($var, $value) {
672 672
 
673
-		$method = '_set'.ucfirst($var);
673
+        $method = '_set'.ucfirst($var);
674 674
 
675
-		if (!property_exists($this, $var) || !method_exists($this, $method)) {
675
+        if (!property_exists($this, $var) || !method_exists($this, $method)) {
676 676
 
677
-			if (TYPO3_DLOG) {
677
+            if (TYPO3_DLOG) {
678 678
 
679
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->__set('.$var.', [data])] There is no setter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING, $value);
679
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->__set('.$var.', [data])] There is no setter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING, $value);
680 680
 
681
-			}
681
+            }
682 682
 
683
-		} else {
683
+        } else {
684 684
 
685
-			$this->$method($value);
685
+            $this->$method($value);
686 686
 
687
-		}
687
+        }
688 688
 
689
-	}
689
+    }
690 690
 
691
-	/**
692
-	 * This is a singleton class, thus the constructor should be private/protected
693
-	 *
694
-	 * @access	protected
695
-	 *
696
-	 * @param	string		$core: The name of the core to use
697
-	 *
698
-	 * @return	void
699
-	 */
700
-	protected function __construct($core) {
691
+    /**
692
+     * This is a singleton class, thus the constructor should be private/protected
693
+     *
694
+     * @access	protected
695
+     *
696
+     * @param	string		$core: The name of the core to use
697
+     *
698
+     * @return	void
699
+     */
700
+    protected function __construct($core) {
701 701
 
702
-		// Load class.
703
-		if (!class_exists('Apache_Solr_Service')) {
702
+        // Load class.
703
+        if (!class_exists('Apache_Solr_Service')) {
704 704
 
705
-			require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Service.php'));
705
+            require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Service.php'));
706 706
 
707
-		}
707
+        }
708 708
 
709
-		$solrInfo = self::getSolrConnectionInfo($core);
709
+        $solrInfo = self::getSolrConnectionInfo($core);
710 710
 
711
-		// Instantiate Apache_Solr_Service class.
712
-		$this->service = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Apache_Solr_Service', $solrInfo['host'], $solrInfo['port'], $solrInfo['path']);
711
+        // Instantiate Apache_Solr_Service class.
712
+        $this->service = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Apache_Solr_Service', $solrInfo['host'], $solrInfo['port'], $solrInfo['path']);
713 713
 
714
-		// Check if connection is established.
715
-		if ($this->service->ping() !== FALSE) {
714
+        // Check if connection is established.
715
+        if ($this->service->ping() !== FALSE) {
716 716
 
717
-			// Do not collapse single value arrays.
718
-			$this->service->setCollapseSingleValueArrays = FALSE;
717
+            // Do not collapse single value arrays.
718
+            $this->service->setCollapseSingleValueArrays = FALSE;
719 719
 
720
-			// Set core name.
721
-			$this->core = $core;
720
+            // Set core name.
721
+            $this->core = $core;
722 722
 
723
-			// Instantiation successful!
724
-			$this->ready = TRUE;
723
+            // Instantiation successful!
724
+            $this->ready = TRUE;
725 725
 
726
-		}
726
+        }
727 727
 
728
-	}
728
+    }
729 729
 
730 730
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,12 +139,12 @@
 block discarded – undo
139 139
 		if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(.*\)$/', $query)) {
140 140
 
141 141
 			// Get all indexed fields.
142
-			$fields = array();
142
+			$fields = array ();
143 143
 
144 144
 			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
145 145
 				'tx_dlf_metadata.index_name,tx_dlf_metadata.index_tokenized,tx_dlf_metadata.index_stored',
146 146
 				'tx_dlf_metadata',
147
-				'tx_dlf_metadata.index_indexed=1 AND tx_dlf_metadata.pid=' . intval($pid) . ' AND (tx_dlf_metadata.sys_language_uid IN (-1,0) OR tx_dlf_metadata.l18n_parent=0)' . tx_dlf_helper::whereClause('tx_dlf_metadata'),
147
+				'tx_dlf_metadata.index_indexed=1 AND tx_dlf_metadata.pid='.intval($pid).' AND (tx_dlf_metadata.sys_language_uid IN (-1,0) OR tx_dlf_metadata.l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'),
148 148
 				'',
149 149
 				'',
150 150
 				''
Please login to merge, or discard this patch.
common/class.tx_dlf_format.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@
 block discarded – undo
20 20
  */
21 21
 interface tx_dlf_format {
22 22
 
23
-	/**
24
-	 * This extracts metadata from XML
25
-	 *
26
-	 * @access	public
27
-	 *
28
-	 * @param	SimpleXMLElement		$xml: The XML to extract the metadata from
29
-	 * @param	array		&$metadata: The metadata array to fill
30
-	 *
31
-	 * @return	void
32
-	 */
33
-	public function extractMetadata(SimpleXMLElement $xml, array &$metadata);
23
+    /**
24
+     * This extracts metadata from XML
25
+     *
26
+     * @access	public
27
+     *
28
+     * @param	SimpleXMLElement		$xml: The XML to extract the metadata from
29
+     * @param	array		&$metadata: The metadata array to fill
30
+     *
31
+     * @return	void
32
+     */
33
+    public function extractMetadata(SimpleXMLElement $xml, array &$metadata);
34 34
 
35 35
 }
Please login to merge, or discard this patch.
common/class.tx_dlf_helper.php 2 patches
Indentation   +837 added lines, -837 removed lines patch added patch discarded remove patch
@@ -20,1318 +20,1318 @@
 block discarded – undo
20 20
  */
21 21
 class tx_dlf_helper {
22 22
 
23
-	/**
24
-	 * The extension key
25
-	 *
26
-	 * @var	string
27
-	 * @access public
28
-	 */
29
-	public static $extKey = 'dlf';
30
-
31
-	/**
32
-	 * The locallang array for common use
33
-	 *
34
-	 * @var	array
35
-	 * @access protected
36
-	 */
37
-	protected static $locallang = array ();
23
+    /**
24
+     * The extension key
25
+     *
26
+     * @var	string
27
+     * @access public
28
+     */
29
+    public static $extKey = 'dlf';
30
+
31
+    /**
32
+     * The locallang array for common use
33
+     *
34
+     * @var	array
35
+     * @access protected
36
+     */
37
+    protected static $locallang = array ();
38 38
 
39
-	/**
40
-	 * Adds a message to the message queue.
41
-	 *
42
-	 * @access	public
43
-	 *
44
-	 * @param	\TYPO3\CMS\Core\Messaging\FlashMessage		$message: Instance of \TYPO3\CMS\Core\Messaging\FlashMessage
45
-	 *
46
-	 * @return	void
47
-	 */
48
-	public static function addMessage($message) {
39
+    /**
40
+     * Adds a message to the message queue.
41
+     *
42
+     * @access	public
43
+     *
44
+     * @param	\TYPO3\CMS\Core\Messaging\FlashMessage		$message: Instance of \TYPO3\CMS\Core\Messaging\FlashMessage
45
+     *
46
+     * @return	void
47
+     */
48
+    public static function addMessage($message) {
49 49
 
50
-		$flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
50
+        $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
51 51
 
52
-		$flashMessageService->getMessageQueueByIdentifier()->enqueue($message);
52
+        $flashMessageService->getMessageQueueByIdentifier()->enqueue($message);
53 53
 
54
-	}
54
+    }
55 55
 
56
-	/**
57
-	 * Implements array_merge_recursive_overrule() in a cross-version way
58
-	 * This code is a copy from realurl, written by Dmitry Dulepov <[email protected]>.
59
-	 *
60
-	 * @access	public
61
-	 *
62
-	 * @param	array		$array1: First array
63
-	 * @param	array		$array2: Second array
64
-	 *
65
-	 * @return	array		Merged array with second array overruling first one
66
-	 */
67
-	static public function array_merge_recursive_overrule($array1, $array2) {
56
+    /**
57
+     * Implements array_merge_recursive_overrule() in a cross-version way
58
+     * This code is a copy from realurl, written by Dmitry Dulepov <[email protected]>.
59
+     *
60
+     * @access	public
61
+     *
62
+     * @param	array		$array1: First array
63
+     * @param	array		$array2: Second array
64
+     *
65
+     * @return	array		Merged array with second array overruling first one
66
+     */
67
+    static public function array_merge_recursive_overrule($array1, $array2) {
68 68
 
69
-		if (class_exists('\\TYPO3\\CMS\\Core\\Utility\\ArrayUtility')) {
69
+        if (class_exists('\\TYPO3\\CMS\\Core\\Utility\\ArrayUtility')) {
70 70
 
71
-			\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($array1, $array2);
71
+            \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($array1, $array2);
72 72
 
73
-		} else {
73
+        } else {
74 74
 
75
-			$array1 = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($array1, $array2);
75
+            $array1 = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($array1, $array2);
76 76
 
77
-		}
77
+        }
78 78
 
79
-		return $array1;
79
+        return $array1;
80 80
 
81
-	}
81
+    }
82 82
 
83
-	/**
84
-	 * Searches the array recursively for a given value and returns the corresponding key if successful
85
-	 * @see http://php.net/array_search
86
-	 *
87
-	 * @access	public
88
-	 *
89
-	 * @param	mixed		$needle: The searched value
90
-	 * @param	array		$haystack: The array to search in
91
-	 * @param	boolean		$strict: Check needle's type, too?
92
-	 *
93
-	 * @return	mixed		Returns the needle's key if found and FALSE otherwise
94
-	 *
95
-	 * @deprecated because of its inefficiency
96
-	 */
97
-	public static function array_search_recursive($needle, $haystack, $strict = FALSE) {
83
+    /**
84
+     * Searches the array recursively for a given value and returns the corresponding key if successful
85
+     * @see http://php.net/array_search
86
+     *
87
+     * @access	public
88
+     *
89
+     * @param	mixed		$needle: The searched value
90
+     * @param	array		$haystack: The array to search in
91
+     * @param	boolean		$strict: Check needle's type, too?
92
+     *
93
+     * @return	mixed		Returns the needle's key if found and FALSE otherwise
94
+     *
95
+     * @deprecated because of its inefficiency
96
+     */
97
+    public static function array_search_recursive($needle, $haystack, $strict = FALSE) {
98 98
 
99
-		foreach ($haystack as $key => $value) {
99
+        foreach ($haystack as $key => $value) {
100 100
 
101
-			if (($strict && $value === $needle) || (!$strict && $value == $needle) || (is_array($value) && self::array_search_recursive($needle, $value, $strict) !== FALSE)) {
101
+            if (($strict && $value === $needle) || (!$strict && $value == $needle) || (is_array($value) && self::array_search_recursive($needle, $value, $strict) !== FALSE)) {
102 102
 
103
-				return $key;
103
+                return $key;
104 104
 
105
-			}
105
+            }
106 106
 
107
-		}
107
+        }
108 108
 
109
-		return FALSE;
109
+        return FALSE;
110 110
 
111
-	}
111
+    }
112 112
 
113
-	/**
114
-	 * Check if given identifier is a valid identifier of the German National Library
115
-	 * @see	http://support.d-nb.de/iltis/onlineRoutinen/Pruefziffernberechnung.htm
116
-	 *
117
-	 * @access	public
118
-	 *
119
-	 * @param	string		$id: The identifier to check
120
-	 * @param	string		$type: What type is the identifier supposed to be?
121
-	 * 						Possible values: PPN, IDN, PND, ZDB, SWD, GKD
122
-	 *
123
-	 * @return	boolean		Is $id a valid GNL identifier of the given $type?
124
-	 */
125
-	public static function checkIdentifier($id, $type) {
113
+    /**
114
+     * Check if given identifier is a valid identifier of the German National Library
115
+     * @see	http://support.d-nb.de/iltis/onlineRoutinen/Pruefziffernberechnung.htm
116
+     *
117
+     * @access	public
118
+     *
119
+     * @param	string		$id: The identifier to check
120
+     * @param	string		$type: What type is the identifier supposed to be?
121
+     * 						Possible values: PPN, IDN, PND, ZDB, SWD, GKD
122
+     *
123
+     * @return	boolean		Is $id a valid GNL identifier of the given $type?
124
+     */
125
+    public static function checkIdentifier($id, $type) {
126 126
 
127
-		$digits = substr($id, 0, 8);
127
+        $digits = substr($id, 0, 8);
128 128
 
129
-		$checksum = 0;
129
+        $checksum = 0;
130 130
 
131
-		for ($i = 0, $j = strlen($digits); $i < $j; $i++) {
131
+        for ($i = 0, $j = strlen($digits); $i < $j; $i++) {
132 132
 
133
-			$checksum += (9 - $i) * intval(substr($digits, $i, 1));
133
+            $checksum += (9 - $i) * intval(substr($digits, $i, 1));
134 134
 
135
-		}
135
+        }
136 136
 
137
-		$checksum = (11 - ($checksum % 11)) % 11;
137
+        $checksum = (11 - ($checksum % 11)) % 11;
138 138
 
139
-		switch (strtoupper($type)) {
139
+        switch (strtoupper($type)) {
140 140
 
141
-			case 'PPN':
142
-			case 'IDN':
143
-			case 'PND':
141
+            case 'PPN':
142
+            case 'IDN':
143
+            case 'PND':
144 144
 
145
-				if ($checksum == 10) {
145
+                if ($checksum == 10) {
146 146
 
147
-					$checksum = 'X';
147
+                    $checksum = 'X';
148 148
 
149
-				}
149
+                }
150 150
 
151
-				if (!preg_match('/[0-9]{8}[0-9X]{1}/i', $id)) {
151
+                if (!preg_match('/[0-9]{8}[0-9X]{1}/i', $id)) {
152 152
 
153
-					return FALSE;
153
+                    return FALSE;
154 154
 
155
-				} elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
155
+                } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
156 156
 
157
-					return FALSE;
157
+                    return FALSE;
158 158
 
159
-				}
159
+                }
160 160
 
161
-				break;
161
+                break;
162 162
 
163
-			case 'ZDB':
163
+            case 'ZDB':
164 164
 
165
-				if ($checksum == 10) {
165
+                if ($checksum == 10) {
166 166
 
167
-					$checksum = 'X';
167
+                    $checksum = 'X';
168 168
 
169
-				}
169
+                }
170 170
 
171
-				if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) {
171
+                if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) {
172 172
 
173
-					return FALSE;
173
+                    return FALSE;
174 174
 
175
-				} elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
175
+                } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
176 176
 
177
-					return FALSE;
177
+                    return FALSE;
178 178
 
179
-				}
179
+                }
180 180
 
181
-				break;
181
+                break;
182 182
 
183
-			case 'SWD':
183
+            case 'SWD':
184 184
 
185
-				$checksum = 11 - $checksum;
185
+                $checksum = 11 - $checksum;
186 186
 
187
-				if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) {
187
+                if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) {
188 188
 
189
-					return FALSE;
189
+                    return FALSE;
190 190
 
191
-				} elseif ($checksum == 10) {
191
+                } elseif ($checksum == 10) {
192 192
 
193
-					return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD');
193
+                    return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD');
194 194
 
195
-				} elseif (substr($id, -1, 1) != $checksum) {
195
+                } elseif (substr($id, -1, 1) != $checksum) {
196 196
 
197
-					return FALSE;
197
+                    return FALSE;
198 198
 
199
-				}
199
+                }
200 200
 
201
-				break;
201
+                break;
202 202
 
203
-			case 'GKD':
203
+            case 'GKD':
204 204
 
205
-				$checksum = 11 - $checksum;
205
+                $checksum = 11 - $checksum;
206 206
 
207
-				if ($checksum == 10) {
207
+                if ($checksum == 10) {
208 208
 
209
-					$checksum = 'X';
209
+                    $checksum = 'X';
210 210
 
211
-				}
211
+                }
212 212
 
213
-				if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) {
213
+                if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) {
214 214
 
215
-					return FALSE;
215
+                    return FALSE;
216 216
 
217
-				} elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
217
+                } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
218 218
 
219
-					return FALSE;
219
+                    return FALSE;
220 220
 
221
-				}
221
+                }
222 222
 
223
-				break;
223
+                break;
224 224
 
225
-		}
225
+        }
226 226
 
227
-		return TRUE;
227
+        return TRUE;
228 228
 
229
-	}
229
+    }
230 230
 
231
-	/**
232
-	 * Decrypt encrypted value with given control hash
233
-	 * @see http://yavkata.co.uk/weblog/php/securing-html-hidden-input-fields-using-encryption-and-hashing/
234
-	 *
235
-	 * @access	public
236
-	 *
237
-	 * @param	string		$encrypted: The encrypted value to decrypt
238
-	 * @param	string		$hash: The control hash for decrypting
239
-	 *
240
-	 * @return	mixed		The decrypted value or NULL on error
241
-	 */
242
-	public static function decrypt($encrypted, $hash) {
231
+    /**
232
+     * Decrypt encrypted value with given control hash
233
+     * @see http://yavkata.co.uk/weblog/php/securing-html-hidden-input-fields-using-encryption-and-hashing/
234
+     *
235
+     * @access	public
236
+     *
237
+     * @param	string		$encrypted: The encrypted value to decrypt
238
+     * @param	string		$hash: The control hash for decrypting
239
+     *
240
+     * @return	mixed		The decrypted value or NULL on error
241
+     */
242
+    public static function decrypt($encrypted, $hash) {
243 243
 
244
-		$decrypted = NULL;
244
+        $decrypted = NULL;
245 245
 
246
-		// Check for PHP extension "mcrypt".
247
-		if (!extension_loaded('mcrypt')) {
246
+        // Check for PHP extension "mcrypt".
247
+        if (!extension_loaded('mcrypt')) {
248 248
 
249
-			if (TYPO3_DLOG) {
249
+            if (TYPO3_DLOG) {
250 250
 
251
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] PHP extension "mcrypt" not available', self::$extKey, SYSLOG_SEVERITY_WARNING);
251
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] PHP extension "mcrypt" not available', self::$extKey, SYSLOG_SEVERITY_WARNING);
252 252
 
253
-			}
253
+            }
254 254
 
255
-			return;
255
+            return;
256 256
 
257
-		}
257
+        }
258 258
 
259
-		if (empty($encrypted) || empty($hash)) {
259
+        if (empty($encrypted) || empty($hash)) {
260 260
 
261
-			if (TYPO3_DLOG) {
261
+            if (TYPO3_DLOG) {
262 262
 
263
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] Invalid parameters given for decryption', self::$extKey, SYSLOG_SEVERITY_ERROR);
263
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] Invalid parameters given for decryption', self::$extKey, SYSLOG_SEVERITY_ERROR);
264 264
 
265
-			}
265
+            }
266 266
 
267
-			return;
267
+            return;
268 268
 
269
-		}
269
+        }
270 270
 
271
-		if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
271
+        if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
272 272
 
273
-			if (TYPO3_DLOG) {
273
+            if (TYPO3_DLOG) {
274 274
 
275
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] No encryption key set in TYPO3 configuration', self::$extKey, SYSLOG_SEVERITY_ERROR);
275
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] No encryption key set in TYPO3 configuration', self::$extKey, SYSLOG_SEVERITY_ERROR);
276 276
 
277
-			}
277
+            }
278 278
 
279
-			return;
279
+            return;
280 280
 
281
-		}
281
+        }
282 282
 
283
-		$iv = substr(md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']), 0, mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CFB));
283
+        $iv = substr(md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']), 0, mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CFB));
284 284
 
285
-		$decrypted = mcrypt_decrypt(MCRYPT_BLOWFISH, substr($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], 0, 56), base64_decode($encrypted), MCRYPT_MODE_CFB, $iv);
285
+        $decrypted = mcrypt_decrypt(MCRYPT_BLOWFISH, substr($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], 0, 56), base64_decode($encrypted), MCRYPT_MODE_CFB, $iv);
286 286
 
287
-		$salt = substr($hash, 0, 10);
287
+        $salt = substr($hash, 0, 10);
288 288
 
289
-		$hashed = $salt.substr(sha1($salt.$decrypted), -10);
289
+        $hashed = $salt.substr(sha1($salt.$decrypted), -10);
290 290
 
291
-		if ($hashed !== $hash) {
291
+        if ($hashed !== $hash) {
292 292
 
293
-			if (TYPO3_DLOG) {
293
+            if (TYPO3_DLOG) {
294 294
 
295
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] Invalid hash "'.$hash.'" given for decryption', self::$extKey, SYSLOG_SEVERITY_WARNING);
295
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] Invalid hash "'.$hash.'" given for decryption', self::$extKey, SYSLOG_SEVERITY_WARNING);
296 296
 
297
-			}
297
+            }
298 298
 
299
-			return;
299
+            return;
300 300
 
301
-		}
301
+        }
302 302
 
303
-		return $decrypted;
303
+        return $decrypted;
304 304
 
305
-	}
305
+    }
306 306
 
307
-	/**
308
-	 * Encrypt the given string
309
-	 * @see http://yavkata.co.uk/weblog/php/securing-html-hidden-input-fields-using-encryption-and-hashing/
310
-	 *
311
-	 * @access	public
312
-	 *
313
-	 * @param	string		$string: The string to encrypt
314
-	 *
315
-	 * @return	array		Array with encrypted string and control hash
316
-	 */
317
-	public static function encrypt($string) {
307
+    /**
308
+     * Encrypt the given string
309
+     * @see http://yavkata.co.uk/weblog/php/securing-html-hidden-input-fields-using-encryption-and-hashing/
310
+     *
311
+     * @access	public
312
+     *
313
+     * @param	string		$string: The string to encrypt
314
+     *
315
+     * @return	array		Array with encrypted string and control hash
316
+     */
317
+    public static function encrypt($string) {
318 318
 
319
-		// Check for PHP extension "mcrypt".
320
-		if (!extension_loaded('mcrypt')) {
319
+        // Check for PHP extension "mcrypt".
320
+        if (!extension_loaded('mcrypt')) {
321 321
 
322
-			if (TYPO3_DLOG) {
322
+            if (TYPO3_DLOG) {
323 323
 
324
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->encrypt('.$string.')] PHP extension "mcrypt" not available', self::$extKey, SYSLOG_SEVERITY_WARNING);
324
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->encrypt('.$string.')] PHP extension "mcrypt" not available', self::$extKey, SYSLOG_SEVERITY_WARNING);
325 325
 
326
-			}
326
+            }
327 327
 
328
-			return;
328
+            return;
329 329
 
330
-		}
330
+        }
331 331
 
332
-		if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
332
+        if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
333 333
 
334
-			if (TYPO3_DLOG) {
334
+            if (TYPO3_DLOG) {
335 335
 
336
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->encrypt('.$string.')] No encryption key set in TYPO3 configuration', self::$extKey, SYSLOG_SEVERITY_ERROR);
336
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->encrypt('.$string.')] No encryption key set in TYPO3 configuration', self::$extKey, SYSLOG_SEVERITY_ERROR);
337 337
 
338
-			}
338
+            }
339 339
 
340
-			return;
340
+            return;
341 341
 
342
-		}
342
+        }
343 343
 
344
-		$iv = substr(md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']), 0, mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CFB));
344
+        $iv = substr(md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']), 0, mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CFB));
345 345
 
346
-		$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_BLOWFISH, substr($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], 0, 56), $string, MCRYPT_MODE_CFB, $iv));
346
+        $encrypted = base64_encode(mcrypt_encrypt(MCRYPT_BLOWFISH, substr($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], 0, 56), $string, MCRYPT_MODE_CFB, $iv));
347 347
 
348
-		$salt = substr(md5(uniqid(rand(), TRUE)), 0, 10);
348
+        $salt = substr(md5(uniqid(rand(), TRUE)), 0, 10);
349 349
 
350
-		$hash = $salt.substr(sha1($salt.$string), -10);
350
+        $hash = $salt.substr(sha1($salt.$string), -10);
351 351
 
352
-		return array ('encrypted' => $encrypted, 'hash' => $hash);
352
+        return array ('encrypted' => $encrypted, 'hash' => $hash);
353 353
 
354
-	}
354
+    }
355 355
 
356
-	/**
357
-	 * Get a backend user object (even in frontend mode)
358
-	 *
359
-	 * @access	public
360
-	 *
361
-	 * @return	\TYPO3\CMS\Core\Authentication\BackendUserAuthentication		Instance of \TYPO3\CMS\Core\Authentication\BackendUserAuthentication or NULL on failure
362
-	 */
363
-	public static function getBeUser() {
356
+    /**
357
+     * Get a backend user object (even in frontend mode)
358
+     *
359
+     * @access	public
360
+     *
361
+     * @return	\TYPO3\CMS\Core\Authentication\BackendUserAuthentication		Instance of \TYPO3\CMS\Core\Authentication\BackendUserAuthentication or NULL on failure
362
+     */
363
+    public static function getBeUser() {
364 364
 
365
-		if (TYPO3_MODE === 'FE' || TYPO3_MODE === 'BE') {
365
+        if (TYPO3_MODE === 'FE' || TYPO3_MODE === 'BE') {
366 366
 
367
-			// Initialize backend session with CLI user's rights.
368
-			$userObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
367
+            // Initialize backend session with CLI user's rights.
368
+            $userObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
369 369
 
370
-			$userObj->dontSetCookie = TRUE;
370
+            $userObj->dontSetCookie = TRUE;
371 371
 
372
-			$userObj->start();
372
+            $userObj->start();
373 373
 
374
-			$userObj->setBeUserByName('_cli_dlf');
374
+            $userObj->setBeUserByName('_cli_dlf');
375 375
 
376
-			$userObj->backendCheckLogin();
376
+            $userObj->backendCheckLogin();
377 377
 
378
-			return $userObj;
378
+            return $userObj;
379 379
 
380
-		} else {
380
+        } else {
381 381
 
382
-			if (TYPO3_DLOG) {
382
+            if (TYPO3_DLOG) {
383 383
 
384
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getBeUser()] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
384
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getBeUser()] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
385 385
 
386
-			}
386
+            }
387 387
 
388
-			return;
388
+            return;
389 389
 
390
-		}
390
+        }
391 391
 
392
-	}
392
+    }
393 393
 
394
-	/**
395
-	 * Get the current frontend user object
396
-	 *
397
-	 * @access	public
398
-	 *
399
-	 * @return	\TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication		Instance of \TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication or NULL on failure
400
-	 */
401
-	public static function getFeUser() {
394
+    /**
395
+     * Get the current frontend user object
396
+     *
397
+     * @access	public
398
+     *
399
+     * @return	\TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication		Instance of \TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication or NULL on failure
400
+     */
401
+    public static function getFeUser() {
402 402
 
403
-		if (TYPO3_MODE === 'FE') {
403
+        if (TYPO3_MODE === 'FE') {
404 404
 
405
-			// Check if a user is currently logged in.
406
-			if (!empty($GLOBALS['TSFE']->loginUser)) {
405
+            // Check if a user is currently logged in.
406
+            if (!empty($GLOBALS['TSFE']->loginUser)) {
407 407
 
408
-				return $GLOBALS['TSFE']->fe_user;
408
+                return $GLOBALS['TSFE']->fe_user;
409 409
 
410
-			} elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('eID') !== NULL) {
410
+            } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('eID') !== NULL) {
411 411
 
412
-				return \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
412
+                return \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
413 413
 
414
-			}
414
+            }
415 415
 
416
-		} else {
416
+        } else {
417 417
 
418
-			if (TYPO3_DLOG) {
418
+            if (TYPO3_DLOG) {
419 419
 
420
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getFeUser()] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
420
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getFeUser()] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
421 421
 
422
-			}
422
+            }
423 423
 
424
-		}
424
+        }
425 425
 
426
-		return;
426
+        return;
427 427
 
428
-	}
428
+    }
429 429
 
430
-	/**
431
-	 * Get the registered hook objects for a class
432
-	 *
433
-	 * @access	public
434
-	 *
435
-	 * @param	string		$scriptRelPath: The path to the class file
436
-	 *
437
-	 * @return	array		Array of hook objects for the class
438
-	 */
439
-	public static function getHookObjects($scriptRelPath) {
430
+    /**
431
+     * Get the registered hook objects for a class
432
+     *
433
+     * @access	public
434
+     *
435
+     * @param	string		$scriptRelPath: The path to the class file
436
+     *
437
+     * @return	array		Array of hook objects for the class
438
+     */
439
+    public static function getHookObjects($scriptRelPath) {
440 440
 
441
-		$hookObjects = array ();
441
+        $hookObjects = array ();
442 442
 
443
-		if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) {
443
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) {
444 444
 
445
-			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) {
445
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) {
446 446
 
447
-				$hookObjects[] = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
447
+                $hookObjects[] = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
448 448
 
449
-			}
449
+            }
450 450
 
451
-		}
451
+        }
452 452
 
453
-		return $hookObjects;
453
+        return $hookObjects;
454 454
 
455
-	}
455
+    }
456 456
 
457
-	/**
458
-	 * Get the "index_name" for an UID
459
-	 *
460
-	 * @access	public
461
-	 *
462
-	 * @param	integer		$uid: The UID of the record
463
-	 * @param	string		$table: Get the "index_name" from this table
464
-	 * @param	integer		$pid: Get the "index_name" from this page
465
-	 *
466
-	 * @return	string		"index_name" for the given UID
467
-	 */
468
-	public static function getIndexName($uid, $table, $pid = -1) {
457
+    /**
458
+     * Get the "index_name" for an UID
459
+     *
460
+     * @access	public
461
+     *
462
+     * @param	integer		$uid: The UID of the record
463
+     * @param	string		$table: Get the "index_name" from this table
464
+     * @param	integer		$pid: Get the "index_name" from this page
465
+     *
466
+     * @return	string		"index_name" for the given UID
467
+     */
468
+    public static function getIndexName($uid, $table, $pid = -1) {
469 469
 
470
-		// Save parameters for logging purposes.
471
-		$_uid = $uid;
470
+        // Save parameters for logging purposes.
471
+        $_uid = $uid;
472 472
 
473
-		$_pid = $pid;
473
+        $_pid = $pid;
474 474
 
475
-		// Sanitize input.
476
-		$uid = max(intval($uid), 0);
475
+        // Sanitize input.
476
+        $uid = max(intval($uid), 0);
477 477
 
478
-		if (!$uid || !in_array($table, array ('tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'))) {
478
+        if (!$uid || !in_array($table, array ('tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'))) {
479 479
 
480
-			if (TYPO3_DLOG) {
480
+            if (TYPO3_DLOG) {
481 481
 
482
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getIndexName('.$_uid.', '.$table.', '.$_pid.')] Invalid UID "'.$uid.'" or table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
482
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getIndexName('.$_uid.', '.$table.', '.$_pid.')] Invalid UID "'.$uid.'" or table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
483 483
 
484
-			}
484
+            }
485 485
 
486
-			return '';
486
+            return '';
487 487
 
488
-		}
488
+        }
489 489
 
490
-		$where = '';
490
+        $where = '';
491 491
 
492
-		// Should we check for a specific PID, too?
493
-		if ($pid !== -1) {
492
+        // Should we check for a specific PID, too?
493
+        if ($pid !== -1) {
494 494
 
495
-			$pid = max(intval($pid), 0);
495
+            $pid = max(intval($pid), 0);
496 496
 
497
-			$where = ' AND '.$table.'.pid='.$pid;
497
+            $where = ' AND '.$table.'.pid='.$pid;
498 498
 
499
-		}
499
+        }
500 500
 
501
-		// Get index_name from database.
502
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
503
-			$table.'.index_name AS index_name',
504
-			$table,
505
-			$table.'.uid='.$uid.$where.self::whereClause($table),
506
-			'',
507
-			'',
508
-			'1'
509
-		);
501
+        // Get index_name from database.
502
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
503
+            $table.'.index_name AS index_name',
504
+            $table,
505
+            $table.'.uid='.$uid.$where.self::whereClause($table),
506
+            '',
507
+            '',
508
+            '1'
509
+        );
510 510
 
511
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
511
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
512 512
 
513
-			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
513
+            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
514 514
 
515
-			return $resArray['index_name'];
515
+            return $resArray['index_name'];
516 516
 
517
-		} else {
517
+        } else {
518 518
 
519
-			if (TYPO3_DLOG) {
519
+            if (TYPO3_DLOG) {
520 520
 
521
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getIndexName('.$_uid.', '.$table.', '.$_pid.')] No "index_name" with UID "'.$uid.'" and PID "'.$pid.'" found in table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
521
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getIndexName('.$_uid.', '.$table.', '.$_pid.')] No "index_name" with UID "'.$uid.'" and PID "'.$pid.'" found in table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
522 522
 
523
-			}
523
+            }
524 524
 
525
-			return '';
525
+            return '';
526 526
 
527
-		}
527
+        }
528 528
 
529
-	}
529
+    }
530 530
 
531
-	/**
532
-	 * Get the UID for a given "index_name"
533
-	 *
534
-	 * @access	public
535
-	 *
536
-	 * @param	integer		$index_name: The index_name of the record
537
-	 * @param	string		$table: Get the "index_name" from this table
538
-	 * @param	integer		$pid: Get the "index_name" from this page
539
-	 *
540
-	 * @return	string		"uid" for the given index_name
541
-	 */
542
-	public static function getIdFromIndexName($index_name, $table, $pid = -1) {
531
+    /**
532
+     * Get the UID for a given "index_name"
533
+     *
534
+     * @access	public
535
+     *
536
+     * @param	integer		$index_name: The index_name of the record
537
+     * @param	string		$table: Get the "index_name" from this table
538
+     * @param	integer		$pid: Get the "index_name" from this page
539
+     *
540
+     * @return	string		"uid" for the given index_name
541
+     */
542
+    public static function getIdFromIndexName($index_name, $table, $pid = -1) {
543 543
 
544
-		// Save parameters for logging purposes.
545
-		$_index_name = $index_name;
544
+        // Save parameters for logging purposes.
545
+        $_index_name = $index_name;
546 546
 
547
-		$_pid = $pid;
547
+        $_pid = $pid;
548 548
 
549
-		if (!$index_name || !in_array($table, array ('tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'))) {
549
+        if (!$index_name || !in_array($table, array ('tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'))) {
550 550
 
551
-			if (TYPO3_DLOG) {
551
+            if (TYPO3_DLOG) {
552 552
 
553
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getIdFromIndexName('.$_index_name.', '.$table.', '.$_pid.')] Invalid UID "'.$index_name.'" or table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
553
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getIdFromIndexName('.$_index_name.', '.$table.', '.$_pid.')] Invalid UID "'.$index_name.'" or table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
554 554
 
555
-			}
555
+            }
556 556
 
557
-			return '';
557
+            return '';
558 558
 
559
-		}
559
+        }
560 560
 
561
-		$where = '';
561
+        $where = '';
562 562
 
563
-		// Should we check for a specific PID, too?
564
-		if ($pid !== -1) {
563
+        // Should we check for a specific PID, too?
564
+        if ($pid !== -1) {
565 565
 
566
-			$pid = max(intval($pid), 0);
566
+            $pid = max(intval($pid), 0);
567 567
 
568
-			$where = ' AND '.$table.'.pid='.$pid;
568
+            $where = ' AND '.$table.'.pid='.$pid;
569 569
 
570
-		}
570
+        }
571 571
 
572
-		// Get index_name from database.
573
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
574
-			$table.'.uid AS uid',
575
-			$table,
576
-			$table.'.index_name="'.$index_name.'"'.$where.self::whereClause($table),
577
-			'',
578
-			'',
579
-			'1'
580
-		);
572
+        // Get index_name from database.
573
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
574
+            $table.'.uid AS uid',
575
+            $table,
576
+            $table.'.index_name="'.$index_name.'"'.$where.self::whereClause($table),
577
+            '',
578
+            '',
579
+            '1'
580
+        );
581 581
 
582
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
582
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
583 583
 
584
-			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
584
+            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
585 585
 
586
-			return $resArray['uid'];
586
+            return $resArray['uid'];
587 587
 
588
-		} else {
588
+        } else {
589 589
 
590
-			if (TYPO3_DLOG) {
590
+            if (TYPO3_DLOG) {
591 591
 
592
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getIdFromIndexName('.$_index_name.', '.$table.', '.$_pid.')] No UID for given "index_name" "'.$index_name.'" and PID "'.$pid.'" found in table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
592
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getIdFromIndexName('.$_index_name.', '.$table.', '.$_pid.')] No UID for given "index_name" "'.$index_name.'" and PID "'.$pid.'" found in table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
593 593
 
594
-			}
594
+            }
595 595
 
596
-			return '';
596
+            return '';
597 597
 
598
-		}
598
+        }
599 599
 
600
-	}
600
+    }
601 601
 
602
-	/**
603
-	 * Get language name from ISO code
604
-	 *
605
-	 * @access	public
606
-	 *
607
-	 * @param	string		$code: ISO 639-1 or ISO 639-2/B language code
608
-	 *
609
-	 * @return	string		Localized full name of language or unchanged input
610
-	 */
611
-	public static function getLanguageName($code) {
602
+    /**
603
+     * Get language name from ISO code
604
+     *
605
+     * @access	public
606
+     *
607
+     * @param	string		$code: ISO 639-1 or ISO 639-2/B language code
608
+     *
609
+     * @return	string		Localized full name of language or unchanged input
610
+     */
611
+    public static function getLanguageName($code) {
612 612
 
613
-		// Analyze code and set appropriate ISO table.
614
-		$isoCode = strtolower(trim($code));
613
+        // Analyze code and set appropriate ISO table.
614
+        $isoCode = strtolower(trim($code));
615 615
 
616
-		if (preg_match('/^[a-z]{3}$/', $isoCode)) {
616
+        if (preg_match('/^[a-z]{3}$/', $isoCode)) {
617 617
 
618
-			$file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'lib/ISO-639/iso-639-2b.xml';
618
+            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'lib/ISO-639/iso-639-2b.xml';
619 619
 
620
-		} elseif (preg_match('/^[a-z]{2}$/', $isoCode)) {
620
+        } elseif (preg_match('/^[a-z]{2}$/', $isoCode)) {
621 621
 
622
-			$file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'lib/ISO-639/iso-639-1.xml';
622
+            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'lib/ISO-639/iso-639-1.xml';
623 623
 
624
-		} else {
624
+        } else {
625 625
 
626
-			// No ISO code, return unchanged.
627
-			return $code;
626
+            // No ISO code, return unchanged.
627
+            return $code;
628 628
 
629
-		}
629
+        }
630 630
 
631
-		// Load ISO table and get localized full name of language.
632
-		if (TYPO3_MODE === 'FE') {
631
+        // Load ISO table and get localized full name of language.
632
+        if (TYPO3_MODE === 'FE') {
633 633
 
634
-			$iso639 = $GLOBALS['TSFE']->readLLfile($file);
634
+            $iso639 = $GLOBALS['TSFE']->readLLfile($file);
635 635
 
636
-			if (!empty($iso639['default'][$isoCode])) {
636
+            if (!empty($iso639['default'][$isoCode])) {
637 637
 
638
-				$lang = $GLOBALS['TSFE']->getLLL($isoCode, $iso639);
638
+                $lang = $GLOBALS['TSFE']->getLLL($isoCode, $iso639);
639 639
 
640
-			}
640
+            }
641 641
 
642
-		} elseif (TYPO3_MODE === 'BE') {
642
+        } elseif (TYPO3_MODE === 'BE') {
643 643
 
644
-			$iso639 = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE);
644
+            $iso639 = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE);
645 645
 
646
-			if (!empty($iso639['default'][$isoCode])) {
646
+            if (!empty($iso639['default'][$isoCode])) {
647 647
 
648
-				$lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639, FALSE);
648
+                $lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639, FALSE);
649 649
 
650
-			}
650
+            }
651 651
 
652
-		} else {
652
+        } else {
653 653
 
654
-			if (TYPO3_DLOG) {
654
+            if (TYPO3_DLOG) {
655 655
 
656
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getLanguageName('.$code.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
656
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getLanguageName('.$code.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
657 657
 
658
-			}
658
+            }
659 659
 
660
-			return $code;
660
+            return $code;
661 661
 
662
-		}
662
+        }
663 663
 
664
-		if (!empty($lang)) {
664
+        if (!empty($lang)) {
665 665
 
666
-			return $lang;
666
+            return $lang;
667 667
 
668
-		} else {
668
+        } else {
669 669
 
670
-			if (TYPO3_DLOG) {
670
+            if (TYPO3_DLOG) {
671 671
 
672
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getLanguageName('.$code.')] Language code "'.$code.'" not found in ISO-639 table', self::$extKey, SYSLOG_SEVERITY_NOTICE);
672
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getLanguageName('.$code.')] Language code "'.$code.'" not found in ISO-639 table', self::$extKey, SYSLOG_SEVERITY_NOTICE);
673 673
 
674
-			}
674
+            }
675 675
 
676
-			return $code;
676
+            return $code;
677 677
 
678
-		}
678
+        }
679 679
 
680
-	}
680
+    }
681 681
 
682
-	/**
683
-	 * Wrapper function for getting localizations in frontend and backend
684
-	 *
685
-	 * @param	string		$key: The locallang key to translate
686
-	 * @param	boolean		$hsc: Should the result be htmlspecialchar()'ed?
687
-	 * @param	string		$default: Default return value if no translation is available
688
-	 *
689
-	 * @return	string		The translated string or the given key on failure
690
-	 */
691
-	public static function getLL($key, $hsc = FALSE, $default = '') {
682
+    /**
683
+     * Wrapper function for getting localizations in frontend and backend
684
+     *
685
+     * @param	string		$key: The locallang key to translate
686
+     * @param	boolean		$hsc: Should the result be htmlspecialchar()'ed?
687
+     * @param	string		$default: Default return value if no translation is available
688
+     *
689
+     * @return	string		The translated string or the given key on failure
690
+     */
691
+    public static function getLL($key, $hsc = FALSE, $default = '') {
692 692
 
693
-		// Set initial output to default value.
694
-		$translated = (string) $default;
693
+        // Set initial output to default value.
694
+        $translated = (string) $default;
695 695
 
696
-		// Load common locallang file.
697
-		if (empty(self::$locallang)) {
696
+        // Load common locallang file.
697
+        if (empty(self::$locallang)) {
698 698
 
699
-			$file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey, 'common/locallang.xml');
699
+            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey, 'common/locallang.xml');
700 700
 
701
-			if (TYPO3_MODE === 'FE') {
701
+            if (TYPO3_MODE === 'FE') {
702 702
 
703
-				self::$locallang = $GLOBALS['TSFE']->readLLfile($file);
703
+                self::$locallang = $GLOBALS['TSFE']->readLLfile($file);
704 704
 
705
-			} elseif (TYPO3_MODE === 'BE') {
705
+            } elseif (TYPO3_MODE === 'BE') {
706 706
 
707
-				self::$locallang = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE);
707
+                self::$locallang = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE);
708 708
 
709
-			} elseif (TYPO3_DLOG) {
709
+            } elseif (TYPO3_DLOG) {
710 710
 
711
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getLL('.$key.', '.$default.', ['.($hsc ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
711
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getLL('.$key.', '.$default.', ['.($hsc ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
712 712
 
713
-			}
713
+            }
714 714
 
715
-		}
715
+        }
716 716
 
717
-		// Get translation.
718
-		if (!empty(self::$locallang['default'][$key])) {
717
+        // Get translation.
718
+        if (!empty(self::$locallang['default'][$key])) {
719 719
 
720
-			if (TYPO3_MODE === 'FE') {
720
+            if (TYPO3_MODE === 'FE') {
721 721
 
722
-				$translated = $GLOBALS['TSFE']->getLLL($key, self::$locallang);
722
+                $translated = $GLOBALS['TSFE']->getLLL($key, self::$locallang);
723 723
 
724
-			} elseif (TYPO3_MODE === 'BE') {
724
+            } elseif (TYPO3_MODE === 'BE') {
725 725
 
726
-				$translated = $GLOBALS['LANG']->getLLL($key, self::$locallang, FALSE);
726
+                $translated = $GLOBALS['LANG']->getLLL($key, self::$locallang, FALSE);
727 727
 
728
-			} elseif (TYPO3_DLOG) {
728
+            } elseif (TYPO3_DLOG) {
729 729
 
730
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getLL('.$key.', '.$default.', ['.($hsc ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
730
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getLL('.$key.', '.$default.', ['.($hsc ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
731 731
 
732
-			}
732
+            }
733 733
 
734
-		}
734
+        }
735 735
 
736
-		// Escape HTML characters if applicable.
737
-		if ($hsc) {
736
+        // Escape HTML characters if applicable.
737
+        if ($hsc) {
738 738
 
739
-			$translated = htmlspecialchars($translated);
739
+            $translated = htmlspecialchars($translated);
740 740
 
741
-		}
741
+        }
742 742
 
743
-		return $translated;
743
+        return $translated;
744 744
 
745
-	}
745
+    }
746 746
 
747
-	/**
748
-	 * Get the URN of an object
749
-	 * @see	http://www.persistent-identifier.de/?link=316
750
-	 *
751
-	 * @access	public
752
-	 *
753
-	 * @param	string		$base: The namespace and base URN
754
-	 * @param	string		$id: The object's identifier
755
-	 *
756
-	 * @return	string		Uniform Resource Name as string
757
-	 */
758
-	public static function getURN($base, $id) {
747
+    /**
748
+     * Get the URN of an object
749
+     * @see	http://www.persistent-identifier.de/?link=316
750
+     *
751
+     * @access	public
752
+     *
753
+     * @param	string		$base: The namespace and base URN
754
+     * @param	string		$id: The object's identifier
755
+     *
756
+     * @return	string		Uniform Resource Name as string
757
+     */
758
+    public static function getURN($base, $id) {
759 759
 
760
-		$concordance = array (
761
-			'0' => 1,
762
-			'1' => 2,
763
-			'2' => 3,
764
-			'3' => 4,
765
-			'4' => 5,
766
-			'5' => 6,
767
-			'6' => 7,
768
-			'7' => 8,
769
-			'8' => 9,
770
-			'9' => 41,
771
-			'a' => 18,
772
-			'b' => 14,
773
-			'c' => 19,
774
-			'd' => 15,
775
-			'e' => 16,
776
-			'f' => 21,
777
-			'g' => 22,
778
-			'h' => 23,
779
-			'i' => 24,
780
-			'j' => 25,
781
-			'k' => 42,
782
-			'l' => 26,
783
-			'm' => 27,
784
-			'n' => 13,
785
-			'o' => 28,
786
-			'p' => 29,
787
-			'q' => 31,
788
-			'r' => 12,
789
-			's' => 32,
790
-			't' => 33,
791
-			'u' => 11,
792
-			'v' => 34,
793
-			'w' => 35,
794
-			'x' => 36,
795
-			'y' => 37,
796
-			'z' => 38,
797
-			'-' => 39,
798
-			':' => 17,
799
-		);
760
+        $concordance = array (
761
+            '0' => 1,
762
+            '1' => 2,
763
+            '2' => 3,
764
+            '3' => 4,
765
+            '4' => 5,
766
+            '5' => 6,
767
+            '6' => 7,
768
+            '7' => 8,
769
+            '8' => 9,
770
+            '9' => 41,
771
+            'a' => 18,
772
+            'b' => 14,
773
+            'c' => 19,
774
+            'd' => 15,
775
+            'e' => 16,
776
+            'f' => 21,
777
+            'g' => 22,
778
+            'h' => 23,
779
+            'i' => 24,
780
+            'j' => 25,
781
+            'k' => 42,
782
+            'l' => 26,
783
+            'm' => 27,
784
+            'n' => 13,
785
+            'o' => 28,
786
+            'p' => 29,
787
+            'q' => 31,
788
+            'r' => 12,
789
+            's' => 32,
790
+            't' => 33,
791
+            'u' => 11,
792
+            'v' => 34,
793
+            'w' => 35,
794
+            'x' => 36,
795
+            'y' => 37,
796
+            'z' => 38,
797
+            '-' => 39,
798
+            ':' => 17,
799
+        );
800 800
 
801
-		$urn = strtolower($base.$id);
801
+        $urn = strtolower($base.$id);
802 802
 
803
-		if (preg_match('/[^a-z0-9:-]/', $urn)) {
803
+        if (preg_match('/[^a-z0-9:-]/', $urn)) {
804 804
 
805
-			if (TYPO3_DLOG) {
805
+            if (TYPO3_DLOG) {
806 806
 
807
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getURN('.$base.', '.$id.')] Invalid chars in given parameters', self::$extKey, SYSLOG_SEVERITY_WARNING);
807
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->getURN('.$base.', '.$id.')] Invalid chars in given parameters', self::$extKey, SYSLOG_SEVERITY_WARNING);
808 808
 
809
-			}
809
+            }
810 810
 
811
-			return '';
811
+            return '';
812 812
 
813
-		}
813
+        }
814 814
 
815
-		$digits = '';
815
+        $digits = '';
816 816
 
817
-		for ($i = 0, $j = strlen($urn); $i < $j; $i++) {
817
+        for ($i = 0, $j = strlen($urn); $i < $j; $i++) {
818 818
 
819
-			$digits .= $concordance[substr($urn, $i, 1)];
819
+            $digits .= $concordance[substr($urn, $i, 1)];
820 820
 
821
-		}
821
+        }
822 822
 
823
-		$checksum = 0;
823
+        $checksum = 0;
824 824
 
825
-		for ($i = 0, $j = strlen($digits); $i < $j; $i++) {
825
+        for ($i = 0, $j = strlen($digits); $i < $j; $i++) {
826 826
 
827
-			$checksum += ($i + 1) * intval(substr($digits, $i, 1));
827
+            $checksum += ($i + 1) * intval(substr($digits, $i, 1));
828 828
 
829
-		}
829
+        }
830 830
 
831
-		$checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1);
831
+        $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1);
832 832
 
833
-		return $base.$id.$checksum;
833
+        return $base.$id.$checksum;
834 834
 
835
-	}
835
+    }
836 836
 
837
-	/**
838
-	 * Check if given ID is a valid Pica Production Number (PPN)
839
-	 *
840
-	 * @access	public
841
-	 *
842
-	 * @param	string		$ppn: The identifier to check
843
-	 *
844
-	 * @return	boolean		Is $id a valid PPN?
845
-	 */
846
-	public static function isPPN($id) {
837
+    /**
838
+     * Check if given ID is a valid Pica Production Number (PPN)
839
+     *
840
+     * @access	public
841
+     *
842
+     * @param	string		$ppn: The identifier to check
843
+     *
844
+     * @return	boolean		Is $id a valid PPN?
845
+     */
846
+    public static function isPPN($id) {
847 847
 
848
-		return self::checkIdentifier($id, 'PPN');
848
+        return self::checkIdentifier($id, 'PPN');
849 849
 
850
-	}
850
+    }
851 851
 
852
-	/**
853
-	 * Load value from user's session.
854
-	 *
855
-	 * @access	public
856
-	 *
857
-	 * @param	string		$key: Session data key for retrieval
858
-	 *
859
-	 * @return	mixed		Session value for given key or NULL on failure
860
-	 */
861
-	public static function loadFromSession($key) {
852
+    /**
853
+     * Load value from user's session.
854
+     *
855
+     * @access	public
856
+     *
857
+     * @param	string		$key: Session data key for retrieval
858
+     *
859
+     * @return	mixed		Session value for given key or NULL on failure
860
+     */
861
+    public static function loadFromSession($key) {
862 862
 
863
-		// Save parameter for logging purposes.
864
-		$_key = $key;
863
+        // Save parameter for logging purposes.
864
+        $_key = $key;
865 865
 
866
-		// Cast to string for security reasons.
867
-		$key = (string) $key;
866
+        // Cast to string for security reasons.
867
+        $key = (string) $key;
868 868
 
869
-		if (!$key) {
869
+        if (!$key) {
870 870
 
871
-			if (TYPO3_DLOG) {
871
+            if (TYPO3_DLOG) {
872 872
 
873
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->loadFromSession('.$_key.')] Invalid key "'.$key.'" for session data retrieval', self::$extKey, SYSLOG_SEVERITY_WARNING);
873
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->loadFromSession('.$_key.')] Invalid key "'.$key.'" for session data retrieval', self::$extKey, SYSLOG_SEVERITY_WARNING);
874 874
 
875
-			}
875
+            }
876 876
 
877
-			return;
877
+            return;
878 878
 
879
-		}
879
+        }
880 880
 
881
-		// Get the session data.
882
-		if (TYPO3_MODE === 'FE') {
881
+        // Get the session data.
882
+        if (TYPO3_MODE === 'FE') {
883 883
 
884
-			return $GLOBALS['TSFE']->fe_user->getKey('ses', $key);
884
+            return $GLOBALS['TSFE']->fe_user->getKey('ses', $key);
885 885
 
886
-		} elseif (TYPO3_MODE === 'BE') {
886
+        } elseif (TYPO3_MODE === 'BE') {
887 887
 
888
-			return $GLOBALS['BE_USER']->getSessionData($key);
888
+            return $GLOBALS['BE_USER']->getSessionData($key);
889 889
 
890
-		} else {
890
+        } else {
891 891
 
892
-			if (TYPO3_DLOG) {
892
+            if (TYPO3_DLOG) {
893 893
 
894
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->loadFromSession('.$_key.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
894
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->loadFromSession('.$_key.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
895 895
 
896
-			}
896
+            }
897 897
 
898
-			return;
898
+            return;
899 899
 
900
-		}
900
+        }
901 901
 
902
-	}
902
+    }
903 903
 
904
-	/**
905
-	 * Process a data and/or command map with TYPO3 core engine.
906
-	 *
907
-	 * @access	public
908
-	 *
909
-	 * @param	array		$data: Data map
910
-	 * @param	array		$cmd: Command map
911
-	 * @param	boolean		$reverseOrder: Should the command map be processed first?
912
-	 * @param	boolean		$be_user: Use current backend user's rights for processing?
913
-	 *
914
-	 * @return	array		Array of substituted "NEW..." identifiers and their actual UIDs.
915
-	 */
916
-	public static function processDB(array $data = array (), array $cmd = array (), $reverseOrder = FALSE, $be_user = FALSE) {
904
+    /**
905
+     * Process a data and/or command map with TYPO3 core engine.
906
+     *
907
+     * @access	public
908
+     *
909
+     * @param	array		$data: Data map
910
+     * @param	array		$cmd: Command map
911
+     * @param	boolean		$reverseOrder: Should the command map be processed first?
912
+     * @param	boolean		$be_user: Use current backend user's rights for processing?
913
+     *
914
+     * @return	array		Array of substituted "NEW..." identifiers and their actual UIDs.
915
+     */
916
+    public static function processDB(array $data = array (), array $cmd = array (), $reverseOrder = FALSE, $be_user = FALSE) {
917 917
 
918
-		// Instantiate TYPO3 core engine.
919
-		$tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
918
+        // Instantiate TYPO3 core engine.
919
+        $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
920 920
 
921
-		// Set some configuration variables.
922
-		$tce->stripslashes_values = FALSE;
921
+        // Set some configuration variables.
922
+        $tce->stripslashes_values = FALSE;
923 923
 
924
-		// Get backend user for processing.
925
-		if ($be_user && isset($GLOBALS['BE_USER'])) {
924
+        // Get backend user for processing.
925
+        if ($be_user && isset($GLOBALS['BE_USER'])) {
926 926
 
927
-			$user = $GLOBALS['BE_USER'];
927
+            $user = $GLOBALS['BE_USER'];
928 928
 
929
-		} else {
929
+        } else {
930 930
 
931
-			$user = self::getBeUser();
931
+            $user = self::getBeUser();
932 932
 
933
-		}
933
+        }
934 934
 
935
-		// Load data and command arrays.
936
-		$tce->start($data, $cmd, $user);
935
+        // Load data and command arrays.
936
+        $tce->start($data, $cmd, $user);
937 937
 
938
-		// Process command map first if default order is reversed.
939
-		if ($cmd && $reverseOrder) {
938
+        // Process command map first if default order is reversed.
939
+        if ($cmd && $reverseOrder) {
940 940
 
941
-			$tce->process_cmdmap();
941
+            $tce->process_cmdmap();
942 942
 
943
-		}
943
+        }
944 944
 
945
-		// Process data map.
946
-		if ($data) {
945
+        // Process data map.
946
+        if ($data) {
947 947
 
948
-			$tce->process_datamap();
948
+            $tce->process_datamap();
949 949
 
950
-		}
950
+        }
951 951
 
952
-		// Process command map if processing order is not reversed.
953
-		if ($cmd && !$reverseOrder) {
952
+        // Process command map if processing order is not reversed.
953
+        if ($cmd && !$reverseOrder) {
954 954
 
955
-			$tce->process_cmdmap();
955
+            $tce->process_cmdmap();
956 956
 
957
-		}
957
+        }
958 958
 
959
-		return $tce->substNEWwithIDs;
959
+        return $tce->substNEWwithIDs;
960 960
 
961
-	}
961
+    }
962 962
 
963
-	/**
964
-	 * Process a data and/or command map with TYPO3 core engine as admin.
965
-	 *
966
-	 * @access	public
967
-	 *
968
-	 * @param	array		$data: Data map
969
-	 * @param	array		$cmd: Command map
970
-	 * @param	boolean		$reverseOrder: Should the command map be processed first?
971
-	 *
972
-	 * @return	array		Array of substituted "NEW..." identifiers and their actual UIDs.
973
-	 */
974
-	public static function processDBasAdmin(array $data = array (), array $cmd = array (), $reverseOrder = FALSE) {
963
+    /**
964
+     * Process a data and/or command map with TYPO3 core engine as admin.
965
+     *
966
+     * @access	public
967
+     *
968
+     * @param	array		$data: Data map
969
+     * @param	array		$cmd: Command map
970
+     * @param	boolean		$reverseOrder: Should the command map be processed first?
971
+     *
972
+     * @return	array		Array of substituted "NEW..." identifiers and their actual UIDs.
973
+     */
974
+    public static function processDBasAdmin(array $data = array (), array $cmd = array (), $reverseOrder = FALSE) {
975 975
 
976
-		if (TYPO3_MODE === 'BE' && $GLOBALS['BE_USER']->isAdmin()) {
976
+        if (TYPO3_MODE === 'BE' && $GLOBALS['BE_USER']->isAdmin()) {
977 977
 
978
-			return self::processDB($data, $cmd, $reverseOrder, TRUE);
978
+            return self::processDB($data, $cmd, $reverseOrder, TRUE);
979 979
 
980
-		} else {
980
+        } else {
981 981
 
982
-			if (TYPO3_DLOG) {
982
+            if (TYPO3_DLOG) {
983 983
 
984
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->processDBasAdmin([data->data], [data->cmd], ['.($reverseOrder ? 'TRUE' : 'FALSE').'])] Current backend user has no admin privileges', self::$extKey, SYSLOG_SEVERITY_ERROR, array ('data' => $data, 'cmd' => $cmd));
984
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->processDBasAdmin([data->data], [data->cmd], ['.($reverseOrder ? 'TRUE' : 'FALSE').'])] Current backend user has no admin privileges', self::$extKey, SYSLOG_SEVERITY_ERROR, array ('data' => $data, 'cmd' => $cmd));
985 985
 
986
-			}
986
+            }
987 987
 
988
-			return array ();
988
+            return array ();
989 989
 
990
-		}
990
+        }
991 991
 
992
-	}
992
+    }
993 993
 
994
-	/**
995
-	 * Fetches and renders all available flash messages from the queue.
996
-	 *
997
-	 * @return	string		All flash messages in the queue rendered as HTML.
998
-	 */
999
-	public static function renderFlashMessages() {
994
+    /**
995
+     * Fetches and renders all available flash messages from the queue.
996
+     *
997
+     * @return	string		All flash messages in the queue rendered as HTML.
998
+     */
999
+    public static function renderFlashMessages() {
1000 1000
 
1001
-		$flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
1001
+        $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
1002 1002
 
1003
-		$content = '';
1003
+        $content = '';
1004 1004
 
1005
-		if (version_compare(TYPO3_branch, '7.4', '<')) {
1005
+        if (version_compare(TYPO3_branch, '7.4', '<')) {
1006 1006
 
1007
-			// For TYPO3 6.2 - 7.3, we can use the existing method.
1008
-			$content .= $flashMessageService->getMessageQueueByIdentifier()->renderFlashMessages();
1007
+            // For TYPO3 6.2 - 7.3, we can use the existing method.
1008
+            $content .= $flashMessageService->getMessageQueueByIdentifier()->renderFlashMessages();
1009 1009
 
1010
-		} else {
1010
+        } else {
1011 1011
 
1012
-			// Since TYPO3 7.4.0, \TYPO3\CMS\Core\Messaging\FlashMessageQueue::renderFlashMessages
1013
-			// uses htmlspecialchars on all texts, but we have message text with HTML tags.
1014
-			// Therefore we copy the implementation from 7.4.0, but remove the htmlspecialchars call.
1015
-			$flashMessages = $flashMessageService->getMessageQueueByIdentifier()->getAllMessagesAndFlush();
1012
+            // Since TYPO3 7.4.0, \TYPO3\CMS\Core\Messaging\FlashMessageQueue::renderFlashMessages
1013
+            // uses htmlspecialchars on all texts, but we have message text with HTML tags.
1014
+            // Therefore we copy the implementation from 7.4.0, but remove the htmlspecialchars call.
1015
+            $flashMessages = $flashMessageService->getMessageQueueByIdentifier()->getAllMessagesAndFlush();
1016 1016
 
1017
-			if (!empty($flashMessages)) {
1017
+            if (!empty($flashMessages)) {
1018 1018
 
1019
-				$content .= '<ul class="typo3-messages">';
1019
+                $content .= '<ul class="typo3-messages">';
1020 1020
 
1021
-				foreach ($flashMessages as $flashMessage) {
1021
+                foreach ($flashMessages as $flashMessage) {
1022 1022
 
1023
-					$severityClass = sprintf('alert %s', $flashMessage->getClass());
1023
+                    $severityClass = sprintf('alert %s', $flashMessage->getClass());
1024 1024
 
1025
-					//~ $messageContent = htmlspecialchars($flashMessage->getMessage());
1025
+                    //~ $messageContent = htmlspecialchars($flashMessage->getMessage());
1026 1026
 
1027
-					$messageContent = $flashMessage->getMessage();
1027
+                    $messageContent = $flashMessage->getMessage();
1028 1028
 
1029
-					if ($flashMessage->getTitle() !== '') {
1029
+                    if ($flashMessage->getTitle() !== '') {
1030 1030
 
1031
-						$messageContent = sprintf('<h4>%s</h4>', htmlspecialchars($flashMessage->getTitle())) . $messageContent;
1031
+                        $messageContent = sprintf('<h4>%s</h4>', htmlspecialchars($flashMessage->getTitle())) . $messageContent;
1032 1032
 
1033
-					}
1033
+                    }
1034 1034
 
1035
-					$content .= sprintf('<li class="%s">%s</li>', htmlspecialchars($severityClass), $messageContent);
1035
+                    $content .= sprintf('<li class="%s">%s</li>', htmlspecialchars($severityClass), $messageContent);
1036 1036
 
1037
-				}
1037
+                }
1038 1038
 
1039
-				$content .= '</ul>';
1039
+                $content .= '</ul>';
1040 1040
 
1041
-			}
1041
+            }
1042 1042
 
1043
-		}
1043
+        }
1044 1044
 
1045
-		return $content;
1045
+        return $content;
1046 1046
 
1047
-	}
1047
+    }
1048 1048
 
1049
-	/**
1050
-	 * Save given value to user's session.
1051
-	 *
1052
-	 * @access	public
1053
-	 *
1054
-	 * @param	mixed		$value: Value to save
1055
-	 * @param	string		$key: Session data key for saving
1056
-	 *
1057
-	 * @return	boolean		TRUE on success, FALSE on failure
1058
-	 */
1059
-	public static function saveToSession($value, $key) {
1049
+    /**
1050
+     * Save given value to user's session.
1051
+     *
1052
+     * @access	public
1053
+     *
1054
+     * @param	mixed		$value: Value to save
1055
+     * @param	string		$key: Session data key for saving
1056
+     *
1057
+     * @return	boolean		TRUE on success, FALSE on failure
1058
+     */
1059
+    public static function saveToSession($value, $key) {
1060 1060
 
1061
-		// Save parameter for logging purposes.
1062
-		$_key = $key;
1061
+        // Save parameter for logging purposes.
1062
+        $_key = $key;
1063 1063
 
1064
-		// Cast to string for security reasons.
1065
-		$key = (string) $key;
1064
+        // Cast to string for security reasons.
1065
+        $key = (string) $key;
1066 1066
 
1067
-		if (!$key) {
1067
+        if (!$key) {
1068 1068
 
1069
-			if (TYPO3_DLOG) {
1069
+            if (TYPO3_DLOG) {
1070 1070
 
1071
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->saveToSession([data], '.$_key.')] Invalid key "'.$key.'" for session data saving', self::$extKey, SYSLOG_SEVERITY_WARNING, $value);
1071
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->saveToSession([data], '.$_key.')] Invalid key "'.$key.'" for session data saving', self::$extKey, SYSLOG_SEVERITY_WARNING, $value);
1072 1072
 
1073
-			}
1073
+            }
1074 1074
 
1075
-			return FALSE;
1075
+            return FALSE;
1076 1076
 
1077
-		}
1077
+        }
1078 1078
 
1079
-		// Save value in session data.
1080
-		if (TYPO3_MODE === 'FE') {
1079
+        // Save value in session data.
1080
+        if (TYPO3_MODE === 'FE') {
1081 1081
 
1082
-			$GLOBALS['TSFE']->fe_user->setKey('ses', $key, $value);
1082
+            $GLOBALS['TSFE']->fe_user->setKey('ses', $key, $value);
1083 1083
 
1084
-			$GLOBALS['TSFE']->fe_user->storeSessionData();
1084
+            $GLOBALS['TSFE']->fe_user->storeSessionData();
1085 1085
 
1086
-			return TRUE;
1086
+            return TRUE;
1087 1087
 
1088
-		} elseif (TYPO3_MODE === 'BE') {
1088
+        } elseif (TYPO3_MODE === 'BE') {
1089 1089
 
1090
-			$GLOBALS['BE_USER']->setAndSaveSessionData($key, $value);
1090
+            $GLOBALS['BE_USER']->setAndSaveSessionData($key, $value);
1091 1091
 
1092
-			return TRUE;
1092
+            return TRUE;
1093 1093
 
1094
-		} else {
1094
+        } else {
1095 1095
 
1096
-			if (TYPO3_DLOG) {
1096
+            if (TYPO3_DLOG) {
1097 1097
 
1098
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->saveToSession([data], '.$_key.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR, $data);
1098
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->saveToSession([data], '.$_key.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR, $data);
1099 1099
 
1100
-			}
1100
+            }
1101 1101
 
1102
-			return FALSE;
1102
+            return FALSE;
1103 1103
 
1104
-		}
1104
+        }
1105 1105
 
1106
-	}
1106
+    }
1107 1107
 
1108
-	/**
1109
-	 * This translates an internal "index_name"
1110
-	 *
1111
-	 * @access	public
1112
-	 *
1113
-	 * @param	string		$index_name: The internal "index_name" to translate
1114
-	 * @param	string		$table: Get the translation from this table
1115
-	 * @param	string		$pid: Get the translation from this page
1116
-	 *
1117
-	 * @return	string		Localized label for $index_name
1118
-	 */
1119
-	public static function translate($index_name, $table, $pid) {
1108
+    /**
1109
+     * This translates an internal "index_name"
1110
+     *
1111
+     * @access	public
1112
+     *
1113
+     * @param	string		$index_name: The internal "index_name" to translate
1114
+     * @param	string		$table: Get the translation from this table
1115
+     * @param	string		$pid: Get the translation from this page
1116
+     *
1117
+     * @return	string		Localized label for $index_name
1118
+     */
1119
+    public static function translate($index_name, $table, $pid) {
1120 1120
 
1121
-		// Save parameters for logging purposes.
1122
-		$_index_name = $index_name;
1121
+        // Save parameters for logging purposes.
1122
+        $_index_name = $index_name;
1123 1123
 
1124
-		$_pid = $pid;
1124
+        $_pid = $pid;
1125 1125
 
1126
-		// Load labels into static variable for future use.
1127
-		static $labels = array ();
1126
+        // Load labels into static variable for future use.
1127
+        static $labels = array ();
1128 1128
 
1129
-		// Sanitize input.
1130
-		$pid = max(intval($pid), 0);
1129
+        // Sanitize input.
1130
+        $pid = max(intval($pid), 0);
1131 1131
 
1132
-		if (!$pid) {
1132
+        if (!$pid) {
1133 1133
 
1134
-			if (TYPO3_DLOG) {
1134
+            if (TYPO3_DLOG) {
1135 1135
 
1136
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->translate('.$_index_name.', '.$table.', '.$_pid.')] Invalid PID "'.$pid.'" for translation', self::$extKey, SYSLOG_SEVERITY_WARNING);
1136
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->translate('.$_index_name.', '.$table.', '.$_pid.')] Invalid PID "'.$pid.'" for translation', self::$extKey, SYSLOG_SEVERITY_WARNING);
1137 1137
 
1138
-			}
1138
+            }
1139 1139
 
1140
-			return $index_name;
1140
+            return $index_name;
1141 1141
 
1142
-		}
1142
+        }
1143 1143
 
1144
-		// Check if "index_name" is an UID.
1145
-		if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($index_name)) {
1144
+        // Check if "index_name" is an UID.
1145
+        if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($index_name)) {
1146 1146
 
1147
-			$index_name = self::getIndexName($index_name, $table, $pid);
1147
+            $index_name = self::getIndexName($index_name, $table, $pid);
1148 1148
 
1149
-		}
1149
+        }
1150 1150
 
1151
-		/* $labels already contains the translated content element, but with the index_name of the translated content element itself
1151
+        /* $labels already contains the translated content element, but with the index_name of the translated content element itself
1152 1152
 		 * and not with the $index_name of the original that we receive here. So we have to determine the index_name of the
1153 1153
 		 * associated translated content element. E.g. $labels['title0'] != $index_name = title. */
1154 1154
 
1155
-		// First fetch the uid of the received index_name
1156
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1157
-				'uid, l18n_parent',
1158
-				$table,
1159
-				'pid='.$pid.' AND index_name="'.$index_name.'"'.self::whereClause($table, TRUE),
1160
-				'',
1161
-				'',
1162
-				''
1163
-		);
1155
+        // First fetch the uid of the received index_name
1156
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1157
+                'uid, l18n_parent',
1158
+                $table,
1159
+                'pid='.$pid.' AND index_name="'.$index_name.'"'.self::whereClause($table, TRUE),
1160
+                '',
1161
+                '',
1162
+                ''
1163
+        );
1164 1164
 
1165
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
1165
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
1166 1166
 
1167
-			// Now we use the uid of the l18_parent to fetch the index_name of the translated content element.
1168
-			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
1167
+            // Now we use the uid of the l18_parent to fetch the index_name of the translated content element.
1168
+            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
1169 1169
 
1170
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1171
-					'index_name',
1172
-					$table,
1173
-					'pid='.$pid.' AND uid='.$resArray['l18n_parent'].' AND sys_language_uid='.intval($GLOBALS['TSFE']->sys_language_content).self::whereClause($table, TRUE),
1174
-					'',
1175
-					'',
1176
-					''
1177
-			);
1170
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1171
+                    'index_name',
1172
+                    $table,
1173
+                    'pid='.$pid.' AND uid='.$resArray['l18n_parent'].' AND sys_language_uid='.intval($GLOBALS['TSFE']->sys_language_content).self::whereClause($table, TRUE),
1174
+                    '',
1175
+                    '',
1176
+                    ''
1177
+            );
1178 1178
 
1179
-			if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
1179
+            if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
1180 1180
 
1181
-				// If there is an translated content element, overwrite the received $index_name.
1182
-				$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
1181
+                // If there is an translated content element, overwrite the received $index_name.
1182
+                $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
1183 1183
 
1184
-				$index_name = $resArray['index_name'];
1184
+                $index_name = $resArray['index_name'];
1185 1185
 
1186
-			}
1186
+            }
1187 1187
 
1188
-		}
1188
+        }
1189 1189
 
1190
-		// Check if we already got a translation.
1191
-		if (empty($labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$index_name])) {
1190
+        // Check if we already got a translation.
1191
+        if (empty($labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$index_name])) {
1192 1192
 
1193
-			// Check if this table is allowed for translation.
1194
-			if (in_array($table, array ('tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'))) {
1193
+            // Check if this table is allowed for translation.
1194
+            if (in_array($table, array ('tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'))) {
1195 1195
 
1196
-				$additionalWhere = ' AND sys_language_uid IN (-1,0)';
1196
+                $additionalWhere = ' AND sys_language_uid IN (-1,0)';
1197 1197
 
1198
-				if ($GLOBALS['TSFE']->sys_language_content > 0) {
1198
+                if ($GLOBALS['TSFE']->sys_language_content > 0) {
1199 1199
 
1200
-					$additionalWhere = ' AND (sys_language_uid IN (-1,0) OR (sys_language_uid='.intval($GLOBALS['TSFE']->sys_language_content).' AND l18n_parent=0))';
1200
+                    $additionalWhere = ' AND (sys_language_uid IN (-1,0) OR (sys_language_uid='.intval($GLOBALS['TSFE']->sys_language_content).' AND l18n_parent=0))';
1201 1201
 
1202
-				}
1202
+                }
1203 1203
 
1204
-				// Get labels from database.
1205
-				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1206
-					'*',
1207
-					$table,
1208
-					'pid='.$pid.$additionalWhere.self::whereClause($table, TRUE),
1209
-					'',
1210
-					'',
1211
-					''
1212
-				);
1204
+                // Get labels from database.
1205
+                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1206
+                    '*',
1207
+                    $table,
1208
+                    'pid='.$pid.$additionalWhere.self::whereClause($table, TRUE),
1209
+                    '',
1210
+                    '',
1211
+                    ''
1212
+                );
1213 1213
 
1214
-				if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
1214
+                if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
1215 1215
 
1216
-					while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1216
+                    while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1217 1217
 
1218
-						// Overlay localized labels if available.
1219
-						if ($GLOBALS['TSFE']->sys_language_content > 0) {
1218
+                        // Overlay localized labels if available.
1219
+                        if ($GLOBALS['TSFE']->sys_language_content > 0) {
1220 1220
 
1221
-							$resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay($table, $resArray,$GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
1221
+                            $resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay($table, $resArray,$GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
1222 1222
 
1223
-						}
1223
+                        }
1224 1224
 
1225
-						if ($resArray) {
1225
+                        if ($resArray) {
1226 1226
 
1227
-							$labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$resArray['index_name']] = $resArray['label'];
1227
+                            $labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$resArray['index_name']] = $resArray['label'];
1228 1228
 
1229
-						}
1229
+                        }
1230 1230
 
1231
-					}
1231
+                    }
1232 1232
 
1233
-				} else {
1233
+                } else {
1234 1234
 
1235
-					if (TYPO3_DLOG) {
1235
+                    if (TYPO3_DLOG) {
1236 1236
 
1237
-						\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->translate('.$_index_name.', '.$table.', '.$_pid.')] No translation with PID "'.$pid.'" available in table "'.$table.'" or translation not accessible', self::extKey, SYSLOG_SEVERITY_NOTICE);
1237
+                        \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->translate('.$_index_name.', '.$table.', '.$_pid.')] No translation with PID "'.$pid.'" available in table "'.$table.'" or translation not accessible', self::extKey, SYSLOG_SEVERITY_NOTICE);
1238 1238
 
1239
-					}
1239
+                    }
1240 1240
 
1241
-				}
1241
+                }
1242 1242
 
1243
-			} else {
1243
+            } else {
1244 1244
 
1245
-				if (TYPO3_DLOG) {
1245
+                if (TYPO3_DLOG) {
1246 1246
 
1247
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->translate('.$_index_name.', '.$table.', '.$_pid.')] No translations available for table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
1247
+                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->translate('.$_index_name.', '.$table.', '.$_pid.')] No translations available for table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
1248 1248
 
1249
-				}
1249
+                }
1250 1250
 
1251
-			}
1251
+            }
1252 1252
 
1253
-		}
1253
+        }
1254 1254
 
1255
-		if (!empty($labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$index_name])) {
1255
+        if (!empty($labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$index_name])) {
1256 1256
 
1257
-			return $labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$index_name];
1257
+            return $labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$index_name];
1258 1258
 
1259
-		} else {
1259
+        } else {
1260 1260
 
1261
-			return $index_name;
1261
+            return $index_name;
1262 1262
 
1263
-		}
1263
+        }
1264 1264
 
1265
-	}
1265
+    }
1266 1266
 
1267
-	/**
1268
-	 * This returns the additional WHERE clause of a table based on its TCA configuration
1269
-	 *
1270
-	 * @access	public
1271
-	 *
1272
-	 * @param	string		$table: Table name as defined in TCA
1273
-	 * @param	boolean		$showHidden: Ignore the hidden flag?
1274
-	 *
1275
-	 * @return	string		Additional WHERE clause
1276
-	 */
1277
-	public static function whereClause($table, $showHidden = FALSE) {
1267
+    /**
1268
+     * This returns the additional WHERE clause of a table based on its TCA configuration
1269
+     *
1270
+     * @access	public
1271
+     *
1272
+     * @param	string		$table: Table name as defined in TCA
1273
+     * @param	boolean		$showHidden: Ignore the hidden flag?
1274
+     *
1275
+     * @return	string		Additional WHERE clause
1276
+     */
1277
+    public static function whereClause($table, $showHidden = FALSE) {
1278 1278
 
1279
-		if (TYPO3_MODE === 'FE') {
1279
+        if (TYPO3_MODE === 'FE') {
1280 1280
 
1281
-			// Table "tx_dlf_formats" always has PID 0.
1282
-			if ($table == 'tx_dlf_formats') {
1281
+            // Table "tx_dlf_formats" always has PID 0.
1282
+            if ($table == 'tx_dlf_formats') {
1283 1283
 
1284
-				return \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
1284
+                return \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
1285 1285
 
1286
-			}
1286
+            }
1287 1287
 
1288
-			// Should we ignore the record's hidden flag?
1289
-			$ignoreHide = -1;
1288
+            // Should we ignore the record's hidden flag?
1289
+            $ignoreHide = -1;
1290 1290
 
1291
-			if ($showHidden) {
1291
+            if ($showHidden) {
1292 1292
 
1293
-				$ignoreHide = 1;
1293
+                $ignoreHide = 1;
1294 1294
 
1295
-			}
1295
+            }
1296 1296
 
1297
-			// $GLOBALS['TSFE']->sys_page is not always available in frontend.
1298
-			if (is_object($GLOBALS['TSFE']->sys_page)) {
1297
+            // $GLOBALS['TSFE']->sys_page is not always available in frontend.
1298
+            if (is_object($GLOBALS['TSFE']->sys_page)) {
1299 1299
 
1300
-				return $GLOBALS['TSFE']->sys_page->enableFields($table, $ignoreHide);
1300
+                return $GLOBALS['TSFE']->sys_page->enableFields($table, $ignoreHide);
1301 1301
 
1302
-			} else {
1302
+            } else {
1303 1303
 
1304
-				$pageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
1304
+                $pageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
1305 1305
 
1306
-				$GLOBALS['TSFE']->includeTCA();
1306
+                $GLOBALS['TSFE']->includeTCA();
1307 1307
 
1308
-				return $pageRepository->enableFields($table, $ignoreHide);
1308
+                return $pageRepository->enableFields($table, $ignoreHide);
1309 1309
 
1310
-			}
1310
+            }
1311 1311
 
1312
-		} elseif (TYPO3_MODE === 'BE') {
1312
+        } elseif (TYPO3_MODE === 'BE') {
1313 1313
 
1314
-			return \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
1314
+            return \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
1315 1315
 
1316
-		} else {
1316
+        } else {
1317 1317
 
1318
-			if (TYPO3_DLOG) {
1318
+            if (TYPO3_DLOG) {
1319 1319
 
1320
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->whereClause('.$table.', ['.($showHidden ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
1320
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_helper->whereClause('.$table.', ['.($showHidden ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
1321 1321
 
1322
-			}
1322
+            }
1323 1323
 
1324
-			return ' AND 1=-1';
1324
+            return ' AND 1=-1';
1325 1325
 
1326
-		}
1326
+        }
1327 1327
 
1328
-	}
1328
+    }
1329 1329
 
1330
-	/**
1331
-	 * This is a static class, thus no instances should be created
1332
-	 *
1333
-	 * @access private
1334
-	 */
1335
-	private function __construct() {}
1330
+    /**
1331
+     * This is a static class, thus no instances should be created
1332
+     *
1333
+     * @access private
1334
+     */
1335
+    private function __construct() {}
1336 1336
 
1337 1337
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
 					if ($flashMessage->getTitle() !== '') {
1030 1030
 
1031
-						$messageContent = sprintf('<h4>%s</h4>', htmlspecialchars($flashMessage->getTitle())) . $messageContent;
1031
+						$messageContent = sprintf('<h4>%s</h4>', htmlspecialchars($flashMessage->getTitle())).$messageContent;
1032 1032
 
1033 1033
 					}
1034 1034
 
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
 						// Overlay localized labels if available.
1219 1219
 						if ($GLOBALS['TSFE']->sys_language_content > 0) {
1220 1220
 
1221
-							$resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay($table, $resArray,$GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
1221
+							$resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay($table, $resArray, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
1222 1222
 
1223 1223
 						}
1224 1224
 
Please login to merge, or discard this patch.
common/class.tx_dlf_module.php 2 patches
Indentation   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -20,115 +20,115 @@  discard block
 block discarded – undo
20 20
  */
21 21
 abstract class tx_dlf_module extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
22 22
 
23
-	public $extKey = 'dlf';
24
-
25
-	public $prefixId = 'tx_dlf';
26
-
27
-	/**
28
-	 * Holds the path to this module relative to 'EXT:dlf/modules/' and with trailing slash
29
-	 *
30
-	 * @var	string
31
-	 * @access protected
32
-	 */
33
-	protected $modPath = '';
34
-
35
-	/**
36
-	 * Holds the page record if access granted or FALSE if access denied
37
-	 *
38
-	 * @var	mixed
39
-	 * @access protected
40
-	 */
41
-	protected $pageInfo;
42
-
43
-	/**
44
-	 * Holds the module's button array
45
-	 *
46
-	 * @var	array
47
-	 * @access protected
48
-	 */
49
-	protected $buttonArray = array ();
50
-
51
-	/**
52
-	 * Holds the module's marker array
53
-	 *
54
-	 * @var	array
55
-	 * @access protected
56
-	 */
57
-	protected $markerArray = array ();
58
-
59
-	/**
60
-	 * Holds the module's subpart array
61
-	 *
62
-	 * @var	array
63
-	 * @access protected
64
-	 */
65
-	protected $subpartArray = array ();
66
-
67
-	/**
68
-	 * Holds the TYPO3_CONF_VARS array of this extension
69
-	 *
70
-	 * @var	array
71
-	 * @access protected
72
-	 */
73
-	protected $conf = array ();
74
-
75
-	/**
76
-	 * Holds the submitted form's data
77
-	 *
78
-	 * @var	array
79
-	 * @access protected
80
-	 */
81
-	protected $data;
82
-
83
-	/**
84
-	 * Initializes the backend module by setting internal variables, initializing the menu.
85
-	 *
86
-	 * @access public
87
-	 *
88
-	 * @return	void
89
-	 */
90
-	public function __construct() {
91
-
92
-		$GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], 1);
93
-
94
-		$GLOBALS['LANG']->includeLLFile('EXT:'.$this->extKey.'/modules/'.$this->modPath.'locallang.xml');
95
-
96
-		$this->setMOD_MENU();
97
-
98
-		parent::init();
99
-
100
-		$this->conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]);
101
-
102
-		$this->pageInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
103
-
104
-		$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
105
-
106
-		$this->doc->setModuleTemplate('EXT:'.$this->extKey.'/modules/'.$this->modPath.'template.tmpl');
107
-
108
-		$this->doc->getPageRenderer()->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($this->extKey) . 'res/backend.css');
109
-
110
-		$this->doc->backPath = $GLOBALS['BACK_PATH'];
111
-
112
-		$this->doc->bodyTagAdditions = 'class="ext-'.$this->extKey.'-modules"';
113
-
114
-		$this->doc->form = '<form action="" method="post" enctype="multipart/form-data">';
115
-
116
-		$this->data = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($this->prefixId);
117
-
118
-	}
119
-
120
-	/**
121
-	 * Sets the module's MOD_MENU configuration.
122
-	 *
123
-	 * @access	protected
124
-	 *
125
-	 * @return	void
126
-	 */
127
-	protected function setMOD_MENU() {
128
-
129
-		// Set $this->MOD_MENU array here or leave empty.
130
-
131
-		/* Example code:
23
+    public $extKey = 'dlf';
24
+
25
+    public $prefixId = 'tx_dlf';
26
+
27
+    /**
28
+     * Holds the path to this module relative to 'EXT:dlf/modules/' and with trailing slash
29
+     *
30
+     * @var	string
31
+     * @access protected
32
+     */
33
+    protected $modPath = '';
34
+
35
+    /**
36
+     * Holds the page record if access granted or FALSE if access denied
37
+     *
38
+     * @var	mixed
39
+     * @access protected
40
+     */
41
+    protected $pageInfo;
42
+
43
+    /**
44
+     * Holds the module's button array
45
+     *
46
+     * @var	array
47
+     * @access protected
48
+     */
49
+    protected $buttonArray = array ();
50
+
51
+    /**
52
+     * Holds the module's marker array
53
+     *
54
+     * @var	array
55
+     * @access protected
56
+     */
57
+    protected $markerArray = array ();
58
+
59
+    /**
60
+     * Holds the module's subpart array
61
+     *
62
+     * @var	array
63
+     * @access protected
64
+     */
65
+    protected $subpartArray = array ();
66
+
67
+    /**
68
+     * Holds the TYPO3_CONF_VARS array of this extension
69
+     *
70
+     * @var	array
71
+     * @access protected
72
+     */
73
+    protected $conf = array ();
74
+
75
+    /**
76
+     * Holds the submitted form's data
77
+     *
78
+     * @var	array
79
+     * @access protected
80
+     */
81
+    protected $data;
82
+
83
+    /**
84
+     * Initializes the backend module by setting internal variables, initializing the menu.
85
+     *
86
+     * @access public
87
+     *
88
+     * @return	void
89
+     */
90
+    public function __construct() {
91
+
92
+        $GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], 1);
93
+
94
+        $GLOBALS['LANG']->includeLLFile('EXT:'.$this->extKey.'/modules/'.$this->modPath.'locallang.xml');
95
+
96
+        $this->setMOD_MENU();
97
+
98
+        parent::init();
99
+
100
+        $this->conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]);
101
+
102
+        $this->pageInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
103
+
104
+        $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
105
+
106
+        $this->doc->setModuleTemplate('EXT:'.$this->extKey.'/modules/'.$this->modPath.'template.tmpl');
107
+
108
+        $this->doc->getPageRenderer()->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($this->extKey) . 'res/backend.css');
109
+
110
+        $this->doc->backPath = $GLOBALS['BACK_PATH'];
111
+
112
+        $this->doc->bodyTagAdditions = 'class="ext-'.$this->extKey.'-modules"';
113
+
114
+        $this->doc->form = '<form action="" method="post" enctype="multipart/form-data">';
115
+
116
+        $this->data = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($this->prefixId);
117
+
118
+    }
119
+
120
+    /**
121
+     * Sets the module's MOD_MENU configuration.
122
+     *
123
+     * @access	protected
124
+     *
125
+     * @return	void
126
+     */
127
+    protected function setMOD_MENU() {
128
+
129
+        // Set $this->MOD_MENU array here or leave empty.
130
+
131
+        /* Example code:
132 132
 		$this->MOD_MENU = array (
133 133
 			'function' => array (
134 134
 				'1' => $GLOBALS['LANG']->getLL('function1'),
@@ -137,30 +137,30 @@  discard block
 block discarded – undo
137 137
 			)
138 138
 		); */
139 139
 
140
-	}
141
-
142
-	/**
143
-	 * Main function of the module.
144
-	 *
145
-	 * @access	public
146
-	 *
147
-	 * @abstract
148
-	 *
149
-	 * @return	void
150
-	 */
151
-	abstract public function main();
152
-
153
-	/**
154
-	 * Outputs all contents.
155
-	 *
156
-	 * @access	protected
157
-	 *
158
-	 * @return	void
159
-	 */
160
-	protected function printContent() {
161
-
162
-		// Add Javascript for function menu.
163
-		$this->doc->JScode .= '
140
+    }
141
+
142
+    /**
143
+     * Main function of the module.
144
+     *
145
+     * @access	public
146
+     *
147
+     * @abstract
148
+     *
149
+     * @return	void
150
+     */
151
+    abstract public function main();
152
+
153
+    /**
154
+     * Outputs all contents.
155
+     *
156
+     * @access	protected
157
+     *
158
+     * @return	void
159
+     */
160
+    protected function printContent() {
161
+
162
+        // Add Javascript for function menu.
163
+        $this->doc->JScode .= '
164 164
 		<script type="text/javascript">
165 165
 		script_ended = 0;
166 166
 		function jumpToUrl(URL)	{
@@ -168,46 +168,46 @@  discard block
 block discarded – undo
168 168
 		}
169 169
 		</script>';
170 170
 
171
-		// Add Javascript for convenient module switch.
172
-		$this->doc->postCode .= '
171
+        // Add Javascript for convenient module switch.
172
+        $this->doc->postCode .= '
173 173
 		<script type="text/javascript">
174 174
 		script_ended = 1;
175 175
 		</script>';
176 176
 
177
-		// Render output.
178
-		$this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
177
+        // Render output.
178
+        $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
179 179
 
180
-		// Set defaults for buttons and menu.
181
-		if (empty($this->buttonArray['RELOAD'])) {
180
+        // Set defaults for buttons and menu.
181
+        if (empty($this->buttonArray['RELOAD'])) {
182 182
 
183
-			$this->buttonArray['RELOAD'] = '<a href="'.$GLOBALS['MCONF']['_'].'" title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.reload', TRUE).'">'.\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-refresh').'</a>';
183
+            $this->buttonArray['RELOAD'] = '<a href="'.$GLOBALS['MCONF']['_'].'" title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.reload', TRUE).'">'.\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-refresh').'</a>';
184 184
 
185
-		}
185
+        }
186 186
 
187
-		if (empty($this->buttonArray['SHORTCUT'])) {
187
+        if (empty($this->buttonArray['SHORTCUT'])) {
188 188
 
189
-			$this->buttonArray['SHORTCUT'] = $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
189
+            $this->buttonArray['SHORTCUT'] = $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
190 190
 
191
-		}
191
+        }
192 192
 
193
-		if (empty($this->markerArray['CSH'])) {
193
+        if (empty($this->markerArray['CSH'])) {
194 194
 
195
-			$this->markerArray['CSH'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_'.$GLOBALS['MCONF']['name'], 'csh', $GLOBALS['BACK_PATH'], '', TRUE);
195
+            $this->markerArray['CSH'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_'.$GLOBALS['MCONF']['name'], 'csh', $GLOBALS['BACK_PATH'], '', TRUE);
196 196
 
197
-		}
197
+        }
198 198
 
199
-		if (empty($this->markerArray['MOD_MENU'])) {
199
+        if (empty($this->markerArray['MOD_MENU'])) {
200 200
 
201
-			$this->markerArray['MOD_MENU'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
201
+            $this->markerArray['MOD_MENU'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
202 202
 
203
-		}
203
+        }
204 204
 
205
-		$this->content .= $this->doc->moduleBody($this->pageInfo, $this->buttonArray, $this->markerArray, $this->subpartArray);
205
+        $this->content .= $this->doc->moduleBody($this->pageInfo, $this->buttonArray, $this->markerArray, $this->subpartArray);
206 206
 
207
-		$this->content .= $this->doc->endPage();
207
+        $this->content .= $this->doc->endPage();
208 208
 
209
-		echo $this->content;
209
+        echo $this->content;
210 210
 
211
-	}
211
+    }
212 212
 
213 213
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
 
106 106
 		$this->doc->setModuleTemplate('EXT:'.$this->extKey.'/modules/'.$this->modPath.'template.tmpl');
107 107
 
108
-		$this->doc->getPageRenderer()->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($this->extKey) . 'res/backend.css');
108
+		$this->doc->getPageRenderer()->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($this->extKey).'res/backend.css');
109 109
 
110 110
 		$this->doc->backPath = $GLOBALS['BACK_PATH'];
111 111
 
Please login to merge, or discard this patch.
common/class.tx_dlf_mods.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -19,159 +19,159 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_mods implements tx_dlf_format {
21 21
 
22
-	/**
23
-	 * This extracts the essential MODS metadata from XML
24
-	 *
25
-	 * @access	public
26
-	 *
27
-	 * @param	SimpleXMLElement		$xml: The XML to extract the metadata from
28
-	 * @param	array		&$metadata: The metadata array to fill
29
-	 *
30
-	 * @return	void
31
-	 */
32
-	public function extractMetadata(SimpleXMLElement $xml, array &$metadata) {
22
+    /**
23
+     * This extracts the essential MODS metadata from XML
24
+     *
25
+     * @access	public
26
+     *
27
+     * @param	SimpleXMLElement		$xml: The XML to extract the metadata from
28
+     * @param	array		&$metadata: The metadata array to fill
29
+     *
30
+     * @return	void
31
+     */
32
+    public function extractMetadata(SimpleXMLElement $xml, array &$metadata) {
33 33
 
34
-		$xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
34
+        $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
35 35
 
36
-		// Get "author" and "author_sorting".
37
-		$authors = $xml->xpath('./mods:name[./mods:role/mods:roleTerm[@type="code" and @authority="marcrelator"]="aut"]');
36
+        // Get "author" and "author_sorting".
37
+        $authors = $xml->xpath('./mods:name[./mods:role/mods:roleTerm[@type="code" and @authority="marcrelator"]="aut"]');
38 38
 
39
-		// Get "author" and "author_sorting" again if that was to sophisticated.
40
-		if (!$authors) {
39
+        // Get "author" and "author_sorting" again if that was to sophisticated.
40
+        if (!$authors) {
41 41
 
42
-			// Get all names which do not have any role term assigned and assume these are authors.
43
-			$authors = $xml->xpath('./mods:name[not(./mods:role)]');
42
+            // Get all names which do not have any role term assigned and assume these are authors.
43
+            $authors = $xml->xpath('./mods:name[not(./mods:role)]');
44 44
 
45
-		}
45
+        }
46 46
 
47
-		if (is_array($authors)) {
47
+        if (is_array($authors)) {
48 48
 
49
-			for ($i = 0, $j = count($authors); $i < $j; $i++) {
49
+            for ($i = 0, $j = count($authors); $i < $j; $i++) {
50 50
 
51
-				$authors[$i]->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
51
+                $authors[$i]->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
52 52
 
53
-				// Check if there is a display form.
54
-				if (($displayForm = $authors[$i]->xpath('./mods:displayForm'))) {
53
+                // Check if there is a display form.
54
+                if (($displayForm = $authors[$i]->xpath('./mods:displayForm'))) {
55 55
 
56
-					$metadata['author'][$i] = (string) $displayForm[0];
56
+                    $metadata['author'][$i] = (string) $displayForm[0];
57 57
 
58
-				} elseif (($nameParts = $authors[$i]->xpath('./mods:namePart'))) {
58
+                } elseif (($nameParts = $authors[$i]->xpath('./mods:namePart'))) {
59 59
 
60
-					$name = array ();
60
+                    $name = array ();
61 61
 
62
-					$k = 4;
62
+                    $k = 4;
63 63
 
64
-					foreach ($nameParts as $namePart) {
64
+                    foreach ($nameParts as $namePart) {
65 65
 
66
-						if (isset($namePart['type']) && (string) $namePart['type'] == 'family') {
66
+                        if (isset($namePart['type']) && (string) $namePart['type'] == 'family') {
67 67
 
68
-							$name[0] = (string) $namePart;
68
+                            $name[0] = (string) $namePart;
69 69
 
70
-						} elseif (isset($namePart['type']) && (string) $namePart['type'] == 'given') {
70
+                        } elseif (isset($namePart['type']) && (string) $namePart['type'] == 'given') {
71 71
 
72
-							$name[1] = (string) $namePart;
72
+                            $name[1] = (string) $namePart;
73 73
 
74
-						} elseif (isset($namePart['type']) && (string) $namePart['type'] == 'termsOfAddress') {
74
+                        } elseif (isset($namePart['type']) && (string) $namePart['type'] == 'termsOfAddress') {
75 75
 
76
-							$name[2] = (string) $namePart;
76
+                            $name[2] = (string) $namePart;
77 77
 
78
-						} elseif (isset($namePart['type']) && (string) $namePart['type'] == 'date') {
78
+                        } elseif (isset($namePart['type']) && (string) $namePart['type'] == 'date') {
79 79
 
80
-							$name[3] = (string) $namePart;
80
+                            $name[3] = (string) $namePart;
81 81
 
82
-						} else {
82
+                        } else {
83 83
 
84
-							$name[$k] = (string) $namePart;
84
+                            $name[$k] = (string) $namePart;
85 85
 
86
-						}
86
+                        }
87 87
 
88
-						$k++;
88
+                        $k++;
89 89
 
90
-					}
90
+                    }
91 91
 
92
-					ksort($name);
92
+                    ksort($name);
93 93
 
94
-					$metadata['author'][$i] = trim(implode(', ', $name));
94
+                    $metadata['author'][$i] = trim(implode(', ', $name));
95 95
 
96
-				}
96
+                }
97 97
 
98
-			}
98
+            }
99 99
 
100
-		}
100
+        }
101 101
 
102
-		// Get "place" and "place_sorting".
103
-		$places = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:place/mods:placeTerm');
102
+        // Get "place" and "place_sorting".
103
+        $places = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:place/mods:placeTerm');
104 104
 
105
-		// Get "place" and "place_sorting" again if that was to sophisticated.
106
-		if (!$places) {
105
+        // Get "place" and "place_sorting" again if that was to sophisticated.
106
+        if (!$places) {
107 107
 
108
-			// Get all places and assume these are places of publication.
109
-			$places = $xml->xpath('./mods:originInfo/mods:place/mods:placeTerm');
108
+            // Get all places and assume these are places of publication.
109
+            $places = $xml->xpath('./mods:originInfo/mods:place/mods:placeTerm');
110 110
 
111
-		}
111
+        }
112 112
 
113
-		if (is_array($places)) {
113
+        if (is_array($places)) {
114 114
 
115
-			foreach ($places as $place) {
115
+            foreach ($places as $place) {
116 116
 
117
-				$metadata['place'][] = (string) $place;
117
+                $metadata['place'][] = (string) $place;
118 118
 
119
-				if (!$metadata['place_sorting'][0]) {
119
+                if (!$metadata['place_sorting'][0]) {
120 120
 
121
-					$metadata['place_sorting'][0] = preg_replace('/[[:punct:]]/', '', (string) $place);
121
+                    $metadata['place_sorting'][0] = preg_replace('/[[:punct:]]/', '', (string) $place);
122 122
 
123
-				}
123
+                }
124 124
 
125
-			}
125
+            }
126 126
 
127
-		}
127
+        }
128 128
 
129
-		// Get "year_sorting".
130
-		if (($years_sorting = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:dateOther[@type="order" and @encoding="w3cdtf"]'))) {
129
+        // Get "year_sorting".
130
+        if (($years_sorting = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:dateOther[@type="order" and @encoding="w3cdtf"]'))) {
131 131
 
132
-			foreach ($years_sorting as $year_sorting) {
132
+            foreach ($years_sorting as $year_sorting) {
133 133
 
134
-				$metadata['year_sorting'][0] = intval($year_sorting);
134
+                $metadata['year_sorting'][0] = intval($year_sorting);
135 135
 
136
-			}
136
+            }
137 137
 
138
-		}
138
+        }
139 139
 
140
-		// Get "year" and "year_sorting" if not specified separately.
141
-		$years = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:dateIssued[@keyDate="yes"]');
140
+        // Get "year" and "year_sorting" if not specified separately.
141
+        $years = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:dateIssued[@keyDate="yes"]');
142 142
 
143
-		// Get "year" and "year_sorting" again if that was to sophisticated.
144
-		if (!$years) {
143
+        // Get "year" and "year_sorting" again if that was to sophisticated.
144
+        if (!$years) {
145 145
 
146
-			// Get all dates and assume these are dates of publication.
147
-			$years = $xml->xpath('./mods:originInfo/mods:dateIssued');
146
+            // Get all dates and assume these are dates of publication.
147
+            $years = $xml->xpath('./mods:originInfo/mods:dateIssued');
148 148
 
149
-		}
149
+        }
150 150
 
151
-		if (is_array($years)) {
151
+        if (is_array($years)) {
152 152
 
153
-			foreach ($years as $year) {
153
+            foreach ($years as $year) {
154 154
 
155
-				$metadata['year'][] = (string) $year;
155
+                $metadata['year'][] = (string) $year;
156 156
 
157
-				if (!$metadata['year_sorting'][0]) {
157
+                if (!$metadata['year_sorting'][0]) {
158 158
 
159
-					$year_sorting = str_ireplace('x', '5', preg_replace('/[^\d.x]/i', '', (string) $year));
159
+                    $year_sorting = str_ireplace('x', '5', preg_replace('/[^\d.x]/i', '', (string) $year));
160 160
 
161
-					if (strpos($year_sorting, '.') || strlen($year_sorting) < 3) {
161
+                    if (strpos($year_sorting, '.') || strlen($year_sorting) < 3) {
162 162
 
163
-						$year_sorting = ((intval(trim($year_sorting, '.')) - 1) * 100) + 50;
163
+                        $year_sorting = ((intval(trim($year_sorting, '.')) - 1) * 100) + 50;
164 164
 
165
-					}
165
+                    }
166 166
 
167
-					$metadata['year_sorting'][0] = intval($year_sorting);
167
+                    $metadata['year_sorting'][0] = intval($year_sorting);
168 168
 
169
-				}
169
+                }
170 170
 
171
-			}
171
+            }
172 172
 
173
-		}
173
+        }
174 174
 
175
-	}
175
+    }
176 176
 
177 177
 }
Please login to merge, or discard this patch.
common/class.tx_dlf_list.php 1 patch
Indentation   +634 added lines, -634 removed lines patch added patch discarded remove patch
@@ -19,893 +19,893 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_list implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\SingletonInterface {
21 21
 
22
-	/**
23
-	 * This holds the number of documents in the list
24
-	 * @see Countable
25
-	 *
26
-	 * @var	integer
27
-	 * @access protected
28
-	 */
29
-	protected $count = 0;
30
-
31
-	/**
32
-	 * This holds the list entries in sorted order
33
-	 * @see ArrayAccess
34
-	 *
35
-	 * @var	array()
36
-	 * @access protected
37
-	 */
38
-	protected $elements = array ();
39
-
40
-	/**
41
-	 * This holds the list's metadata
42
-	 *
43
-	 * @var	array
44
-	 * @access protected
45
-	 */
46
-	protected $metadata = array ();
47
-
48
-	/**
49
-	 * This holds the current list position
50
-	 * @see Iterator
51
-	 *
52
-	 * @var	integer
53
-	 * @access protected
54
-	 */
55
-	protected $position = 0;
56
-
57
-	/**
58
-	 * This holds the full records of already processed list elements
59
-	 *
60
-	 * @var	array()
61
-	 * @access protected
62
-	 */
63
-	protected $records = array ();
64
-
65
-	/**
66
-	 * Instance of Apache_Solr_Service class
67
-	 *
68
-	 * @var	Apache_Solr_Service
69
-	 * @access protected
70
-	 */
71
-	protected $solr;
72
-
73
-	/**
74
-	 * This holds the Solr metadata configuration
75
-	 *
76
-	 * @var	array
77
-	 * @access protected
78
-	 */
79
-	protected $solrConfig = array ();
80
-
81
-	/**
82
-	 * This adds an array of elements at the given position to the list
83
-	 *
84
-	 * @access	public
85
-	 *
86
-	 * @param	array		$elements: Array of elements to add to list
87
-	 * @param	integer		$position: Numeric position for including
88
-	 *
89
-	 * @return	void
90
-	 */
91
-	public function add(array $elements, $position = -1) {
92
-
93
-		$position = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($position, 0, $this->count, $this->count);
94
-
95
-		if (!empty($elements)) {
96
-
97
-			array_splice($this->elements, $position, 0, $elements);
98
-
99
-			$this->count = count($this->elements);
100
-
101
-		}
102
-
103
-	}
104
-
105
-	/**
106
-	 * This counts the elements
107
-	 * @see Countable::count()
108
-	 *
109
-	 * @access	public
110
-	 *
111
-	 * @return	integer		The number of elements in the list
112
-	 */
113
-	public function count() {
22
+    /**
23
+     * This holds the number of documents in the list
24
+     * @see Countable
25
+     *
26
+     * @var	integer
27
+     * @access protected
28
+     */
29
+    protected $count = 0;
30
+
31
+    /**
32
+     * This holds the list entries in sorted order
33
+     * @see ArrayAccess
34
+     *
35
+     * @var	array()
36
+     * @access protected
37
+     */
38
+    protected $elements = array ();
39
+
40
+    /**
41
+     * This holds the list's metadata
42
+     *
43
+     * @var	array
44
+     * @access protected
45
+     */
46
+    protected $metadata = array ();
47
+
48
+    /**
49
+     * This holds the current list position
50
+     * @see Iterator
51
+     *
52
+     * @var	integer
53
+     * @access protected
54
+     */
55
+    protected $position = 0;
56
+
57
+    /**
58
+     * This holds the full records of already processed list elements
59
+     *
60
+     * @var	array()
61
+     * @access protected
62
+     */
63
+    protected $records = array ();
64
+
65
+    /**
66
+     * Instance of Apache_Solr_Service class
67
+     *
68
+     * @var	Apache_Solr_Service
69
+     * @access protected
70
+     */
71
+    protected $solr;
72
+
73
+    /**
74
+     * This holds the Solr metadata configuration
75
+     *
76
+     * @var	array
77
+     * @access protected
78
+     */
79
+    protected $solrConfig = array ();
80
+
81
+    /**
82
+     * This adds an array of elements at the given position to the list
83
+     *
84
+     * @access	public
85
+     *
86
+     * @param	array		$elements: Array of elements to add to list
87
+     * @param	integer		$position: Numeric position for including
88
+     *
89
+     * @return	void
90
+     */
91
+    public function add(array $elements, $position = -1) {
92
+
93
+        $position = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($position, 0, $this->count, $this->count);
94
+
95
+        if (!empty($elements)) {
96
+
97
+            array_splice($this->elements, $position, 0, $elements);
98
+
99
+            $this->count = count($this->elements);
100
+
101
+        }
102
+
103
+    }
104
+
105
+    /**
106
+     * This counts the elements
107
+     * @see Countable::count()
108
+     *
109
+     * @access	public
110
+     *
111
+     * @return	integer		The number of elements in the list
112
+     */
113
+    public function count() {
114 114
 
115
-		return $this->count;
115
+        return $this->count;
116 116
 
117
-	}
117
+    }
118 118
 
119
-	/**
120
-	 * This returns the current element
121
-	 * @see Iterator::current()
122
-	 *
123
-	 * @access	public
124
-	 *
125
-	 * @return	array		The current element
126
-	 */
127
-	public function current() {
119
+    /**
120
+     * This returns the current element
121
+     * @see Iterator::current()
122
+     *
123
+     * @access	public
124
+     *
125
+     * @return	array		The current element
126
+     */
127
+    public function current() {
128 128
 
129
-		if ($this->valid()) {
129
+        if ($this->valid()) {
130 130
 
131
-			return $this->getRecord($this->elements[$this->position]);
131
+            return $this->getRecord($this->elements[$this->position]);
132 132
 
133
-		} else {
133
+        } else {
134 134
 
135
-			if (TYPO3_DLOG) {
135
+            if (TYPO3_DLOG) {
136 136
 
137
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->current()] Invalid position "'.$this->position.'" for list element', $this->extKey, SYSLOG_SEVERITY_NOTICE);
137
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->current()] Invalid position "'.$this->position.'" for list element', $this->extKey, SYSLOG_SEVERITY_NOTICE);
138 138
 
139
-			}
139
+            }
140 140
 
141
-			return;
141
+            return;
142 142
 
143
-		}
143
+        }
144 144
 
145
-	}
145
+    }
146 146
 
147
-	/**
148
-	 * This returns the full record of any list element
149
-	 *
150
-	 * @access	protected
151
-	 *
152
-	 * @param	mixed		$element: The list element
153
-	 *
154
-	 * @return	mixed		The element's full record
155
-	 */
156
-	protected function getRecord($element) {
147
+    /**
148
+     * This returns the full record of any list element
149
+     *
150
+     * @access	protected
151
+     *
152
+     * @param	mixed		$element: The list element
153
+     *
154
+     * @return	mixed		The element's full record
155
+     */
156
+    protected function getRecord($element) {
157 157
 
158
-		if (is_array($element) && array_keys($element) == array ('u', 'h', 's', 'p')) {
158
+        if (is_array($element) && array_keys($element) == array ('u', 'h', 's', 'p')) {
159 159
 
160
-			// Return already processed record if possible.
161
-			if (!empty($this->records[$element['u']])) {
160
+            // Return already processed record if possible.
161
+            if (!empty($this->records[$element['u']])) {
162 162
 
163
-				return $this->records[$element['u']];
163
+                return $this->records[$element['u']];
164 164
 
165
-			}
165
+            }
166 166
 
167
-			$record = array (
168
-				'uid' => $element['u'],
169
-				'page' => 1,
170
-				'preview' => '',
171
-				'subparts' => $element['p']
172
-			);
167
+            $record = array (
168
+                'uid' => $element['u'],
169
+                'page' => 1,
170
+                'preview' => '',
171
+                'subparts' => $element['p']
172
+            );
173 173
 
174
-			// Check if it's a list of database records or Solr documents.
175
-			if (!empty($this->metadata['options']['source']) && $this->metadata['options']['source'] == 'collection') {
174
+            // Check if it's a list of database records or Solr documents.
175
+            if (!empty($this->metadata['options']['source']) && $this->metadata['options']['source'] == 'collection') {
176 176
 
177
-				// Get document's thumbnail and metadata from database.
178
-				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
179
-					'tx_dlf_documents.uid AS uid,tx_dlf_documents.thumbnail AS thumbnail,tx_dlf_documents.metadata AS metadata',
180
-					'tx_dlf_documents',
181
-					'(tx_dlf_documents.uid='.intval($record['uid']).' OR tx_dlf_documents.partof='.intval($record['uid']).')'.tx_dlf_helper::whereClause('tx_dlf_documents'),
182
-					'',
183
-					'',
184
-					''
185
-				);
177
+                // Get document's thumbnail and metadata from database.
178
+                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
179
+                    'tx_dlf_documents.uid AS uid,tx_dlf_documents.thumbnail AS thumbnail,tx_dlf_documents.metadata AS metadata',
180
+                    'tx_dlf_documents',
181
+                    '(tx_dlf_documents.uid='.intval($record['uid']).' OR tx_dlf_documents.partof='.intval($record['uid']).')'.tx_dlf_helper::whereClause('tx_dlf_documents'),
182
+                    '',
183
+                    '',
184
+                    ''
185
+                );
186 186
 
187
-				// Process results.
188
-				while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
187
+                // Process results.
188
+                while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
189 189
 
190
-					// Prepare document's metadata.
191
-					$metadata = unserialize($resArray['metadata']);
190
+                    // Prepare document's metadata.
191
+                    $metadata = unserialize($resArray['metadata']);
192 192
 
193
-					if (!empty($metadata['type'][0]) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($metadata['type'][0])) {
193
+                    if (!empty($metadata['type'][0]) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($metadata['type'][0])) {
194 194
 
195
-						$metadata['type'][0] = tx_dlf_helper::getIndexName($metadata['type'][0], 'tx_dlf_structures', $this->metadata['options']['pid']);
195
+                        $metadata['type'][0] = tx_dlf_helper::getIndexName($metadata['type'][0], 'tx_dlf_structures', $this->metadata['options']['pid']);
196 196
 
197
-					}
197
+                    }
198 198
 
199
-					if (!empty($metadata['owner'][0]) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($metadata['owner'][0])) {
199
+                    if (!empty($metadata['owner'][0]) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($metadata['owner'][0])) {
200 200
 
201
-						$metadata['owner'][0] = tx_dlf_helper::getIndexName($metadata['owner'][0], 'tx_dlf_libraries', $this->metadata['options']['pid']);
201
+                        $metadata['owner'][0] = tx_dlf_helper::getIndexName($metadata['owner'][0], 'tx_dlf_libraries', $this->metadata['options']['pid']);
202 202
 
203
-					}
203
+                    }
204 204
 
205
-					if (!empty($metadata['collection']) && is_array($metadata['collection'])) {
205
+                    if (!empty($metadata['collection']) && is_array($metadata['collection'])) {
206 206
 
207
-						foreach ($metadata['collection'] as $i => $collection) {
207
+                        foreach ($metadata['collection'] as $i => $collection) {
208 208
 
209
-							if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($collection)) {
209
+                            if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($collection)) {
210 210
 
211
-								$metadata['collection'][$i] = tx_dlf_helper::getIndexName($metadata['collection'][$i], 'tx_dlf_collections', $this->metadata['options']['pid']);
211
+                                $metadata['collection'][$i] = tx_dlf_helper::getIndexName($metadata['collection'][$i], 'tx_dlf_collections', $this->metadata['options']['pid']);
212 212
 
213
-							}
213
+                            }
214 214
 
215
-						}
215
+                        }
216 216
 
217
-					}
217
+                    }
218 218
 
219
-					// Add metadata to list element.
220
-					if ($resArray['uid'] == $record['uid']) {
219
+                    // Add metadata to list element.
220
+                    if ($resArray['uid'] == $record['uid']) {
221 221
 
222
-						$record['thumbnail'] = $resArray['thumbnail'];
222
+                        $record['thumbnail'] = $resArray['thumbnail'];
223 223
 
224
-						$record['metadata'] = $metadata;
224
+                        $record['metadata'] = $metadata;
225 225
 
226
-					} elseif (($key = tx_dlf_helper::array_search_recursive($resArray['uid'], $record['subparts'], TRUE)) !== FALSE) {
226
+                    } elseif (($key = tx_dlf_helper::array_search_recursive($resArray['uid'], $record['subparts'], TRUE)) !== FALSE) {
227 227
 
228
-						$record['subparts'][$key] = array (
229
-							'uid' => $resArray['uid'],
230
-							'page' => 1,
231
-							'preview' => (!empty($record['subparts'][$key]['h']) ? $record['subparts'][$key]['h'] : ''),
232
-							'thumbnail' => $resArray['thumbnail'],
233
-							'metadata' => $metadata
234
-						);
228
+                        $record['subparts'][$key] = array (
229
+                            'uid' => $resArray['uid'],
230
+                            'page' => 1,
231
+                            'preview' => (!empty($record['subparts'][$key]['h']) ? $record['subparts'][$key]['h'] : ''),
232
+                            'thumbnail' => $resArray['thumbnail'],
233
+                            'metadata' => $metadata
234
+                        );
235 235
 
236
-					}
236
+                    }
237 237
 
238
-				}
238
+                }
239 239
 
240
-			} elseif (!empty($this->metadata['options']['source']) && $this->metadata['options']['source'] == 'search') {
240
+            } elseif (!empty($this->metadata['options']['source']) && $this->metadata['options']['source'] == 'search') {
241 241
 
242
-				if ($this->solrConnect()) {
242
+                if ($this->solrConnect()) {
243 243
 
244
-					// Get document's thumbnail and metadata from Solr index.
245
-					$result = $this->solr->service->search('uid:'.tx_dlf_solr::escapeQuery($record['uid']), 0, $this->solr->limit);
244
+                    // Get document's thumbnail and metadata from Solr index.
245
+                    $result = $this->solr->service->search('uid:'.tx_dlf_solr::escapeQuery($record['uid']), 0, $this->solr->limit);
246 246
 
247
-					// Process results.
248
-					foreach ($result->response->docs as $resArray) {
247
+                    // Process results.
248
+                    foreach ($result->response->docs as $resArray) {
249 249
 
250
-						// Prepare document's metadata.
251
-						$metadata = array ();
250
+                        // Prepare document's metadata.
251
+                        $metadata = array ();
252 252
 
253
-						foreach ($this->solrConfig as $index_name => $solr_name) {
253
+                        foreach ($this->solrConfig as $index_name => $solr_name) {
254 254
 
255
-							if (!empty($resArray->$solr_name)) {
255
+                            if (!empty($resArray->$solr_name)) {
256 256
 
257
-								$metadata[$index_name] = (is_array($resArray->$solr_name) ? $resArray->$solr_name : array ($resArray->$solr_name));
257
+                                $metadata[$index_name] = (is_array($resArray->$solr_name) ? $resArray->$solr_name : array ($resArray->$solr_name));
258 258
 
259
-							}
259
+                            }
260 260
 
261
-						}
261
+                        }
262 262
 
263
-						// Add metadata to list elements.
264
-						if ($resArray->toplevel) {
263
+                        // Add metadata to list elements.
264
+                        if ($resArray->toplevel) {
265 265
 
266
-							$record['thumbnail'] = $resArray->thumbnail;
266
+                            $record['thumbnail'] = $resArray->thumbnail;
267 267
 
268
-							$record['metadata'] = $metadata;
268
+                            $record['metadata'] = $metadata;
269 269
 
270
-						} elseif (($key = tx_dlf_helper::array_search_recursive($resArray->id, $record['subparts'], TRUE)) !== FALSE) {
270
+                        } elseif (($key = tx_dlf_helper::array_search_recursive($resArray->id, $record['subparts'], TRUE)) !== FALSE) {
271 271
 
272
-							$record['subparts'][$key] = array (
273
-								'uid' => $resArray->uid,
274
-								'page' => $resArray->page,
275
-								'preview' => (!empty($record['subparts'][$key]['h']) ? $record['subparts'][$key]['h'] : ''),
276
-								'thumbnail' => $resArray->thumbnail,
277
-								'metadata' => $metadata
278
-							);
272
+                            $record['subparts'][$key] = array (
273
+                                'uid' => $resArray->uid,
274
+                                'page' => $resArray->page,
275
+                                'preview' => (!empty($record['subparts'][$key]['h']) ? $record['subparts'][$key]['h'] : ''),
276
+                                'thumbnail' => $resArray->thumbnail,
277
+                                'metadata' => $metadata
278
+                            );
279 279
 
280
-						}
280
+                        }
281 281
 
282
-					}
282
+                    }
283 283
 
284
-				}
284
+                }
285 285
 
286
-			}
286
+            }
287 287
 
288
-			// Save record for later usage.
289
-			$this->records[$element['u']] = $record;
288
+            // Save record for later usage.
289
+            $this->records[$element['u']] = $record;
290 290
 
291
-		} else {
291
+        } else {
292 292
 
293
-			if (TYPO3_DLOG) {
293
+            if (TYPO3_DLOG) {
294 294
 
295
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->getRecord([data])] No UID of list element to fetch full record', $this->extKey, SYSLOG_SEVERITY_NOTICE, $element);
295
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->getRecord([data])] No UID of list element to fetch full record', $this->extKey, SYSLOG_SEVERITY_NOTICE, $element);
296 296
 
297
-			}
297
+            }
298 298
 
299
-			$record = $element;
299
+            $record = $element;
300 300
 
301
-		}
301
+        }
302 302
 
303
-		return $record;
303
+        return $record;
304 304
 
305
-	}
305
+    }
306 306
 
307
-	/**
308
-	 * This returns the current position
309
-	 * @see Iterator::key()
310
-	 *
311
-	 * @access	public
312
-	 *
313
-	 * @return	integer		The current position
314
-	 */
315
-	public function key() {
307
+    /**
308
+     * This returns the current position
309
+     * @see Iterator::key()
310
+     *
311
+     * @access	public
312
+     *
313
+     * @return	integer		The current position
314
+     */
315
+    public function key() {
316 316
 
317
-		return $this->position;
317
+        return $this->position;
318 318
 
319
-	}
319
+    }
320 320
 
321 321
 
322 322
 
323
-	/**
324
-	 * This moves the element at the given position up or down
325
-	 *
326
-	 * @access	public
327
-	 *
328
-	 * @param	integer		$position: Numeric position for moving
329
-	 * @param	integer		$steps: Amount of steps to move up or down
330
-	 *
331
-	 * @return	void
332
-	 */
333
-	public function move($position, $steps) {
323
+    /**
324
+     * This moves the element at the given position up or down
325
+     *
326
+     * @access	public
327
+     *
328
+     * @param	integer		$position: Numeric position for moving
329
+     * @param	integer		$steps: Amount of steps to move up or down
330
+     *
331
+     * @return	void
332
+     */
333
+    public function move($position, $steps) {
334 334
 
335
-		// Save parameters for logging purposes.
336
-		$_position = $position;
335
+        // Save parameters for logging purposes.
336
+        $_position = $position;
337 337
 
338
-		$_steps = $steps;
338
+        $_steps = $steps;
339 339
 
340
-		$position = intval($position);
340
+        $position = intval($position);
341 341
 
342
-		// Check if list position is valid.
343
-		if ($position < 0 || $position >= $this->count) {
342
+        // Check if list position is valid.
343
+        if ($position < 0 || $position >= $this->count) {
344 344
 
345
-			if (TYPO3_DLOG) {
345
+            if (TYPO3_DLOG) {
346 346
 
347
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->move('.$_position.', '.$_steps.')] Invalid position "'.$position.'" for element moving', $this->extKey, SYSLOG_SEVERITY_WARNING);
347
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->move('.$_position.', '.$_steps.')] Invalid position "'.$position.'" for element moving', $this->extKey, SYSLOG_SEVERITY_WARNING);
348 348
 
349
-			}
349
+            }
350 350
 
351
-			return;
351
+            return;
352 352
 
353
-		}
353
+        }
354 354
 
355
-		$steps = intval($steps);
355
+        $steps = intval($steps);
356 356
 
357
-		// Check if moving given amount of steps is possible.
358
-		if (($position + $steps) < 0 || ($position + $steps) >= $this->count) {
357
+        // Check if moving given amount of steps is possible.
358
+        if (($position + $steps) < 0 || ($position + $steps) >= $this->count) {
359 359
 
360
-			if (TYPO3_DLOG) {
360
+            if (TYPO3_DLOG) {
361 361
 
362
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->move('.$_position.', '.$_steps.')] Invalid steps "'.$steps.'" for moving element at position "'.$position.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
362
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->move('.$_position.', '.$_steps.')] Invalid steps "'.$steps.'" for moving element at position "'.$position.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
363 363
 
364
-			}
364
+            }
365 365
 
366
-			return;
366
+            return;
367 367
 
368
-		}
368
+        }
369 369
 
370
-		$element = $this->remove($position);
370
+        $element = $this->remove($position);
371 371
 
372
-		$this->add(array ($element), $position + $steps);
372
+        $this->add(array ($element), $position + $steps);
373 373
 
374
-	}
374
+    }
375 375
 
376
-	/**
377
-	 * This moves the element at the given position up
378
-	 *
379
-	 * @access	public
380
-	 *
381
-	 * @param	integer		$position: Numeric position for moving
382
-	 *
383
-	 * @return	void
384
-	 */
385
-	public function moveUp($position) {
376
+    /**
377
+     * This moves the element at the given position up
378
+     *
379
+     * @access	public
380
+     *
381
+     * @param	integer		$position: Numeric position for moving
382
+     *
383
+     * @return	void
384
+     */
385
+    public function moveUp($position) {
386 386
 
387
-		$this->move($position, -1);
387
+        $this->move($position, -1);
388 388
 
389
-	}
389
+    }
390 390
 
391
-	/**
392
-	 * This moves the element at the given position down
393
-	 *
394
-	 * @access	public
395
-	 *
396
-	 * @param	integer		$position: Numeric position for moving
397
-	 *
398
-	 * @return	void
399
-	 */
400
-	public function moveDown($position) {
391
+    /**
392
+     * This moves the element at the given position down
393
+     *
394
+     * @access	public
395
+     *
396
+     * @param	integer		$position: Numeric position for moving
397
+     *
398
+     * @return	void
399
+     */
400
+    public function moveDown($position) {
401 401
 
402
-		$this->move($position, 1);
402
+        $this->move($position, 1);
403 403
 
404
-	}
404
+    }
405 405
 
406
-	/**
407
-	 * This increments the current list position
408
-	 * @see Iterator::next()
409
-	 *
410
-	 * @access	public
411
-	 *
412
-	 * @return	void
413
-	 */
414
-	public function next() {
406
+    /**
407
+     * This increments the current list position
408
+     * @see Iterator::next()
409
+     *
410
+     * @access	public
411
+     *
412
+     * @return	void
413
+     */
414
+    public function next() {
415 415
 
416
-		$this->position++;
416
+        $this->position++;
417 417
 
418
-	}
418
+    }
419 419
 
420
-	/**
421
-	 * This checks if an offset exists
422
-	 * @see ArrayAccess::offsetExists()
423
-	 *
424
-	 * @access	public
425
-	 *
426
-	 * @param	mixed		$offset: The offset to check
427
-	 *
428
-	 * @return	boolean		Does the given offset exist?
429
-	 */
430
-	public function offsetExists($offset) {
420
+    /**
421
+     * This checks if an offset exists
422
+     * @see ArrayAccess::offsetExists()
423
+     *
424
+     * @access	public
425
+     *
426
+     * @param	mixed		$offset: The offset to check
427
+     *
428
+     * @return	boolean		Does the given offset exist?
429
+     */
430
+    public function offsetExists($offset) {
431 431
 
432
-		return isset($this->elements[$offset]);
432
+        return isset($this->elements[$offset]);
433 433
 
434
-	}
434
+    }
435 435
 
436
-	/**
437
-	 * This returns the element at the given offset
438
-	 * @see ArrayAccess::offsetGet()
439
-	 *
440
-	 * @access	public
441
-	 *
442
-	 * @param	mixed		$offset: The offset to return
443
-	 *
444
-	 * @return	array		The element at the given offset
445
-	 */
446
-	public function offsetGet($offset) {
436
+    /**
437
+     * This returns the element at the given offset
438
+     * @see ArrayAccess::offsetGet()
439
+     *
440
+     * @access	public
441
+     *
442
+     * @param	mixed		$offset: The offset to return
443
+     *
444
+     * @return	array		The element at the given offset
445
+     */
446
+    public function offsetGet($offset) {
447 447
 
448
-		if ($this->offsetExists($offset)) {
448
+        if ($this->offsetExists($offset)) {
449 449
 
450
-			return $this->getRecord($this->elements[$offset]);
450
+            return $this->getRecord($this->elements[$offset]);
451 451
 
452
-		} else {
452
+        } else {
453 453
 
454
-			if (TYPO3_DLOG) {
454
+            if (TYPO3_DLOG) {
455 455
 
456
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->offsetGet('.$offset.')] Invalid offset "'.$offset.'" for list element', $this->extKey, SYSLOG_SEVERITY_NOTICE);
456
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->offsetGet('.$offset.')] Invalid offset "'.$offset.'" for list element', $this->extKey, SYSLOG_SEVERITY_NOTICE);
457 457
 
458
-			}
458
+            }
459 459
 
460
-			return;
460
+            return;
461 461
 
462
-		}
462
+        }
463 463
 
464
-	}
464
+    }
465 465
 
466
-	/**
467
-	 * This sets the element at the given offset
468
-	 * @see ArrayAccess::offsetSet()
469
-	 *
470
-	 * @access	public
471
-	 *
472
-	 * @param	mixed		$offset: The offset to set (non-integer offsets will be appended)
473
-	 * @param	mixed		$value: The value to set
474
-	 *
475
-	 * @return	void
476
-	 */
477
-	public function offsetSet($offset, $value) {
466
+    /**
467
+     * This sets the element at the given offset
468
+     * @see ArrayAccess::offsetSet()
469
+     *
470
+     * @access	public
471
+     *
472
+     * @param	mixed		$offset: The offset to set (non-integer offsets will be appended)
473
+     * @param	mixed		$value: The value to set
474
+     *
475
+     * @return	void
476
+     */
477
+    public function offsetSet($offset, $value) {
478 478
 
479
-		if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($offset)) {
479
+        if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($offset)) {
480 480
 
481
-			$this->elements[$offset] = $value;
481
+            $this->elements[$offset] = $value;
482 482
 
483
-		} else {
483
+        } else {
484 484
 
485
-			$this->elements[] = $value;
485
+            $this->elements[] = $value;
486 486
 
487
-		}
487
+        }
488 488
 
489
-		// Re-number the elements.
490
-		$this->elements = array_values($this->elements);
489
+        // Re-number the elements.
490
+        $this->elements = array_values($this->elements);
491 491
 
492
-		$this->count = count($this->elements);
492
+        $this->count = count($this->elements);
493 493
 
494
-	}
494
+    }
495 495
 
496
-	/**
497
-	 * This removes the element at the given position from the list
498
-	 *
499
-	 * @access	public
500
-	 *
501
-	 * @param	integer		$position: Numeric position for removing
502
-	 *
503
-	 * @return	array		The removed element
504
-	 */
505
-	public function remove($position) {
496
+    /**
497
+     * This removes the element at the given position from the list
498
+     *
499
+     * @access	public
500
+     *
501
+     * @param	integer		$position: Numeric position for removing
502
+     *
503
+     * @return	array		The removed element
504
+     */
505
+    public function remove($position) {
506 506
 
507
-		// Save parameter for logging purposes.
508
-		$_position = $position;
507
+        // Save parameter for logging purposes.
508
+        $_position = $position;
509 509
 
510
-		$position = intval($position);
510
+        $position = intval($position);
511 511
 
512
-		if ($position < 0 || $position >= $this->count) {
512
+        if ($position < 0 || $position >= $this->count) {
513 513
 
514
-			if (TYPO3_DLOG) {
514
+            if (TYPO3_DLOG) {
515 515
 
516
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->remove('.$_position.')] Invalid position "'.$position.'" for element removing', $this->extKey, SYSLOG_SEVERITY_WARNING);
516
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->remove('.$_position.')] Invalid position "'.$position.'" for element removing', $this->extKey, SYSLOG_SEVERITY_WARNING);
517 517
 
518
-			}
518
+            }
519 519
 
520
-			return;
520
+            return;
521 521
 
522
-		}
522
+        }
523 523
 
524
-		$removed = array_splice($this->elements, $position, 1);
524
+        $removed = array_splice($this->elements, $position, 1);
525 525
 
526
-		$this->count = count($this->elements);
526
+        $this->count = count($this->elements);
527 527
 
528
-		return $this->getRecord($removed[0]);
528
+        return $this->getRecord($removed[0]);
529 529
 
530
-	}
530
+    }
531 531
 
532
-	/**
533
-	 * This clears the current list
534
-	 *
535
-	 * @access	public
536
-	 *
537
-	 * @return	void
538
-	 */
539
-	public function reset() {
532
+    /**
533
+     * This clears the current list
534
+     *
535
+     * @access	public
536
+     *
537
+     * @return	void
538
+     */
539
+    public function reset() {
540 540
 
541
-		$this->elements = array ();
541
+        $this->elements = array ();
542 542
 
543
-		$this->records = array ();
543
+        $this->records = array ();
544 544
 
545
-		$this->metadata = array ();
545
+        $this->metadata = array ();
546 546
 
547
-		$this->count = 0;
547
+        $this->count = 0;
548 548
 
549
-		$this->position = 0;
549
+        $this->position = 0;
550 550
 
551
-	}
551
+    }
552 552
 
553
-	/**
554
-	 * This resets the list position
555
-	 * @see Iterator::rewind()
556
-	 *
557
-	 * @access	public
558
-	 *
559
-	 * @return	void
560
-	 */
561
-	public function rewind() {
553
+    /**
554
+     * This resets the list position
555
+     * @see Iterator::rewind()
556
+     *
557
+     * @access	public
558
+     *
559
+     * @return	void
560
+     */
561
+    public function rewind() {
562 562
 
563
-		$this->position = 0;
563
+        $this->position = 0;
564 564
 
565
-	}
565
+    }
566 566
 
567
-	/**
568
-	 * This saves the current list
569
-	 *
570
-	 * @access	public
571
-	 *
572
-	 * @param	integer		$pid: PID for saving in database
573
-	 *
574
-	 * @return	void
575
-	 */
576
-	public function save($pid = 0) {
567
+    /**
568
+     * This saves the current list
569
+     *
570
+     * @access	public
571
+     *
572
+     * @param	integer		$pid: PID for saving in database
573
+     *
574
+     * @return	void
575
+     */
576
+    public function save($pid = 0) {
577 577
 
578
-		$pid = max(intval($pid), 0);
578
+        $pid = max(intval($pid), 0);
579 579
 
580
-		// If no PID is given, save to the user's session instead
581
-		if ($pid > 0) {
580
+        // If no PID is given, save to the user's session instead
581
+        if ($pid > 0) {
582 582
 
583
-			// TODO: Liste in Datenbank speichern (inkl. Sichtbarkeit, Beschreibung, etc.)
583
+            // TODO: Liste in Datenbank speichern (inkl. Sichtbarkeit, Beschreibung, etc.)
584 584
 
585
-		} else {
585
+        } else {
586 586
 
587
-			tx_dlf_helper::saveToSession(array ($this->elements, $this->metadata), get_class($this));
587
+            tx_dlf_helper::saveToSession(array ($this->elements, $this->metadata), get_class($this));
588 588
 
589
-		}
589
+        }
590 590
 
591
-	}
591
+    }
592 592
 
593
-	/**
594
-	 * Connects to Solr server.
595
-	 *
596
-	 * @access	protected
597
-	 *
598
-	 * @return	boolean		TRUE on success or FALSE on failure
599
-	 */
600
-	protected function solrConnect() {
593
+    /**
594
+     * Connects to Solr server.
595
+     *
596
+     * @access	protected
597
+     *
598
+     * @return	boolean		TRUE on success or FALSE on failure
599
+     */
600
+    protected function solrConnect() {
601 601
 
602
-		// Get Solr instance.
603
-		if (!$this->solr) {
602
+        // Get Solr instance.
603
+        if (!$this->solr) {
604 604
 
605
-			// Connect to Solr server.
606
-			if ($this->solr = tx_dlf_solr::getInstance($this->metadata['options']['core'])) {
605
+            // Connect to Solr server.
606
+            if ($this->solr = tx_dlf_solr::getInstance($this->metadata['options']['core'])) {
607 607
 
608
-				// Load index configuration.
609
-				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
610
-						'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.index_tokenized AS index_tokenized,tx_dlf_metadata.index_indexed AS index_indexed',
611
-						'tx_dlf_metadata',
612
-						'tx_dlf_metadata.is_listed=1 AND tx_dlf_metadata.pid='.intval($this->metadata['options']['pid']).tx_dlf_helper::whereClause('tx_dlf_metadata'),
613
-						'',
614
-						'tx_dlf_metadata.sorting ASC',
615
-						''
616
-				);
608
+                // Load index configuration.
609
+                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
610
+                        'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.index_tokenized AS index_tokenized,tx_dlf_metadata.index_indexed AS index_indexed',
611
+                        'tx_dlf_metadata',
612
+                        'tx_dlf_metadata.is_listed=1 AND tx_dlf_metadata.pid='.intval($this->metadata['options']['pid']).tx_dlf_helper::whereClause('tx_dlf_metadata'),
613
+                        '',
614
+                        'tx_dlf_metadata.sorting ASC',
615
+                        ''
616
+                );
617 617
 
618
-				while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
618
+                while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
619 619
 
620
-					$this->solrConfig[$resArray['index_name']] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').'s'.($resArray['index_indexed'] ? 'i' : 'u');
620
+                    $this->solrConfig[$resArray['index_name']] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').'s'.($resArray['index_indexed'] ? 'i' : 'u');
621 621
 
622
-				}
622
+                }
623 623
 
624
-				// Add static fields.
625
-				$this->solrConfig['type'] = 'type';
624
+                // Add static fields.
625
+                $this->solrConfig['type'] = 'type';
626 626
 
627
-			} else {
627
+            } else {
628 628
 
629
-				return FALSE;
629
+                return FALSE;
630 630
 
631
-			}
631
+            }
632 632
 
633
-		}
633
+        }
634 634
 
635
-		return TRUE;
635
+        return TRUE;
636 636
 
637
-	}
637
+    }
638 638
 
639
-	/**
640
-	 * This sorts the current list by the given field
641
-	 *
642
-	 * @access	public
643
-	 *
644
-	 * @param	string		$by: Sort the list by this field
645
-	 * @param	boolean		$asc: Sort ascending?
646
-	 *
647
-	 * @return	void
648
-	 */
649
-	public function sort($by, $asc = TRUE) {
639
+    /**
640
+     * This sorts the current list by the given field
641
+     *
642
+     * @access	public
643
+     *
644
+     * @param	string		$by: Sort the list by this field
645
+     * @param	boolean		$asc: Sort ascending?
646
+     *
647
+     * @return	void
648
+     */
649
+    public function sort($by, $asc = TRUE) {
650 650
 
651
-		$newOrder = array ();
651
+        $newOrder = array ();
652 652
 
653
-		$nonSortable = array ();
653
+        $nonSortable = array ();
654 654
 
655
-		foreach ($this->elements as $num => $element) {
655
+        foreach ($this->elements as $num => $element) {
656 656
 
657
-			// Is this element sortable?
658
-			if (!empty($element['s'][$by])) {
657
+            // Is this element sortable?
658
+            if (!empty($element['s'][$by])) {
659 659
 
660
-				$newOrder[$element['s'][$by].str_pad($num, 6, '0', STR_PAD_LEFT)] = $element;
660
+                $newOrder[$element['s'][$by].str_pad($num, 6, '0', STR_PAD_LEFT)] = $element;
661 661
 
662
-			} else {
662
+            } else {
663 663
 
664
-				$nonSortable[] = $element;
664
+                $nonSortable[] = $element;
665 665
 
666
-			}
666
+            }
667 667
 
668
-		}
668
+        }
669 669
 
670
-		// Reorder elements.
671
-		if ($asc) {
670
+        // Reorder elements.
671
+        if ($asc) {
672 672
 
673
-			ksort($newOrder, SORT_LOCALE_STRING);
673
+            ksort($newOrder, SORT_LOCALE_STRING);
674 674
 
675
-		} else {
675
+        } else {
676 676
 
677
-			krsort($newOrder, SORT_LOCALE_STRING);
677
+            krsort($newOrder, SORT_LOCALE_STRING);
678 678
 
679
-		}
679
+        }
680 680
 
681
-		// Add non sortable elements to the end of the list.
682
-		$newOrder = array_merge(array_values($newOrder), $nonSortable);
681
+        // Add non sortable elements to the end of the list.
682
+        $newOrder = array_merge(array_values($newOrder), $nonSortable);
683 683
 
684
-		// Check if something is missing.
685
-		if ($this->count == count($newOrder)) {
684
+        // Check if something is missing.
685
+        if ($this->count == count($newOrder)) {
686 686
 
687
-			$this->elements = $newOrder;
687
+            $this->elements = $newOrder;
688 688
 
689
-		} else {
689
+        } else {
690 690
 
691
-			if (TYPO3_DLOG) {
691
+            if (TYPO3_DLOG) {
692 692
 
693
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->sort('.$by.', ['.($asc ? 'TRUE' : 'FALSE').'])] Sorted list elements do not match unsorted elements', $this->extKey, SYSLOG_SEVERITY_ERROR);
693
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->sort('.$by.', ['.($asc ? 'TRUE' : 'FALSE').'])] Sorted list elements do not match unsorted elements', $this->extKey, SYSLOG_SEVERITY_ERROR);
694 694
 
695
-			}
695
+            }
696 696
 
697
-		}
697
+        }
698 698
 
699
-	}
699
+    }
700 700
 
701
-	/**
702
-	 * This unsets the element at the given offset
703
-	 * @see ArrayAccess::offsetUnset()
704
-	 *
705
-	 * @access	public
706
-	 *
707
-	 * @param	mixed		$offset: The offset to unset
708
-	 *
709
-	 * @return	void
710
-	 */
711
-	public function offsetUnset($offset) {
701
+    /**
702
+     * This unsets the element at the given offset
703
+     * @see ArrayAccess::offsetUnset()
704
+     *
705
+     * @access	public
706
+     *
707
+     * @param	mixed		$offset: The offset to unset
708
+     *
709
+     * @return	void
710
+     */
711
+    public function offsetUnset($offset) {
712 712
 
713
-		unset ($this->elements[$offset]);
713
+        unset ($this->elements[$offset]);
714 714
 
715
-		// Re-number the elements.
716
-		$this->elements = array_values($this->elements);
715
+        // Re-number the elements.
716
+        $this->elements = array_values($this->elements);
717 717
 
718
-		$this->count = count($this->elements);
718
+        $this->count = count($this->elements);
719 719
 
720
-	}
720
+    }
721 721
 
722
-	/**
723
-	 * This checks if the current list position is valid
724
-	 * @see Iterator::valid()
725
-	 *
726
-	 * @access	public
727
-	 *
728
-	 * @return	boolean		Is the current list position valid?
729
-	 */
730
-	public function valid() {
722
+    /**
723
+     * This checks if the current list position is valid
724
+     * @see Iterator::valid()
725
+     *
726
+     * @access	public
727
+     *
728
+     * @return	boolean		Is the current list position valid?
729
+     */
730
+    public function valid() {
731 731
 
732
-		return isset($this->elements[$this->position]);
732
+        return isset($this->elements[$this->position]);
733 733
 
734
-	}
734
+    }
735 735
 
736
-	/**
737
-	 * This returns $this->metadata via __get()
738
-	 *
739
-	 * @access	protected
740
-	 *
741
-	 * @return	array		The list's metadata
742
-	 */
743
-	protected function _getMetadata() {
736
+    /**
737
+     * This returns $this->metadata via __get()
738
+     *
739
+     * @access	protected
740
+     *
741
+     * @return	array		The list's metadata
742
+     */
743
+    protected function _getMetadata() {
744 744
 
745
-		return $this->metadata;
745
+        return $this->metadata;
746 746
 
747
-	}
747
+    }
748 748
 
749
-	/**
750
-	 * This sets $this->metadata via __set()
751
-	 *
752
-	 * @access	protected
753
-	 *
754
-	 * @param	array		$metadata: Array of new metadata
755
-	 *
756
-	 * @return	void
757
-	 */
758
-	protected function _setMetadata(array $metadata = array ()) {
749
+    /**
750
+     * This sets $this->metadata via __set()
751
+     *
752
+     * @access	protected
753
+     *
754
+     * @param	array		$metadata: Array of new metadata
755
+     *
756
+     * @return	void
757
+     */
758
+    protected function _setMetadata(array $metadata = array ()) {
759 759
 
760
-		$this->metadata = $metadata;
760
+        $this->metadata = $metadata;
761 761
 
762
-	}
762
+    }
763 763
 
764
-	/**
765
-	 * This is the constructor
766
-	 *
767
-	 * @access	public
768
-	 *
769
-	 * @param	array		$elements: Array of documents initially setting up the list
770
-	 * @param	array		$metadata: Array of initial metadata
771
-	 *
772
-	 * @return	void
773
-	 */
774
-	public function __construct(array $elements = array (), array $metadata = array ()) {
764
+    /**
765
+     * This is the constructor
766
+     *
767
+     * @access	public
768
+     *
769
+     * @param	array		$elements: Array of documents initially setting up the list
770
+     * @param	array		$metadata: Array of initial metadata
771
+     *
772
+     * @return	void
773
+     */
774
+    public function __construct(array $elements = array (), array $metadata = array ()) {
775 775
 
776
-		if (empty($elements) && empty($metadata)) {
776
+        if (empty($elements) && empty($metadata)) {
777 777
 
778
-			// Let's check the user's session.
779
-			$sessionData = tx_dlf_helper::loadFromSession(get_class($this));
778
+            // Let's check the user's session.
779
+            $sessionData = tx_dlf_helper::loadFromSession(get_class($this));
780 780
 
781
-			// Restore list from session data.
782
-			if (is_array($sessionData)) {
781
+            // Restore list from session data.
782
+            if (is_array($sessionData)) {
783 783
 
784
-				if (is_array($sessionData[0])) {
784
+                if (is_array($sessionData[0])) {
785 785
 
786
-					$this->elements = $sessionData[0];
786
+                    $this->elements = $sessionData[0];
787 787
 
788
-				}
788
+                }
789 789
 
790
-				if (is_array($sessionData[1])) {
790
+                if (is_array($sessionData[1])) {
791 791
 
792
-					$this->metadata = $sessionData[1];
792
+                    $this->metadata = $sessionData[1];
793 793
 
794
-				}
794
+                }
795 795
 
796
-			}
796
+            }
797 797
 
798
-		} else {
798
+        } else {
799 799
 
800
-			// Add metadata to the list.
801
-			$this->metadata = $metadata;
800
+            // Add metadata to the list.
801
+            $this->metadata = $metadata;
802 802
 
803
-			// Add initial set of elements to the list.
804
-			$this->elements = $elements;
803
+            // Add initial set of elements to the list.
804
+            $this->elements = $elements;
805 805
 
806
-		}
806
+        }
807 807
 
808
-		$this->count = count($this->elements);
808
+        $this->count = count($this->elements);
809 809
 
810
-	}
810
+    }
811 811
 
812
-	/**
813
-	 * This magic method is invoked each time a clone is called on the object variable
814
-	 * (This method is defined as private/protected because singleton objects should not be cloned)
815
-	 *
816
-	 * @access	protected
817
-	 *
818
-	 * @return	void
819
-	 */
820
-	protected function __clone() {}
812
+    /**
813
+     * This magic method is invoked each time a clone is called on the object variable
814
+     * (This method is defined as private/protected because singleton objects should not be cloned)
815
+     *
816
+     * @access	protected
817
+     *
818
+     * @return	void
819
+     */
820
+    protected function __clone() {}
821 821
 
822
-	/**
823
-	 * This magic method is called each time an invisible property is referenced from the object
824
-	 *
825
-	 * @access	public
826
-	 *
827
-	 * @param	string		$var: Name of variable to get
828
-	 *
829
-	 * @return	mixed		Value of $this->$var
830
-	 */
831
-	public function __get($var) {
822
+    /**
823
+     * This magic method is called each time an invisible property is referenced from the object
824
+     *
825
+     * @access	public
826
+     *
827
+     * @param	string		$var: Name of variable to get
828
+     *
829
+     * @return	mixed		Value of $this->$var
830
+     */
831
+    public function __get($var) {
832 832
 
833
-		$method = '_get'.ucfirst($var);
833
+        $method = '_get'.ucfirst($var);
834 834
 
835
-		if (!property_exists($this, $var) || !method_exists($this, $method)) {
835
+        if (!property_exists($this, $var) || !method_exists($this, $method)) {
836 836
 
837
-			if (TYPO3_DLOG) {
837
+            if (TYPO3_DLOG) {
838 838
 
839
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->__get('.$var.')] There is no getter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
839
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->__get('.$var.')] There is no getter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
840 840
 
841
-			}
841
+            }
842 842
 
843
-			return;
843
+            return;
844 844
 
845
-		} else {
845
+        } else {
846 846
 
847
-			return $this->$method();
847
+            return $this->$method();
848 848
 
849
-		}
849
+        }
850 850
 
851
-	}
851
+    }
852 852
 
853
-	/**
854
-	 * This magic method is called each time an invisible property is referenced from the object
855
-	 *
856
-	 * @access	public
857
-	 *
858
-	 * @param	string		$var: Name of variable to set
859
-	 * @param	mixed		$value: New value of variable
860
-	 *
861
-	 * @return	void
862
-	 */
863
-	public function __set($var, $value) {
853
+    /**
854
+     * This magic method is called each time an invisible property is referenced from the object
855
+     *
856
+     * @access	public
857
+     *
858
+     * @param	string		$var: Name of variable to set
859
+     * @param	mixed		$value: New value of variable
860
+     *
861
+     * @return	void
862
+     */
863
+    public function __set($var, $value) {
864 864
 
865
-		$method = '_set'.ucfirst($var);
865
+        $method = '_set'.ucfirst($var);
866 866
 
867
-		if (!property_exists($this, $var) || !method_exists($this, $method)) {
867
+        if (!property_exists($this, $var) || !method_exists($this, $method)) {
868 868
 
869
-			if (TYPO3_DLOG) {
869
+            if (TYPO3_DLOG) {
870 870
 
871
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->__set('.$var.', [data])] There is no setter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $value);
871
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->__set('.$var.', [data])] There is no setter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $value);
872 872
 
873
-			}
873
+            }
874 874
 
875
-		} else {
875
+        } else {
876 876
 
877
-			$this->$method($value);
877
+            $this->$method($value);
878 878
 
879
-		}
879
+        }
880 880
 
881
-	}
881
+    }
882 882
 
883
-	/**
884
-	 * This magic method is executed prior to any serialization of the object
885
-	 * @see __wakeup()
886
-	 *
887
-	 * @access	public
888
-	 *
889
-	 * @return	array		Properties to be serialized
890
-	 */
891
-	public function __sleep() {
883
+    /**
884
+     * This magic method is executed prior to any serialization of the object
885
+     * @see __wakeup()
886
+     *
887
+     * @access	public
888
+     *
889
+     * @return	array		Properties to be serialized
890
+     */
891
+    public function __sleep() {
892 892
 
893
-		return array ('elements', 'metadata');
893
+        return array ('elements', 'metadata');
894 894
 
895
-	}
895
+    }
896 896
 
897
-	/**
898
-	 * This magic method is executed after the object is deserialized
899
-	 * @see __sleep()
900
-	 *
901
-	 * @access	public
902
-	 *
903
-	 * @return	void
904
-	 */
905
-	public function __wakeup() {
897
+    /**
898
+     * This magic method is executed after the object is deserialized
899
+     * @see __sleep()
900
+     *
901
+     * @access	public
902
+     *
903
+     * @return	void
904
+     */
905
+    public function __wakeup() {
906 906
 
907
-		$this->count = count($this->elements);
907
+        $this->count = count($this->elements);
908 908
 
909
-	}
909
+    }
910 910
 
911 911
 }
Please login to merge, or discard this patch.
common/class.tx_dlf_fulltext.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -20,15 +20,15 @@
 block discarded – undo
20 20
  */
21 21
 interface tx_dlf_fulltext {
22 22
 
23
-	/**
24
-	 * This extracts raw fulltext data from XML
25
-	 *
26
-	 * @access	public
27
-	 *
28
-	 * @param	SimpleXMLElement		$xml: The XML to extract the metadata from
29
-	 *
30
-	 * @return	string			The raw unformatted fulltext
31
-	 */
32
-	public static function getRawText(SimpleXMLElement $xml);
23
+    /**
24
+     * This extracts raw fulltext data from XML
25
+     *
26
+     * @access	public
27
+     *
28
+     * @param	SimpleXMLElement		$xml: The XML to extract the metadata from
29
+     *
30
+     * @return	string			The raw unformatted fulltext
31
+     */
32
+    public static function getRawText(SimpleXMLElement $xml);
33 33
 
34 34
 }
Please login to merge, or discard this patch.