mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-12 18:45:20 +02:00
Added: [/*] tag (list item end tag). Automagically added if needed, in which case it's stored as [/*Ⓜ️$uid]
git-svn-id: file:///svn/phpbb/trunk@4016 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
e2d5fcdda9
commit
1bb83a6760
@ -189,7 +189,7 @@ class parse_message
|
|||||||
// TODO: validation regexp
|
// TODO: validation regexp
|
||||||
11 => array('#\[flash\](.*?)\[/flash\]#i' => '[flash:' . $this->bbcode_uid . ']\1[/flash:' . $this->bbcode_uid . ']'),
|
11 => array('#\[flash\](.*?)\[/flash\]#i' => '[flash:' . $this->bbcode_uid . ']\1[/flash:' . $this->bbcode_uid . ']'),
|
||||||
10 => array('#\[email(=.*?)?\](.*?)\[/email\]#ise' => "\$this->validate_email('\\1', '\\2')"),
|
10 => array('#\[email(=.*?)?\](.*?)\[/email\]#ise' => "\$this->validate_email('\\1', '\\2')"),
|
||||||
9 => array('#\[list(=[a-z|0-1]+)?\].*\[/list\]#ise' => "\$this->bbcode_list('\\0')"),
|
9 => array('#\[list(=[a-z|0-9|(?:disc|circle|square))]+)?\].*\[/list\]#ise' => "\$this->bbcode_list('\\0')"),
|
||||||
7 => array('#\[u\](.*?)\[/u\]#is' => '[u:' . $this->bbcode_uid . ']\1[/u:' . $this->bbcode_uid . ']'),
|
7 => array('#\[u\](.*?)\[/u\]#is' => '[u:' . $this->bbcode_uid . ']\1[/u:' . $this->bbcode_uid . ']'),
|
||||||
6 => array('!\[color=(#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]!is'
|
6 => array('!\[color=(#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]!is'
|
||||||
=> '[color=\1:' . $this->bbcode_uid . ']\2[/color:' . $this->bbcode_uid . ']'),
|
=> '[color=\1:' . $this->bbcode_uid . ']\2[/color:' . $this->bbcode_uid . ']'),
|
||||||
@ -334,7 +334,7 @@ echo "<pre><hr>processing <b>$username</b><hr></pre>";
|
|||||||
$out = '[';
|
$out = '[';
|
||||||
|
|
||||||
$in = substr(stripslashes($in), 1);
|
$in = substr(stripslashes($in), 1);
|
||||||
$close_tags = array();
|
$list_end_tags = $item_end_tags = array();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -356,28 +356,49 @@ echo "<pre><hr>processing <b>$username</b><hr></pre>";
|
|||||||
{
|
{
|
||||||
// if $tok is ']' the buffer holds a tag
|
// if $tok is ']' the buffer holds a tag
|
||||||
|
|
||||||
if ($buffer == '/list' && count($close_tags))
|
if ($buffer == '/list' && count($list_end_tags))
|
||||||
{
|
{
|
||||||
// valid [/list] tag
|
// valid [/list] tag
|
||||||
$tag = array_pop($close_tags);
|
if (count($item_end_tags))
|
||||||
$out .= $tag . ']';
|
{
|
||||||
|
// current li tag has not been closed
|
||||||
|
$out .= array_pop($item_end_tags) . '][';
|
||||||
|
}
|
||||||
|
|
||||||
|
$out .= array_pop($list_end_tags) . ']';
|
||||||
$tok = '[';
|
$tok = '[';
|
||||||
}
|
}
|
||||||
elseif (preg_match('#list(=?(?:[0-9]|[a-z]|))#i', $buffer, $m))
|
elseif (preg_match('#list(=?(?:[0-9]|[a-z]|))#i', $buffer, $m))
|
||||||
{
|
{
|
||||||
// sub-list, add a closing tag
|
// sub-list, add a closing tag
|
||||||
array_push($close_tags, (($m[1]) ? '/list:o:' . $this->bbcode_uid : '/list:u:' . $this->bbcode_uid));
|
array_push($list_end_tags, (($m[1]) ? '/list:o:' . $this->bbcode_uid : '/list:u:' . $this->bbcode_uid));
|
||||||
$out .= $buffer . ':' . $this->bbcode_uid . ']';
|
$out .= $buffer . ':' . $this->bbcode_uid . ']';
|
||||||
$tok = '[';
|
$tok = '[';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($buffer == '*' && count($close_tags))
|
if ($buffer == '*' && count($list_end_tags))
|
||||||
{
|
{
|
||||||
// the buffer holds a bullet tag and we have a [list] tag open
|
// the buffer holds a bullet tag and we have a [list] tag open
|
||||||
|
|
||||||
|
if (count($item_end_tags) >= count($list_end_tags))
|
||||||
|
{
|
||||||
|
// current li tag has not been closed
|
||||||
|
$buffer = array_pop($item_end_tags) . '][*:' . $this->bbcode_uid;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$buffer = '*:' . $this->bbcode_uid;
|
$buffer = '*:' . $this->bbcode_uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$item_end_tags[] = '/*:m:' . $this->bbcode_uid;
|
||||||
|
}
|
||||||
|
elseif ($buffer == '/*')
|
||||||
|
{
|
||||||
|
array_pop($item_end_tags);
|
||||||
|
$buffer = '/*:' . $this->bbcode_uid;
|
||||||
|
}
|
||||||
|
|
||||||
$out .= $buffer . $tok;
|
$out .= $buffer . $tok;
|
||||||
$tok = '[]';
|
$tok = '[]';
|
||||||
}
|
}
|
||||||
@ -393,9 +414,13 @@ echo "<pre><hr>processing <b>$username</b><hr></pre>";
|
|||||||
while ($in);
|
while ($in);
|
||||||
|
|
||||||
// do we have some tags open? close them now
|
// do we have some tags open? close them now
|
||||||
if (count($close_tags))
|
if (count($item_end_tags))
|
||||||
{
|
{
|
||||||
$out .= '[' . implode('][', $close_tags) . ']';
|
$out .= '[' . implode('][', $item_end_tags) . ']';
|
||||||
|
}
|
||||||
|
if (count($list_end_tags))
|
||||||
|
{
|
||||||
|
$out .= '[' . implode('][', $list_end_tags) . ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user