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.
Passed
Branch master (5c2c02)
by Sebastian
03:02
created
plugins/collection/class.tx_dlf_collection.php 1 patch
Indentation   +261 added lines, -261 removed lines patch added patch discarded remove patch
@@ -19,414 +19,414 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_collection extends tx_dlf_plugin {
21 21
 
22
-	public $scriptRelPath = 'plugins/collection/class.tx_dlf_collection.php';
22
+    public $scriptRelPath = 'plugins/collection/class.tx_dlf_collection.php';
23 23
 
24
-	/**
25
-	 * This holds the hook objects
26
-	 *
27
-	 * @var	array
28
-	 * @access protected
29
-	 */
30
-	protected $hookObjects = array ();
24
+    /**
25
+     * This holds the hook objects
26
+     *
27
+     * @var	array
28
+     * @access protected
29
+     */
30
+    protected $hookObjects = array ();
31 31
 
32
-	/**
33
-	 * The main method of the PlugIn
34
-	 *
35
-	 * @access	public
36
-	 *
37
-	 * @param	string		$content: The PlugIn content
38
-	 * @param	array		$conf: The PlugIn configuration
39
-	 *
40
-	 * @return	string		The content that is displayed on the website
41
-	 */
42
-	public function main($content, $conf) {
32
+    /**
33
+     * The main method of the PlugIn
34
+     *
35
+     * @access	public
36
+     *
37
+     * @param	string		$content: The PlugIn content
38
+     * @param	array		$conf: The PlugIn configuration
39
+     *
40
+     * @return	string		The content that is displayed on the website
41
+     */
42
+    public function main($content, $conf) {
43 43
 
44
-		$this->init($conf);
44
+        $this->init($conf);
45 45
 
46
-		// Turn cache on.
47
-		$this->setCache(TRUE);
46
+        // Turn cache on.
47
+        $this->setCache(TRUE);
48 48
 
49
-		// Quit without doing anything if required configuration variables are not set.
50
-		if (empty($this->conf['pages'])) {
49
+        // Quit without doing anything if required configuration variables are not set.
50
+        if (empty($this->conf['pages'])) {
51 51
 
52
-			if (TYPO3_DLOG) {
52
+            if (TYPO3_DLOG) {
53 53
 
54
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_collection->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
54
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_collection->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
55 55
 
56
-			}
56
+            }
57 57
 
58
-			return $content;
58
+            return $content;
59 59
 
60
-		}
60
+        }
61 61
 
62
-		// Load template file.
63
-		if (!empty($this->conf['templateFile'])) {
62
+        // Load template file.
63
+        if (!empty($this->conf['templateFile'])) {
64 64
 
65
-			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
65
+            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
66 66
 
67
-		} else {
67
+        } else {
68 68
 
69
-			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/collection/template.tmpl'), '###TEMPLATE###');
69
+            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/collection/template.tmpl'), '###TEMPLATE###');
70 70
 
71
-		}
71
+        }
72 72
 
73
-		// Get hook objects.
74
-		$this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath);
73
+        // Get hook objects.
74
+        $this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath);
75 75
 
76
-		if (!empty($this->piVars['collection'])) {
76
+        if (!empty($this->piVars['collection'])) {
77 77
 
78
-			$this->showSingleCollection(intval($this->piVars['collection']));
78
+            $this->showSingleCollection(intval($this->piVars['collection']));
79 79
 
80
-		} else {
80
+        } else {
81 81
 
82
-			$content .= $this->showCollectionList();
82
+            $content .= $this->showCollectionList();
83 83
 
84
-		}
84
+        }
85 85
 
86
-		return $this->pi_wrapInBaseClass($content);
86
+        return $this->pi_wrapInBaseClass($content);
87 87
 
88
-	}
88
+    }
89 89
 
90
-	/**
91
-	 * Builds a collection list
92
-	 *
93
-	 * @access	protected
94
-	 *
95
-	 * @return	string		The list of collections ready to output
96
-	 */
97
-	protected function showCollectionList() {
90
+    /**
91
+     * Builds a collection list
92
+     *
93
+     * @access	protected
94
+     *
95
+     * @return	string		The list of collections ready to output
96
+     */
97
+    protected function showCollectionList() {
98 98
 
99
-		$additionalWhere = '';
99
+        $additionalWhere = '';
100 100
 
101
-		$orderBy = 'tx_dlf_collections.label';
101
+        $orderBy = 'tx_dlf_collections.label';
102 102
 
103
-		// Handle collections set by configuration.
104
-		if ($this->conf['collections']) {
103
+        // Handle collections set by configuration.
104
+        if ($this->conf['collections']) {
105 105
 
106
-			if (count(explode(',', $this->conf['collections'])) == 1 && empty($this->conf['dont_show_single'])) {
106
+            if (count(explode(',', $this->conf['collections'])) == 1 && empty($this->conf['dont_show_single'])) {
107 107
 
108
-				$this->showSingleCollection(intval(trim($this->conf['collections'], ' ,')));
108
+                $this->showSingleCollection(intval(trim($this->conf['collections'], ' ,')));
109 109
 
110
-			}
110
+            }
111 111
 
112
-			$additionalWhere .= ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
112
+            $additionalWhere .= ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
113 113
 
114
-			$orderBy = 'FIELD(tx_dlf_collections.uid, '.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
114
+            $orderBy = 'FIELD(tx_dlf_collections.uid, '.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
115 115
 
116
-		}
116
+        }
117 117
 
118
-		// Should user-defined collections be shown?
119
-		if (empty($this->conf['show_userdefined'])) {
118
+        // Should user-defined collections be shown?
119
+        if (empty($this->conf['show_userdefined'])) {
120 120
 
121
-			$additionalWhere .= ' AND tx_dlf_collections.fe_cruser_id=0';
121
+            $additionalWhere .= ' AND tx_dlf_collections.fe_cruser_id=0';
122 122
 
123
-		} elseif ($this->conf['show_userdefined'] > 0) {
123
+        } elseif ($this->conf['show_userdefined'] > 0) {
124 124
 
125
-			if (!empty($GLOBALS['TSFE']->fe_user->user['uid'])) {
125
+            if (!empty($GLOBALS['TSFE']->fe_user->user['uid'])) {
126 126
 
127
-				$additionalWhere .= ' AND tx_dlf_collections.fe_cruser_id='.intval($GLOBALS['TSFE']->fe_user->user['uid']);
127
+                $additionalWhere .= ' AND tx_dlf_collections.fe_cruser_id='.intval($GLOBALS['TSFE']->fe_user->user['uid']);
128 128
 
129
-			} else {
129
+            } else {
130 130
 
131
-				$additionalWhere .= ' AND NOT tx_dlf_collections.fe_cruser_id=0';
131
+                $additionalWhere .= ' AND NOT tx_dlf_collections.fe_cruser_id=0';
132 132
 
133
-			}
133
+            }
134 134
 
135
-		}
135
+        }
136 136
 
137
-		// Get collections.
138
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
139
-			'tx_dlf_collections.uid AS uid,tx_dlf_collections.label AS label,tx_dlf_collections.thumbnail AS thumbnail,tx_dlf_collections.description AS description,tx_dlf_collections.priority AS priority,COUNT(tx_dlf_documents.uid) AS titles',
140
-			'tx_dlf_documents',
141
-			'tx_dlf_relations',
142
-			'tx_dlf_collections',
143
-			'AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
144
-			'tx_dlf_collections.uid',
145
-			$orderBy,
146
-			''
147
-		);
137
+        // Get collections.
138
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
139
+            'tx_dlf_collections.uid AS uid,tx_dlf_collections.label AS label,tx_dlf_collections.thumbnail AS thumbnail,tx_dlf_collections.description AS description,tx_dlf_collections.priority AS priority,COUNT(tx_dlf_documents.uid) AS titles',
140
+            'tx_dlf_documents',
141
+            'tx_dlf_relations',
142
+            'tx_dlf_collections',
143
+            'AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
144
+            'tx_dlf_collections.uid',
145
+            $orderBy,
146
+            ''
147
+        );
148 148
 
149
-		$count = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
149
+        $count = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
150 150
 
151
-		$content = '';
151
+        $content = '';
152 152
 
153
-		if ($count == 1 && empty($this->conf['dont_show_single'])) {
153
+        if ($count == 1 && empty($this->conf['dont_show_single'])) {
154 154
 
155
-			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
155
+            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
156 156
 
157
-			$this->showSingleCollection(intval($resArray['uid']));
157
+            $this->showSingleCollection(intval($resArray['uid']));
158 158
 
159
-		} elseif ($count > 0) {
159
+        } elseif ($count > 0) {
160 160
 
161
-			// Get number of volumes per collection.
162
-			$resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
163
-				'tx_dlf_collections.uid AS uid,COUNT(tx_dlf_documents.uid) AS volumes',
164
-				'tx_dlf_documents',
165
-				'tx_dlf_relations',
166
-				'tx_dlf_collections',
167
-				'AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
168
-				'tx_dlf_collections.uid',
169
-				'',
170
-				''
171
-			);
161
+            // Get number of volumes per collection.
162
+            $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
163
+                'tx_dlf_collections.uid AS uid,COUNT(tx_dlf_documents.uid) AS volumes',
164
+                'tx_dlf_documents',
165
+                'tx_dlf_relations',
166
+                'tx_dlf_collections',
167
+                'AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
168
+                'tx_dlf_collections.uid',
169
+                '',
170
+                ''
171
+            );
172 172
 
173
-			$volumes = array ();
173
+            $volumes = array ();
174 174
 
175
-			while ($resArrayVolumes = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultVolumes)) {
175
+            while ($resArrayVolumes = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultVolumes)) {
176 176
 
177
-				$volumes[$resArrayVolumes['uid']] = $resArrayVolumes['volumes'];
177
+                $volumes[$resArrayVolumes['uid']] = $resArrayVolumes['volumes'];
178 178
 
179
-			}
179
+            }
180 180
 
181
-			// Process results.
182
-			while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
181
+            // Process results.
182
+            while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
183 183
 
184
-				// Generate random but unique array key taking priority into account.
185
-				do {
184
+                // Generate random but unique array key taking priority into account.
185
+                do {
186 186
 
187
-					$_key = ($resArray['priority'] * 1000) + mt_rand(0, 1000);
187
+                    $_key = ($resArray['priority'] * 1000) + mt_rand(0, 1000);
188 188
 
189
-				} while (!empty($markerArray[$_key]));
189
+                } while (!empty($markerArray[$_key]));
190 190
 
191
-				// Merge plugin variables with new set of values.
192
-				$additionalParams = array ('collection' => $resArray['uid']);
191
+                // Merge plugin variables with new set of values.
192
+                $additionalParams = array ('collection' => $resArray['uid']);
193 193
 
194
-				if (is_array($this->piVars)) {
194
+                if (is_array($this->piVars)) {
195 195
 
196
-					$piVars = $this->piVars;
196
+                    $piVars = $this->piVars;
197 197
 
198
-					unset($piVars['DATA']);
198
+                    unset($piVars['DATA']);
199 199
 
200
-					$additionalParams = tx_dlf_helper::array_merge_recursive_overrule($piVars, $additionalParams);
200
+                    $additionalParams = tx_dlf_helper::array_merge_recursive_overrule($piVars, $additionalParams);
201 201
 
202
-				}
202
+                }
203 203
 
204
-				// Build typolink configuration array.
205
-				$conf = array (
206
-					'useCacheHash' => 1,
207
-					'parameter' => $GLOBALS['TSFE']->id,
208
-					'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
209
-				);
204
+                // Build typolink configuration array.
205
+                $conf = array (
206
+                    'useCacheHash' => 1,
207
+                    'parameter' => $GLOBALS['TSFE']->id,
208
+                    'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
209
+                );
210 210
 
211
-				// Link collection's title to list view.
212
-				$markerArray[$_key]['###TITLE###'] = $this->cObj->typoLink(htmlspecialchars($resArray['label']), $conf);
211
+                // Link collection's title to list view.
212
+                $markerArray[$_key]['###TITLE###'] = $this->cObj->typoLink(htmlspecialchars($resArray['label']), $conf);
213 213
 
214
-				// Add feed link if applicable.
215
-				if (!empty($this->conf['targetFeed'])) {
214
+                // Add feed link if applicable.
215
+                if (!empty($this->conf['targetFeed'])) {
216 216
 
217
-					$img = '<img src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/icons/txdlffeeds.png" alt="'.$this->pi_getLL('feedAlt', '', TRUE).'" title="'.$this->pi_getLL('feedTitle', '', TRUE).'" />';
217
+                    $img = '<img src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/icons/txdlffeeds.png" alt="'.$this->pi_getLL('feedAlt', '', TRUE).'" title="'.$this->pi_getLL('feedTitle', '', TRUE).'" />';
218 218
 
219
-					$markerArray[$_key]['###FEED###'] = $this->pi_linkTP($img, array ($this->prefixId => array ('collection' => $resArray['uid'])), FALSE, $this->conf['targetFeed']);
219
+                    $markerArray[$_key]['###FEED###'] = $this->pi_linkTP($img, array ($this->prefixId => array ('collection' => $resArray['uid'])), FALSE, $this->conf['targetFeed']);
220 220
 
221
-				} else {
221
+                } else {
222 222
 
223
-					$markerArray[$_key]['###FEED###'] = '';
223
+                    $markerArray[$_key]['###FEED###'] = '';
224 224
 
225
-				}
225
+                }
226 226
 
227
-				// Add thumbnail.
228
-				if (!empty($resArray['thumbnail'])) {
227
+                // Add thumbnail.
228
+                if (!empty($resArray['thumbnail'])) {
229 229
 
230
-					$markerArray[$_key]['###THUMBNAIL###'] = '<img alt="" title="'.htmlspecialchars($resArray['label']).'" src="'.$resArray['thumbnail'].'" />';
230
+                    $markerArray[$_key]['###THUMBNAIL###'] = '<img alt="" title="'.htmlspecialchars($resArray['label']).'" src="'.$resArray['thumbnail'].'" />';
231 231
 
232
-				} else {
232
+                } else {
233 233
 
234
-					$markerArray[$_key]['###THUMBNAIL###'] = '';
234
+                    $markerArray[$_key]['###THUMBNAIL###'] = '';
235 235
 
236
-				}
236
+                }
237 237
 
238
-				// Add description.
239
-				$markerArray[$_key]['###DESCRIPTION###'] = $this->pi_RTEcssText($resArray['description']);
238
+                // Add description.
239
+                $markerArray[$_key]['###DESCRIPTION###'] = $this->pi_RTEcssText($resArray['description']);
240 240
 
241
-				// Build statistic's output.
242
-				$labelTitles = $this->pi_getLL(($resArray['titles'] > 1 ? 'titles' : 'title'), '', FALSE);
241
+                // Build statistic's output.
242
+                $labelTitles = $this->pi_getLL(($resArray['titles'] > 1 ? 'titles' : 'title'), '', FALSE);
243 243
 
244
-				$markerArray[$_key]['###COUNT_TITLES###'] = htmlspecialchars($resArray['titles'].$labelTitles);
244
+                $markerArray[$_key]['###COUNT_TITLES###'] = htmlspecialchars($resArray['titles'].$labelTitles);
245 245
 
246
-				$labelVolumes = $this->pi_getLL(($volumes[$resArray['uid']] > 1 ? 'volumes' : 'volume'), '', FALSE);
246
+                $labelVolumes = $this->pi_getLL(($volumes[$resArray['uid']] > 1 ? 'volumes' : 'volume'), '', FALSE);
247 247
 
248
-				$markerArray[$_key]['###COUNT_VOLUMES###'] = htmlspecialchars($volumes[$resArray['uid']].$labelVolumes);
248
+                $markerArray[$_key]['###COUNT_VOLUMES###'] = htmlspecialchars($volumes[$resArray['uid']].$labelVolumes);
249 249
 
250
-			}
250
+            }
251 251
 
252
-			// Randomize sorting?
253
-			if (!empty($this->conf['randomize'])) {
252
+            // Randomize sorting?
253
+            if (!empty($this->conf['randomize'])) {
254 254
 
255
-				ksort($markerArray, SORT_NUMERIC);
255
+                ksort($markerArray, SORT_NUMERIC);
256 256
 
257
-				// Don't cache the output.
258
-				$this->setCache(FALSE);
257
+                // Don't cache the output.
258
+                $this->setCache(FALSE);
259 259
 
260
-			}
260
+            }
261 261
 
262
-			$entry = $this->cObj->getSubpart($this->template, '###ENTRY###');
262
+            $entry = $this->cObj->getSubpart($this->template, '###ENTRY###');
263 263
 
264
-			foreach ($markerArray as $marker) {
264
+            foreach ($markerArray as $marker) {
265 265
 
266
-				$content .= $this->cObj->substituteMarkerArray($entry, $marker);
266
+                $content .= $this->cObj->substituteMarkerArray($entry, $marker);
267 267
 
268
-			}
268
+            }
269 269
 
270
-			// Hook for getting custom collection hierarchies/subentries (requested by SBB).
271
-			foreach ($this->hookObjects as $hookObj) {
270
+            // Hook for getting custom collection hierarchies/subentries (requested by SBB).
271
+            foreach ($this->hookObjects as $hookObj) {
272 272
 
273
-				if (method_exists($hookObj, 'showCollectionList_getCustomCollectionList')) {
273
+                if (method_exists($hookObj, 'showCollectionList_getCustomCollectionList')) {
274 274
 
275
-					$hookObj->showCollectionList_getCustomCollectionList($this, $this->conf['templateFile'], $content, $markerArray);
275
+                    $hookObj->showCollectionList_getCustomCollectionList($this, $this->conf['templateFile'], $content, $markerArray);
276 276
 
277
-				}
277
+                }
278 278
 
279
-			}
279
+            }
280 280
 
281
-			return $this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE);
281
+            return $this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE);
282 282
 
283
-		}
283
+        }
284 284
 
285
-		return $content;
285
+        return $content;
286 286
 
287
-	}
287
+    }
288 288
 
289
-	/**
290
-	 * Builds a collection's list
291
-	 *
292
-	 * @access	protected
293
-	 *
294
-	 * @param	integer		$id: The collection's UID
295
-	 *
296
-	 * @return	void
297
-	 */
298
-	protected function showSingleCollection($id) {
289
+    /**
290
+     * Builds a collection's list
291
+     *
292
+     * @access	protected
293
+     *
294
+     * @param	integer		$id: The collection's UID
295
+     *
296
+     * @return	void
297
+     */
298
+    protected function showSingleCollection($id) {
299 299
 
300
-		// Should user-defined collections be shown?
301
-		if (empty($this->conf['show_userdefined'])) {
300
+        // Should user-defined collections be shown?
301
+        if (empty($this->conf['show_userdefined'])) {
302 302
 
303
-			$additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
303
+            $additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
304 304
 
305
-		} elseif ($this->conf['show_userdefined'] > 0) {
305
+        } elseif ($this->conf['show_userdefined'] > 0) {
306 306
 
307
-			$additionalWhere = ' AND NOT tx_dlf_collections.fe_cruser_id=0';
307
+            $additionalWhere = ' AND NOT tx_dlf_collections.fe_cruser_id=0';
308 308
 
309
-		}
309
+        }
310 310
 
311
-		// Get all documents in collection.
312
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
313
-			'tx_dlf_collections.index_name AS index_name,tx_dlf_collections.label AS collLabel,tx_dlf_collections.description AS collDesc,tx_dlf_collections.thumbnail AS collThumb,tx_dlf_collections.fe_cruser_id AS userid,tx_dlf_documents.uid AS uid,tx_dlf_documents.metadata_sorting AS metadata_sorting,tx_dlf_documents.volume_sorting AS volume_sorting,tx_dlf_documents.partof AS partof',
314
-			'tx_dlf_documents',
315
-			'tx_dlf_relations',
316
-			'tx_dlf_collections',
317
-			'AND tx_dlf_collections.uid='.intval($id).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
318
-			'',
319
-			'tx_dlf_documents.title_sorting ASC',
320
-			''
321
-		);
311
+        // Get all documents in collection.
312
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
313
+            'tx_dlf_collections.index_name AS index_name,tx_dlf_collections.label AS collLabel,tx_dlf_collections.description AS collDesc,tx_dlf_collections.thumbnail AS collThumb,tx_dlf_collections.fe_cruser_id AS userid,tx_dlf_documents.uid AS uid,tx_dlf_documents.metadata_sorting AS metadata_sorting,tx_dlf_documents.volume_sorting AS volume_sorting,tx_dlf_documents.partof AS partof',
314
+            'tx_dlf_documents',
315
+            'tx_dlf_relations',
316
+            'tx_dlf_collections',
317
+            'AND tx_dlf_collections.uid='.intval($id).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
318
+            '',
319
+            'tx_dlf_documents.title_sorting ASC',
320
+            ''
321
+        );
322 322
 
323
-		$toplevel = array ();
323
+        $toplevel = array ();
324 324
 
325
-		$subparts = array ();
325
+        $subparts = array ();
326 326
 
327
-		$listMetadata = array ();
327
+        $listMetadata = array ();
328 328
 
329
-		// Process results.
330
-		while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
329
+        // Process results.
330
+        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
331 331
 
332
-			if (empty($listMetadata)) {
332
+            if (empty($listMetadata)) {
333 333
 
334
-				$listMetadata = array (
335
-					'label' => htmlspecialchars($resArray['collLabel']),
336
-					'description' => $this->pi_RTEcssText($resArray['collDesc']),
337
-					'thumbnail' => htmlspecialchars($resArray['collThumb']),
338
-					'options' => array (
339
-						'source' => 'collection',
340
-						'select' => $id,
341
-						'userid' => $resArray['userid'],
342
-						'params' => array ('fq' => array ('collection_faceting:("'.$resArray['index_name'].'")')),
343
-						'core' => '',
344
-						'pid' => $this->conf['pages'],
345
-						'order' => 'title',
346
-						'order.asc' => TRUE
347
-					)
348
-				);
334
+                $listMetadata = array (
335
+                    'label' => htmlspecialchars($resArray['collLabel']),
336
+                    'description' => $this->pi_RTEcssText($resArray['collDesc']),
337
+                    'thumbnail' => htmlspecialchars($resArray['collThumb']),
338
+                    'options' => array (
339
+                        'source' => 'collection',
340
+                        'select' => $id,
341
+                        'userid' => $resArray['userid'],
342
+                        'params' => array ('fq' => array ('collection_faceting:("'.$resArray['index_name'].'")')),
343
+                        'core' => '',
344
+                        'pid' => $this->conf['pages'],
345
+                        'order' => 'title',
346
+                        'order.asc' => TRUE
347
+                    )
348
+                );
349 349
 
350
-			}
350
+            }
351 351
 
352
-			// Split toplevel documents from volumes.
353
-			if ($resArray['partof'] == 0) {
352
+            // Split toplevel documents from volumes.
353
+            if ($resArray['partof'] == 0) {
354 354
 
355
-				// Prepare document's metadata for sorting.
356
-				$sorting = unserialize($resArray['metadata_sorting']);
355
+                // Prepare document's metadata for sorting.
356
+                $sorting = unserialize($resArray['metadata_sorting']);
357 357
 
358
-				if (!empty($sorting['type']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['type'])) {
358
+                if (!empty($sorting['type']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['type'])) {
359 359
 
360
-					$sorting['type'] = tx_dlf_helper::getIndexName($sorting['type'], 'tx_dlf_structures', $this->conf['pages']);
360
+                    $sorting['type'] = tx_dlf_helper::getIndexName($sorting['type'], 'tx_dlf_structures', $this->conf['pages']);
361 361
 
362
-				}
362
+                }
363 363
 
364
-				if (!empty($sorting['owner']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['owner'])) {
364
+                if (!empty($sorting['owner']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['owner'])) {
365 365
 
366
-					$sorting['owner'] = tx_dlf_helper::getIndexName($sorting['owner'], 'tx_dlf_libraries', $this->conf['pages']);
366
+                    $sorting['owner'] = tx_dlf_helper::getIndexName($sorting['owner'], 'tx_dlf_libraries', $this->conf['pages']);
367 367
 
368
-				}
368
+                }
369 369
 
370
-				if (!empty($sorting['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['collection'])) {
370
+                if (!empty($sorting['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['collection'])) {
371 371
 
372
-					$sorting['collection'] = tx_dlf_helper::getIndexName($sorting['collection'], 'tx_dlf_collections', $this->conf['pages']);
372
+                    $sorting['collection'] = tx_dlf_helper::getIndexName($sorting['collection'], 'tx_dlf_collections', $this->conf['pages']);
373 373
 
374
-				}
374
+                }
375 375
 
376
-				$toplevel[$resArray['uid']] = array (
377
-					'u' => $resArray['uid'],
378
-					'h' => '',
379
-					's' => $sorting,
380
-					'p' => array ()
381
-				);
376
+                $toplevel[$resArray['uid']] = array (
377
+                    'u' => $resArray['uid'],
378
+                    'h' => '',
379
+                    's' => $sorting,
380
+                    'p' => array ()
381
+                );
382 382
 
383
-			} else {
383
+            } else {
384 384
 
385
-				$subparts[$resArray['partof']][$resArray['volume_sorting']] = $resArray['uid'];
385
+                $subparts[$resArray['partof']][$resArray['volume_sorting']] = $resArray['uid'];
386 386
 
387
-			}
387
+            }
388 388
 
389
-		}
389
+        }
390 390
 
391
-		// Add volumes to the corresponding toplevel documents.
392
-		foreach ($subparts as $partof => $parts) {
391
+        // Add volumes to the corresponding toplevel documents.
392
+        foreach ($subparts as $partof => $parts) {
393 393
 
394
-			if (!empty($toplevel[$partof])) {
394
+            if (!empty($toplevel[$partof])) {
395 395
 
396
-				ksort($parts);
396
+                ksort($parts);
397 397
 
398
-				foreach ($parts as $part) {
398
+                foreach ($parts as $part) {
399 399
 
400
-					$toplevel[$partof]['p'][] = array ('u' => $part);
400
+                    $toplevel[$partof]['p'][] = array ('u' => $part);
401 401
 
402
-				}
402
+                }
403 403
 
404
-			}
404
+            }
405 405
 
406
-		}
406
+        }
407 407
 
408
-		// Save list of documents.
409
-		$list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
408
+        // Save list of documents.
409
+        $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
410 410
 
411
-		$list->reset();
411
+        $list->reset();
412 412
 
413
-		$list->add(array_values($toplevel));
413
+        $list->add(array_values($toplevel));
414 414
 
415
-		$list->metadata = $listMetadata;
415
+        $list->metadata = $listMetadata;
416 416
 
417
-		$list->save();
417
+        $list->save();
418 418
 
419
-		// Clean output buffer.
420
-		\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
419
+        // Clean output buffer.
420
+        \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
421 421
 
422
-		// Send headers.
423
-		header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL(array ('parameter' => $this->conf['targetPid']))));
422
+        // Send headers.
423
+        header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL(array ('parameter' => $this->conf['targetPid']))));
424 424
 
425
-		// Flush output buffer and end script processing.
426
-		ob_end_flush();
425
+        // Flush output buffer and end script processing.
426
+        ob_end_flush();
427 427
 
428
-		exit;
428
+        exit;
429 429
 
430
-	}
430
+    }
431 431
 
432 432
 }
Please login to merge, or discard this patch.
plugins/search/class.tx_dlf_search_suggest.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -20,43 +20,43 @@
 block discarded – undo
20 20
  */
21 21
 class tx_dlf_search_suggest extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
22 22
 
23
-	public $scriptRelPath = 'plugins/search/class.tx_dlf_search_suggest.php';
23
+    public $scriptRelPath = 'plugins/search/class.tx_dlf_search_suggest.php';
24 24
 
