예제 #1
0
 /** @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;
 }
예제 #2
0
파일: Module.php 프로젝트: cyantree/grout
 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;
 }
예제 #3
0
    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
예제 #4
0
파일: Task.php 프로젝트: cyantree/grout
 /**
  * @param $page Page
  */
 public function redirectToPage($page, $action = 'parseTask')
 {
     $this->app->redirectTaskToPage($this, $page, $action);
 }