* initial work towards factorizing the controllers (yeah, now it's tsControllerSometh...
[vsc.git] / _res / _libs / tscontrollercss.class.php
blobd85bc7e342ed40f889e4bd5149a0d8e1cde95d9b
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();
19 header('Content-type: text/css');
21 $this->theme = (!empty($_COOKIE['theme']) ? $_COOKIE['theme'] : DEFAULT_THEME);
22 if (!empty($_GET)) {
23 list($this->media) = array_keys($_GET);
24 } else {
25 $this->media = 'screen';
29 if (!is_file(THEME_PATH. $tthis->heme . DIRECTORY_SEPARATOR .'_css'. DIRECTORY_SEPARATOR .$this->media.'.css')) {
30 $this->theme = DEFAULT_THEME;
31 $this->media = 'screen';
36 public function dispatch (){
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 if (stristr ($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
44 $incString = str_replace(array('min-width:', 'max-width:'), 'width:', $incString);
46 echo $incString;