- Timestamp:
- Sep 27, 2009, 10:47:24 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/template.class.php
r3282 r3927 47 47 var $extents = array(); 48 48 49 // Templates prefilter from external sources (plugins) 50 var $external_filters = array(); 51 49 52 // used by html_head smarty block to add content before </head> 50 53 var $html_head_elements = array(); … … 291 294 ((is_adviser()) ? 'disabled="disabled" onclick="return false;"' : '')); 292 295 296 $this->load_external_filters(); 297 293 298 global $conf, $lang_info; 294 299 if ( $conf['compiled_template_cache_language'] and isset($lang_info['code']) ) … … 334 339 $this->html_head_elements = array(); 335 340 } 341 336 342 echo $this->output; 337 343 $this->output=''; … … 420 426 } 421 427 428 /** 429 * This function allows to declare a Smarty prefilter from a plugin, thus allowing 430 * it to modify template source before compilation and without changing core files 431 * They will be processed by weight ascending. 432 * http://www.smarty.net/manual/en/advanced.features.prefilters.php 433 */ 434 function set_external_filter($weight, $callback) 435 { 436 437 if (! is_integer($weight)) return false; 438 $this->external_filters[$weight] = $callback; 439 return ksort($this->external_filters); 440 } 441 442 /** 443 * This function actually triggers the filters on the tpl files. 444 * Called in the parse method. 445 * http://www.smarty.net/manual/en/advanced.features.prefilters.php 446 */ 447 function load_external_filters() 448 { 449 if (! isset($this->external_filters) || ! count($this->external_filters)) return; 450 print_r($this->external_filters ); 451 $test= array(1,2,3); 452 print_r($test); 453 foreach ($this->external_filters as $filter) 454 { 455 $this->smarty->register_prefilter( $filter ); 456 } 457 } 458 422 459 static function prefilter_white_space($source, &$smarty) 423 460 { … … 465 502 } 466 503 } 504 467 505 468 506 /**
Note: See TracChangeset
for help on using the changeset viewer.