* various small modifications. image controller will fail gracefully now
[vsc.git] / _res / _libs / tscontrollercss.class.php
blob6926068c9bd2dc285c538ab99f6d358aae46568d
1 <?php
2 /**
3 * @name tsControllerCss
4 * @package CSS output class
5 */
7 class tsControllerCss extends tsController {
8 public $themePath;
10 private $media = 'screen';
12 /**
13 * the constructor that does it all.
14 * starts output buffering, and initializes different things
17 public function __construct(){
18 ob_start();
20 $this->theme = (!empty($_COOKIE['theme']) ? $_COOKIE['theme'] : DEFAULT_THEME);
22 $this->media = tsController::getRequest('do');
24 if (empty($this->media))
25 $this->media = 'screen';
27 if (!is_file(THEME_PATH. $this->theme . DIRECTORY_SEPARATOR .'_css'. DIRECTORY_SEPARATOR .$this->media.'.css')) {
28 $this->theme = DEFAULT_THEME;
29 $this->media = 'screen';
34 public function dispatch (){
35 parent::dispatch ();
36 header('Content-type: text/css');
37 $out = file_get_contents ( THEME_PATH. $this->theme . DIRECTORY_SEPARATOR .'_css'. DIRECTORY_SEPARATOR .$this->media.'.css');
38 $this->postDispatch ( $out );
42 private function postDispatch ($incString){
43 // set expire header.
44 header ('Expires: '.strftime ('%a, %d %m %Y %T GMT', time()+2419200)); // one month
45 if (stristr ($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
46 $incString = str_replace(array('min-width:', 'max-width:'), 'width:', $incString);
48 // echo $incString;
49 echo str_replace (
50 array ('%TIME%','%QUERIES%', '%MEMUSED%'),
51 array (
52 number_format(microtime (true) - $GLOBALS['st'] , 5, ',', '.'),
53 $GLOBALS['qCnt'],
54 number_format(memory_get_usage()/1024, 3, ',', '.')
56 $incString