25
-	/**
26
-	 * The main method of the PlugIn
27
-	 *
28
-	 * @access	public
29
-	 *
30
-	 * @param	string		$content: The PlugIn content
31
-	 * @param	array		$conf: The PlugIn configuration
32
-	 *
33
-	 * @return	void
34
-	 */
35
-	public function main($content = '', $conf = array ()) {
25
+    /**
26
+     * The main method of the PlugIn
27
+     *
28
+     * @access	public
29
+     *
30
+     * @param	string		$content: The PlugIn content
31
+     * @param	array		$conf: The PlugIn configuration
32
+     *
33
+     * @return	void
34
+     */
35
+    public function main($content = '', $conf = array ()) {
36 36
 
37
-		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted') != '' && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed') != '') {
37
+        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted') != '' && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed') != '') {
38 38
 
39
-			$core = tx_dlf_helper::decrypt(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed'));
39
+            $core = tx_dlf_helper::decrypt(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed'));
40 40
 
41
-		}
41
+        }
42 42
 
43
-		if (!empty($core)) {
43
+        if (!empty($core)) {
44 44
 
45
-			$url = trim(tx_dlf_solr::getSolrUrl($core), '/').'/suggest/?q='.tx_dlf_solr::escapeQuery(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('q'));
45
+            $url = trim(tx_dlf_solr::getSolrUrl($core), '/').'/suggest/?q='.tx_dlf_solr::escapeQuery(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('q'));
46 46
 
47
-			if ($stream = fopen($url, 'r')) {
47
+            if ($stream = fopen($url, 'r')) {
48 48
 
49
-				$content .= stream_get_contents($stream);
49
+                $content .= stream_get_contents($stream);
50 50
 
51
-				fclose($stream);
51
+                fclose($stream);
52 52
 
53
-			}
53
+            }
54 54
 
55
-		}
55
+        }
56 56
 
57
-		echo $content;
57
+        echo $content;
58 58
 
59
-	}
59
+    }
60 60
 
61 61
 }
62 62
 
Please login to merge, or discard this patch.
plugins/search/class.tx_dlf_search.php 1 patch
Indentation   +515 added lines, -515 removed lines patch added patch discarded remove patch
@@ -20,834 +20,834 @@
 block discarded – undo
20 20
  */
21 21
 class tx_dlf_search extends tx_dlf_plugin {
22 22
 
23
-	public $scriptRelPath = 'plugins/search/class.tx_dlf_search.php';
23
+    public $scriptRelPath = 'plugins/search/class.tx_dlf_search.php';
24 24
 
25
-	/**
26
-	 * Adds the JS files necessary for search suggestions
27
-	 *
28
-	 * @access	protected
29
-	 *
30
-	 * @return	void
31
-	 */
32
-	protected function addAutocompleteJS() {
25
+    /**
26
+     * Adds the JS files necessary for search suggestions
27
+     *
28
+     * @access	protected
29
+     *
30
+     * @return	void
31
+     */
32
+    protected function addAutocompleteJS() {
33 33
 
34
-		// Check if there are any metadata to suggest.
35
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
36
-			'tx_dlf_metadata.*',
37
-			'tx_dlf_metadata',
38
-			'tx_dlf_metadata.index_autocomplete=1 AND tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'),
39
-			'',
40
-			'',
41
-			'1'
42
-		);
34
+        // Check if there are any metadata to suggest.
35
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
36
+            'tx_dlf_metadata.*',
37
+            'tx_dlf_metadata',
38
+            'tx_dlf_metadata.index_autocomplete=1 AND tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'),
39
+            '',
40
+            '',
41
+            '1'
42
+        );
43 43
 
44 44
 
45
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
45
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
46 46
 
47
-			$GLOBALS['TSFE']->additionalHeaderData[$this->prefixId.'_search_suggest'] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/search/tx_dlf_search_suggest.js"></script>';
47
+            $GLOBALS['TSFE']->additionalHeaderData[$this->prefixId.'_search_suggest'] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/search/tx_dlf_search_suggest.js"></script>';
48 48
 
49
-		} else {
49
+        } else {
50 50
 
51
-			if (TYPO3_DLOG) {
51
+            if (TYPO3_DLOG) {
52 52
 
53
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addAutocompleteJS()] No metadata fields configured for search suggestions', $this->extKey, SYSLOG_SEVERITY_WARNING);
53
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addAutocompleteJS()] No metadata fields configured for search suggestions', $this->extKey, SYSLOG_SEVERITY_WARNING);
54 54
 
55
-			}
55
+            }
56 56
 
57
-		}
57
+        }
58 58
 
59
-	}
59
+    }
60 60
 
61
-	/**
62
-	 * Adds the current collection's UID to the search form
63
-	 *
64
-	 * @access	protected
65
-	 *
66
-	 * @return	string		HTML input fields with current document's UID and parent ID
67
-	 */
68
-	protected function addCurrentCollection() {
61
+    /**
62
+     * Adds the current collection's UID to the search form
63
+     *
64
+     * @access	protected
65
+     *
66
+     * @return	string		HTML input fields with current document's UID and parent ID
67
+     */
68
+    protected function addCurrentCollection() {
69 69
 
70
-		// Load current collection.
71
-		$list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
70
+        // Load current collection.
71
+        $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
72 72
 
73
-		if (!empty($list->metadata['options']['source']) && $list->metadata['options']['source'] == 'collection') {
73
+        if (!empty($list->metadata['options']['source']) && $list->metadata['options']['source'] == 'collection') {
74 74
 
75
-			// Get collection's UID.
76
-			return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$list->metadata['options']['select'].'" />';
75
+            // Get collection's UID.
76
+            return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$list->metadata['options']['select'].'" />';
77 77
 
78
-		} elseif (!empty($list->metadata['options']['params']['fq'])) {
78
+        } elseif (!empty($list->metadata['options']['params']['fq'])) {
79 79
 
80
-			// Get collection's UID from search metadata.
81
-			foreach ($list->metadata['options']['params']['fq'] as $id => $facet) {
80
+            // Get collection's UID from search metadata.
81
+            foreach ($list->metadata['options']['params']['fq'] as $id => $facet) {
82 82
 
83
-				$facetKeyVal = explode(':', $facet, 2);
83
+                $facetKeyVal = explode(':', $facet, 2);
84 84
 
85
-				if ($facetKeyVal[0] == 'collection_faceting' && !strpos($facetKeyVal[1], '" OR "')) {
85
+                if ($facetKeyVal[0] == 'collection_faceting' && !strpos($facetKeyVal[1], '" OR "')) {
86 86
 
87
-					$collectionId = tx_dlf_helper::getIdFromIndexName(trim($facetKeyVal[1], '(")'), 'tx_dlf_collections');
87
+                    $collectionId = tx_dlf_helper::getIdFromIndexName(trim($facetKeyVal[1], '(")'), 'tx_dlf_collections');
88 88
 
89
-				}
89
+                }
90 90
 
91
-			}
91
+            }
92 92
 
93
-			return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$collectionId.'" />';
93
+            return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$collectionId.'" />';
94 94
 
95
-		}
95
+        }
96 96
 
97
-		return '';
97
+        return '';
98 98
 
99
-	}
99
+    }
100 100
 
101
-	/**
102
-	 * Adds the current document's UID or parent ID to the search form
103
-	 *
104
-	 * @access	protected
105
-	 *
106
-	 * @return	string		HTML input fields with current document's UID and parent ID
107
-	 */
108
-	protected function addCurrentDocument() {
101
+    /**
102
+     * Adds the current document's UID or parent ID to the search form
103
+     *
104
+     * @access	protected
105
+     *
106
+     * @return	string		HTML input fields with current document's UID and parent ID
107
+     */
108
+    protected function addCurrentDocument() {
109 109
 
110
-		// Load current list object.
111
-		$list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
110
+        // Load current list object.
111
+        $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
112 112
 
113
-		// Load current document.
114
-		if (!empty($this->piVars['id']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])) {
113
+        // Load current document.
114
+        if (!empty($this->piVars['id']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])) {
115 115
 
116
-			$this->loadDocument();
116
+            $this->loadDocument();
117 117
 
118
-			// Get document's UID or parent ID.
119
-			if ($this->doc->ready) {
118
+            // Get document's UID or parent ID.
119
+            if ($this->doc->ready) {
120 120
 
121
-				return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.($this->doc->parentId > 0 ? $this->doc->parentId : $this->doc->uid).'" />';
121
+                return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.($this->doc->parentId > 0 ? $this->doc->parentId : $this->doc->uid).'" />';
122 122
 
123
-			}
123
+            }
124 124
 
125
-		} elseif (!empty($list->metadata['options']['params']['fq'])) {
125
+        } elseif (!empty($list->metadata['options']['params']['fq'])) {
126 126
 
127
-			// Get document's UID from search metadata.
128
-			foreach ($list->metadata['options']['params']['fq'] as $id => $facet) {
127
+            // Get document's UID from search metadata.
128
+            foreach ($list->metadata['options']['params']['fq'] as $id => $facet) {
129 129
 
130
-				$facetKeyVal = explode(':', $facet);
130
+                $facetKeyVal = explode(':', $facet);
131 131
 
132
-				if ($facetKeyVal[0] == 'uid') {
132
+                if ($facetKeyVal[0] == 'uid') {
133 133
 
134
-					$documentId = (int) substr($facetKeyVal[1], 1, strpos($facetKeyVal[1], ')'));
134
+                    $documentId = (int) substr($facetKeyVal[1], 1, strpos($facetKeyVal[1], ')'));
135 135
 
136
-				}
136
+                }
137 137
 
138
-			}
138
+            }
139 139
 
140
-			return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.$documentId.'" />';
140
+            return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.$documentId.'" />';
141 141
 
142
-		}
142
+        }
143 143
 
144
-		return '';
144
+        return '';
145 145
 
146
-	}
146
+    }
147 147
 
148
-	/**
149
-	 * Adds the encrypted Solr core name to the search form
150
-	 *
151
-	 * @access	protected
152
-	 *
153
-	 * @return	string		HTML input fields with encrypted core name and hash
154
-	 */
155
-	protected function addEncryptedCoreName() {
148
+    /**
149
+     * Adds the encrypted Solr core name to the search form
150
+     *
151
+     * @access	protected
152
+     *
153
+     * @return	string		HTML input fields with encrypted core name and hash
154
+     */
155
+    protected function addEncryptedCoreName() {
156 156
 
157
-		// Get core name.
158
-		$name = tx_dlf_helper::getIndexName($this->conf['solrcore'], 'tx_dlf_solrcores');
157
+        // Get core name.
158
+        $name = tx_dlf_helper::getIndexName($this->conf['solrcore'], 'tx_dlf_solrcores');
159 159
 
160
-		// Encrypt core name.
161
-		if (!empty($name)) {
160
+        // Encrypt core name.
161
+        if (!empty($name)) {
162 162
 
163
-			$name = tx_dlf_helper::encrypt($name);
163
+            $name = tx_dlf_helper::encrypt($name);
164 164
 
165
-		}
165
+        }
166 166
 
167
-		// Add encrypted fields to search form.
168
-		if (is_array($name)) {
167
+        // Add encrypted fields to search form.
168
+        if (is_array($name)) {
169 169
 
170
-			return '<input type="hidden" name="'.$this->prefixId.'[encrypted]" value="'.$name['encrypted'].'" /><input type="hidden" name="'.$this->prefixId.'[hashed]" value="'.$name['hash'].'" />';
170
+            return '<input type="hidden" name="'.$this->prefixId.'[encrypted]" value="'.$name['encrypted'].'" /><input type="hidden" name="'.$this->prefixId.'[hashed]" value="'.$name['hash'].'" />';
171 171
 
172
-		} else {
172
+        } else {
173 173
 
174
-			return '';
174
+            return '';
175 175
 
176
-		}
176
+        }
177 177
 
178
-	}
178
+    }
179 179
 
180
-	/**
181
-	 * Returns the extended search form and adds the JS files necessary for extended search.
182
-	 *
183
-	 * @access	protected
184
-	 *
185
-	 * @return	string		The extended search form or an empty string
186
-	 */
187
-	protected function addExtendedSearch() {
180
+    /**
181
+     * Returns the extended search form and adds the JS files necessary for extended search.
182
+     *
183
+     * @access	protected
184
+     *
185
+     * @return	string		The extended search form or an empty string
186
+     */
187
+    protected function addExtendedSearch() {
188 188
 
189
-		$extendedSearch = '';
189
+        $extendedSearch = '';
190 190
 
191
-		// Quit without doing anything if no fields for extended search are selected.
192
-		if (empty($this->conf['extendedSlotCount']) || empty($this->conf['extendedFields'])) {
191
+        // Quit without doing anything if no fields for extended search are selected.
192
+        if (empty($this->conf['extendedSlotCount']) || empty($this->conf['extendedFields'])) {
193 193
 
194
-			return $extendedSearch;
194
+            return $extendedSearch;
195 195
 
196
-		}
196
+        }
197 197
 
198
-		// Get operator options.
199
-		$operatorOptions = '';
198
+        // Get operator options.
199
+        $operatorOptions = '';
200 200
 
201
-		foreach (array ('AND', 'OR', 'NOT') as $operator) {
201
+        foreach (array ('AND', 'OR', 'NOT') as $operator) {
202 202
 
203
-			$operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-'.$operator.'" value="'.$operator.'">'.$this->pi_getLL($operator, '', TRUE).'</option>';
203
+            $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-'.$operator.'" value="'.$operator.'">'.$this->pi_getLL($operator, '', TRUE).'</option>';
204 204
 
205
-		}
205
+        }
206 206
 
207
-		// Get field selector options.
208
-		$fieldSelectorOptions = '';
207
+        // Get field selector options.
208
+        $fieldSelectorOptions = '';
209 209
 
210
-		$searchFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE);
210
+        $searchFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE);
211 211
 
212
-		foreach ($searchFields as $searchField) {
212
+        foreach ($searchFields as $searchField) {
213 213
 
214
-			$fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-'.$searchField.'" value="'.$searchField.'">'.tx_dlf_helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']).'</option>';
214
+            $fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-'.$searchField.'" value="'.$searchField.'">'.tx_dlf_helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']).'</option>';
215 215
 
216
-		}
216
+        }
217 217
 
218
-		for ($i = 0; $i < $this->conf['extendedSlotCount']; $i++) {
218
+        for ($i = 0; $i < $this->conf['extendedSlotCount']; $i++) {
219 219
 
220
-			$markerArray = array (
221
-				'###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-'.$i.'" name="'.$this->prefixId.'[extOperator]['.$i.']">'.$operatorOptions.'</select>',
222
-				'###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-'.$i.'" name="'.$this->prefixId.'[extField]['.$i.']">'.$fieldSelectorOptions.'</select>',
223
-				'###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-'.$i.'" type="text" name="'.$this->prefixId.'[extQuery]['.$i.']" />'
224
-			);
220
+            $markerArray = array (
221
+                '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-'.$i.'" name="'.$this->prefixId.'[extOperator]['.$i.']">'.$operatorOptions.'</select>',
222
+                '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-'.$i.'" name="'.$this->prefixId.'[extField]['.$i.']">'.$fieldSelectorOptions.'</select>',
223
+                '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-'.$i.'" type="text" name="'.$this->prefixId.'[extQuery]['.$i.']" />'
224
+            );
225 225
 
226
-			$extendedSearch .= $this->cObj->substituteMarkerArray($this->cObj->getSubpart($this->template, '###EXT_SEARCH_ENTRY###'), $markerArray);
226
+            $extendedSearch .= $this->cObj->substituteMarkerArray($this->cObj->getSubpart($this->template, '###EXT_SEARCH_ENTRY###'), $markerArray);
227 227
 
228
-		}
228
+        }
229 229
 
230
-		return $extendedSearch;
230
+        return $extendedSearch;
231 231
 
232
-	}
232
+    }
233 233
 
234
-	/**
235
-	 * Adds the facets menu to the search form
236
-	 *
237
-	 * @access	protected
238
-	 *
239
-	 * @return	string		HTML output of facets menu
240
-	 */
241
-	protected function addFacetsMenu() {
234
+    /**
235
+     * Adds the facets menu to the search form
236
+     *
237
+     * @access	protected
238
+     *
239
+     * @return	string		HTML output of facets menu
240
+     */
241
+    protected function addFacetsMenu() {
242 242
 
243
-		// Check for typoscript configuration to prevent fatal error.
244
-		if (empty($this->conf['facetsConf.'])) {
243
+        // Check for typoscript configuration to prevent fatal error.
244
+        if (empty($this->conf['facetsConf.'])) {
245 245
 
246
-			if (TYPO3_DLOG) {
246
+            if (TYPO3_DLOG) {
247 247
 
248
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addFacetsMenu()] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING);
248
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addFacetsMenu()] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING);
249 249
 
250
-			}
250
+            }
251 251
 
252
-			return '';
252
+            return '';
253 253
 
254
-		}
254
+        }
255 255
 
256
-		// Quit without doing anything if no facets are selected.
257
-		if (empty($this->conf['facets'])) {
256
+        // Quit without doing anything if no facets are selected.
257
+        if (empty($this->conf['facets'])) {
258 258
 
259
-			return '';
259
+            return '';
260 260
 
261
-		}
261
+        }
262 262
 
263
-		// Get facets from plugin configuration.
264
-		$facets = array ();
263
+        // Get facets from plugin configuration.
264
+        $facets = array ();
265 265
 
266
-		foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['facets'], TRUE) as $facet) {
266
+        foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['facets'], TRUE) as $facet) {
267 267
 
268
-			$facets[$facet.'_faceting'] = tx_dlf_helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']);
268
+            $facets[$facet.'_faceting'] = tx_dlf_helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']);
269 269
 
270
-		}
270
+        }
271 271
 
272
-		// Render facets menu.
273
-		$TSconfig = array ();
272
+        // Render facets menu.
273
+        $TSconfig = array ();
274 274
 
275
-		$TSconfig['special'] = 'userfunction';
275
+        $TSconfig['special'] = 'userfunction';
276 276
 
277
-		$TSconfig['special.']['userFunc'] = 'tx_dlf_search->makeFacetsMenuArray';
277
+        $TSconfig['special.']['userFunc'] = 'tx_dlf_search->makeFacetsMenuArray';
278 278
 
279
-		$TSconfig['special.']['facets'] = $facets;
279
+        $TSconfig['special.']['facets'] = $facets;
280 280
 
281
-		$TSconfig['special.']['limit'] = max(intval($this->conf['limitFacets']), 1);
281
+        $TSconfig['special.']['limit'] = max(intval($this->conf['limitFacets']), 1);
282 282
 
283
-		$TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['facetsConf.'], $TSconfig);
283
+        $TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['facetsConf.'], $TSconfig);
284 284
 
285
-		return $this->cObj->HMENU($TSconfig);
285
+        return $this->cObj->HMENU($TSconfig);
286 286
 
287
-	}
287
+    }
288 288
 
289
-	/**
290
-	 * Adds the fulltext switch to the search form
291
-	 *
292
-	 * @access	protected
293
-	 *
294
-	 * @param int $isFulltextSearch
295
-	 *
296
-	 * @return	string		HTML output of fulltext switch
297
-	 */
298
-	protected function addFulltextSwitch($isFulltextSearch = 0) {
289
+    /**
290
+     * Adds the fulltext switch to the search form
291
+     *
292
+     * @access	protected
293
+     *
294
+     * @param int $isFulltextSearch
295
+     *
296
+     * @return	string		HTML output of fulltext switch
297
+     */
298
+    protected function addFulltextSwitch($isFulltextSearch = 0) {
299 299
 
300
-		$output = '';
300
+        $output = '';
301 301
 
302
-		// Check for plugin configuration.
303
-		if (!empty($this->conf['fulltext'])) {
302
+        // Check for plugin configuration.
303
+        if (!empty($this->conf['fulltext'])) {
304 304
 
305
-			$output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-no" type="radio" name="' . $this->prefixId . '[fulltext]" value="0" ' . ($isFulltextSearch == 0 ? 'checked="checked"' : '') .' />';
305
+            $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-no" type="radio" name="' . $this->prefixId . '[fulltext]" value="0" ' . ($isFulltextSearch == 0 ? 'checked="checked"' : '') .' />';
306 306
 
307
-			$output .= ' <label for="tx-dlf-search-fulltext-no">' . $this->pi_getLL('label.inMetadata', '') . '</label>';
307
+            $output .= ' <label for="tx-dlf-search-fulltext-no">' . $this->pi_getLL('label.inMetadata', '') . '</label>';
308 308
 
309
-			$output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-yes" type="radio" name="' . $this->prefixId . '[fulltext]" value="1" ' . ($isFulltextSearch == 1 ? 'checked="checked"' : '') .'/>';
309
+            $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-yes" type="radio" name="' . $this->prefixId . '[fulltext]" value="1" ' . ($isFulltextSearch == 1 ? 'checked="checked"' : '') .'/>';
310 310
 
311
-			$output .= ' <label for="tx-dlf-search-fulltext-yes">' . $this->pi_getLL('label.inFulltext', '') . '</label>';
311
+            $output .= ' <label for="tx-dlf-search-fulltext-yes">' . $this->pi_getLL('label.inFulltext', '') . '</label>';
312 312
 
313
-		}
313
+        }
314 314
 
315
-		return $output;
315
+        return $output;
316 316
 
317
-	}
317
+    }
318 318
 
319
-	/**
320
-	 * Adds the logical page field to the search form
321
-	 *
322
-	 * @access	protected
323
-	 *
324
-	 * @return	string		HTML output of logical page field
325
-	 */
326
-	protected function addLogicalPage() {
319
+    /**
320
+     * Adds the logical page field to the search form
321
+     *
322
+     * @access	protected
323
+     *
324
+     * @return	string		HTML output of logical page field
325
+     */
326
+    protected function addLogicalPage() {
327 327
 		
328
-		$output = '';
328
+        $output = '';
329 329
 
330
-		// Check for plugin configuration.
331
-		if (!empty($this->conf['showLogicalPageField'])) {
330
+        // Check for plugin configuration.
331
+        if (!empty($this->conf['showLogicalPageField'])) {
332 332
 			
333
-			$output .= ' <label for="tx-dlf-search-logical-page">' . $this->pi_getLL('label.logicalPage', '') . ': </label>';
333
+            $output .= ' <label for="tx-dlf-search-logical-page">' . $this->pi_getLL('label.logicalPage', '') . ': </label>';
334 334
 			
335
-			$output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="' . $this->prefixId . '[logicalPage]" />';
335
+            $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="' . $this->prefixId . '[logicalPage]" />';
336 336
 			
337
-		}
337
+        }
338 338
 
339
-		return $output;
339
+        return $output;
340 340
 		
341
-	}
341
+    }
342 342
 
343
-	/**
344
-	 * Creates an array for a HMENU entry of a facet value.
345
-	 *
346
-	 * @param	string		$field: The facet's index_name
347
-	 * @param	string		$value: The facet's value
348
-	 * @param	integer		$count: Number of hits for this facet
349
-	 * @param	array		$search: The parameters of the current search query
350
-	 * @param	string		&$state: The state of the parent item
351
-	 *
352
-	 * @return	array		The array for the facet's menu entry
353
-	 */
354
-	protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) {
343
+    /**
344
+     * Creates an array for a HMENU entry of a facet value.
345
+     *
346
+     * @param	string		$field: The facet's index_name
347
+     * @param	string		$value: The facet's value
348
+     * @param	integer		$count: Number of hits for this facet
349
+     * @param	array		$search: The parameters of the current search query
350
+     * @param	string		&$state: The state of the parent item
351
+     *
352
+     * @return	array		The array for the facet's menu entry
353
+     */
354
+    protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) {
355 355
 
356
-		$entryArray = array();
356
+        $entryArray = array();
357 357
 
358
-		// Translate value.
359
-		if ($field == 'owner_faceting') {
358
+        // Translate value.
359
+        if ($field == 'owner_faceting') {
360 360
 
361
-			// Translate name of holding library.
362
-			$entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages']));
361
+            // Translate name of holding library.
362
+            $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages']));
363 363
 
364
-		} elseif ($field == 'type_faceting') {
364
+        } elseif ($field == 'type_faceting') {
365 365
 
366
-			// Translate document type.
367
-			$entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages']));
366
+            // Translate document type.
367
+            $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages']));
368 368
 
369
-		} elseif ($field == 'collection_faceting') {
369
+        } elseif ($field == 'collection_faceting') {
370 370
 
371
-			// Translate name of collection.
372
-			$entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages']));
371
+            // Translate name of collection.
372
+            $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages']));
373 373
 
374
-		} elseif ($field == 'language_faceting') {
374
+        } elseif ($field == 'language_faceting') {
375 375
 
376
-			// Translate ISO 639 language code.
377
-			$entryArray['title'] = htmlspecialchars(tx_dlf_helper::getLanguageName($value));
376
+            // Translate ISO 639 language code.
377
+            $entryArray['title'] = htmlspecialchars(tx_dlf_helper::getLanguageName($value));
378 378
 
379
-		} else {
379
+        } else {
380 380
 
381
-			$entryArray['title'] = htmlspecialchars($value);
381
+            $entryArray['title'] = htmlspecialchars($value);
382 382
 
383
-		}
383
+        }
384 384
 
385
-		$entryArray['count'] = $count;
385
+        $entryArray['count'] = $count;
386 386
 
387
-		$entryArray['doNotLinkIt'] = 0;
387
+        $entryArray['doNotLinkIt'] = 0;
388 388
 
389
-		// Check if facet is already selected.
390
-		$index = array_search($field.':("'.tx_dlf_solr::escapeQuery($value).'")', $search['params']['fq']);
389
+        // Check if facet is already selected.
390
+        $index = array_search($field.':("'.tx_dlf_solr::escapeQuery($value).'")', $search['params']['fq']);
391 391
 
392
-		if ($index !== FALSE) {
392
+        if ($index !== FALSE) {
393 393
 
394
-			// Facet is selected, thus remove it from filter.
395
-			unset($search['params']['fq'][$index]);
394
+            // Facet is selected, thus remove it from filter.
395
+            unset($search['params']['fq'][$index]);
396 396
 
397
-			$search['params']['fq'] = array_values($search['params']['fq']);
397
+            $search['params']['fq'] = array_values($search['params']['fq']);
398 398
 
399
-			$entryArray['ITEM_STATE'] = 'CUR';
399
+            $entryArray['ITEM_STATE'] = 'CUR';
400 400
 
401
-			$state = 'ACTIFSUB';
401
+            $state = 'ACTIFSUB';
402 402
 
403
-			//Reset facets
404
-			if ($this->conf['resetFacets']) {
405
-				//remove ($count) for selected facet in template
406
-				$entryArray['count'] = FALSE;
407
-				//build link to delete selected facet
408
-				$entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq']));
409
-				$entryArray['title'] = sprintf($this->pi_getLL('resetFacet', ''), $entryArray['title']);
410
-			}
403
+            //Reset facets
404
+            if ($this->conf['resetFacets']) {
405
+                //remove ($count) for selected facet in template
406
+                $entryArray['count'] = FALSE;
407
+                //build link to delete selected facet
408
+                $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq']));
409
+                $entryArray['title'] = sprintf($this->pi_getLL('resetFacet', ''), $entryArray['title']);
410
+            }
411 411
 
412
-		} else {
412
+        } else {
413 413
 
414
-			// Facet is not selected, thus add it to filter.
415
-			$search['params']['fq'][] = $field.':("'.tx_dlf_solr::escapeQuery($value).'")';
414
+            // Facet is not selected, thus add it to filter.
415
+            $search['params']['fq'][] = $field.':("'.tx_dlf_solr::escapeQuery($value).'")';
416 416
 
417
-			$entryArray['ITEM_STATE'] = 'NO';
417
+            $entryArray['ITEM_STATE'] = 'NO';
418 418
 
419
-		}
419
+        }
420 420
 
421
-		$entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq']));
421
+        $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq']));
422 422
 
423
-		return $entryArray;
423
+        return $entryArray;
424 424
 
425
-	}
425
+    }
426 426
 
