dbc453b6960e8953fb96186ac79c148adba3d8cc
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / ContentObject / Menu / GraphicalMenuContentObject.php
1 <?php
2 namespace TYPO3\CMS\Frontend\ContentObject\Menu;
3
4 /**
5 * Extension class creating graphic based menus (PNG or GIF files)
6 *
7 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
8 * @package TYPO3
9 * @subpackage tslib
10 */
11 class GraphicalMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject {
12
13 /**
14 * Calls procesItemStates() so that the common configuration for the menu items are resolved into individual configuration per item.
15 * Calls makeGifs() for all "normal" items and if configured for, also the "rollover" items.
16 *
17 * @return void
18 * @see tslib_menu::procesItemStates(), makeGifs()
19 * @todo Define visibility
20 */
21 public function generate() {
22 $splitCount = count($this->menuArr);
23 if ($splitCount) {
24 list($NOconf, $ROconf) = $this->procesItemStates($splitCount);
25 //store initial count value
26 $temp_HMENU_MENUOBJ = $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'];
27 $temp_MENUOBJ = $GLOBALS['TSFE']->register['count_MENUOBJ'];
28 // Now we generate the giffiles:
29 $this->makeGifs($NOconf, 'NO');
30 // store count from NO obj
31 $tempcnt_HMENU_MENUOBJ = $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'];
32 $tempcnt_MENUOBJ = $GLOBALS['TSFE']->register['count_MENUOBJ'];
33 if ($this->mconf['debugItemConf']) {
34 echo '<h3>$NOconf:</h3>';
35 debug($NOconf);
36 }
37 // RollOver
38 if ($ROconf) {
39 // Start recount for rollover with initial values
40 $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'] = $temp_HMENU_MENUOBJ;
41 $GLOBALS['TSFE']->register['count_MENUOBJ'] = $temp_MENUOBJ;
42 $this->makeGifs($ROconf, 'RO');
43 if ($this->mconf['debugItemConf']) {
44 echo '<h3>$ROconf:</h3>';
45 debug($ROconf);
46 }
47 }
48 // Use count from NO obj
49 $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'] = $tempcnt_HMENU_MENUOBJ;
50 $GLOBALS['TSFE']->register['count_MENUOBJ'] = $tempcnt_MENUOBJ;
51 }
52 }
53
54 /**
55 * Will traverse input array with configuratoin per-item and create corresponding GIF files for the menu.
56 * The data of the files are stored in $this->result
57 *
58 * @param array $conf Array with configuration for each item.
59 * @param string $resKey Type of images: normal ("NO") or rollover ("RO"). Valid values are "NO" and "RO
60 * @return void
61 * @access private
62 * @see generate()
63 * @todo Define visibility
64 */
65 public function makeGifs($conf, $resKey) {
66 $isGD = $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'];
67 if (!is_array($conf)) {
68 $conf = array();
69 }
70 $totalWH = array();
71 $items = count($conf);
72 if ($isGD) {
73 // Generate the gif-files. the $menuArr is filled with some values like output_w, output_h, output_file
74 $Hcounter = 0;
75 $Wcounter = 0;
76 $Hobjs = $this->mconf['applyTotalH'];
77 if ($Hobjs) {
78 $Hobjs = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $Hobjs);
79 }
80 $Wobjs = $this->mconf['applyTotalW'];
81 if ($Wobjs) {
82 $Wobjs = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $Wobjs);
83 }
84 $minDim = $this->mconf['min'];
85 if ($minDim) {
86 $minDim = \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::calcIntExplode(',', $minDim . ',');
87 }
88 $maxDim = $this->mconf['max'];
89 if ($maxDim) {
90 $maxDim = \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::calcIntExplode(',', $maxDim . ',');
91 }
92 if ($minDim) {
93 $conf[$items] = $conf[$items - 1];
94 $this->menuArr[$items] = array();
95 $items = count($conf);
96 }
97 // TOTAL width
98 if ((($this->mconf['useLargestItemX'] || $this->mconf['useLargestItemY']) || $this->mconf['distributeX']) || $this->mconf['distributeY']) {
99 $totalWH = $this->findLargestDims($conf, $items, $Hobjs, $Wobjs, $minDim, $maxDim);
100 }
101 }
102 $c = 0;
103 $maxFlag = 0;
104 $distributeAccu = array('H' => 0, 'W' => 0);
105 foreach ($conf as $key => $val) {
106 $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']++;
107 $GLOBALS['TSFE']->register['count_MENUOBJ']++;
108 if ($items == $c + 1 && $minDim) {
109 $Lobjs = $this->mconf['removeObjectsOfDummy'];
110 if ($Lobjs) {
111 $Lobjs = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $Lobjs);
112 foreach ($Lobjs as $remItem) {
113 unset($val[$remItem]);
114 unset($val[$remItem . '.']);
115 }
116 }
117 $flag = 0;
118 $tempXY = explode(',', $val['XY']);
119 if ($Wcounter < $minDim[0]) {
120 $tempXY[0] = $minDim[0] - $Wcounter;
121 $flag = 1;
122 }
123 if ($Hcounter < $minDim[1]) {
124 $tempXY[1] = $minDim[1] - $Hcounter;
125 $flag = 1;
126 }
127 $val['XY'] = implode(',', $tempXY);
128 if (!$flag) {
129 break;
130 }
131 }
132 $c++;
133 if ($isGD) {
134 // Pre-working the item
135 $gifCreator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Imaging\\GifBuilder');
136 $gifCreator->init();
137 $gifCreator->start($val, $this->menuArr[$key]);
138 // If useLargestItemH/W is specified
139 if (count($totalWH) && ($this->mconf['useLargestItemX'] || $this->mconf['useLargestItemY'])) {
140 $tempXY = explode(',', $gifCreator->setup['XY']);
141 if ($this->mconf['useLargestItemX']) {
142 $tempXY[0] = max($totalWH['W']);
143 }
144 if ($this->mconf['useLargestItemY']) {
145 $tempXY[1] = max($totalWH['H']);
146 }
147 // Regenerate the new values...
148 $val['XY'] = implode(',', $tempXY);
149 $gifCreator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Imaging\\GifBuilder');
150 $gifCreator->init();
151 $gifCreator->start($val, $this->menuArr[$key]);
152 }
153 // If distributeH/W is specified
154 if (count($totalWH) && ($this->mconf['distributeX'] || $this->mconf['distributeY'])) {
155 $tempXY = explode(',', $gifCreator->setup['XY']);
156 if ($this->mconf['distributeX']) {
157 $diff = ($this->mconf['distributeX'] - $totalWH['W_total']) - $distributeAccu['W'];
158 $compensate = round($diff / (($items - $c) + 1));
159 $distributeAccu['W'] += $compensate;
160 $tempXY[0] = $totalWH['W'][$key] + $compensate;
161 }
162 if ($this->mconf['distributeY']) {
163 $diff = ($this->mconf['distributeY'] - $totalWH['H_total']) - $distributeAccu['H'];
164 $compensate = round($diff / (($items - $c) + 1));
165 $distributeAccu['H'] += $compensate;
166 $tempXY[1] = $totalWH['H'][$key] + $compensate;
167 }
168 // Regenerate the new values...
169 $val['XY'] = implode(',', $tempXY);
170 $gifCreator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Imaging\\GifBuilder');
171 $gifCreator->init();
172 $gifCreator->start($val, $this->menuArr[$key]);
173 }
174 // If max dimensions are specified
175 if ($maxDim) {
176 $tempXY = explode(',', $val['XY']);
177 if ($maxDim[0] && $Wcounter + $gifCreator->XY[0] >= $maxDim[0]) {
178 $tempXY[0] == $maxDim[0] - $Wcounter;
179 $maxFlag = 1;
180 }
181 if ($maxDim[1] && $Hcounter + $gifCreator->XY[1] >= $maxDim[1]) {
182 $tempXY[1] = $maxDim[1] - $Hcounter;
183 $maxFlag = 1;
184 }
185 if ($maxFlag) {
186 $val['XY'] = implode(',', $tempXY);
187 $gifCreator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Imaging\\GifBuilder');
188 $gifCreator->init();
189 $gifCreator->start($val, $this->menuArr[$key]);
190 }
191 }
192 // displace
193 if ($Hobjs) {
194 foreach ($Hobjs as $index) {
195 if ($gifCreator->setup[$index] && $gifCreator->setup[$index . '.']) {
196 $oldOffset = explode(',', $gifCreator->setup[$index . '.']['offset']);
197 $gifCreator->setup[$index . '.']['offset'] = implode(',', $gifCreator->applyOffset($oldOffset, array(0, -$Hcounter)));
198 }
199 }
200 }
201 if ($Wobjs) {
202 foreach ($Wobjs as $index) {
203 if ($gifCreator->setup[$index] && $gifCreator->setup[$index . '.']) {
204 $oldOffset = explode(',', $gifCreator->setup[$index . '.']['offset']);
205 $gifCreator->setup[$index . '.']['offset'] = implode(',', $gifCreator->applyOffset($oldOffset, array(-$Wcounter, 0)));
206 }
207 }
208 }
209 }
210 // Finding alternative GIF names if any (by altImgResource)
211 $gifFileName = '';
212 if ($conf[$key]['altImgResource'] || is_array($conf[$key]['altImgResource.'])) {
213 if (!is_object($cObj)) {
214 $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
215 }
216 $cObj->start($this->menuArr[$key], 'pages');
217 $altImgInfo = $cObj->getImgResource($conf[$key]['altImgResource'], $conf[$key]['altImgResource.']);
218 $gifFileName = $altImgInfo[3];
219 }
220 // If an alternative name was NOT given, find the GIFBUILDER name.
221 if (!$gifFileName && $isGD) {
222 $gifCreator->createTempSubDir('menu/');
223 $gifFileName = $gifCreator->fileName('menu/');
224 }
225 $this->result[$resKey][$key] = $conf[$key];
226 // Generation of image file:
227 // File exists
228 if (file_exists($gifFileName)) {
229 $info = @getimagesize($gifFileName);
230 $this->result[$resKey][$key]['output_w'] = intval($info[0]);
231 $this->result[$resKey][$key]['output_h'] = intval($info[1]);
232 $this->result[$resKey][$key]['output_file'] = $gifFileName;
233 } elseif ($isGD) {
234 // file is generated
235 $gifCreator->make();
236 $this->result[$resKey][$key]['output_w'] = $gifCreator->w;
237 $this->result[$resKey][$key]['output_h'] = $gifCreator->h;
238 $this->result[$resKey][$key]['output_file'] = $gifFileName;
239 $gifCreator->output($this->result[$resKey][$key]['output_file']);
240 $gifCreator->destroy();
241 }
242 $this->result[$resKey][$key]['output_file'] = \TYPO3\CMS\Core\Utility\GeneralUtility::png_to_gif_by_imagemagick($this->result[$resKey][$key]['output_file']);
243 // counter is increased
244 $Hcounter += $this->result[$resKey][$key]['output_h'];
245 // counter is increased
246 $Wcounter += $this->result[$resKey][$key]['output_w'];
247 if ($maxFlag) {
248 break;
249 }
250 }
251 }
252
253 /**
254 * Function searching for the largest width and height of the menu items to be generated.
255 * Uses some of the same code as makeGifs and even instantiates some gifbuilder objects BUT does not render the images - only reading out which width they would have.
256 * Remember to upgrade the code in here if the makeGifs function is updated.
257 *
258 * @param array $conf Same configuration array as passed to makeGifs()
259 * @param integer $items The number of menu items
260 * @param array $Hobjs Array with "applyTotalH" numbers
261 * @param array $Wobjs Array with "applyTotalW" numbers
262 * @param array $minDim Array with "min" x/y
263 * @param array $maxDim Array with "max" x/y
264 * @return array Array with keys "H" and "W" which are in themselves arrays with the heights and widths of menu items inside. This can be used to find the max/min size of the menu items.
265 * @access private
266 * @see makeGifs()
267 * @todo Define visibility
268 */
269 public function findLargestDims($conf, $items, $Hobjs, $Wobjs, $minDim, $maxDim) {
270 $totalWH = array(
271 'W' => array(),
272 'H' => array(),
273 'W_total' => 0,
274 'H_total' => 0
275 );
276 $Hcounter = 0;
277 $Wcounter = 0;
278 $c = 0;
279 $maxFlag = 0;
280 foreach ($conf as $key => $val) {
281 // SAME CODE AS makeGifs()! BEGIN
282 if ($items == $c + 1 && $minDim) {
283 $Lobjs = $this->mconf['removeObjectsOfDummy'];
284 if ($Lobjs) {
285 $Lobjs = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $Lobjs);
286 foreach ($Lobjs as $remItem) {
287 unset($val[$remItem]);
288 unset($val[$remItem . '.']);
289 }
290 }
291 $flag = 0;
292 $tempXY = explode(',', $val['XY']);
293 if ($Wcounter < $minDim[0]) {
294 $tempXY[0] = $minDim[0] - $Wcounter;
295 $flag = 1;
296 }
297 if ($Hcounter < $minDim[1]) {
298 $tempXY[1] = $minDim[1] - $Hcounter;
299 $flag = 1;
300 }
301 $val['XY'] = implode(',', $tempXY);
302 if (!$flag) {
303 break;
304 }
305 }
306 $c++;
307 $gifCreator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Imaging\\GifBuilder');
308 $gifCreator->init();
309 $gifCreator->start($val, $this->menuArr[$key]);
310 if ($maxDim) {
311 $tempXY = explode(',', $val['XY']);
312 if ($maxDim[0] && $Wcounter + $gifCreator->XY[0] >= $maxDim[0]) {
313 $tempXY[0] == $maxDim[0] - $Wcounter;
314 $maxFlag = 1;
315 }
316 if ($maxDim[1] && $Hcounter + $gifCreator->XY[1] >= $maxDim[1]) {
317 $tempXY[1] = $maxDim[1] - $Hcounter;
318 $maxFlag = 1;
319 }
320 if ($maxFlag) {
321 $val['XY'] = implode(',', $tempXY);
322 $gifCreator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Imaging\\GifBuilder');
323 $gifCreator->init();
324 $gifCreator->start($val, $this->menuArr[$key]);
325 }
326 }
327 // SAME CODE AS makeGifs()! END
328 // Setting the width/height
329 $totalWH['W'][$key] = $gifCreator->XY[0];
330 $totalWH['H'][$key] = $gifCreator->XY[1];
331 $totalWH['W_total'] += $gifCreator->XY[0];
332 $totalWH['H_total'] += $gifCreator->XY[1];
333 // counter is increased
334 $Hcounter += $gifCreator->XY[1];
335 // counter is increased
336 $Wcounter += $gifCreator->XY[0];
337 if ($maxFlag) {
338 break;
339 }
340 }
341 return $totalWH;
342 }
343
344 /**
345 * Traverses the ->result['NO'] array of menu items configuration (made by ->generate()) and renders the HTML of each item (the images themselves was made with makeGifs() before this. See ->generate())
346 * During the execution of this function many internal methods prefixed "extProc_" from this class is called and many of these are for now dummy functions. But they can be used for processing as they are used by the GMENU_LAYERS
347 *
348 * @return string The HTML for the menu (returns result through $this->extProc_finish(); )
349 * @todo Define visibility
350 */
351 public function writeMenu() {
352 if (((is_array($this->menuArr) && is_array($this->result)) && count($this->result)) && is_array($this->result['NO'])) {
353 // Create new tslib_cObj for our use
354 $this->WMcObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
355 $this->WMresult = '';
356 $this->INPfixMD5 = substr(md5(microtime() . $this->GMENU_fixKey), 0, 4);
357 $this->WMmenuItems = count($this->result['NO']);
358 $this->WMsubmenuObjSuffixes = $this->tmpl->splitConfArray(array('sOSuffix' => $this->mconf['submenuObjSuffixes']), $this->WMmenuItems);
359 $this->extProc_init();
360 for ($key = 0; $key < $this->WMmenuItems; $key++) {
361 if ($this->result['NO'][$key]['output_file']) {
362 // Initialize the cObj with the page record of the menu item
363 $this->WMcObj->start($this->menuArr[$key], 'pages');
364 $this->I = array();
365 $this->I['key'] = $key;
366 $this->I['INPfix'] = (($this->imgNameNotRandom ? '' : '_' . $this->INPfixMD5) . '_') . $key;
367 $this->I['val'] = $this->result['NO'][$key];
368 $this->I['title'] = $this->getPageTitle($this->menuArr[$key]['title'], $this->menuArr[$key]['nav_title']);
369 $this->I['uid'] = $this->menuArr[$key]['uid'];
370 $this->I['mount_pid'] = $this->menuArr[$key]['mount_pid'];
371 $this->I['pid'] = $this->menuArr[$key]['pid'];
372 $this->I['spacer'] = $this->menuArr[$key]['isSpacer'];
373 if (!$this->I['uid'] && !$this->menuArr[$key]['_OVERRIDE_HREF']) {
374 $this->I['spacer'] = 1;
375 }
376 $this->I['noLink'] = ($this->I['spacer'] || $this->I['val']['noLink']) || !count($this->menuArr[$key]);
377 // !count($this->menuArr[$key]) means that this item is a dummyItem
378 $this->I['name'] = '';
379 // Set access key
380 if ($this->mconf['accessKey']) {
381 $this->I['accessKey'] = $this->accessKey($this->I['title']);
382 } else {
383 $this->I['accessKey'] = array();
384 }
385 // Make link tag
386 $this->I['val']['ATagParams'] = $this->WMcObj->getATagParams($this->I['val']);
387 if (isset($this->I['val']['additionalParams.'])) {
388 $this->I['val']['additionalParams'] = $this->WMcObj->stdWrap($this->I['val']['additionalParams'], $this->I['val']['additionalParams.']);
389 }
390 $this->I['linkHREF'] = $this->link($key, $this->I['val']['altTarget'], $this->mconf['forceTypeValue']);
391 // Title attribute of links:
392 $titleAttrValue = isset($this->I['val']['ATagTitle.']) ? $this->WMcObj->stdWrap($this->I['val']['ATagTitle'], $this->I['val']['ATagTitle.']) . $this->I['accessKey']['alt'] : $this->I['val']['ATagTitle'] . $this->I['accessKey']['alt'];
393 if (strlen($titleAttrValue)) {
394 $this->I['linkHREF']['title'] = $titleAttrValue;
395 }
396 // Set rollover
397 if ($this->result['RO'][$key] && !$this->I['noLink']) {
398 $this->I['theName'] = ($this->imgNamePrefix . $this->I['uid']) . $this->I['INPfix'];
399 $this->I['name'] = (((' ' . $this->nameAttribute) . '="') . $this->I['theName']) . '"';
400 $this->I['linkHREF']['onMouseover'] = (($this->WMfreezePrefix . 'over(\'') . $this->I['theName']) . '\');';
401 $this->I['linkHREF']['onMouseout'] = (($this->WMfreezePrefix . 'out(\'') . $this->I['theName']) . '\');';
402 $GLOBALS['TSFE']->JSImgCode .= ((((((LF . $this->I['theName']) . '_n=new Image(); ') . $this->I['theName']) . '_n.src = "') . $GLOBALS['TSFE']->absRefPrefix) . $this->I['val']['output_file']) . '"; ';
403 $GLOBALS['TSFE']->JSImgCode .= ((((((LF . $this->I['theName']) . '_h=new Image(); ') . $this->I['theName']) . '_h.src = "') . $GLOBALS['TSFE']->absRefPrefix) . $this->result['RO'][$key]['output_file']) . '"; ';
404 $GLOBALS['TSFE']->imagesOnPage[] = $this->result['RO'][$key]['output_file'];
405 $GLOBALS['TSFE']->setJS('mouseOver');
406 $this->extProc_RO($key);
407 }
408 // Set altText
409 $this->I['altText'] = $this->I['title'] . $this->I['accessKey']['alt'];
410 // Calling extra processing function
411 $this->extProc_beforeLinking($key);
412 // Set linking
413 if (!$this->I['noLink']) {
414 $this->setATagParts();
415 } else {
416 $this->I['A1'] = '';
417 $this->I['A2'] = '';
418 }
419 $this->I['IMG'] = ((((((((((('<img src="' . $GLOBALS['TSFE']->absRefPrefix) . $this->I['val']['output_file']) . '" width="') . $this->I['val']['output_w']) . '" height="') . $this->I['val']['output_h']) . '" ') . \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getBorderAttr('border="0"')) . ($this->mconf['disableAltText'] ? '' : (' alt="' . htmlspecialchars($this->I['altText'])) . '"')) . $this->I['name']) . ($this->I['val']['imgParams'] ? ' ' . $this->I['val']['imgParams'] : '')) . ' />';
420 // Make before, middle and after parts
421 $this->I['parts'] = array();
422 $this->I['parts']['ATag_begin'] = $this->I['A1'];
423 $this->I['parts']['image'] = $this->I['IMG'];
424 $this->I['parts']['ATag_end'] = $this->I['A2'];
425 // Passing I to a user function
426 if ($this->mconf['IProcFunc']) {
427 $this->I = $this->userProcess('IProcFunc', $this->I);
428 }
429 // Putting the item together.
430 // Merge parts + beforeAllWrap
431 $this->I['theItem'] = implode('', $this->I['parts']);
432 $this->I['theItem'] = $this->extProc_beforeAllWrap($this->I['theItem'], $key);
433 // wrap:
434 $this->I['theItem'] = $this->tmpl->wrap($this->I['theItem'], $this->I['val']['wrap']);
435 // allWrap:
436 $allWrap = isset($this->I['val']['allWrap.']) ? $this->WMcObj->stdWrap($this->I['val']['allWrap'], $this->I['val']['allWrap.']) : $this->I['val']['allWrap'];
437 $this->I['theItem'] = $this->tmpl->wrap($this->I['theItem'], $allWrap);
438 if ($this->I['val']['subst_elementUid']) {
439 $this->I['theItem'] = str_replace('{elementUid}', $this->I['uid'], $this->I['theItem']);
440 }
441 // allStdWrap:
442 if (is_array($this->I['val']['allStdWrap.'])) {
443 $this->I['theItem'] = $this->WMcObj->stdWrap($this->I['theItem'], $this->I['val']['allStdWrap.']);
444 }
445 $GLOBALS['TSFE']->imagesOnPage[] = $this->I['val']['output_file'];
446 $this->extProc_afterLinking($key);
447 }
448 }
449 return $this->extProc_finish();
450 }
451 }
452
453 /**
454 * Called right before the traversing of $this->result begins.
455 * Can be used for various initialization
456 *
457 * @return void
458 * @access private
459 * @see writeMenu(), tslib_gmenu_layers::extProc_init()
460 * @todo Define visibility
461 */
462 public function extProc_init() {
463
464 }
465
466 /**
467 * Called after all processing for RollOver of an element has been done.
468 *
469 * @param integer Pointer to $this->menuArr[$key] where the current menu element record is found OR $this->result['RO'][$key] where the configuration for that elements RO version is found!
470 * @return void
471 * @access private
472 * @see writeMenu(), tslib_gmenu_layers::extProc_RO()
473 * @todo Define visibility
474 */
475 public function extProc_RO($key) {
476
477 }
478
479 /**
480 * Called right before the creation of the link for the menu item
481 *
482 * @param integer Pointer to $this->menuArr[$key] where the current menu element record is found
483 * @return void
484 * @access private
485 * @see writeMenu(), tslib_gmenu_layers::extProc_beforeLinking()
486 * @todo Define visibility
487 */
488 public function extProc_beforeLinking($key) {
489
490 }
491
492 /**
493 * Called right after the creation of links for the menu item. This is also the last function call before the for-loop traversing menu items goes to the next item.
494 * This function MUST set $this->WMresult.=[HTML for menu item] to add the generated menu item to the internal accumulation of items.
495 * Further this calls the subMenu function in the parent class to create any submenu there might be.
496 *
497 * @param integer Pointer to $this->menuArr[$key] where the current menu element record is found
498 * @return void
499 * @access private
500 * @see writeMenu(), tslib_gmenu_layers::extProc_afterLinking(), tslib_menu::subMenu()
501 * @todo Define visibility
502 */
503 public function extProc_afterLinking($key) {
504 // Add part to the accumulated result + fetch submenus
505 if (!$this->I['spacer']) {
506 $this->I['theItem'] .= $this->subMenu($this->I['uid'], $this->WMsubmenuObjSuffixes[$key]['sOSuffix']);
507 }
508 $part = isset($this->I['val']['wrapItemAndSub.']) ? $this->WMcObj->stdWrap($this->I['val']['wrapItemAndSub'], $this->I['val']['wrapItemAndSub.']) : $this->I['val']['wrapItemAndSub'];
509 $this->WMresult .= $part ? $this->tmpl->wrap($this->I['theItem'], $part) : $this->I['theItem'];
510 }
511
512 /**
513 * Called before the "wrap" happens on the menu item.
514 *
515 * @param string The current content of the menu item, $this->I['theItem'], passed along.
516 * @param integer Pointer to $this->menuArr[$key] where the current menu element record is found
517 * @return string The modified version of $item, going back into $this->I['theItem']
518 * @access private
519 * @see writeMenu(), tslib_gmenu_layers::extProc_beforeAllWrap()
520 * @todo Define visibility
521 */
522 public function extProc_beforeAllWrap($item, $key) {
523 return $item;
524 }
525
526 /**
527 * Called before the writeMenu() function returns (only if a menu was generated)
528 *
529 * @return string The total menu content should be returned by this function
530 * @access private
531 * @see writeMenu(), tslib_gmenu_layers::extProc_finish()
532 * @todo Define visibility
533 */
534 public function extProc_finish() {
535 // stdWrap:
536 if (is_array($this->mconf['stdWrap.'])) {
537 $this->WMresult = $this->WMcObj->stdWrap($this->WMresult, $this->mconf['stdWrap.']);
538 }
539 return $this->tmpl->wrap($this->WMresult, $this->mconf['wrap']) . $this->WMextraScript;
540 }
541
542 }
543
544
545 ?>