/** @return GroutQuick */ public function appQuick() { if ($tool = $this->_getAppTool(__FUNCTION__, __CLASS__)) { return $tool; } $tool = new GroutQuick($this->app); $tool->publicAssetUrl = $this->app->publicUrl . $this->app->getConfig()->assetUrl; $this->_setAppTool(__FUNCTION__, $tool); return $tool; }
public function importPlugin($type, $config = null, $id = null) { if ($id === null) { $id = str_replace('\\', '', $type); } if ($this->getPluginById($id)) { return null; } $pos = strrpos($type, '\\'); if ($pos === false) { $class = $type; } else { $class = substr($type, strrpos($type, '\\') + 1); } if ($config === null || is_array($config)) { $config = new ArrayFilter($config); } // $directory = str_replace('\\', '/', $type); // $path = $this->app->path . 'plugins/' . $directory . '/'; $this->app->importPluginNamespace($type); $class = 'Grout\\' . $type . '\\' . $class; $reflection = new \ReflectionClass($class); $path = dirname($reflection->getFileName()) . '/'; /** @var $p Plugin */ $p = new $class(); $p->type = $type; $p->config = $config; $p->path = $path; $p->namespace = NamespaceTools::getNamespaceOfInstance($p) . '\\'; $p->module = $this; $p->app = $this->app; $p->id = $id; $this->pluginIds[$p->id] = $p; $this->plugins[] = $p; if (!isset($this->pluginTypes[$type])) { $this->pluginTypes[$type] = array($p); } else { $this->pluginTypes[$type][] = $p; } $this->app->plugins[] = $p; $this->app->pluginIds[$p->id] = $p; if (!isset($this->app->pluginTypes[$type])) { $this->app->pluginTypes[$type] = array($p); } else { $this->app->pluginTypes[$type][] = $p; } $p->init(); return $p; }
ob_end_clean(); } $isConsole = php_sapi_name() == 'cli'; // Update configuration to fit your setup $basePath = realpath(dirname(__FILE__)) . '/'; $init = array('frameworkPath' => $basePath, 'dataPath' => $basePath . 'data/', 'bootstrap' => array('module' => 'AppModule', 'config' => array('config' => null))); chdir($init['frameworkPath']); // Init auto loader require_once $init['frameworkPath'] . 'vendor/autoload.php'; AutoLoader::init(); if (is_dir('source/')) { AutoLoader::registerNamespace('', 'source/'); } // Setup request and application App::initEnvironment(); $app = new App(); $app->dataPath = $init['dataPath']; if ($isConsole) { $bootstrap = new ConsoleBootstrap($app); $bootstrap->frameworkPath = $init['frameworkPath']; $request = $bootstrap->init(); } else { $bootstrap = new Bootstrap($app); $bootstrap->frameworkPath = $init['frameworkPath']; $bootstrap->usesModRewrite = true; $bootstrap->checkForMagicQuotes = true; $request = $bootstrap->init(); } $request->config->set('startupError', $startupError); $app->init(); // Import bootstrap module and process request
/** * @param $page Page */ public function redirectToPage($page, $action = 'parseTask') { $this->app->redirectTaskToPage($this, $page, $action); }