public attr / function, constructeurs __construct
[mtweb] / mw / env / modules / mw_env_out.php
index 998f489..2042744 100644 (file)
@@ -2,29 +2,27 @@
 
   class mw_env_out extends mw_env{
 
-    var $out;
-    var $out_config;
-    var $layout;
-
-    var $js_files;
-    var $css_files;
-
-    var $template;
+    public $out;
+    public $out_config;
+    public $layout;
+    public $js_files;
+    public $css_files;
+    public $template;
 
     // ---------------------------------------------------------------------------------
     //                                                                          out vars
     //
 
-    function set_out($key, $value){
+    public function set_out($key, $value){
       $this->out[$key] = $value;
       return $value;
     }
 
-    function get_out(){
+    public function get_out(){
       return $this->out;
     }
 
-    function out($key){
+    public function out($key){
       return isset($this->out[$key]) ? $this->out[$key] : null;
     }
 
@@ -32,7 +30,7 @@
     //                                                                         templates
     //
 
-    function templates(){
+    public function templates(){
       if(($out_pathes = $this->out_pathes()) === false) return false;
       $templates = array();
       $current_out_path = $this->config("out");
       return $templates;
     }
 
-    function get_template(){
+    public function get_template(){
       if(isset($this->template)) return $this->template;
       $this->template = $this->_get_template();
       return $this->template;
     }
 
-    function _get_template(){
+    public function _get_template(){
       $template_class_name = "mw_template";
       if($this->out_file_exists("template.php")){
         $template_class_file = $this->out_file("template.php");
@@ -63,7 +61,7 @@
       return $template;
     }
 
-    function out_pathes(){
+    public function out_pathes(){
       $pathes = array();
       if(($plugins = $this->plugins()) !== false){
         foreach($plugins as $plugin_name => $plugin){
@@ -85,7 +83,7 @@
       return $pathes;
     }
 
-    function _out_pathes($out_dir, $pathes = array()){
+    public 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) != "." && !in_array($file, $pathes)) $pathes[] = $file;
     //                                                                         out files
     //
 
-    function out_file_exists($file, $PRIORITE = "DESC"){
+    public function out_file_exists($file, $PRIORITE = "DESC"){
       $out_file = $this->_out_file($file, $PRIORITE);
       return $out_file ? true : false;
     }
 
-    function out_file($file, $PRIORITE = "DESC"){
+    public function out_file($file, $PRIORITE = "DESC"){
       $out_file = $this->_out_file($file, $PRIORITE);
       return $out_file ? $this->path("mw_dir").$out_file : $file;
     }
 
-    function out_url($file, $PRIORITE = "DESC"){
+    public function out_url($file, $PRIORITE = "DESC"){
       $out_file = $this->_out_file($file, $PRIORITE);
       return $out_file ? $this->path("web").$this->path("mw_path").$out_file : $file;
     }
 
-    function _out_file($file, $PRIORITE = "DESC"){
+    public function _out_file($file, $PRIORITE = "DESC"){
       $out_file = false;
       if($PRIORITE == "ASC"){
         $tmp_out_file = "app/out/".$this->config("out")."/".$file;
     //                                                                    js / css files
     //
 
-    function js_files(){
+    public function js_files(){
       if(!isset($this->js_files)) $this->js_files = array();
       $files = array();
       foreach($this->js_files as $url => $enabled){
       return $files;
     }
 
-    function add_js_file($url){
+    public function add_js_file($url){
       if(!isset($this->js_files)) $this->js_files = array();
       $this->js_files[$url] = true;
     }
 
-    function remove_js_file($url){
+    public function remove_js_file($url){
       if(isset($this->js_files) && isset($this->js_files[$url])){
         unset($this->js_files[$url]);
       }
     }
 
-    function css_files(){
+    public function css_files(){
       if(!isset($this->css_files)) $this->css_files = array();
       $files = array();
       foreach($this->css_files as $url => $enabled){
       return $files;
     }
 
-    function add_css_file($url){
+    public function add_css_file($url){
       if(!isset($this->css_files)) $this->css_files = array();
       $this->css_files[$url] = true;
     }
 
-    function remove_css_file($url){
+    public function remove_css_file($url){
       if(isset($this->css_files) && isset($this->css_files[$url])){
         unset($this->css_files[$url]);
       }
     //                                                                        out config
     //
 
-    function set_out_config($out_config){
+    public function set_out_config($out_config){
       $this->out_config = $out_config;
       return $this->out_config;
     }
 
-    function get_out_config(){
+    public function get_out_config(){
       return isset($this->out_config) ? $this->out_config : array();
     }
 
-    function out_config($name){
+    public function out_config($name){
       if(isset($this->out_config)){
         $CONFIG = $this->get_CONFIG();
         return isset($CONFIG["out_".$name]) ? $CONFIG["out_".$name] : (isset($this->out_config[$name]) ? $this->out_config[$name]["default"] : "");
     //                                                                           layouts
     //
 
-    function layout(){
+    public function layout(){
       return $this->layout;
     }
 
-    function init_layout(){
+    public function init_layout(){
       $this->layout = array();
       $this->_init_layout("index");
       if(($mod = $this->etat("mod")) != "index") $this->_init_layout($mod);
       return $this->get_layout();
     }
 
-    function _init_layout($mod){
+    public function _init_layout($mod){
       if(($plugins = $this->plugins("ASC")) !== false){
         $layout_file = false;
         $tmp_layout_file = $this->path("mw_dir")."app/out/".$this->config("out")."/layouts/".$mod.".xml";
       }
     }
 
-    function load_layout($layout_file){
+    public function load_layout($layout_file){
       if(file_exists($layout_file)){
         $xml_parser = new sxml();
         $xml_parser->parse(file_get_contents($layout_file));
       return false;
     }
 
-    function get_layout(){
+    public function get_layout(){
       $mod = $this->etat("mod");
       $controller = $this->etat("controller");
       $action = $this->etat("action");
 
   }
 
+  // -------------------------------------------------------------------------------------------
+  //                                                                           class mw_template
+  //
+
   class mw_template extends empty_class{
 
-    var $out;
-    var $ENV_SET;
-    var $template_infos;
+    public $out;
+    public $ENV_SET;
+    public $template_infos;
 
-    function set_env(&$env){
+    public function set_env(&$env){
       $this->modules = array("env" => $env);
       $this->ENV_SET = true;
       $this->set_out_config($this->get_out_config());
       $this->set_template_infos($this->get_template_infos());
     }
 
-    function render_layout($layout = null){
+    public function render_layout($layout = null){
       if(!isset($this->ENV_SET) || !$this->ENV_SET) return false;
       if(!isset($layout)) $layout = $this->init_layout();
       $this->out = $this->get_out();
       }
     }
 
-    function get_template_info($key){
+    public function get_template_info($key){
       return isset($this->template_infos[$key]) ? $this->template_infos[$key] : "";
     }
 
-    function init(){
+    public function init(){
       return true;
     }
 
-    function init_script(){
+    public function init_script(){
       return false;
     }
 
-    function get_out_config(){
+    public function get_out_config(){
       $out_config = array();
       if($this->ENV_SET){
         $env = $this->modules["env"];
       return $out_config;
     }
 
-    function set_template_infos($template_infos){
+    public function set_template_infos($template_infos){
       $this->template_infos = $template_infos;
     }
 
-    function get_template_infos(){
+    public function get_template_infos(){
       return array();
     }
 
   }
-
-?>
\ No newline at end of file