00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00055 require_once(PATH_tslib.'class.tslib_pibase.php');
00056
00057
00058
00067 class tx_cssstyledcontent_pi1 extends tslib_pibase {
00068
00069
00070 var $prefixId = 'tx_cssstyledcontent_pi1';
00071 var $scriptRelPath = 'pi1/class.tx_cssstyledcontent_pi1.php';
00072 var $extKey = 'css_styled_content';
00073 var $conf = array();
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00095 function render_bullets($content,$conf) {
00096
00097
00098 if ($hookObj = &$this->hookRequest('render_bullets')) {
00099 return $hookObj->render_bullets($content,$conf);
00100 } else {
00101
00102
00103 $content = trim($this->cObj->data['bodytext']);
00104 if (!strcmp($content,'')) return '';
00105
00106
00107 $lines = t3lib_div::trimExplode(chr(10),$content);
00108 while(list($k)=each($lines)) {
00109 $lines[$k]='
00110 <li>'.$this->cObj->stdWrap($lines[$k],$conf['innerStdWrap.']).'</li>';
00111 }
00112
00113
00114 $type = intval($this->cObj->data['layout']);
00115
00116
00117 $out = '
00118 <ul class="csc-bulletlist csc-bulletlist-'.$type.'">'.
00119 implode('',$lines).'
00120 </ul>';
00121
00122
00123 if ($conf['stdWrap.']) {
00124 $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
00125 }
00126
00127
00128 return $out;
00129 }
00130 }
00131
00140 function render_table($content,$conf) {
00141
00142
00143 if ($hookObj = &$this->hookRequest('render_table')) {
00144 return $hookObj->render_table($content,$conf);
00145 } else {
00146
00147
00148 $content = trim($this->cObj->data['bodytext']);
00149 if (!strcmp($content,'')) return '';
00150
00151
00152 $rows = t3lib_div::trimExplode(chr(10),$content);
00153
00154
00155 $cols = t3lib_div::intInRange($this->cObj->data['cols']?$this->cObj->data['cols']:count(explode('|',current($rows))),0,100);
00156
00157
00158 $rCount = count($rows);
00159 foreach($rows as $k => $v) {
00160 $cells = explode('|',$v);
00161 $newCells=array();
00162 for($a=0;$a<$cols;$a++) {
00163 if (!strcmp(trim($cells[$a]),'')) $cells[$a]=' ';
00164 $cellAttribs = ($a>0 && ($cols-1)==$a) ? ' class="td-last"' : ' class="td-'.$a.'"';
00165 $newCells[$a] = '
00166 <td'.$cellAttribs.'><p>'.$this->cObj->stdWrap($cells[$a],$conf['innerStdWrap.']).'</p></td>';
00167 }
00168
00169 $oddEven = $k%2 ? 'tr-odd' : 'tr-even';
00170 $rowAttribs = ($k>0 && ($rCount-1)==$k) ? ' class="'.$oddEven.' tr-last"' : ' class="'.$oddEven.' tr-'.$k.'"';
00171 $rows[$k]='
00172 <tr'.$rowAttribs.'>'.implode('',$newCells).'
00173 </tr>';
00174 }
00175
00176
00177 $type = intval($this->cObj->data['layout']);
00178
00179
00180 $tableTagParams = $this->getTableAttributes($conf,$type);
00181 $tableTagParams['class'] = 'contenttable contenttable-'.$type;
00182
00183
00184 $out = '
00185 <table '.t3lib_div::implodeAttributes($tableTagParams).'>'.
00186 implode('',$rows).'
00187 </table>';
00188
00189
00190 if ($conf['stdWrap.']) {
00191 $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
00192 }
00193
00194
00195 return $out;
00196 }
00197 }
00198
00207 function render_uploads($content,$conf) {
00208
00209
00210 if ($hookObj = &$this->hookRequest('render_uploads')) {
00211 return $hookObj->render_uploads($content,$conf);
00212 } else {
00213
00214 $out = '';
00215
00216
00217 $type = intval($this->cObj->data['layout']);
00218
00219
00220 $lConf=array();
00221 $lConf['override.']['filelist.']['field'] = 'select_key';
00222 $fileList = $this->cObj->stdWrap($this->cObj->data['media'],$lConf);
00223
00224
00225 $fileArray = t3lib_div::trimExplode(',',$fileList,1);
00226
00227
00228 if (count($fileArray)) {
00229
00230
00231 $selectKeyValues = explode('|',$this->cObj->data['select_key']);
00232 $path = trim($selectKeyValues[0]) ? trim($selectKeyValues[0]) : 'uploads/media/';
00233
00234
00235 $descriptions = t3lib_div::trimExplode(chr(10),$this->cObj->data['imagecaption']);
00236
00237
00238 $conf['linkProc.']['path.']['current'] = 1;
00239 $conf['linkProc.']['icon'] = 1;
00240 $conf['linkProc.']['icon.']['wrap'] = ' |
00241 $conf['linkProc.']['icon_link'] = 1;
00242 $conf['linkProc.']['icon_image_ext_list'] = ($type==2 || $type==3) ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] : '';
00243
00244
00245 $filesData = array();
00246 foreach($fileArray as $key => $fileName) {
00247 $absPath = t3lib_div::getFileAbsFileName($path.$fileName);
00248 if (@is_file($absPath)) {
00249 $fI = pathinfo($fileName);
00250 $filesData[$key] = array();
00251
00252 $filesData[$key]['filename'] = $fileName;
00253 $filesData[$key]['path'] = $path;
00254 $filesData[$key]['filesize'] = filesize($absPath);
00255 $filesData[$key]['fileextension'] = strtolower($fI['extension']);
00256 $filesData[$key]['description'] = trim($descriptions[$key]);
00257
00258 $this->cObj->setCurrentVal($path);
00259 $GLOBALS['TSFE']->register['ICON_REL_PATH'] = $path.$fileName;
00260 $filesData[$key]['linkedFilenameParts'] = explode('
00261 }
00262 }
00263
00264
00265 $tRows = array();
00266 foreach($filesData as $key => $fileD) {
00267
00268
00269 $oddEven = $key%2 ? 'tr-odd' : 'tr-even';
00270
00271
00272 $tRows[]='
00273 <tr class="'.$oddEven.'">'.($type>0 ? '
00274 <td class="csc-uploads-icon">
00275 '.$fileD['linkedFilenameParts'][0].'
00276 </td>' : '').'
00277 <td class="csc-uploads-fileName">
00278 <p>'.$fileD['linkedFilenameParts'][1].'</p>'.
00279 ($fileD['description'] ? '
00280 <p class="csc-uploads-description">'.htmlspecialchars($fileD['description']).'</p>' : '').'
00281 </td>'.($this->cObj->data['filelink_size'] ? '
00282 <td class="csc-uploads-fileSize">
00283 <p>'.t3lib_div::formatSize($fileD['filesize']).'</p>
00284 </td>' : '').'
00285 </tr>';
00286 }
00287
00288
00289 $tableTagParams = $this->getTableAttributes($conf,$type);
00290 $tableTagParams['class'] = 'csc-uploads csc-uploads-'.$type;
00291
00292
00293
00294 $out = '
00295 <table '.t3lib_div::implodeAttributes($tableTagParams).'>
00296 '.implode('',$tRows).'
00297 </table>';
00298 }
00299
00300
00301 if ($conf['stdWrap.']) {
00302 $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
00303 }
00304
00305
00306 return $out;
00307 }
00308 }
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00335 function getTableAttributes($conf,$type) {
00336
00337
00338 $tableTagParams_conf = $conf['tableParams_'.$type.'.'];
00339
00340 $conf['color.'][200] = '';
00341 $conf['color.'][240] = 'black';
00342 $conf['color.'][241] = 'white';
00343 $conf['color.'][242] = '#333333';
00344 $conf['color.'][243] = 'gray';
00345 $conf['color.'][244] = 'silver';
00346
00347
00348 $tableTagParams = array();
00349 $tableTagParams['border'] = $this->cObj->data['table_border'] ? intval($this->cObj->data['table_border']) : $tableTagParams_conf['border'];
00350 $tableTagParams['cellspacing'] = $this->cObj->data['table_cellspacing'] ? intval($this->cObj->data['table_cellspacing']) : $tableTagParams_conf['cellspacing'];
00351 $tableTagParams['cellpadding'] = $this->cObj->data['table_cellpadding'] ? intval($this->cObj->data['table_cellpadding']) : $tableTagParams_conf['cellpadding'];
00352 $tableTagParams['bgcolor'] = isset($conf['color.'][$this->cObj->data['table_bgColor']]) ? $conf['color.'][$this->cObj->data['table_bgColor']] : $conf['color.']['default'];
00353
00354
00355 return $tableTagParams;
00356 }
00357
00364 function &hookRequest($functionName) {
00365 global $TYPO3_CONF_VARS;
00366
00367
00368 if ($TYPO3_CONF_VARS['EXTCONF']['css_styled_content']['pi1_hooks'][$functionName]) {
00369 $hookObj = &t3lib_div::getUserObj($TYPO3_CONF_VARS['EXTCONF']['css_styled_content']['pi1_hooks'][$functionName]);
00370 if (method_exists ($hookObj, $functionName)) {
00371 $hookObj->pObj = &$this;
00372 return $hookObj;
00373 }
00374 }
00375 }
00376 }
00377
00378
00379
00380 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']) {
00381 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']);
00382 }
00383 ?>