/** * Default view helper. Takes the same parameters as PicoraController::render(). */ public static final function render($file, $local_variables = false) { return PicoraController::render($file, $local_variables); }
protected static function generateResponse($response) { if ($response === null) { $method_name = strtolower(preg_replace('/([a-z])([A-Z])/e', "'\\1_'.strtolower('\\2')", self::$status['current_method'])); $controller_name = strtolower(preg_replace('/([a-z])([A-Z])/e', "'\\1_'.strtolower('\\2')", self::$status['current_controller'])); $try_one = self::getDefaultViewDirectory() . $controller_name . '/' . $method_name . '.php'; $try_two = self::getDefaultViewDirectory() . PicoraSupport::pluralize($controller_name) . '/' . $method_name . '.php'; if (file_exists($try_one)) { $response = PicoraController::render($try_one); } elseif (file_exists($try_two)) { $response = PicoraController::render($try_two); } else { throw new Exception(self::$status['current_controller'] . 'Controller->' . self::$status['current_method'] . '() returned null, and no matching view was found.'); } } return self::getRequestMethod() == 'ajax' ? $response : call_user_func(self::$layout_handler, $response instanceof PicoraView ? $response->display() : $response, self::getCurrentController()); }