Changeset 2529 for releases/2.1.2/modules/media/controllers/media.php
- Timestamp:
- 04/17/2008 08:35:37 PM (7 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
releases/2.1.2/modules/media/controllers/media.php
r2524 r2529 29 29 parent::__construct(); 30 30 31 $this->separator = Config::item('media.separator') or$this->separator = ',';31 $this->separator = Config::item('media.separator') OR $this->separator = ','; 32 32 33 33 $cache = Config::item('media.cache'); … … 40 40 else 41 41 { 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; 43 43 } 44 44 … … 50 50 $this->pack_css = (bool) Config::item('media.pack_css'); 51 51 $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 57 62 // Find all the individual files 58 63 $files = explode($this->separator, $querystr); 59 64 60 65 $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); 64 69 65 70 if ( ! isset($output) OR empty($output)) … … 77 82 } 78 83 79 ($this->use_cache) and$this->cache->set('media.css.'.$querystr, $data, array('media'), $this->cache_lifetime);80 } 81 82 $mimetype andheader('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); 83 88 echo $output; 84 89 } 85 90 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 88 98 // Find all the individual files 89 99 $files = explode($this->separator, $querystr); 90 100 91 101 $mimetype = Config::item('mimes.js'); 92 $mimetype = (isset($mimetype[0])) ? $mimetype[0] : ' text/javascript';102 $mimetype = (isset($mimetype[0])) ? $mimetype[0] : 'application/x-javascript'; 93 103 94 104 $this->use_cache AND $output = $this->cache->get('media.js.'.$querystr); … … 109 119 } 110 120 111 ($this->use_cache) and$this->cache->set('media.js.'.$querystr, $data, array('media'), $this->cache_lifetime);112 } 113 114 $mimetype andheader('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); 115 125 echo $output; 116 126 } … … 174 184 } 175 185 176 (isset($view)) and$filedata[$filename] = $view->render();186 (isset($view)) AND $filedata[$filename] = $view->render(); 177 187 } 178 188
