83506098ed905cef317c9aeab7cde5cb0a539246
[mtweb] / web / app / env / mw_env.php
1 <?php
2
3   class mw_env extends empty_class
4   {
5
6     function app_file_exists($file, $PRIORITE = "ASC")
7     { $app_file = $this->_app_file($file, $PRIORITE);
8       return $app_file ? true : false;
9     }
10
11     function app_file($file, $PRIORITE = "ASC")
12     { $app_file = $this->_app_file($file, $PRIORITE);
13       return $app_file ? $app_file : $file;
14     }
15
16     function _app_file($file, $PRIORITE = "ASC")
17     { $app_file = false;
18       if($PRIORITE == "ASC" && file_exists($this->path("app").$file)) return $this->path("app").$file;
19       if(($plugins = $this->plugins($PRIORITE)) !== false)
20       { foreach($plugins as $plugin_name => $plugin)
21         { if($file && $plugin["installed"] && $plugin["enabled"] && file_exists($this->path("plugins").$plugin_name."/app/".$file))
22           { $app_file = $this->path("plugins").$plugin_name."/app/".$file;
23             break;
24           }
25         }
26         if($PRIORITE == "DESC" && !$app_file)
27         { if(file_exists($this->path("app").$file)) $app_file = $this->path("app").$file;
28         }
29       }
30       return $app_file;
31     }
32
33   }
34
35 ?>