427
-	/**
428
-	 * The main method of the PlugIn
429
-	 *
430
-	 * @access	public
431
-	 *
432
-	 * @param	string		$content: The PlugIn content
433
-	 * @param	array		$conf: The PlugIn configuration
434
-	 *
435
-	 * @return	string		The content that is displayed on the website
436
-	 */
437
-	public function main($content, $conf) {
427
+    /**
428
+     * The main method of the PlugIn
429
+     *
430
+     * @access	public
431
+     *
432
+     * @param	string		$content: The PlugIn content
433
+     * @param	array		$conf: The PlugIn configuration
434
+     *
435
+     * @return	string		The content that is displayed on the website
436
+     */
437
+    public function main($content, $conf) {
438 438
 
439
-		$this->init($conf);
439
+        $this->init($conf);
440 440
 
441
-		// Disable caching for this plugin.
442
-		$this->setCache(FALSE);
441
+        // Disable caching for this plugin.
442
+        $this->setCache(FALSE);
443 443
 
444
-		// Quit without doing anything if required variables are not set.
445
-		if (empty($this->conf['solrcore'])) {
444
+        // Quit without doing anything if required variables are not set.
445
+        if (empty($this->conf['solrcore'])) {
446 446
 
447
-			if (TYPO3_DLOG) {
447
+            if (TYPO3_DLOG) {
448 448
 
449
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
449
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
450 450
 
451
-			}
451
+            }
452 452
 
453
-			return $content;
453
+            return $content;
454 454
 
455
-		}
455
+        }
456 456
 
457
-		if (!isset($this->piVars['query']) && empty($this->piVars['extQuery'])) {
457
+        if (!isset($this->piVars['query']) && empty($this->piVars['extQuery'])) {
458 458
 
459
-			// Extract query and filter from last search.
460
-			$list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
459
+            // Extract query and filter from last search.
460
+            $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
461 461
 
462
-			if (!empty($list->metadata['searchString'])) {
462
+            if (!empty($list->metadata['searchString'])) {
463 463
 
464
-				if ($list->metadata['options']['source'] == 'search') {
464
+                if ($list->metadata['options']['source'] == 'search') {
465 465
 
466
-					$search['query'] = $list->metadata['searchString'];
466
+                    $search['query'] = $list->metadata['searchString'];
467 467
 
468
-				}
468
+                }
469 469
 
470
-				$search['params'] = $list->metadata['options']['params'];
470
+                $search['params'] = $list->metadata['options']['params'];
471 471
 
472
-			}
472
+            }
473 473
 
474
-			// Add javascript for search suggestions if enabled and jQuery autocompletion is available.
475
-			if (!empty($this->conf['suggest'])) {
474
+            // Add javascript for search suggestions if enabled and jQuery autocompletion is available.
475
+            if (!empty($this->conf['suggest'])) {
476 476
 
477
-				$this->addAutocompleteJS();
477
+                $this->addAutocompleteJS();
478 478
 
479
-			}
479
+            }
480 480
 
481
-			// Load template file.
482
-			if (!empty($this->conf['templateFile'])) {
481
+            // Load template file.
482
+            if (!empty($this->conf['templateFile'])) {
483 483
 
484
-				$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
484
+                $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
485 485
 
486
-			} else {
486
+            } else {
487 487
 
488
-				$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/search/template.tmpl'), '###TEMPLATE###');
488
+                $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/search/template.tmpl'), '###TEMPLATE###');
489 489
 
490
-			}
490
+            }
491 491
 
492
-			// Configure @action URL for form.
493
-			$linkConf = array (
494
-				'parameter' => $GLOBALS['TSFE']->id,
495
-				'forceAbsoluteUrl' => 1
496
-			);
492
+            // Configure @action URL for form.
493
+            $linkConf = array (
494
+                'parameter' => $GLOBALS['TSFE']->id,
495
+                'forceAbsoluteUrl' => 1
496
+            );
497 497
 
498
-			// Fill markers.
499
-			$markerArray = array (
500
-				'###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf),
501
-				'###LABEL_QUERY###' => (!empty($search['query']) ? $search['query'] : $this->pi_getLL('label.query')),
502
-				'###LABEL_SUBMIT###' => $this->pi_getLL('label.submit'),
503
-				'###FIELD_QUERY###' => $this->prefixId.'[query]',
504
-				'###QUERY###' => (!empty($search['query']) ? $search['query'] : ''),
505
-				'###FULLTEXTSWITCH###' => $this->addFulltextSwitch($list->metadata['fulltextSearch']),
506
-				'###FIELD_DOC###' => ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all' ? $this->addCurrentDocument() : ''),
507
-				'###FIELD_COLL###' => ($this->conf['searchIn'] == 'collection' || $this->conf['searchIn'] == 'all' ? $this->addCurrentCollection() : ''),
508
-				'###ADDITIONAL_INPUTS###' => $this->addEncryptedCoreName(),
509
-				'###FACETS_MENU###' => $this->addFacetsMenu(),
510
-				'###LOGICAL_PAGE###' => $this->addLogicalPage()
511
-			);
498
+            // Fill markers.
499
+            $markerArray = array (
500
+                '###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf),
501
+                '###LABEL_QUERY###' => (!empty($search['query']) ? $search['query'] : $this->pi_getLL('label.query')),
502
+                '###LABEL_SUBMIT###' => $this->pi_getLL('label.submit'),
503
+                '###FIELD_QUERY###' => $this->prefixId.'[query]',
504
+                '###QUERY###' => (!empty($search['query']) ? $search['query'] : ''),
505
+                '###FULLTEXTSWITCH###' => $this->addFulltextSwitch($list->metadata['fulltextSearch']),
506
+                '###FIELD_DOC###' => ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all' ? $this->addCurrentDocument() : ''),
507
+                '###FIELD_COLL###' => ($this->conf['searchIn'] == 'collection' || $this->conf['searchIn'] == 'all' ? $this->addCurrentCollection() : ''),
508
+                '###ADDITIONAL_INPUTS###' => $this->addEncryptedCoreName(),
509
+                '###FACETS_MENU###' => $this->addFacetsMenu(),
510
+                '###LOGICAL_PAGE###' => $this->addLogicalPage()
511
+            );
512 512
 
513
-			// Get additional fields for extended search.
514
-			$extendedSearch = $this->addExtendedSearch();
513
+            // Get additional fields for extended search.
514
+            $extendedSearch = $this->addExtendedSearch();
515 515
 
516
-			// Display search form.
517
-			$content .= $this->cObj->substituteSubpart($this->cObj->substituteMarkerArray($this->template, $markerArray), '###EXT_SEARCH_ENTRY###', $extendedSearch);
516
+            // Display search form.
517
+            $content .= $this->cObj->substituteSubpart($this->cObj->substituteMarkerArray($this->template, $markerArray), '###EXT_SEARCH_ENTRY###', $extendedSearch);
518 518
 
519
-			return $this->pi_wrapInBaseClass($content);
519
+            return $this->pi_wrapInBaseClass($content);
520 520
 
521
-		} else {
521
+        } else {
522 522
 
523
-			// Instantiate search object.
524
-			$solr = tx_dlf_solr::getInstance($this->conf['solrcore']);
523
+            // Instantiate search object.
524
+            $solr = tx_dlf_solr::getInstance($this->conf['solrcore']);
525 525
 
526
-			if (!$solr->ready) {
526
+            if (!$solr->ready) {
527 527
 
528
-				if (TYPO3_DLOG) {
528
+                if (TYPO3_DLOG) {
529 529
 
530
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
530
+                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
531 531
 
532
-				}
532
+                }
533 533
 
534
-				return $content;
534
+                return $content;
535 535
 
536
-			}
536
+            }
537 537
 
538
-			// Build label for result list.
539
-			$label = $this->pi_getLL('search', '', TRUE);
538
+            // Build label for result list.
539
+            $label = $this->pi_getLL('search', '', TRUE);
540 540
 
541
-			if (!empty($this->piVars['query'])) {
541
+            if (!empty($this->piVars['query'])) {
542 542
 
543
-				$label .= htmlspecialchars(sprintf($this->pi_getLL('for', ''), $this->piVars['query']));
543
+                $label .= htmlspecialchars(sprintf($this->pi_getLL('for', ''), $this->piVars['query']));
544 544
 
545
-			}
545
+            }
546 546
 
547
-			// Prepare query parameters.
548
-			$params = array ();
547
+            // Prepare query parameters.
548
+            $params = array ();
549 549
 
550
-			$matches = array ();
550
+            $matches = array ();
551 551
 
552
-			// Set search query.
553
-			if ((!empty($this->conf['fulltext']) && !empty($this->piVars['fulltext'])) || preg_match('/fulltext:\((.*)\)/', $this->piVars['query'], $matches)) {
552
+            // Set search query.
553
+            if ((!empty($this->conf['fulltext']) && !empty($this->piVars['fulltext'])) || preg_match('/fulltext:\((.*)\)/', $this->piVars['query'], $matches)) {
554 554
 
555
-				// If the query already is a fulltext query e.g using the facets
556
-				$this->piVars['query'] = empty($matches[1])?$this->piVars['query']:$matches[1];
555
+                // If the query already is a fulltext query e.g using the facets
556
+                $this->piVars['query'] = empty($matches[1])?$this->piVars['query']:$matches[1];
557 557
 
558
-				// Search in fulltext field if applicable. query must not be empty!
559
-				if (!empty($this->piVars['query'])) {
558
+                // Search in fulltext field if applicable. query must not be empty!
559
+                if (!empty($this->piVars['query'])) {
560 560
 
561
-					$query = 'fulltext:('.tx_dlf_solr::escapeQuery($this->piVars['query']).')';
561
+                    $query = 'fulltext:('.tx_dlf_solr::escapeQuery($this->piVars['query']).')';
562 562
 
563
-				}
563
+                }
564 564
 
565
-				// Add highlighting for fulltext.
566
-				$params['hl'] = 'true';
565
+                // Add highlighting for fulltext.
566
+                $params['hl'] = 'true';
567 567
 
568
-				$params['hl.fl'] = 'fulltext';
568
+                $params['hl.fl'] = 'fulltext';
569 569
 
570
-			} else {
571
-				// Retain given search field if valid.
572
-				$query = tx_dlf_solr::escapeQueryKeepField($this->piVars['query'], $this->conf['pages']);
570
+            } else {
571
+                // Retain given search field if valid.
572
+                $query = tx_dlf_solr::escapeQueryKeepField($this->piVars['query'], $this->conf['pages']);
573 573
 
574
-			}
574
+            }
575 575
 
576
-			// Add extended search query.
577
-			if (!empty($this->piVars['extQuery']) && is_array($this->piVars['extQuery'])) {
576
+            // Add extended search query.
577
+            if (!empty($this->piVars['extQuery']) && is_array($this->piVars['extQuery'])) {
578 578
 
579
-				$allowedOperators = array('AND', 'OR', 'NOT');
579
+                $allowedOperators = array('AND', 'OR', 'NOT');
580 580
 
581
-				$allowedFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE);
581
+                $allowedFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE);
582 582
 
583
-				for ($i = 0; $i < count($this->piVars['extQuery']); $i++) {
583
+                for ($i = 0; $i < count($this->piVars['extQuery']); $i++) {
584 584
 
585
-					if (!empty($this->piVars['extQuery'][$i])) {
585
+                    if (!empty($this->piVars['extQuery'][$i])) {
586 586
 
587
-						if (in_array($this->piVars['extOperator'][$i], $allowedOperators) && in_array($this->piVars['extField'][$i], $allowedFields)) {
587
+                        if (in_array($this->piVars['extOperator'][$i], $allowedOperators) && in_array($this->piVars['extField'][$i], $allowedFields)) {
588 588
 
589
-							if (!empty($query)) {
589
+                            if (!empty($query)) {
590 590
 
591
-								$query .= ' '.$this->piVars['extOperator'][$i].' ';
591
+                                $query .= ' '.$this->piVars['extOperator'][$i].' ';
592 592
 
593
-							}
593
+                            }
594 594
 
595
-							$query .= tx_dlf_indexing::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']).':('.tx_dlf_solr::escapeQuery($this->piVars['extQuery'][$i]).')';
595
+                            $query .= tx_dlf_indexing::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']).':('.tx_dlf_solr::escapeQuery($this->piVars['extQuery'][$i]).')';
596 596
 
597
-						}
597
+                        }
598 598
 
599
-					}
599
+                    }
600 600
 
601
-				}
601
+                }
602 602
 
603
-			}
603
+            }
604 604
 
605
-			// Add filter query for faceting.
606
-			if (!empty($this->piVars['fq'])) {
605
+            // Add filter query for faceting.
606
+            if (!empty($this->piVars['fq'])) {
607 607
 
608
-				$params['fq'] = $this->piVars['fq'];
608
+                $params['fq'] = $this->piVars['fq'];
609 609
 
610
-			}
610
+            }
611 611
 
612
-			// Add filter query for in-document searching.
613
-			if ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all') {
612
+            // Add filter query for in-document searching.
613
+            if ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all') {
614 614
 
615
-				if (!empty($this->piVars['id']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])) {
615
+                if (!empty($this->piVars['id']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])) {
616 616
 
617
-					$params['fq'][] = 'uid:('.$this->piVars['id'].') OR partof:('.$this->piVars['id'].')';
617
+                    $params['fq'][] = 'uid:('.$this->piVars['id'].') OR partof:('.$this->piVars['id'].')';
618 618
 
619
-					$label .= htmlspecialchars(sprintf($this->pi_getLL('in', ''), tx_dlf_document::getTitle($this->piVars['id'])));
619
+                    $label .= htmlspecialchars(sprintf($this->pi_getLL('in', ''), tx_dlf_document::getTitle($this->piVars['id'])));
620 620
 
621
-				}
621
+                }
622 622
 
623
-			}
623
+            }
624 624
 
625
-			// Add filter query for in-collection searching.
626
-			if ($this->conf['searchIn'] == 'collection' || $this->conf['searchIn'] == 'all') {
625
+            // Add filter query for in-collection searching.
626
+            if ($this->conf['searchIn'] == 'collection' || $this->conf['searchIn'] == 'all') {
627 627
 
628
-				if (!empty($this->piVars['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['collection'])) {
628
+                if (!empty($this->piVars['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['collection'])) {
629 629
 
630
-					$index_name = tx_dlf_helper::getIndexName($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']);
630
+                    $index_name = tx_dlf_helper::getIndexName($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']);
631 631
 
632
-					$params['fq'][] = 'collection_faceting:("'.tx_dlf_solr::escapeQuery($index_name).'")';
632
+                    $params['fq'][] = 'collection_faceting:("'.tx_dlf_solr::escapeQuery($index_name).'")';
633 633
 
634
-					$label .= sprintf($this->pi_getLL('in', '', TRUE), tx_dlf_helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages']));
634
+                    $label .= sprintf($this->pi_getLL('in', '', TRUE), tx_dlf_helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages']));
635 635
 
636
-				}
636
+                }
637 637
 
638
-			}
638
+            }
639 639
 
640
-			// Add filter query for collection restrictions.
641
-			if ($this->conf['collections']) {
640
+            // Add filter query for collection restrictions.
641
+            if ($this->conf['collections']) {
642 642
 
643
-				$collIds = explode(',', $this->conf['collections']);
643
+                $collIds = explode(',', $this->conf['collections']);
644 644
 
645
-				$collIndexNames = array ();
645
+                $collIndexNames = array ();
646 646
 
647
-				foreach ($collIds as $collId) {
647
+                foreach ($collIds as $collId) {
648 648
 
649
-					$collIndexNames[] = tx_dlf_solr::escapeQuery(tx_dlf_helper::getIndexName(intval($collId), 'tx_dlf_collections', $this->conf['pages']));
649
+                    $collIndexNames[] = tx_dlf_solr::escapeQuery(tx_dlf_helper::getIndexName(intval($collId), 'tx_dlf_collections', $this->conf['pages']));
650 650
 
651
-				}
651
+                }
652 652
 
653
-				// Last value is fake and used for distinction in $this->addCurrentCollection()
654
-				$params['fq'][] = 'collection_faceting:("'.implode('" OR "', $collIndexNames).'" OR "FakeValueForDistinction")';
653
+                // Last value is fake and used for distinction in $this->addCurrentCollection()
654
+                $params['fq'][] = 'collection_faceting:("'.implode('" OR "', $collIndexNames).'" OR "FakeValueForDistinction")';
655 655
 
656
-			}
656
+            }
657 657
 
658
-			// Set search parameters.
659
-			$solr->limit = max(intval($this->conf['limit']), 1);
658
+            // Set search parameters.
659
+            $solr->limit = max(intval($this->conf['limit']), 1);
660 660
 
661
-			$solr->cPid = $this->conf['pages'];
661
+            $solr->cPid = $this->conf['pages'];
662 662
 
663
-			$solr->params = $params;
663
+            $solr->params = $params;
664 664
 
665
-			// Perform search.
666
-			$results = $solr->search($query);
665
+            // Perform search.
666
+            $results = $solr->search($query);
667 667
 
668
-			$results->metadata = array (
669
-				'label' => $label,
670
-				'description' => '<p class="tx-dlf-search-numHits">'.htmlspecialchars(sprintf($this->pi_getLL('hits', ''), $solr->numberOfHits, count($results))).'</p>',
671
-				'thumbnail' => '',
672
-				'searchString' => $this->piVars['query'],
673
-				'fulltextSearch' => (!empty($this->piVars['fulltext']) ? '1' : '0'),
674
-				'options' => $results->metadata['options']
675
-			);
668
+            $results->metadata = array (
669
+                'label' => $label,
670
+                'description' => '<p class="tx-dlf-search-numHits">'.htmlspecialchars(sprintf($this->pi_getLL('hits', ''), $solr->numberOfHits, count($results))).'</p>',
671
+                'thumbnail' => '',
672
+                'searchString' => $this->piVars['query'],
673
+                'fulltextSearch' => (!empty($this->piVars['fulltext']) ? '1' : '0'),
674
+                'options' => $results->metadata['options']
675
+            );
676 676
 
677
-			$results->save();
677
+            $results->save();
678 678
 
679
-			// Clean output buffer.
680
-			\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
679
+            // Clean output buffer.
680
+            \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
681 681
 
682
-			$additionalParams = array();
682
+            $additionalParams = array();
683 683
 
684
-			if(!empty($this->piVars['logicalPage'])) {
684
+            if(!empty($this->piVars['logicalPage'])) {
685 685
 
686
-				$additionalParams['logicalPage'] = $this->piVars['logicalPage'];
686
+                $additionalParams['logicalPage'] = $this->piVars['logicalPage'];
687 687
 
688
-			}
688
+            }
689 689
 
690
-			// Jump directly to the page view, if there is only one result and it is configured
691
-			if($results->count() == 1 && !empty($this->conf['showSingleResult'])) {
690
+            // Jump directly to the page view, if there is only one result and it is configured
691
+            if($results->count() == 1 && !empty($this->conf['showSingleResult'])) {
692 692
 
693
-				$linkConf['parameter'] = $this->conf['targetPidPageView'];
693
+                $linkConf['parameter'] = $this->conf['targetPidPageView'];
694 694
 
695
-				$additionalParams['id'] = $results->current()['uid'];
696
-				$additionalParams['highlight_word'] = preg_replace('/\s\s+/', ';', $results->metadata['searchString']);
697
-				$additionalParams['page'] = count($results[0]['subparts']) == 1?$results[0]['subparts'][0]['page']:1;
695
+                $additionalParams['id'] = $results->current()['uid'];
696
+                $additionalParams['highlight_word'] = preg_replace('/\s\s+/', ';', $results->metadata['searchString']);
697
+                $additionalParams['page'] = count($results[0]['subparts']) == 1?$results[0]['subparts'][0]['page']:1;
698 698
 
699
-			} else {
699
+            } else {
700 700
 
701
-				// Keep some plugin variables.
702
-				$linkConf['parameter'] = $this->conf['targetPid'];
701
+                // Keep some plugin variables.
702
+                $linkConf['parameter'] = $this->conf['targetPid'];
703 703
 
704
-				if (!empty($this->piVars['order'])) {
704
+                if (!empty($this->piVars['order'])) {
705 705
 
706
-					$additionalParams['order'] = $this->piVars['order'];
707
-					$additionalParams['asc'] = !empty($this->piVars['asc']) ? '1' : '0';
706
+                    $additionalParams['order'] = $this->piVars['order'];
707
+                    $additionalParams['asc'] = !empty($this->piVars['asc']) ? '1' : '0';
708 708
 
709
-				}
709
+                }
710 710
 
711
-			}
711
+            }
712 712
 
713
-			$linkConf['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE);
713
+            $linkConf['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE);
714 714
 
715
-			// Send headers.
716
-			header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf)));
715
+            // Send headers.
716
+            header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf)));
717 717
 
718
-			// Flush output buffer and end script processing.
719
-			ob_end_flush();
718
+            // Flush output buffer and end script processing.
719
+            ob_end_flush();
720 720
 
721
-			exit;
721
+            exit;
722 722
 
723
-		}
723
+        }
724 724
 
725
-	}
725
+    }
726 726
 
727
-	/**
728
-	 * This builds a menu array for HMENU
729
-	 *
730
-	 * @access	public
731
-	 *
732
-	 * @param	string		$content: The PlugIn content
733
-	 * @param	array		$conf: The PlugIn configuration
734
-	 *
735
-	 * @return	array		HMENU array
736
-	 */
737
-	public function makeFacetsMenuArray($content, $conf) {
727
+    /**
728
+     * This builds a menu array for HMENU
729
+     *
730
+     * @access	public
731
+     *
732
+     * @param	string		$content: The PlugIn content
733
+     * @param	array		$conf: The PlugIn configuration
734
+     *
735
+     * @return	array		HMENU array
736
+     */
737
+    public function makeFacetsMenuArray($content, $conf) {
738 738
 
739
-		$this->init($conf);
739
+        $this->init($conf);
740 740
 
741
-		$menuArray = array ();
741
+        $menuArray = array ();
742 742
 
743
-		// Set default value for facet search.
744
-		$search = array (
745
-			'query' => '*',
746
-			'params' => array ()
747
-		);
743
+        // Set default value for facet search.
744
+        $search = array (
745
+            'query' => '*',
746
+            'params' => array ()
747
+        );
748 748
 
749
-		// Extract query and filter from last search.
750
-		$list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
749
+        // Extract query and filter from last search.
750
+        $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
751 751
 
752
-		if (!empty($list->metadata['options']['source'])) {
752
+        if (!empty($list->metadata['options']['source'])) {
753 753
 
754
-			if ($list->metadata['options']['source'] == 'search') {
754
+            if ($list->metadata['options']['source'] == 'search') {
755 755
 
756
-				$search['query'] = $list->metadata['options']['select'];
756
+                $search['query'] = $list->metadata['options']['select'];
757 757
 
758
-			}
758
+            }
759 759
 
760
-			$search['params'] = $list->metadata['options']['params'];
760
+            $search['params'] = $list->metadata['options']['params'];
761 761
 
762
-		}
762
+        }
763 763
 
764
-		// Get applicable facets.
765
-		$solr = tx_dlf_solr::getInstance($this->conf['solrcore']);
764
+        // Get applicable facets.
765
+        $solr = tx_dlf_solr::getInstance($this->conf['solrcore']);
766 766
 
767
-		if (!$solr->ready) {
767
+        if (!$solr->ready) {
768 768
 
769
-			if (TYPO3_DLOG) {
769
+            if (TYPO3_DLOG) {
770 770
 
771
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->makeFacetsMenuArray('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
771
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->makeFacetsMenuArray('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
772 772
 
773
-			}
773
+            }
774 774
 
775
-			return array ();
775
+            return array ();
776 776
 
777
-		}
777
+        }
778 778
 
779
-		// Set needed parameters for facet search.
780
-		if (empty($search['params']['fq'])) {
779
+        // Set needed parameters for facet search.
780
+        if (empty($search['params']['fq'])) {
781 781
 
782
-			$search['params']['fq'] = array ();
782
+            $search['params']['fq'] = array ();
783 783
 
784
-		}
784
+        }
785 785
 
786
-		$search['params']['facet'] = 'true';
786
+        $search['params']['facet'] = 'true';
787 787
 
788
-		$search['params']['facet.field'] = array_keys($this->conf['facets']);
788
+        $search['params']['facet.field'] = array_keys($this->conf['facets']);
789 789
 
790
-		//override SOLR default value for facet.limit of 100
791
-		$search['params']['facet.limit'] = $this->conf['limitFacets'];
790
+        //override SOLR default value for facet.limit of 100
791
+        $search['params']['facet.limit'] = $this->conf['limitFacets'];
792 792
 
793
-		// Perform search.
794
-		$results = $solr->service->search($search['query'], 0, $this->conf['limit'], $search['params']);
793
+        // Perform search.
794
+        $results = $solr->service->search($search['query'], 0, $this->conf['limit'], $search['params']);
795 795
 
796
-		// Process results.
797
-		foreach ($results->facet_counts->facet_fields as $field => $values) {
796
+        // Process results.
797
+        foreach ($results->facet_counts->facet_fields as $field => $values) {
798 798
 
799
-			$entryArray = array ();
799
+            $entryArray = array ();
800 800
 
801
-			$entryArray['title'] = htmlspecialchars($this->conf['facets'][$field]);
801
+            $entryArray['title'] = htmlspecialchars($this->conf['facets'][$field]);
802 802
 
803
-			$entryArray['count'] = 0;
803
+            $entryArray['count'] = 0;
804 804
 
805
-			$entryArray['_OVERRIDE_HREF'] = '';
805
+            $entryArray['_OVERRIDE_HREF'] = '';
806 806
 
807
-			$entryArray['doNotLinkIt'] = 1;
807
+            $entryArray['doNotLinkIt'] = 1;
808 808
 
809
-			$entryArray['ITEM_STATE'] = 'NO';
809
+            $entryArray['ITEM_STATE'] = 'NO';
810 810
 
811
-			// Count number of facet values.
812
-			$i = 0;
811
+            // Count number of facet values.
812
+            $i = 0;
813 813
 
814
-			foreach ($values as $value => $count) {
814
+            foreach ($values as $value => $count) {
815 815
 
816
-				if ($count > 0) {
816
+                if ($count > 0) {
817 817
 
818
-					$hasValue = TRUE;
818
+                    $hasValue = TRUE;
819 819
 
820
-					$entryArray['count']++;
820
+                    $entryArray['count']++;
821 821
 
822
-					if ($entryArray['ITEM_STATE'] == 'NO') {
822
+                    if ($entryArray['ITEM_STATE'] == 'NO') {
823 823
 
824
-						$entryArray['ITEM_STATE'] = 'IFSUB';
824
+                        $entryArray['ITEM_STATE'] = 'IFSUB';
825 825
 
826
-					}
826
+                    }
827 827
 
828
-					$entryArray['_SUB_MENU'][] = $this->getFacetsMenuEntry($field, $value, $count, $search, $entryArray['ITEM_STATE']);
828
+                    $entryArray['_SUB_MENU'][] = $this->getFacetsMenuEntry($field, $value, $count, $search, $entryArray['ITEM_STATE']);
829 829
 
830
-					if (++$i == $this->conf['limit']) {
830
+                    if (++$i == $this->conf['limit']) {
831 831
 
832
-						break;
832
+                        break;
833 833
 
834
-					}
834
+                    }
835 835
 
836
-				} else {
836
+                } else {
837 837
 
838
-					break;
838
+                    break;
839 839
 
840
-				}
840
+                }
841 841
 
842
-			}
842
+            }
843 843
 
844
-			$menuArray[] = $entryArray;
844
+            $menuArray[] = $entryArray;
845 845
 
846
-		}
846
+        }
847 847
 
848
-		return $menuArray;
848
+        return $menuArray;
849 849
 
850 850
 
851
-	}
851
+    }
852 852
 
853 853
 }
Please login to merge, or discard this patch.
plugins/audioplayer/class.tx_dlf_audioplayer.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -19,35 +19,35 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_audioplayer extends tx_dlf_plugin {
21 21
 
22
-	public $scriptRelPath = 'plugins/audioplayer/class.tx_dlf_audioplayer.php';
22
+    public $scriptRelPath = 'plugins/audioplayer/class.tx_dlf_audioplayer.php';
23 23
 
24
-	/**
25
-	 * Holds the current audio file's URL, MIME type and optional label
26
-	 *
27
-	 * @var	array
28
-	 * @access protected
29
-	 */
30
-	protected $audio = array ();
24
+    /**
25
+     * Holds the current audio file's URL, MIME type and optional label
26
+     *
27
+     * @var	array
28
+     * @access protected
29
+     */
30
+    protected $audio = array ();
31 31
 
32
-	/**
33
-	 * Adds Player javascript
34
-	 *
35
-	 * @access	protected
36
-	 *
37
-	 * @return	string		Player script tags ready for output
38
-	 */
39
-	protected function addPlayerJS() {
32
+    /**
33
+     * Adds Player javascript
34
+     *
35
+     * @access	protected
36
+     *
37
+     * @return	string		Player script tags ready for output
38
+     */
39
+    protected function addPlayerJS() {
40 40
 
41
-		$output = array ();
41
+        $output = array ();
42 42
 
43
-		$output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/blue.monday/css/jplayer.blue.monday.min.css">';
43
+        $output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/blue.monday/css/jplayer.blue.monday.min.css">';
44 44
 
45
-		$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/jquery.jplayer.min.js"></script>';
45
+        $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/jquery.jplayer.min.js"></script>';
46 46
 
47
-		$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/audioplayer/js/tx_dlf_audioplayer.js"></script>';
47
+        $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/audioplayer/js/tx_dlf_audioplayer.js"></script>';
48 48
 
49
-		// Add player configuration.
50
-		$output[] = '
49
+        // Add player configuration.
50
+        $output[] = '
51 51
 		<style>
52 52
 			#tx-dlf-audio { width: 100px; height: 100px };
53 53
 		</style>
@@ -65,87 +65,87 @@  discard block
 block discarded – undo
65 65
 			});
66 66
 		</script>';
67 67
 
68
-		return implode("\n", $output);
68
+        return implode("\n", $output);
69 69
 
70
-	}
70
+    }
71 71
 
