X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw%2Fenv%2Fmodules%2Fmw_env_out.php;h=859682f0a9ef84bba14190ad798494517d351a7a;hb=5dfe5e84a7007ddd9737707ce15f0155e6415066;hp=00f4a8414bef21b469d0376ead7c8c2158f63697;hpb=4947a4d83a2e96ee33135abdca8685b4c07e165c;p=mtweb diff --git a/mw/env/modules/mw_env_out.php b/mw/env/modules/mw_env_out.php index 00f4a84..859682f 100644 --- a/mw/env/modules/mw_env_out.php +++ b/mw/env/modules/mw_env_out.php @@ -6,6 +6,9 @@ var $out_config; var $layout; + var $js_files; + var $css_files; + // --------------------------------------------------------------------------------- // out vars // @@ -52,7 +55,7 @@ function _out_pathes($out_dir, $pathes = array()){ if($dh = opendir($out_dir)){ while(($file = readdir($dh)) !== false){ - if(is_dir($out_dir.$file) && substr($file, 0 ,1) != ".") $pathes[] = $file; + if(is_dir($out_dir.$file) && substr($file, 0 ,1) != "." && !in_array($file, $pathes)) $pathes[] = $file; } closedir($dh); } @@ -126,6 +129,50 @@ } // --------------------------------------------------------------------------------- + // js / css files + // + + function js_files(){ + if(!isset($this->js_files)) $this->js_files = array(); + $files = array(); + foreach($this->js_files as $url => $enabled){ + if($enabled) $files[] = $url; + } + return $files; + } + + function add_js_file($url){ + if(!isset($this->js_files)) $this->js_files = array(); + $this->js_files[$url] = true; + } + + function remove_js_file($url){ + if(isset($this->js_files) && isset($this->js_files[$url])){ + unset($this->js_files[$url]); + } + } + + function css_files(){ + if(!isset($this->css_files)) $this->css_files = array(); + $files = array(); + foreach($this->css_files as $url => $enabled){ + if($enabled) $files[] = $url; + } + return $files; + } + + function add_css_file($url){ + if(!isset($this->css_files)) $this->css_files = array(); + $this->css_files[$url] = true; + } + + function remove_css_file($url){ + if(isset($this->css_files) && isset($this->css_files[$url])){ + unset($this->css_files[$url]); + } + } + + // --------------------------------------------------------------------------------- // out config //