TYPO3 API  SVNRelease
class.tx_cssstyledcontent_pi1.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Plugin 'Content rendering' for the 'css_styled_content' extension.
00029  *
00030  * $Id: class.tx_cssstyledcontent_pi1.php 10120 2011-01-18 20:03:36Z ohader $
00031  *
00032  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00033  */
00034 /**
00035  * [CLASS/FUNCTION INDEX of SCRIPT]
00036  *
00037  *
00038  *
00039  *   68: class tx_cssstyledcontent_pi1 extends tslib_pibase
00040  *
00041  *              SECTION: Rendering of Content Elements:
00042  *   96:     function render_bullets($content,$conf)
00043  *  141:     function render_table($content,$conf)
00044  *  283:     function render_uploads($content,$conf)
00045  *  395:     function render_textpic($content, $conf)
00046  *
00047  *              SECTION: Helper functions
00048  *  832:     function getTableAttributes($conf,$type)
00049  *  861:     function &hookRequest($functionName)
00050  *
00051  * TOTAL FUNCTIONS: 6
00052  * (This index is automatically created/updated by the extension "extdeveval")
00053  *
00054  */
00055 /**
00056  * Plugin class - instantiated from TypoScript.
00057  * Rendering some content elements from tt_content table.
00058  *
00059  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00060  * @package TYPO3
00061  * @subpackage tx_cssstyledcontent
00062  */
00063 class tx_cssstyledcontent_pi1 extends tslib_pibase {
00064 
00065         // Default plugin variables:
00066     var $prefixId = 'tx_cssstyledcontent_pi1';      // Same as class name
00067     var $scriptRelPath = 'pi1/class.tx_cssstyledcontent_pi1.php';   // Path to this script relative to the extension dir.
00068     var $extKey = 'css_styled_content';     // The extension key.
00069     var $conf = array();
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077     /***********************************
00078      *
00079      * Rendering of Content Elements:
00080      *
00081      ***********************************/
00082 
00083     /**
00084      * Rendering the "Bulletlist" type content element, called from TypoScript (tt_content.bullets.20)
00085      *
00086      * @param   string      Content input. Not used, ignore.
00087      * @param   array       TypoScript configuration
00088      * @return  string      HTML output.
00089      * @access private
00090      */
00091     function render_bullets($content,$conf) {
00092 
00093             // Look for hook before running default code for function
00094         if ($hookObj = $this->hookRequest('render_bullets')) {
00095             return $hookObj->render_bullets($content,$conf);
00096         } else {
00097 
00098                 // Get bodytext field content, returning blank if empty:
00099             $field = (isset($conf['field']) && trim($conf['field']) ? trim($conf['field']) : 'bodytext');
00100             $content = trim($this->cObj->data[$field]);
00101             if (!strcmp($content,''))   return '';
00102 
00103                 // Split into single lines:
00104             $lines = t3lib_div::trimExplode(LF,$content);
00105             foreach($lines as &$val)    {
00106                 $val = '<li>'.$this->cObj->stdWrap($val,$conf['innerStdWrap.']).'</li>';
00107             }
00108 
00109                 // Set header type:
00110             $type = intval($this->cObj->data['layout']);
00111 
00112                 // Compile list:
00113             $out = '
00114                 <ul class="csc-bulletlist csc-bulletlist-'.$type.'">'.
00115                     implode('',$lines).'
00116                 </ul>';
00117 
00118                 // Calling stdWrap:
00119             if ($conf['stdWrap.']) {
00120                 $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
00121             }
00122 
00123                 // Return value
00124             return $out;
00125         }
00126     }
00127 
00128     /**
00129      * Rendering the "Table" type content element, called from TypoScript (tt_content.table.20)
00130      *
00131      * @param   string      Content input. Not used, ignore.
00132      * @param   array       TypoScript configuration
00133      * @return  string      HTML output.
00134      * @access private
00135      */
00136     function render_table($content,$conf)   {
00137 
00138             // Look for hook before running default code for function
00139         if ($hookObj = $this->hookRequest('render_table')) {
00140             return $hookObj->render_table($content,$conf);
00141         } else {
00142                 // Init FlexForm configuration
00143             $this->pi_initPIflexForm();
00144 
00145                 // Get bodytext field content
00146             $field = (isset($conf['field']) && trim($conf['field']) ? trim($conf['field']) : 'bodytext');
00147             $content = trim($this->cObj->data[$field]);
00148             if (!strcmp($content,''))   return '';
00149 
00150                 // get flexform values
00151             $caption = trim(htmlspecialchars($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_caption')));
00152             $summary = trim(htmlspecialchars($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_summary')));
00153             $useTfoot = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_tfoot'));
00154             $headerPos = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_headerpos');
00155             $noStyles = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_nostyles');
00156             $tableClass = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_tableclass');
00157 
00158             $delimiter = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'tableparsing_delimiter','s_parsing'));
00159             if ($delimiter) {
00160                 $delimiter = chr(intval($delimiter));
00161             } else {
00162                 $delimiter = '|';
00163             }
00164             $quotedInput = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'tableparsing_quote','s_parsing'));
00165             if ($quotedInput)   {
00166                 $quotedInput = chr(intval($quotedInput));
00167             } else {
00168                 $quotedInput = '';
00169             }
00170 
00171                 // generate id prefix for accessible header
00172             $headerScope = ($headerPos=='top'?'col':'row');
00173             $headerIdPrefix = $headerScope.$this->cObj->data['uid'].'-';
00174 
00175                 // Split into single lines (will become table-rows):
00176             $rows = t3lib_div::trimExplode(LF,$content);
00177             reset($rows);
00178 
00179                 // Find number of columns to render:
00180             $cols = t3lib_div::intInRange($this->cObj->data['cols']?$this->cObj->data['cols']:count(explode($delimiter,current($rows))),0,100);
00181 
00182                 // Traverse rows (rendering the table here)
00183             $rCount = count($rows);
00184             foreach($rows as $k => $v)  {
00185                 $cells = explode($delimiter,$v);
00186                 $newCells=array();
00187                 for($a=0;$a<$cols;$a++) {
00188                         // remove quotes if needed
00189                     if ($quotedInput && substr($cells[$a],0,1) == $quotedInput && substr($cells[$a],-1,1) == $quotedInput)  {
00190                         $cells[$a] = substr($cells[$a],1,-1);
00191                     }
00192 
00193                     if (!strcmp(trim($cells[$a]),''))   $cells[$a]='&nbsp;';
00194                     $cellAttribs = ($noStyles?'':($a>0 && ($cols-1)==$a) ? ' class="td-last td-'.$a.'"' : ' class="td-'.$a.'"');
00195                     if (($headerPos == 'top' && !$k) || ($headerPos == 'left' && !$a))  {
00196                         $scope = ' scope="'.$headerScope.'"';
00197                         $scope .= ' id="'.$headerIdPrefix.(($headerScope=='col')?$a:$k).'"';
00198 
00199                         $newCells[$a] = '
00200                             <th'.$cellAttribs.$scope.'>'.$this->cObj->stdWrap($cells[$a],$conf['innerStdWrap.']).'</th>';
00201                     } else {
00202                         if (empty($headerPos))  {
00203                             $accessibleHeader = '';
00204                         } else {
00205                             $accessibleHeader = ' headers="'.$headerIdPrefix.(($headerScope=='col')?$a:$k).'"';
00206                         }
00207                         $newCells[$a] = '
00208                             <td'.$cellAttribs.$accessibleHeader.'>'.$this->cObj->stdWrap($cells[$a],$conf['innerStdWrap.']).'</td>';
00209                     }
00210                 }
00211                 if (!$noStyles) {
00212                     $oddEven = $k%2 ? 'tr-odd' : 'tr-even';
00213                     $rowAttribs =  ($k>0 && ($rCount-1)==$k) ? ' class="'.$oddEven.' tr-last"' : ' class="'.$oddEven.' tr-'.$k.'"';
00214                 }
00215                 $rows[$k]='
00216                     <tr'.$rowAttribs.'>'.implode('',$newCells).'
00217                     </tr>';
00218             }
00219 
00220             $addTbody = 0;
00221             $tableContents = '';
00222             if ($caption)   {
00223                 $tableContents .= '
00224                     <caption>'.$caption.'</caption>';
00225             }
00226             if ($headerPos == 'top' && $rows[0])    {
00227                 $tableContents .= '<thead>'. $rows[0] .'
00228                     </thead>';
00229                 unset($rows[0]);
00230                 $addTbody = 1;
00231             }
00232             if ($useTfoot)  {
00233                 $tableContents .= '
00234                     <tfoot>'.$rows[$rCount-1].'</tfoot>';
00235                 unset($rows[$rCount-1]);
00236                 $addTbody = 1;
00237             }
00238             $tmpTable = implode('',$rows);
00239             if ($addTbody)  {
00240                 $tmpTable = '<tbody>'.$tmpTable.'</tbody>';
00241             }
00242             $tableContents .= $tmpTable;
00243 
00244                 // Set header type:
00245             $type = intval($this->cObj->data['layout']);
00246 
00247                 // Table tag params.
00248             $tableTagParams = $this->getTableAttributes($conf,$type);
00249             if (!$noStyles) {
00250                 $tableTagParams['class'] = 'contenttable contenttable-'.$type.($tableClass?' '.$tableClass:'');
00251             } elseif ($tableClass) {
00252                 $tableTagParams['class'] = $tableClass;
00253             }
00254 
00255 
00256                 // Compile table output:
00257             $out = '
00258                 <table '.t3lib_div::implodeAttributes($tableTagParams).($summary?' summary="'.$summary.'"':'').'>'. // Omitted xhtmlSafe argument TRUE - none of the values will be needed to be converted anyways, no need to spend processing time on that.
00259                 $tableContents.'
00260                 </table>';
00261 
00262                 // Calling stdWrap:
00263             if ($conf['stdWrap.']) {
00264                 $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
00265             }
00266 
00267                 // Return value
00268             return $out;
00269         }
00270     }
00271 
00272     /**
00273      * Rendering the "Filelinks" type content element, called from TypoScript (tt_content.uploads.20)
00274      *
00275      * @param   string      Content input. Not used, ignore.
00276      * @param   array       TypoScript configuration
00277      * @return  string      HTML output.
00278      * @access private
00279      */
00280     function render_uploads($content,$conf) {
00281 
00282             // Look for hook before running default code for function
00283         if ($hookObj = $this->hookRequest('render_uploads')) {
00284             return $hookObj->render_uploads($content,$conf);
00285         } else {
00286 
00287             $out = '';
00288 
00289                 // Set layout type:
00290             $type = intval($this->cObj->data['layout']);
00291 
00292                 // see if the file path variable is set, this takes precedence
00293             $filePathConf = $this->cObj->stdWrap($conf['filePath'], $conf['filePath.']);
00294             if ($filePathConf) {
00295                 $fileList = $this->cObj->filelist($filePathConf);
00296                 list($path) = explode('|', $filePathConf);
00297             } else {
00298                     // Get the list of files from the field
00299                 $field = (trim($conf['field']) ? trim($conf['field']) : 'media');
00300                 $fileList = $this->cObj->data[$field];
00301                 t3lib_div::loadTCA('tt_content');
00302                 $path = 'uploads/media/';
00303                 if (is_array($GLOBALS['TCA']['tt_content']['columns'][$field]) && !empty($GLOBALS['TCA']['tt_content']['columns'][$field]['config']['uploadfolder'])) {
00304                     // in TCA-Array folders are saved without trailing slash, so $path.$fileName won't work
00305                     $path = $GLOBALS['TCA']['tt_content']['columns'][$field]['config']['uploadfolder'] .'/';
00306                 }
00307             }
00308             $path = trim($path);
00309 
00310                 // Explode into an array:
00311             $fileArray = t3lib_div::trimExplode(',',$fileList,1);
00312 
00313                 // If there were files to list...:
00314             if (count($fileArray))  {
00315 
00316                     // Get the descriptions for the files (if any):
00317                 $descriptions = t3lib_div::trimExplode(LF,$this->cObj->data['imagecaption']);
00318 
00319                     // Adding hardcoded TS to linkProc configuration:
00320                 $conf['linkProc.']['path.']['current'] = 1;
00321                 $conf['linkProc.']['icon'] = 1; // Always render icon - is inserted by PHP if needed.
00322                 $conf['linkProc.']['icon.']['wrap'] = ' | //**//';  // Temporary, internal split-token!
00323                 $conf['linkProc.']['icon_link'] = 1;    // ALways link the icon
00324                 $conf['linkProc.']['icon_image_ext_list'] = ($type==2 || $type==3) ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] : '';  // If the layout is type 2 or 3 we will render an image based icon if possible.
00325                 if ($conf['labelStdWrap.']) {
00326                     $conf['linkProc.']['labelStdWrap.'] = $conf['labelStdWrap.'];
00327                 }
00328                 if ($conf['useSpacesInLinkText'] || $conf['stripFileExtensionFromLinkText']) {
00329                     $conf['linkProc.']['removePrependedNumbers'] = 0;
00330                 }
00331 
00332                     // Traverse the files found:
00333                 $filesData = array();
00334                 foreach($fileArray as $key => $fileName)    {
00335                     $absPath = t3lib_div::getFileAbsFileName($path.$fileName);
00336                     if (@is_file($absPath)) {
00337                         $fI = pathinfo($fileName);
00338                         $filesData[$key] = array();
00339 
00340                         $filesData[$key]['filename'] = $fileName;
00341                         $filesData[$key]['path'] = $path;
00342                         $filesData[$key]['filesize'] = filesize($absPath);
00343                         $filesData[$key]['fileextension'] = strtolower($fI['extension']);
00344                         $filesData[$key]['description'] = trim($descriptions[$key]);
00345 
00346                         $this->cObj->setCurrentVal($path);
00347                         $GLOBALS['TSFE']->register['ICON_REL_PATH'] = $path.$fileName;
00348                         $GLOBALS['TSFE']->register['filename'] = $filesData[$key]['filename'];
00349                         $GLOBALS['TSFE']->register['path'] = $filesData[$key]['path'];
00350                         $GLOBALS['TSFE']->register['fileSize'] = $filesData[$key]['filesize'];
00351                         $GLOBALS['TSFE']->register['fileExtension'] = $filesData[$key]['fileextension'];
00352                         $GLOBALS['TSFE']->register['description'] = $filesData[$key]['description'];
00353                         $filesData[$key]['linkedFilenameParts']
00354                             = $this->beautifyFileLink(
00355                                 explode(
00356                                     '//**//',
00357                                     $this->cObj->filelink(
00358                                         $fileName, $conf['linkProc.']
00359                                     )
00360                                 ),
00361                                 $fileName,
00362                                 $conf['useSpacesInLinkText'],
00363                                 $conf['stripFileExtensionFromLinkText']
00364                             );
00365                     }
00366                 }
00367 
00368                     // optionSplit applied to conf to allow differnt settings per file
00369                 $splitConf = $GLOBALS['TSFE']->tmpl->splitConfArray($conf, count($filesData));
00370 
00371                     // Now, lets render the list!
00372                 $outputEntries = array();
00373                 foreach($filesData as $key => $fileData)    {
00374                     $GLOBALS['TSFE']->register['linkedIcon'] = $fileData['linkedFilenameParts'][0];
00375                     $GLOBALS['TSFE']->register['linkedLabel'] = $fileData['linkedFilenameParts'][1];
00376                     $GLOBALS['TSFE']->register['filename'] = $fileData['filename'];
00377                     $GLOBALS['TSFE']->register['path'] = $fileData['path'];
00378                     $GLOBALS['TSFE']->register['description'] = $fileData['description'];
00379                     $GLOBALS['TSFE']->register['fileSize'] = $fileData['filesize'];
00380                     $GLOBALS['TSFE']->register['fileExtension'] = $fileData['fileextension'];
00381                     $outputEntries[] = $this->cObj->cObjGetSingle($splitConf[$key]['itemRendering'], $splitConf[$key]['itemRendering.']);
00382                 }
00383 
00384                 if (isset($conf['outerWrap']))  {
00385                         // Wrap around the whole content
00386                     $outerWrap = $conf['outerWrap'];
00387                 } else  {
00388                         // Table tag params
00389                     $tableTagParams = $this->getTableAttributes($conf,$type);
00390                     $tableTagParams['class'] = 'csc-uploads csc-uploads-'.$type;
00391                     $outerWrap = '<table ' . t3lib_div::implodeAttributes($tableTagParams) . '>|</table>';
00392                 }
00393 
00394                     // Compile it all into table tags:
00395                 $out = $this->cObj->wrap(implode('', $outputEntries), $outerWrap);
00396             }
00397 
00398                 // Calling stdWrap:
00399             if ($conf['stdWrap.']) {
00400                 $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
00401             }
00402 
00403                 // Return value
00404             return $out;
00405         }
00406     }
00407 
00408     /**
00409      * returns an array containing width relations for $colCount columns.
00410      * 
00411      * tries to use "colRelations" setting given by TS.
00412      * uses "1:1" column relations by default. 
00413      *
00414      * @param array $conf TS configuration for img
00415      * @param int $colCount number of columns
00416      * @return array
00417      */
00418     protected function getImgColumnRelations($conf, $colCount) {
00419         $relations = array();
00420         $equalRelations= array_fill(0, $colCount, 1);
00421         $colRelationsTypoScript = trim($this->cObj->stdWrap($conf['colRelations'], $conf['colRelations.']));
00422 
00423         if ($colRelationsTypoScript) {
00424                 // try to use column width relations given by TS
00425             $relationParts = explode(':', $colRelationsTypoScript);
00426                 // enough columns defined?
00427             if (count($relationParts) >= $colCount) {
00428                 $out = array();
00429                 for ($a = 0; $a < $colCount; $a++) {
00430                     $currentRelationValue = intval($relationParts[$a]);
00431                     if ($currentRelationValue >= 1) {
00432                         $out[$a] = $currentRelationValue;
00433                     } else {
00434                         t3lib_div::devLog('colRelations used with a value smaller than 1 therefore colRelations setting is ignored.', $this->extKey, 2);
00435                         unset($out);
00436                         break;
00437                     }
00438                 }
00439                 if (max($out) / min($out) <= 10) {
00440                     $relations = $out;
00441                 } else {
00442                     t3lib_div::devLog('The difference in size between the largest and smallest colRelation was not within a factor of ten therefore colRelations setting is ignored..', $this->extKey, 2);
00443                 }
00444             }
00445         }
00446         return $relations ? $relations : $equalRelations;
00447     }
00448     
00449     /**
00450      * returns an array containing the image widths for an image row with $colCount columns.
00451      *
00452      * @param array $conf TS configuration of img
00453      * @param int $colCount number of columns
00454      * @param int $netW max usable width for images (without spaces and borders)
00455      * @return array
00456      */
00457     protected function getImgColumnWidths($conf, $colCount, $netW) {
00458         $columnWidths = array();
00459         $colRelations = $this->getImgColumnRelations($conf, $colCount);
00460         
00461         $accumWidth = 0;
00462         $accumDesiredWidth = 0;
00463         $relUnitCount = array_sum($colRelations);
00464         
00465         for ($a = 0; $a < $colCount; $a++)  {
00466             $availableWidth = $netW - $accumWidth; // this much width is available for the remaining images in this row (int)
00467             $desiredWidth = $netW / $relUnitCount * $colRelations[$a]; // theoretical width of resized image. (float)
00468             $accumDesiredWidth += $desiredWidth; // add this width. $accumDesiredWidth becomes the desired horizontal position 
00469                 // calculate width by comparing actual and desired horizontal position.
00470                 // this evenly distributes rounding errors across all images in this row. 
00471             $suggestedWidth = round($accumDesiredWidth - $accumWidth);
00472             $finalImgWidth = (int) min($availableWidth, $suggestedWidth); // finalImgWidth may not exceed $availableWidth
00473             $accumWidth += $finalImgWidth;
00474             $columnWidths[$a] = $finalImgWidth;
00475         }
00476         return $columnWidths;
00477     }
00478     
00479     /**
00480      * Rendering the IMGTEXT content element, called from TypoScript (tt_content.textpic.20)
00481      *
00482      * @param   string      Content input. Not used, ignore.
00483      * @param   array       TypoScript configuration. See TSRef "IMGTEXT". This function aims to be compatible.
00484      * @return  string      HTML output.
00485      * @access private
00486      * @coauthor    Ernesto Baschny <ernst@cron-it.de>
00487      */
00488      function render_textpic($content, $conf)   {
00489             // Look for hook before running default code for function
00490         if (method_exists($this, 'hookRequest') && $hookObj = $this->hookRequest('render_textpic')) {
00491             return $hookObj->render_textpic($content,$conf);
00492         }
00493 
00494         $renderMethod = $this->cObj->stdWrap($conf['renderMethod'], $conf['renderMethod.']);
00495 
00496             // Render using the default IMGTEXT code (table-based)
00497         if (!$renderMethod || $renderMethod == 'table') {
00498             return $this->cObj->IMGTEXT($conf);
00499         }
00500 
00501             // Specific configuration for the chosen rendering method
00502         if (is_array($conf['rendering.'][$renderMethod . '.'])) {
00503             $conf = $this->cObj->joinTSarrays($conf, $conf['rendering.'][$renderMethod . '.']);
00504         }
00505 
00506             // Image or Text with Image?
00507         if (is_array($conf['text.']))   {
00508             $content = $this->cObj->stdWrap($this->cObj->cObjGet($conf['text.'], 'text.'), $conf['text.']);
00509         }
00510 
00511         $imgList = trim($this->cObj->stdWrap($conf['imgList'], $conf['imgList.']));
00512 
00513         if (!$imgList)  {
00514                 // No images, that's easy
00515             if (is_array($conf['stdWrap.']))    {
00516                 return $this->cObj->stdWrap($content, $conf['stdWrap.']);
00517             }
00518             return $content;
00519         }
00520 
00521         $imgs = t3lib_div::trimExplode(',', $imgList);
00522         $imgStart = intval($this->cObj->stdWrap($conf['imgStart'], $conf['imgStart.']));
00523         $imgCount = count($imgs) - $imgStart;
00524         $imgMax = intval($this->cObj->stdWrap($conf['imgMax'], $conf['imgMax.']));
00525         if ($imgMax)    {
00526             $imgCount = t3lib_div::intInRange($imgCount, 0, $imgMax);   // reduce the number of images.
00527         }
00528 
00529         $imgPath = $this->cObj->stdWrap($conf['imgPath'], $conf['imgPath.']);
00530 
00531             // Does we need to render a "global caption" (below the whole image block)?
00532         $renderGlobalCaption = !$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.']);
00533         if ($imgCount == 1) {
00534                 // If we just have one image, the caption relates to the image, so it is not "global"
00535             $renderGlobalCaption = false;
00536         }
00537 
00538             // Use the calculated information (amount of images, if global caption is wanted) to choose a different rendering method for the images-block
00539         $GLOBALS['TSFE']->register['imageCount'] = $imgCount;
00540         $GLOBALS['TSFE']->register['renderGlobalCaption'] = $renderGlobalCaption;
00541         $fallbackRenderMethod = $this->cObj->cObjGetSingle($conf['fallbackRendering'], $conf['fallbackRendering.']);
00542         if ($fallbackRenderMethod && is_array($conf['rendering.'][$fallbackRenderMethod . '.']))    {
00543             $conf = $this->cObj->joinTSarrays($conf, $conf['rendering.'][$fallbackRenderMethod . '.']);
00544         }
00545 
00546             // Global caption
00547         $globalCaption = '';
00548         if ($renderGlobalCaption)   {
00549             $globalCaption = $this->cObj->stdWrap($this->cObj->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
00550         }
00551 
00552             // Positioning
00553         $position = $this->cObj->stdWrap($conf['textPos'], $conf['textPos.']);
00554 
00555         $imagePosition = $position&7;   // 0,1,2 = center,right,left
00556         $contentPosition = $position&24;    // 0,8,16,24 (above,below,intext,intext-wrap)
00557         $align = $this->cObj->align[$imagePosition];
00558         $textMargin = intval($this->cObj->stdWrap($conf['textMargin'],$conf['textMargin.']));
00559         if (!$conf['textMargin_outOfText'] && $contentPosition < 16)    {
00560             $textMargin = 0;
00561         }
00562 
00563         $colspacing = intval($this->cObj->stdWrap($conf['colSpace'], $conf['colSpace.']));
00564         $rowspacing = intval($this->cObj->stdWrap($conf['rowSpace'], $conf['rowSpace.']));
00565 
00566         $border = intval($this->cObj->stdWrap($conf['border'], $conf['border.'])) ? 1:0;
00567         $borderColor = $this->cObj->stdWrap($conf['borderCol'], $conf['borderCol.']);
00568         $borderThickness = intval($this->cObj->stdWrap($conf['borderThick'], $conf['borderThick.']));
00569 
00570         $borderColor = $borderColor?$borderColor:'black';
00571         $borderThickness = $borderThickness?$borderThickness:1;
00572         $borderSpace = (($conf['borderSpace']&&$border) ? intval($conf['borderSpace']) : 0);
00573 
00574             // Generate cols
00575         $cols = intval($this->cObj->stdWrap($conf['cols'],$conf['cols.']));
00576         $colCount = ($cols > 1) ? $cols : 1;
00577         if ($colCount > $imgCount)  {$colCount = $imgCount;}
00578         $rowCount = ceil($imgCount / $colCount);
00579 
00580             // Generate rows
00581         $rows = intval($this->cObj->stdWrap($conf['rows'],$conf['rows.']));
00582         if ($rows>1)    {
00583             $rowCount = $rows;
00584             if ($rowCount > $imgCount)  {$rowCount = $imgCount;}
00585             $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount;
00586         }
00587 
00588             // Max Width
00589         $maxW = intval($this->cObj->stdWrap($conf['maxW'], $conf['maxW.']));
00590 
00591         if ($contentPosition>=16)   {   // in Text
00592             $maxWInText = intval($this->cObj->stdWrap($conf['maxWInText'],$conf['maxWInText.']));
00593             if (!$maxWInText)   {
00594                     // If maxWInText is not set, it's calculated to the 50% of the max
00595                 $maxW = round($maxW/100*50);
00596             } else {
00597                 $maxW = $maxWInText;
00598             }
00599         }
00600 
00601             // max usuable width for images (without spacers and borders)
00602         $netW = $maxW - $colspacing * ($colCount - 1) - $colCount * $border * ($borderThickness + $borderSpace) * 2;
00603 
00604             // Specify the maximum width for each column
00605         $columnWidths = $this->getImgColumnWidths($conf, $colCount, $netW);
00606         
00607         $image_compression = intval($this->cObj->stdWrap($conf['image_compression'],$conf['image_compression.']));
00608         $image_effects = intval($this->cObj->stdWrap($conf['image_effects'],$conf['image_effects.']));
00609         $image_frames = intval($this->cObj->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.']));
00610 
00611             // EqualHeight
00612         $equalHeight = intval($this->cObj->stdWrap($conf['equalH'],$conf['equalH.']));
00613         if ($equalHeight)   {
00614                 // Initiate gifbuilder object in order to get dimensions AND calculate the imageWidth's
00615             $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
00616             $gifCreator->init();
00617             $relations_cols = Array();
00618             $imgWidths = array(); // contains the individual width of all images after scaling to $equalHeight
00619             for ($a=0; $a<$imgCount; $a++)  {
00620                 $imgKey = $a+$imgStart;
00621                 $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]);
00622                 $rel = $imgInfo[1] / $equalHeight;  // relationship between the original height and the wished height
00623                 if ($rel)   {   // if relations is zero, then the addition of this value is omitted as the image is not expected to display because of some error.
00624                     $imgWidths[$a] = $imgInfo[0] / $rel;
00625                     $relations_cols[floor($a/$colCount)] += $imgWidths[$a]; // counts the total width of the row with the new height taken into consideration.
00626                 }
00627             }
00628         }
00629 
00630             // Fetches pictures
00631         $splitArr = array();
00632         $splitArr['imgObjNum'] = $conf['imgObjNum'];
00633         $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr, $imgCount);
00634 
00635         $imageRowsFinalWidths = Array();    // contains the width of every image row
00636         $imgsTag = array();     // array index of $imgsTag will be the same as in $imgs, but $imgsTag only contains the images that are actually shown
00637         $origImages = array();
00638         $rowIdx = 0;
00639         for ($a=0; $a<$imgCount; $a++)  {
00640             $imgKey = $a+$imgStart;
00641             $totalImagePath = $imgPath.$imgs[$imgKey];
00642 
00643             $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgKey;  // register IMG_NUM is kept for backwards compatibility
00644             $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgKey;
00645             $GLOBALS['TSFE']->register['ORIG_FILENAME'] = $totalImagePath;
00646 
00647             $this->cObj->data[$this->cObj->currentValKey] = $totalImagePath;
00648             $imgObjNum = intval($splitArr[$a]['imgObjNum']);
00649             $imgConf = $conf[$imgObjNum.'.'];
00650 
00651             if ($equalHeight)   {
00652                 
00653                 if ($a % $colCount == 0) {
00654                         // a new row startsS
00655                     $accumWidth = 0; // reset accumulated net width
00656                     $accumDesiredWidth = 0; // reset accumulated desired width
00657                     $rowTotalMaxW = $relations_cols[$rowIdx];
00658                     if ($rowTotalMaxW > $netW)  {
00659                         $scale = $rowTotalMaxW / $netW;
00660                     } else {
00661                         $scale = 1;
00662                     }
00663                     $desiredHeight = $equalHeight / $scale;
00664                     $rowIdx++;
00665                 }
00666                 
00667                 $availableWidth= $netW - $accumWidth; // this much width is available for the remaining images in this row (int)
00668                 $desiredWidth= $imgWidths[$a] / $scale; // theoretical width of resized image. (float)
00669                 $accumDesiredWidth += $desiredWidth; // add this width. $accumDesiredWidth becomes the desired horizontal position 
00670                     // calculate width by comparing actual and desired horizontal position.
00671                     // this evenly distributes rounding errors across all images in this row. 
00672                 $suggestedWidth = round($accumDesiredWidth - $accumWidth);
00673                 $finalImgWidth = (int) min($availableWidth, $suggestedWidth); // finalImgWidth may not exceed $availableWidth
00674                 $accumWidth += $finalImgWidth;
00675                 $imgConf['file.']['width'] = $finalImgWidth;
00676                 $imgConf['file.']['height'] = round($desiredHeight);
00677 
00678                     // other stuff will be calculated accordingly:
00679                 unset($imgConf['file.']['maxW']);
00680                 unset($imgConf['file.']['maxH']);
00681                 unset($imgConf['file.']['minW']);
00682                 unset($imgConf['file.']['minH']);
00683                 unset($imgConf['file.']['width.']);
00684                 unset($imgConf['file.']['maxW.']);
00685                 unset($imgConf['file.']['maxH.']);
00686                 unset($imgConf['file.']['minW.']);
00687                 unset($imgConf['file.']['minH.']);
00688             } else {
00689                 $imgConf['file.']['maxW'] = $columnWidths[($a%$colCount)];
00690             }
00691 
00692             $titleInLink = $this->cObj->stdWrap($imgConf['titleInLink'], $imgConf['titleInLink.']);
00693             $titleInLinkAndImg = $this->cObj->stdWrap($imgConf['titleInLinkAndImg'], $imgConf['titleInLinkAndImg.']);
00694             $oldATagParms = $GLOBALS['TSFE']->ATagParams;
00695             if ($titleInLink)   {
00696                     // Title in A-tag instead of IMG-tag
00697                 $titleText = trim($this->cObj->stdWrap($imgConf['titleText'], $imgConf['titleText.']));
00698                 if ($titleText) {
00699                         // This will be used by the IMAGE call later:
00700                     $GLOBALS['TSFE']->ATagParams .= ' title="'. $titleText .'"';
00701                 }
00702             }
00703 
00704             if ($imgConf || $imgConf['file'])   {
00705                 if ($this->cObj->image_effects[$image_effects]) {
00706                     $imgConf['file.']['params'] .= ' '.$this->cObj->image_effects[$image_effects];
00707                 }
00708                 if ($image_frames)  {
00709                     if (is_array($conf['image_frames.'][$image_frames.'.']))    {
00710                         $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.'];
00711                     }
00712                 }
00713                 if ($image_compression && $imgConf['file'] != 'GIFBUILDER') {
00714                     if ($image_compression == 1)    {
00715                         $tempImport = $imgConf['file.']['import'];
00716                         $tempImport_dot = $imgConf['file.']['import.'];
00717                         unset($imgConf['file.']);
00718                         $imgConf['file.']['import'] = $tempImport;
00719                         $imgConf['file.']['import.'] = $tempImport_dot;
00720                     } elseif (isset($this->cObj->image_compression[$image_compression])) {
00721                         $imgConf['file.']['params'] .= ' '.$this->cObj->image_compression[$image_compression]['params'];
00722                         $imgConf['file.']['ext'] = $this->cObj->image_compression[$image_compression]['ext'];
00723                         unset($imgConf['file.']['ext.']);
00724                     }
00725                 }
00726                 if ($titleInLink && ! $titleInLinkAndImg)   {
00727                         // Check if the image will be linked
00728                     $link = $this->cObj->imageLinkWrap('', $totalImagePath, $imgConf['imageLinkWrap.']);
00729                     if ($link)  {
00730                             // Title in A-tag only (set above: ATagParams), not in IMG-tag
00731                         unset($imgConf['titleText']);
00732                         unset($imgConf['titleText.']);
00733                         $imgConf['emptyTitleHandling'] = 'removeAttr';
00734                     }
00735                 }
00736                 $imgsTag[$imgKey] = $this->cObj->IMAGE($imgConf);
00737             } else {
00738                 $imgsTag[$imgKey] = $this->cObj->IMAGE(Array('file' => $totalImagePath));   // currentValKey !!!
00739             }
00740                 // Restore our ATagParams
00741             $GLOBALS['TSFE']->ATagParams = $oldATagParms;
00742                 // Store the original filepath
00743             $origImages[$imgKey] = $GLOBALS['TSFE']->lastImageInfo;
00744 
00745             if ($GLOBALS['TSFE']->lastImageInfo[0]==0) {
00746                 $imageRowsFinalWidths[floor($a/$colCount)] += $this->cObj->data['imagewidth'];
00747             } else {
00748                 $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0];
00749             }
00750 
00751         }
00752             // How much space will the image-block occupy?
00753         $imageBlockWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*($borderSpace+$borderThickness)*2;
00754         $GLOBALS['TSFE']->register['rowwidth'] = $imageBlockWidth;
00755         $GLOBALS['TSFE']->register['rowWidthPlusTextMargin'] = $imageBlockWidth + $textMargin;
00756 
00757             // noRows is in fact just one ROW, with the amount of columns specified, where the images are placed in.
00758             // noCols is just one COLUMN, each images placed side by side on each row
00759         $noRows = $this->cObj->stdWrap($conf['noRows'],$conf['noRows.']);
00760         $noCols = $this->cObj->stdWrap($conf['noCols'],$conf['noCols.']);
00761         if ($noRows) {$noCols=0;}   // noRows overrides noCols. They cannot exist at the same time.
00762 
00763         $rowCount_temp = 1;
00764         $colCount_temp = $colCount;
00765         if ($noRows)    {
00766             $rowCount_temp = $rowCount;
00767             $rowCount = 1;
00768         }
00769         if ($noCols)    {
00770             $colCount = 1;
00771             $columnWidths = array();
00772         }
00773 
00774             // Edit icons:
00775         if (!is_array($conf['editIcons.'])) {
00776             $conf['editIcons.'] = array();
00777         }
00778         $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->cObj->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';
00779 
00780             // If noRows, we need multiple imagecolumn wraps
00781         $imageWrapCols = 1;
00782         if ($noRows)    { $imageWrapCols = $colCount; }
00783 
00784             // User wants to separate the rows, but only do that if we do have rows
00785         $separateRows = $this->cObj->stdWrap($conf['separateRows'], $conf['separateRows.']);
00786         if ($noRows)    { $separateRows = 0; }
00787         if ($rowCount == 1) { $separateRows = 0; }
00788 
00789             // Apply optionSplit to the list of classes that we want to add to each image
00790         $addClassesImage = $conf['addClassesImage'];
00791         if ($conf['addClassesImage.'])  {
00792             $addClassesImage = $this->cObj->stdWrap($addClassesImage, $conf['addClassesImage.']);
00793         }
00794         $addClassesImageConf = $GLOBALS['TSFE']->tmpl->splitConfArray(array('addClassesImage' => $addClassesImage), $colCount);
00795 
00796             // Render the images
00797         $images = '';
00798         for ($c = 0; $c < $imageWrapCols; $c++) {
00799             $tmpColspacing = $colspacing;
00800             if (($c==$imageWrapCols-1 && $imagePosition==2) || ($c==0 && ($imagePosition==1||$imagePosition==0))) {
00801                     // Do not add spacing after column if we are first column (left) or last column (center/right)
00802                 $tmpColspacing = 0;
00803             }
00804 
00805             $thisImages = '';
00806             $allRows = '';
00807             $maxImageSpace = 0;
00808             for ($i = $c; $i<count($imgsTag); $i=$i+$imageWrapCols) {
00809                 $imgKey = $i+$imgStart;
00810                 $colPos = $i%$colCount;
00811                 if ($separateRows && $colPos == 0) {
00812                     $thisRow = '';
00813                 }
00814 
00815                     // Render one image
00816                 if($origImages[$imgKey][0]==0) {
00817                     $imageSpace=$this->cObj->data['imagewidth'] + $border*($borderSpace+$borderThickness)*2;
00818                 } else {
00819                     $imageSpace = $origImages[$imgKey][0] + $border*($borderSpace+$borderThickness)*2;
00820                 }
00821 
00822                 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgKey;
00823                 $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgKey;
00824                 $GLOBALS['TSFE']->register['ORIG_FILENAME'] = $origImages[$imgKey]['origFile'];
00825                 $GLOBALS['TSFE']->register['imagewidth'] = $origImages[$imgKey][0];
00826                 $GLOBALS['TSFE']->register['imagespace'] = $imageSpace;
00827                 $GLOBALS['TSFE']->register['imageheight'] = $origImages[$imgKey][1];
00828                 if ($imageSpace > $maxImageSpace)   {
00829                     $maxImageSpace = $imageSpace;
00830                 }
00831                 $thisImage = '';
00832                 $thisImage .= $this->cObj->stdWrap($imgsTag[$imgKey], $conf['imgTagStdWrap.']);
00833 
00834                 if (!$renderGlobalCaption)  {
00835                     $thisImage .= $this->cObj->stdWrap($this->cObj->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
00836                 }
00837                 if ($editIconsHTML) {
00838                     $thisImage .= $this->cObj->stdWrap($editIconsHTML, $conf['editIconsStdWrap.']);
00839                 }
00840                 $thisImage = $this->cObj->stdWrap($thisImage, $conf['oneImageStdWrap.']);
00841                 $classes = '';
00842                 if ($addClassesImageConf[$colPos]['addClassesImage'])   {
00843                     $classes = ' ' . $addClassesImageConf[$colPos]['addClassesImage'];
00844                 }
00845                 $thisImage = str_replace('###CLASSES###', $classes, $thisImage);
00846 
00847                 if ($separateRows)  {
00848                     $thisRow .= $thisImage;
00849                 } else {
00850                     $allRows .= $thisImage;
00851                 }
00852                 $GLOBALS['TSFE']->register['columnwidth'] = $maxImageSpace + $tmpColspacing;
00853 
00854 
00855                     // Close this row at the end (colCount), or the last row at the final end
00856                 if ($separateRows && ($i+1 == count($imgsTag))) {
00857                         // Close the very last row with either normal configuration or lastRow stdWrap
00858                     $allRows .= $this->cObj->stdWrap($thisRow, (is_array($conf['imageLastRowStdWrap.']) ? $conf['imageLastRowStdWrap.'] : $conf['imageRowStdWrap.']));
00859                 } elseif ($separateRows && $colPos == $colCount-1)  {
00860                     $allRows .= $this->cObj->stdWrap($thisRow, $conf['imageRowStdWrap.']);
00861                 }
00862             }
00863             if ($separateRows)  {
00864                 $thisImages .= $allRows;
00865             } else {
00866                 $thisImages .= $this->cObj->stdWrap($allRows, $conf['noRowsStdWrap.']);
00867             }
00868             if ($noRows)    {
00869                     // Only needed to make columns, rather than rows:
00870                 $images .= $this->cObj->stdWrap($thisImages, $conf['imageColumnStdWrap.']);
00871             } else {
00872                 $images .= $thisImages;
00873             }
00874         }
00875 
00876             // Add the global caption, if not split
00877         if ($globalCaption) {
00878             $images .= $globalCaption;
00879         }
00880 
00881             // CSS-classes
00882         $captionClass = '';
00883         $classCaptionAlign = array(
00884             'center' => 'csc-textpic-caption-c',
00885             'right' => 'csc-textpic-caption-r',
00886             'left' => 'csc-textpic-caption-l',
00887         );
00888         $captionAlign = $this->cObj->stdWrap($conf['captionAlign'], $conf['captionAlign.']);
00889         if ($captionAlign)  {
00890             $captionClass = $classCaptionAlign[$captionAlign];
00891         }
00892         $borderClass = '';
00893         if ($border)    {
00894             $borderClass = $conf['borderClass'] ? $conf['borderClass'] : 'csc-textpic-border';
00895         }
00896 
00897             // Multiple classes with all properties, to be styled in CSS
00898         $class = '';
00899         $class .= ($borderClass? ' '.$borderClass:'');
00900         $class .= ($captionClass? ' '.$captionClass:'');
00901         $class .= ($equalHeight? ' csc-textpic-equalheight':'');
00902         $addClasses = $this->cObj->stdWrap($conf['addClasses'], $conf['addClasses.']);
00903         $class .= ($addClasses ? ' '.$addClasses:'');
00904 
00905             // Do we need a width in our wrap around images?
00906         $imgWrapWidth = '';
00907         if ($position == 0 || $position == 8)   {
00908                 // For 'center' we always need a width: without one, the margin:auto trick won't work
00909             $imgWrapWidth = $imageBlockWidth;
00910         }
00911         if ($rowCount > 1)  {
00912                 // For multiple rows we also need a width, so that the images will wrap
00913             $imgWrapWidth = $imageBlockWidth;
00914         }
00915         if ($caption)   {
00916                 // If we have a global caption, we need the width so that the caption will wrap
00917             $imgWrapWidth = $imageBlockWidth;
00918         }
00919 
00920             // Wrap around the whole image block
00921         $GLOBALS['TSFE']->register['totalwidth'] = $imgWrapWidth;
00922         if ($imgWrapWidth)  {
00923             $images = $this->cObj->stdWrap($images, $conf['imageStdWrap.']);
00924         } else {
00925             $images = $this->cObj->stdWrap($images, $conf['imageStdWrapNoWidth.']);
00926         }
00927 
00928         $output = $this->cObj->cObjGetSingle($conf['layout'], $conf['layout.']);
00929         $output = str_replace('###TEXT###', $content, $output);
00930         $output = str_replace('###IMAGES###', $images, $output);
00931         $output = str_replace('###CLASSES###', $class, $output);
00932 
00933         if ($conf['stdWrap.'])  {
00934             $output = $this->cObj->stdWrap($output, $conf['stdWrap.']);
00935         }
00936 
00937         return $output;
00938     }
00939 
00940 
00941 
00942 
00943 
00944 
00945 
00946 
00947 
00948 
00949 
00950 
00951     /************************************
00952      *
00953      * Helper functions
00954      *
00955      ************************************/
00956 
00957     /**
00958      * Returns a link text string which replaces underscores in filename with
00959      * blanks.
00960      *
00961      * Has the possibility to cut off FileType.
00962 
00963      * @param array $links
00964      *        array with [0] linked file icon, [1] text link
00965      * @param string $fileName
00966      *        the name of the file to be linked (without path)
00967      * @param boolean $useSpaces
00968      *        whether underscores in the file name should be replaced with spaces
00969      * @param boolean $cutFileExtension
00970      *        whether the file extension should be removed
00971      *
00972      * @return array modified array with new link text
00973      */
00974     protected function beautifyFileLink(
00975         array $links, $fileName, $useSpaces = FALSE, $cutFileExtension = FALSE
00976     ) {
00977         $linkText = $fileName;
00978         if ($useSpaces) {
00979             $linkText = str_replace('_', ' ', $linkText);
00980         }
00981         if ($cutFileExtension) {
00982             $pos = strrpos($linkText, '.');
00983             $linkText = substr($linkText, 0, $pos);
00984         }
00985         $links[1] = str_replace(
00986             '>' . $fileName . '<', '>' . $linkText . '<', $links[1]
00987         );
00988         return $links;
00989     }
00990 
00991     /**
00992      * Returns table attributes for uploads / tables.
00993      *
00994      * @param   array       TypoScript configuration array
00995      * @param   integer     The "layout" type
00996      * @return  array       Array with attributes inside.
00997      */
00998     function getTableAttributes($conf,$type)    {
00999 
01000             // Initializing:
01001         $tableTagParams_conf = $conf['tableParams_'.$type.'.'];
01002 
01003         $conf['color.'][200] = '';
01004         $conf['color.'][240] = 'black';
01005         $conf['color.'][241] = 'white';
01006         $conf['color.'][242] = '#333333';
01007         $conf['color.'][243] = 'gray';
01008         $conf['color.'][244] = 'silver';
01009 
01010             // Create table attributes array:
01011         $tableTagParams = array();
01012         $tableTagParams['border'] =  $this->cObj->data['table_border'] ? intval($this->cObj->data['table_border']) : $tableTagParams_conf['border'];
01013         $tableTagParams['cellspacing'] =  $this->cObj->data['table_cellspacing'] ? intval($this->cObj->data['table_cellspacing']) : $tableTagParams_conf['cellspacing'];
01014         $tableTagParams['cellpadding'] =  $this->cObj->data['table_cellpadding'] ? intval($this->cObj->data['table_cellpadding']) : $tableTagParams_conf['cellpadding'];
01015         $tableTagParams['bgcolor'] =  isset($conf['color.'][$this->cObj->data['table_bgColor']]) ? $conf['color.'][$this->cObj->data['table_bgColor']] : $conf['color.']['default'];
01016 
01017             // Return result:
01018         return $tableTagParams;
01019     }
01020 
01021     /**
01022      * Returns an object reference to the hook object if any
01023      *
01024      * @param   string      Name of the function you want to call / hook key
01025      * @return  object      Hook object, if any. Otherwise null.
01026      */
01027     function hookRequest($functionName) {
01028         global $TYPO3_CONF_VARS;
01029 
01030             // Hook: menuConfig_preProcessModMenu
01031         if ($TYPO3_CONF_VARS['EXTCONF']['css_styled_content']['pi1_hooks'][$functionName]) {
01032             $hookObj = t3lib_div::getUserObj($TYPO3_CONF_VARS['EXTCONF']['css_styled_content']['pi1_hooks'][$functionName]);
01033             if (method_exists ($hookObj, $functionName)) {
01034                 $hookObj->pObj = $this;
01035                 return $hookObj;
01036             }
01037         }
01038     }
01039 }
01040 
01041 
01042 
01043 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php'])) {
01044     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']);
01045 }
01046 
01047 ?>