예제 #1
0
 /**
  *This method returns the base url
  *
  *@param null
  *@return string $url the base url for this application
  *@throws this method does not throw an error
  *
  */
 public static function link($fileName)
 {
     //get the server name from global $_SERVER[] array()
     $base = $_SERVER['SERVER_NAME'];
     $url = Registry::getUrl();
     //check if there is a uri string
     if (!empty($url)) {
         //prepend installation folder to server name
         $base .= substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], Registry::getUrl()));
     } else {
         //prepend installation folder to server name
         $base .= substr($_SERVER['REQUEST_URI'], 0);
     }
     //use https if its defined in the $_SERVER global variable
     $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off" ? "https" : "http";
     //compose the url string
     return $protocol . '://' . $base . $fileName;
 }
예제 #2
0
 /**
  * This method returns the url string.
  * @param mixed $linkParams The params to add to the link to generate
  * @return string $url the base url for this application
  * @throws this method does not throw an error
  */
 public static function link($linkParams = null)
 {
     if ($linkParams === null) {
         $link_params = null;
     } elseif (is_array($linkParams)) {
         $link_params = join(Registry::getConfig()['url_component_separator'], $linkParams);
     } else {
         $params = func_get_args();
         $link_params = join(Registry::getConfig()['url_component_separator'], $params);
     }
     //get the server name from global $_SERVER[] array()
     $base = $_SERVER['SERVER_NAME'];
     $url = Registry::getUrl();
     //check if there is a uri string
     if (!empty($url)) {
         //prepend installation folder to server name
         $base .= substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], Registry::getUrl()));
     } else {
         //prepend installation folder to server name
         $base .= substr($_SERVER['REQUEST_URI'], 0);
     }
     //use https if its defined in the $_SERVER global variable
     $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off" ? "https" : "http";
     //compose the url string
     return $protocol . '://' . $base . $link_params;
 }
예제 #3
0
파일: Url.php 프로젝트: joycekenya/gliver
 /**
  *This method returns the assets url
  *
  *@param string $string the string to use to compose this url
  *@return string $url the full url for this request
  *@throws malformed string
  *
  */
 public static function link($string = null)
 {
     //get the server name from global $_SERVER[] array()
     $base = $_SERVER['SERVER_NAME'];
     //prepend installation folder to server name
     $base .= substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], Registry::getUrl()));
     //use https if its defined in the $_SERVER global variable
     $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off" ? "https" : "http";
     //compose the url string
     return $protocol . '://' . $base . '<br />';
 }