72
-	/**
73
-	 * The main method of the PlugIn
74
-	 *
75
-	 * @access	public
76
-	 *
77
-	 * @param	string		$content: The PlugIn content
78
-	 * @param	array		$conf: The PlugIn configuration
79
-	 *
80
-	 * @return	string		The content that is displayed on the website
81
-	 */
82
-	public function main($content, $conf) {
72
+    /**
73
+     * The main method of the PlugIn
74
+     *
75
+     * @access	public
76
+     *
77
+     * @param	string		$content: The PlugIn content
78
+     * @param	array		$conf: The PlugIn configuration
79
+     *
80
+     * @return	string		The content that is displayed on the website
81
+     */
82
+    public function main($content, $conf) {
83 83
 
84
-		$this->init($conf);
84
+        $this->init($conf);
85 85
 
86
-		// Load current document.
87
-		$this->loadDocument();
86
+        // Load current document.
87
+        $this->loadDocument();
88 88
 
89
-		if ($this->doc === NULL || $this->doc->numPages < 1) {
89
+        if ($this->doc === NULL || $this->doc->numPages < 1) {
90 90
 
91
-			// Quit without doing anything if required variables are not set.
92
-			return $content;
91
+            // Quit without doing anything if required variables are not set.
92
+            return $content;
93 93
 
94
-		} else {
94
+        } else {
95 95
 
96
-			// Set default values if not set.
97
-			// $this->piVars['page'] may be integer or string (physical structure @ID)
98
-			if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
96
+            // Set default values if not set.
97
+            // $this->piVars['page'] may be integer or string (physical structure @ID)
98
+            if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
99 99
 
100
-				$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
100
+                $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
101 101
 
102
-			} else {
102
+            } else {
103 103
 
104
-				$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
104
+                $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
105 105
 
106
-			}
106
+            }
107 107
 
108
-			$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
108
+            $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
109 109
 
110
-		}
110
+        }
111 111
 
112
-		// Check if there are any audio files available.
113
-		if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']])) {
112
+        // Check if there are any audio files available.
113
+        if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']])) {
114 114
 
115
-			// Get audio data.
116
-			$this->audio['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']]);
115
+            // Get audio data.
116
+            $this->audio['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']]);
117 117
 
118
-			$this->audio['label'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['label'];
118
+            $this->audio['label'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['label'];
119 119
 
120
-			$this->audio['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']]);
120
+            $this->audio['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']]);
121 121
 
122
-		} else {
122
+        } else {
123 123
 
124
-			// Quit without doing anything if required variables are not set.
125
-			return $content;
124
+            // Quit without doing anything if required variables are not set.
125
+            return $content;
126 126
 
127
-		}
127
+        }
128 128
 
129
-		// Load template file.
130
-		if (!empty($this->conf['templateFile'])) {
129
+        // Load template file.
130
+        if (!empty($this->conf['templateFile'])) {
131 131
 
132
-			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
132
+            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
133 133
 
134
-		} else {
134
+        } else {
135 135
 
136
-			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/audioplayer/template.tmpl'), '###TEMPLATE###');
136
+            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/audioplayer/template.tmpl'), '###TEMPLATE###');
137 137
 
138
-		}
138
+        }
139 139
 
140
-		// Fill in the template markers.
141
-		$markerArray = array (
142
-			'###PLAYER_JS###' => $this->addPlayerJS()
143
-		);
140
+        // Fill in the template markers.
141
+        $markerArray = array (
142
+            '###PLAYER_JS###' => $this->addPlayerJS()
143
+        );
144 144
 
145
-		$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
145
+        $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
146 146
 
147
-		return $this->pi_wrapInBaseClass($content);
147
+        return $this->pi_wrapInBaseClass($content);
148 148
 
149
-	}
149
+    }
150 150
 
151 151
 }
Please login to merge, or discard this patch.
plugins/statistics/class.tx_dlf_statistics.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -19,111 +19,111 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_statistics extends tx_dlf_plugin {
21 21
 
22
-	public $scriptRelPath = 'plugins/statistics/class.tx_dlf_statistics.php';
23
-
24
-	/**
25
-	 * The main method of the PlugIn
26
-	 *
27
-	 * @access	public
28
-	 *
29
-	 * @param	string		$content: The PlugIn content
30
-	 * @param	array		$conf: The PlugIn configuration
31
-	 *
32
-	 * @return	string		The content that is displayed on the website
33
-	 */
34
-	public function main($content, $conf) {
35
-
36
-		$this->init($conf);
37
-
38
-		// Turn cache on.
39
-		$this->setCache(TRUE);
40
-
41
-		// Quit without doing anything if required configuration variables are not set.
42
-		if (empty($this->conf['pages'])) {
43
-
44
-			if (TYPO3_DLOG) {
45
-
46
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_statistics->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
47
-
48
-			}
49
-
50
-			return $content;
51
-
52
-		}
53
-
54
-		// Get description.
55
-		$content .= $this->pi_RTEcssText($this->conf['description']);
56
-
57
-		// Check for selected collections.
58
-		if ($this->conf['collections']) {
59
-
60
-			// Include only selected collections.
61
-			$resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
62
-				'tx_dlf_documents.uid AS uid',
63
-				'tx_dlf_documents',
64
-				'tx_dlf_relations',
65
-				'tx_dlf_collections',
66
-				'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
67
-				'tx_dlf_documents.uid',
68
-				'',
69
-				''
70
-			);
71
-
72
-			$resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
73
-				'tx_dlf_documents.uid AS uid',
74
-				'tx_dlf_documents',
75
-				'tx_dlf_relations',
76
-				'tx_dlf_collections',
77
-				'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
78
-				'tx_dlf_documents.uid',
79
-				'',
80
-				''
81
-			);
82
-
83
-		} else {
84
-
85
-			// Include all collections.
86
-			$resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
87
-				'tx_dlf_documents.uid AS uid',
88
-				'tx_dlf_documents',
89
-				'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents'),
90
-				'',
91
-				'',
92
-				''
93
-			);
94
-
95
-			$resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
96
-				'tx_dlf_documents.uid AS uid',
97
-				'tx_dlf_documents',
98
-				'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').')'.tx_dlf_helper::whereClause('tx_dlf_documents'),
99
-				'',
100
-				'',
101
-				''
102
-			);
103
-
104
-		}
105
-
106
-		$countTitles = $GLOBALS['TYPO3_DB']->sql_num_rows($resultTitles);
107
-
108
-		$countVolumes = $GLOBALS['TYPO3_DB']->sql_num_rows($resultVolumes);
109
-
110
-		// Set replacements.
111
-		$replace = array (
112
-			'key' => array (
113
-				'###TITLES###',
114
-				'###VOLUMES###'
115
-			),
116
-			'value' => array (
117
-				$countTitles.($countTitles > 1 ? $this->pi_getLL('titles', '', TRUE) : $this->pi_getLL('title', '', TRUE)),
118
-				$countVolumes.($countVolumes > 1 ? $this->pi_getLL('volumes', '', TRUE) : $this->pi_getLL('volume', '', TRUE))
119
-			)
120
-		);
121
-
122
-		// Apply replacements.
123
-		$content = str_replace($replace['key'], $replace['value'], $content);
124
-
125
-		return $this->pi_wrapInBaseClass($content);
126
-
127
-	}
22
+    public $scriptRelPath = 'plugins/statistics/class.tx_dlf_statistics.php';
23
+
24
+    /**
25
+     * The main method of the PlugIn
26
+     *
27
+     * @access	public
28
+     *
29
+     * @param	string		$content: The PlugIn content
30
+     * @param	array		$conf: The PlugIn configuration
31
+     *
32
+     * @return	string		The content that is displayed on the website
33
+     */
34
+    public function main($content, $conf) {
35
+
36
+        $this->init($conf);
37
+
38
+        // Turn cache on.
39
+        $this->setCache(TRUE);
40
+
41
+        // Quit without doing anything if required configuration variables are not set.
42
+        if (empty($this->conf['pages'])) {
43
+
44
+            if (TYPO3_DLOG) {
45
+
46
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_statistics->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
47
+
48
+            }
49
+
50
+            return $content;
51
+
52
+        }
53
+
54
+        // Get description.
55
+        $content .= $this->pi_RTEcssText($this->conf['description']);
56
+
57
+        // Check for selected collections.
58
+        if ($this->conf['collections']) {
59
+
60
+            // Include only selected collections.
61
+            $resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
62
+                'tx_dlf_documents.uid AS uid',
63
+                'tx_dlf_documents',
64
+                'tx_dlf_relations',
65
+                'tx_dlf_collections',
66
+                'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
67
+                'tx_dlf_documents.uid',
68
+                '',
69
+                ''
70
+            );
71
+
72
+            $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
73
+                'tx_dlf_documents.uid AS uid',
74
+                'tx_dlf_documents',
75
+                'tx_dlf_relations',
76
+                'tx_dlf_collections',
77
+                'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
78
+                'tx_dlf_documents.uid',
79
+                '',
80
+                ''
81
+            );
82
+
83
+        } else {
84
+
85
+            // Include all collections.
86
+            $resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
87
+                'tx_dlf_documents.uid AS uid',
88
+                'tx_dlf_documents',
89
+                'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents'),
90
+                '',
91
+                '',
92
+                ''
93
+            );
94
+
95
+            $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
96
+                'tx_dlf_documents.uid AS uid',
97
+                'tx_dlf_documents',
98
+                'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').')'.tx_dlf_helper::whereClause('tx_dlf_documents'),
99
+                '',
100
+                '',
101
+                ''
102
+            );
103
+
104
+        }
105
+
106
+        $countTitles = $GLOBALS['TYPO3_DB']->sql_num_rows($resultTitles);
107
+
108
+        $countVolumes = $GLOBALS['TYPO3_DB']->sql_num_rows($resultVolumes);
109
+
110
+        // Set replacements.
111
+        $replace = array (
112
+            'key' => array (
113
+                '###TITLES###',
114
+                '###VOLUMES###'
115
+            ),
116
+            'value' => array (
117
+                $countTitles.($countTitles > 1 ? $this->pi_getLL('titles', '', TRUE) : $this->pi_getLL('title', '', TRUE)),
118
+                $countVolumes.($countVolumes > 1 ? $this->pi_getLL('volumes', '', TRUE) : $this->pi_getLL('volume', '', TRUE))
119
+            )
120
+        );
121
+
122
+        // Apply replacements.
123
+        $content = str_replace($replace['key'], $replace['value'], $content);
124
+
125
+        return $this->pi_wrapInBaseClass($content);
126
+
127
+    }
128 128
 
129 129
 }
Please login to merge, or discard this patch.
plugins/pageview/class.tx_dlf_geturl_eid.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -22,65 +22,65 @@
 block discarded – undo
22 22
  */
23 23
 class tx_dlf_geturl_eid extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
24 24
 
25
-	/**
26
-	 *
27
-	 */
28
-	public $cObj;
25
+    /**
26
+     *
27
+     */
28
+    public $cObj;
29 29
 
30 30
 
31
-	/**
32
-	 * The main method of the eID-Script
33
-	 *
34
-	 * @access	public
35
-	 *
36
-	 * @param	string		$content: The PlugIn content
37
-	 * @param	array		$conf: The PlugIn configuration
38
-	 *
39
-	 * @return	void
40
-	 */
41
-	public function main($content = '', $conf = array ()) {
31
+    /**
32
+     * The main method of the eID-Script
33
+     *
34
+     * @access	public
35
+     *
36
+     * @param	string		$content: The PlugIn content
37
+     * @param	array		$conf: The PlugIn configuration
38
+     *
39
+     * @return	void
40
+     */
41
+    public function main($content = '', $conf = array ()) {
42 42
 
43
-		$this->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
43
+        $this->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
44 44
 
45
-		$this->extKey = 'dlf';
45
+        $this->extKey = 'dlf';
46 46
 
47
-		$this->scriptRelPath = 'plugins/pageview/class.tx_dlf_geturl_eid.php';
47
+        $this->scriptRelPath = 'plugins/pageview/class.tx_dlf_geturl_eid.php';
48 48
 
49
-		$url = GeneralUtility::_GP('url');
49
+        $url = GeneralUtility::_GP('url');
50 50
     $includeHeader = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(GeneralUtility::_GP('header'), 0, 2, 0);
51 51
 
52
-		// first we fetch header separately
53
-		$fetchedHeader = GeneralUtility::getUrl($url, 2);
52
+        // first we fetch header separately
53
+        $fetchedHeader = GeneralUtility::getUrl($url, 2);
54 54
 
55
-		if ($includeHeader == 0) {
55
+        if ($includeHeader == 0) {
56 56
 
57
-			$fetchedData = GeneralUtility::getUrl($url, $includeHeader);
57
+            $fetchedData = GeneralUtility::getUrl($url, $includeHeader);
58 58
 
59
-		} else {
59
+        } else {
60 60
 
61
-			$fetchedData = $fetchedHeader;
61
+            $fetchedData = $fetchedHeader;
62 62
 
63
-		}
63
+        }
64 64
 
65
-		// add some self calculated header tags
66
-		header('Last-Modified: ' . gmdate( "D, d M Y H:i:s" ) . 'GMT');
67
-		header('Cache-Control: max-age=3600, must-revalidate');
68
-		header('Content-Length: '.strlen($fetchedData));
69
-		$fi = finfo_open(FILEINFO_MIME);
70
-		header('Content-Type: ' . finfo_buffer($fi, $fetchedData));
65
+        // add some self calculated header tags
66
+        header('Last-Modified: ' . gmdate( "D, d M Y H:i:s" ) . 'GMT');
67
+        header('Cache-Control: max-age=3600, must-revalidate');
68
+        header('Content-Length: '.strlen($fetchedData));
69
+        $fi = finfo_open(FILEINFO_MIME);
70
+        header('Content-Type: ' . finfo_buffer($fi, $fetchedData));
71 71
 
72
-		// take some tags from request header and overwrite in case already set
73
-		$fetchedHeader = explode("\n", GeneralUtility::getUrl($url, 2));
72
+        // take some tags from request header and overwrite in case already set
73
+        $fetchedHeader = explode("\n", GeneralUtility::getUrl($url, 2));
74 74
 
75
-		foreach ($fetchedHeader as $headerline) {
76
-			if (stripos($headerline, 'Last-Modified:') !== FALSE) {
77
-				header($headerline);
78
-			}
79
-		}
75
+        foreach ($fetchedHeader as $headerline) {
76
+            if (stripos($headerline, 'Last-Modified:') !== FALSE) {
77
+                header($headerline);
78
+            }
79
+        }
80 80
 
81
-		echo $fetchedData;
81
+        echo $fetchedData;
82 82
 
83
-	}
83
+    }
84 84
 
85 85
 }
86 86
 
Please login to merge, or discard this patch.
plugins/pageview/class.tx_dlf_pageview.php 1 patch
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -19,69 +19,69 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_pageview extends tx_dlf_plugin {
21 21
 
22
-	public $scriptRelPath = 'plugins/pageview/class.tx_dlf_pageview.php';
22
+    public $scriptRelPath = 'plugins/pageview/class.tx_dlf_pageview.php';
23 23
 
24
-	/**
25
-	 * Holds the controls to add to the map
26
-	 *
27
-	 * @var	array
28
-	 * @access protected
29
-	 */
30
-	protected $controls = array ();
24
+    /**
25
+     * Holds the controls to add to the map
26
+     *
27
+     * @var	array
28
+     * @access protected
29
+     */
30
+    protected $controls = array ();
31 31
 
32
-	/**
33
-	 * Holds the current images' URLs and MIME types
34
-	 *
35
-	 * @var	array
36
-	 * @access protected
37
-	 */
38
-	protected $images = array ();
32
+    /**
33
+     * Holds the current images' URLs and MIME types
34
+     *
35
+     * @var	array
36
+     * @access protected
37
+     */
38
+    protected $images = array ();
39 39
 
40
-	/**
41
-	 * Holds the current fulltexts' URLs
42
-	 *
43
-	 * @var	array
44
-	 * @access protected
45
-	 */
46
-	protected $fulltexts = array ();
40
+    /**
41
+     * Holds the current fulltexts' URLs
42
+     *
43
+     * @var	array
44
+     * @access protected
45
+     */
46
+    protected $fulltexts = array ();
47 47
 
48
-	/**
49
-	 * Adds Viewer javascript
50
-	 *
51
-	 * @access	protected
52
-	 *
53
-	 * @return	string		Viewer script tags ready for output
54
-	 */
55
-	protected function addViewerJS() {
48
+    /**
49
+     * Adds Viewer javascript
50
+     *
51
+     * @access	protected
52
+     *
53
+     * @return	string		Viewer script tags ready for output
54
+     */
55
+    protected function addViewerJS() {
56 56
 
57
-		$output = array ();
57
+        $output = array ();
58 58
 
59
-		// Add OpenLayers library.
60
-		$output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3.css">';
59
+        // Add OpenLayers library.
60
+        $output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3.css">';
61 61
 
62
-		$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/glif.min.js"></script>';
62
+        $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/glif.min.js"></script>';
63 63
 
64
-		$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3-dlf.js"></script>';
64
+        $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3-dlf.js"></script>';
65 65
 
66
-		// Add viewer library.
67
-		$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_utils.js"></script>';
66
+        // Add viewer library.
67
+        $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_utils.js"></script>';
68 68
 
69
-		$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3.js"></script>';
69
+        $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3.js"></script>';
70 70
 
71
-		$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_styles.js"></script>';
71
+        $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_styles.js"></script>';
72 72
 
73
-		$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_source.js"></script>';
73
+        $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_source.js"></script>';
74 74
 
75
-		$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_altoparser.js"></script>';
75
+        $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_altoparser.js"></script>';
76 76
 
77
-		$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_imagemanipulation_control.js"></script>';
77
+        $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_imagemanipulation_control.js"></script>';
78 78
 
79
-		$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_fulltext_control.js"></script>';
79
+        $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_fulltext_control.js"></script>';
80 80
 
81
-		$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview.js"></script>';
81
+        $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview.js"></script>';
82 82
 
83
-		// Add viewer configuration.
84
-		$output[] = '
83
+        // Add viewer configuration.
84
+        $output[] = '
85 85
 		<script id="tx-dlf-pageview-initViewer" type="text/javascript">
86 86
 			window.onload = function() {
87 87
 				if (dlfUtils.exists(dlfViewer)) {
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
 			}
97 97
 		</script>';
98 98
 
99
-		return implode("\n", $output);
99
+        return implode("\n", $output);
100 100
 
101
-	}
101
+    }
102 102
 
103
-	/**
103
+    /**
104 104
      * Adds pageview interaction (crop, magnifier and rotation)
105 105
      *
106 106
      * @access	protected
@@ -225,183 +225,183 @@  discard block
 block discarded – undo
225 225
 
226 226
     /**
227 227
      * Get image's URL and MIME type
228
-	 *
229
-	 * @access	protected
230
-	 *
231
-	 * @param	integer		$page: Page number
232
-	 *
233
-	 * @return	array		URL and MIME type of image file
234
-	 */
235
-	protected function getImage($page) {
228
+     *
229
+     * @access	protected
230
+     *
231
+     * @param	integer		$page: Page number
232
+     *
233
+     * @return	array		URL and MIME type of image file
234
+     */
235
+    protected function getImage($page) {
236 236
 
237
-		$image = array ();
237
+        $image = array ();
238 238
 
239
-		// Get @USE value of METS fileGrp.
240
-		$fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrps']);
239
+        // Get @USE value of METS fileGrp.
240
+        $fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrps']);
241 241
 
242
-		while ($fileGrp = @array_pop($fileGrps)) {
242
+        while ($fileGrp = @array_pop($fileGrps)) {
243 243
 
244
-			// Get image link.
245
-			if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) {
244
+            // Get image link.
245
+            if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) {
246 246
 
247
-				$image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
247
+                $image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
248 248
 
249
-				if ($this->conf['useInternalProxy']) {
250
-					// Configure @action URL for form.
251
-					$linkConf = array (
252
-						'parameter' => $GLOBALS['TSFE']->id,
253
-						'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($image['url']),
254
-					);
249
+                if ($this->conf['useInternalProxy']) {
250
+                    // Configure @action URL for form.
251
+                    $linkConf = array (
252
+                        'parameter' => $GLOBALS['TSFE']->id,
253
+                        'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($image['url']),
254
+                    );
255 255
 
256
-					$image['url'] = $this->cObj->typoLink_URL($linkConf);
257
-				}
256
+                    $image['url'] = $this->cObj->typoLink_URL($linkConf);
257
+                }
258 258
 
259
-				$image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
259
+                $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
260 260
 
261
-				break;
261
+                break;
262 262
 
263
-			} else {
263
+            } else {
264 264
 
265
-				if (TYPO3_DLOG) {
265
+                if (TYPO3_DLOG) {
266 266
 
267
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
267
+                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
268 268
 
269
-				}
269
+                }
270 270
 
271
-			}
271
+            }
272 272
 
273
-		}
273
+        }
274 274
 
275
-		return $image;
275
+        return $image;
276 276
 
277
-	}
277
+    }
278 278
 
279
-	/**
280
-	 * Get fulltext URL and MIME type
281
-	 *
282
-	 * @access	protected
283
-	 *
284
-	 * @param	integer		$page: Page number
285
-	 *
286
-	 * @return	array		URL and MIME type of fulltext file
287
-	 */
288
-	protected function getFulltext($page) {
279
+    /**
280
+     * Get fulltext URL and MIME type
281
+     *
282
+     * @access	protected
283
+     *
284
+     * @param	integer		$page: Page number
285
+     *
286
+     * @return	array		URL and MIME type of fulltext file
287
+     */
288
+    protected function getFulltext($page) {
289 289
 
290
-		$fulltext = array ();
290
+        $fulltext = array ();
291 291
 
292
-		// Get fulltext link.
293
-		if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']])) {
292
+        // Get fulltext link.
293
+        if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']])) {
294 294
 
295
-			$fulltext['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]);
295
+            $fulltext['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]);
296 296
 
297
-			// Configure @action URL for form.
298
-			$linkConf = array (
299
-				'parameter' => $GLOBALS['TSFE']->id,
300
-				'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($fulltext['url']),
301
-			);
297
+            // Configure @action URL for form.
298
+            $linkConf = array (
299
+                'parameter' => $GLOBALS['TSFE']->id,
300
+                'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($fulltext['url']),
301
+            );
302 302
 
303
-			$fulltext['url'] = $this->cObj->typoLink_URL($linkConf);
303
+            $fulltext['url'] = $this->cObj->typoLink_URL($linkConf);
304 304
 
305
-			$fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]);
305
+            $fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]);
306 306
 
307
-		} else {
307
+        } else {
308 308
 
309
-			if (TYPO3_DLOG) {
309
+            if (TYPO3_DLOG) {
310 310
 
311
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getFulltext('.$page.')] File not found in fileGrp "'.$this->conf['fileGrpFulltext'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
311
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getFulltext('.$page.')] File not found in fileGrp "'.$this->conf['fileGrpFulltext'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
312 312
 
313
-			}
313
+            }
314 314
 
315
-		}
315
+        }
316 316
 
317
-		return $fulltext;
317
+        return $fulltext;
318 318
 
319
-	}
319
+    }
320 320
 
321
-	/**
322
-	 * The main method of the PlugIn
323
-	 *
324
-	 * @access	public
325
-	 *
326
-	 * @param	string		$content: The PlugIn content
327
-	 * @param	array		$conf: The PlugIn configuration
328
-	 *
329
-	 * @return	string		The content that is displayed on the website
330
-	 */
331
-	public function main($content, $conf) {
321
+    /**
322
+     * The main method of the PlugIn
323
+     *
324
+     * @access	public
325
+     *
326
+     * @param	string		$content: The PlugIn content
327
+     * @param	array		$conf: The PlugIn configuration
328
+     *
329
+     * @return	string		The content that is displayed on the website
330
+     */
331
+    public function main($content, $conf) {
332 332
 
333
-		$this->init($conf);
333
+        $this->init($conf);
334 334
 
335
-		// Load current document.
336
-		$this->loadDocument();
335
+        // Load current document.
336
+        $this->loadDocument();
337 337
 
338
-		if ($this->doc === NULL || $this->doc->numPages < 1) {
338
+        if ($this->doc === NULL || $this->doc->numPages < 1) {
339 339
 
340
-			// Quit without doing anything if required variables are not set.
341
-			return $content;
340
+            // Quit without doing anything if required variables are not set.
341
+            return $content;
342 342
 
343
-		} else {
343
+        } else {
344 344
 
345
-			if (!empty($this->piVars['logicalPage'])) {
345
+            if (!empty($this->piVars['logicalPage'])) {
346 346
 
347
-				$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
348
-				// The logical page parameter should not appear again
349
-				unset($this->piVars['logicalPage']);
347
+                $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
348
+                // The logical page parameter should not appear again
349
+                unset($this->piVars['logicalPage']);
350 350
 
351
-			}
351
+            }
352 352
 
353
-			// Set default values if not set.
354
-			// $this->piVars['page'] may be integer or string (physical structure @ID)
355
-			if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) {
353
+            // Set default values if not set.
354
+            // $this->piVars['page'] may be integer or string (physical structure @ID)
355
+            if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) {
356 356
 
357
-				$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1);
357
+                $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1);
358 358
 
359
-			} else {
359
+            } else {
360 360
 
361
-				$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
361
+                $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
362 362
 
363
-			}
363
+            }
364 364
 
365
-			$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
365
+            $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
366 366
 
367
-		}
367
+        }
368 368
 
369
-		// Load template file.
370
-		if (!empty($this->conf['templateFile'])) {
369
+        // Load template file.
370
+        if (!empty($this->conf['templateFile'])) {
371 371
 
372
-			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
372
+            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
373 373
 
374
-		} else {
374
+        } else {
375 375
 
376
-			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pageview/template.tmpl'), '###TEMPLATE###');
376
+            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pageview/template.tmpl'), '###TEMPLATE###');
377 377
 
378
-		}
378
+        }
379 379
 
380
-		// Get image data.
381
-		$this->images[0] = $this->getImage($this->piVars['page']);
382
-		$this->fulltexts[0] = $this->getFulltext($this->piVars['page']);
380
+        // Get image data.
381
+        $this->images[0] = $this->getImage($this->piVars['page']);
382
+        $this->fulltexts[0] = $this->getFulltext($this->piVars['page']);
383 383
 
384
-		if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) {
384
+        if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) {
385 385
 
386
-			$this->images[1] = $this->getImage($this->piVars['page'] + 1);
387
-			$this->fulltexts[1] = $this->getFulltext($this->piVars['page'] + 1);
386
+            $this->images[1] = $this->getImage($this->piVars['page'] + 1);
387
+            $this->fulltexts[1] = $this->getFulltext($this->piVars['page'] + 1);
388 388
 
389
-		}
389
+        }
390 390
 
