You are here

protected function FeedSet::absolutiseUri in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Reader/FeedSet.php \Zend\Feed\Reader\FeedSet::absolutiseUri()

Attempt to turn a relative URI into an absolute URI

1 call to FeedSet::absolutiseUri()
FeedSet::addLinks in vendor/zendframework/zend-feed/src/Reader/FeedSet.php
Import a DOMNodeList from any document containing a set of links for alternate versions of a document, which will normally refer to RSS/RDF/Atom feeds for the current document.

File

vendor/zendframework/zend-feed/src/Reader/FeedSet.php, line 65

Class

FeedSet

Namespace

Zend\Feed\Reader

Code

protected function absolutiseUri($link, $uri = null) {
  $linkUri = Uri::factory($link);
  if (!$linkUri
    ->isAbsolute() or !$linkUri
    ->isValid()) {
    if ($uri !== null) {
      $uri = Uri::factory($uri);
      if ($link[0] !== '/') {
        $link = $uri
          ->getPath() . '/' . $link;
      }
      $link = sprintf('%s://%s/%s', $uri
        ->getScheme() ?: 'http', $uri
        ->getHost(), $this
        ->canonicalizePath($link));
      if (!Uri::factory($link)
        ->isValid()) {
        $link = null;
      }
    }
  }
  return $link;
}