function xbbcode_basic_render_list in Extensible BBCode 8.2
Same name and namespace in other branches
- 8 xbbcode_basic/xbbcode_basic.module \xbbcode_basic_render_list()
- 5 xbbcode_basic/xbbcode_basic.module \xbbcode_basic_render_list()
- 6 xbbcode_basic/xbbcode_basic.module \xbbcode_basic_render_list()
- 7 xbbcode_basic/xbbcode_basic.module \xbbcode_basic_render_list()
1 string reference to 'xbbcode_basic_render_list'
- xbbcode_basic_xbbcode_info in xbbcode_basic/
xbbcode_basic.module
File
- xbbcode_basic/
xbbcode_basic.module, line 236
Code
function xbbcode_basic_render_list($tag) {
$items = preg_split('/\\s*\\[\\*\\]\\s*/', trim($tag->content));
// The first [*] is not a delimiter.
array_shift($items);
$text = '<li>' . implode('</li><li>', $items) . '</li>';
$style = '';
// "n" renders an <ol> element and is usually equivalent to "numeric".
if ($tag->option == 'n') {
$element = 'ol';
}
else {
// The list style type overrides the element, so <ul> may safely be used.
$element = 'ul';
if (preg_match('/^[a-z-]*$/', $tag->option, $match)) {
$style = ' style="list-style-type:' . $match[0] . '"';
}
}
return "<{$element}{$style}>{$text}</{$element}>";
}