391
-		// Get the controls for the map.
392
-		$this->controls = explode(',', $this->conf['features']);
391
+        // Get the controls for the map.
392
+        $this->controls = explode(',', $this->conf['features']);
393 393
 
394
-		// Fill in the template markers.
395
-		$markerArray = array (
396
-			'###VIEWER_JS###' => $this->addViewerJS()
397
-		);
394
+        // Fill in the template markers.
395
+        $markerArray = array (
396
+            '###VIEWER_JS###' => $this->addViewerJS()
397
+        );
398 398
 
399
-		$markerArray = array_merge($markerArray, $this->addInteraction(), $this->addBasketForm());
399
+        $markerArray = array_merge($markerArray, $this->addInteraction(), $this->addBasketForm());
400 400
 
401 401
         $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
402 402
 
403
-		return $this->pi_wrapInBaseClass($content);
403
+        return $this->pi_wrapInBaseClass($content);
404 404
 
405
-	}
405
+    }
406 406
 
407 407
 }
Please login to merge, or discard this patch.
plugins/feeds/class.tx_dlf_feeds.php 1 patch
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -19,210 +19,210 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_feeds extends tx_dlf_plugin {
21 21
 
22
-	public $scriptRelPath = 'plugins/feeds/class.tx_dlf_feeds.php';
22
+    public $scriptRelPath = 'plugins/feeds/class.tx_dlf_feeds.php';
23 23
 
24
-	/**
25
-	 * The main method of the PlugIn
26
-	 *
27
-	 * @access	public
28
-	 *
29
-	 * @param	string		$content: The PlugIn content
30
-	 * @param	array		$conf: The PlugIn configuration
31
-	 *
32
-	 * @return	void
33
-	 */
34
-	public function main($content, $conf) {
24
+    /**
25
+     * The main method of the PlugIn
26
+     *
27
+     * @access	public
28
+     *
29
+     * @param	string		$content: The PlugIn content
30
+     * @param	array		$conf: The PlugIn configuration
31
+     *
32
+     * @return	void
33
+     */
34
+    public function main($content, $conf) {
35 35
 
36
-		$this->init($conf);
36
+        $this->init($conf);
37 37
 
38
-		// Don't cache the output.
39
-		$this->setCache(FALSE);
38
+        // Don't cache the output.
39
+        $this->setCache(FALSE);
40 40
 
41
-		// Create XML document.
42
-		$rss = new DOMDocument('1.0', 'utf-8');
41
+        // Create XML document.
42
+        $rss = new DOMDocument('1.0', 'utf-8');
43 43
 
44
-		// Add mandatory root element.
45
-		$root = $rss->createElement('rss');
44
+        // Add mandatory root element.
45
+        $root = $rss->createElement('rss');
46 46
 
47
-		$root->setAttribute('version', '2.0');
47
+        $root->setAttribute('version', '2.0');
48 48
 
49
-		// Add channel element.
50
-		$channel = $rss->createElement('channel');
49
+        // Add channel element.
50
+        $channel = $rss->createElement('channel');
51 51
 
52
-		$channel->appendChild($rss->createElement('title', htmlspecialchars($this->conf['title'], ENT_NOQUOTES, 'UTF-8')));
52
+        $channel->appendChild($rss->createElement('title', htmlspecialchars($this->conf['title'], ENT_NOQUOTES, 'UTF-8')));
53 53
 
54
-		$channel->appendChild($rss->createElement('link', htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->pi_linkTP_keepPIvars_url()), ENT_NOQUOTES, 'UTF-8')));
54
+        $channel->appendChild($rss->createElement('link', htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->pi_linkTP_keepPIvars_url()), ENT_NOQUOTES, 'UTF-8')));
55 55
 
56
-		if (!empty($this->conf['description'])) {
56
+        if (!empty($this->conf['description'])) {
57 57
 
58
-			$channel->appendChild($rss->createElement('description', htmlspecialchars($this->conf['description'], ENT_QUOTES, 'UTF-8')));
58
+            $channel->appendChild($rss->createElement('description', htmlspecialchars($this->conf['description'], ENT_QUOTES, 'UTF-8')));
59 59
 
60
-		}
60
+        }
61 61
 
62
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
63
-			'tx_dlf_libraries.label AS label',
64
-			'tx_dlf_libraries',
65
-			'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'),
66
-			'',
67
-			'',
68
-			'1'
69
-		);
62
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
63
+            'tx_dlf_libraries.label AS label',
64
+            'tx_dlf_libraries',
65
+            'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'),
66
+            '',
67
+            '',
68
+            '1'
69
+        );
70 70
 
71
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
71
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
72 72
 
73
-			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
73
+            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
74 74
 
75
-			$channel->appendChild($rss->createElement('copyright', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8')));
75
+            $channel->appendChild($rss->createElement('copyright', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8')));
76 76
 
77
-		}
77
+        }
78 78
 
79
-		$channel->appendChild($rss->createElement('pubDate', date('r', $GLOBALS['EXEC_TIME'])));
79
+        $channel->appendChild($rss->createElement('pubDate', date('r', $GLOBALS['EXEC_TIME'])));
80 80
 
81
-		$channel->appendChild($rss->createElement('generator', htmlspecialchars($this->conf['useragent'], ENT_NOQUOTES, 'UTF-8')));
81
+        $channel->appendChild($rss->createElement('generator', htmlspecialchars($this->conf['useragent'], ENT_NOQUOTES, 'UTF-8')));
82 82
 
83
-		// Add item elements.
84
-		if (!$this->conf['excludeOther'] || empty($this->piVars['collection']) || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['collections'], $this->piVars['collection'])) {
83
+        // Add item elements.
84
+        if (!$this->conf['excludeOther'] || empty($this->piVars['collection']) || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['collections'], $this->piVars['collection'])) {
85 85
 
86
-			$additionalWhere = '';
86
+            $additionalWhere = '';
87 87
 
88
-			// Check for pre-selected collections.
89
-			if (!empty($this->piVars['collection'])) {
88
+            // Check for pre-selected collections.
89
+            if (!empty($this->piVars['collection'])) {
90 90
 
91
-				$additionalWhere = ' AND tx_dlf_collections.uid='.intval($this->piVars['collection']);
91
+                $additionalWhere = ' AND tx_dlf_collections.uid='.intval($this->piVars['collection']);
92 92
 
93
-			} elseif (!empty($this->conf['collections'])) {
93
+            } elseif (!empty($this->conf['collections'])) {
94 94
 
95
-				$additionalWhere = ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
95
+                $additionalWhere = ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
96 96
 
97
-			}
97
+            }
98 98
 
99
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
100
-				'tx_dlf_documents.uid AS uid,tx_dlf_documents.partof AS partof,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_documents.author AS author,tx_dlf_documents.record_id AS guid,tx_dlf_documents.tstamp AS tstamp,tx_dlf_documents.crdate AS crdate',
101
-				'tx_dlf_documents',
102
-				'tx_dlf_relations',
103
-				'tx_dlf_collections',
104
-				'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').' AND tx_dlf_collections.pid='.intval($this->conf['pages']).$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
105
-				'tx_dlf_documents.uid',
106
-				'tx_dlf_documents.tstamp DESC',
107
-				intval($this->conf['limit'])
108
-			);
99
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
100
+                'tx_dlf_documents.uid AS uid,tx_dlf_documents.partof AS partof,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_documents.author AS author,tx_dlf_documents.record_id AS guid,tx_dlf_documents.tstamp AS tstamp,tx_dlf_documents.crdate AS crdate',
101
+                'tx_dlf_documents',
102
+                'tx_dlf_relations',
103
+                'tx_dlf_collections',
104
+                'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').' AND tx_dlf_collections.pid='.intval($this->conf['pages']).$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
105
+                'tx_dlf_documents.uid',
106
+                'tx_dlf_documents.tstamp DESC',
107
+                intval($this->conf['limit'])
108
+            );
109 109
 
110
-			if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
110
+            if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
111 111
 
112
-				// Add each record as item element.
113
-				while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
112
+                // Add each record as item element.
113
+                while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
114 114
 
115
-					$item = $rss->createElement('item');
115
+                    $item = $rss->createElement('item');
116 116
 
117
-					$title = '';
117
+                    $title = '';
118 118
 
119
-					// Get title of superior document.
120
-					if ((empty($resArray['title']) || !empty($this->conf['prependSuperiorTitle'])) && !empty($resArray['partof'])) {
119
+                    // Get title of superior document.
120
+                    if ((empty($resArray['title']) || !empty($this->conf['prependSuperiorTitle'])) && !empty($resArray['partof'])) {
121 121
 
122
-						$superiorTitle = tx_dlf_document::getTitle($resArray['partof'], TRUE);
122
+                        $superiorTitle = tx_dlf_document::getTitle($resArray['partof'], TRUE);
123 123
 
124
-						if (!empty($superiorTitle)) {
124
+                        if (!empty($superiorTitle)) {
125 125
 
126
-							$title .= '['.$superiorTitle.']';
126
+                            $title .= '['.$superiorTitle.']';
127 127
 
128
-						}
128
+                        }
129 129
 
130
-					}
130
+                    }
131 131
 
132
-					// Get title of document.
133
-					if (!empty($resArray['title'])) {
132
+                    // Get title of document.
133
+                    if (!empty($resArray['title'])) {
134 134
 
135
-						$title .= ' '.$resArray['title'];
135
+                        $title .= ' '.$resArray['title'];
136 136
 
137
-					}
137
+                    }
138 138
 
139
-					// Set default title if empty.
140
-					if (empty($title)) {
139
+                    // Set default title if empty.
140
+                    if (empty($title)) {
141 141
 
142
-						$title = $this->pi_getLL('noTitle');
142
+                        $title = $this->pi_getLL('noTitle');
143 143
 
144
-					}
144
+                    }
145 145
 
146
-					// Append volume information.
147
-					if (!empty($resArray['volume'])) {
146
+                    // Append volume information.
147
+                    if (!empty($resArray['volume'])) {
148 148
 
149
-						$title .= ', '.$this->pi_getLL('volume').' '.$resArray['volume'];
149
+                        $title .= ', '.$this->pi_getLL('volume').' '.$resArray['volume'];
150 150
 
151
-					}
151
+                    }
152 152
 
153
-					// Is this document new or updated?
154
-					if ($resArray['crdate'] == $resArray['tstamp']) {
153
+                    // Is this document new or updated?
154
+                    if ($resArray['crdate'] == $resArray['tstamp']) {
155 155
 
156
-						$title = $this->pi_getLL('new').' '.trim($title);
156
+                        $title = $this->pi_getLL('new').' '.trim($title);
157 157
 
158
-					} else {
158
+                    } else {
159 159
 
160
-						$title = $this->pi_getLL('update').' '.trim($title);
160
+                        $title = $this->pi_getLL('update').' '.trim($title);
161 161
 
162
-					}
162
+                    }
163 163
 
164
-					$item->appendChild($rss->createElement('title', htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8')));
164
+                    $item->appendChild($rss->createElement('title', htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8')));
165 165
 
166
-					// Add link.
167
-					$linkConf = array (
168
-						'parameter' => $this->conf['targetPid'],
169
-						'forceAbsoluteUrl' => 1,
170
-						'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, array ('id' => $resArray['uid']), '', TRUE, FALSE)
171
-					);
166
+                    // Add link.
167
+                    $linkConf = array (
168
+                        'parameter' => $this->conf['targetPid'],
169
+                        'forceAbsoluteUrl' => 1,
170
+                        'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, array ('id' => $resArray['uid']), '', TRUE, FALSE)
171
+                    );
172 172
 
173
-					$item->appendChild($rss->createElement('link', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8')));
173
+                    $item->appendChild($rss->createElement('link', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8')));
174 174
 
175
-					// Add author if applicable.
176
-					if (!empty($resArray['author'])) {
175
+                    // Add author if applicable.
176
+                    if (!empty($resArray['author'])) {
177 177
 
178
-						$item->appendChild($rss->createElement('author', htmlspecialchars($resArray['author'], ENT_NOQUOTES, 'UTF-8')));
178
+                        $item->appendChild($rss->createElement('author', htmlspecialchars($resArray['author'], ENT_NOQUOTES, 'UTF-8')));
179 179
 
180
-					}
180
+                    }
181 181
 
182
-					// Add online publication date.
183
-					$item->appendChild($rss->createElement('pubDate', date('r', $resArray['crdate'])));
182
+                    // Add online publication date.
183
+                    $item->appendChild($rss->createElement('pubDate', date('r', $resArray['crdate'])));
184 184
 
185
-					// Add internal record identifier.
186
-					$item->appendChild($rss->createElement('guid', htmlspecialchars($resArray['guid'], ENT_NOQUOTES, 'UTF-8')));
185
+                    // Add internal record identifier.
186
+                    $item->appendChild($rss->createElement('guid', htmlspecialchars($resArray['guid'], ENT_NOQUOTES, 'UTF-8')));
187 187
 
188
-					$channel->appendChild($item);
188
+                    $channel->appendChild($item);
189 189
 
190
-				}
190
+                }
191 191
 
192
-			}
192
+            }
193 193
 
194
-		}
194
+        }
195 195
 
196
-		$root->appendChild($channel);
196
+        $root->appendChild($channel);
197 197
 
198
-		// Build XML output.
199
-		$rss->appendChild($root);
198
+        // Build XML output.
199
+        $rss->appendChild($root);
200 200
 
201
-		$content = $rss->saveXML();
201
+        $content = $rss->saveXML();
202 202
 
203
-		// Clean output buffer.
204
-		\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
203
+        // Clean output buffer.
204
+        \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
205 205
 
206
-		// Send headers.
207
-		header('HTTP/1.1 200 OK');
206
+        // Send headers.
207
+        header('HTTP/1.1 200 OK');
208 208
 
209
-		header('Cache-Control: no-cache');
209
+        header('Cache-Control: no-cache');
210 210
 
211
-		header('Content-Length: '.strlen($content));
211
+        header('Content-Length: '.strlen($content));
212 212
 
213
-		header('Content-Type: application/rss+xml; charset=utf-8');
213
+        header('Content-Type: application/rss+xml; charset=utf-8');
214 214
 
215
-		header('Date: '.date('r', $GLOBALS['EXEC_TIME']));
215
+        header('Date: '.date('r', $GLOBALS['EXEC_TIME']));
216 216
 
217
-		header('Expires: '.date('r', $GLOBALS['EXEC_TIME']));
217
+        header('Expires: '.date('r', $GLOBALS['EXEC_TIME']));
218 218
 
219
-		echo $content;
219
+        echo $content;
220 220
 
221
-		// Flush output buffer and end script processing.
222
-		ob_end_flush();
221
+        // Flush output buffer and end script processing.
222
+        ob_end_flush();
223 223
 
224
-		exit;
224
+        exit;
225 225
 
226
-	}
226
+    }
227 227
 
228 228
 }
Please login to merge, or discard this patch.
plugins/oai/class.tx_dlf_oai.php 1 patch
Indentation   +1100 added lines, -1100 removed lines patch added patch discarded remove patch
@@ -19,1755 +19,1755 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_oai extends tx_dlf_plugin {
21 21
 
22
-	public $scriptRelPath = 'plugins/oai/class.tx_dlf_oai.php';
23
-
24
-	/**
25
-	 * Did an error occur?
26
-	 *
27
-	 * @var	boolean
28
-	 * @access protected
29
-	 */
30
-	protected $error = FALSE;
31
-
32
-	/**
33
-	 * This holds the OAI DOM object
34
-	 *
35
-	 * @var	DOMDocument
36
-	 * @access protected
37
-	 */
38
-	protected $oai;
39
-
40
-	/**
41
-	 * This holds the configuration for all supported metadata prefixes
42
-	 *
43
-	 * @var	array
44
-	 * @access protected
45
-	 */
46
-	protected $formats = array (
47
-		'oai_dc' => array (
48
-			'schema' => 'http://www.openarchives.org/OAI/2.0/oai_dc.xsd',
49
-			'namespace' => 'http://www.openarchives.org/OAI/2.0/oai_dc/',
50
-			'requiredFields' => array ('record_id'),
51
-		),
52
-		'epicur' => array (
53
-			'schema' => 'http://www.persistent-identifier.de/xepicur/version1.0/xepicur.xsd',
54
-			'namespace' => 'urn:nbn:de:1111-2004033116',
55
-			'requiredFields' => array ('purl', 'urn'),
56
-		),
57
-		'mets' => array (
58
-			'schema' => 'http://www.loc.gov/standards/mets/version17/mets.v1-7.xsd',
59
-			'namespace' => 'http://www.loc.gov/METS/',
60
-			'requiredFields' => array ('location'),
61
-		)
62
-	);
63
-
64
-	/**
65
-	 * Delete expired resumption tokens
66
-	 *
67
-	 * @access	protected
68
-	 *
69
-	 * @return	void
70
-	 */
71
-	protected function deleteExpiredTokens() {
72
-
73
-		// Delete expired resumption tokens.
74
-		$result = $GLOBALS['TYPO3_DB']->exec_DELETEquery(
75
-			'tx_dlf_tokens',
76
-			'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.tstamp<'.intval($GLOBALS['EXEC_TIME'] - $this->conf['expired'])
77
-		);
78
-
79
-		if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) === -1) {
80
-
81
-			// Deletion failed.
82
-			if (TYPO3_DLOG) {
22
+    public $scriptRelPath = 'plugins/oai/class.tx_dlf_oai.php';
23
+
24
+    /**
25
+     * Did an error occur?
26
+     *
27
+     * @var	boolean
28
+     * @access protected
29
+     */
30
+    protected $error = FALSE;
31
+
32
+    /**
33
+     * This holds the OAI DOM object
34
+     *
35
+     * @var	DOMDocument
36
+     * @access protected
37
+     */
38
+    protected $oai;
39
+
40
+    /**
41
+     * This holds the configuration for all supported metadata prefixes
42
+     *
43
+     * @var	array
44
+     * @access protected
45
+     */
46
+    protected $formats = array (
47
+        'oai_dc' => array (
48
+            'schema' => 'http://www.openarchives.org/OAI/2.0/oai_dc.xsd',
49
+            'namespace' => 'http://www.openarchives.org/OAI/2.0/oai_dc/',
50
+            'requiredFields' => array ('record_id'),
51
+        ),
52
+        'epicur' => array (
53
+            'schema' => 'http://www.persistent-identifier.de/xepicur/version1.0/xepicur.xsd',
54
+            'namespace' => 'urn:nbn:de:1111-2004033116',
55
+            'requiredFields' => array ('purl', 'urn'),
56
+        ),
57
+        'mets' => array (
58
+            'schema' => 'http://www.loc.gov/standards/mets/version17/mets.v1-7.xsd',
59
+            'namespace' => 'http://www.loc.gov/METS/',
60
+            'requiredFields' => array ('location'),
61
+        )
62
+    );
63
+
64
+    /**
65
+     * Delete expired resumption tokens
66
+     *
67
+     * @access	protected
68
+     *
69
+     * @return	void
70
+     */
71
+    protected function deleteExpiredTokens() {
72
+
73
+        // Delete expired resumption tokens.
74
+        $result = $GLOBALS['TYPO3_DB']->exec_DELETEquery(
75
+            'tx_dlf_tokens',
76
+            'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.tstamp<'.intval($GLOBALS['EXEC_TIME'] - $this->conf['expired'])
77
+        );
78
+
79
+        if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) === -1) {
80
+
81
+            // Deletion failed.
82
+            if (TYPO3_DLOG) {
83 83
 
84
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->deleteExpiredTokens()] Could not delete expired resumption tokens', $this->extKey, SYSLOG_SEVERITY_WARNING);
84
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->deleteExpiredTokens()] Could not delete expired resumption tokens', $this->extKey, SYSLOG_SEVERITY_WARNING);
85 85
 
86
-			}
86
+            }
87 87
 
88
-		}
88
+        }
89 89
 
90
-	}
90
+    }
91 91
 
92
-	/**
93
-	 * Process error
94
-	 *
95
-	 * @access	protected
96
-	 *
97
-	 * @param	string		$type: Error type
98
-	 *
99
-	 * @return	DOMElement		XML node to add to the OAI response
100
-	 */
101
-	protected function error($type) {
92
+    /**
93
+     * Process error
94
+     *
95
+     * @access	protected
96
+     *
97
+     * @param	string		$type: Error type
98
+     *
99
+     * @return	DOMElement		XML node to add to the OAI response
100
+     */
101
+    protected function error($type) {
102 102
 
103
-		$this->error = TRUE;
103
+        $this->error = TRUE;
104 104
 
105
-		$error = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'error', htmlspecialchars($this->pi_getLL($type, $type, FALSE), ENT_NOQUOTES, 'UTF-8'));
105
+        $error = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'error', htmlspecialchars($this->pi_getLL($type, $type, FALSE), ENT_NOQUOTES, 'UTF-8'));
106 106
 
107
-		$error->setAttribute('code', $type);
107
+        $error->setAttribute('code', $type);
108 108
 
109
-		return $error;
109
+        return $error;
110 110
 
111
-	}
111
+    }
112 112
 
113
-	/**
114
-	 * Load URL parameters
115
-	 *
116
-	 * @access	protected
117
-	 *
118
-	 * @return	void
119
-	 */
120
-	protected function getUrlParams() {
113
+    /**
114
+     * Load URL parameters
115
+     *
116
+     * @access	protected
117
+     *
118
+     * @return	void
119
+     */
120
+    protected function getUrlParams() {
121 121
 
122
-		$allowedParams = array (
123
-			'verb',
124
-			'identifier',
125
-			'metadataPrefix',
126
-			'from',
127
-			'until',
128
-			'set',
129
-			'resumptionToken'
130
-		);
122
+        $allowedParams = array (
123
+            'verb',
124
+            'identifier',
125
+            'metadataPrefix',
126
+            'from',
127
+            'until',
128
+            'set',
129
+            'resumptionToken'
130
+        );
131 131
 
132
-		// Clear plugin variables.
133
-		$this->piVars = array ();
132
+        // Clear plugin variables.
133
+        $this->piVars = array ();
134 134
 
135
-		// Set only allowed parameters.
136
-		foreach ($allowedParams as $param) {
135
+        // Set only allowed parameters.
136
+        foreach ($allowedParams as $param) {
137 137
 
138
-			if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP($param)) {
138
+            if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP($param)) {
139 139
 
140
-				$this->piVars[$param] = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP($param);
140
+                $this->piVars[$param] = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP($param);
141 141
 
142
-			}
142
+            }
143 143
 
144
-		}
144
+        }
145 145
 
146
-	}
146
+    }
147 147
 
148
-	/**
149
-	 * Get unqualified Dublin Core data.
150
-	 * @see http://www.openarchives.org/OAI/openarchivesprotocol.html#dublincore
151
-	 *
152
-	 * @access	protected
153
-	 *
154
-	 * @param	array		$metadata: The metadata array
155
-	 *
156
-	 * @return	DOMElement		XML node to add to the OAI response
157
-	 */
158
-	protected function getDcData(array $metadata) {
148
+    /**
149
+     * Get unqualified Dublin Core data.
150
+     * @see http://www.openarchives.org/OAI/openarchivesprotocol.html#dublincore
151
+     *
152
+     * @access	protected
153
+     *
154
+     * @param	array		$metadata: The metadata array
155
+     *
156
+     * @return	DOMElement		XML node to add to the OAI response
157
+     */
158
+    protected function getDcData(array $metadata) {
159 159
 
160
-		$oai_dc = $this->oai->createElementNS($this->formats['oai_dc']['namespace'], 'oai_dc:dc');
160
+        $oai_dc = $this->oai->createElementNS($this->formats['oai_dc']['namespace'], 'oai_dc:dc');
161 161
 
162
-		$oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:dc', 'http://purl.org/dc/elements/1.1/');
162
+        $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:dc', 'http://purl.org/dc/elements/1.1/');
163 163
 
164
-		$oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
164
+        $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
165 165
 
166
-		$oai_dc->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['oai_dc']['namespace'].' '.$this->formats['oai_dc']['schema']);
166
+        $oai_dc->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['oai_dc']['namespace'].' '.$this->formats['oai_dc']['schema']);
167 167
 
168
-		$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['record_id'], ENT_NOQUOTES, 'UTF-8')));
168
+        $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['record_id'], ENT_NOQUOTES, 'UTF-8')));
169 169
 
170
-		if (!empty($metadata['purl'])) {
170
+        if (!empty($metadata['purl'])) {
171 171
 
172
-			$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8')));
172
+            $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8')));
173 173
 
174
-		}
174
+        }
175 175
 
176
-		if (!empty($metadata['urn'])) {
176
+        if (!empty($metadata['urn'])) {
177 177
 
178
-			$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8')));
178
+            $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8')));
179 179
 
180
-		}
180
+        }
181 181
 
182
-		if (!empty($metadata['title'])) {
182
+        if (!empty($metadata['title'])) {
183 183
 
184
-			$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:title', htmlspecialchars($metadata['title'], ENT_NOQUOTES, 'UTF-8')));
184
+            $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:title', htmlspecialchars($metadata['title'], ENT_NOQUOTES, 'UTF-8')));
185 185
 
186
-		}
186
+        }
187 187
 
188
-		if (!empty($metadata['author'])) {
188
+        if (!empty($metadata['author'])) {
189 189
 
190
-			$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:creator', htmlspecialchars($metadata['author'], ENT_NOQUOTES, 'UTF-8')));
190
+            $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:creator', htmlspecialchars($metadata['author'], ENT_NOQUOTES, 'UTF-8')));
191 191
 
192
-		}
192
+        }
193 193
 
194
-		if (!empty($metadata['year'])) {
194
+        if (!empty($metadata['year'])) {
195 195
 
196
-			$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:date', htmlspecialchars($metadata['year'], ENT_NOQUOTES, 'UTF-8')));
196
+            $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:date', htmlspecialchars($metadata['year'], ENT_NOQUOTES, 'UTF-8')));
197 197
 
198
-		}
198
+        }
199 199
 
200
-		if (!empty($metadata['place'])) {
200
+        if (!empty($metadata['place'])) {
201 201
 
202
-			$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:coverage', htmlspecialchars($metadata['place'], ENT_NOQUOTES, 'UTF-8')));
202
+            $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:coverage', htmlspecialchars($metadata['place'], ENT_NOQUOTES, 'UTF-8')));
203 203
 
204
-		}
204
+        }
205 205
 
206
-		$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:format', 'application/mets+xml'));
206
+        $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:format', 'application/mets+xml'));
207 207
 
208
-		$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:type', 'Text'));
208
+        $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:type', 'Text'));
209 209
 
210
-		if (!empty($metadata['partof'])) {
210
+        if (!empty($metadata['partof'])) {
211 211
 
212
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
213
-				'tx_dlf_documents.record_id',
214
-				'tx_dlf_documents',
215
-				'tx_dlf_documents.uid='.intval($metadata['partof']).tx_dlf_helper::whereClause('tx_dlf_documents'),
216
-				'',
217
-				'',
218
-				'1'
219
-			);
212
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
213
+                'tx_dlf_documents.record_id',
214
+                'tx_dlf_documents',
215
+                'tx_dlf_documents.uid='.intval($metadata['partof']).tx_dlf_helper::whereClause('tx_dlf_documents'),
216
+                '',
217
+                '',
218
+                '1'
219
+            );
220 220
 
221
-			if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
221
+            if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
222 222
 
223
-				$partof = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
223
+                $partof = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
224 224
 
225
-				$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:relation', htmlspecialchars($partof['record_id'], ENT_NOQUOTES, 'UTF-8')));
225
+                $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:relation', htmlspecialchars($partof['record_id'], ENT_NOQUOTES, 'UTF-8')));
226 226
 
227
-			}
227
+            }
228 228
 
229
-		}
229
+        }
230 230
 
231
-		return $oai_dc;
231
+        return $oai_dc;
232 232
 
233
-	}
233
+    }
234 234
 
