Changeset 2529

Show
Ignore:
Timestamp:
04/17/2008 08:35:37 PM (6 months ago)
Author:
JAAulde
Message:

merged r2528 from trunk to releases/2.1.2

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • releases/2.1.2/modules/media/controllers/media.php

    r2524 r2529  
    2929                parent::__construct(); 
    3030 
    31                 $this->separator = Config::item('media.separator') or $this->separator = ','; 
     31                $this->separator = Config::item('media.separator') OR $this->separator = ','; 
    3232 
    3333                $cache = Config::item('media.cache'); 
     
    4040                else 
    4141                { 
    42                         $this->cache_lifetime = Config::item('cache.lifetime') or $this->cache_lifetime = 1800; 
     42                        $this->cache_lifetime = Config::item('cache.lifetime') OR $this->cache_lifetime = 1800; 
    4343                } 
    4444 
     
    5050                $this->pack_css = (bool) Config::item('media.pack_css'); 
    5151                $this->pack_js = Config::item('media.pack_js'); 
    52                 ($this->pack_js === TRUE) and $this->pack_js = 'Normal'; 
    53         } 
    54  
    55         public function css($querystr) 
    56         { 
     52                ($this->pack_js === TRUE) AND $this->pack_js = 'Normal'; 
     53        } 
     54 
     55        public function css($querystr = FALSE) 
     56        { 
     57                if( ! is_string($querystr)) 
     58                { 
     59                        $querystr = implode('/', $this->uri->argument_array()); 
     60                } 
     61                 
    5762                // Find all the individual files 
    5863                $files = explode($this->separator, $querystr); 
    5964 
    6065                $mimetype = Config::item('mimes.css'); 
    61                 $mimetype = (isset($mimetype[0])) ? $mimetype[0] : 'text/stylesheet'; 
    62  
    63                 $this->use_cache and $output = $this->cache->get('media.css.'.$querystr); 
     66                $mimetype = (isset($mimetype[0])) ? $mimetype[0] : 'text/css'; 
     67 
     68                $this->use_cache AND $output = $this->cache->get('media.css.'.$querystr); 
    6469 
    6570                if ( ! isset($output) OR empty($output)) 
     
    7782                        } 
    7883 
    79                         ($this->use_cache) and $this->cache->set('media.css.'.$querystr, $data, array('media'), $this->cache_lifetime); 
    80                 } 
    81  
    82                 $mimetype and header('Content-type: '.$mimetype); 
     84                        ($this->use_cache) AND $this->cache->set('media.css.'.$querystr, $data, array('media'), $this->cache_lifetime); 
     85                } 
     86 
     87                $mimetype AND header('Content-type: '.$mimetype); 
    8388                echo $output; 
    8489        } 
    8590 
    86         public function js($querystr) 
    87         { 
     91        public function js($querystr = FALSE) 
     92        { 
     93                if( ! is_string($querystr)) 
     94                { 
     95                        $querystr = implode('/', $this->uri->argument_array()); 
     96                } 
     97                 
    8898                // Find all the individual files 
    8999                $files = explode($this->separator, $querystr); 
    90100 
    91101                $mimetype = Config::item('mimes.js'); 
    92                 $mimetype = (isset($mimetype[0])) ? $mimetype[0] : 'text/javascript'; 
     102                $mimetype = (isset($mimetype[0])) ? $mimetype[0] : 'application/x-javascript'; 
    93103 
    94104                $this->use_cache AND $output = $this->cache->get('media.js.'.$querystr); 
     
    109119                        } 
    110120 
    111                         ($this->use_cache) and $this->cache->set('media.js.'.$querystr, $data, array('media'), $this->cache_lifetime); 
    112                 } 
    113  
    114                 $mimetype and header('Content-type: '.$mimetype); 
     121                        ($this->use_cache) AND $this->cache->set('media.js.'.$querystr, $data, array('media'), $this->cache_lifetime); 
     122                } 
     123 
     124                $mimetype AND header('Content-type: '.$mimetype); 
    115125                echo $output; 
    116126        } 
     
    174184                        } 
    175185 
    176                         (isset($view)) and $filedata[$filename] = $view->render(); 
     186                        (isset($view)) AND $filedata[$filename] = $view->render(); 
    177187                } 
    178188