public function invoke(User $user, $handlerName) { $user->validate(); include_once RUDRA . "/core/handler/AbstractHandler.php"; $handleCache = new RxCache("handlers", true); global $temp; $className; if ($handleCache->hasKey($handlerName)) { $classObj = $handleCache->get($handlerName); include_once $classObj["filePath"]; $className = $classObj["className"]; } else { $className = ucfirst($handlerName); include_once HANDLER_PATH . "/" . $this->getHandlerPath() . $className . ".php"; } $tempClass = new ReflectionClass($className); if ($tempClass->isInstantiable()) { $temp = $tempClass->newInstance(); } if ($temp != NULL) { if ($tempClass->hasMethod("invokeHandler")) { $tpl = new Smarty(); // $tpl->prepare(); self::setSmartyPaths($tpl); // $tpl->testInstall(); exit; $tpl->debugging = Config::get('SMARTY_DEBUG'); $page = new Page(); $view = RudraX::invokeMethodByReflectionClass($tempClass, $temp, 'invokeHandler', array('tpl' => $tpl, 'viewModel' => $tpl, 'user' => $user, 'page' => $page, 'dataModel' => $page->data)); //$view = $temp->invokeHandler($tpl ); if (!isset($view)) { $view = $handlerName; } $tpl->assign('user', $user); $tpl->assign('CONTEXT_PATH', CONTEXT_PATH); $tpl->assign('RESOURCE_PATH', Config::get('RESOURCE_PATH')); if (isset($tpl->repeatData)) { foreach ($tpl->repeatData as $key => $value) { $tpl->assign($value['key'], $value['value']); $tpl->display($this->getViewPath() . $view . Config::get('TEMP_EXT')); } } else { $tpl->display($this->getViewPath() . $view . Config::get('TEMP_EXT')); } echo TEMP_DELIMITER; if (BROWSER_LOGS) { Browser::printlogs(); } echo TEMP_DELIMITER . json_encode($page->data->data); } else { if ($tempClass->hasMethod("invoke")) { $view = $temp->invoke(); if (!isset($view)) { $view = $handlerName; } include $this->getViewPath() . $view . '.php'; } } } }
public static function findAndExecuteController() { self::$url_cache = new RxCache("url", true); $allControllers = ClassUtil::getControllerArray(); if (!empty($allControllers)) { foreach ($allControllers as $mappingUrl => $mappingInfo) { if (!isset($mappingInfo["requestMethod"]) || strcasecmp($mappingInfo["requestMethod"], $_SERVER['REQUEST_METHOD']) == 0) { $mapObj = self::getMapObject($mappingInfo["mappingUrl"]); if ($mapObj != NULL) { self::$url_controller_info = $mappingInfo; } } } } self::$url_cache->save(true); }
public function invoke(User $user, $handlerName) { $className = ucfirst($handlerName); $user->validate(); include_once RUDRA . "/core/handler/AbstractHandler.php"; include_once HANDLER_PATH . "/" . $this->getHandlerPath() . $className . ".php"; $tempClass = new ReflectionClass($className); global $temp; if ($tempClass->isInstantiable()) { $temp = $tempClass->newInstance(); } if ($temp != NULL) { if ($tempClass->hasMethod("invokeHandler")) { $resp = RudraX::invokeMethodByReflectionClass($tempClass, $temp, 'invokeHandler', array('user' => $user)); if (isset($resp)) { echo $resp; } } } }
<?php ini_set('display_errors', 'On'); ini_set('error_reporting', E_ALL); //error_reporting(E_ALL); //error_reporting(E_ALL & ~E_DEPRECATED); require "./lib/autoload.php"; require_once "./lib/rudrax/boot/RudraX.php"; RudraX::invoke(array('RX_MODE_MAGIC' => TRUE, 'RX_MODE_DEBUG' => FALSE, 'PROJECT_ROOT_DIR' => "./"));
/** * @RequestMapping(url="image/{pid}",method="GET",type="template") * @RequestParams(true) */ function image($q, $p, $f, $pid) { return RudraX::invokeHandler("Image"); }
<?php // Default RudraX Plug RudraX::mapRequest("combinejs/{mdfile}", function () { include_once RUDRA . "/core/handler/ResourceHandler.php"; $handler = new ResourceHandler(); $handler->invokeHandler(); }); RudraX::mapRequest("template/{temp}", function ($temp = "nohandler") { return RudraX::invokeHandler($temp); }); RudraX::mapRequest('data/{eventname}', function ($eventName = "dataHandler") { $controller = RudraX::getDataController(); $controller->invokeHandler($eventName); }); RudraX::mapRequest("resources.json", function ($cb = "") { require_once RUDRA . '/core/model/Header.php'; echo $cb . "((" . json_encode(Header::getModules()) . ").bundles)"; }); // Default Plug for default page RudraX::mapRequest("", function () { return RudraX::invokeHandler("Index"); });