|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 Xavier Perseguers <typo3@perseguers.ch> 00006 * (c) 2010-2011 Steffen Kamper <steffen@typo3.org> 00007 * All rights reserved 00008 * 00009 * This script is part of the TYPO3 project. The TYPO3 project is 00010 * free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * The GNU General Public License can be found at 00016 * http://www.gnu.org/copyleft/gpl.html. 00017 * A copy is found in the textfile GPL.txt and important notices to the license 00018 * from the author is found in LICENSE.txt distributed with these scripts. 00019 * 00020 * 00021 * This script is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU General Public License for more details. 00025 * 00026 * This copyright notice MUST APPEAR in all copies of the script! 00027 ***************************************************************/ 00028 00029 /** 00030 * Contains IMAGE class object. 00031 * 00032 * $Id: class.tslib_content.php 7905 2010-06-13 14:42:33Z ohader $ 00033 * @author Xavier Perseguers <typo3@perseguers.ch> 00034 * @author Steffen Kamper <steffen@typo3.org> 00035 */ 00036 class tslib_content_ImageText extends tslib_content_Abstract { 00037 00038 /** 00039 * Rendering the cObject, IMAGE 00040 * 00041 * @param array Array of TypoScript properties 00042 * @return string Output 00043 */ 00044 public function render($conf = array()) { 00045 $content = ''; 00046 00047 if (isset($conf['text.'])) { 00048 $text = $this->cObj->cObjGet($conf['text.'], 'text.'); 00049 $content .= $this->cObj->stdWrap($text, $conf['text.']); // this gets the surrounding content 00050 } 00051 $imgList = isset($conf['imgList.']) 00052 ? trim($this->cObj->stdWrap($conf['imgList'], $conf['imgList.'])) // gets images 00053 : trim($conf['imgList']); 00054 if ($imgList) { 00055 $imgs = t3lib_div::trimExplode(',', $imgList); 00056 $imgStart = isset($conf['imgStart.']) 00057 ? intval($this->cObj->stdWrap($conf['imgStart'], $conf['imgStart.'])) 00058 : intval($conf['imgStart']); 00059 00060 $imgCount = count($imgs) - $imgStart; 00061 00062 $imgMax = isset($conf['imgMax.']) 00063 ? intval($this->cObj->stdWrap($conf['imgMax'], $conf['imgMax.'])) 00064 : intval($conf['imgMax']); 00065 if ($imgMax) { 00066 $imgCount = t3lib_div::intInRange($imgCount, 0, $imgMax); // reduces the number of images. 00067 } 00068 00069 $imgPath = isset($conf['imgPath.']) 00070 ? $this->cObj->stdWrap($conf['imgPath'], $conf['imgPath.']) 00071 : $conf['imgPath']; 00072 00073 // initialisation 00074 $caption = ''; 00075 $captionArray = array(); 00076 if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && isset($conf['caption.'])) { 00077 $caption = $this->cObj->cObjGet($conf['caption.'], 'caption.'); 00078 $caption = $this->cObj->stdWrap($caption, $conf['caption.']); // global caption, no splitting 00079 } 00080 if ($conf['captionSplit'] && $conf['captionSplit.']['cObject']) { 00081 $legacyCaptionSplit = 1; 00082 $capSplit = isset($conf['captionSplit.']['token.']) 00083 ? $this->cObj->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']) 00084 : $conf['captionSplit.']['token']; 00085 if (!$capSplit) { 00086 $capSplit = LF; 00087 } 00088 $captionArray = explode($capSplit, $this->cObj->cObjGetSingle( 00089 $conf['captionSplit.']['cObject'], 00090 $conf['captionSplit.']['cObject.'], 00091 'captionSplit.cObject') 00092 ); 00093 foreach ($captionArray as $ca_key => $ca_val) { 00094 $captionArray[$ca_key] = isset($conf['captionSplit.']['stdWrap.']) 00095 ? $this->cObj->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']) 00096 : trim($captionArray[$ca_key]); 00097 } 00098 } 00099 00100 $tablecode = ''; 00101 $position = isset($conf['textPos.']) 00102 ? $this->cObj->stdWrap($conf['textPos'], $conf['textPos.']) 00103 : $conf['textPos']; 00104 00105 $tmppos = $position & 7; 00106 $contentPosition = $position & 24; 00107 $align = $this->cObj->align[$tmppos]; 00108 $cap = ($caption) 00109 ? 1 00110 : 0; 00111 $txtMarg = isset($conf['textMargin.']) 00112 ? intval($this->cObj->stdWrap($conf['textMargin'], $conf['textMargin.'])) 00113 : intval($conf['textMargin']); 00114 if (!$conf['textMargin_outOfText'] && $contentPosition < 16) { 00115 $txtMarg = 0; 00116 } 00117 00118 $cols = isset($conf['cols.']) 00119 ? intval($this->cObj->stdWrap($conf['cols'], $conf['cols.'])) 00120 : intval($conf['cols']); 00121 $rows = isset($conf['rows.']) 00122 ? intval($this->cObj->stdWrap($conf['rows'], $conf['rows.'])) 00123 : intval($conf['rows']); 00124 $colspacing = isset($conf['colSpace.']) 00125 ? intval($this->cObj->stdWrap($conf['colSpace'], $conf['colSpace.'])) 00126 : intval($conf['colSpace']); 00127 $rowspacing = isset($conf['rowSpace.']) 00128 ? intval($this->cObj->stdWrap($conf['rowSpace'], $conf['rowSpace.'])) 00129 : intval($conf['rowSpace']); 00130 00131 $border = isset($conf['border.']) 00132 ? intval($this->cObj->stdWrap($conf['border'], $conf['border.'])) 00133 : intval($conf['border']); 00134 00135 $border = $border 00136 ? 1 00137 : 0; 00138 00139 if($border) { 00140 $borderColor = isset($conf['borderCol.']) 00141 ? $this->cObj->stdWrap($conf['borderCol'], $conf['borderCol.']) 00142 : $conf['borderCol']; 00143 if(!$borderColor) { 00144 $borderColor = 'black'; 00145 } 00146 00147 $borderThickness = isset($conf['borderThick.']) 00148 ? intval($this->cObj->stdWrap($conf['borderThick'], $conf['borderThick.'])) 00149 : intval($conf['borderThick']); 00150 if(!$borderThickness) { 00151 $borderThickness = 'black'; 00152 } 00153 } 00154 00155 $caption_align = isset($conf['captionAlign.']) 00156 ? $this->cObj->stdWrap($conf['captionAlign'], $conf['captionAlign.']) 00157 : $conf['captionAlign']; 00158 if (!$caption_align) { 00159 $caption_align = $align; 00160 } 00161 // generate cols 00162 $colCount = ($cols > 1) 00163 ? $cols 00164 : 1; 00165 if ($colCount > $imgCount) { 00166 $colCount = $imgCount; 00167 } 00168 $rowCount = ($colCount > 1) 00169 ? ceil($imgCount / $colCount) 00170 : $imgCount; 00171 // generate rows 00172 if ($rows > 1) { 00173 $rowCount = $rows; 00174 if ($rowCount > $imgCount) { 00175 $rowCount = $imgCount; 00176 } 00177 $colCount = ($rowCount > 1) 00178 ? ceil($imgCount / $rowCount) 00179 : $imgCount; 00180 } 00181 00182 // max Width 00183 $colRelations = isset($conf['colRelations.']) 00184 ? trim($this->cObj->stdWrap($conf['colRelations'], $conf['colRelations.'])) 00185 : trim($conf['colRelations']); 00186 $maxW = isset($conf['maxW.']) 00187 ? intval($this->cObj->stdWrap($conf['maxW'], $conf['maxW.'])) 00188 : intval($conf['maxW']); 00189 00190 $maxWInText = isset($conf['maxWInText.']) 00191 ? intval($this->cObj->stdWrap($conf['maxWInText'], $conf['maxWInText.'])) 00192 : intval($conf['maxWInText']); 00193 if (!$maxWInText) { // If maxWInText is not set, it's calculated to the 50 % of the max... 00194 $maxWInText = round($maxW / 2); 00195 } 00196 00197 if ($maxWInText && $contentPosition >= 16) { // inText 00198 $maxW = $maxWInText; 00199 } 00200 00201 if ($maxW && $colCount > 0) { // If there is a max width and if colCount is greater than column 00202 $maxW = ceil(($maxW - $colspacing * ($colCount - 1) - $colCount * $border * $borderThickness * 2) / $colCount); 00203 } 00204 // create the relation between rows 00205 $colMaxW = array(); 00206 if ($colRelations) { 00207 $rel_parts = explode(':', $colRelations); 00208 $rel_total = 0; 00209 for ($a = 0; $a < $colCount; $a++) { 00210 $rel_parts[$a] = intval($rel_parts[$a]); 00211 $rel_total += $rel_parts[$a]; 00212 } 00213 if ($rel_total) { 00214 for ($a = 0; $a < $colCount; $a++) { 00215 $colMaxW[$a] = round(($maxW * $colCount) / $rel_total * $rel_parts[$a]); 00216 } 00217 if (min($colMaxW) <= 0 || max($rel_parts) / min($rel_parts) > 10) { // The difference in size between the largest and smalles must be within a factor of ten. 00218 $colMaxW = array(); 00219 } 00220 } 00221 } 00222 $image_compression = isset($conf['image_compression.']) 00223 ? intval($this->cObj->stdWrap($conf['image_compression'], $conf['image_compression.'])) 00224 : intval($conf['image_compression']); 00225 $image_effects = isset($conf['image_effects.']) 00226 ? intval($this->cObj->stdWrap($conf['image_effects'], $conf['image_effects.'])) 00227 : intval($conf['image_effects']); 00228 $image_frames = isset($conf['image_frames.']['key.']) 00229 ? intval($this->cObj->stdWrap($conf['image_frames.']['key'], $conf['image_frames.']['key.'])) 00230 : intval($conf['image_frames.']['key']); 00231 00232 // fetches pictures 00233 $splitArr = array(); 00234 $splitArr['imgObjNum'] = $conf['imgObjNum']; 00235 $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr, $imgCount); 00236 00237 // EqualHeight 00238 $equalHeight = isset($conf['equalH.']) 00239 ? intval($this->cObj->stdWrap($conf['equalH'], $conf['equalH.'])) 00240 : intval($conf['equalH']); 00241 if ($equalHeight) { // Initiate gifbuilder object in order to get dimensions AND calculate the imageWidth's 00242 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder'); 00243 $gifCreator->init(); 00244 $relations = array(); 00245 $relations_cols = array(); 00246 $totalMaxW = $maxW * $colCount; 00247 for ($a = 0; $a < $imgCount; $a++) { 00248 $imgKey = $a + $imgStart; 00249 $imgInfo = $gifCreator->getImageDimensions($imgPath . $imgs[$imgKey]); 00250 $relations[$a] = $imgInfo[1] / $equalHeight; // relationship between the original height and the wished height 00251 if ($relations[$a]) { // if relations is zero, then the addition of this value is omitted as the image is not expected to display because of some error. 00252 $relations_cols[floor($a / $colCount)] += $imgInfo[0] / $relations[$a]; // counts the total width of the row with the new height taken into consideration. 00253 } 00254 } 00255 } 00256 00257 $imageRowsFinalWidths = array(); // contains the width of every image row 00258 $imageRowsMaxHeights = array(); 00259 $imgsTag = array(); 00260 $origImages = array(); 00261 for ($a = 0; $a < $imgCount; $a++) { 00262 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a; 00263 $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a; 00264 00265 $imgKey = $a + $imgStart; 00266 $totalImagePath = $imgPath . $imgs[$imgKey]; 00267 $this->cObj->data[$this->cObj->currentValKey] = $totalImagePath; 00268 $imgObjNum = intval($splitArr[$a]['imgObjNum']); 00269 $imgConf = $conf[$imgObjNum . '.']; 00270 00271 if ($equalHeight) { 00272 $scale = 1; 00273 if ($totalMaxW) { 00274 $rowTotalMaxW = $relations_cols[floor($a / $colCount)]; 00275 if ($rowTotalMaxW > $totalMaxW) { 00276 $scale = $rowTotalMaxW / $totalMaxW; 00277 } 00278 } 00279 // transfer info to the imageObject. Please note, that 00280 $imgConf['file.']['height'] = round($equalHeight / $scale); 00281 00282 unset( 00283 $imgConf['file.']['width'], 00284 $imgConf['file.']['maxW'], 00285 $imgConf['file.']['maxH'], 00286 $imgConf['file.']['minW'], 00287 $imgConf['file.']['minH'], 00288 $imgConf['file.']['width.'], 00289 $imgConf['file.']['maxW.'], 00290 $imgConf['file.']['maxH.'], 00291 $imgConf['file.']['minW.'], 00292 $imgConf['file.']['minH.'] 00293 ); 00294 $maxW = 0; // setting this to zero, so that it doesn't disturb 00295 } 00296 00297 if ($maxW) { 00298 if (count($colMaxW)) { 00299 $imgConf['file.']['maxW'] = $colMaxW[($a % $colCount)]; 00300 } else { 00301 $imgConf['file.']['maxW'] = $maxW; 00302 } 00303 } 00304 00305 // Image Object supplied: 00306 if (is_array($imgConf)) { 00307 if ($this->cObj->image_effects[$image_effects]) { 00308 $imgConf['file.']['params'] .= ' ' . $this->cObj->image_effects[$image_effects]; 00309 } 00310 if ($image_frames) { 00311 if (is_array($conf['image_frames.'][$image_frames . '.'])) { 00312 $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames . '.']; 00313 } 00314 } 00315 if ($image_compression && $imgConf['file'] != 'GIFBUILDER') { 00316 if ($image_compression == 1) { 00317 $tempImport = $imgConf['file.']['import']; 00318 $tempImport_dot = $imgConf['file.']['import.']; 00319 unset($imgConf['file.']); 00320 $imgConf['file.']['import'] = $tempImport; 00321 $imgConf['file.']['import.'] = $tempImport_dot; 00322 } elseif (isset($this->cObj->image_compression[$image_compression])) { 00323 $imgConf['file.']['params'] .= ' ' . $this->cObj->image_compression[$image_compression]['params']; 00324 $imgConf['file.']['ext'] = $this->cObj->image_compression[$image_compression]['ext']; 00325 unset($imgConf['file.']['ext.']); 00326 } 00327 } 00328 00329 // "alt", "title" and "longdesc" attributes: 00330 if (!strlen($imgConf['altText']) && !is_array($imgConf['altText.'])) { 00331 $imgConf['altText'] = $conf['altText']; 00332 $imgConf['altText.'] = $conf['altText.']; 00333 } 00334 if (!strlen($imgConf['titleText']) && !is_array($imgConf['titleText.'])) { 00335 $imgConf['titleText'] = $conf['titleText']; 00336 $imgConf['titleText.'] = $conf['titleText.']; 00337 } 00338 if (!strlen($imgConf['longdescURL']) && !is_array($imgConf['longdescURL.'])) { 00339 $imgConf['longdescURL'] = $conf['longdescURL']; 00340 $imgConf['longdescURL.'] = $conf['longdescURL.']; 00341 } 00342 } else { 00343 $imgConf = array( 00344 'altText' => $conf['altText'], 00345 'titleText' => $conf['titleText'], 00346 'longdescURL' => $conf['longdescURL'], 00347 'file' => $totalImagePath 00348 ); 00349 } 00350 00351 $imgsTag[$imgKey] = $this->cObj->IMAGE($imgConf); 00352 00353 // Store the original filepath 00354 $origImages[$imgKey] = $GLOBALS['TSFE']->lastImageInfo; 00355 00356 $imageRowsFinalWidths[floor($a / $colCount)] += $GLOBALS['TSFE']->lastImageInfo[0]; 00357 if ($GLOBALS['TSFE']->lastImageInfo[1] > $imageRowsMaxHeights[floor($a / $colCount)]) { 00358 $imageRowsMaxHeights[floor($a / $colCount)] = $GLOBALS['TSFE']->lastImageInfo[1]; 00359 } 00360 } 00361 // calculating the tableWidth: 00362 // TableWidth problems: It creates problems if the pictures are NOT as wide as the tableWidth. 00363 $tableWidth = max($imageRowsFinalWidths) + $colspacing * ($colCount - 1) + $colCount * $border * $borderThickness * 2; 00364 00365 // make table for pictures 00366 $index = $imgIndex = $imgStart; 00367 00368 $noRows = isset($conf['noRows.']) 00369 ? $this->cObj->stdWrap($conf['noRows'], $conf['noRows.']) 00370 : $conf['noRows']; 00371 $noCols = isset($conf['noCols.']) 00372 ? $this->cObj->stdWrap($conf['noCols'], $conf['noCols.']) 00373 : $conf['noCols']; 00374 if ($noRows) { 00375 $noCols = 0; 00376 } // noRows overrides noCols. They cannot exist at the same time. 00377 if ($equalHeight) { 00378 $noCols = 1; 00379 $noRows = 0; 00380 } 00381 00382 $rowCount_temp = 1; 00383 $colCount_temp = $colCount; 00384 if ($noRows) { 00385 $rowCount_temp = $rowCount; 00386 $rowCount = 1; 00387 } 00388 if ($noCols) { 00389 $colCount = 1; 00390 } 00391 // col- and rowspans calculated 00392 $colspan = $colspacing 00393 ? $colCount * 2 - 1 00394 : $colCount; 00395 $rowspan = ($rowspacing 00396 ? $rowCount * 2 - 1 00397 : $rowCount) 00398 + $cap; 00399 00400 // Edit icons: 00401 if (!is_array($conf['editIcons.'])) { 00402 $conf['editIcons.'] = array(); 00403 } 00404 $editIconsHTML = $conf['editIcons'] && $GLOBALS['TSFE']->beUserLogin 00405 ? $this->cObj->editIcons('', $conf['editIcons'], $conf['editIcons.']) 00406 : ''; 00407 00408 // strech out table: 00409 $tablecode = ''; 00410 $flag = 0; 00411 $noStretchAndMarginCells = isset($conf['noStretchAndMarginCells.']) 00412 ? $this->cObj->stdWrap($conf['noStretchAndMarginCells'], $conf['noStretchAndMarginCells.']) 00413 : $conf['noStretchAndMarginCells']; 00414 if ($noStretchAndMarginCells != 1) { 00415 $tablecode .= '<tr>'; 00416 if ($txtMarg && $align == 'right') { // If right aligned, the textborder is added on the right side 00417 $tablecode .= '<td rowspan="' . ($rowspan + 1) . '" valign="top"><img src="' . 00418 $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . $txtMarg . '" height="1" alt="" title="" />' . 00419 ($editIconsHTML ? '<br />' . $editIconsHTML : '') . '</td>'; 00420 $editIconsHTML = ''; 00421 $flag = 1; 00422 } 00423 $tablecode .= '<td colspan="' . $colspan . '"><img src="' . 00424 $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . $tableWidth . '" height="1" alt="" /></td>'; 00425 if ($txtMarg && $align == 'left') { // If left aligned, the textborder is added on the left side 00426 $tablecode .= '<td rowspan="' . ($rowspan + 1) . '" valign="top"><img src="' . 00427 $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . $txtMarg . '" height="1" alt="" title="" />' . 00428 ($editIconsHTML ? '<br />' . $editIconsHTML : '') . '</td>'; 00429 $editIconsHTML = ''; 00430 $flag = 1; 00431 } 00432 if ($flag) { 00433 $tableWidth += $txtMarg + 1; 00434 } 00435 $tablecode .= '</tr>'; 00436 } 00437 00438 // draw table 00439 for ($c = 0; $c < $rowCount; $c++) { // Looping through rows. If 'noRows' is set, this is '1 time', but $rowCount_temp will hold the actual number of rows! 00440 if ($c && $rowspacing) { // If this is NOT the first time in the loop AND if space is required, a row-spacer is added. In case of "noRows" rowspacing is done further down. 00441 $tablecode .= '<tr><td colspan="' . $colspan . '"><img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="1" height="' . $rowspacing . '"' . $this->cObj->getBorderAttr(' border="0"') . ' alt="" title="" /></td></tr>'; 00442 } 00443 $tablecode .= '<tr>'; // starting row 00444 for ($b = 0; $b < $colCount_temp; $b++) { // Looping through the columns 00445 if ($b && $colspacing) { // If this is NOT the first iteration AND if column space is required. In case of "noCols", the space is done without a separate cell. 00446 if (!$noCols) { 00447 $tablecode .= '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . 00448 $colspacing . '" height="1"' . $this->cObj->getBorderAttr(' border="0"') . ' alt="" title="" /></td>'; 00449 } else { 00450 $colSpacer = '<img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . 00451 ($border ? $colspacing - 6 : $colspacing) . '" height="' . 00452 ($imageRowsMaxHeights[$c] + ($border ? $borderThickness * 2 : 0)) . '"' . 00453 $this->cObj->getBorderAttr(' border="0"') . ' align="' . 00454 ($border ? 'left' : 'top') . '" alt="" title="" />'; 00455 $colSpacer = '<td valign="top">' . $colSpacer . '</td>'; // added 160301, needed for the new "noCols"-table... 00456 $tablecode .= $colSpacer; 00457 } 00458 } 00459 if (!$noCols || ($noCols && !$b)) { 00460 $tablecode .= '<td valign="top">'; // starting the cell. If "noCols" this cell will hold all images in the row, otherwise only a single image. 00461 if ($noCols) { 00462 $tablecode .= '<table width="' . $imageRowsFinalWidths[$c] . '" border="0" cellpadding="0" cellspacing="0"><tr>'; 00463 } // In case of "noCols" we must set the table-tag that surrounds the images in the row. 00464 } 00465 for ($a = 0; $a < $rowCount_temp; $a++) { // Looping through the rows IF "noRows" is set. "noRows" means that the rows of images is not rendered by physical table rows but images are all in one column and spaced apart with clear-gifs. This loop is only one time if "noRows" is not set. 00466 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex; // register previous imgIndex 00467 $imgIndex = $index + $a * $colCount_temp; 00468 $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgIndex; 00469 if ($imgsTag[$imgIndex]) { 00470 if ($rowspacing && $noRows && $a) { // Puts distance between the images IF "noRows" is set and this is the first iteration of the loop 00471 $tablecode .= '<img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="1" height="' . 00472 $rowspacing . '" alt="" title="" /><br />'; 00473 } 00474 if ($legacyCaptionSplit) { 00475 $thisCaption = $captionArray[$imgIndex]; 00476 } else if (($conf['captionSplit'] || $conf['imageTextSplit']) && isset($conf['caption.'])) { 00477 $thisCaption = $this->cObj->cObjGet($conf['caption.'], 'caption.'); 00478 $thisCaption = $this->cObj->stdWrap($thisCaption, $conf['caption.']); 00479 } 00480 $imageHTML = $imgsTag[$imgIndex] . '<br />'; 00481 $Talign = (!trim($thisCaption) && !$noRows) ? ' align="left"' : ''; // this is necessary if the tablerows are supposed to space properly together! "noRows" is excluded because else the images "layer" together. 00482 if ($border) { 00483 $imageHTML = '<table border="0" cellpadding="' . $borderThickness . '" cellspacing="0" bgcolor="' . 00484 $borderColor . '"' . $Talign . '><tr><td>' . $imageHTML . '</td></tr></table>'; 00485 } 00486 $imageHTML .= $editIconsHTML; 00487 $editIconsHTML = ''; 00488 $imageHTML .= $thisCaption; // Adds caption. 00489 if ($noCols) { 00490 $imageHTML = '<td valign="top">' . $imageHTML . '</td>'; 00491 } // If noCols, put in table cell. 00492 $tablecode .= $imageHTML; 00493 } 00494 } 00495 $index++; 00496 if (!$noCols || ($noCols && $b + 1 == $colCount_temp)) { 00497 if ($noCols) { 00498 $tablecode .= '</tr></table>'; 00499 } // In case of "noCols" we must finish the table that surrounds the images in the row. 00500 $tablecode .= '</td>'; // Ending the cell. In case of "noCols" the cell holds all pictures! 00501 } 00502 } 00503 $tablecode .= '</tr>'; // ending row 00504 } 00505 if ($c) { 00506 switch ($contentPosition) { 00507 case '0' : // above 00508 case '8' : // below 00509 switch ($align) { // These settings are needed for Firefox 00510 case 'center' : 00511 $table_align = 'margin-left: auto; margin-right: auto'; 00512 break; 00513 case 'right' : 00514 $table_align = 'margin-left: auto; margin-right: 0px'; 00515 break; 00516 default : // Most of all: left 00517 $table_align = 'margin-left: 0px; margin-right: auto'; 00518 } 00519 $table_align = 'style="' . $table_align . '"'; 00520 break; 00521 case '16' : // in text 00522 $table_align = 'align="' . $align . '"'; 00523 break; 00524 default : 00525 $table_align = ''; 00526 } 00527 00528 // Table-tag is inserted 00529 $tablecode = '<table' . ($tableWidth ? ' width="' . $tableWidth . '"' : '') . ' border="0" cellspacing="0" cellpadding="0" ' . $table_align . ' class="imgtext-table">' . $tablecode; 00530 if ($editIconsHTML) { // IF this value is not long since reset. 00531 $tablecode .= '<tr><td colspan="' . $colspan . '">' . $editIconsHTML . '</td></tr>'; 00532 $editIconsHTML = ''; 00533 } 00534 if ($cap) { 00535 $tablecode .= '<tr><td colspan="' . $colspan . '" align="' . $caption_align . '">' . $caption . '</td></tr>'; 00536 } 00537 $tablecode .= '</table>'; 00538 if (isset($conf['tableStdWrap.'])) { 00539 $tablecode = $this->cObj->stdWrap($tablecode, $conf['tableStdWrap.']); 00540 } 00541 } 00542 00543 $spaceBelowAbove = isset($conf['spaceBelowAbove.']) 00544 ? intval($this->cObj->stdWrap($conf['spaceBelowAbove'], $conf['spaceBelowAbove.'])) 00545 : intval($conf['spaceBelowAbove']); 00546 switch ($contentPosition) { 00547 case '0' : // above 00548 $output = '<div style="text-align:' . $align . ';">' . $tablecode . '</div>' . 00549 $this->cObj->wrapSpace($content, $spaceBelowAbove . '|0'); 00550 break; 00551 case '8' : // below 00552 $output = $this->cObj->wrapSpace($content, '0|' . $spaceBelowAbove) . 00553 '<div style="text-align:' . $align . ';">' . $tablecode . '</div>'; 00554 break; 00555 case '16' : // in text 00556 $output = $tablecode . $content; 00557 break; 00558 case '24' : // in text, no wrap 00559 $theResult = ''; 00560 $theResult .= '<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap"><tr>'; 00561 if ($align == 'right') { 00562 $theResult .= '<td valign="top">' . $content . '</td><td valign="top">' . $tablecode . '</td>'; 00563 } else { 00564 $theResult .= '<td valign="top">' . $tablecode . '</td><td valign="top">' . $content . '</td>'; 00565 } 00566 $theResult .= '</tr></table>'; 00567 $output = $theResult; 00568 break; 00569 } 00570 } else { 00571 $output = $content; 00572 } 00573 00574 if (isset($conf['stdWrap.'])) { 00575 $output = $this->cObj->stdWrap($output, $conf['stdWrap.']); 00576 } 00577 00578 return $output; 00579 } 00580 00581 } 00582 00583 00584 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/content/class.tslib_content_imagetext.php'])) { 00585 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/content/class.tslib_content_imagetext.php']); 00586 } 00587 00588 ?>
1.8.0