public function __construct($engineName = null) { Runtime::loadModule('mvc'); if ($engineName) { parent::__construct($engineName); } }
public function ls() { Runtime::loadModule('rom'); $items = array('name' => '', 'age' => '12'); $form = Validation\Validation::parse('vld', $items); $this->data->form = $form; $this->data->report = $form->validate(); $this->data->fsm = \FSM\Engine::parse('site'); }
public function executeLogic() { Runtime::loadModule('util'); $models = $this->model(); $this->modelInclude($models); while (!end($models)) { array_pop($models); } $last_model = end($models); require_once $this->controller(); $model = null; if ($last_model->path && $last_model->className) { $modelName = $last_model->className; /*Figure out model name*/ $modelReflection = new ReflectionClass($modelName); /*Instantiate The Model*/ $model = $modelReflection->newInstance(); } $controllerName = ucfirst($this->navigation->controllerName . 'Controller'); $controllerReflection = new ReflectionClass($controllerName); $controller = $controllerReflection->newInstanceArgs(array($model)); $this->_ctorParams = $controller->params(); $controller->flushParams(); if (isset($this->navigation->methodName)) { $this->_alternateView = ControllerTray::instance()->alternateView; $controllerReflectionObject = new ReflectionObject($controller); try { $methodReflection = $controllerReflectionObject->getMethod($this->navigation->methodName); } catch (ReflectionException $ex) { throw new MethodNotFoundException($this->navigation->methodName, $this->navigation->controllerName, $this->projectName); } if ($methodReflection) { if (count($this->navigation->args) < $methodReflection->getNumberOfRequiredParameters()) { throw new ArgumentNotGivenException($this->navigation->methodName, $this->navigation->controllerName, $this->projectName); } else { $this->_methodReturn = $methodReflection->invokeArgs($controller, $this->navigation->args); $this->_actionParams = $controller->params(); $controller->flushParams(); } } } $controller->setParams($this->_arrangedParams); /*This check will be required in future. cause In future it will be possible to have a controler with no XDO attached to it*/ if ($controller->xdo) { $this->storeXDO($controller->xdo); } $controller->serialize(); return $controller; }
public function buildNavigation($path) { //var_dump($path); //http://localhost/bong/index.php/controllerName/methodName/arg1/arg2/+spiritName/methodName/spiritArg1/spiritArg2/+spiritName2/methodName/args $this->navigation->controllerName = null; $this->navigation->methodName = null; $this->navigation->args = array(); $this->navigation->spirits = array(); $racks = array(); foreach ($path as $i => $urlSection) { if (strlen($urlSection) > 0 && $urlSection[0] == '+') { $racks[] = array(); } $racks[count($racks) == 0 ? count($racks) : count($racks) - 1][] = $urlSection; } foreach ($racks as $i => &$rack) { if ($i == 0) { $this->navigation->controllerName = isset($rack[0]) && !empty($rack[0]) ? $rack[0] : Conf::instance()->evaluate('default.controller'); $this->navigation->methodName = isset($rack[1]) && !empty($rack[1]) ? $rack[1] : Conf::instance()->evaluate('default.method'); for ($i = 2; $i < count($rack); ++$i) { $this->navigation->args[] = $rack[$i]; } } else { if (count($rack) > 1) { //Ignore if no MethodName is provided $spirit = new stdClass(); $spirit->spiritName = substr($rack[0], 1); //remove the + sign $spirit->methodName = $rack[1]; $spirit->args = array(); for ($i = 2; $i < count($rack); ++$i) { $spirit->args[] = $rack[$i]; } $this->navigation->spirits[] = $spirit; } } } if (is_null($this->navigation->controllerName)) { $this->navigation->controllerName = 'default'; } if (is_null($this->navigation->methodName)) { $this->navigation->methodName = 'main'; } MemPool::instance()->set('bong.mvc.controller', $this->navigation->controllerName); MemPool::instance()->set('bong.mvc.method', $this->navigation->methodName); Runtime::loadModule('mvc'); //print_r($this->navigation); }
public function ctor() { Runtime::loadModule('admin'); ControllerTray::instance()->renderLayout = false; $this->_xdo = ControllerXDO::unpack('project'); $this->_xdo->unserialize(); if (Backend::ExistsUnSessioned('explorer.' . $this->_xdo->project->name)) { $this->_backend = Backend::LoadUnSessioned('explorer.' . $this->_xdo->project->name); } else { $this->_backend = Structs\Admin\Project::create($this->_xdo->project->name); /*Create From reflection*/ } if (isset($this->_xdo->controllerName)) { $this->_controllerName = $this->_xdo->controllerName; } }
} /** * Slash the Url to Get URL Parts. * e.g. exploding it with '/' will extract all URL Parts in an array */ MemPool::instance()->set("bong.url.path", isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/'); Runtime::loadModule('rom'); \ROM\BongCurrentUserData::startSession(); $router = URLAnalyzer::instance()->decide(); \ROM\BongCurrentUserData::instance()->load(); if (!\ROM\BongCurrentUserData::instance()->identical()) { \ROM\BongCurrentUserData::reset(); } $urlReq = new \ROM\UrlRequest(time(), session_id(), $_SERVER['SCRIPT_NAME']); \ROM\BongCurrentUserData::instance()->addUrlRequest($urlReq); Runtime::loadModule('dal'); /*AbstractContentEngine* */ $engine = $router->engine(); $engine->run(); HTTPHeaders::send(); $response = $engine->response(); $res = new stdClass(); $res->url = $r_url; $res->res = base64_encode($response); $res->checksum = md5($res->res); if (!empty($r_checksum) && $r_checksum == $res->checksum) { $res->res = ''; } $response = ""; $response_buff[] = $res; \ROM\BongCurrentUserData::instance()->dump();
public function __construct() { parent::__construct("ResourceEngine"); Runtime::loadModule('util'); }