function f_function_normal(&$obj, $x) { $y = f_function($x); return $y; }
function loadController($fileName, $part=0) { D::log($fileName, 'Loading Controller…'); //$fileName = Events::callEvent('loadController', $fileName); require(LOC . 'Controllers/' . $fileName); //print_r($this); static $partCount = 0; $class = substr(strrchr('/' . $fileName, '/'), 1, -4); $page = $this->lib->Uri->loadUrl($class::$urlPattern, $part); if(is_array(f_last($page))) { if(is_array( f_first(f_last($page)) )) { $this->loadController(f_first(f_first(f_last($page))), $part+1); return true; } $page[$part] = f_first(f_last($page)); //D::log($page[$part], 'page o parts'); } D::log($page, 'Loading Controller…'); $this->controller = new $class(); $this->controller->getLibrary('Databases/Query.php'); /*@todo make "shortcuts" more dynamic */ $this->controller->template =& $this->controller->lib->Template; if(empty($page[$part])) { echo $this->controller->index(); } else { if(method_exists($class, $page[$part])) { echo f_call(array( $this->controller, $page[$part] )); return true; } else { return f_function(function() { header("HTTP/1.0 404 Not Found"); echo '<h1>404 error</h1>'; //todo check for some sort of custom 404… }); } } D::log($page, 'controller method array'); }