Esempio n. 1
0
 /**
  * if it is ajax request - will be outputted json: 'redirect' => 'url'
  * if it is simple request - header "Location" will be sent.
  *
  * @param \KZ\link\interfaces\Link|string $url
  * @return void
  */
 public function redirect($url)
 {
     if ($url instanceof Link) {
         $url = $url->getLink();
     }
     if ($this->request->isAjaxRequest()) {
         $this->json(['redirect' => $url]);
     } else {
         header('Location: ' . $url);
     }
     if ($this->exitAfterRedirect) {
         exit;
     }
 }
Esempio n. 2
0
 public function __construct()
 {
     $route = isset($_GET['r']) ? $_GET['r'] : '';
     parent::__construct($route);
 }