Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-232

Error while using L_ strings in custom BBCode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • None
    • 3.0.x
    • Posting
    • None
    • PHP Environment:
      Database:

      The Custom BBCode Admin Screen:

      In addition to these tokens you can use any of lang string present in your language/ directory like this:

      Unknown macro: {L_<stringname>}

      where <stringname> is the name of the translated string you want to add. For example,

      Unknown macro: {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:

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

      Replace with

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

      Thanks.

            Acyd Burn Meik Sievertsen [X] (Inactive)
            pentapenguin pentapenguin [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: