Ejemplo n.º 1
0
 function __construct($site = GCORE_SITE, $thread = 'gcore')
 {
     $app = \GCore\Bootstrap::getApp($site, $thread);
     $this->site = $site;
     $this->thread = $thread;
     $this->_vars = $app->_vars;
     $this->data =& Request::raw();
     //&$_POST;
     //$this->data = array_merge($_GET, $this->data);
     $this->path = $app->path;
     $this->url = $app->url;
     $this->name = get_class($this);
     $this->action = $app->action;
     //set models properties
     if (!empty($this->models)) {
         $this->models = (array) $this->models;
         foreach ($this->models as $model) {
             $alias = Base::getClassName($model);
             $this->{$alias} = new $model();
         }
     }
     //set libs properties
     if (!empty($this->libs)) {
         $this->libs = (array) $this->libs;
         foreach ($this->libs as $lib) {
             $alias = Base::getClassName($lib);
             if (in_array('getInstance', get_class_methods($lib))) {
                 $this->{$alias} = $lib::getInstance();
             } else {
                 $this->{$alias} = new $lib();
             }
             $this->{$alias}->controller =& $this;
         }
     }
 }
Ejemplo n.º 2
0
 public static function call($site, $extension, $controller = '', $action = '', $params = array(), $check_perm = true)
 {
     //$x_app = self::getInstance($site, 'x_core_'.rand());
     $x_app = \GCore\Bootstrap::getApp($site, 'x_core_' . rand());
     $x_app->extension = $extension;
     $x_app->controller = $controller;
     $x_app->action = $action;
     $x_app->set($params);
     $x_app->dispatch(true, $check_perm);
     return $x_app->buffer;
 }