Bug tracker

This ticket has been moved to our new tracker. Open Ticket PHPBB3-232 now.

Error while using L_ strings in custom BBCode (fix completed in vcs)

The Custom BBCode Admin Screen wrote:In addition to these tokens you can use any of lang string present in your language/ directory like this: {L_<stringname>} where <stringname> is the name of the translated string you want to add. For example, {L_WROTE} will be displayed as "wrote" or its translation according to user's locale

If you use for example {L_FONT_COLOR} you get this error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in olympus/includes/bbcode.php(295) : regexp code on line 1

Fatal error: preg_replace(): Failed evaluating code: (!empty($user->lang['FONT_COLOR'])) ? $user->lang['FONT_COLOR'] : ucwords(strtolower(str_replace'_', ' ', 'FONT_COLOR'))) in olympus/includes/bbcode.php on line 295

This error is due to a typo (missing opening parenthesis mark) in includes/bbcode.php
Find:
Code: Select all
$bbcode_tpl = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace'_', ' ', '\$1')))", $bbcode_tpl);

Replace with
Code: Select all
$bbcode_tpl = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $bbcode_tpl);


Thanks.

Comments / History

Linked ticket with changeset: r5737

Action performed by Anonymous (I am too lazy to register) on Mar 27th 2006, 21:32

Ticket details

Related SVN changesets