コード例 #1
0
 /**
  * Returns the current 'base site' url, optionally with a subpath.
  *
  * @staticvar string $uri
  * @param string $subpath Optional string
  * @return string The Url + basePath plus the optional subpath
  */
 public function getCurrentURI($subpath = '')
 {
     static $uri;
     if (!$uri) {
         $uri = \MUtil_Https::on() || $this->project->isHttpsRequired() ? 'https' : 'http';
         $uri .= '://';
         $uri .= isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $this->project->getConsoleUrl();
         $uri .= $this->basepath->getBasePath();
     }
     if ($subpath && $subpath[0] != '/') {
         $subpath = '/' . $subpath;
     }
     return $uri . $subpath;
 }