Changeset 12920 for trunk/include/template.class.php
- Timestamp:
- Jan 17, 2012, 10:58:18 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/template.class.php
r12908 r12920 23 23 24 24 25 require_once(PHPWG_ROOT_PATH.'include/smarty/libs/Smarty.class.php');26 27 28 25 class Template { 29 26 … … 43 40 // used by html_head smarty block to add content before </head> 44 41 var $html_head_elements = array(); 42 private $html_style = ''; 45 43 46 44 const COMBINED_SCRIPTS_TAG = '<!-- COMBINED_SCRIPTS -->'; … … 113 111 $this->smarty->register_modifier( 'get_extent', array(&$this, 'get_extent') ); 114 112 $this->smarty->register_block('html_head', array(&$this, 'block_html_head') ); 113 $this->smarty->register_block('html_style', array(&$this, 'block_html_style') ); 115 114 $this->smarty->register_function('combine_script', array(&$this, 'func_combine_script') ); 116 115 $this->smarty->register_function('get_combined_scripts', array(&$this, 'func_get_combined_scripts') ); … … 467 466 } 468 467 469 if ( count($this->html_head_elements) )468 if ( count($this->html_head_elements) || strlen($this->html_style) ) 470 469 { 471 470 $search = "\n</head>"; … … 473 472 if ($pos !== false) 474 473 { 475 $this->output = substr_replace( $this->output, "\n".implode( "\n", $this->html_head_elements ), $pos, 0 ); 474 $rep = "\n".implode( "\n", $this->html_head_elements ); 475 if (strlen($this->html_style)) 476 { 477 $rep='<style type="text/css">'.$this->html_style.'</style>'; 478 } 479 $this->output = substr_replace( $this->output, $rep, $pos, 0 ); 476 480 } //else maybe error or warning ? 477 481 $this->html_head_elements = array(); 482 $this->html_style = ''; 478 483 } 479 484 … … 530 535 { // second call 531 536 $this->html_head_elements[] = $content; 537 } 538 } 539 540 function block_html_style($params, $content, &$smarty, &$repeat) 541 { 542 $content = trim($content); 543 if ( !empty($content) ) 544 { // second call 545 $this->html_style .= $content; 532 546 } 533 547 } … … 843 857 return call_user_func_array('sprintf', $args ); 844 858 } 845 859 846 860 function derivative_url($type, $img) 847 861 {
Note: See TracChangeset
for help on using the changeset viewer.