Changeset 12427 for trunk/include


Ignore:
Timestamp:
Oct 13, 2011, 8:00:53 PM (13 years ago)
Author:
rvelices
Message:

bug 2469 compiled_template_cache_language option does not work properly on some language keys because of double escaping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/template.class.php

    r11753 r12427  
    767767
    768768    $regex = "~$ldq *\'([^'$]+)\'\|@translate *$rdq~";
    769     $source = preg_replace( $regex.'e', 'isset($lang[\'$1\']) ? $lang[\'$1\'] : \'$0\'', $source);
     769    $source = preg_replace_callback( $regex, create_function('$m', 'global $lang; return isset($lang[$m[1]]) ? $lang[$m[1]] : $m[0];'), $source);
    770770
    771771    $regex = "~$ldq *\'([^'$]+)\'\|@translate\|~";
    772     $source = preg_replace( $regex.'e', 'isset($lang[\'$1\']) ? \'{\'.var_export($lang[\'$1\'],true).\'|\' : \'$0\'', $source);
     772    $source = preg_replace_callback( $regex, create_function('$m', 'global $lang; return isset($lang[$m[1]]) ? \'{\'.var_export($lang[$m[1]],true).\'|\' : \'$m[0]\';'), $source);
    773773
    774774    $regex = "~($ldq *assign +var=.+ +value=)\'([^'$]+)\'\|@translate~e";
    775     $source = preg_replace( $regex, 'isset($lang[\'$2\']) ? \'$1\'.var_export($lang[\'$2\'],true) : \'$0\'', $source);
     775    $source = preg_replace_callback( $regex, create_function('$m', 'global $lang; return isset($lang[$m[2]]) ? $m[1].var_export($lang[$m[2]],true) : \'$m[0]\';'), $source);
    776776
    777777    return $source;
Note: See TracChangeset for help on using the changeset viewer.