src/Graby.php
private function makeAbsolute($base, \DOMNode $elem)
    {
        $base = new \SimplePie_IRI($base);

        // remove '//' in URL path (used to prevent URLs from resolving properly)
        if (isset($base->ipath)) {
            $base->ipath = str_replace('//', '/', $base->ipath);
        }

        foreach (['a' => 'href', 'img' => 'src', 'iframe' => 'src'] as $tag => $attr) {
            $elems = $elem->getElementsByTagName($tag);

            for ($i = $elems->length - 1; $i >= 0; --$i) {
                $e = $elems->item($i);
                $this->makeAbsoluteAttr($base, $e, $attr);
            }

            if (strtolower($elem->nodeName) === $tag) {
                $this->makeAbsoluteAttr($base, $elem, $attr);
            }
        }
    }
private function makeAbsolute($base, \DOMNode $elem)
    {
        $base = new \SimplePie_IRI($base);

        // remove '//' in URL path (used to prevent URLs from resolving properly)
        if (isset($base->ipath)) {
            $base->ipath = str_replace('//', '/', $base->ipath);
        }

        foreach (['a' => 'href', 'img' => 'src', 'iframe' => 'src'] as $tag => $attr) {
            $elems = $elem->getElementsByTagName($tag);

            for ($i = $elems->length - 1; $i >= 0; --$i) {
                $e = $elems->item($i);
                $this->makeAbsoluteAttr($base, $e, $attr);
            }

            if (strtolower($elem->nodeName) === $tag) {
                $this->makeAbsoluteAttr($base, $elem, $attr);
            }
        }
    }
private function makeAbsolute ( $ base , \ DOMNode $ elem ) { $ base = new \ SimplePie_IRI ( $ base ) ; // remove '//' in URL path (used to prevent URLs from resolving properly) if ( isset ( $ base -> ipath ) ) { $ base -> ipath = str_replace ( '//' , '/' , $ base -> ipath ) ; } foreach ( [ 'a' => 'href' , 'img' => 'src' , 'iframe' => 'src' ] as $ tag => $ attr ) { $ elems = $ elem -> getElementsByTagName ( $ tag ) ; for ( $ i = $ elems -> length - 1 ; $ i >= 0 ; -- $ i ) { $ e = $ elems -> item ( $ i ) ; $ this -> makeAbsoluteAttr ( $ base , $ e , $ attr ) ; } if ( strtolower ( $ elem -> nodeName ) === $ tag ) { $ this -> makeAbsoluteAttr ( $ base , $ elem , $ attr ) ; } } }
Make an absolute url from an element.

@param string   $base The base url
@param \DOMNode $elem Element on which we'll retrieve the attribute
Make an absolute url from an element .