235
-	/**
236
-	 * Get epicur data.
237
-	 * @see http://www.persistent-identifier.de/?link=210
238
-	 *
239
-	 * @access	protected
240
-	 *
241
-	 * @param	array		$metadata: The metadata array
242
-	 *
243
-	 * @return	DOMElement		XML node to add to the OAI response
244
-	 */
245
-	protected function getEpicurData(array $metadata) {
235
+    /**
236
+     * Get epicur data.
237
+     * @see http://www.persistent-identifier.de/?link=210
238
+     *
239
+     * @access	protected
240
+     *
241
+     * @param	array		$metadata: The metadata array
242
+     *
243
+     * @return	DOMElement		XML node to add to the OAI response
244
+     */
245
+    protected function getEpicurData(array $metadata) {
246 246
 
247
-		// Define all XML elements with or without qualified namespace.
248
-		if (empty($this->conf['unqualified_epicur'])) {
247
+        // Define all XML elements with or without qualified namespace.
248
+        if (empty($this->conf['unqualified_epicur'])) {
249 249
 
250
-			// Create epicur element.
251
-			$epicur = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:epicur');
250
+            // Create epicur element.
251
+            $epicur = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:epicur');
252 252
 
253
-			// Add administrative data.
254
-			$admin = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:administrative_data');
253
+            // Add administrative data.
254
+            $admin = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:administrative_data');
255 255
 
256
-			$delivery = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:delivery');
256
+            $delivery = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:delivery');
257 257
 
258
-			$update = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:update_status');
258
+            $update = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:update_status');
259 259
 
260
-			$transfer = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:transfer');
260
+            $transfer = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:transfer');
261 261
 
262
-			$format = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:format', 'text/html');
262
+            $format = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:format', 'text/html');
263 263
 
264
-			// Add record data.
265
-			$record = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:record');
264
+            // Add record data.
265
+            $record = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:record');
266 266
 
267
-			$identifier = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8'));
267
+            $identifier = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8'));
268 268
 
269
-			$resource = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:resource');
269
+            $resource = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:resource');
270 270
 
271
-			$ident = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8'));
271
+            $ident = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8'));
272 272
 
273
-		} else {
273
+        } else {
274 274
 
275
-			// Create epicur element with unqualified namespace.
276
-			$epicur = $this->oai->createElement('epicur');
275
+            // Create epicur element with unqualified namespace.
276
+            $epicur = $this->oai->createElement('epicur');
277 277
 
278
-			$epicur->setAttribute('xmlns', $this->formats['epicur']['namespace']);
278
+            $epicur->setAttribute('xmlns', $this->formats['epicur']['namespace']);
279 279
 
280
-			// Add administrative data without qualified namespace.
281
-			$admin = $this->oai->createElement('administrative_data');
280
+            // Add administrative data without qualified namespace.
281
+            $admin = $this->oai->createElement('administrative_data');
282 282
 
283
-			$delivery = $this->oai->createElement('delivery');
283
+            $delivery = $this->oai->createElement('delivery');
284 284
 
285
-			$update = $this->oai->createElement('update_status');
285
+            $update = $this->oai->createElement('update_status');
286 286
 
287
-			$transfer = $this->oai->createElement('transfer');
287
+            $transfer = $this->oai->createElement('transfer');
288 288
 
289
-			$format = $this->oai->createElement('format', 'text/html');
289
+            $format = $this->oai->createElement('format', 'text/html');
290 290
 
291
-			// Add record data without qualified namespace.
292
-			$record = $this->oai->createElement('record');
291
+            // Add record data without qualified namespace.
292
+            $record = $this->oai->createElement('record');
293 293
 
294
-			$identifier = $this->oai->createElement('identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8'));
294
+            $identifier = $this->oai->createElement('identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8'));
295 295
 
296
-			$resource = $this->oai->createElement('resource');
296
+            $resource = $this->oai->createElement('resource');
297 297
 
298
-			$ident = $this->oai->createElement('identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8'));
298
+            $ident = $this->oai->createElement('identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8'));
299 299
 
300
-		}
300
+        }
301 301
 
302
-		// Add attributes and build XML tree.
303
-		$epicur->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
302
+        // Add attributes and build XML tree.
303
+        $epicur->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
304 304
 
305
-		$epicur->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['epicur']['namespace'].' '.$this->formats['epicur']['schema']);
305
+        $epicur->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['epicur']['namespace'].' '.$this->formats['epicur']['schema']);
306 306
 
307
-		// Do we update an URN or register a new one?
308
-		if ($metadata['tstamp'] == $metadata['crdate']) {
307
+        // Do we update an URN or register a new one?
308
+        if ($metadata['tstamp'] == $metadata['crdate']) {
309 309
 
310
-			$update->setAttribute('type', 'urn_new');
310
+            $update->setAttribute('type', 'urn_new');
311 311
 
312
-		} else {
312
+        } else {
313 313
 
314
-			$update->setAttribute('type', 'url_update_general');
314
+            $update->setAttribute('type', 'url_update_general');
315 315
 
316
-		}
316
+        }
317 317
 
318
-		$delivery->appendChild($update);
318
+        $delivery->appendChild($update);
319 319
 
320
-		$transfer->setAttribute('type', 'http');
320
+        $transfer->setAttribute('type', 'http');
321 321
 
322
-		$delivery->appendChild($transfer);
322
+        $delivery->appendChild($transfer);
323 323
 
324
-		$admin->appendChild($delivery);
324
+        $admin->appendChild($delivery);
325 325
 
326
-		$epicur->appendChild($admin);
326
+        $epicur->appendChild($admin);
327 327
 
328
-		$identifier->setAttribute('scheme', 'urn:nbn:de');
328
+        $identifier->setAttribute('scheme', 'urn:nbn:de');
329 329
 
330
-		$record->appendChild($identifier);
330
+        $record->appendChild($identifier);
331 331
 
332
-		$ident->setAttribute('scheme', 'url');
332
+        $ident->setAttribute('scheme', 'url');
333 333
 
334
-		$ident->setAttribute('type', 'frontpage');
334
+        $ident->setAttribute('type', 'frontpage');
335 335
 
336
-		$ident->setAttribute('role', 'primary');
336
+        $ident->setAttribute('role', 'primary');
337 337
 
338
-		$resource->appendChild($ident);
338
+        $resource->appendChild($ident);
339 339
 
340
-		$format->setAttribute('scheme', 'imt');
340
+        $format->setAttribute('scheme', 'imt');
341 341
 
342
-		$resource->appendChild($format);
342
+        $resource->appendChild($format);
343 343
 
344
-		$record->appendChild($resource);
344
+        $record->appendChild($resource);
345 345
 
346
-		$epicur->appendChild($record);
346
+        $epicur->appendChild($record);
347 347
 
348
-		return $epicur;
348
+        return $epicur;
349 349
 
350
-	}
350
+    }
351 351
 
352
-	/**
353
-	 * Get METS data.
354
-	 * @see http://www.loc.gov/standards/mets/docs/mets.v1-7.html
355
-	 *
356
-	 * @access	protected
357
-	 *
358
-	 * @param	array		$metadata: The metadata array
359
-	 *
360
-	 * @return	DOMElement		XML node to add to the OAI response
361
-	 */
362
-	protected function getMetsData(array $metadata) {
352
+    /**
353
+     * Get METS data.
354
+     * @see http://www.loc.gov/standards/mets/docs/mets.v1-7.html
355
+     *
356
+     * @access	protected
357
+     *
358
+     * @param	array		$metadata: The metadata array
359
+     *
360
+     * @return	DOMElement		XML node to add to the OAI response
361
+     */
362
+    protected function getMetsData(array $metadata) {
363 363
 
364
-		$mets = NULL;
364
+        $mets = NULL;
365 365
 
366
-		// Load METS file.
367
-		$xml = new DOMDocument();
366
+        // Load METS file.
367
+        $xml = new DOMDocument();
368 368
 
369
-		if ($xml->load($metadata['location'])) {
369
+        if ($xml->load($metadata['location'])) {
370 370
 
371
-			// Get root element.
372
-			$root = $xml->getElementsByTagNameNS($this->formats['mets']['namespace'], 'mets');
371
+            // Get root element.
372
+            $root = $xml->getElementsByTagNameNS($this->formats['mets']['namespace'], 'mets');
373 373
 
374
-			if ($root->item(0) instanceof DOMNode) {
374
+            if ($root->item(0) instanceof DOMNode) {
375 375
 
376
-				// Import node into DOMDocument.
377
-				$mets = $this->oai->importNode($root->item(0), TRUE);
376
+                // Import node into DOMDocument.
377
+                $mets = $this->oai->importNode($root->item(0), TRUE);
378 378
 
379
-			} else {
379
+            } else {
380 380
 
381
-				if (TYPO3_DLOG) {
381
+                if (TYPO3_DLOG) {
382 382
 
383
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->getMetsData([data])] No METS part found in document with location "'.$location.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $metadata);
383
+                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->getMetsData([data])] No METS part found in document with location "'.$location.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $metadata);
384 384
 
385
-				}
385
+                }
386 386
 
387
-			}
387
+            }
388 388
 
389
-		} else {
389
+        } else {
390 390
 
391
-			if (TYPO3_DLOG) {
391
+            if (TYPO3_DLOG) {
392 392
 
393
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->getMetsData([data])] Could not load XML file from "'.$location.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $metadata);
393
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->getMetsData([data])] Could not load XML file from "'.$location.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $metadata);
394 394
 
395
-			}
395
+            }
396 396
 
397
-		}
397
+        }
398 398
 
399
-		if ($mets === NULL) {
399
+        if ($mets === NULL) {
400 400
 
401
-			$mets = $this->oai->createElementNS('http://kitodo.org/', 'kitodo:error', htmlspecialchars($this->pi_getLL('error', 'Error!', FALSE), ENT_NOQUOTES, 'UTF-8'));
401
+            $mets = $this->oai->createElementNS('http://kitodo.org/', 'kitodo:error', htmlspecialchars($this->pi_getLL('error', 'Error!', FALSE), ENT_NOQUOTES, 'UTF-8'));
402 402
 
403
-		}
403
+        }
404 404
 
405
-		return $mets;
405
+        return $mets;
406 406
 
407
-	}
407
+    }
408 408
 
409
-	/**
410
-	 * The main method of the PlugIn
411
-	 *
412
-	 * @access	public
413
-	 *
414
-	 * @param	string		$content: The PlugIn content
415
-	 * @param	array		$conf: The PlugIn configuration
416
-	 *
417
-	 * @return	void
418
-	 */
419
-	public function main($content, $conf) {
409
+    /**
410
+     * The main method of the PlugIn
411
+     *
412
+     * @access	public
413
+     *
414
+     * @param	string		$content: The PlugIn content
415
+     * @param	array		$conf: The PlugIn configuration
416
+     *
417
+     * @return	void
418
+     */
419
+    public function main($content, $conf) {
420 420
 
421
-		// Initialize plugin.
422
-		$this->init($conf);
421
+        // Initialize plugin.
422
+        $this->init($conf);
423 423
 
424
-		// Turn cache off.
425
-		$this->setCache(FALSE);
424
+        // Turn cache off.
425
+        $this->setCache(FALSE);
426 426
 
427
-		// Get GET and POST variables.
428
-		$this->getUrlParams();
427
+        // Get GET and POST variables.
428
+        $this->getUrlParams();
429 429
 
430
-		// Delete expired resumption tokens.
431
-		$this->deleteExpiredTokens();
430
+        // Delete expired resumption tokens.
431
+        $this->deleteExpiredTokens();
432 432
 
433
-		// Create XML document.
434
-		$this->oai = new DOMDocument('1.0', 'UTF-8');
433
+        // Create XML document.
434
+        $this->oai = new DOMDocument('1.0', 'UTF-8');
435 435
 
436
-		// Add processing instruction (aka XSL stylesheet).
437
-		if (!empty($this->conf['stylesheet'])) {
436
+        // Add processing instruction (aka XSL stylesheet).
437
+        if (!empty($this->conf['stylesheet'])) {
438 438
 
439
-			// Resolve "EXT:" prefix in file path.
440
-			if (substr($this->conf['stylesheet'], 0, 4) == 'EXT:') {
439
+            // Resolve "EXT:" prefix in file path.
440
+            if (substr($this->conf['stylesheet'], 0, 4) == 'EXT:') {
441 441
 
442
-				list ($extKey, $filePath) = explode('/', substr($this->conf['stylesheet'], 4), 2);
442
+                list ($extKey, $filePath) = explode('/', substr($this->conf['stylesheet'], 4), 2);
443 443
 
444
-				if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey)) {
444
+                if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey)) {
445 445
 
446
-					$this->conf['stylesheet'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey).$filePath;
446
+                    $this->conf['stylesheet'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey).$filePath;
447 447
 
448
-				}
448
+                }
449 449
 
450
-			}
450
+            }
451 451
 
452
-			$stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->conf['stylesheet']);
452
+            $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->conf['stylesheet']);
453 453
 
454
-		} else {
454
+        } else {
455 455
 
456
-			// Use default stylesheet if no custom stylesheet is given.
457
-			$stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/oai/transform.xsl');
456
+            // Use default stylesheet if no custom stylesheet is given.
457
+            $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/oai/transform.xsl');
458 458
 
459
-		}
459
+        }
460 460
 
461
-		$this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8').'"'));
461
+        $this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8').'"'));
462 462
 
463
-		// Create root element.
464
-		$root = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'OAI-PMH');
463
+        // Create root element.
464
+        $root = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'OAI-PMH');
465 465
 
466
-		$root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
466
+        $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
467 467
 
468
-		$root->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', 'http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd');
468
+        $root->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', 'http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd');
469 469
 
470
-		// Add response date.
471
-		$root->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'responseDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'])));
470
+        // Add response date.
471
+        $root->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'responseDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'])));
472 472
 
473
-		// Get response data.
474
-		switch ($this->piVars['verb']) {
473
+        // Get response data.
474
+        switch ($this->piVars['verb']) {
475 475
 
476
-			case 'GetRecord':
476
+            case 'GetRecord':
477 477
 
478
-				$response = $this->verbGetRecord();
478
+                $response = $this->verbGetRecord();
479 479
 
480
-				break;
480
+                break;
481 481
 
482
-			case 'Identify':
482
+            case 'Identify':
483 483
 
484
-				$response = $this->verbIdentify();
484
+                $response = $this->verbIdentify();
485 485
 
486
-				break;
486
+                break;
487 487
 
488
-			case 'ListIdentifiers':
488
+            case 'ListIdentifiers':
489 489
 
490
-				$response = $this->verbListIdentifiers();
490
+                $response = $this->verbListIdentifiers();
491 491
 
492
-				break;
492
+                break;
493 493
 
494
-			case 'ListMetadataFormats':
494
+            case 'ListMetadataFormats':
495 495
 
496
-				$response = $this->verbListMetadataFormats();
496
+                $response = $this->verbListMetadataFormats();
497 497
 
498
-				break;
498
+                break;
499 499
 
500
-			case 'ListRecords':
500
+            case 'ListRecords':
501 501
 
502
-				$response = $this->verbListRecords();
502
+                $response = $this->verbListRecords();
503 503
 
504
-				break;
504
+                break;
505 505
 
506
-			case 'ListSets':
506
+            case 'ListSets':
507 507
 
508
-				$response = $this->verbListSets();
508
+                $response = $this->verbListSets();
509 509
 
510
-				break;
510
+                break;
511 511
 
512
-			default:
512
+            default:
513 513
 
514
-				$response = $this->error('badVerb');
514
+                $response = $this->error('badVerb');
515 515
 
516
-		}
516
+        }
517 517
 
518
-		// Add request.
519
-		$linkConf = array (
520
-			'parameter' => $GLOBALS['TSFE']->id,
521
-			'forceAbsoluteUrl' => 1
522
-		);
518
+        // Add request.
519
+        $linkConf = array (
520
+            'parameter' => $GLOBALS['TSFE']->id,
521
+            'forceAbsoluteUrl' => 1
522
+        );
523 523
 
524
-		$request = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'request', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8'));
524
+        $request = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'request', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8'));
525 525
 
526
-		if (!$this->error) {
526
+        if (!$this->error) {
527 527
 
528
-			foreach ($this->piVars as $key => $value) {
528
+            foreach ($this->piVars as $key => $value) {
529 529
 
530
-				$request->setAttribute($key, htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8'));
530
+                $request->setAttribute($key, htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8'));
531 531
 
532
-			}
532
+            }
533 533
 
534
-		}
534
+        }
535 535
 
536
-		$root->appendChild($request);
536
+        $root->appendChild($request);
537 537
 
538
-		// Add response data.
539
-		$root->appendChild($response);
538
+        // Add response data.
539
+        $root->appendChild($response);
540 540
 
541
-		// Build XML output.
542
-		$this->oai->appendChild($root);
541
+        // Build XML output.
542
+        $this->oai->appendChild($root);
543 543
 
544
-		$content = $this->oai->saveXML();
544
+        $content = $this->oai->saveXML();
545 545
 
546
-		// Clean output buffer.
547
-		\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
546
+        // Clean output buffer.
547
+        \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
548 548
 
549
-		// Send headers.
550
-		header('HTTP/1.1 200 OK');
549
+        // Send headers.
550
+        header('HTTP/1.1 200 OK');
551 551
 
552
-		header('Cache-Control: no-cache');
552
+        header('Cache-Control: no-cache');
553 553
 
554
-		header('Content-Length: '.strlen($content));
554
+        header('Content-Length: '.strlen($content));
555 555
 
556
-		header('Content-Type: text/xml; charset=utf-8');
556
+        header('Content-Type: text/xml; charset=utf-8');
557 557
 
558
-		header('Date: '.date('r', $GLOBALS['EXEC_TIME']));
558
+        header('Date: '.date('r', $GLOBALS['EXEC_TIME']));
559 559
 
560
-		header('Expires: '.date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
560
+        header('Expires: '.date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
561 561
 
562
-		echo $content;
562
+        echo $content;
563 563
 
564
-		// Flush output buffer and end script processing.
565
-		ob_end_flush();
564
+        // Flush output buffer and end script processing.
565
+        ob_end_flush();
566 566
 
567
-		exit;
567
+        exit;
568 568
 
569
-	}
569
+    }
570 570
 
571
-	/**
572
-	 * Continue with resumption token
573
-	 *
574
-	 * @access	protected
575
-	 *
576
-	 * @return	string		Substitution for subpart "###RESPONSE###"
577
-	 */
578
-	protected function resume() {
571
+    /**
572
+     * Continue with resumption token
573
+     *
574
+     * @access	protected
575
+     *
576
+     * @return	string		Substitution for subpart "###RESPONSE###"
577
+     */
578
+    protected function resume() {
579 579
 
580
-		// Get resumption token.
581
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
582
-			'tx_dlf_tokens.options AS options',
583
-			'tx_dlf_tokens',
584
-			'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.token='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['resumptionToken'], 'tx_dlf_tokens'),
585
-			'',
586
-			'',
587
-			'1'
588
-		);
580
+        // Get resumption token.
581
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
582
+            'tx_dlf_tokens.options AS options',
583
+            'tx_dlf_tokens',
584
+            'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.token='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['resumptionToken'], 'tx_dlf_tokens'),
585
+            '',
586
+            '',
587
+            '1'
588
+        );
589 589
 
590
-		if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
590
+        if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
591 591
 
592
-			// No resumption token found or resumption token expired.
593
-			return $this->error('badResumptionToken');
592
+            // No resumption token found or resumption token expired.
593
+            return $this->error('badResumptionToken');
594 594
 
595
-		}
595
+        }
596 596
 
597
-		$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
597
+        $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
598 598
 
599
-		$resultSet = unserialize($resArray['options']);
599
+        $resultSet = unserialize($resArray['options']);
600 600
 
601
-		$complete = FALSE;
601
+        $complete = FALSE;
602 602
 
603
-		$todo = array ();
603
+        $todo = array ();
604 604
 
605
-		$resume = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', $this->piVars['verb']);
605
+        $resume = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', $this->piVars['verb']);
606 606
 
607
-		for ($i = $resultSet->metadata['offset'], $j = intval($resultSet->metadata['offset'] + $this->conf['limit']); $i < $j; $i++) {
607
+        for ($i = $resultSet->metadata['offset'], $j = intval($resultSet->metadata['offset'] + $this->conf['limit']); $i < $j; $i++) {
608 608
 
609
-			$todo[] = $resultSet[$i];
609
+            $todo[] = $resultSet[$i];
610 610
 
611
-			if (empty($resultSet[$i + 1])) {
611
+            if (empty($resultSet[$i + 1])) {
612 612
 
613
-				$complete = TRUE;
613
+                $complete = TRUE;
614 614
 
615
-				break;
615
+                break;
616 616
 
617
-			}
617
+            }
618 618
 
619
-		}
619
+        }
620 620
 
621
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
622
-			'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
623
-			'tx_dlf_documents',
624
-			'tx_dlf_relations',
625
-			'tx_dlf_collections',
626
-			'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($todo)).') AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
627
-			'tx_dlf_documents.uid',
628
-			'tx_dlf_documents.tstamp',
629
-			$this->conf['limit']
630
-		);
621
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
622
+            'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
623
+            'tx_dlf_documents',
624
+            'tx_dlf_relations',
625
+            'tx_dlf_collections',
626
+            'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($todo)).') AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
627
+            'tx_dlf_documents.uid',
628
+            'tx_dlf_documents.tstamp',
629
+            $this->conf['limit']
630
+        );
631 631
 
632
-		while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
632
+        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
633 633
 
634
-			// Add header node.
635
-			$header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header');
634
+            // Add header node.
635
+            $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header');
636 636
 
637
-			$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8')));
637
+            $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8')));
638 638
 
639
-			$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp'])));
639
+            $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp'])));
640 640
 
641
-			// Check if document is deleted or hidden.
642
-			// TODO: Use TYPO3 API functions here!
643
-			if ($resArray['deleted'] || $resArray['hidden']) {
641
+            // Check if document is deleted or hidden.
642
+            // TODO: Use TYPO3 API functions here!
643
+            if ($resArray['deleted'] || $resArray['hidden']) {
644 644
 
645
-				// Add "deleted" status.
646
-				$header->setAttribute('status', 'deleted');
645
+                // Add "deleted" status.
646
+                $header->setAttribute('status', 'deleted');
647 647
 
648
-				if ($this->piVars['verb'] == 'ListRecords') {
648
+                if ($this->piVars['verb'] == 'ListRecords') {
649 649
 
650
-					// Add record node.
651
-					$record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
650
+                    // Add record node.
651
+                    $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
652 652
 
653
-					$record->appendChild($header);
653
+                    $record->appendChild($header);
654 654
 
655
-					$resume->appendChild($record);
655
+                    $resume->appendChild($record);
656 656
 
657
-				} elseif ($this->piVars['verb'] == 'ListIdentifiers') {
657
+                } elseif ($this->piVars['verb'] == 'ListIdentifiers') {
658 658
 
659
-					$resume->appendChild($header);
659
+                    $resume->appendChild($header);
660 660
 
661
-				}
661
+                }
662 662
 
663
-			} else {
663
+            } else {
664 664
 
665
-				// Add sets.
666
-				foreach (explode(' ', $resArray['collections']) as $spec) {
665
+                // Add sets.
666
+                foreach (explode(' ', $resArray['collections']) as $spec) {
667 667
 
668
-					$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8')));
668
+                    $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8')));
669 669
 
670
-				}
670
+                }
671 671
 
672
-				if ($this->piVars['verb'] == 'ListRecords') {
672
+                if ($this->piVars['verb'] == 'ListRecords') {
673 673
 
674
-					// Add record node.
675
-					$record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
674
+                    // Add record node.
675
+                    $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
676 676
 
677
-					$record->appendChild($header);
677
+                    $record->appendChild($header);
678 678
 
679
-					// Add metadata node.
680
-					$metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata');
679
+                    // Add metadata node.
680
+                    $metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata');
681 681
 
682
-					switch ($resultSet->metadata['metadataPrefix']) {
682
+                    switch ($resultSet->metadata['metadataPrefix']) {
683 683
 
684
-						case 'oai_dc':
684
+                        case 'oai_dc':
685 685
 
686
-							$metadata->appendChild($this->getDcData($resArray));
686
+                            $metadata->appendChild($this->getDcData($resArray));
687 687
 
688
-							break;
688
+                            break;
689 689
 
690
-						case 'epicur':
690
+                        case 'epicur':
691 691
 
692
-							$metadata->appendChild($this->getEpicurData($resArray));
692
+                            $metadata->appendChild($this->getEpicurData($resArray));
693 693
 
694
-							break;
694
+                            break;
695 695
 
696
-						case 'mets':
696
+                        case 'mets':
697 697
 
698
-							$metadata->appendChild($this->getMetsData($resArray));
698
+                            $metadata->appendChild($this->getMetsData($resArray));
699 699
 
700
-							break;
700
+                            break;
701 701
 
702
-					}
702
+                    }
703 703
 
704
-					$record->appendChild($metadata);
704
+                    $record->appendChild($metadata);
705 705
 
706
-					$resume->appendChild($record);
706
+                    $resume->appendChild($record);
707 707
 
708
-				} elseif ($this->piVars['verb'] == 'ListIdentifiers') {
708
+                } elseif ($this->piVars['verb'] == 'ListIdentifiers') {
709 709
 
710
-					$resume->appendChild($header);
710
+                    $resume->appendChild($header);
711 711
 
712
-				}
712
+                }
713 713
 
714
-			}
714
+            }
715 715
 
716
-		}
716
+        }
717 717
 
718
-		if (!$complete) {
718
+        if (!$complete) {
719 719
 
720
-			// Save result set to database and generate resumption token.
721
-			$token = uniqid();
720
+            // Save result set to database and generate resumption token.
721
+            $token = uniqid();
722 722
 
723
-			$resultSet->metadata = array (
724
-				'offset' => intval($resultSet->metadata['offset'] + $this->conf['limit']),
725
-				'metadataPrefix' => $resultSet->metadata['metadataPrefix'],
726
-			);
723
+            $resultSet->metadata = array (
724
+                'offset' => intval($resultSet->metadata['offset'] + $this->conf['limit']),
725
+                'metadataPrefix' => $resultSet->metadata['metadataPrefix'],
726
+            );
727 727
 
728
-			$result = $GLOBALS['TYPO3_DB']->exec_INSERTquery(
729
-				'tx_dlf_tokens',
730
-				array (
731
-					'tstamp' => $GLOBALS['EXEC_TIME'],
732
-					'token' => $token,
733
-					'options' => serialize($resultSet),
734
-					'ident' => 'oai',
735
-				)
736
-			);
728
+            $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery(
729
+                'tx_dlf_tokens',
730
+                array (
731
+                    'tstamp' => $GLOBALS['EXEC_TIME'],
732
+                    'token' => $token,
733
+                    'options' => serialize($resultSet),
734
+                    'ident' => 'oai',
735
+                )
736
+            );
737 737
 
738
-			if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) {
738
+            if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) {
739 739
 
740
-				$resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
740
+                $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
741 741
 
742
-			} else {
742
+            } else {
743 743
 
744
-				if (TYPO3_DLOG) {
744
+                if (TYPO3_DLOG) {
745 745
 
746
-					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->resume()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR);
746
+                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->resume()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR);
747 747
 
748
-				}
748
+                }
749 749
 
750
-			}
750
+            }
751 751
 
752
-		} else {
752
+        } else {
753 753
 
754
-			// Result set complete. No more resumption token needed.
755
-			$resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken');
754
+            // Result set complete. No more resumption token needed.
755
+            $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken');
756 756
 
757
-		}
757
+        }
758 758
 
759
-		$resumptionToken->setAttribute('cursor', $resultSet->metadata['offset']);
759
+        $resumptionToken->setAttribute('cursor', $resultSet->metadata['offset']);
760 760
 
761
-		$resumptionToken->setAttribute('completeListSize', count($resultSet));
761
+        $resumptionToken->setAttribute('completeListSize', count($resultSet));
762 762
 
763
-		$resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
763
+        $resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
764 764
 
765
-		$resume->appendChild($resumptionToken);
765
+        $resume->appendChild($resumptionToken);
766 766
 
767
-		return $resume;
767
+        return $resume;
768 768
 
769
-	}
769
+    }
770 770
 
