Jeff PHP framework
0.99
Modular, extensible, OOP, MVC, lightweight php framework designed to ease the programmers in the development of web applications.
|
00001 <?php 00012 require_once('interface.theme.php'); 00013 00031 class theme { 00032 00036 protected $_registry; 00037 00041 protected $_name; 00042 00046 protected $_tpl_name; 00047 00051 protected $_tpl; 00052 00056 protected $_dft_theme = 'default'; 00057 00064 function __construct($theme_name) { 00065 $this->_registry = registry::instance(); 00066 $this->_name = $theme_name; 00067 } 00068 00074 public function name() { 00075 00076 return $this->_name; 00077 00078 } 00079 00085 public function path() { 00086 00087 return ABS_THEMES.DS.$this->_name; 00088 00089 } 00090 00096 public function dftPath() { 00097 00098 return ABS_THEMES.DS.$this->_dft_theme; 00099 00100 } 00101 00107 public function viewPath() { 00108 00109 return ABS_THEMES.DS.$this->_name.DS."view"; 00110 00111 } 00112 00118 public function dftViewPath() { 00119 00120 return ABS_THEMES.DS.$this->_dft_theme.DS."view"; 00121 00122 } 00123 00129 public function cssPath() { 00130 00131 return ABS_THEMES.DS.$this->_name.DS."css"; 00132 00133 } 00134 00140 public function dftCssPath() { 00141 00142 return ABS_THEMES.DS.$this->_dft_theme.DS."css"; 00143 00144 } 00145 00151 public function getTemplate() { 00152 00153 return $this->_tpl; 00154 00155 } 00156 00163 public function setTpl($tpl) { 00164 00165 $this->_tpl_name = $tpl; 00166 00167 if(is_readable($this->path().DS.$tpl.".tpl")) 00168 $tpl_path = $this->path().DS.$tpl.".tpl"; 00169 elseif(is_readable($this->dftPath().DS.$tpl.".tpl")) 00170 $tpl_path = $this->dftPath().DS.$tpl.".tpl"; 00171 else $tpl_path = null; 00172 00173 $this->_tpl = $tpl_path ? new template($tpl_path) : null; 00174 00175 } 00176 00182 public function getCss() { 00183 00184 $css = array(); 00185 00186 // theme css 00187 if(is_readable($this->path().DS.'css'.DS."stylesheet.css")) 00188 $css[] = relativePath($this->path())."/css/stylesheet.css"; 00189 00190 // template specific css 00191 if(is_readable($this->path().DS.'css'.DS.$this->_tpl_name.".css")) 00192 $css[] = relativePath($this->path())."/css/".$this->_tpl_name.".css"; 00193 elseif(is_readable($this->dftPath().DS.'css'.DS.$this->_tpl_name.".css")) 00194 $css[] = relativePath($this->dftPath())."/css/".$this->_tpl_name.".css"; 00195 00196 return $css; 00197 00198 } 00199 00205 public function getJs() { 00206 00207 $js = array(); 00208 00209 // theme js 00210 if(is_readable($this->path().DS.'js'.DS."themejs.js")) 00211 $js[] = relativePath($this->path())."/js/themejs.js"; 00212 00213 // template specific js 00214 if(is_readable($this->path().DS.'js'.DS.$this->_tpl_name.".js")) 00215 $js[] = relativePath($this->path())."/js/".$this->_tpl_name.".js"; 00216 elseif(is_readable($this->dftPath().DS.'js'.DS.$this->_tpl_name.".js")) 00217 $js[] = relativePath($this->dftPath())."/js/".$this->_tpl_name.".js"; 00218 00219 return $js; 00220 00221 } 00222 00223 } 00224 00225 ?>