/**
  * Handles passed exception.
  *
  * @param Exception $ex Exception to be handled.
  */
 public static function handleException(Exception $ex)
 {
     $exText = ExceptionHandler::getExceptionString($ex);
     $exText = ExceptionHandler::saveToLogFile($exText, get_class($ex));
     if (!ExceptionHandler::$showErrorPage || empty(ExceptionHandler::$errorPageUrl)) {
         ExceptionHandler::outputExceptionText($exText);
     } else {
         if (ExceptionHandler::$url == null) {
             die('Url object is null, cannot redirect to error page');
         }
         ExceptionHandler::$url->redirect(ExceptionHandler::$errorPageUrl);
     }
 }
Example #2
0
 /**
  * Generates configuration values.
  */
 private function genConfigValues()
 {
     $mainUrl = $this->url->getMainUrlNoLang();
     $this->config->set('main_url', $this->url->getMainUrl());
     $this->config->set('main_url_no_lang', $this->url->getMainUrlNoLang());
     $this->config->set('protocol', $this->url->getProtocol());
     $this->config->set('current_page', $this->url->getCurrentPageName());
     $this->config->set('current_language', $this->url->getCurrentLanguage());
     $this->config->set('url_parts', $this->url->getUrlParts());
     $this->config->set('output_components_url', $mainUrl . $this->config->get('output_components_url'));
     $this->config->set('index_url', $mainUrl . $this->config->get('index_url'));
     $this->config->set('pages_url', $mainUrl . $this->config->get('pages_url'));
 }
Example #3
0
 /**
  * Redirect to 404.
  */
 protected function redirectTo404()
 {
     $location = $this->url->getMainUrl() . $this->pageNotFoundPage;
     $this->url->redirect($location);
 }