We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -210,13 +210,13 @@ discard block |
||
210 | 210 | |
211 | 211 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($resultMail) > 0) { |
212 | 212 | |
213 | - $mails = array(); |
|
213 | + $mails = array (); |
|
214 | 214 | |
215 | 215 | $mailForm = '<select name="tx_dlf[mail_action]">'; |
216 | 216 | |
217 | 217 | $mailForm .= '<option value="">'.$this->pi_getLL('chooseMail', '', TRUE).'</option>'; |
218 | 218 | |
219 | - while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail)){ |
|
219 | + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail)) { |
|
220 | 220 | |
221 | 221 | $mails[] = $row; |
222 | 222 | |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | |
256 | 256 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($resultPrinter) > 0) { |
257 | 257 | |
258 | - $printers = array(); |
|
258 | + $printers = array (); |
|
259 | 259 | |
260 | 260 | $printForm = '<select name="tx_dlf[print_action]">'; |
261 | 261 | |
262 | 262 | $printForm .= '<option value="">'.$this->pi_getLL('choosePrinter', '', TRUE).'</option>'; |
263 | 263 | |
264 | - while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultPrinter)){ |
|
264 | + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultPrinter)) { |
|
265 | 265 | |
266 | 266 | $printers[] = $row; |
267 | 267 | |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | |
415 | 415 | if ($page != null || $_piVars['addToBasket'] == 'list') { |
416 | 416 | |
417 | - $documentItem = array( |
|
417 | + $documentItem = array ( |
|
418 | 418 | 'id' => intval($_piVars['id']), |
419 | 419 | 'startpage' => intval($_piVars['startpage']), |
420 | 420 | 'endpage' => intval($_piVars['endpage']), |
@@ -434,12 +434,12 @@ discard block |
||
434 | 434 | |
435 | 435 | } else { |
436 | 436 | |
437 | - $items = array(); |
|
437 | + $items = array (); |
|
438 | 438 | |
439 | 439 | } |
440 | 440 | |
441 | 441 | // get document instance to load further information |
442 | - $document = tx_dlf_document::getInstance($documentItem['id'],0); |
|
442 | + $document = tx_dlf_document::getInstance($documentItem['id'], 0); |
|
443 | 443 | |
444 | 444 | // set endpage for toc and subentry based on logid |
445 | 445 | if (($_piVars['addToBasket'] == 'subentry') OR ($_piVars['addToBasket'] == 'toc')) { |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | |
524 | 524 | } |
525 | 525 | |
526 | - $update = array('doc_ids' => json_encode($items)); |
|
526 | + $update = array ('doc_ids' => json_encode($items)); |
|
527 | 527 | |
528 | 528 | $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_dlf_basket', 'uid='.intval($basketData['uid']), $update); |
529 | 529 | |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | |
532 | 532 | } |
533 | 533 | |
534 | - return array('basketData' => $basketData, 'jsOutput' => $output); |
|
534 | + return array ('basketData' => $basketData, 'jsOutput' => $output); |
|
535 | 535 | |
536 | 536 | } |
537 | 537 | |
@@ -581,11 +581,11 @@ discard block |
||
581 | 581 | |
582 | 582 | if (empty($items)) { |
583 | 583 | |
584 | - $update = array('doc_ids' => ''); |
|
584 | + $update = array ('doc_ids' => ''); |
|
585 | 585 | |
586 | 586 | } else { |
587 | 587 | |
588 | - $update = array('doc_ids' => json_encode($items)); |
|
588 | + $update = array ('doc_ids' => json_encode($items)); |
|
589 | 589 | |
590 | 590 | } |
591 | 591 | |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | public function getDocumentData($id, $data) { |
640 | 640 | |
641 | 641 | // get document instance to load further information |
642 | - $document = tx_dlf_document::getInstance($id,0); |
|
642 | + $document = tx_dlf_document::getInstance($id, 0); |
|
643 | 643 | |
644 | 644 | if ($document) { |
645 | 645 | |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | |
715 | 715 | } |
716 | 716 | |
717 | - return array( |
|
717 | + return array ( |
|
718 | 718 | 'downloadUrl' => $downloadUrl, |
719 | 719 | 'downloadLink' => $downloadLink, |
720 | 720 | 'pageNums' => $pageNums, |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | ->setFrom($from) |
801 | 801 | |
802 | 802 | // Set the To addresses with an associative array |
803 | - ->setTo(array($mailData['mail'] => $mailData['name'])) |
|
803 | + ->setTo(array ($mailData['mail'] => $mailData['name'])) |
|
804 | 804 | |
805 | 805 | ->setBody($body, 'text/html') |
806 | 806 | |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | ; |
809 | 809 | |
810 | 810 | // protocol |
811 | - $insertArray = array( |
|
811 | + $insertArray = array ( |
|
812 | 812 | 'pid' => $this->conf['pages'], |
813 | 813 | 'file_name' => $pdfUrl, |
814 | 814 | 'count_pages' => $numberOfPages, |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | } |
909 | 909 | |
910 | 910 | // protocol |
911 | - $insertArray = array( |
|
911 | + $insertArray = array ( |
|
912 | 912 | 'pid' => $this->conf['pages'], |
913 | 913 | 'file_name' => $pdfUrl, |
914 | 914 | 'count_pages' => $numberOfPages, |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | $mailForm .= '<option value="">'.$this->pi_getLL('chooseMail', '', TRUE).'</option>'; |
218 | 218 | |
219 | - while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail)){ |
|
219 | + while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail)) { |
|
220 | 220 | |
221 | 221 | $mails[] = $row; |
222 | 222 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | $printForm .= '<option value="">'.$this->pi_getLL('choosePrinter', '', TRUE).'</option>'; |
263 | 263 | |
264 | - while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultPrinter)){ |
|
264 | + while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultPrinter)) { |
|
265 | 265 | |
266 | 266 | $printers[] = $row; |
267 | 267 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $GLOBALS['TSFE']->fe_user->setKey('ses', 'tx_dlf_basket', ''); |
75 | 75 | |
76 | - $GLOBALS['TSFE']->fe_user->sesData_change = true; |
|
76 | + $GLOBALS['TSFE']->fe_user->sesData_change = TRUE; |
|
77 | 77 | |
78 | 78 | $GLOBALS['TSFE']->fe_user->storeSessionData(); |
79 | 79 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | |
413 | 413 | } |
414 | 414 | |
415 | - if ($page != null || $_piVars['addToBasket'] == 'list') { |
|
415 | + if ($page != NULL || $_piVars['addToBasket'] == 'list') { |
|
416 | 416 | |
417 | 417 | $documentItem = array( |
418 | 418 | 'id' => intval($_piVars['id']), |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | $document = tx_dlf_document::getInstance($documentItem['id'],0); |
443 | 443 | |
444 | 444 | // set endpage for toc and subentry based on logid |
445 | - if (($_piVars['addToBasket'] == 'subentry') OR ($_piVars['addToBasket'] == 'toc')) { |
|
445 | + if (($_piVars['addToBasket'] == 'subentry') or ($_piVars['addToBasket'] == 'toc')) { |
|
446 | 446 | |
447 | 447 | $smLinks = $document->smLinks; |
448 | 448 | |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | |
725 | 725 | } |
726 | 726 | |
727 | - return false; |
|
727 | + return FALSE; |
|
728 | 728 | |
729 | 729 | } |
730 | 730 |
@@ -19,210 +19,210 @@ |
||
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 | } |
@@ -20,391 +20,391 @@ |
||
20 | 20 | */ |
21 | 21 | class tx_dlf_metadata extends tx_dlf_plugin { |
22 | 22 | |
23 | - public $scriptRelPath = 'plugins/metadata/class.tx_dlf_metadata.php'; |
|
23 | + public $scriptRelPath = 'plugins/metadata/class.tx_dlf_metadata.php'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * This holds the hook objects |
|
27 | - * |
|
28 | - * @var array |
|
29 | - * @access protected |
|
30 | - */ |
|
31 | - protected $hookObjects = array (); |
|
25 | + /** |
|
26 | + * This holds the hook objects |
|
27 | + * |
|
28 | + * @var array |
|
29 | + * @access protected |
|
30 | + */ |
|
31 | + protected $hookObjects = array (); |
|
32 | 32 | |
33 | - /** |
|
34 | - * The main method of the PlugIn |
|
35 | - * |
|
36 | - * @access public |
|
37 | - * |
|
38 | - * @param string $content: The PlugIn content |
|
39 | - * @param array $conf: The PlugIn configuration |
|
40 | - * |
|
41 | - * @return string The content that is displayed on the website |
|
42 | - */ |
|
43 | - public function main($content, $conf) { |
|
33 | + /** |
|
34 | + * The main method of the PlugIn |
|
35 | + * |
|
36 | + * @access public |
|
37 | + * |
|
38 | + * @param string $content: The PlugIn content |
|
39 | + * @param array $conf: The PlugIn configuration |
|
40 | + * |
|
41 | + * @return string The content that is displayed on the website |
|
42 | + */ |
|
43 | + public function main($content, $conf) { |
|
44 | 44 | |
45 | - $this->init($conf); |
|
45 | + $this->init($conf); |
|
46 | 46 | |
47 | - // Turn cache on. |
|
48 | - $this->setCache(TRUE); |
|
47 | + // Turn cache on. |
|
48 | + $this->setCache(TRUE); |
|
49 | 49 | |
50 | - // Load current document. |
|
51 | - $this->loadDocument(); |
|
50 | + // Load current document. |
|
51 | + $this->loadDocument(); |
|
52 | 52 | |
53 | - if ($this->doc === NULL) { |
|
53 | + if ($this->doc === NULL) { |
|
54 | 54 | |
55 | - // Quit without doing anything if required variables are not set. |
|
56 | - return $content; |
|
55 | + // Quit without doing anything if required variables are not set. |
|
56 | + return $content; |
|
57 | 57 | |
58 | - } else { |
|
58 | + } else { |
|
59 | 59 | |
60 | - // Set default values if not set. |
|
61 | - if (!isset($this->conf['rootline'])) { |
|
60 | + // Set default values if not set. |
|
61 | + if (!isset($this->conf['rootline'])) { |
|
62 | 62 | |
63 | - $this->conf['rootline'] = 0; |
|
63 | + $this->conf['rootline'] = 0; |
|
64 | 64 | |
65 | - } |
|
65 | + } |
|
66 | 66 | |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - $metadata = array (); |
|
69 | + $metadata = array (); |
|
70 | 70 | |
71 | - if ($this->conf['rootline'] < 2) { |
|
71 | + if ($this->conf['rootline'] < 2) { |
|
72 | 72 | |
73 | - // Get current structure's @ID. |
|
74 | - $ids = array (); |
|
73 | + // Get current structure's @ID. |
|
74 | + $ids = array (); |
|
75 | 75 | |
76 | - if (!empty($this->doc->physicalStructure[$this->piVars['page']]) && !empty($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]])) { |
|
76 | + if (!empty($this->doc->physicalStructure[$this->piVars['page']]) && !empty($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]])) { |
|
77 | 77 | |
78 | - foreach ($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]] as $logId) { |
|
78 | + foreach ($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]] as $logId) { |
|
79 | 79 | |
80 | - $count = count($this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*')); |
|
80 | + $count = count($this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*')); |
|
81 | 81 | |
82 | - $ids[$count][] = $logId; |
|
82 | + $ids[$count][] = $logId; |
|
83 | 83 | |
84 | - } |
|
84 | + } |
|
85 | 85 | |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - ksort($ids); |
|
88 | + ksort($ids); |
|
89 | 89 | |
90 | - reset($ids); |
|
90 | + reset($ids); |
|
91 | 91 | |
92 | - // Check if we should display all metadata up to the root. |
|
93 | - if ($this->conf['rootline'] == 1) { |
|
92 | + // Check if we should display all metadata up to the root. |
|
93 | + if ($this->conf['rootline'] == 1) { |
|
94 | 94 | |
95 | - foreach ($ids as $id) { |
|
95 | + foreach ($ids as $id) { |
|
96 | 96 | |
97 | - foreach ($id as $sid) { |
|
97 | + foreach ($id as $sid) { |
|
98 | 98 | |
99 | - $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
|
99 | + $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
|
100 | 100 | |
101 | - if (!empty($data)) { |
|
101 | + if (!empty($data)) { |
|
102 | 102 | |
103 | - $data['_id'] = $sid; |
|
103 | + $data['_id'] = $sid; |
|
104 | 104 | |
105 | - $metadata[] = $data; |
|
105 | + $metadata[] = $data; |
|
106 | 106 | |
107 | - } |
|
107 | + } |
|
108 | 108 | |
109 | - } |
|
109 | + } |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | - } else { |
|
113 | + } else { |
|
114 | 114 | |
115 | - $id = array_pop($ids); |
|
115 | + $id = array_pop($ids); |
|
116 | 116 | |
117 | - if (is_array($id)) { |
|
117 | + if (is_array($id)) { |
|
118 | 118 | |
119 | - foreach ($id as $sid) { |
|
119 | + foreach ($id as $sid) { |
|
120 | 120 | |
121 | - $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
|
121 | + $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
|
122 | 122 | |
123 | - if (!empty($data)) { |
|
123 | + if (!empty($data)) { |
|
124 | 124 | |
125 | - $data['_id'] = $sid; |
|
125 | + $data['_id'] = $sid; |
|
126 | 126 | |
127 | - $metadata[] = $data; |
|
127 | + $metadata[] = $data; |
|
128 | 128 | |
129 | - } |
|
129 | + } |
|
130 | 130 | |
131 | - } |
|
131 | + } |
|
132 | 132 | |
133 | - } |
|
133 | + } |
|
134 | 134 | |
135 | - } |
|
135 | + } |
|
136 | 136 | |
137 | - } |
|
137 | + } |
|
138 | 138 | |
139 | - // Get titledata? |
|
140 | - if (empty($metadata) || ($this->conf['rootline'] == 1 && $metadata[0]['_id'] != $this->doc->toplevelId)) { |
|
139 | + // Get titledata? |
|
140 | + if (empty($metadata) || ($this->conf['rootline'] == 1 && $metadata[0]['_id'] != $this->doc->toplevelId)) { |
|
141 | 141 | |
142 | - $data = $this->doc->getTitleData($this->conf['pages']); |
|
142 | + $data = $this->doc->getTitleData($this->conf['pages']); |
|
143 | 143 | |
144 | - $data['_id'] = $this->doc->toplevelId; |
|
144 | + $data['_id'] = $this->doc->toplevelId; |
|
145 | 145 | |
146 | - array_unshift($metadata, $data); |
|
146 | + array_unshift($metadata, $data); |
|
147 | 147 | |
148 | - } |
|
148 | + } |
|
149 | 149 | |
150 | - if (empty($metadata)) { |
|
150 | + if (empty($metadata)) { |
|
151 | 151 | |
152 | - if (TYPO3_DLOG) { |
|
152 | + if (TYPO3_DLOG) { |
|
153 | 153 | |
154 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
154 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
155 | 155 | |
156 | - } |
|
156 | + } |
|
157 | 157 | |
158 | - return $content; |
|
158 | + return $content; |
|
159 | 159 | |
160 | - } |
|
160 | + } |
|
161 | 161 | |
162 | - ksort($metadata); |
|
162 | + ksort($metadata); |
|
163 | 163 | |
164 | - // Get hook objects. |
|
165 | - $this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath); |
|
164 | + // Get hook objects. |
|
165 | + $this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath); |
|
166 | 166 | |
167 | - // Hook for getting a customized title bar (requested by SBB). |
|
168 | - foreach ($this->hookObjects as $hookObj) { |
|
167 | + // Hook for getting a customized title bar (requested by SBB). |
|
168 | + foreach ($this->hookObjects as $hookObj) { |
|
169 | 169 | |
170 | - if (method_exists($hookObj, 'main_customizeTitleBarGetCustomTemplate')) { |
|
170 | + if (method_exists($hookObj, 'main_customizeTitleBarGetCustomTemplate')) { |
|
171 | 171 | |
172 | - $hookObj->main_customizeTitleBarGetCustomTemplate($this, $metadata); |
|
172 | + $hookObj->main_customizeTitleBarGetCustomTemplate($this, $metadata); |
|
173 | 173 | |
174 | - } |
|
174 | + } |
|
175 | 175 | |
176 | - } |
|
176 | + } |
|
177 | 177 | |
178 | - $content .= $this->printMetadata($metadata); |
|
178 | + $content .= $this->printMetadata($metadata); |
|
179 | 179 | |
180 | - return $this->pi_wrapInBaseClass($content); |
|
180 | + return $this->pi_wrapInBaseClass($content); |
|
181 | 181 | |
182 | - } |
|
182 | + } |
|
183 | 183 | |
184 | - /** |
|
185 | - * Prepares the metadata array for output |
|
186 | - * |
|
187 | - * @access protected |
|
188 | - * |
|
189 | - * @param array $metadataArray: The metadata array |
|
190 | - * |
|
191 | - * @return string The metadata array ready for output |
|
192 | - */ |
|
193 | - protected function printMetadata(array $metadataArray) { |
|
184 | + /** |
|
185 | + * Prepares the metadata array for output |
|
186 | + * |
|
187 | + * @access protected |
|
188 | + * |
|
189 | + * @param array $metadataArray: The metadata array |
|
190 | + * |
|
191 | + * @return string The metadata array ready for output |
|
192 | + */ |
|
193 | + protected function printMetadata(array $metadataArray) { |
|
194 | 194 | |
195 | - // Load template file. |
|
196 | - if (!empty($this->conf['templateFile'])) { |
|
195 | + // Load template file. |
|
196 | + if (!empty($this->conf['templateFile'])) { |
|
197 | 197 | |
198 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
198 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
199 | 199 | |
200 | - } else { |
|
200 | + } else { |
|
201 | 201 | |
202 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/metadata/template.tmpl'), '###TEMPLATE###'); |
|
202 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/metadata/template.tmpl'), '###TEMPLATE###'); |
|
203 | 203 | |
204 | - } |
|
204 | + } |
|
205 | 205 | |
206 | - $output = ''; |
|
206 | + $output = ''; |
|
207 | 207 | |
208 | - $subpart['block'] = $this->cObj->getSubpart($this->template, '###BLOCK###'); |
|
208 | + $subpart['block'] = $this->cObj->getSubpart($this->template, '###BLOCK###'); |
|
209 | 209 | |
210 | - // Get list of metadata to show. |
|
211 | - $metaList = array (); |
|
210 | + // Get list of metadata to show. |
|
211 | + $metaList = array (); |
|
212 | 212 | |
213 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
214 | - 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.wrap AS wrap', |
|
215 | - 'tx_dlf_metadata', |
|
216 | - 'tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata').' AND (sys_language_uid IN (-1,0) OR (sys_language_uid = ' .$GLOBALS['TSFE']->sys_language_uid. ' AND l18n_parent = 0))', |
|
217 | - '', |
|
218 | - 'tx_dlf_metadata.sorting', |
|
219 | - '' |
|
220 | - ); |
|
213 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
214 | + 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.wrap AS wrap', |
|
215 | + 'tx_dlf_metadata', |
|
216 | + 'tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata').' AND (sys_language_uid IN (-1,0) OR (sys_language_uid = ' .$GLOBALS['TSFE']->sys_language_uid. ' AND l18n_parent = 0))', |
|
217 | + '', |
|
218 | + 'tx_dlf_metadata.sorting', |
|
219 | + '' |
|
220 | + ); |
|
221 | 221 | |
222 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
222 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
223 | 223 | |
224 | - if (is_array($resArray) && $resArray['sys_language_uid'] != $GLOBALS['TSFE']->sys_language_content && $GLOBALS['TSFE']->sys_language_contentOL) { |
|
224 | + if (is_array($resArray) && $resArray['sys_language_uid'] != $GLOBALS['TSFE']->sys_language_content && $GLOBALS['TSFE']->sys_language_contentOL) { |
|
225 | 225 | |
226 | - $resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_dlf_metadata', $resArray, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL); |
|
226 | + $resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_dlf_metadata', $resArray, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL); |
|
227 | 227 | |
228 | - } |
|
228 | + } |
|
229 | 229 | |
230 | - if ($resArray) { |
|
231 | - // get correct language uid for translated realurl link |
|
232 | - $link_uid = ($resArray['_LOCALIZED_UID']) ? $resArray['_LOCALIZED_UID'] : $resArray['uid']; |
|
230 | + if ($resArray) { |
|
231 | + // get correct language uid for translated realurl link |
|
232 | + $link_uid = ($resArray['_LOCALIZED_UID']) ? $resArray['_LOCALIZED_UID'] : $resArray['uid']; |
|
233 | 233 | |
234 | - // do stuff with the row entry data like built HTML or prepare further usage |
|
235 | - if ($this->conf['showFull'] || $resArray['is_listed']) { |
|
234 | + // do stuff with the row entry data like built HTML or prepare further usage |
|
235 | + if ($this->conf['showFull'] || $resArray['is_listed']) { |
|
236 | 236 | |
237 | - $metaList[$resArray['index_name']] = array ( |
|
238 | - 'wrap' => $resArray['wrap'], |
|
239 | - 'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']) |
|
240 | - ); |
|
237 | + $metaList[$resArray['index_name']] = array ( |
|
238 | + 'wrap' => $resArray['wrap'], |
|
239 | + 'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']) |
|
240 | + ); |
|
241 | 241 | |
242 | - } |
|
242 | + } |
|
243 | 243 | |
244 | - } |
|
244 | + } |
|
245 | 245 | |
246 | - } |
|
246 | + } |
|
247 | 247 | |
248 | - // Get list of collections to show. |
|
249 | - $collList = array (); |
|
248 | + // Get list of collections to show. |
|
249 | + $collList = array (); |
|
250 | 250 | |
251 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
252 | - 'tx_dlf_collections.index_name AS index_name', |
|
253 | - 'tx_dlf_collections', |
|
254 | - 'tx_dlf_collections.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
255 | - '', |
|
256 | - '', |
|
257 | - '' |
|
258 | - ); |
|
251 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
252 | + 'tx_dlf_collections.index_name AS index_name', |
|
253 | + 'tx_dlf_collections', |
|
254 | + 'tx_dlf_collections.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
255 | + '', |
|
256 | + '', |
|
257 | + '' |
|
258 | + ); |
|
259 | 259 | |
260 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
260 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
261 | 261 | |
262 | - $collList[] = $resArray['index_name']; |
|
262 | + $collList[] = $resArray['index_name']; |
|
263 | 263 | |
264 | - } |
|
264 | + } |
|
265 | 265 | |
266 | - // Save original data array. |
|
267 | - $cObjData = $this->cObj->data; |
|
266 | + // Save original data array. |
|
267 | + $cObjData = $this->cObj->data; |
|
268 | 268 | |
269 | - // Parse the metadata arrays. |
|
270 | - foreach ($metadataArray as $metadata) { |
|
269 | + // Parse the metadata arrays. |
|
270 | + foreach ($metadataArray as $metadata) { |
|
271 | 271 | |
272 | - $markerArray['###METADATA###'] = ''; |
|
272 | + $markerArray['###METADATA###'] = ''; |
|
273 | 273 | |
274 | - // Reset content object's data array. |
|
275 | - $this->cObj->data = $cObjData; |
|
274 | + // Reset content object's data array. |
|
275 | + $this->cObj->data = $cObjData; |
|
276 | 276 | |
277 | - // Load all the metadata values into the content object's data array. |
|
278 | - foreach ($metadata as $index_name => $value) { |
|
277 | + // Load all the metadata values into the content object's data array. |
|
278 | + foreach ($metadata as $index_name => $value) { |
|
279 | 279 | |
280 | - if (is_array($value)) { |
|
280 | + if (is_array($value)) { |
|
281 | 281 | |
282 | - $this->cObj->data[$index_name] = implode($this->conf['separator'], $value); |
|
282 | + $this->cObj->data[$index_name] = implode($this->conf['separator'], $value); |
|
283 | 283 | |
284 | - } else { |
|
284 | + } else { |
|
285 | 285 | |
286 | - $this->cObj->data[$index_name] = $value; |
|
286 | + $this->cObj->data[$index_name] = $value; |
|
287 | 287 | |
288 | - } |
|
288 | + } |
|
289 | 289 | |
290 | - } |
|
290 | + } |
|
291 | 291 | |
292 | - // Process each metadate. |
|
293 | - foreach ($metaList as $index_name => $metaConf) { |
|
292 | + // Process each metadate. |
|
293 | + foreach ($metaList as $index_name => $metaConf) { |
|
294 | 294 | |
295 | - $parsedValue = ''; |
|
295 | + $parsedValue = ''; |
|
296 | 296 | |
297 | - $fieldwrap = $this->parseTS($metaConf['wrap']); |
|
297 | + $fieldwrap = $this->parseTS($metaConf['wrap']); |
|
298 | 298 | |
299 | - do { |
|
299 | + do { |
|
300 | 300 | |
301 | - $value = @array_shift($metadata[$index_name]); |
|
301 | + $value = @array_shift($metadata[$index_name]); |
|
302 | 302 | |
303 | - if ($index_name == 'title') { |
|
303 | + if ($index_name == 'title') { |
|
304 | 304 | |
305 | - // Get title of parent document if needed. |
|
306 | - if (empty($value) && $this->conf['getTitle'] && $this->doc->parentId) { |
|
305 | + // Get title of parent document if needed. |
|
306 | + if (empty($value) && $this->conf['getTitle'] && $this->doc->parentId) { |
|
307 | 307 | |
308 | - $superiorTitle = tx_dlf_document::getTitle($this->doc->parentId, TRUE); |
|
308 | + $superiorTitle = tx_dlf_document::getTitle($this->doc->parentId, TRUE); |
|
309 | 309 | |
310 | - if (!empty($superiorTitle)) { |
|
310 | + if (!empty($superiorTitle)) { |
|
311 | 311 | |
312 | - $value = '['.$superiorTitle.']'; |
|
312 | + $value = '['.$superiorTitle.']'; |
|
313 | 313 | |
314 | - } |
|
314 | + } |
|
315 | 315 | |
316 | - } |
|
316 | + } |
|
317 | 317 | |
318 | - if (!empty($value)) { |
|
318 | + if (!empty($value)) { |
|
319 | 319 | |
320 | - $value = htmlspecialchars($value); |
|
320 | + $value = htmlspecialchars($value); |
|
321 | 321 | |
322 | - // Link title to pageview. |
|
323 | - if ($this->conf['linkTitle'] && $metadata['_id']) { |
|
322 | + // Link title to pageview. |
|
323 | + if ($this->conf['linkTitle'] && $metadata['_id']) { |
|
324 | 324 | |
325 | - $details = $this->doc->getLogicalStructure($metadata['_id']); |
|
325 | + $details = $this->doc->getLogicalStructure($metadata['_id']); |
|
326 | 326 | |
327 | - $value = $this->pi_linkTP($value, array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']); |
|
327 | + $value = $this->pi_linkTP($value, array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']); |
|
328 | 328 | |
329 | - } |
|
329 | + } |
|
330 | 330 | |
331 | - } |
|
331 | + } |
|
332 | 332 | |
333 | - } elseif ($index_name == 'owner' && !empty($value)) { |
|
333 | + } elseif ($index_name == 'owner' && !empty($value)) { |
|
334 | 334 | |
335 | - // Translate name of holding library. |
|
336 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
335 | + // Translate name of holding library. |
|
336 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
337 | 337 | |
338 | - } elseif ($index_name == 'type' && !empty($value)) { |
|
338 | + } elseif ($index_name == 'type' && !empty($value)) { |
|
339 | 339 | |
340 | - // Translate document type. |
|
341 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
340 | + // Translate document type. |
|
341 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
342 | 342 | |
343 | - } elseif ($index_name == 'collection' && !empty($value)) { |
|
343 | + } elseif ($index_name == 'collection' && !empty($value)) { |
|
344 | 344 | |
345 | - // Check if collections isn't hidden. |
|
346 | - if (in_array($value, $collList)) { |
|
345 | + // Check if collections isn't hidden. |
|
346 | + if (in_array($value, $collList)) { |
|
347 | 347 | |
348 | - // Translate collection. |
|
349 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages'])); |
|
348 | + // Translate collection. |
|
349 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages'])); |
|
350 | 350 | |
351 | - } else { |
|
351 | + } else { |
|
352 | 352 | |
353 | - $value = ''; |
|
353 | + $value = ''; |
|
354 | 354 | |
355 | - } |
|
355 | + } |
|
356 | 356 | |
357 | - } elseif ($index_name == 'language' && !empty($value)) { |
|
357 | + } elseif ($index_name == 'language' && !empty($value)) { |
|
358 | 358 | |
359 | - // Translate ISO 639 language code. |
|
360 | - $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
359 | + // Translate ISO 639 language code. |
|
360 | + $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
361 | 361 | |
362 | - } elseif (!empty($value)) { |
|
362 | + } elseif (!empty($value)) { |
|
363 | 363 | |
364 | - // Sanitize value for output. |
|
365 | - $value = htmlspecialchars($value); |
|
364 | + // Sanitize value for output. |
|
365 | + $value = htmlspecialchars($value); |
|
366 | 366 | |
367 | - } |
|
367 | + } |
|
368 | 368 | |
369 | - // Hook for getting a customized value (requested by SBB). |
|
370 | - foreach ($this->hookObjects as $hookObj) { |
|
369 | + // Hook for getting a customized value (requested by SBB). |
|
370 | + foreach ($this->hookObjects as $hookObj) { |
|
371 | 371 | |
372 | - if (method_exists($hookObj, 'printMetadata_customizeMetadata')) { |
|
372 | + if (method_exists($hookObj, 'printMetadata_customizeMetadata')) { |
|
373 | 373 | |
374 | - $hookObj->printMetadata_customizeMetadata($value); |
|
374 | + $hookObj->printMetadata_customizeMetadata($value); |
|
375 | 375 | |
376 | - } |
|
376 | + } |
|
377 | 377 | |
378 | - } |
|
378 | + } |
|
379 | 379 | |
380 | - $value = $this->cObj->stdWrap($value, $fieldwrap['value.']); |
|
380 | + $value = $this->cObj->stdWrap($value, $fieldwrap['value.']); |
|
381 | 381 | |
382 | - if (!empty($value)) { |
|
382 | + if (!empty($value)) { |
|
383 | 383 | |
384 | - $parsedValue .= $value; |
|
384 | + $parsedValue .= $value; |
|
385 | 385 | |
386 | - } |
|
386 | + } |
|
387 | 387 | |
388 | - } while (count($metadata[$index_name])); |
|
388 | + } while (count($metadata[$index_name])); |
|
389 | 389 | |
390 | - if (!empty($parsedValue)) { |
|
390 | + if (!empty($parsedValue)) { |
|
391 | 391 | |
392 | - $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); |
|
392 | + $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); |
|
393 | 393 | |
394 | - $field .= $parsedValue; |
|
394 | + $field .= $parsedValue; |
|
395 | 395 | |
396 | - $markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); |
|
396 | + $markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); |
|
397 | 397 | |
398 | - } |
|
398 | + } |
|
399 | 399 | |
400 | - } |
|
400 | + } |
|
401 | 401 | |
402 | - $output .= $this->cObj->substituteMarkerArray($subpart['block'], $markerArray); |
|
402 | + $output .= $this->cObj->substituteMarkerArray($subpart['block'], $markerArray); |
|
403 | 403 | |
404 | - } |
|
404 | + } |
|
405 | 405 | |
406 | - return $this->cObj->substituteSubpart($this->template, '###BLOCK###', $output, TRUE); |
|
406 | + return $this->cObj->substituteSubpart($this->template, '###BLOCK###', $output, TRUE); |
|
407 | 407 | |
408 | - } |
|
408 | + } |
|
409 | 409 | |
410 | 410 | } |
@@ -213,7 +213,7 @@ |
||
213 | 213 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
214 | 214 | 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.wrap AS wrap', |
215 | 215 | 'tx_dlf_metadata', |
216 | - 'tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata').' AND (sys_language_uid IN (-1,0) OR (sys_language_uid = ' .$GLOBALS['TSFE']->sys_language_uid. ' AND l18n_parent = 0))', |
|
216 | + 'tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata').' AND (sys_language_uid IN (-1,0) OR (sys_language_uid = '.$GLOBALS['TSFE']->sys_language_uid.' AND l18n_parent = 0))', |
|
217 | 217 | '', |
218 | 218 | 'tx_dlf_metadata.sorting', |
219 | 219 | '' |
@@ -222,9 +222,9 @@ |
||
222 | 222 | |
223 | 223 | // Set default values for page if not set. |
224 | 224 | // $this->piVars['page'] may be integer or string (physical structure @ID) |
225 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
225 | + if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
226 | 226 | |
227 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
227 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1); |
|
228 | 228 | |
229 | 229 | } else { |
230 | 230 |
@@ -19,53 +19,53 @@ discard block |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_toc extends tx_dlf_plugin { |
21 | 21 | |
22 | - public $scriptRelPath = 'plugins/toc/class.tx_dlf_toc.php'; |
|
22 | + public $scriptRelPath = 'plugins/toc/class.tx_dlf_toc.php'; |
|
23 | 23 | |
24 | - /** |
|
25 | - * This holds the active entries according to the currently selected page |
|
26 | - * |
|
27 | - * @var array |
|
28 | - * @access protected |
|
29 | - */ |
|
30 | - protected $activeEntries = array (); |
|
24 | + /** |
|
25 | + * This holds the active entries according to the currently selected page |
|
26 | + * |
|
27 | + * @var array |
|
28 | + * @access protected |
|
29 | + */ |
|
30 | + protected $activeEntries = array (); |
|
31 | 31 | |
32 | - /** |
|
33 | - * This builds an array for one menu entry |
|
34 | - * |
|
35 | - * @access protected |
|
36 | - * |
|
37 | - * @param array $entry: The entry's array from tx_dlf_document->getLogicalStructure |
|
38 | - * @param boolean $recursive: Whether to include the child entries |
|
39 | - * |
|
40 | - * @return array HMENU array for menu entry |
|
41 | - */ |
|
42 | - protected function getMenuEntry(array $entry, $recursive = FALSE) { |
|
32 | + /** |
|
33 | + * This builds an array for one menu entry |
|
34 | + * |
|
35 | + * @access protected |
|
36 | + * |
|
37 | + * @param array $entry: The entry's array from tx_dlf_document->getLogicalStructure |
|
38 | + * @param boolean $recursive: Whether to include the child entries |
|
39 | + * |
|
40 | + * @return array HMENU array for menu entry |
|
41 | + */ |
|
42 | + protected function getMenuEntry(array $entry, $recursive = FALSE) { |
|
43 | 43 | |
44 | - $entryArray = array (); |
|
44 | + $entryArray = array (); |
|
45 | 45 | |
46 | - // Set "title", "volume", "type" and "pagination" from $entry array. |
|
47 | - $entryArray['title'] = $entry['label']; |
|
46 | + // Set "title", "volume", "type" and "pagination" from $entry array. |
|
47 | + $entryArray['title'] = $entry['label']; |
|
48 | 48 | |
49 | - $entryArray['volume'] = $entry['volume']; |
|
49 | + $entryArray['volume'] = $entry['volume']; |
|
50 | 50 | |
51 | - $entryArray['orderlabel'] = $entry['orderlabel']; |
|
51 | + $entryArray['orderlabel'] = $entry['orderlabel']; |
|
52 | 52 | |
53 | - $entryArray['type'] = tx_dlf_helper::translate($entry['type'], 'tx_dlf_structures', $this->conf['pages']); |
|
53 | + $entryArray['type'] = tx_dlf_helper::translate($entry['type'], 'tx_dlf_structures', $this->conf['pages']); |
|
54 | 54 | |
55 | - $entryArray['pagination'] = $entry['pagination']; |
|
55 | + $entryArray['pagination'] = $entry['pagination']; |
|
56 | 56 | |
57 | - $entryArray['_OVERRIDE_HREF'] = ''; |
|
57 | + $entryArray['_OVERRIDE_HREF'] = ''; |
|
58 | 58 | |
59 | - $entryArray['doNotLinkIt'] = 1; |
|
59 | + $entryArray['doNotLinkIt'] = 1; |
|
60 | 60 | |
61 | - $entryArray['ITEM_STATE'] = 'NO'; |
|
61 | + $entryArray['ITEM_STATE'] = 'NO'; |
|
62 | 62 | |
63 | - // Build menu links based on the $entry['points'] array. |
|
64 | - if (!empty($entry['points']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($entry['points'])) { |
|
63 | + // Build menu links based on the $entry['points'] array. |
|
64 | + if (!empty($entry['points']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($entry['points'])) { |
|
65 | 65 | |
66 | - $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('page' => $entry['points']), TRUE, FALSE, $this->conf['targetPid']); |
|
66 | + $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('page' => $entry['points']), TRUE, FALSE, $this->conf['targetPid']); |
|
67 | 67 | |
68 | - $entryArray['doNotLinkIt'] = 0; |
|
68 | + $entryArray['doNotLinkIt'] = 0; |
|
69 | 69 | |
70 | 70 | if ($this->conf['basketButton']) { |
71 | 71 | |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | |
76 | 76 | } elseif (!empty($entry['points']) && is_string($entry['points'])) { |
77 | 77 | |
78 | - $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['points'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']); |
|
78 | + $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['points'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']); |
|
79 | 79 | |
80 | - $entryArray['doNotLinkIt'] = 0; |
|
80 | + $entryArray['doNotLinkIt'] = 0; |
|
81 | 81 | |
82 | 82 | if ($this->conf['basketButton']) { |
83 | 83 | |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | |
88 | 88 | } elseif (!empty($entry['targetUid'])) { |
89 | 89 | |
90 | - $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['targetUid'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']); |
|
90 | + $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['targetUid'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']); |
|
91 | 91 | |
92 | - $entryArray['doNotLinkIt'] = 0; |
|
92 | + $entryArray['doNotLinkIt'] = 0; |
|
93 | 93 | |
94 | 94 | if ($this->conf['basketButton']) { |
95 | 95 | |
@@ -99,230 +99,230 @@ discard block |
||
99 | 99 | |
100 | 100 | } |
101 | 101 | |
102 | - // Set "ITEM_STATE" to "CUR" if this entry points to current page. |
|
103 | - if (in_array($entry['id'], $this->activeEntries)) { |
|
102 | + // Set "ITEM_STATE" to "CUR" if this entry points to current page. |
|
103 | + if (in_array($entry['id'], $this->activeEntries)) { |
|
104 | 104 | |
105 | - $entryArray['ITEM_STATE'] = 'CUR'; |
|
105 | + $entryArray['ITEM_STATE'] = 'CUR'; |
|
106 | 106 | |
107 | - } |
|
107 | + } |
|
108 | 108 | |
109 | - // Build sub-menu if available and called recursively. |
|
110 | - if ($recursive == TRUE && !empty($entry['children'])) { |
|
109 | + // Build sub-menu if available and called recursively. |
|
110 | + if ($recursive == TRUE && !empty($entry['children'])) { |
|
111 | 111 | |
112 | - // Build sub-menu only if one of the following conditions apply: |
|
113 | - // 1. "expAll" is set for menu |
|
114 | - // 2. Current menu node is in rootline |
|
115 | - // 3. Current menu node points to another file |
|
116 | - // 4. Current menu node has no corresponding images |
|
117 | - if (!empty($this->conf['menuConf.']['expAll']) || $entryArray['ITEM_STATE'] == 'CUR' || is_string($entry['points']) || empty($this->doc->smLinks['l2p'][$entry['id']])) { |
|
112 | + // Build sub-menu only if one of the following conditions apply: |
|
113 | + // 1. "expAll" is set for menu |
|
114 | + // 2. Current menu node is in rootline |
|
115 | + // 3. Current menu node points to another file |
|
116 | + // 4. Current menu node has no corresponding images |
|
117 | + if (!empty($this->conf['menuConf.']['expAll']) || $entryArray['ITEM_STATE'] == 'CUR' || is_string($entry['points']) || empty($this->doc->smLinks['l2p'][$entry['id']])) { |
|
118 | 118 | |
119 | - $entryArray['_SUB_MENU'] = array (); |
|
119 | + $entryArray['_SUB_MENU'] = array (); |
|
120 | 120 | |
121 | - foreach ($entry['children'] as $child) { |
|
121 | + foreach ($entry['children'] as $child) { |
|
122 | 122 | |
123 | - // Set "ITEM_STATE" to "ACT" if this entry points to current page and has sub-entries pointing to the same page. |
|
124 | - if (in_array($child['id'], $this->activeEntries)) { |
|
123 | + // Set "ITEM_STATE" to "ACT" if this entry points to current page and has sub-entries pointing to the same page. |
|
124 | + if (in_array($child['id'], $this->activeEntries)) { |
|
125 | 125 | |
126 | - $entryArray['ITEM_STATE'] = 'ACT'; |
|
126 | + $entryArray['ITEM_STATE'] = 'ACT'; |
|
127 | 127 | |
128 | - } |
|
128 | + } |
|
129 | 129 | |
130 | - $entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, TRUE); |
|
130 | + $entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, TRUE); |
|
131 | 131 | |
132 | - } |
|
132 | + } |
|
133 | 133 | |
134 | - } |
|
134 | + } |
|
135 | 135 | |
136 | - // Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries. |
|
137 | - $entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'].'IFSUB'); |
|
136 | + // Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries. |
|
137 | + $entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'].'IFSUB'); |
|
138 | 138 | |
139 | - } |
|
139 | + } |
|
140 | 140 | |
141 | - return $entryArray; |
|
141 | + return $entryArray; |
|
142 | 142 | |
143 | - } |
|
143 | + } |
|
144 | 144 | |
145 | - /** |
|
146 | - * The main method of the PlugIn |
|
147 | - * |
|
148 | - * @access public |
|
149 | - * |
|
150 | - * @param string $content: The PlugIn content |
|
151 | - * @param array $conf: The PlugIn configuration |
|
152 | - * |
|
153 | - * @return string The content that is displayed on the website |
|
154 | - */ |
|
155 | - public function main($content, $conf) { |
|
145 | + /** |
|
146 | + * The main method of the PlugIn |
|
147 | + * |
|
148 | + * @access public |
|
149 | + * |
|
150 | + * @param string $content: The PlugIn content |
|
151 | + * @param array $conf: The PlugIn configuration |
|
152 | + * |
|
153 | + * @return string The content that is displayed on the website |
|
154 | + */ |
|
155 | + public function main($content, $conf) { |
|
156 | 156 | |
157 | - $this->init($conf); |
|
157 | + $this->init($conf); |
|
158 | 158 | |
159 | - // Check for typoscript configuration to prevent fatal error. |
|
160 | - if (empty($this->conf['menuConf.'])) { |
|
159 | + // Check for typoscript configuration to prevent fatal error. |
|
160 | + if (empty($this->conf['menuConf.'])) { |
|
161 | 161 | |
162 | - if (TYPO3_DLOG) { |
|
162 | + if (TYPO3_DLOG) { |
|
163 | 163 | |
164 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toc->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
164 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toc->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
165 | 165 | |
166 | - } |
|
166 | + } |
|
167 | 167 | |
168 | - return $content; |
|
168 | + return $content; |
|
169 | 169 | |
170 | - } |
|
170 | + } |
|
171 | 171 | |
172 | - // Load template file. |
|
173 | - if (!empty($this->conf['templateFile'])) { |
|
172 | + // Load template file. |
|
173 | + if (!empty($this->conf['templateFile'])) { |
|
174 | 174 | |
175 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
175 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
176 | 176 | |
177 | - } else { |
|
177 | + } else { |
|
178 | 178 | |
179 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toc/template.tmpl'), '###TEMPLATE###'); |
|
179 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toc/template.tmpl'), '###TEMPLATE###'); |
|
180 | 180 | |
181 | - } |
|
181 | + } |
|
182 | 182 | |
183 | - $TSconfig = array (); |
|
183 | + $TSconfig = array (); |
|
184 | 184 | |
185 | - $TSconfig['special'] = 'userfunction'; |
|
185 | + $TSconfig['special'] = 'userfunction'; |
|
186 | 186 | |
187 | - $TSconfig['special.']['userFunc'] = 'tx_dlf_toc->makeMenuArray'; |
|
187 | + $TSconfig['special.']['userFunc'] = 'tx_dlf_toc->makeMenuArray'; |
|
188 | 188 | |
189 | - $TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['menuConf.'], $TSconfig); |
|
189 | + $TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['menuConf.'], $TSconfig); |
|
190 | 190 | |
191 | - $markerArray['###TOCMENU###'] = $this->cObj->HMENU($TSconfig); |
|
191 | + $markerArray['###TOCMENU###'] = $this->cObj->HMENU($TSconfig); |
|
192 | 192 | |
193 | - $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
193 | + $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
194 | 194 | |
195 | - return $this->pi_wrapInBaseClass($content); |
|
195 | + return $this->pi_wrapInBaseClass($content); |
|
196 | 196 | |
197 | - } |
|
197 | + } |
|
198 | 198 | |
199 | - /** |
|
200 | - * This builds a menu array for HMENU |
|
201 | - * |
|
202 | - * @access public |
|
203 | - * |
|
204 | - * @param string $content: The PlugIn content |
|
205 | - * @param array $conf: The PlugIn configuration |
|
206 | - * |
|
207 | - * @return array HMENU array |
|
208 | - */ |
|
209 | - public function makeMenuArray($content, $conf) { |
|
199 | + /** |
|
200 | + * This builds a menu array for HMENU |
|
201 | + * |
|
202 | + * @access public |
|
203 | + * |
|
204 | + * @param string $content: The PlugIn content |
|
205 | + * @param array $conf: The PlugIn configuration |
|
206 | + * |
|
207 | + * @return array HMENU array |
|
208 | + */ |
|
209 | + public function makeMenuArray($content, $conf) { |
|
210 | 210 | |
211 | - $this->init($conf); |
|
211 | + $this->init($conf); |
|
212 | 212 | |
213 | - // Load current document. |
|
214 | - $this->loadDocument(); |
|
213 | + // Load current document. |
|
214 | + $this->loadDocument(); |
|
215 | 215 | |
216 | - if ($this->doc === NULL) { |
|
216 | + if ($this->doc === NULL) { |
|
217 | 217 | |
218 | - // Quit without doing anything if required variables are not set. |
|
219 | - return array (); |
|
218 | + // Quit without doing anything if required variables are not set. |
|
219 | + return array (); |
|
220 | 220 | |
221 | - } else { |
|
221 | + } else { |
|
222 | 222 | |
223 | - if (!empty($this->piVars['logicalPage'])) { |
|
223 | + if (!empty($this->piVars['logicalPage'])) { |
|
224 | 224 | |
225 | - $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
226 | - // The logical page parameter should not appear again |
|
227 | - unset($this->piVars['logicalPage']); |
|
225 | + $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
226 | + // The logical page parameter should not appear again |
|
227 | + unset($this->piVars['logicalPage']); |
|
228 | 228 | |
229 | - } |
|
229 | + } |
|
230 | 230 | |
231 | - // Set default values for page if not set. |
|
232 | - // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
233 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
231 | + // Set default values for page if not set. |
|
232 | + // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
233 | + if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
234 | 234 | |
235 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
235 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
236 | 236 | |
237 | - } else { |
|
237 | + } else { |
|
238 | 238 | |
239 | - $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
239 | + $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
240 | 240 | |
241 | - } |
|
241 | + } |
|
242 | 242 | |
243 | - $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
243 | + $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
244 | 244 | |
245 | - } |
|
245 | + } |
|
246 | 246 | |
247 | - $menuArray = array (); |
|
247 | + $menuArray = array (); |
|
248 | 248 | |
249 | - // Does the document have physical elements or is it an external file? |
|
250 | - if ($this->doc->physicalStructure || !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->doc->uid)) { |
|
249 | + // Does the document have physical elements or is it an external file? |
|
250 | + if ($this->doc->physicalStructure || !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->doc->uid)) { |
|
251 | 251 | |
252 | - // Get all logical units the current page or track is a part of. |
|
253 | - if (!empty($this->piVars['page']) && $this->doc->physicalStructure) { |
|
252 | + // Get all logical units the current page or track is a part of. |
|
253 | + if (!empty($this->piVars['page']) && $this->doc->physicalStructure) { |
|
254 | 254 | |
255 | - $this->activeEntries = array_merge((array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[0]], (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]]); |
|
255 | + $this->activeEntries = array_merge((array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[0]], (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]]); |
|
256 | 256 | |
257 | - if (!empty($this->piVars['double']) && $this->piVars['page'] < $this->doc->numPages) { |
|
257 | + if (!empty($this->piVars['double']) && $this->piVars['page'] < $this->doc->numPages) { |
|
258 | 258 | |
259 | - $this->activeEntries = array_merge($this->activeEntries, (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page'] + 1]]); |
|
259 | + $this->activeEntries = array_merge($this->activeEntries, (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page'] + 1]]); |
|
260 | 260 | |
261 | - } |
|
261 | + } |
|
262 | 262 | |
263 | - } |
|
263 | + } |
|
264 | 264 | |
265 | - // Go through table of contents and create all menu entries. |
|
266 | - foreach ($this->doc->tableOfContents as $entry) { |
|
265 | + // Go through table of contents and create all menu entries. |
|
266 | + foreach ($this->doc->tableOfContents as $entry) { |
|
267 | 267 | |
268 | - $menuArray[] = $this->getMenuEntry($entry, TRUE); |
|
268 | + $menuArray[] = $this->getMenuEntry($entry, TRUE); |
|
269 | 269 | |
270 | - } |
|
270 | + } |
|
271 | 271 | |
272 | - } else { |
|
272 | + } else { |
|
273 | 273 | |
274 | - // Go through table of contents and create top-level menu entries. |
|
275 | - foreach ($this->doc->tableOfContents as $entry) { |
|
274 | + // Go through table of contents and create top-level menu entries. |
|
275 | + foreach ($this->doc->tableOfContents as $entry) { |
|
276 | 276 | |
277 | - $menuArray[] = $this->getMenuEntry($entry, FALSE); |
|
277 | + $menuArray[] = $this->getMenuEntry($entry, FALSE); |
|
278 | 278 | |
279 | - } |
|
279 | + } |
|
280 | 280 | |
281 | - // Get all child documents from database. |
|
282 | - $whereClause = 'tx_dlf_documents.partof='.intval($this->doc->uid).' AND tx_dlf_documents.structure=tx_dlf_structures.uid AND tx_dlf_structures.pid='.$this->doc->pid.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_structures'); |
|
281 | + // Get all child documents from database. |
|
282 | + $whereClause = 'tx_dlf_documents.partof='.intval($this->doc->uid).' AND tx_dlf_documents.structure=tx_dlf_structures.uid AND tx_dlf_structures.pid='.$this->doc->pid.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_structures'); |
|
283 | 283 | |
284 | - if ($this->conf['excludeOther']) { |
|
284 | + if ($this->conf['excludeOther']) { |
|
285 | 285 | |
286 | - $whereClause .= ' AND tx_dlf_documents.pid='.intval($this->conf['pages']); |
|
286 | + $whereClause .= ' AND tx_dlf_documents.pid='.intval($this->conf['pages']); |
|
287 | 287 | |
288 | - } |
|
288 | + } |
|
289 | 289 | |
290 | - // Build table of contents from database. |
|
291 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
292 | - 'tx_dlf_documents.uid AS uid,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_structures.index_name AS type', |
|
293 | - 'tx_dlf_documents,tx_dlf_structures', |
|
294 | - $whereClause, |
|
295 | - '', |
|
296 | - 'tx_dlf_documents.volume_sorting', |
|
297 | - '' |
|
298 | - ); |
|
290 | + // Build table of contents from database. |
|
291 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
292 | + 'tx_dlf_documents.uid AS uid,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_structures.index_name AS type', |
|
293 | + 'tx_dlf_documents,tx_dlf_structures', |
|
294 | + $whereClause, |
|
295 | + '', |
|
296 | + 'tx_dlf_documents.volume_sorting', |
|
297 | + '' |
|
298 | + ); |
|
299 | 299 | |
300 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
300 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
301 | 301 | |
302 | - $menuArray[0]['ITEM_STATE'] = 'CURIFSUB'; |
|
302 | + $menuArray[0]['ITEM_STATE'] = 'CURIFSUB'; |
|
303 | 303 | |
304 | - $menuArray[0]['_SUB_MENU'] = array (); |
|
304 | + $menuArray[0]['_SUB_MENU'] = array (); |
|
305 | 305 | |
306 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
306 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
307 | 307 | |
308 | - $entry = array ( |
|
309 | - 'label' => $resArray['title'], |
|
310 | - 'type' => $resArray['type'], |
|
311 | - 'volume' => $resArray['volume'], |
|
312 | - 'pagination' => '', |
|
313 | - 'targetUid' => $resArray['uid'] |
|
314 | - ); |
|
308 | + $entry = array ( |
|
309 | + 'label' => $resArray['title'], |
|
310 | + 'type' => $resArray['type'], |
|
311 | + 'volume' => $resArray['volume'], |
|
312 | + 'pagination' => '', |
|
313 | + 'targetUid' => $resArray['uid'] |
|
314 | + ); |
|
315 | 315 | |
316 | - $menuArray[0]['_SUB_MENU'][] = $this->getMenuEntry($entry, FALSE); |
|
316 | + $menuArray[0]['_SUB_MENU'][] = $this->getMenuEntry($entry, FALSE); |
|
317 | 317 | |
318 | - } |
|
318 | + } |
|
319 | 319 | |
320 | - } |
|
320 | + } |
|
321 | 321 | |
322 | - } |
|
322 | + } |
|
323 | 323 | |
324 | - return $menuArray; |
|
324 | + return $menuArray; |
|
325 | 325 | |
326 | - } |
|
326 | + } |
|
327 | 327 | |
328 | 328 | } |
@@ -19,414 +19,414 @@ |
||
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 | } |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | |
132 | 132 | // Set default values if not set. |
133 | 133 | // $this->piVars['page'] may be integer or string (physical structure @ID) |
134 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
134 | + if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
135 | 135 | |
136 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
136 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1); |
|
137 | 137 | |
138 | 138 | } else { |
139 | 139 | |
@@ -271,11 +271,11 @@ discard block |
||
271 | 271 | $markerArray['###LINKLISTVIEW###'] = $this->getLinkToListview(); |
272 | 272 | |
273 | 273 | // fill some language labels if available |
274 | - $markerArray['###ZOOM_IN###'] = $this->pi_getLL('zoom-in', '', TRUE); |
|
274 | + $markerArray['###ZOOM_IN###'] = $this->pi_getLL('zoom-in', '', TRUE); |
|
275 | 275 | $markerArray['###ZOOM_OUT###'] = $this->pi_getLL('zoom-out', '', TRUE); |
276 | 276 | $markerArray['###ZOOM_FULLSCREEN###'] = $this->pi_getLL('zoom-fullscreen', '', TRUE); |
277 | 277 | |
278 | - $markerArray['###ROTATE_LEFT###'] = $this->pi_getLL('rotate-left', '', TRUE); |
|
278 | + $markerArray['###ROTATE_LEFT###'] = $this->pi_getLL('rotate-left', '', TRUE); |
|
279 | 279 | $markerArray['###ROTATE_RIGHT###'] = $this->pi_getLL('rotate-right', '', TRUE); |
280 | 280 | $markerArray['###ROTATE_RESET###'] = $this->pi_getLL('rotate-reset', '', TRUE); |
281 | 281 |
@@ -19,315 +19,315 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_navigation extends tx_dlf_plugin { |
21 | 21 | |
22 | - public $scriptRelPath = 'plugins/navigation/class.tx_dlf_navigation.php'; |
|
22 | + public $scriptRelPath = 'plugins/navigation/class.tx_dlf_navigation.php'; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Display a link to the list view |
|
26 | - * |
|
27 | - * @access protected |
|
28 | - * |
|
29 | - * @return string Link to the list view ready to output |
|
30 | - */ |
|
31 | - protected function getLinkToListview() { |
|
24 | + /** |
|
25 | + * Display a link to the list view |
|
26 | + * |
|
27 | + * @access protected |
|
28 | + * |
|
29 | + * @return string Link to the list view ready to output |
|
30 | + */ |
|
31 | + protected function getLinkToListview() { |
|
32 | 32 | |
33 | - if (!empty($this->conf['targetPid'])) { |
|
33 | + if (!empty($this->conf['targetPid'])) { |
|
34 | 34 | |
35 | - // Load the list. |
|
36 | - $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
35 | + // Load the list. |
|
36 | + $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
37 | 37 | |
38 | - if (count($list) > 0) { |
|
38 | + if (count($list) > 0) { |
|
39 | 39 | |
40 | - // Build typolink configuration array. |
|
41 | - $conf = array ( |
|
42 | - 'useCacheHash' => 1, |
|
43 | - 'parameter' => $this->conf['targetPid'], |
|
44 | - 'title' => $this->pi_getLL('linkToList', '', TRUE) |
|
45 | - ); |
|
40 | + // Build typolink configuration array. |
|
41 | + $conf = array ( |
|
42 | + 'useCacheHash' => 1, |
|
43 | + 'parameter' => $this->conf['targetPid'], |
|
44 | + 'title' => $this->pi_getLL('linkToList', '', TRUE) |
|
45 | + ); |
|
46 | 46 | |
47 | - return $this->cObj->typoLink($this->pi_getLL('linkToList', '', TRUE), $conf); |
|
47 | + return $this->cObj->typoLink($this->pi_getLL('linkToList', '', TRUE), $conf); |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - } |
|
51 | + } |
|
52 | 52 | |
53 | - return ''; |
|
53 | + return ''; |
|
54 | 54 | |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Display the page selector for the page view |
|
59 | - * |
|
60 | - * @access protected |
|
61 | - * |
|
62 | - * @return string Page selector ready to output |
|
63 | - */ |
|
64 | - protected function getPageSelector() { |
|
57 | + /** |
|
58 | + * Display the page selector for the page view |
|
59 | + * |
|
60 | + * @access protected |
|
61 | + * |
|
62 | + * @return string Page selector ready to output |
|
63 | + */ |
|
64 | + protected function getPageSelector() { |
|
65 | 65 | |
66 | - // Configure @action URL for form. |
|
67 | - $linkConf = array ( |
|
68 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
69 | - 'forceAbsoluteUrl' => 1 |
|
70 | - ); |
|
66 | + // Configure @action URL for form. |
|
67 | + $linkConf = array ( |
|
68 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
69 | + 'forceAbsoluteUrl' => 1 |
|
70 | + ); |
|
71 | 71 | |
72 | - $output = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />'; |
|
72 | + $output = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />'; |
|
73 | 73 | |
74 | - // Add plugin variables. |
|
75 | - foreach ($this->piVars as $piVar => $value) { |
|
74 | + // Add plugin variables. |
|
75 | + foreach ($this->piVars as $piVar => $value) { |
|
76 | 76 | |
77 | - if ($piVar != 'page' && $piVars != 'DATA' && !empty($value)) { |
|
77 | + if ($piVar != 'page' && $piVars != 'DATA' && !empty($value)) { |
|
78 | 78 | |
79 | - $output .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />'; |
|
79 | + $output .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />'; |
|
80 | 80 | |
81 | - } |
|
81 | + } |
|
82 | 82 | |
83 | - } |
|
83 | + } |
|
84 | 84 | |
85 | - // Add page selector. |
|
86 | - $uniqId = uniqid(str_replace('_', '-', get_class($this)).'-'); |
|
85 | + // Add page selector. |
|
86 | + $uniqId = uniqid(str_replace('_', '-', get_class($this)).'-'); |
|
87 | 87 | |
88 | - $output .= '<label for="'.$uniqId.'">'.$this->pi_getLL('selectPage', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[page]" onchange="javascript:this.form.submit();"'.($this->doc->numPages < 1 ? ' disabled="disabled"' : '').'>'; |
|
88 | + $output .= '<label for="'.$uniqId.'">'.$this->pi_getLL('selectPage', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[page]" onchange="javascript:this.form.submit();"'.($this->doc->numPages < 1 ? ' disabled="disabled"' : '').'>'; |
|
89 | 89 | |
90 | - for ($i = 1; $i <= $this->doc->numPages; $i++) { |
|
90 | + for ($i = 1; $i <= $this->doc->numPages; $i++) { |
|
91 | 91 | |
92 | - $output .= '<option value="'.$i.'"'.($this->piVars['page'] == $i ? ' selected="selected"' : '').'>['.$i.']'.($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel'] ? ' - '.htmlspecialchars($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel']) : '').'</option>'; |
|
92 | + $output .= '<option value="'.$i.'"'.($this->piVars['page'] == $i ? ' selected="selected"' : '').'>['.$i.']'.($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel'] ? ' - '.htmlspecialchars($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel']) : '').'</option>'; |
|
93 | 93 | |
94 | - } |
|
94 | + } |
|
95 | 95 | |
96 | - $output .= '</select></div></form>'; |
|
96 | + $output .= '</select></div></form>'; |
|
97 | 97 | |
98 | - return $output; |
|
98 | + return $output; |
|
99 | 99 | |
100 | - } |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
103 | - * The main method of the PlugIn |
|
104 | - * |
|
105 | - * @access public |
|
106 | - * |
|
107 | - * @param string $content: The PlugIn content |
|
108 | - * @param array $conf: The PlugIn configuration |
|
109 | - * |
|
110 | - * @return string The content that is displayed on the website |
|
111 | - */ |
|
112 | - public function main($content, $conf) { |
|
102 | + /** |
|
103 | + * The main method of the PlugIn |
|
104 | + * |
|
105 | + * @access public |
|
106 | + * |
|
107 | + * @param string $content: The PlugIn content |
|
108 | + * @param array $conf: The PlugIn configuration |
|
109 | + * |
|
110 | + * @return string The content that is displayed on the website |
|
111 | + */ |
|
112 | + public function main($content, $conf) { |
|
113 | 113 | |
114 | - $this->init($conf); |
|
114 | + $this->init($conf); |
|
115 | 115 | |
116 | - // Turn cache on. |
|
117 | - $this->setCache(TRUE); |
|
116 | + // Turn cache on. |
|
117 | + $this->setCache(TRUE); |
|
118 | 118 | |
119 | - // Load current document. |
|
120 | - $this->loadDocument(); |
|
119 | + // Load current document. |
|
120 | + $this->loadDocument(); |
|
121 | 121 | |
122 | - if ($this->doc === NULL) { |
|
122 | + if ($this->doc === NULL) { |
|
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 | - } else { |
|
127 | + } else { |
|
128 | 128 | |
129 | - // Set default values if not set. |
|
130 | - if ($this->doc->numPages > 0) { |
|
129 | + // Set default values if not set. |
|
130 | + if ($this->doc->numPages > 0) { |
|
131 | 131 | |
132 | - if (!empty($this->piVars['logicalPage'])) { |
|
132 | + if (!empty($this->piVars['logicalPage'])) { |
|
133 | 133 | |
134 | - $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
135 | - // The logical page parameter should not appear |
|
136 | - unset($this->piVars['logicalPage']); |
|
134 | + $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
135 | + // The logical page parameter should not appear |
|
136 | + unset($this->piVars['logicalPage']); |
|
137 | 137 | |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | - // Set default values if not set. |
|
141 | - // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
142 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
140 | + // Set default values if not set. |
|
141 | + // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
142 | + if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
143 | 143 | |
144 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
144 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
145 | 145 | |
146 | - } else { |
|
146 | + } else { |
|
147 | 147 | |
148 | - $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
148 | + $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
149 | 149 | |
150 | - } |
|
150 | + } |
|
151 | 151 | |
152 | - $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
152 | + $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
153 | 153 | |
154 | - } else { |
|
154 | + } else { |
|
155 | 155 | |
156 | - $this->piVars['page'] = 0; |
|
156 | + $this->piVars['page'] = 0; |
|
157 | 157 | |
158 | - $this->piVars['double'] = 0; |
|
158 | + $this->piVars['double'] = 0; |
|
159 | 159 | |
160 | - } |
|
160 | + } |
|
161 | 161 | |
162 | - } |
|
162 | + } |
|
163 | 163 | |
164 | - // Load template file. |
|
165 | - if (!empty($this->conf['templateFile'])) { |
|
164 | + // Load template file. |
|
165 | + if (!empty($this->conf['templateFile'])) { |
|
166 | 166 | |
167 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
167 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
168 | 168 | |
169 | - } else { |
|
169 | + } else { |
|
170 | 170 | |
171 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/navigation/template.tmpl'), '###TEMPLATE###'); |
|
171 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/navigation/template.tmpl'), '###TEMPLATE###'); |
|
172 | 172 | |
173 | - } |
|
173 | + } |
|
174 | 174 | |
175 | - // Steps for X pages backward / forward. Double page view uses double steps. |
|
176 | - $pageSteps = $this->conf['pageStep'] * ($this->piVars['double'] + 1); |
|
175 | + // Steps for X pages backward / forward. Double page view uses double steps. |
|
176 | + $pageSteps = $this->conf['pageStep'] * ($this->piVars['double'] + 1); |
|
177 | 177 | |
178 | - // Link to first page. |
|
179 | - if ($this->piVars['page'] > 1) { |
|
178 | + // Link to first page. |
|
179 | + if ($this->piVars['page'] > 1) { |
|
180 | 180 | |
181 | - $markerArray['###FIRST###'] = $this->makeLink($this->pi_getLL('firstPage', '', TRUE), array ('page' => 1)); |
|
181 | + $markerArray['###FIRST###'] = $this->makeLink($this->pi_getLL('firstPage', '', TRUE), array ('page' => 1)); |
|
182 | 182 | |
183 | - } else { |
|
183 | + } else { |
|
184 | 184 | |
185 | - $markerArray['###FIRST###'] = '<span>'.$this->pi_getLL('firstPage', '', TRUE).'</span>'; |
|
185 | + $markerArray['###FIRST###'] = '<span>'.$this->pi_getLL('firstPage', '', TRUE).'</span>'; |
|
186 | 186 | |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | - // Link back X pages. |
|
190 | - if ($this->piVars['page'] > $pageSteps) { |
|
189 | + // Link back X pages. |
|
190 | + if ($this->piVars['page'] > $pageSteps) { |
|
191 | 191 | |
192 | - $markerArray['###BACK###'] = $this->makeLink(sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] - $pageSteps)); |
|
192 | + $markerArray['###BACK###'] = $this->makeLink(sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] - $pageSteps)); |
|
193 | 193 | |
194 | - } else { |
|
194 | + } else { |
|
195 | 195 | |
196 | - $markerArray['###BACK###'] = '<span>'.sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps).'</span>'; |
|
196 | + $markerArray['###BACK###'] = '<span>'.sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps).'</span>'; |
|
197 | 197 | |
198 | - } |
|
198 | + } |
|
199 | 199 | |
200 | - // Link to previous page. |
|
201 | - if ($this->piVars['page'] > (1 + $this->piVars['double'])) { |
|
200 | + // Link to previous page. |
|
201 | + if ($this->piVars['page'] > (1 + $this->piVars['double'])) { |
|
202 | 202 | |
203 | - $markerArray['###PREVIOUS###'] = $this->makeLink($this->pi_getLL('prevPage', '', TRUE), array ('page' => $this->piVars['page'] - (1 + $this->piVars['double']))); |
|
203 | + $markerArray['###PREVIOUS###'] = $this->makeLink($this->pi_getLL('prevPage', '', TRUE), array ('page' => $this->piVars['page'] - (1 + $this->piVars['double']))); |
|
204 | 204 | |
205 | - } else { |
|
205 | + } else { |
|
206 | 206 | |
207 | - $markerArray['###PREVIOUS###'] = '<span>'.$this->pi_getLL('prevPage', '', TRUE).'</span>'; |
|
207 | + $markerArray['###PREVIOUS###'] = '<span>'.$this->pi_getLL('prevPage', '', TRUE).'</span>'; |
|
208 | 208 | |
209 | - } |
|
209 | + } |
|
210 | 210 | |
211 | - // Link to next page. |
|
212 | - if ($this->piVars['page'] < ($this->doc->numPages - $this->piVars['double'])) { |
|
211 | + // Link to next page. |
|
212 | + if ($this->piVars['page'] < ($this->doc->numPages - $this->piVars['double'])) { |
|
213 | 213 | |
214 | - $markerArray['###NEXT###'] = $this->makeLink($this->pi_getLL('nextPage', '', TRUE), array ('page' => $this->piVars['page'] + (1 + $this->piVars['double']))); |
|
214 | + $markerArray['###NEXT###'] = $this->makeLink($this->pi_getLL('nextPage', '', TRUE), array ('page' => $this->piVars['page'] + (1 + $this->piVars['double']))); |
|
215 | 215 | |
216 | - } else { |
|
216 | + } else { |
|
217 | 217 | |
218 | - $markerArray['###NEXT###'] = '<span>'.$this->pi_getLL('nextPage', '', TRUE).'</span>'; |
|
218 | + $markerArray['###NEXT###'] = '<span>'.$this->pi_getLL('nextPage', '', TRUE).'</span>'; |
|
219 | 219 | |
220 | - } |
|
220 | + } |
|
221 | 221 | |
222 | - // Link forward X pages. |
|
223 | - if ($this->piVars['page'] <= ($this->doc->numPages - $pageSteps)) { |
|
222 | + // Link forward X pages. |
|
223 | + if ($this->piVars['page'] <= ($this->doc->numPages - $pageSteps)) { |
|
224 | 224 | |
225 | - $markerArray['###FORWARD###'] = $this->makeLink(sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] + $pageSteps)); |
|
225 | + $markerArray['###FORWARD###'] = $this->makeLink(sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] + $pageSteps)); |
|
226 | 226 | |
227 | - } else { |
|
227 | + } else { |
|
228 | 228 | |
229 | - $markerArray['###FORWARD###'] = '<span>'.sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps).'</span>'; |
|
229 | + $markerArray['###FORWARD###'] = '<span>'.sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps).'</span>'; |
|
230 | 230 | |
231 | - } |
|
231 | + } |
|
232 | 232 | |
233 | - // Link to last page. |
|
234 | - if ($this->piVars['page'] < $this->doc->numPages) { |
|
233 | + // Link to last page. |
|
234 | + if ($this->piVars['page'] < $this->doc->numPages) { |
|
235 | 235 | |
236 | - $markerArray['###LAST###'] = $this->makeLink($this->pi_getLL('lastPage', '', TRUE), array ('page' => $this->doc->numPages)); |
|
236 | + $markerArray['###LAST###'] = $this->makeLink($this->pi_getLL('lastPage', '', TRUE), array ('page' => $this->doc->numPages)); |
|
237 | 237 | |
238 | - } else { |
|
238 | + } else { |
|
239 | 239 | |
240 | - $markerArray['###LAST###'] = '<span>'.$this->pi_getLL('lastPage', '', TRUE).'</span>'; |
|
240 | + $markerArray['###LAST###'] = '<span>'.$this->pi_getLL('lastPage', '', TRUE).'</span>'; |
|
241 | 241 | |
242 | - } |
|
242 | + } |
|
243 | 243 | |
244 | - // Add double page switcher. |
|
245 | - if ($this->doc->numPages > 0) { |
|
244 | + // Add double page switcher. |
|
245 | + if ($this->doc->numPages > 0) { |
|
246 | 246 | |
247 | - if (!$this->piVars['double']) { |
|
247 | + if (!$this->piVars['double']) { |
|
248 | 248 | |
249 | - $markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOn', '', TRUE), array ('double' => 1), 'class="tx-dlf-navigation-doubleOn"'); |
|
249 | + $markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOn', '', TRUE), array ('double' => 1), 'class="tx-dlf-navigation-doubleOn"'); |
|
250 | 250 | |
251 | - } else { |
|
251 | + } else { |
|
252 | 252 | |
253 | - $markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOff', '', TRUE), array ('double' => 0), 'class="tx-dlf-navigation-doubleOff"'); |
|
253 | + $markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOff', '', TRUE), array ('double' => 0), 'class="tx-dlf-navigation-doubleOff"'); |
|
254 | 254 | |
255 | - } |
|
255 | + } |
|
256 | 256 | |
257 | - if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) { |
|
257 | + if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) { |
|
258 | 258 | |
259 | - $markerArray['###DOUBLEPAGE+1###'] = $this->makeLink($this->pi_getLL('doublePage+1', '', TRUE), array ('page' => $this->piVars['page'] + 1)); |
|
259 | + $markerArray['###DOUBLEPAGE+1###'] = $this->makeLink($this->pi_getLL('doublePage+1', '', TRUE), array ('page' => $this->piVars['page'] + 1)); |
|
260 | 260 | |
261 | - } else { |
|
261 | + } else { |
|
262 | 262 | |
263 | - $markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>'; |
|
263 | + $markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>'; |
|
264 | 264 | |
265 | - } |
|
265 | + } |
|
266 | 266 | |
267 | - } else { |
|
267 | + } else { |
|
268 | 268 | |
269 | - $markerArray['###DOUBLEPAGE###'] = '<span>'.$this->pi_getLL('doublePageOn', '', TRUE).'</span>'; |
|
269 | + $markerArray['###DOUBLEPAGE###'] = '<span>'.$this->pi_getLL('doublePageOn', '', TRUE).'</span>'; |
|
270 | 270 | |
271 | - $markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>'; |
|
271 | + $markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>'; |
|
272 | 272 | |
273 | - } |
|
273 | + } |
|
274 | 274 | |
275 | - // Add page selector. |
|
276 | - $markerArray['###PAGESELECT###'] = $this->getPageSelector(); |
|
275 | + // Add page selector. |
|
276 | + $markerArray['###PAGESELECT###'] = $this->getPageSelector(); |
|
277 | 277 | |
278 | - // Add link to listview if applicable. |
|
279 | - $markerArray['###LINKLISTVIEW###'] = $this->getLinkToListview(); |
|
278 | + // Add link to listview if applicable. |
|
279 | + $markerArray['###LINKLISTVIEW###'] = $this->getLinkToListview(); |
|
280 | 280 | |
281 | - // fill some language labels if available |
|
282 | - $markerArray['###ZOOM_IN###'] = $this->pi_getLL('zoom-in', '', TRUE); |
|
283 | - $markerArray['###ZOOM_OUT###'] = $this->pi_getLL('zoom-out', '', TRUE); |
|
284 | - $markerArray['###ZOOM_FULLSCREEN###'] = $this->pi_getLL('zoom-fullscreen', '', TRUE); |
|
281 | + // fill some language labels if available |
|
282 | + $markerArray['###ZOOM_IN###'] = $this->pi_getLL('zoom-in', '', TRUE); |
|
283 | + $markerArray['###ZOOM_OUT###'] = $this->pi_getLL('zoom-out', '', TRUE); |
|
284 | + $markerArray['###ZOOM_FULLSCREEN###'] = $this->pi_getLL('zoom-fullscreen', '', TRUE); |
|
285 | 285 | |
286 | - $markerArray['###ROTATE_LEFT###'] = $this->pi_getLL('rotate-left', '', TRUE); |
|
287 | - $markerArray['###ROTATE_RIGHT###'] = $this->pi_getLL('rotate-right', '', TRUE); |
|
288 | - $markerArray['###ROTATE_RESET###'] = $this->pi_getLL('rotate-reset', '', TRUE); |
|
286 | + $markerArray['###ROTATE_LEFT###'] = $this->pi_getLL('rotate-left', '', TRUE); |
|
287 | + $markerArray['###ROTATE_RIGHT###'] = $this->pi_getLL('rotate-right', '', TRUE); |
|
288 | + $markerArray['###ROTATE_RESET###'] = $this->pi_getLL('rotate-reset', '', TRUE); |
|
289 | 289 | |
290 | - $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
290 | + $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
291 | 291 | |
292 | - return $this->pi_wrapInBaseClass($content); |
|
292 | + return $this->pi_wrapInBaseClass($content); |
|
293 | 293 | |
294 | - } |
|
294 | + } |
|
295 | 295 | |
296 | - /** |
|
297 | - * Generates a navigation link |
|
298 | - * |
|
299 | - * @access protected |
|
300 | - * |
|
301 | - * @param string $label: The link's text |
|
302 | - * @param array $overrulePIvars: The new set of plugin variables |
|
303 | - * @param string $aTagParams: Additional HTML attributes for link tag |
|
304 | - * |
|
305 | - * @return string Typolink ready to output |
|
306 | - */ |
|
307 | - protected function makeLink($label, array $overrulePIvars = array (), $aTagParams = '') { |
|
296 | + /** |
|
297 | + * Generates a navigation link |
|
298 | + * |
|
299 | + * @access protected |
|
300 | + * |
|
301 | + * @param string $label: The link's text |
|
302 | + * @param array $overrulePIvars: The new set of plugin variables |
|
303 | + * @param string $aTagParams: Additional HTML attributes for link tag |
|
304 | + * |
|
305 | + * @return string Typolink ready to output |
|
306 | + */ |
|
307 | + protected function makeLink($label, array $overrulePIvars = array (), $aTagParams = '') { |
|
308 | 308 | |
309 | - // Merge plugin variables with new set of values. |
|
310 | - if (is_array($this->piVars)) { |
|
309 | + // Merge plugin variables with new set of values. |
|
310 | + if (is_array($this->piVars)) { |
|
311 | 311 | |
312 | - $piVars = $this->piVars; |
|
312 | + $piVars = $this->piVars; |
|
313 | 313 | |
314 | - unset($piVars['DATA']); |
|
314 | + unset($piVars['DATA']); |
|
315 | 315 | |
316 | - $overrulePIvars = tx_dlf_helper::array_merge_recursive_overrule($piVars, $overrulePIvars); |
|
316 | + $overrulePIvars = tx_dlf_helper::array_merge_recursive_overrule($piVars, $overrulePIvars); |
|
317 | 317 | |
318 | - } |
|
318 | + } |
|
319 | 319 | |
320 | - // Build typolink configuration array. |
|
321 | - $conf = array ( |
|
322 | - 'useCacheHash' => 1, |
|
323 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
324 | - 'ATagParams' => $aTagParams, |
|
325 | - 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $overrulePIvars, '', TRUE, FALSE), |
|
326 | - 'title' => $label |
|
327 | - ); |
|
320 | + // Build typolink configuration array. |
|
321 | + $conf = array ( |
|
322 | + 'useCacheHash' => 1, |
|
323 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
324 | + 'ATagParams' => $aTagParams, |
|
325 | + 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $overrulePIvars, '', TRUE, FALSE), |
|
326 | + 'title' => $label |
|
327 | + ); |
|
328 | 328 | |
329 | - return $this->cObj->typoLink($label, $conf); |
|
329 | + return $this->cObj->typoLink($label, $conf); |
|
330 | 330 | |
331 | - } |
|
331 | + } |
|
332 | 332 | |
333 | 333 | } |
@@ -19,35 +19,35 @@ discard block |
||
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 |
||
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 | } |
@@ -55,9 +55,9 @@ |
||
55 | 55 | $(document).ready(function() { |
56 | 56 | tx_dlf_audioplayer = new dlfAudioPlayer({ |
57 | 57 | audio: { |
58 | - mimeType: "' . $this->audio['mimetype'] . '", |
|
59 | - title: "' . $this->audio['label'] . '", |
|
60 | - url: "' . $this->audio['url'] . '" |
|
58 | + mimeType: "' . $this->audio['mimetype'].'", |
|
59 | + title: "' . $this->audio['label'].'", |
|
60 | + url: "' . $this->audio['url'].'" |
|
61 | 61 | }, |
62 | 62 | parentElId: "tx-dlf-audio", |
63 | 63 | swfPath: "'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/jquery.jplayer.swf" |
@@ -22,65 +22,65 @@ |
||
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 |
@@ -63,11 +63,11 @@ |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | // add some self calculated header tags |
66 | - header('Last-Modified: ' . gmdate( "D, d M Y H:i:s" ) . 'GMT'); |
|
66 | + header('Last-Modified: '.gmdate("D, d M Y H:i:s").'GMT'); |
|
67 | 67 | header('Cache-Control: max-age=3600, must-revalidate'); |
68 | 68 | header('Content-Length: '.strlen($fetchedData)); |
69 | 69 | $fi = finfo_open(FILEINFO_MIME); |
70 | - header('Content-Type: ' . finfo_buffer($fi, $fetchedData)); |
|
70 | + header('Content-Type: '.finfo_buffer($fi, $fetchedData)); |
|
71 | 71 | |
72 | 72 | // take some tags from request header and overwrite in case already set |
73 | 73 | $fetchedHeader = explode("\n", GeneralUtility::getUrl($url, 2)); |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | window.onload = function() { |
87 | 87 | if (dlfUtils.exists(dlfViewer)) { |
88 | 88 | tx_dlf_viewer = new dlfViewer({ |
89 | - controls: ["' . implode('", "', $this->controls) . '"], |
|
90 | - div: "' . $this->conf['elementId'] . '", |
|
91 | - images: ' . json_encode($this->images) . ', |
|
92 | - fulltexts: '. json_encode($this->fulltexts) . ', |
|
93 | - useInternalProxy: ' . ($this->conf['useInternalProxy'] ? 1 : 0) .' |
|
89 | + controls: ["' . implode('", "', $this->controls).'"], |
|
90 | + div: "' . $this->conf['elementId'].'", |
|
91 | + images: ' . json_encode($this->images).', |
|
92 | + fulltexts: '. json_encode($this->fulltexts).', |
|
93 | + useInternalProxy: ' . ($this->conf['useInternalProxy'] ? 1 : 0).' |
|
94 | 94 | }) |
95 | 95 | } |
96 | 96 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | protected function addInteraction() { |
111 | 111 | |
112 | - $markerArray = array(); |
|
112 | + $markerArray = array (); |
|
113 | 113 | |
114 | 114 | if ($this->piVars['id']) { |
115 | 115 | |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | */ |
158 | 158 | protected function addBasketForm() { |
159 | 159 | |
160 | - $markerArray = array(); |
|
160 | + $markerArray = array (); |
|
161 | 161 | |
162 | 162 | // Add basket button |
163 | 163 | if ($this->conf['basketButton'] && $this->conf['targetBasket'] && $this->piVars['id']) { |
164 | 164 | |
165 | 165 | $label = $this->pi_getLL('addBasket', '', TRUE); |
166 | 166 | |
167 | - $params = array( |
|
167 | + $params = array ( |
|
168 | 168 | 'id' => $this->piVars['id'], |
169 | 169 | 'addToBasket' => true |
170 | 170 | ); |
@@ -344,9 +344,9 @@ discard block |
||
344 | 344 | |
345 | 345 | // Set default values if not set. |
346 | 346 | // $this->piVars['page'] may be integer or string (physical structure @ID) |
347 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
347 | + if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
348 | 348 | |
349 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
349 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1); |
|
350 | 350 | |
351 | 351 | } else { |
352 | 352 |
@@ -166,7 +166,7 @@ |
||
166 | 166 | |
167 | 167 | $params = array( |
168 | 168 | 'id' => $this->piVars['id'], |
169 | - 'addToBasket' => true |
|
169 | + 'addToBasket' => TRUE |
|
170 | 170 | ); |
171 | 171 | |
172 | 172 | if (empty($this->piVars['page'])) { |
@@ -19,69 +19,69 @@ discard block |
||
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 |
||
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 |
||
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 | } |