/** * render pages * @param $action * @throws \Exception * @throws \Throwable */ protected function render($action, $values = array()) { $this->action = $action; $prefix = new Prefixes(); $address = new Addresses(); $extension = new ExtensionsSupport(); $findme = $prefix->Prefix()['doubleBarsInAddress']; $pos = strpos($this->action, $findme); if ($pos !== false) { $this->action = str_replace(".", "//", $this->action); } //include_once "..".$prefix->Prefix()['defaultAddressViews'].$this->action.$extension->Extensions()['defaultViewExtension']; $r = $this->loadBlade(".." . $address->Address()['defaultAddressCacheViews'] . $this->action . $extension->Extensions()['defaultViewExtension'], ".." . $address->Address()['defaultAddressViews'] . $this->action . $extension->Extensions()['defaultViewExtension'], $values); echo $r->render(); }
protected function run($url) { array_walk($this->routes, function ($route) use($url) { $address = new Addresses(); //TODO: Values in route //$this->valueInRouteToArray($route['route'], $url); if ($url == $route['route']) { $class = $address->Address()['defaultAddressControllers'] . ucfirst($route['controller']); //Caminho para a classe "controller" $controller = new $class(); //Instancia a classe $action = $route['action']; //Nome da ação a ser executada $controller->{$action}(); //Executa ação } }); }
function loadBlade($view, $viewPath = false, $data = array()) { $address = new Addresses(); // echo $this->viewPath; if (isset($viewPath)) { $this->viewPath = $viewPath; } // this path needs to be array $FileViewFinder = new FileViewFinder(new Filesystem(), array($this->viewPath, $this->view)); // use blade instead of phpengine // pass in filesystem object and cache path $compiler = new BladeCompiler(new Filesystem(), '..' . $address->Address()['defaultAddressCacheViews']); $BladeEngine = new CompilerEngine($compiler); // create a dispatcher $dispatcher = new Dispatcher(new Container()); // build the factory $factory = new Factory(new EngineResolver(), $FileViewFinder, $dispatcher); // this path needs to be string $viewObj = new View($factory, $BladeEngine, $view, $this->viewPath, $data); return $viewObj; }
public static function get($model) { $address = new Addresses(); $class = $address->Address()['defaultAddressModels'] . ucfirst($model); return new $class(Conn::getDb()); }