Line 128 | Line 128 |
---|
*/ function bbcode_cache_init() {
|
*/ function bbcode_cache_init() {
|
global $user, $phpbb_root_path;
| global $phpbb_root_path, $template, $user;
|
if (empty($this->template_filename)) { $this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']); $this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html';
|
if (empty($this->template_filename)) { $this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']); $this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html';
|
| if (empty($user->theme['template_inherits_id']) && !empty($template->orig_tpl_inherits_id)) { $user->theme['template_inherits_id'] = $template->orig_tpl_inherits_id; }
|
if (!@file_exists($this->template_filename)) {
| if (!@file_exists($this->template_filename)) {
|
Line 265 | Line 270 |
---|
case 6: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array(
|
case 6: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array(
|
'!\[color=(#[0-9a-f]{6}|[a-z\-]+):$uid\](.*?)\[/color:$uid\]!is' => $this->bbcode_tpl('color', $bbcode_id),
| '!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+):$uid\](.*?)\[/color:$uid\]!is' => $this->bbcode_tpl('color', $bbcode_id),
|
) ); break;
| ) ); break;
|
Line 360 | Line 365 |
---|
// In order to use templates with custom bbcodes we need // to replace all {VARS} to corresponding backreferences // Note that backreferences are numbered from bbcode_match
|
// In order to use templates with custom bbcodes we need // to replace all {VARS} to corresponding backreferences // Note that backreferences are numbered from bbcode_match
|
if (preg_match_all('/\{(URL|LOCAL_URL|EMAIL|TEXT|SIMPLETEXT|IDENTIFIER|COLOR|NUMBER)[0-9]*\}/', $rowset[$bbcode_id]['bbcode_match'], $m))
| if (preg_match_all('/\{(URL|LOCAL_URL|EMAIL|TEXT|SIMPLETEXT|INTTEXT|IDENTIFIER|COLOR|NUMBER)[0-9]*\}/', $rowset[$bbcode_id]['bbcode_match'], $m))
|
{ foreach ($m[0] as $i => $tok) {
| { foreach ($m[0] as $i => $tok) {
|
Line 376 | Line 381 |
---|
}
// Replace {L_*} lang strings
|
}
// Replace {L_*} lang strings
|
$bbcode_tpl = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $bbcode_tpl);
| $bbcode_tpl = preg_replace('/{L_([A-Z0-9_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $bbcode_tpl);
|
if (!empty($rowset[$bbcode_id]['second_pass_replace'])) {
| if (!empty($rowset[$bbcode_id]['second_pass_replace'])) {
|
Line 480 | Line 485 |
---|
'email' => array('{EMAIL}' => '$1', '{DESCRIPTION}' => '$2') );
|
'email' => array('{EMAIL}' => '$1', '{DESCRIPTION}' => '$2') );
|
$tpl = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $tpl);
| $tpl = preg_replace('/{L_([A-Z0-9_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $tpl);
|
if (!empty($replacements[$tpl_name])) {
| if (!empty($replacements[$tpl_name])) {
|
Line 528 | Line 533 |
---|
else if (is_numeric($type)) { $tpl = 'olist_open';
|
else if (is_numeric($type)) { $tpl = 'olist_open';
|
$type = 'arabic-numbers';
| $type = 'decimal';
|
} else { $tpl = 'olist_open';
|
} else { $tpl = 'olist_open';
|
$type = 'arabic-numbers';
| $type = 'decimal';
|
}
return str_replace('{LIST_TYPE}', $type, $this->bbcode_tpl($tpl));
| }
return str_replace('{LIST_TYPE}', $type, $this->bbcode_tpl($tpl));
|
Line 584 | Line 589 |
---|
$code = str_replace("\t", ' ', $code); $code = str_replace(' ', ' ', $code); $code = str_replace(' ', ' ', $code);
|
$code = str_replace("\t", ' ', $code); $code = str_replace(' ', ' ', $code); $code = str_replace(' ', ' ', $code);
|
| $code = str_replace("\n ", "\n ", $code);
// keep space at the beginning if (!empty($code) && $code[0] == ' ') { $code = ' ' . substr($code, 1); }
|
// remove newline at the beginning if (!empty($code) && $code[0] == "\n")
| // remove newline at the beginning if (!empty($code) && $code[0] == "\n")
|