Added: [/*] tag (list item end tag). Automagically added if needed, in which case it's stored as [/*Ⓜ️$uid]

Added: any {L_*} var in bbcode.html is replaced by its matching $lang string


git-svn-id: file:///svn/phpbb/trunk@4014 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Ludovic Arnaud 2003-05-18 23:26:05 +00:00
parent 9723acc883
commit 4ae5f981b5

View file

@ -214,7 +214,9 @@ class bbcode
'[list:$uid]' => '<ul>', '[list:$uid]' => '<ul>',
'[/list:u:$uid]' => '</ul>', '[/list:u:$uid]' => '</ul>',
'[/list:o:$uid]' => '</ol>', '[/list:o:$uid]' => '</ol>',
'[*:$uid]' => '<li>' '[*:$uid]' => '<li>',
'[/*:$uid]' => '</li>',
'[/*:m:$uid]' => '</li>',
), ),
'preg' => array( 'preg' => array(
'#\[list=(.+?):$uid\]#e' => "\$this->bbcode_ordered_list('\\1')", '#\[list=(.+?):$uid\]#e' => "\$this->bbcode_ordered_list('\\1')",
@ -279,34 +281,56 @@ class bbcode
$this->bbcode_tpl = array(); $this->bbcode_tpl = array();
eval($tpl); eval($tpl);
$this->bbcode_tpl['quote_open'] = str_replace('{L_QUOTE}', $user->lang['QUOTE'], $this->bbcode_tpl['quote_open']); foreach ($this->bbcode_tpl as $key => $val)
$this->bbcode_tpl['quote_username_open'] = str_replace('{L_QUOTE}', $user->lang['QUOTE'], $this->bbcode_tpl['quote_username_open']); {
$this->bbcode_tpl['quote_username_open'] = str_replace('{L_WROTE}', $user->lang['WROTE'], $this->bbcode_tpl['quote_username_open']); $this->bbcode_tpl[$key] = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : ucwords(strtolower('\\1'))", $this->bbcode_tpl[$key]);
}
$this->bbcode_tpl['quote_username_open'] = str_replace('{USERNAME}', '\\1', $this->bbcode_tpl['quote_username_open']); $this->bbcode_tpl['quote_username_open'] = str_replace('{USERNAME}', '\\1', $this->bbcode_tpl['quote_username_open']);
$this->bbcode_tpl['code_open'] = str_replace('{L_CODE}', $user->lang['CODE'], $this->bbcode_tpl['code_open']); $this->bbcode_tpl['flash'] = str_replace('{URL}', '\\1', $this->bbcode_tpl['flash']);
$this->bbcode_tpl['flash'] = str_replace('{URL}', '\1', $this->bbcode_tpl['flash']);
} }
return $this->bbcode_tpl[$tpl_name]; return $this->bbcode_tpl[$tpl_name];
} }
function bbcode_ordered_list($chr) function bbcode_ordered_list($type)
{ {
if (is_numeric($chr)) if ($type == 'i')
{
$start = $chr;
$chr = '1';
}
elseif (strtolower($chr) == 'i')
{ {
$type = 'lower-roman';
$start = 1; $start = 1;
} }
elseif ($type == 'I')
{
$type = 'upper-roman';
$start = 1;
}
elseif (preg_match('#^(disc|circle|square)$#i', $type))
{
$type = strtolower($type);
$start = 1;
}
elseif (preg_match('#^[a-z]$#', $type))
{
$type = 'lower-alpha';
$start = ord($type) - 96;
}
elseif (preg_match('#[A-Z]#', $type))
{
$type = 'upper-alpha';
$start = ord($type) - 64;
}
elseif (is_numeric($type))
{
$type = 'arabic-numbers';
$start = intval($chr);
}
else else
{ {
$start = ord(strtolower($chr)) - 96; $type = 'arabic-numbers';
$chr = 'a'; $start = 1;
} }
return '<ol type="' . $chr . '" start="' . $start . '">'; return '<ol style="list-style-type: ' . $type . '" start="' . $start . '">';
} }
function bbcode_second_pass_code($type, $code) function bbcode_second_pass_code($type, $code)