mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-15 20:17:36 +02:00
[ticket/13832] Use preg_replace_callback instead of /e modifier
PHPBB3-13832
This commit is contained in:
parent
c967ba7b9b
commit
71f5c9c327
@ -491,7 +491,9 @@ class acp_bbcodes
|
|||||||
if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))
|
if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))
|
||||||
{
|
{
|
||||||
$repad = $pad + sizeof(array_unique($repad[0]));
|
$repad = $pad + sizeof(array_unique($repad[0]));
|
||||||
$replace = preg_replace('/(?<!\\\\)\$([0-9]+)/e', "'\${' . (\$1 + \$pad) . '}'", $replace);
|
$replace = preg_replace_callback('/(?<!\\\\)\$([0-9]+)/', function ($match) use ($pad) {
|
||||||
|
return '${' . ($match[1] + $pad) . '}';
|
||||||
|
}, $replace);
|
||||||
$pad = $repad;
|
$pad = $repad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +385,16 @@ class bbcode
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replace {L_*} lang strings
|
// Replace {L_*} lang strings
|
||||||
$bbcode_tpl = preg_replace('/{L_([A-Z0-9_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $bbcode_tpl);
|
$bbcode_tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) {
|
||||||
|
if (!empty($user->lang[$match['1']]))
|
||||||
|
{
|
||||||
|
return $user->lang[$match['1']];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ucwords(strtolower(str_replace('_', ' ', $match['1'])));
|
||||||
|
}
|
||||||
|
}, $bbcode_tpl);
|
||||||
|
|
||||||
if (!empty($rowset[$bbcode_id]['second_pass_replace']))
|
if (!empty($rowset[$bbcode_id]['second_pass_replace']))
|
||||||
{
|
{
|
||||||
@ -509,7 +518,16 @@ class bbcode
|
|||||||
'email' => array('{EMAIL}' => '$1', '{DESCRIPTION}' => '$2')
|
'email' => array('{EMAIL}' => '$1', '{DESCRIPTION}' => '$2')
|
||||||
);
|
);
|
||||||
|
|
||||||
$tpl = preg_replace('/{L_([A-Z0-9_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $tpl);
|
$tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) {
|
||||||
|
if (!empty($user->lang[$match['1']]))
|
||||||
|
{
|
||||||
|
return $user->lang[$match['1']];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ucwords(strtolower(str_replace('_', ' ', $match['1'])));
|
||||||
|
}
|
||||||
|
}, $tpl);
|
||||||
|
|
||||||
if (!empty($replacements[$tpl_name]))
|
if (!empty($replacements[$tpl_name]))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user