コード例 #1
0
 /**
  *  Convert relative urls to absolute
  *
  * @param string $url Url to make absolute
  * @param string $baseUrl Base url to WordPress blog
  *
  * @return string Absolute Url
  */
 private function _getAbsoluteUrl($url, $baseUrl)
 {
     $baseUrlParsed = parse_url($baseUrl);
     $urlParsed = parse_url($url);
     // Check for root relative image paths and prepend domain if nessessary
     if (UrlHelper::isRootRelativeUrl($url)) {
         $url = $baseUrlParsed['scheme'] . '://' . $baseUrlParsed['host'] . $url;
     } else {
         if (UrlHelper::isProtocolRelativeUrl($url)) {
             $url = $baseUrlParsed['scheme'] . '://' . $url;
         }
     }
     return $url;
 }