771
-	/**
772
-	 * Process verb "GetRecord"
773
-	 *
774
-	 * @access	protected
775
-	 *
776
-	 * @return	string		Substitution for subpart "###RESPONSE###"
777
-	 */
778
-	protected function verbGetRecord() {
771
+    /**
772
+     * Process verb "GetRecord"
773
+     *
774
+     * @access	protected
775
+     *
776
+     * @return	string		Substitution for subpart "###RESPONSE###"
777
+     */
778
+    protected function verbGetRecord() {
779 779
 
780
-		// Check for invalid arguments.
781
-		if (count($this->piVars) != 3 || empty($this->piVars['metadataPrefix']) || empty($this->piVars['identifier'])) {
780
+        // Check for invalid arguments.
781
+        if (count($this->piVars) != 3 || empty($this->piVars['metadataPrefix']) || empty($this->piVars['identifier'])) {
782 782
 
783
-			return $this->error('badArgument');
783
+            return $this->error('badArgument');
784 784
 
785
-		} else {
785
+        } else {
786 786
 
787
-			// Check "metadataPrefix" for valid value.
788
-			if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) {
787
+            // Check "metadataPrefix" for valid value.
788
+            if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) {
789 789
 
790
-				return $this->error('cannotDisseminateFormat');
790
+                return $this->error('cannotDisseminateFormat');
791 791
 
792
-			}
792
+            }
793 793
 
794
-			$where = '';
794
+            $where = '';
795 795
 
796
-			// Select records from database.
797
-			if (!$this->conf['show_userdefined']) {
796
+            // Select records from database.
797
+            if (!$this->conf['show_userdefined']) {
798 798
 
799
-				$where .= ' AND tx_dlf_collections.fe_cruser_id=0';
799
+                $where .= ' AND tx_dlf_collections.fe_cruser_id=0';
800 800
 
801
-			}
801
+            }
802 802
 
803
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
804
-				'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
805
-				'tx_dlf_documents',
806
-				'tx_dlf_relations',
807
-				'tx_dlf_collections',
808
-				'AND tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['identifier'], 'tx_dlf_documents').' AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
809
-				'tx_dlf_documents.uid',
810
-				'tx_dlf_documents.tstamp',
811
-				'1'
812
-			);
803
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
804
+                'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
805
+                'tx_dlf_documents',
806
+                'tx_dlf_relations',
807
+                'tx_dlf_collections',
808
+                'AND tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['identifier'], 'tx_dlf_documents').' AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
809
+                'tx_dlf_documents.uid',
810
+                'tx_dlf_documents.tstamp',
811
+                '1'
812
+            );
813 813
 
814
-			if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
814
+            if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
815 815
 
816
-				return $this->error('idDoesNotExist');
816
+                return $this->error('idDoesNotExist');
817 817
 
818
-			} else {
818
+            } else {
819 819
 
820
-				$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
820
+                $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
821 821
 
822
-				// Check for required fields.
823
-				foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
822
+                // Check for required fields.
823
+                foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
824 824
 
825
-					if (empty($resArray[$required])) {
825
+                    if (empty($resArray[$required])) {
826 826
 
827
-						return $this->error('cannotDisseminateFormat');
827
+                        return $this->error('cannotDisseminateFormat');
828 828
 
829
-					}
829
+                    }
830 830
 
831
-				}
831
+                }
832 832
 
833
-				// Add record node.
834
-				$GetRecord = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'GetRecord');
833
+                // Add record node.
834
+                $GetRecord = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'GetRecord');
835 835
 
836
-				$record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
836
+                $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
837 837
 
838
-				// Add header node.
839
-				$header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header');
838
+                // Add header node.
839
+                $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header');
840 840
 
841
-				$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8')));
841
+                $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8')));
842 842
 
843
-				$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp'])));
843
+                $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp'])));
844 844
 
845
-				// Handle deleted documents.
846
-				// TODO: Use TYPO3 API functions here!
847
-				if ($resArray['deleted'] || $resArray['hidden']) {
845
+                // Handle deleted documents.
846
+                // TODO: Use TYPO3 API functions here!
847
+                if ($resArray['deleted'] || $resArray['hidden']) {
848 848
 
849
-					$header->setAttribute('status', 'deleted');
849
+                    $header->setAttribute('status', 'deleted');
850 850
 
851
-					$record->appendChild($header);
851
+                    $record->appendChild($header);
852 852
 
853
-				} else {
853
+                } else {
854 854
 
855
-					foreach (explode(' ', $resArray['collections']) as $spec) {
855
+                    foreach (explode(' ', $resArray['collections']) as $spec) {
856 856
 
857
-						$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8')));
857
+                        $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8')));
858 858
 
859
-					}
859
+                    }
860 860
 
861
-					$record->appendChild($header);
861
+                    $record->appendChild($header);
862 862
 
863
-					// Add metadata node.
864
-					$metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata');
863
+                    // Add metadata node.
864
+                    $metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata');
865 865
 
866
-					switch ($this->piVars['metadataPrefix']) {
866
+                    switch ($this->piVars['metadataPrefix']) {
867 867
 
868
-						case 'oai_dc':
868
+                        case 'oai_dc':
869 869
 
870
-							$metadata->appendChild($this->getDcData($resArray));
870
+                            $metadata->appendChild($this->getDcData($resArray));
871 871
 
872
-							break;
872
+                            break;
873 873
 
874
-						case 'epicur':
874
+                        case 'epicur':
875 875
 
876
-							$metadata->appendChild($this->getEpicurData($resArray));
876
+                            $metadata->appendChild($this->getEpicurData($resArray));
877 877
 
878
-							break;
878
+                            break;
879 879
 
880
-						case 'mets':
880
+                        case 'mets':
881 881
 
882
-							$metadata->appendChild($this->getMetsData($resArray));
882
+                            $metadata->appendChild($this->getMetsData($resArray));
883 883
 
884
-							break;
884
+                            break;
885 885
 
886
-					}
886
+                    }
887 887
 
888
-					$record->appendChild($metadata);
888
+                    $record->appendChild($metadata);
889 889
 
890
-				}
890
+                }
891 891
 
892
-				$GetRecord->appendChild($record);
892
+                $GetRecord->appendChild($record);
893 893
 
894
-				return $GetRecord;
894
+                return $GetRecord;
895 895
 
896
-			}
896
+            }
897 897
 
898
-		}
898
+        }
899 899
 
900
-	}
900
+    }
901 901
 
902
-	/**
903
-	 * Process verb "Identify"
904
-	 *
905
-	 * @access	protected
906
-	 *
907
-	 * @return	DOMElement		XML node to add to the OAI response
908
-	 */
909
-	protected function verbIdentify() {
902
+    /**
903
+     * Process verb "Identify"
904
+     *
905
+     * @access	protected
906
+     *
907
+     * @return	DOMElement		XML node to add to the OAI response
908
+     */
909
+    protected function verbIdentify() {
910 910
 
911
-		// Check for invalid arguments.
912
-		if (count($this->piVars) > 1) {
911
+        // Check for invalid arguments.
912
+        if (count($this->piVars) > 1) {
913 913
 
914
-			return $this->error('badArgument');
914
+            return $this->error('badArgument');
915 915
 
916
-		}
916
+        }
917 917
 
918
-		// Get repository name and administrative contact.
919
-		// Use default values for an installation with incomplete plugin configuration.
918
+        // Get repository name and administrative contact.
919
+        // Use default values for an installation with incomplete plugin configuration.
920 920
 
921
-		$adminEmail = '[email protected]';
922
-		$repositoryName = 'Kitodo.Presentation OAI-PMH interface (incomplete configuration)';
921
+        $adminEmail = '[email protected]';
922
+        $repositoryName = 'Kitodo.Presentation OAI-PMH interface (incomplete configuration)';
923 923
 
924
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
925
-			'tx_dlf_libraries.oai_label AS oai_label,tx_dlf_libraries.contact AS contact',
926
-			'tx_dlf_libraries',
927
-			'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'),
928
-			'',
929
-			'',
930
-			''
931
-		);
924
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
925
+            'tx_dlf_libraries.oai_label AS oai_label,tx_dlf_libraries.contact AS contact',
926
+            'tx_dlf_libraries',
927
+            'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'),
928
+            '',
929
+            '',
930
+            ''
931
+        );
932 932
 
933
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
933
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
934 934
 
935
-			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
935
+            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
936 936
 
937
-			$adminEmail = htmlspecialchars(trim(str_replace('mailto:', '', $resArray['contact'])), ENT_NOQUOTES);
938
-			$repositoryName = htmlspecialchars($resArray['oai_label'], ENT_NOQUOTES);
937
+            $adminEmail = htmlspecialchars(trim(str_replace('mailto:', '', $resArray['contact'])), ENT_NOQUOTES);
938
+            $repositoryName = htmlspecialchars($resArray['oai_label'], ENT_NOQUOTES);
939 939
 
940
-		} else {
940
+        } else {
941 941
 
942
-			if (TYPO3_DLOG) {
942
+            if (TYPO3_DLOG) {
943 943
 
944
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbIdentify()] Incomplete plugin configuration',
945
-						  $this->extKey, SYSLOG_SEVERITY_NOTICE);
944
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbIdentify()] Incomplete plugin configuration',
945
+                            $this->extKey, SYSLOG_SEVERITY_NOTICE);
946 946
 
947
-			}
947
+            }
948 948
 
949
-		}
949
+        }
950 950
 
951
-		// Get earliest datestamp. Use a default value if that fails.
951
+        // Get earliest datestamp. Use a default value if that fails.
952 952
 
953
-		$earliestDatestamp = '0000-00-00T00:00:00Z';
953
+        $earliestDatestamp = '0000-00-00T00:00:00Z';
954 954
 
955
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
956
-			'tx_dlf_documents.tstamp AS tstamp',
957
-			'tx_dlf_documents',
958
-			'tx_dlf_documents.pid=' . intval($this->conf['pages']),
959
-			'',
960
-			'tx_dlf_documents.tstamp ASC',
961
-			'1'
962
-		);
955
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
956
+            'tx_dlf_documents.tstamp AS tstamp',
957
+            'tx_dlf_documents',
958
+            'tx_dlf_documents.pid=' . intval($this->conf['pages']),
959
+            '',
960
+            'tx_dlf_documents.tstamp ASC',
961
+            '1'
962
+        );
963 963
 
964
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
964
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
965 965
 
966
-			list ($timestamp) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
967
-			$earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
966
+            list ($timestamp) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
967
+            $earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
968 968
 
969
-		} else {
969
+        } else {
970 970
 
971
-			if (TYPO3_DLOG) {
971
+            if (TYPO3_DLOG) {
972 972
 
973
-				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbIdentify()] No records found with PID "' .
974
-						  $this->conf['pages'] . '"', $this->extKey, SYSLOG_SEVERITY_NOTICE);
973
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbIdentify()] No records found with PID "' .
974
+                            $this->conf['pages'] . '"', $this->extKey, SYSLOG_SEVERITY_NOTICE);
975 975
 
976
-			}
976
+            }
977 977
 
978
-		}
978
+        }
979 979
 
980
-		$linkConf = array (
981
-			'parameter' => $GLOBALS['TSFE']->id,
982
-			'forceAbsoluteUrl' => 1
983
-		);
984
-		$baseURL = htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES);
980
+        $linkConf = array (
981
+            'parameter' => $GLOBALS['TSFE']->id,
982
+            'forceAbsoluteUrl' => 1
983
+        );
984
+        $baseURL = htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES);
985 985
 
986
-		// Add identification node.
987
-		$Identify = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'Identify');
988
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
989
-								   'repositoryName', $repositoryName));
990
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
991
-								   'baseURL', $baseURL));
992
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
993
-								   'protocolVersion', '2.0'));
994
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
995
-								   'adminEmail', $adminEmail));
996
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
997
-								   'earliestDatestamp', $earliestDatestamp));
998
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
999
-								   'deletedRecord', 'transient'));
1000
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
1001
-								   'granularity', 'YYYY-MM-DDThh:mm:ssZ'));
986
+        // Add identification node.
987
+        $Identify = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'Identify');
988
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
989
+                                    'repositoryName', $repositoryName));
990
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
991
+                                    'baseURL', $baseURL));
992
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
993
+                                    'protocolVersion', '2.0'));
994
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
995
+                                    'adminEmail', $adminEmail));
996
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
997
+                                    'earliestDatestamp', $earliestDatestamp));
998
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
999
+                                    'deletedRecord', 'transient'));
1000
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/',
1001
+                                    'granularity', 'YYYY-MM-DDThh:mm:ssZ'));
1002 1002
 
1003
-		return $Identify;
1004
-	}
1003
+        return $Identify;
1004
+    }
1005 1005
 
1006
-	/**
1007
-	 * Process verb "ListIdentifiers"
1008
-	 *
1009
-	 * @access	protected
1010
-	 *
1011
-	 * @return	string		Substitution for subpart "###RESPONSE###"
1012
-	 */
1013
-	protected function verbListIdentifiers() {
1006
+    /**
1007
+     * Process verb "ListIdentifiers"
1008
+     *
1009
+     * @access	protected
1010
+     *
1011
+     * @return	string		Substitution for subpart "###RESPONSE###"
1012
+     */
1013
+    protected function verbListIdentifiers() {
1014 1014
 
1015
-		// Check for invalid arguments.
1016
-		if (!empty($this->piVars['resumptionToken'])) {
1015
+        // Check for invalid arguments.
1016
+        if (!empty($this->piVars['resumptionToken'])) {
1017 1017
 
1018
-			// "resumptionToken" is an exclusive argument.
1019
-			if (count($this->piVars) > 2) {
1018
+            // "resumptionToken" is an exclusive argument.
1019
+            if (count($this->piVars) > 2) {
1020 1020
 
1021
-				return $this->error('badArgument');
1021
+                return $this->error('badArgument');
1022 1022
 
1023
-			} else {
1023
+            } else {
1024 1024
 
1025
-				return $this->resume();
1025
+                return $this->resume();
1026 1026
 
1027
-			}
1027
+            }
1028 1028
 
1029
-		} elseif (empty($this->piVars['metadataPrefix']) || !empty($this->piVars['identifier'])) {
1029
+        } elseif (empty($this->piVars['metadataPrefix']) || !empty($this->piVars['identifier'])) {
1030 1030
 
1031
-			// "metadataPrefix" is required and "identifier" is not allowed.
1032
-			return $this->error('badArgument');
1031
+            // "metadataPrefix" is required and "identifier" is not allowed.
1032
+            return $this->error('badArgument');
1033 1033
 
1034
-		} else {
1034
+        } else {
1035 1035
 
1036
-			$where = '';
1036
+            $where = '';
1037 1037
 
1038
-			// Check "metadataPrefix" for valid value.
1039
-			if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) {
1038
+            // Check "metadataPrefix" for valid value.
1039
+            if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) {
1040 1040
 
1041
-				return $this->error('cannotDisseminateFormat');
1041
+                return $this->error('cannotDisseminateFormat');
1042 1042
 
1043
-			} else {
1043
+            } else {
1044 1044
 
1045
-				// Check for required fields.
1046
-				foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
1045
+                // Check for required fields.
1046
+                foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
1047 1047
 
1048
-					$where .= ' AND NOT tx_dlf_documents.'.$required.'=\'\'';
1048
+                    $where .= ' AND NOT tx_dlf_documents.'.$required.'=\'\'';
1049 1049
 
1050
-				}
1050
+                }
1051 1051
 
1052
-			}
1052
+            }
1053 1053
 
1054
-			// Check "set" for valid value.
1055
-			if (!empty($this->piVars['set'])) {
1054
+            // Check "set" for valid value.
1055
+            if (!empty($this->piVars['set'])) {
1056 1056
 
1057
-				// Get set information.
1058
-				$additionalWhere = '';
1057
+                // Get set information.
1058
+                $additionalWhere = '';
1059 1059
 
1060
-				if (!$this->conf['show_userdefined']) {
1060
+                if (!$this->conf['show_userdefined']) {
1061 1061
 
1062
-					$additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
1062
+                    $additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
1063 1063
 
1064
-				}
1064
+                }
1065 1065
 
1066
-				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1067
-					'tx_dlf_collections.uid AS uid',
1068
-					'tx_dlf_collections',
1069
-					'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'], 'tx_dlf_collections').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'),
1070
-					'',
1071
-					'',
1072
-					'1'
1073
-				);
1066
+                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1067
+                    'tx_dlf_collections.uid AS uid',
1068
+                    'tx_dlf_collections',
1069
+                    'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'], 'tx_dlf_collections').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'),
1070
+                    '',
1071
+                    '',
1072
+                    '1'
1073
+                );
1074 1074
 
1075
-				if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1075
+                if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1076 1076
 
1077
-					return $this->error('noSetHierarchy');
1077
+                    return $this->error('noSetHierarchy');
1078 1078
 
1079
-				} else {
1079
+                } else {
1080 1080
 
1081
-					$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
1081
+                    $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
1082 1082
 
1083
-					$where .= ' AND tx_dlf_collections.uid='.intval($resArray['uid']);
1083
+                    $where .= ' AND tx_dlf_collections.uid='.intval($resArray['uid']);
1084 1084
 
1085
-				}
1085
+                }
1086 1086
 
1087
-			}
1087
+            }
1088 1088
 
1089
-			// Check "from" for valid value.
1090
-			if (!empty($this->piVars['from'])) {
1089
+            // Check "from" for valid value.
1090
+            if (!empty($this->piVars['from'])) {
1091 1091
 
1092
-				if (is_array($from = strptime($this->piVars['from'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($from = strptime($this->piVars['from'], '%Y-%m-%d'))) {
1092
+                if (is_array($from = strptime($this->piVars['from'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($from = strptime($this->piVars['from'], '%Y-%m-%d'))) {
1093 1093
 
1094
-					$from = gmmktime($from['tm_hour'], $from['tm_min'], $from['tm_sec'], $from['tm_mon'] + 1, $from['tm_mday'], $from['tm_year'] + 1900);
1094
+                    $from = gmmktime($from['tm_hour'], $from['tm_min'], $from['tm_sec'], $from['tm_mon'] + 1, $from['tm_mday'], $from['tm_year'] + 1900);
1095 1095
 
1096
-				} else {
1096
+                } else {
1097 1097
 
1098
-					return $this->error('badArgument');
1098
+                    return $this->error('badArgument');
1099 1099
 
1100
-				}
1100
+                }
1101 1101
 
1102
-				$where .= ' AND tx_dlf_documents.tstamp>='.intval($from);
1102
+                $where .= ' AND tx_dlf_documents.tstamp>='.intval($from);
1103 1103
 
1104
-			}
1104
+            }
1105 1105
 
1106
-			// Check "until" for valid value.
1107
-			if (!empty($this->piVars['until'])) {
1106
+            // Check "until" for valid value.
1107
+            if (!empty($this->piVars['until'])) {
1108 1108
 
1109
-				if (is_array($until = strptime($this->piVars['until'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($until = strptime($this->piVars['until'], '%Y-%m-%d'))) {
1109
+                if (is_array($until = strptime($this->piVars['until'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($until = strptime($this->piVars['until'], '%Y-%m-%d'))) {
1110 1110
 
1111
-					$until = gmmktime($until['tm_hour'], $until['tm_min'], $until['tm_sec'], $until['tm_mon'] + 1, $until['tm_mday'], $until['tm_year'] + 1900);
1111
+                    $until = gmmktime($until['tm_hour'], $until['tm_min'], $until['tm_sec'], $until['tm_mon'] + 1, $until['tm_mday'], $until['tm_year'] + 1900);
1112 1112
 
1113
-				} else {
1113
+                } else {
1114 1114
 
1115
-					return $this->error('badArgument');
1115
+                    return $this->error('badArgument');
1116 1116
 
1117
-				}
1117
+                }
1118 1118
 
1119
-				if (!empty($from) && $from > $until) {
1119
+                if (!empty($from) && $from > $until) {
1120 1120
 
1121
-					return $this->error('badArgument');
1121
+                    return $this->error('badArgument');
1122 1122
 
1123
-				}
1123
+                }
1124 1124
 
1125
-				$where .= ' AND tx_dlf_documents.tstamp<='.intval($until);
1125
+                $where .= ' AND tx_dlf_documents.tstamp<='.intval($until);
1126 1126
 
1127
-			}
1127
+            }
1128 1128
 
1129
-			// Check "from" and "until" for same granularity.
1130
-			if (!empty($this->piVars['from']) && !empty($this->piVars['until'])) {
1129
+            // Check "from" and "until" for same granularity.
1130
+            if (!empty($this->piVars['from']) && !empty($this->piVars['until'])) {
1131 1131
 
1132
-				if (strlen($this->piVars['from']) != strlen($this->piVars['until'])) {
1132
+                if (strlen($this->piVars['from']) != strlen($this->piVars['until'])) {
1133 1133
 
1134
-					return $this->error('badArgument');
1134
+                    return $this->error('badArgument');
1135 1135
 
1136
-				}
1136
+                }
1137 1137
 
1138
-			}
1138
+            }
1139 1139
 
1140
-		}
1140
+        }
1141 1141
 
1142
-		// Select records from database.
1143
-		if (!$this->conf['show_userdefined']) {
1142
+        // Select records from database.
1143
+        if (!$this->conf['show_userdefined']) {
1144 1144
 
1145
-			$where .= ' AND tx_dlf_collections.fe_cruser_id=0';
1145
+            $where .= ' AND tx_dlf_collections.fe_cruser_id=0';
1146 1146
 
1147
-		}
1147
+        }
1148 1148
 
1149
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
1150
-			'tx_dlf_documents.uid',
1151
-			'tx_dlf_documents',
1152
-			'tx_dlf_relations',
1153
-			'tx_dlf_collections',
1154
-			'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
1155
-			'tx_dlf_documents.uid',
1156
-			'tx_dlf_documents.tstamp',
1157
-			''
1158
-		);
1149
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
1150
+            'tx_dlf_documents.uid',
1151
+            'tx_dlf_documents',
1152
+            'tx_dlf_relations',
1153
+            'tx_dlf_collections',
1154
+            'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
1155
+            'tx_dlf_documents.uid',
1156
+            'tx_dlf_documents.tstamp',
1157
+            ''
1158
+        );
1159 1159
 
1160
-		if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1160
+        if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1161 1161
 
1162
-			return $this->error('noRecordsMatch');
1162
+            return $this->error('noRecordsMatch');
1163 1163
 
1164
-		} else {
1164
+        } else {
1165 1165
 
1166
-			// Build result set.
1167
-			$results = array ();
1166
+            // Build result set.
1167
+            $results = array ();
1168 1168
 
1169
-			while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1169
+            while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1170 1170
 
1171
-				// Save only UIDs for resumption token.
1172
-				$results[] = $resArray['uid'];
1171
+                // Save only UIDs for resumption token.
1172
+                $results[] = $resArray['uid'];
1173 1173
 
1174
-			}
1174
+            }
1175 1175
 
1176
-			if (empty($results)) {
1176
+            if (empty($results)) {
1177 1177
 
1178
-				return $this->error('noRecordsMatch');
1178
+                return $this->error('noRecordsMatch');
1179 1179
 
1180
-			}
1180
+            }
1181 1181
 
1182
-			$complete = FALSE;
1182
+            $complete = FALSE;
1183 1183
 
1184
-			$todo = array ();
1184
+            $todo = array ();
1185 1185
 
1186
-			$ListIdentifiers = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListIdentifiers');
1186
+            $ListIdentifiers = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListIdentifiers');
1187 1187
 
1188
-			for ($i = 0, $j = intval($this->conf['limit']); $i < $j; $i++) {
1188
+            for ($i = 0, $j = intval($this->conf['limit']); $i < $j; $i++) {
1189 1189
 
1190
-				$todo[] = $results[$i];
1190
+                $todo[] = $results[$i];
1191 1191
 
1192
-				if (empty($results[$i + 1])) {
1192
+                if (empty($results[$i + 1])) {
1193 1193
 
1194
-					$complete = TRUE;
1194
+                    $complete = TRUE;
1195 1195
 
1196
-					break;
1196
+                    break;
1197 1197
 
1198
-				}
1198
+                }
1199 1199
 
1200
-			}
1200
+            }
1201 1201
 
1202
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
1203
-				'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
1204
-				'tx_dlf_documents',
1205
-				'tx_dlf_relations',
1206
-				'tx_dlf_collections',
1207
-				'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($todo)).') AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
1208
-				'tx_dlf_documents.uid',
1209
-				'tx_dlf_documents.tstamp',
1210
-				$this->conf['limit']
1211
-			);
1202
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
1203
+                'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
1204
+                'tx_dlf_documents',
1205
+                'tx_dlf_relations',
1206
+                'tx_dlf_collections',
1207
+                'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($todo)).') AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
1208
+                'tx_dlf_documents.uid',
1209
+                'tx_dlf_documents.tstamp',
1210
+                $this->conf['limit']
1211
+            );
1212 1212
 
1213
-			while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1213
+            while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1214 1214
 
1215
-				$header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header');
1215
+                $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header');
1216 1216
 
1217
-				$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8')));
1217
+                $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8')));
1218 1218
 
1219
-				$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp'])));
1219
+                $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp'])));
1220 1220
 
1221
-				// Check if document is deleted or hidden.
1222
-				// TODO: Use TYPO3 API functions here!
1223
-				if ($resArray['deleted'] || $resArray['hidden']) {
1221
+                // Check if document is deleted or hidden.
1222
+                // TODO: Use TYPO3 API functions here!
1223
+                if ($resArray['deleted'] || $resArray['hidden']) {
1224 1224
 
1225
-					// Add "deleted" status.
1226
-					$header->setAttribute('status', 'deleted');
1225
+                    // Add "deleted" status.
1226
+                    $header->setAttribute('status', 'deleted');
1227 1227
 
1228
-				} else {
1228
+                } else {
1229 1229
 
1230
-					// Add sets.
1231
-					foreach (explode(' ', $resArray['collections']) as $spec) {
1230
+                    // Add sets.
1231
+                    foreach (explode(' ', $resArray['collections']) as $spec) {
1232 1232
 
1233
-						$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8')));
1233
+                        $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8')));
1234 1234
 
1235
-					}
1235
+                    }
1236 1236
 
1237
-				}
1237
+                }
1238 1238
 
1239
-				$ListIdentifiers->appendChild($header);
1239
+                $ListIdentifiers->appendChild($header);
1240 1240
 
1241
-			}
1241
+            }
1242 1242
 
1243
-			if (!$complete) {
1243
+            if (!$complete) {
1244 1244
 
1245
-				// Save result set as list object.
1246
-				$resultSet = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
1245
+                // Save result set as list object.
1246
+                $resultSet = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
1247 1247
 
1248
-				$resultSet->reset();
1248
+                $resultSet->reset();
1249 1249
 
1250
-				$resultSet->add($results);
1250
+                $resultSet->add($results);
1251 1251
 
1252
-				// Save result set to database and generate resumption token.
1253
-				$token = uniqid();
1252
+                // Save result set to database and generate resumption token.
1253
+                $token = uniqid();
1254 1254
 
1255
-				$resultSet->metadata = array (
1256
-					'offset' => intval($this->conf['limit']),
1257
-					'metadataPrefix' => $this->piVars['metadataPrefix'],
1258
-				);
1255
+                $resultSet->metadata = array (
1256
+                    'offset' => intval($this->conf['limit']),
1257
+                    'metadataPrefix' => $this->piVars['metadataPrefix'],
1258
+                );
1259 1259
 
1260
-				$result = $GLOBALS['TYPO3_DB']->exec_INSERTquery(
1261
-					'tx_dlf_tokens',
1262
-					array (
1263
-						'tstamp' => $GLOBALS['EXEC_TIME'],
1264
-						'token' => $token,
1265
-						'options' => serialize($resultSet),
1266
-						'ident' => 'oai',
1267
-					)
1268
-				);
1260
+                $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery(
1261
+                    'tx_dlf_tokens',
1262
+                    array (
1263
+                        'tstamp' => $GLOBALS['EXEC_TIME'],
1264
+                        'token' => $token,
1265
+                        'options' => serialize($resultSet),
1266
+                        'ident' => 'oai',
1267
+                    )
1268
+                );
1269 1269
 
1270
-				if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) {
1270
+                if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) {
1271 1271
 
1272
-					$resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
1272
+                    $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
1273 1273
 
1274
-					$resumptionToken->setAttribute('cursor', '0');
1274
+                    $resumptionToken->setAttribute('cursor', '0');
1275 1275
 
1276
-					$resumptionToken->setAttribute('completeListSize', count($resultSet));
1276
+                    $resumptionToken->setAttribute('completeListSize', count($resultSet));
1277 1277
 
1278
-					$resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
1278
+                    $resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
1279 1279
 
1280
-					$ListIdentifiers->appendChild($resumptionToken);
1280
+                    $ListIdentifiers->appendChild($resumptionToken);
1281 1281
 
1282
-				} else {
1282
+                } else {
1283 1283
 
1284
-					if (TYPO3_DLOG) {
1284
+                    if (TYPO3_DLOG) {
1285 1285
 
1286
-						\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbListIdentifiers()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR);
1286
+                        \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbListIdentifiers()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR);
1287 1287
 
1288
-					}
1288
+                    }
1289 1289
 
