/** * Загружает роуты из конфига */ protected function loadRoutes() { $parser = new YmlParser(); $this->_routes = $parser->parse('System/Other/Router/routes.yml'); }
protected function getRoutes() { $parser = new YmlParser(); return $parser->parse('Plugins/' . $this->getName() . '/Others/Routes/routes.yml'); }
public function installPlugins() { $parser = new YmlParser(); $plugins = $parser->parse('Plugins/plugins.yml'); if (!isset($plugins['enable_plugins']) || !is_array($plugins['enable_plugins']) || !count($plugins['enable_plugins'])) { throw new \Exception('Plugins not installed'); } foreach ($plugins['enable_plugins'] as $pluginPath) { $pluginPath .= '\\Plugin'; if (!file_exists(ROOT . '/../' . str_replace('\\', '/', $pluginPath . '.php'))) { throw new \Exception('Plugin wrong path'); } $itemPlugin = new $pluginPath(); $plaginRes = $itemPlugin->init(); $this->plugins[$itemPlugin->getName()] = $itemPlugin; if ($plaginRes['routes']) { $this->getRouter()->setRoutes(array_replace_recursive($this->getRouter()->getRoutes(), $plaginRes['routes'])); } if ($plaginRes['configuration']) { $this->setConfig(array_replace_recursive($this->getConfig(), $plaginRes['configuration'])); } } }