I found good suggestions online for doing that, so, I searched for every occurance of /e modifier and did the suggested replacement. For example, in file includes/bbcode.php, around line 379,
Code: Select all
// 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_callback(
'/{L_([A-Z_]+)}/',
function($matches){
foreach($matches as $match)
return (!empty($user->lang[$match])) ? $user->lang[$match] : ucwords(strtolower(str_replace('_', ' ', $match)));
},
$bbcode_tpl
);
There is, unfortunately one place where the replacement is not literal. It's in the same file, bbcode.php, around line 113,
Code: Select all
$message = preg_replace($preg['search'], $preg['replace'], $message);
$preg = array('search' => array(), 'replace' => array());
How do I write a workaround for $preg['replace'] when I have no idea what the replacement may be?
All help is appreciated.
P.S. I tried commenting out that $message line and it resulted in no errors or notices but all BBCodes are no longer expanded