X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw%2Fenv%2Fmodules%2Fmw_env_plugins.php;h=6e3e6fbc12a2d28f7f95cb589c5b5b2dc336d53c;hb=bec31526c19092982057acabfe12e121442ec19b;hp=1df183466dc47d463cacbfd5ec5d991d24921136;hpb=36ed114046cbe3d72a3589230e9f306a54fcc79d;p=mtweb diff --git a/mw/env/modules/mw_env_plugins.php b/mw/env/modules/mw_env_plugins.php index 1df1834..6e3e6fb 100644 --- a/mw/env/modules/mw_env_plugins.php +++ b/mw/env/modules/mw_env_plugins.php @@ -27,13 +27,6 @@ return; } $plugins = array(); - if(!class_exists("mw_plugin")){ - require $this->path("mw_dir")."plugins/mw_plugin.php"; - if(!class_exists("mw_plugin")){ - $plugins = false; - return; - } - } if($dh = opendir($this->path("mw_dir")."plugins/")){ $OK = true; while($OK && ($plugin_name = readdir($dh)) !== false){ @@ -130,7 +123,9 @@ if(file_exists($this->path("mw_dir")."plugins")){ if(substr($plugin_name, 0 ,1) !== "." && is_dir($this->path("mw_dir")."plugins/".$plugin_name)){ if(file_exists($this->path("mw_dir")."plugins/".$plugin_name."/".$plugin_name.".php")){ - require $this->path("mw_dir")."plugins/".$plugin_name."/".$plugin_name.".php"; + if(!class_exists($plugin_name)){ + require_once $this->path("mw_dir")."plugins/".$plugin_name."/".$plugin_name.".php"; + } if(class_exists($plugin_name)){ $plugin = new $plugin_name(); } @@ -164,6 +159,8 @@ } function set_plugin_data($plugin_name, $data){ + if(!is_dir($this->plugins_data_dir())) @mkdir($this->plugins_data_dir()); + if(!is_dir($this->plugins_data_dir())) return false; $data_file = $this->plugin_data_file($plugin_name); $content = serialize($data); $OK = false; @@ -184,4 +181,36 @@ } + class mw_plugin{ + + function title(){ + return "(sans titre)"; + } + + function description(){ + return ""; + } + + function install($env){ + return true; + } + + function uninstall($env){ + return true; + } + + function enable($env){ + return true; + } + + function disable($env){ + return true; + } + + function init($env){ + return true; + } + + } + ?> \ No newline at end of file