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