Example #1
0
 /**
  * Construct the URL Writer helper
  * 
  * Extract string from server configuration
  */
 private function __construct()
 {
     // Set server address
     $this->server_app_root = Request::server()['SERVER_NAME'];
     $ar_domain = explode('.', Request::server()['SERVER_NAME']);
     if (count($ar_domain) >= 3) {
         $start = strlen($ar_domain[0]) + 1;
         $this->server_main_root = substr(Request::server()['SERVER_NAME'], $start);
     } else {
         $this->server_main_root = Request::server()['SERVER_NAME'];
     }
     if (!Request::is_https() && Request::get_request_port() != 80 || Request::is_https() && Request::get_request_port() != 443) {
         $this->server_app_root .= ":" . Request::get_request_port();
         $this->server_main_root .= ":" . Request::get_request_port();
     }
     if (isset(Request::request()['request'])) {
         $ar_path = explode('/', Request::request()['request']);
         array_shift($ar_path);
         $this->session_path = implode('/', $ar_path);
     } else {
         $this->session_path = '';
     }
     $webroot = Application::get_instance()->get_webroot();
     if (!is_null($webroot) && !empty($webroot)) {
         $this->server_app_root .= "/" . $webroot;
         $this->server_main_root .= "/" . $webroot;
     }
 }