error) { Message::Fail("Warning: Plugin \"$modname\" failed to load: $plugin->error"); } else { self::$list[] = $plugin; } } } class Plugin { public $name; public $author; public $version; public $description; public $handle; public $error = NULL; function __construct($handle) { if (!is_dir("plugins/$handle")) $this->error = "Plugin directory \"plugins/$handle\" doesn't exist"; else if (!is_file("plugins/$handle/$handle.php")) $this->error = "Plugin file \"plugins/$handle/$handle.php\" doesn't exist"; else { require_once "plugins/$handle/$handle.php"; if (!class_exists($handle)) $this->error = "Class \"$handle\" doesn't exist"; else { $plugin = new $handle(); if (!isset($plugin->name)) $this->error = "Plugin name not defined"; elseif (!isset($plugin->author)) $this->error = "Plugin author not defined"; elseif (!isset($plugin->version)) $this->error = "Plugin version not defined"; elseif (!isset($plugin->description)) $this->error = "Plugin description not defined"; else { $this->handle = $handle; $this->name = $plugin->name; $this->author = $plugin->author; $this->version = $plugin->version; $this->description = $plugin->description; } } } } } if (defined('PLUGINS')) { foreach(PLUGINS as $plugin) Plugins::load($plugin); }