Changeset 23476 for trunk/include
- Timestamp:
- Jun 23, 2013, 8:39:31 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/template.class.php
r23425 r23476 56 56 global $conf, $lang_info; 57 57 58 SmartyException::$escape = false; 59 58 60 $this->scriptLoader = new ScriptLoader; 59 61 $this->smarty = new SmartyBC; … … 92 94 $this->smarty->assign( 'pwg', new PwgTemplateAdapter() ); 93 95 $this->smarty->registerPlugin('modifiercompiler', 'translate', array('Template', 'modcompiler_translate') ); 96 $this->smarty->registerPlugin('modifiercompiler', 'translate_dec', array('Template', 'modcompiler_translate_dec') ); 94 97 $this->smarty->registerPlugin('modifier', 'explode', array('Template', 'mod_explode') ); 95 98 $this->smarty->registerPlugin( 'modifier', 'get_extent', array($this, 'get_extent') ); … … 332 335 function clear_assign($tpl_var) 333 336 { 334 $this->smarty->clear _assign( $tpl_var );337 $this->smarty->clearAssign( $tpl_var ); 335 338 } 336 339 … … 362 365 if ( $conf['compiled_template_cache_language'] and isset($lang_info['code']) ) 363 366 { 364 $this->smarty->compile_id .= ' .'.$lang_info['code'];367 $this->smarty->compile_id .= '_'.$lang_info['code']; 365 368 } 366 369 … … 512 515 } 513 516 return 'l10n('.$params[0].')'; 517 } 518 519 static function modcompiler_translate_dec($params) 520 { 521 global $conf, $lang, $lang_info; 522 if ( $conf['compiled_template_cache_language']) 523 { 524 $ret = 'sprintf('; 525 if ($lang_info['zero_plural']) 526 { 527 $ret .= '($tmp=('.$params[0].'))>1||$tmp==0'; 528 } 529 else 530 { 531 $ret .= '('.$params[0].')>1'; 532 } 533 $ret .= '?'; 534 $ret .= self::modcompiler_translate( array($params[2]) ); 535 $ret .= ':'; 536 $ret .= self::modcompiler_translate( array($params[1]) ); 537 $ret .= ','.$params[0]; 538 $ret .= ')'; 539 return $ret; 540 } 541 return 'l10n_dec('.$params[1].','.$params[2].','.$params[0].')'; 514 542 } 515 543 … … 770 798 list($type, $callback) = $filter; 771 799 $compile_id .= $type.( is_array($callback) ? implode('', $callback) : $callback ); 772 call_user_func(array($this->smarty, 'register_'.$type), $callback);800 $this->smarty->registerFilter($type, $callback); 773 801 } 774 802 } … … 786 814 { 787 815 list($type, $callback) = $filter; 788 call_user_func(array($this->smarty, 'unregister_'.$type), $callback);816 $this->smarty->unregisterFilter($type, $callback); 789 817 } 790 818 }
Note: See TracChangeset
for help on using the changeset viewer.