protected static function initialize() { if (self::$initialized) { return; } if (!self::$cache_dir) { self::$cache_dir = self::createPath(dirname(__FILE__), 'cache'); } if (!self::$plugins_dir) { self::$plugins_dir = self::createPath(dirname(__FILE__), 'plugins'); } $suffix = '.php'; $pattern = sprintf(self::createPath('%s', '*%s'), self::$plugins_dir, $suffix); foreach (glob($pattern) as $path) { require_once $path; // TODO: get_declared_classあたりを使って何とかする // TODO: phpParserPluginの子供かをチェック // TODO: 各プラグインをnewしたい気もする。 // TODO: registerRuleメソッドを呼び出して、pluginに自分で登録させる $class = __CLASS__ . 'Plugin' . substr(basename($path), 0, -strlen($suffix)); $properties = get_class_vars($class); $rule =& $properties['rule']; self::$plugins[$class] =& $rule; } self::defineYyFunctions(); }
protected static function initialize() { if (self::$initialized) { return; } if (!self::$cache_dir) { self::$cache_dir = self::createPath(dirname(__FILE__), 'cache'); } if (!self::$plugins_dir) { self::$plugins_dir = self::createPath(dirname(__FILE__), 'plugins'); } $suffix = '.php'; $pattern = sprintf(self::createPath('%s', '*%s'), self::$plugins_dir, $suffix); foreach (glob($pattern) as $path) { require_once $path; $class = __CLASS__ . 'Plugin' . substr(basename($path), 0, -strlen($suffix)); $properties = get_class_vars($class); $rule =& $properties['rule']; self::$plugins[$class] =& $rule; } self::defineYyFunctions(); }