Bug #17287 » class.tx_cssstyledcontent_pi1-4.1.6.patch
typo3/sysext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php (working copy) | ||
---|---|---|
if ($hookObj = &$this->hookRequest('render_bullets')) {
|
||
return $hookObj->render_bullets($content,$conf);
|
||
} else {
|
||
// Get bodytext field content, returning blank if empty:
|
||
$content = trim($this->cObj->data['bodytext']);
|
||
if (!strcmp($content,'')) return '';
|
||
|
||
// Split into single lines:
|
||
$lines = t3lib_div::trimExplode(chr(10),$content);
|
||
|
||
//How many lines do we have reduced of one, because the array numbering begins with 0
|
||
$linecount = count($lines)-1;
|
||
|
||
//On which level was the previous entry in this List
|
||
$prelevel=0;
|
||
|
||
|
||
while(list($k)=each($lines)) {
|
||
$lines[$k]='
|
||
<li>'.$this->cObj->stdWrap($lines[$k],$conf['innerStdWrap.']).'</li>';
|
||
//On which Level in the Bulletlist are we now
|
||
$level=0;
|
||
while ($lines[$k]{$level} == '|') {
|
||
$level++;
|
||
}
|
||
|
||
$pre = '';
|
||
$post = '';
|
||
|
||
if ($level > $prelevel) {
|
||
//The Level of the current Entry deeper than of the Entry before
|
||
$i = $level;
|
||
$pre.=chr(10);
|
||
while ($i > $prelevel) {
|
||
if ($i == $level && $k != 0) {
|
||
//If we are at the same level like the previous entry, there is already an opening <li> tag (Except this is the very first entry on this bulletlist)
|
||
$pre.='<ul>'.chr(10);
|
||
} else {
|
||
//We have to write the <li> tag self
|
||
$pre.='<li>'.chr(10).'<ul>';
|
||
}
|
||
$i--;
|
||
}
|
||
$pre.='<li>';
|
||
|
||
} elseif ($level < $prelevel) {
|
||
//The Level of the current Entry is on an higher Level than the previous Entry
|
||
$i = $level;
|
||
while ($i < $prelevel) {
|
||
$pre.='</li>'.chr(10).'</ul>';
|
||
$i++;
|
||
}
|
||
$pre.=chr(10);
|
||
$pre.='</li>'.chr(10).'<li>';
|
||
|
||
} else {
|
||
//Entry is on the same level as the entry before.
|
||
//If it is the first Entry we don?t have to close a previous Entry
|
||
if ($k!=0) {
|
||
$pre .= '</li>'.chr(10).'<li>';
|
||
} else {
|
||
$pre .= chr(10).'<li>';
|
||
}
|
||
}
|
||
|
||
//Close all open tags on the last entry
|
||
if ($linecount == $k) {
|
||
$i = 0;
|
||
while ($i < $level) {
|
||
$post.='</li>'.chr(10).'</ul>';
|
||
$i++;
|
||
}
|
||
$post.='</li>';
|
||
}
|
||
|
||
$prelevel = $level;
|
||
|
||
$lines[$k]=$this->cObj->stdWrap($pre.substr($lines[$k],$level).$post,$conf['innerStdWrap.']);
|
||
}
|
||
|
||
// Set header type:
|
||
$type = intval($this->cObj->data['layout']);
|
||
|
||
// Compile list:
|
||
$out = '
|
||
<ul class="csc-bulletlist csc-bulletlist-'.$type.'">'.
|
||
implode('',$lines).'
|
||
</ul>';
|
||
|
||
// Calling stdWrap:
|
||
if ($conf['stdWrap.']) {
|
||
$out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
|
||
}
|
||
// Return value
|
||
return $out;
|
||
}
|
- « Previous
- 1
- 2
- Next »