- Timestamp:
- Jun 30, 2013, 7:34:55 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/template.class.php
r23588 r23688 108 108 if ( $conf['compiled_template_cache_language'] ) 109 109 { 110 $this->smarty->registerFilter('p re', array('Template', 'prefilter_language') );110 $this->smarty->registerFilter('post', array('Template', 'postfilter_language') ); 111 111 } 112 112 … … 529 529 else 530 530 { 531 $ret .= '( '.$params[0].')>1';531 $ret .= '($tmp=('.$params[0].'))>1'; 532 532 } 533 533 $ret .= '?'; … … 535 535 $ret .= ':'; 536 536 $ret .= self::modcompiler_translate( array($params[1]) ); 537 $ret .= ', '.$params[0];537 $ret .= ',$tmp'; 538 538 $ret .= ')'; 539 539 return $ret; … … 844 844 845 845 /** 846 * Smarty prefilter to allow caching (whenever possible) language strings 847 * from templates. 848 */ 849 static function prefilter_language($source, $smarty) 850 { 851 global $lang; 852 $ldq = preg_quote($smarty->left_delimiter, '~'); 853 $rdq = preg_quote($smarty->right_delimiter, '~'); 854 855 $regex = "~$ldq\'([^'$]+)\'\|@translate *$rdq~"; 856 $source = preg_replace_callback( $regex, create_function('$m', 'global $lang; return isset($lang[$m[1]]) ? $lang[$m[1]] : $m[0];'), $source); 857 846 * Smarty postfilter 847 */ 848 static function postfilter_language($source, $smarty) 849 { 850 // replaces echo PHP_STRING_LITERAL; with the string literal value 851 $source = preg_replace_callback( 852 '/\\<\\?php echo ((?:\'(?:(?:\\\\.)|[^\'])*\')|(?:"(?:(?:\\\\.)|[^"])*"));\\?\\>\\n/', 853 create_function('$matches', 'eval(\'$tmp=\'.$matches[1].\';\');return $tmp;'), 854 $source); 858 855 return $source; 859 856 }
Note: See TracChangeset
for help on using the changeset viewer.