includes/template.php
changeset 1373 851b91febb85
parent 1364 68c17d935750
equal deleted inserted replaced
1372:947153b432ea 1373:851b91febb85
    58  	* @var string
    58  	* @var string
    59  	*/
    59  	*/
    60 	
    60 	
    61 	var $fading_button = '';
    61 	var $fading_button = '';
    62 	
    62 	
       
    63 	/**
       
    64 	* Context stack. You can save and restore the var set.
       
    65 	* @var array
       
    66 	*/
       
    67 
       
    68 	var $context_stack = array('bool' => array(), 'str' => array(), 'history' => array());
       
    69 	
    63 	function __construct()
    70 	function __construct()
    64 	{
    71 	{
    65 		global $db, $session, $paths, $template, $plugins; // Common objects
    72 		global $db, $session, $paths, $template, $plugins; // Common objects
    66 		global $cache;
    73 		global $cache;
    67 		
    74 		
   114 		$this->named_theme_list[ $this->default_theme ]['css'] = $this->get_theme_css_files($this->default_theme);
   121 		$this->named_theme_list[ $this->default_theme ]['css'] = $this->get_theme_css_files($this->default_theme);
   115 		// Come up with the default style. If the CSS file specified in default_style exists, we're good, just
   122 		// Come up with the default style. If the CSS file specified in default_style exists, we're good, just
   116 		// use that. Otherwise, use the first stylesheet that comes to mind.
   123 		// use that. Otherwise, use the first stylesheet that comes to mind.
   117 		$df_data =& $this->named_theme_list[ $this->default_theme ];
   124 		$df_data =& $this->named_theme_list[ $this->default_theme ];
   118 		$this->default_style = ( in_array($df_data['default_style'], $df_data['css']) ) ? $df_data['default_style'] : $df_data['css'][0];
   125 		$this->default_style = ( in_array($df_data['default_style'], $df_data['css']) ) ? $df_data['default_style'] : $df_data['css'][0];
       
   126 	}
       
   127 	
       
   128 	/**
       
   129 	* Save the current context and start a blank one.
       
   130 	*/
       
   131 	
       
   132 	function context_push()
       
   133 	{
       
   134 		array_push($this->context_stack['str'], $this->tpl_strings);
       
   135 		array_push($this->context_stack['bool'], $this->tpl_bool);
       
   136 		array_push($this->context_stack['history'], $this->vars_assign_history);
       
   137 	}
       
   138 	
       
   139 	function context_pop()
       
   140 	{
       
   141 		$this->tpl_strings = array_pop($this->context_stack['str']);
       
   142 		$this->tpl_bool = array_pop($this->context_stack['bool']);
       
   143 		$this->vars_assign_history = array_pop($this->context_stack['history']);
   119 	}
   144 	}
   120 	
   145 	
   121 	/**
   146 	/**
   122  	* Gets the list of available CSS files (styles) for the specified theme.
   147  	* Gets the list of available CSS files (styles) for the specified theme.
   123  	* @param string Theme ID
   148  	* @param string Theme ID
  1445 			
  1470 			
  1446 			$t = ( $simple ) ? $this->process_template('simple-footer.tpl') : $this->process_template('footer.tpl');
  1471 			$t = ( $simple ) ? $this->process_template('simple-footer.tpl') : $this->process_template('footer.tpl');
  1447 			
  1472 			
  1448 			$f = microtime_float();
  1473 			$f = microtime_float();
  1449 			$f = $f - $_starttime;
  1474 			$f = $f - $_starttime;
  1450 			$f = round($f, 2);
  1475 			$f = sprintf("%.02f", $f);
  1451 			
  1476 			
  1452 			$t_loc = $lang->get('page_msg_stats_gentime_short', array('time' => $f));
  1477 			$t_loc = $lang->get('page_msg_stats_gentime_short', array('time' => $f));
  1453 			$t_loc_long = $lang->get('page_msg_stats_gentime_long', array('time' => $f));
  1478 			$t_loc_long = $lang->get('page_msg_stats_gentime_long', array('time' => $f));
  1454 			$q_loc = '<a href="' . $this->tpl_strings['REPORT_URI'] . '">' . $lang->get('page_msg_stats_sql', array('nq' => $db->num_queries)) . '</a>';
  1479 			$q_loc = '<a href="' . $this->tpl_strings['REPORT_URI'] . '">' . $lang->get('page_msg_stats_sql', array('nq' => $db->num_queries)) . '</a>';
  1455 			$dbg = $t_loc;
  1480 			$dbg = $t_loc;