1290
-				}
1290
+                }
1291 1291
 
1292
-			}
1292
+            }
1293 1293
 
1294
-			return $ListIdentifiers;
1294
+            return $ListIdentifiers;
1295 1295
 
1296
-		}
1296
+        }
1297 1297
 
1298
-	}
1298
+    }
1299 1299
 
1300
-	/**
1301
-	 * Process verb "ListMetadataFormats"
1302
-	 *
1303
-	 * @access	protected
1304
-	 *
1305
-	 * @return	DOMElement		XML node to add to the OAI response
1306
-	 */
1307
-	protected function verbListMetadataFormats() {
1300
+    /**
1301
+     * Process verb "ListMetadataFormats"
1302
+     *
1303
+     * @access	protected
1304
+     *
1305
+     * @return	DOMElement		XML node to add to the OAI response
1306
+     */
1307
+    protected function verbListMetadataFormats() {
1308 1308
 
1309
-		$resArray = array ();
1309
+        $resArray = array ();
1310 1310
 
1311
-		// Check for invalid arguments.
1312
-		if (count($this->piVars) > 1) {
1311
+        // Check for invalid arguments.
1312
+        if (count($this->piVars) > 1) {
1313 1313
 
1314
-			if (empty($this->piVars['identifier']) || count($this->piVars) > 2) {
1314
+            if (empty($this->piVars['identifier']) || count($this->piVars) > 2) {
1315 1315
 
1316
-				return $this->error('badArgument');
1316
+                return $this->error('badArgument');
1317 1317
 
1318
-			} else {
1318
+            } else {
1319 1319
 
1320
-				// Check given identifier.
1321
-				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1322
-					'tx_dlf_documents.*',
1323
-					'tx_dlf_documents',
1324
-					'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['identifier'], 'tx_dlf_documents'),
1325
-					'',
1326
-					'',
1327
-					'1'
1328
-				);
1320
+                // Check given identifier.
1321
+                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1322
+                    'tx_dlf_documents.*',
1323
+                    'tx_dlf_documents',
1324
+                    'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['identifier'], 'tx_dlf_documents'),
1325
+                    '',
1326
+                    '',
1327
+                    '1'
1328
+                );
1329 1329
 
1330
-				if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1330
+                if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1331 1331
 
1332
-					return $this->error('idDoesNotExist');
1332
+                    return $this->error('idDoesNotExist');
1333 1333
 
1334
-				} else {
1334
+                } else {
1335 1335
 
1336
-					$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
1336
+                    $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
1337 1337
 
1338
-				}
1338
+                }
1339 1339
 
1340
-			}
1340
+            }
1341 1341
 
1342
-		}
1342
+        }
1343 1343
 
1344
-		// Add metadata formats node.
1345
-		$ListMetadaFormats = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListMetadataFormats');
1344
+        // Add metadata formats node.
1345
+        $ListMetadaFormats = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListMetadataFormats');
1346 1346
 
1347
-		foreach ($this->formats as $prefix => $details) {
1347
+        foreach ($this->formats as $prefix => $details) {
1348 1348
 
1349
-			// Check for required fields.
1350
-			if (!empty($resArray)) {
1349
+            // Check for required fields.
1350
+            if (!empty($resArray)) {
1351 1351
 
1352
-				foreach ($details['requiredFields'] as $required) {
1352
+                foreach ($details['requiredFields'] as $required) {
1353 1353
 
1354
-					if (empty($resArray[$required])) {
1354
+                    if (empty($resArray[$required])) {
1355 1355
 
1356
-						// Skip metadata formats whose requirements are not met.
1357
-						continue 2;
1356
+                        // Skip metadata formats whose requirements are not met.
1357
+                        continue 2;
1358 1358
 
1359
-					}
1359
+                    }
1360 1360
 
1361
-				}
1361
+                }
1362 1362
 
1363
-			}
1363
+            }
1364 1364
 
1365
-			// Add format node.
1366
-			$format = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataFormat');
1365
+            // Add format node.
1366
+            $format = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataFormat');
1367 1367
 
1368
-			$format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataPrefix', htmlspecialchars($prefix, ENT_NOQUOTES, 'UTF-8')));
1368
+            $format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataPrefix', htmlspecialchars($prefix, ENT_NOQUOTES, 'UTF-8')));
1369 1369
 
1370
-			$format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'schema', htmlspecialchars($details['schema'], ENT_NOQUOTES, 'UTF-8')));
1370
+            $format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'schema', htmlspecialchars($details['schema'], ENT_NOQUOTES, 'UTF-8')));
1371 1371
 
1372
-			$format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataNamespace', htmlspecialchars($details['namespace'], ENT_NOQUOTES, 'UTF-8')));
1372
+            $format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataNamespace', htmlspecialchars($details['namespace'], ENT_NOQUOTES, 'UTF-8')));
1373 1373
 
1374
-			$ListMetadaFormats->appendChild($format);
1374
+            $ListMetadaFormats->appendChild($format);
1375 1375
 
1376
-		}
1376
+        }
1377 1377
 
1378
-		return $ListMetadaFormats;
1378
+        return $ListMetadaFormats;
1379 1379
 
1380
-	}
1380
+    }
1381 1381
 
1382
-	/**
1383
-	 * Process verb "ListRecords"
1384
-	 *
1385
-	 * @access	protected
1386
-	 *
1387
-	 * @return	string		Substitution for subpart "###RESPONSE###"
1388
-	 */
1389
-	protected function verbListRecords() {
1382
+    /**
1383
+     * Process verb "ListRecords"
1384
+     *
1385
+     * @access	protected
1386
+     *
1387
+     * @return	string		Substitution for subpart "###RESPONSE###"
1388
+     */
1389
+    protected function verbListRecords() {
1390 1390
 
1391
-		// Check for invalid arguments.
1392
-		if (!empty($this->piVars['resumptionToken'])) {
1391
+        // Check for invalid arguments.
1392
+        if (!empty($this->piVars['resumptionToken'])) {
1393 1393
 
1394
-			// "resumptionToken" is an exclusive argument.
1395
-			if (count($this->piVars) > 2) {
1394
+            // "resumptionToken" is an exclusive argument.
1395
+            if (count($this->piVars) > 2) {
1396 1396
 
1397
-				return $this->error('badArgument');
1397
+                return $this->error('badArgument');
1398 1398
 
1399
-			} else {
1399
+            } else {
1400 1400
 
1401
-				return $this->resume();
1401
+                return $this->resume();
1402 1402
 
1403
-			}
1403
+            }
1404 1404
 
1405
-		} elseif (empty($this->piVars['metadataPrefix']) || !empty($this->piVars['identifier'])) {
1405
+        } elseif (empty($this->piVars['metadataPrefix']) || !empty($this->piVars['identifier'])) {
1406 1406
 
1407
-			// "metadataPrefix" is required and "identifier" is not allowed.
1408
-			return $this->error('badArgument');
1407
+            // "metadataPrefix" is required and "identifier" is not allowed.
1408
+            return $this->error('badArgument');
1409 1409
 
1410
-		} else {
1410
+        } else {
1411 1411
 
1412
-			$where = '';
1412
+            $where = '';
1413 1413
 
1414
-			// Check "metadataPrefix" for valid value.
1415
-			if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) {
1414
+            // Check "metadataPrefix" for valid value.
1415
+            if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) {
1416 1416
 
1417
-				return $this->error('cannotDisseminateFormat');
1417
+                return $this->error('cannotDisseminateFormat');
1418 1418
 
1419
-			} else {
1419
+            } else {
1420 1420
 
1421
-				// Check for required fields.
1422
-				foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
1421
+                // Check for required fields.
1422
+                foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
1423 1423
 
1424
-					$where .= ' AND NOT tx_dlf_documents.'.$required.'=\'\'';
1424
+                    $where .= ' AND NOT tx_dlf_documents.'.$required.'=\'\'';
1425 1425
 
1426
-				}
1426
+                }
1427 1427
 
1428
-			}
1428
+            }
1429 1429
 
1430
-			// Check "set" for valid value.
1431
-			if (!empty($this->piVars['set'])) {
1430
+            // Check "set" for valid value.
1431
+            if (!empty($this->piVars['set'])) {
1432 1432
 
1433
-				// Get set information.
1434
-				$additionalWhere = '';
1433
+                // Get set information.
1434
+                $additionalWhere = '';
1435 1435
 
1436
-				if (!$this->conf['show_userdefined']) {
1436
+                if (!$this->conf['show_userdefined']) {
1437 1437
 
1438
-					$additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
1438
+                    $additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
1439 1439
 
1440
-				}
1440
+                }
1441 1441
 
1442
-				$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1443
-					'tx_dlf_collections.uid AS uid',
1444
-					'tx_dlf_collections',
1445
-					'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'], 'tx_dlf_collections').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'),
1446
-					'',
1447
-					'',
1448
-					'1'
1449
-				);
1442
+                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1443
+                    'tx_dlf_collections.uid AS uid',
1444
+                    'tx_dlf_collections',
1445
+                    'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'], 'tx_dlf_collections').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'),
1446
+                    '',
1447
+                    '',
1448
+                    '1'
1449
+                );
1450 1450
 
1451
-				if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1451
+                if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1452 1452
 
1453
-					return $this->error('noSetHierarchy');
1453
+                    return $this->error('noSetHierarchy');
1454 1454
 
1455
-				} else {
1455
+                } else {
1456 1456
 
1457
-					$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
1457
+                    $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
1458 1458
 
1459
-					$where .= ' AND tx_dlf_collections.uid='.intval($resArray['uid']);
1459
+                    $where .= ' AND tx_dlf_collections.uid='.intval($resArray['uid']);
1460 1460
 
1461
-				}
1461
+                }
1462 1462
 
1463
-			}
1463
+            }
1464 1464
 
1465
-			// Check "from" for valid value.
1466
-			if (!empty($this->piVars['from'])) {
1465
+            // Check "from" for valid value.
1466
+            if (!empty($this->piVars['from'])) {
1467 1467
 
1468
-				if (is_array($from = strptime($this->piVars['from'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($from = strptime($this->piVars['from'], '%Y-%m-%d'))) {
1468
+                if (is_array($from = strptime($this->piVars['from'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($from = strptime($this->piVars['from'], '%Y-%m-%d'))) {
1469 1469
 
1470
-					$from = gmmktime($from['tm_hour'], $from['tm_min'], $from['tm_sec'], $from['tm_mon'] + 1, $from['tm_mday'], $from['tm_year'] + 1900);
1470
+                    $from = gmmktime($from['tm_hour'], $from['tm_min'], $from['tm_sec'], $from['tm_mon'] + 1, $from['tm_mday'], $from['tm_year'] + 1900);
1471 1471
 
1472
-				} else {
1472
+                } else {
1473 1473
 
1474
-					return $this->error('badArgument');
1474
+                    return $this->error('badArgument');
1475 1475
 
1476
-				}
1476
+                }
1477 1477
 
1478
-				$where .= ' AND tx_dlf_documents.tstamp>='.intval($from);
1478
+                $where .= ' AND tx_dlf_documents.tstamp>='.intval($from);
1479 1479
 
1480
-			}
1480
+            }
1481 1481
 
1482
-			// Check "until" for valid value.
1483
-			if (!empty($this->piVars['until'])) {
1482
+            // Check "until" for valid value.
1483
+            if (!empty($this->piVars['until'])) {
1484 1484
 
1485
-				if (is_array($until = strptime($this->piVars['until'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($until = strptime($this->piVars['until'], '%Y-%m-%d'))) {
1485
+                if (is_array($until = strptime($this->piVars['until'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($until = strptime($this->piVars['until'], '%Y-%m-%d'))) {
1486 1486
 
1487
-					$until = gmmktime($until['tm_hour'], $until['tm_min'], $until['tm_sec'], $until['tm_mon'] + 1, $until['tm_mday'], $until['tm_year'] + 1900);
1487
+                    $until = gmmktime($until['tm_hour'], $until['tm_min'], $until['tm_sec'], $until['tm_mon'] + 1, $until['tm_mday'], $until['tm_year'] + 1900);
1488 1488
 
1489
-				} else {
1489
+                } else {
1490 1490
 
1491
-					return $this->error('badArgument');
1491
+                    return $this->error('badArgument');
1492 1492
 
1493
-				}
1493
+                }
1494 1494
 
1495
-				if (!empty($from) && $from > $until) {
1495
+                if (!empty($from) && $from > $until) {
1496 1496
 
1497
-					return $this->error('badArgument');
1497
+                    return $this->error('badArgument');
1498 1498
 
1499
-				}
1499
+                }
1500 1500
 
1501
-				$where .= ' AND tx_dlf_documents.tstamp<='.intval($until);
1501
+                $where .= ' AND tx_dlf_documents.tstamp<='.intval($until);
1502 1502
 
1503
-			}
1503
+            }
1504 1504
 
1505
-			// Check "from" and "until" for same granularity.
1506
-			if (!empty($this->piVars['from']) && !empty($this->piVars['until'])) {
1505
+            // Check "from" and "until" for same granularity.
1506
+            if (!empty($this->piVars['from']) && !empty($this->piVars['until'])) {
1507 1507
 
1508
-				if (strlen($this->piVars['from']) != strlen($this->piVars['until'])) {
1508
+                if (strlen($this->piVars['from']) != strlen($this->piVars['until'])) {
1509 1509
 
1510
-					return $this->error('badArgument');
1510
+                    return $this->error('badArgument');
1511 1511
 
1512
-				}
1512
+                }
1513 1513
 
1514
-			}
1514
+            }
1515 1515
 
1516
-		}
1516
+        }
1517 1517
 
1518
-		// Select records from database.
1519
-		if (!$this->conf['show_userdefined']) {
1518
+        // Select records from database.
1519
+        if (!$this->conf['show_userdefined']) {
1520 1520
 
1521
-			$where .= ' AND tx_dlf_collections.fe_cruser_id=0';
1521
+            $where .= ' AND tx_dlf_collections.fe_cruser_id=0';
1522 1522
 
1523
-		}
1523
+        }
1524 1524
 
1525
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
1526
-			'tx_dlf_documents.uid',
1527
-			'tx_dlf_documents',
1528
-			'tx_dlf_relations',
1529
-			'tx_dlf_collections',
1530
-			'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
1531
-			'tx_dlf_documents.uid',
1532
-			'tx_dlf_documents.tstamp',
1533
-			''
1534
-		);
1525
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
1526
+            'tx_dlf_documents.uid',
1527
+            'tx_dlf_documents',
1528
+            'tx_dlf_relations',
1529
+            'tx_dlf_collections',
1530
+            'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
1531
+            'tx_dlf_documents.uid',
1532
+            'tx_dlf_documents.tstamp',
1533
+            ''
1534
+        );
1535 1535
 
1536
-		if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1536
+        if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1537 1537
 
1538
-			return $this->error('noRecordsMatch');
1538
+            return $this->error('noRecordsMatch');
1539 1539
 
1540
-		} else {
1540
+        } else {
1541 1541
 
1542
-			// Build result set.
1543
-			$results = array ();
1542
+            // Build result set.
1543
+            $results = array ();
1544 1544
 
1545
-			while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1545
+            while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1546 1546
 
1547
-				// Save only UIDs for resumption token.
1548
-				$results[] = $resArray['uid'];
1547
+                // Save only UIDs for resumption token.
1548
+                $results[] = $resArray['uid'];
1549 1549
 
1550
-			}
1550
+            }
1551 1551
 
1552
-			$complete = FALSE;
1552
+            $complete = FALSE;
1553 1553
 
1554
-			$todo = array ();
1554
+            $todo = array ();
1555 1555
 
1556
-			$ListRecords = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListRecords');
1556
+            $ListRecords = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListRecords');
1557 1557
 
1558
-			for ($i = 0, $j = intval($this->conf['limit']); $i < $j; $i++) {
1558
+            for ($i = 0, $j = intval($this->conf['limit']); $i < $j; $i++) {
1559 1559
 
1560
-				$todo[] = $results[$i];
1560
+                $todo[] = $results[$i];
1561 1561
 
1562
-				if (empty($results[$i + 1])) {
1562
+                if (empty($results[$i + 1])) {
1563 1563
 
1564
-					$complete = TRUE;
1564
+                    $complete = TRUE;
1565 1565
 
1566
-					break;
1566
+                    break;
1567 1567
 
1568
-				}
1568
+                }
1569 1569
 
1570
-			}
1570
+            }
1571 1571
 
1572
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
1573
-				'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
1574
-				'tx_dlf_documents',
1575
-				'tx_dlf_relations',
1576
-				'tx_dlf_collections',
1577
-				'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($todo)).') AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
1578
-				'tx_dlf_documents.uid',
1579
-				'tx_dlf_documents.tstamp',
1580
-				$this->conf['limit']
1581
-			);
1572
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
1573
+                'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
1574
+                'tx_dlf_documents',
1575
+                'tx_dlf_relations',
1576
+                'tx_dlf_collections',
1577
+                'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($todo)).') AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
1578
+                'tx_dlf_documents.uid',
1579
+                'tx_dlf_documents.tstamp',
1580
+                $this->conf['limit']
1581
+            );
1582 1582
 
1583
-			while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1583
+            while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1584 1584
 
1585
-				// Add record node.
1586
-				$record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
1585
+                // Add record node.
1586
+                $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
1587 1587
 
1588
-				// Add header node.
1589
-				$header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header');
1588
+                // Add header node.
1589
+                $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header');
1590 1590
 
1591
-				$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8')));
1591
+                $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8')));
1592 1592
 
1593
-				$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp'])));
1593
+                $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp'])));
1594 1594
 
1595
-				// Check if document is deleted or hidden.
1596
-				// TODO: Use TYPO3 API functions here!
1597
-				if ($resArray['deleted'] || $resArray['hidden']) {
1595
+                // Check if document is deleted or hidden.
1596
+                // TODO: Use TYPO3 API functions here!
1597
+                if ($resArray['deleted'] || $resArray['hidden']) {
1598 1598
 
1599
-					// Add "deleted" status.
1600
-					$header->setAttribute('status', 'deleted');
1599
+                    // Add "deleted" status.
1600
+                    $header->setAttribute('status', 'deleted');
1601 1601
 
1602
-					$record->appendChild($header);
1602
+                    $record->appendChild($header);
1603 1603
 
1604
-				} else {
1604
+                } else {
1605 1605
 
1606
-					// Add sets.
1607
-					foreach (explode(' ', $resArray['collections']) as $spec) {
1606
+                    // Add sets.
1607
+                    foreach (explode(' ', $resArray['collections']) as $spec) {
1608 1608
 
1609
-						$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8')));
1609
+                        $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8')));
1610 1610
 
1611
-					}
1611
+                    }
1612 1612
 
1613
-					$record->appendChild($header);
1613
+                    $record->appendChild($header);
1614 1614
 
1615
-					// Add metadata node.
1616
-					$metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata');
1615
+                    // Add metadata node.
1616
+                    $metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata');
1617 1617
 
1618
-					switch ($this->piVars['metadataPrefix']) {
1618
+                    switch ($this->piVars['metadataPrefix']) {
1619 1619
 
1620
-						case 'oai_dc':
1620
+                        case 'oai_dc':
1621 1621
 
1622
-							$metadata->appendChild($this->getDcData($resArray));
1622
+                            $metadata->appendChild($this->getDcData($resArray));
1623 1623
 
1624
-							break;
1624
+                            break;
1625 1625
 
1626
-						case 'epicur':
1626
+                        case 'epicur':
1627 1627
 
1628
-							$metadata->appendChild($this->getEpicurData($resArray));
1628
+                            $metadata->appendChild($this->getEpicurData($resArray));
1629 1629
 
1630
-							break;
1630
+                            break;
1631 1631
 
1632
-						case 'mets':
1632
+                        case 'mets':
1633 1633
 
1634
-							$metadata->appendChild($this->getMetsData($resArray));
1634
+                            $metadata->appendChild($this->getMetsData($resArray));
1635 1635
 
1636
-							break;
1636
+                            break;
1637 1637
 
1638
-					}
1638
+                    }
1639 1639
 
1640
-					$record->appendChild($metadata);
1640
+                    $record->appendChild($metadata);
1641 1641
 
1642
-				}
1642
+                }
1643 1643
 
1644
-				$ListRecords->appendChild($record);
1644
+                $ListRecords->appendChild($record);
1645 1645
 
1646
-			}
1646
+            }
1647 1647
 
1648
-			if (!$complete) {
1648
+            if (!$complete) {
1649 1649
 
1650
-				// Save result set as list object.
1651
-				$resultSet = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
1650
+                // Save result set as list object.
1651
+                $resultSet = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
1652 1652
 
1653
-				$resultSet->reset();
1653
+                $resultSet->reset();
1654 1654
 
1655
-				$resultSet->add($results);
1655
+                $resultSet->add($results);
1656 1656
 
1657
-				// Save result set to database and generate resumption token.
1658
-				$token = uniqid();
1657
+                // Save result set to database and generate resumption token.
1658
+                $token = uniqid();
1659 1659
 
1660
-				$resultSet->metadata = array (
1661
-					'offset' => intval($this->conf['limit']),
1662
-					'metadataPrefix' => $this->piVars['metadataPrefix'],
1663
-				);
1660
+                $resultSet->metadata = array (
1661
+                    'offset' => intval($this->conf['limit']),
1662
+                    'metadataPrefix' => $this->piVars['metadataPrefix'],
1663
+                );
1664 1664
 
1665
-				$result = $GLOBALS['TYPO3_DB']->exec_INSERTquery(
1666
-					'tx_dlf_tokens',
1667
-					array (
1668
-						'tstamp' => $GLOBALS['EXEC_TIME'],
1669
-						'token' => $token,
1670
-						'options' => serialize($resultSet),
1671
-						'ident' => 'oai',
1672
-					)
1673
-				);
1665
+                $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery(
1666
+                    'tx_dlf_tokens',
1667
+                    array (
1668
+                        'tstamp' => $GLOBALS['EXEC_TIME'],
1669
+                        'token' => $token,
1670
+                        'options' => serialize($resultSet),
1671
+                        'ident' => 'oai',
1672
+                    )
1673
+                );
1674 1674
 
1675
-				if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) {
1675
+                if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) {
1676 1676
 
1677
-					$resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
1677
+                    $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
1678 1678
 
1679
-					$resumptionToken->setAttribute('cursor', '0');
1679
+                    $resumptionToken->setAttribute('cursor', '0');
1680 1680
 
1681
-					$resumptionToken->setAttribute('completeListSize', count($resultSet));
1681
+                    $resumptionToken->setAttribute('completeListSize', count($resultSet));
1682 1682
 
1683
-					$resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
1683
+                    $resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
1684 1684
 
1685
-					$ListRecords->appendChild($resumptionToken);
1685
+                    $ListRecords->appendChild($resumptionToken);
1686 1686
 
1687
-				} else {
1687
+                } else {
1688 1688
 
1689
-					if (TYPO3_DLOG) {
1689
+                    if (TYPO3_DLOG) {
1690 1690
 
1691
-						\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbListRecords()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR);
1691
+                        \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbListRecords()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR);
1692 1692
 
1693
-					}
1693
+                    }
1694 1694
 
1695
-				}
1695
+                }
1696 1696
 
1697
-			}
1697
+            }
1698 1698
 
1699
-			return $ListRecords;
1699
+            return $ListRecords;
1700 1700
 
1701
-		}
1701
+        }
1702 1702
 
1703
-	}
1703
+    }
1704 1704
 
1705
-	/**
1706
-	 * Process verb "ListSets"
1707
-	 *
1708
-	 * @access	protected
1709
-	 *
1710
-	 * @return	string		Substitution for subpart "###RESPONSE###"
1711
-	 */
1712
-	protected function verbListSets() {
1705
+    /**
1706
+     * Process verb "ListSets"
1707
+     *
1708
+     * @access	protected
1709
+     *
1710
+     * @return	string		Substitution for subpart "###RESPONSE###"
1711
+     */
1712
+    protected function verbListSets() {
1713 1713
 
1714
-		// Check for invalid arguments.
1715
-		if (count($this->piVars) > 1) {
1714
+        // Check for invalid arguments.
1715
+        if (count($this->piVars) > 1) {
1716 1716
 
1717
-			if (!empty($this->piVars['resumptionToken'])) {
1717
+            if (!empty($this->piVars['resumptionToken'])) {
1718 1718
 
1719
-				return $this->error('badResumptionToken');
1719
+                return $this->error('badResumptionToken');
1720 1720
 
1721
-			} else {
1721
+            } else {
1722 1722
 
1723
-				return $this->error('badArgument');
1723
+                return $this->error('badArgument');
1724 1724
 
1725
-			}
1725
+            }
1726 1726
 
1727
-		}
1727
+        }
1728 1728
 
1729
-		// Get set information.
1730
-		$additionalWhere = '';
1729
+        // Get set information.
1730
+        $additionalWhere = '';
1731 1731
 
1732
-		if (!$this->conf['show_userdefined']) {
1732
+        if (!$this->conf['show_userdefined']) {
1733 1733
 
1734
-			$additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
1734
+            $additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
1735 1735
 
1736
-		}
1736
+        }
1737 1737
 
1738
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1739
-			'tx_dlf_collections.oai_name AS oai_name,tx_dlf_collections.label AS label',
1740
-			'tx_dlf_collections',
1741
-			'tx_dlf_collections.sys_language_uid IN (-1,0) AND NOT tx_dlf_collections.oai_name=\'\' AND tx_dlf_collections.pid='.intval($this->conf['pages']).$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'),
1742
-			'tx_dlf_collections.oai_name',
1743
-			'tx_dlf_collections.oai_name',
1744
-			''
1745
-		);
1738
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1739
+            'tx_dlf_collections.oai_name AS oai_name,tx_dlf_collections.label AS label',
1740
+            'tx_dlf_collections',
1741
+            'tx_dlf_collections.sys_language_uid IN (-1,0) AND NOT tx_dlf_collections.oai_name=\'\' AND tx_dlf_collections.pid='.intval($this->conf['pages']).$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'),
1742
+            'tx_dlf_collections.oai_name',
1743
+            'tx_dlf_collections.oai_name',
1744
+            ''
1745
+        );
1746 1746
 
1747
-		if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1747
+        if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
1748 1748
 
1749
-			return $this->error('noSetHierarchy');
1749
+            return $this->error('noSetHierarchy');
1750 1750
 
1751
-		}
1751
+        }
1752 1752
 
1753
-		// Add set list node.
1754
-		$ListSets = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListSets');
1753
+        // Add set list node.
1754
+        $ListSets = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListSets');
1755 1755
 
1756
-		while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1756
+        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1757 1757
 
1758
-			// Add set node.
1759
-			$set = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'set');
1758
+            // Add set node.
1759
+            $set = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'set');
1760 1760
 
1761
-			$set->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($resArray['oai_name'], ENT_NOQUOTES, 'UTF-8')));
1761
+            $set->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($resArray['oai_name'], ENT_NOQUOTES, 'UTF-8')));
1762 1762
 
1763
-			$set->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setName', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8')));
1763
+            $set->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setName', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8')));
1764 1764
 
1765
-			$ListSets->appendChild($set);
1765
+            $ListSets->appendChild($set);
1766 1766
 
1767
-		}
1767
+        }
1768 1768
 
1769
-		return $ListSets;
1769
+        return $ListSets;
1770 1770
 
1771
-	}
1771
+    }
1772 1772
 
1773 1773
 }
Please login to merge, or discard this patch.