/** * Perform instant redirect to another page. * * @param string $page * @param array $args */ public function redirect($page = null, $args = array()) { /* * Redirect to specified page. $args are $_GET arguments. * Use this function instead of issuing header("Location") stuff */ $url = $this->url($page, $args); if ($this->app->isAjaxOutput()) { if ($_GET['cut_page']) { echo '<script>' . $this->app->js()->redirect($url) . '</script>Redirecting page...'; exit; } else { $this->app->js()->redirect($url)->execute(); } } header('Location: ' . $url); exit; }