2 namespace TYPO3\CMS\Frontend\ContentObject\Menu;
35 $splitCount = count($this->menuArr);
40 $temp_HMENU_MENUOBJ = $tsfe->register[
'count_HMENU_MENUOBJ'];
41 $temp_MENUOBJ = $tsfe->register[
'count_MENUOBJ'];
45 $tempcnt_HMENU_MENUOBJ = $tsfe->register[
'count_HMENU_MENUOBJ'];
46 $tempcnt_MENUOBJ = $tsfe->register[
'count_MENUOBJ'];
47 if ($this->mconf[
'debugItemConf']) {
48 echo
'<h3>$NOconf:</h3>';
54 $tsfe->register[
'count_HMENU_MENUOBJ'] = $temp_HMENU_MENUOBJ;
55 $tsfe->register[
'count_MENUOBJ'] = $temp_MENUOBJ;
57 if ($this->mconf[
'debugItemConf']) {
58 echo
'<h3>$ROconf:</h3>';
63 $tsfe->register[
'count_HMENU_MENUOBJ'] = $tempcnt_HMENU_MENUOBJ;
64 $tsfe->register[
'count_MENUOBJ'] = $tempcnt_MENUOBJ;
80 $isGD =
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib'];
81 if (!is_array(
$conf)) {
85 $items = count(
$conf);
94 $Hobjs = $this->mconf[
'applyTotalH'];
98 $Wobjs = $this->mconf[
'applyTotalW'];
102 $minDim = $this->mconf[
'min'];
104 $minDim = $this->parent_cObj->calcIntExplode(
',', $minDim .
',');
106 $maxDim = $this->mconf[
'max'];
108 $maxDim = $this->parent_cObj->calcIntExplode(
',', $maxDim .
',');
112 $this->menuArr[$items] = array();
113 $items = count(
$conf);
116 if ($this->mconf[
'useLargestItemX'] || $this->mconf[
'useLargestItemY'] || $this->mconf[
'distributeX'] || $this->mconf[
'distributeY']) {
122 $distributeAccu = array(
'H' => 0,
'W' => 0);
123 foreach (
$conf as $key => $val) {
126 if ($items === $c + 1 && $minDim) {
127 $Lobjs = $this->mconf[
'removeObjectsOfDummy'];
130 foreach ($Lobjs as $remItem) {
131 unset($val[$remItem]);
132 unset($val[$remItem .
'.']);
136 $tempXY = explode(
',', $val[
'XY']);
137 if ($Wcounter < $minDim[0]) {
138 $tempXY[0] = $minDim[0] - $Wcounter;
141 if ($Hcounter < $minDim[1]) {
142 $tempXY[1] = $minDim[1] - $Hcounter;
145 $val[
'XY'] = implode(
',', $tempXY);
156 $gifCreator->start($val, $this->menuArr[$key]);
158 if (!empty($totalWH) && ($this->mconf[
'useLargestItemX'] || $this->mconf[
'useLargestItemY'])) {
159 $tempXY = explode(
',', $gifCreator->setup[
'XY']);
160 if ($this->mconf[
'useLargestItemX']) {
161 $tempXY[0] = max($totalWH[
'W']);
163 if ($this->mconf[
'useLargestItemY']) {
164 $tempXY[1] = max($totalWH[
'H']);
167 $val[
'XY'] = implode(
',', $tempXY);
170 $gifCreator->start($val, $this->menuArr[$key]);
173 if (!empty($totalWH) && ($this->mconf[
'distributeX'] || $this->mconf[
'distributeY'])) {
174 $tempXY = explode(
',', $gifCreator->setup[
'XY']);
175 if ($this->mconf[
'distributeX']) {
176 $diff = $this->mconf[
'distributeX'] - $totalWH[
'W_total'] - $distributeAccu[
'W'];
177 $compensate = round($diff / ($items - $c + 1));
178 $distributeAccu[
'W'] += $compensate;
179 $tempXY[0] = $totalWH[
'W'][$key] + $compensate;
181 if ($this->mconf[
'distributeY']) {
182 $diff = $this->mconf[
'distributeY'] - $totalWH[
'H_total'] - $distributeAccu[
'H'];
183 $compensate = round($diff / ($items - $c + 1));
184 $distributeAccu[
'H'] += $compensate;
185 $tempXY[1] = $totalWH[
'H'][$key] + $compensate;
188 $val[
'XY'] = implode(
',', $tempXY);
191 $gifCreator->start($val, $this->menuArr[$key]);
195 $tempXY = explode(
',', $val[
'XY']);
196 if ($maxDim[0] && $Wcounter + $gifCreator->XY[0] >= $maxDim[0]) {
197 $tempXY[0] = $maxDim[0] - $Wcounter;
200 if ($maxDim[1] && $Hcounter + $gifCreator->XY[1] >= $maxDim[1]) {
201 $tempXY[1] = $maxDim[1] - $Hcounter;
205 $val[
'XY'] = implode(
',', $tempXY);
208 $gifCreator->start($val, $this->menuArr[$key]);
213 foreach ($Hobjs as $index) {
214 if ($gifCreator->setup[$index] && $gifCreator->setup[$index .
'.']) {
215 $oldOffset = explode(
',', $gifCreator->setup[$index .
'.'][
'offset']);
216 $gifCreator->setup[$index .
'.'][
'offset'] = implode(
',', $gifCreator->applyOffset($oldOffset, array(0, -$Hcounter)));
221 foreach ($Wobjs as $index) {
222 if ($gifCreator->setup[$index] && $gifCreator->setup[$index .
'.']) {
223 $oldOffset = explode(
',', $gifCreator->setup[$index .
'.'][
'offset']);
224 $gifCreator->setup[$index .
'.'][
'offset'] = implode(
',', $gifCreator->applyOffset($oldOffset, array(-$Wcounter, 0)));
231 if (
$conf[$key][
'altImgResource'] || is_array(
$conf[$key][
'altImgResource.'])) {
233 $cObj->start($this->menuArr[$key],
'pages');
234 $altImgInfo = $cObj->getImgResource(
$conf[$key][
'altImgResource'],
$conf[$key][
'altImgResource.']);
235 $gifFileName = $altImgInfo[3];
238 if (!$gifFileName && $isGD) {
239 $gifCreator->createTempSubDir(
'menu/');
240 $gifFileName = $gifCreator->fileName(
'menu/');
242 $this->result[$resKey][$key] =
$conf[$key];
245 if (file_exists($gifFileName)) {
246 $info = @getimagesize($gifFileName);
247 $this->result[$resKey][$key][
'output_w'] = (int)$info[0];
248 $this->result[$resKey][$key][
'output_h'] = (int)$info[1];
249 $this->result[$resKey][$key][
'output_file'] = $gifFileName;
253 $this->result[$resKey][$key][
'output_w'] = $gifCreator->w;
254 $this->result[$resKey][$key][
'output_h'] = $gifCreator->h;
255 $this->result[$resKey][$key][
'output_file'] = $gifFileName;
256 $gifCreator->output($this->result[$resKey][$key][
'output_file']);
257 $gifCreator->destroy();
260 $Hcounter += $this->result[$resKey][$key][
'output_h'];
262 $Wcounter += $this->result[$resKey][$key][
'output_w'];
286 $items = (int)$items;
297 foreach (
$conf as $key => $val) {
299 if ($items === $c + 1 && $minDim) {
300 $Lobjs = $this->mconf[
'removeObjectsOfDummy'];
303 foreach ($Lobjs as $remItem) {
304 unset($val[$remItem]);
305 unset($val[$remItem .
'.']);
309 $tempXY = explode(
',', $val[
'XY']);
310 if ($Wcounter < $minDim[0]) {
311 $tempXY[0] = $minDim[0] - $Wcounter;
314 if ($Hcounter < $minDim[1]) {
315 $tempXY[1] = $minDim[1] - $Hcounter;
318 $val[
'XY'] = implode(
',', $tempXY);
326 $gifCreator->start($val, $this->menuArr[$key]);
328 $tempXY = explode(
',', $val[
'XY']);
329 if ($maxDim[0] && $Wcounter + $gifCreator->XY[0] >= $maxDim[0]) {
330 $tempXY[0] = $maxDim[0] - $Wcounter;
333 if ($maxDim[1] && $Hcounter + $gifCreator->XY[1] >= $maxDim[1]) {
334 $tempXY[1] = $maxDim[1] - $Hcounter;
338 $val[
'XY'] = implode(
',', $tempXY);
341 $gifCreator->start($val, $this->menuArr[$key]);
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];
351 $Hcounter += $gifCreator->XY[1];
353 $Wcounter += $gifCreator->XY[0];
369 if (!is_array($this->menuArr) || empty($this->result) || !is_array($this->result[
'NO'])) {
372 $this->WMresult =
'';
373 $this->INPfixMD5 = substr(md5(microtime() . $this->GMENU_fixKey), 0, 4);
374 $this->WMmenuItems = count($this->result[
'NO']);
375 $this->WMsubmenuObjSuffixes = $this->tmpl->splitConfArray(array(
'sOSuffix' => $this->mconf[
'submenuObjSuffixes']), $this->WMmenuItems);
378 if (!isset($tsfe->additionalJavaScript[
'JSImgCode'])) {
379 $tsfe->additionalJavaScript[
'JSImgCode'] =
'';
382 if ($this->result[
'NO'][$key][
'output_file']) {
384 $this->WMcObj->start($this->menuArr[$key],
'pages');
386 $this->I[
'key'] = $key;
387 $this->I[
'INPfix'] = ($this->imgNameNotRandom ?
'' :
'_' .
$this->INPfixMD5) .
'_' . $key;
388 $this->I[
'val'] = $this->result[
'NO'][$key];
389 $this->I[
'title'] = $this->
getPageTitle($this->menuArr[$key][
'title'], $this->menuArr[$key][
'nav_title']);
390 $this->I[
'uid'] = $this->menuArr[$key][
'uid'];
391 $this->I[
'mount_pid'] = $this->menuArr[$key][
'mount_pid'];
392 $this->I[
'pid'] = $this->menuArr[$key][
'pid'];
393 $this->I[
'spacer'] = $this->menuArr[$key][
'isSpacer'];
394 if (!$this->I[
'uid'] && !$this->menuArr[$key][
'_OVERRIDE_HREF']) {
395 $this->I[
'spacer'] = 1;
397 $this->I[
'noLink'] = $this->I[
'spacer'] || $this->I[
'val'][
'noLink'] || empty($this->menuArr[$key]);
399 $this->I[
'name'] =
'';
401 if ($this->mconf[
'accessKey']) {
402 $this->I[
'accessKey'] = $this->
accessKey($this->I[
'title']);
404 $this->I[
'accessKey'] = array();
407 $this->I[
'val'][
'ATagParams'] = $this->WMcObj->getATagParams($this->I[
'val']);
408 if (isset($this->I[
'val'][
'additionalParams.'])) {
409 $this->I[
'val'][
'additionalParams'] = $this->WMcObj->stdWrap($this->I[
'val'][
'additionalParams'], $this->I[
'val'][
'additionalParams.']);
411 $this->I[
'linkHREF'] = $this->
link($key, $this->I[
'val'][
'altTarget'], $this->mconf[
'forceTypeValue']);
413 $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'];
414 if ($titleAttrValue !==
'') {
415 $this->I[
'linkHREF'][
'title'] = $titleAttrValue;
418 if ($this->result[
'RO'][$key] && !$this->I[
'noLink']) {
419 $this->I[
'theName'] = $this->imgNamePrefix . $this->I[
'uid'] . $this->I[
'INPfix'];
420 $this->I[
'name'] =
' ' . $this->nameAttribute .
'="' . $this->I[
'theName'] .
'"';
423 $tsfe->additionalJavaScript[
'JSImgCode'] .= LF . $this->I[
'theName'] .
'_n=new Image(); ' . $this->I[
'theName'] .
'_n.src = ' .
GeneralUtility::quoteJSvalue($tsfe->absRefPrefix . $this->I[
'val'][
'output_file']) .
'; ';
424 $tsfe->additionalJavaScript[
'JSImgCode'] .= LF . $this->I[
'theName'] .
'_h=new Image(); ' . $this->I[
'theName'] .
'_h.src = ' .
GeneralUtility::quoteJSvalue($tsfe->absRefPrefix . $this->result[
'RO'][$key][
'output_file']) .
'; ';
425 $tsfe->imagesOnPage[] = $this->result[
'RO'][$key][
'output_file'];
426 $tsfe->setJS(
'mouseOver');
430 $this->I[
'altText'] = $this->I[
'title'] . $this->I[
'accessKey'][
'alt'];
434 if (!$this->I[
'noLink']) {
440 $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'] :
'') .
' />';
442 $this->I[
'parts'] = array();
443 $this->I[
'parts'][
'ATag_begin'] = $this->I[
'A1'];
444 $this->I[
'parts'][
'image'] = $this->I[
'IMG'];
445 $this->I[
'parts'][
'ATag_end'] = $this->I[
'A2'];
447 if ($this->mconf[
'IProcFunc']) {
448 $this->I = $this->
userProcess(
'IProcFunc', $this->I);
452 $this->I[
'theItem'] = implode(
'', $this->I[
'parts']);
455 $this->I[
'theItem'] = $this->WMcObj->wrap($this->I[
'theItem'], $this->I[
'val'][
'wrap']);
457 $allWrap = isset($this->I[
'val'][
'allWrap.']) ? $this->WMcObj->stdWrap($this->I[
'val'][
'allWrap'], $this->I[
'val'][
'allWrap.']) : $this->I[
'val'][
'allWrap'];
458 $this->I[
'theItem'] = $this->WMcObj->wrap($this->I[
'theItem'], $allWrap);
459 if ($this->I[
'val'][
'subst_elementUid']) {
460 $this->I[
'theItem'] = str_replace(
'{elementUid}', $this->I[
'uid'], $this->I[
'theItem']);
463 if (is_array($this->I[
'val'][
'allStdWrap.'])) {
464 $this->I[
'theItem'] = $this->WMcObj->stdWrap($this->I[
'theItem'], $this->I[
'val'][
'allStdWrap.']);
466 $tsfe->imagesOnPage[] = $this->I[
'val'][
'output_file'];
523 if (!$this->I[
'spacer']) {
524 $this->I[
'theItem'] .= $this->subMenu($this->I[
'uid'], $this->WMsubmenuObjSuffixes[$key][
'sOSuffix']);
526 $part = isset($this->I[
'val'][
'wrapItemAndSub.']) ? $this->WMcObj->stdWrap($this->I[
'val'][
'wrapItemAndSub'], $this->I[
'val'][
'wrapItemAndSub.']) : $this->I[
'val'][
'wrapItemAndSub'];
527 $this->WMresult .= $part ? $this->WMcObj->wrap($this->I[
'theItem'], $part) : $this->I[
'theItem'];
554 if (is_array($this->mconf[
'stdWrap.'])) {
555 $this->WMresult = $this->WMcObj->stdWrap($this->WMresult, $this->mconf[
'stdWrap.']);