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