35 $splitCount = count($this->menuArr);
39 $temp_HMENU_MENUOBJ =
$GLOBALS[
'TSFE']->register[
'count_HMENU_MENUOBJ'];
40 $temp_MENUOBJ =
$GLOBALS[
'TSFE']->register[
'count_MENUOBJ'];
44 $tempcnt_HMENU_MENUOBJ =
$GLOBALS[
'TSFE']->register[
'count_HMENU_MENUOBJ'];
45 $tempcnt_MENUOBJ =
$GLOBALS[
'TSFE']->register[
'count_MENUOBJ'];
46 if ($this->mconf[
'debugItemConf']) {
47 echo
'<h3>$NOconf:</h3>';
53 $GLOBALS[
'TSFE']->register[
'count_HMENU_MENUOBJ'] = $temp_HMENU_MENUOBJ;
54 $GLOBALS[
'TSFE']->register[
'count_MENUOBJ'] = $temp_MENUOBJ;
56 if ($this->mconf[
'debugItemConf']) {
57 echo
'<h3>$ROconf:</h3>';
62 $GLOBALS[
'TSFE']->register[
'count_HMENU_MENUOBJ'] = $tempcnt_HMENU_MENUOBJ;
63 $GLOBALS[
'TSFE']->register[
'count_MENUOBJ'] = $tempcnt_MENUOBJ;
79 $isGD =
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib'];
80 if (!is_array(
$conf)) {
84 $items = count(
$conf);
89 $Hobjs = $this->mconf[
'applyTotalH'];
93 $Wobjs = $this->mconf[
'applyTotalW'];
97 $minDim = $this->mconf[
'min'];
99 $minDim = $this->parent_cObj->calcIntExplode(
',', $minDim .
',');
101 $maxDim = $this->mconf[
'max'];
103 $maxDim = $this->parent_cObj->calcIntExplode(
',', $maxDim .
',');
107 $this->menuArr[$items] = array();
108 $items = count(
$conf);
111 if ($this->mconf[
'useLargestItemX'] || $this->mconf[
'useLargestItemY'] || $this->mconf[
'distributeX'] || $this->mconf[
'distributeY']) {
117 $distributeAccu = array(
'H' => 0,
'W' => 0);
118 foreach (
$conf as $key => $val) {
119 $GLOBALS[
'TSFE']->register[
'count_HMENU_MENUOBJ']++;
120 $GLOBALS[
'TSFE']->register[
'count_MENUOBJ']++;
121 if ($items == $c + 1 && $minDim) {
122 $Lobjs = $this->mconf[
'removeObjectsOfDummy'];
125 foreach ($Lobjs as $remItem) {
126 unset($val[$remItem]);
127 unset($val[$remItem .
'.']);
131 $tempXY = explode(
',', $val[
'XY']);
132 if ($Wcounter < $minDim[0]) {
133 $tempXY[0] = $minDim[0] - $Wcounter;
136 if ($Hcounter < $minDim[1]) {
137 $tempXY[1] = $minDim[1] - $Hcounter;
140 $val[
'XY'] = implode(
',', $tempXY);
150 $gifCreator->start($val, $this->menuArr[$key]);
152 if (count($totalWH) && ($this->mconf[
'useLargestItemX'] || $this->mconf[
'useLargestItemY'])) {
153 $tempXY = explode(
',', $gifCreator->setup[
'XY']);
154 if ($this->mconf[
'useLargestItemX']) {
155 $tempXY[0] = max($totalWH[
'W']);
157 if ($this->mconf[
'useLargestItemY']) {
158 $tempXY[1] = max($totalWH[
'H']);
161 $val[
'XY'] = implode(
',', $tempXY);
164 $gifCreator->start($val, $this->menuArr[$key]);
167 if (count($totalWH) && ($this->mconf[
'distributeX'] || $this->mconf[
'distributeY'])) {
168 $tempXY = explode(
',', $gifCreator->setup[
'XY']);
169 if ($this->mconf[
'distributeX']) {
170 $diff = $this->mconf[
'distributeX'] - $totalWH[
'W_total'] - $distributeAccu[
'W'];
171 $compensate = round($diff / ($items - $c + 1));
172 $distributeAccu[
'W'] += $compensate;
173 $tempXY[0] = $totalWH[
'W'][$key] + $compensate;
175 if ($this->mconf[
'distributeY']) {
176 $diff = $this->mconf[
'distributeY'] - $totalWH[
'H_total'] - $distributeAccu[
'H'];
177 $compensate = round($diff / ($items - $c + 1));
178 $distributeAccu[
'H'] += $compensate;
179 $tempXY[1] = $totalWH[
'H'][$key] + $compensate;
182 $val[
'XY'] = implode(
',', $tempXY);
185 $gifCreator->start($val, $this->menuArr[$key]);
189 $tempXY = explode(
',', $val[
'XY']);
190 if ($maxDim[0] && $Wcounter + $gifCreator->XY[0] >= $maxDim[0]) {
191 $tempXY[0] == $maxDim[0] - $Wcounter;
194 if ($maxDim[1] && $Hcounter + $gifCreator->XY[1] >= $maxDim[1]) {
195 $tempXY[1] = $maxDim[1] - $Hcounter;
199 $val[
'XY'] = implode(
',', $tempXY);
202 $gifCreator->start($val, $this->menuArr[$key]);
207 foreach ($Hobjs as $index) {
208 if ($gifCreator->setup[$index] && $gifCreator->setup[$index .
'.']) {
209 $oldOffset = explode(
',', $gifCreator->setup[$index .
'.'][
'offset']);
210 $gifCreator->setup[$index .
'.'][
'offset'] = implode(
',', $gifCreator->applyOffset($oldOffset, array(0, -$Hcounter)));
215 foreach ($Wobjs as $index) {
216 if ($gifCreator->setup[$index] && $gifCreator->setup[$index .
'.']) {
217 $oldOffset = explode(
',', $gifCreator->setup[$index .
'.'][
'offset']);
218 $gifCreator->setup[$index .
'.'][
'offset'] = implode(
',', $gifCreator->applyOffset($oldOffset, array(-$Wcounter, 0)));
225 if (
$conf[$key][
'altImgResource'] || is_array(
$conf[$key][
'altImgResource.'])) {
226 if (!is_object($cObj)) {
229 $cObj->start($this->menuArr[$key],
'pages');
230 $altImgInfo = $cObj->getImgResource(
$conf[$key][
'altImgResource'],
$conf[$key][
'altImgResource.']);
231 $gifFileName = $altImgInfo[3];
234 if (!$gifFileName && $isGD) {
235 $gifCreator->createTempSubDir(
'menu/');
236 $gifFileName = $gifCreator->fileName(
'menu/');
238 $this->result[$resKey][$key] =
$conf[$key];
241 if (file_exists($gifFileName)) {
242 $info = @getimagesize($gifFileName);
243 $this->result[$resKey][$key][
'output_w'] = (int)$info[0];
244 $this->result[$resKey][$key][
'output_h'] = (int)$info[1];
245 $this->result[$resKey][$key][
'output_file'] = $gifFileName;
249 $this->result[$resKey][$key][
'output_w'] = $gifCreator->w;
250 $this->result[$resKey][$key][
'output_h'] = $gifCreator->h;
251 $this->result[$resKey][$key][
'output_file'] = $gifFileName;
252 $gifCreator->output($this->result[$resKey][$key][
'output_file']);
253 $gifCreator->destroy();
257 $Hcounter += $this->result[$resKey][$key][
'output_h'];
259 $Wcounter += $this->result[$resKey][$key][
'output_w'];
293 foreach (
$conf as $key => $val) {
295 if ($items == $c + 1 && $minDim) {
296 $Lobjs = $this->mconf[
'removeObjectsOfDummy'];
299 foreach ($Lobjs as $remItem) {
300 unset($val[$remItem]);
301 unset($val[$remItem .
'.']);
305 $tempXY = explode(
',', $val[
'XY']);
306 if ($Wcounter < $minDim[0]) {
307 $tempXY[0] = $minDim[0] - $Wcounter;
310 if ($Hcounter < $minDim[1]) {
311 $tempXY[1] = $minDim[1] - $Hcounter;
314 $val[
'XY'] = implode(
',', $tempXY);
322 $gifCreator->start($val, $this->menuArr[$key]);
324 $tempXY = explode(
',', $val[
'XY']);
325 if ($maxDim[0] && $Wcounter + $gifCreator->XY[0] >= $maxDim[0]) {
326 $tempXY[0] == $maxDim[0] - $Wcounter;
329 if ($maxDim[1] && $Hcounter + $gifCreator->XY[1] >= $maxDim[1]) {
330 $tempXY[1] = $maxDim[1] - $Hcounter;
334 $val[
'XY'] = implode(
',', $tempXY);
337 $gifCreator->start($val, $this->menuArr[$key]);
342 $totalWH[
'W'][$key] = $gifCreator->XY[0];
343 $totalWH[
'H'][$key] = $gifCreator->XY[1];
344 $totalWH[
'W_total'] += $gifCreator->XY[0];
345 $totalWH[
'H_total'] += $gifCreator->XY[1];
347 $Hcounter += $gifCreator->XY[1];
349 $Wcounter += $gifCreator->XY[0];
365 if (!is_array($this->menuArr) || empty($this->result) || !is_array($this->result[
'NO'])) {
370 $this->WMresult =
'';
371 $this->INPfixMD5 = substr(md5(microtime() . $this->GMENU_fixKey), 0, 4);
372 $this->WMmenuItems = count($this->result[
'NO']);
373 $this->WMsubmenuObjSuffixes = $this->tmpl->splitConfArray(array(
'sOSuffix' => $this->mconf[
'submenuObjSuffixes']), $this->WMmenuItems);
376 if ($this->result[
'NO'][$key][
'output_file']) {
378 $this->WMcObj->start($this->menuArr[$key],
'pages');
380 $this->I[
'key'] = $key;
381 $this->I[
'INPfix'] = ($this->imgNameNotRandom ?
'' :
'_' .
$this->INPfixMD5) .
'_' . $key;
382 $this->I[
'val'] = $this->result[
'NO'][$key];
383 $this->I[
'title'] = $this->
getPageTitle($this->menuArr[$key][
'title'], $this->menuArr[$key][
'nav_title']);
384 $this->I[
'uid'] = $this->menuArr[$key][
'uid'];
385 $this->I[
'mount_pid'] = $this->menuArr[$key][
'mount_pid'];
386 $this->I[
'pid'] = $this->menuArr[$key][
'pid'];
387 $this->I[
'spacer'] = $this->menuArr[$key][
'isSpacer'];
388 if (!$this->I[
'uid'] && !$this->menuArr[$key][
'_OVERRIDE_HREF']) {
389 $this->I[
'spacer'] = 1;
391 $this->I[
'noLink'] = $this->I[
'spacer'] || $this->I[
'val'][
'noLink'] || !count($this->menuArr[$key]);
393 $this->I[
'name'] =
'';
395 if ($this->mconf[
'accessKey']) {
396 $this->I[
'accessKey'] = $this->
accessKey($this->I[
'title']);
398 $this->I[
'accessKey'] = array();
401 $this->I[
'val'][
'ATagParams'] = $this->WMcObj->getATagParams($this->I[
'val']);
402 if (isset($this->I[
'val'][
'additionalParams.'])) {
403 $this->I[
'val'][
'additionalParams'] = $this->WMcObj->stdWrap($this->I[
'val'][
'additionalParams'], $this->I[
'val'][
'additionalParams.']);
405 $this->I[
'linkHREF'] = $this->
link($key, $this->I[
'val'][
'altTarget'], $this->mconf[
'forceTypeValue']);
407 $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'];
408 if (strlen($titleAttrValue)) {
409 $this->I[
'linkHREF'][
'title'] = $titleAttrValue;
412 if ($this->result[
'RO'][$key] && !$this->I[
'noLink']) {
413 $this->I[
'theName'] = $this->imgNamePrefix . $this->I[
'uid'] . $this->I[
'INPfix'];
414 $this->I[
'name'] =
' ' . $this->nameAttribute .
'="' . $this->I[
'theName'] .
'"';
415 $this->I[
'linkHREF'][
'onMouseover'] = $this->WMfreezePrefix .
'over(\'' . $this->I[
'theName'] .
'\');
'; 416 $this->I['linkHREF
']['onMouseout
'] = $this->WMfreezePrefix . 'out(\
'' . $this->I[
'theName'] .
'\');
'; 417 $GLOBALS['TSFE
']->JSImgCode .= LF . $this->I['theName
'] . '_n=
new Image();
' . $this->I['theName
'] . '_n.src =
"' . $GLOBALS['TSFE']->absRefPrefix . $this->I['val']['output_file'] . '";
'; 418 $GLOBALS['TSFE
']->JSImgCode .= LF . $this->I['theName
'] . '_h=
new Image();
' . $this->I['theName
'] . '_h.src =
"' . $GLOBALS['TSFE']->absRefPrefix . $this->result['RO'][$key]['output_file'] . '";
'; 419 $GLOBALS['TSFE
']->imagesOnPage[] = $this->result['RO
'][$key]['output_file
']; 420 $GLOBALS['TSFE
']->setJS('mouseOver
'); 421 $this->extProc_RO($key); 424 $this->I['altText
'] = $this->I['title
'] . $this->I['accessKey']['alt
']; 425 // Calling extra processing function 426 $this->extProc_beforeLinking($key); 428 if (!$this->I['noLink
']) { 429 $this->setATagParts(); 434 $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'] . '" ' . $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
'] : '') . ' />
'; 435 // Make before, middle and after parts 436 $this->I['parts
'] = array(); 437 $this->I['parts
']['ATag_begin
'] = $this->I['A1
']; 438 $this->I['parts
']['image
'] = $this->I['IMG
']; 439 $this->I['parts
']['ATag_end
'] = $this->I['A2
']; 440 // Passing I to a user function 441 if ($this->mconf['IProcFunc
']) { 442 $this->I = $this->userProcess('IProcFunc
', $this->I); 444 // Putting the item together. 445 // Merge parts + beforeAllWrap 446 $this->I['theItem
'] = implode('', $this->I['parts
']); 447 $this->I['theItem
'] = $this->extProc_beforeAllWrap($this->I['theItem
'], $key); 449 $this->I['theItem
'] = $this->tmpl->wrap($this->I['theItem
'], $this->I['val
']['wrap
']); 451 $allWrap = isset($this->I['val
']['allWrap.
']) ? $this->WMcObj->stdWrap($this->I['val
']['allWrap
'], $this->I['val
']['allWrap.
']) : $this->I['val
']['allWrap
']; 452 $this->I['theItem
'] = $this->tmpl->wrap($this->I['theItem
'], $allWrap); 453 if ($this->I['val
']['subst_elementUid
']) { 454 $this->I['theItem
'] = str_replace('{elementUid}
', $this->I['uid
'], $this->I['theItem
']); 457 if (is_array($this->I['val
']['allStdWrap.
'])) { 458 $this->I['theItem
'] = $this->WMcObj->stdWrap($this->I['theItem
'], $this->I['val
']['allStdWrap.
']); 460 $GLOBALS['TSFE
']->imagesOnPage[] = $this->I['val
']['output_file
']; 461 $this->extProc_afterLinking($key); 464 return $this->extProc_finish(); 476 public function extProc_init() { 489 public function extProc_RO($key) { 502 public function extProc_beforeLinking($key) { 517 public function extProc_afterLinking($key) { 518 // Add part to the accumulated result + fetch submenus 519 if (!$this->I['spacer
']) { 520 $this->I['theItem
'] .= $this->subMenu($this->I['uid
'], $this->WMsubmenuObjSuffixes[$key]['sOSuffix
']); 522 $part = isset($this->I['val
']['wrapItemAndSub.
']) ? $this->WMcObj->stdWrap($this->I['val
']['wrapItemAndSub
'], $this->I['val
']['wrapItemAndSub.
']) : $this->I['val
']['wrapItemAndSub
']; 523 $this->WMresult .= $part ? $this->tmpl->wrap($this->I['theItem
'], $part) : $this->I['theItem
']; 536 public function extProc_beforeAllWrap($item, $key) { 548 public function extProc_finish() { 550 if (is_array($this->mconf['stdWrap.
'])) { 551 $this->WMresult = $this->WMcObj->stdWrap($this->WMresult, $this->mconf['stdWrap.
']); 553 return $this->tmpl->wrap($this->WMresult, $this->mconf['wrap
']) . $this->WMextraScript;
static png_to_gif_by_imagemagick($theFile)
static intExplode($delimiter, $string, $removeEmptyValues=FALSE, $limit=0)
static makeInstance($className)
debug($variable='', $name=' *variable *', $line=' *line *', $file=' *file *', $recursiveDepth=3, $debugLevel=E_DEBUG)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]