function makeAbsolute($base, $elem) { $base = new IRI($base); // remove '//' in URL path (causes URLs not to resolve properly) if (isset($base->ipath)) { $base->ipath = preg_replace('!//+!', '/', $base->ipath); } foreach (array('a' => 'href', 'img' => 'src') as $tag => $attr) { $elems = $elem->getElementsByTagName($tag); for ($i = $elems->length - 1; $i >= 0; $i--) { $e = $elems->item($i); //$e->parentNode->replaceChild($articleContent->ownerDocument->createTextNode($e->textContent), $e); makeAbsoluteAttr($base, $e, $attr); } if (strtolower($elem->tagName) == $tag) { makeAbsoluteAttr($base, $elem, $attr); } } }
function makeAbsolute($base, $elem) { $base = new SimplePie_IRI($base); // remove '//' in URL path (used to prevent URLs from resolving properly) // TODO: check if this is still the case if (isset($base->path)) { $base->path = preg_replace('!//+!', '/', $base->path); } foreach (array('a' => 'href', 'img' => 'src') as $tag => $attr) { $elems = $elem->getElementsByTagName($tag); for ($i = $elems->length - 1; $i >= 0; $i--) { $e = $elems->item($i); //$e->parentNode->replaceChild($articleContent->ownerDocument->createTextNode($e->textContent), $e); makeAbsoluteAttr($base, $e, $attr); } if (strtolower($elem->tagName) == $tag) { makeAbsoluteAttr($base, $elem, $attr); } } }
function makeAbsolute($base, $elem) { $base = new IRI($base); foreach (array('a' => 'href', 'img' => 'src') as $tag => $attr) { $elems = $elem->getElementsByTagName($tag); for ($i = $elems->length - 1; $i >= 0; $i--) { $e = $elems->item($i); //$e->parentNode->replaceChild($articleContent->ownerDocument->createTextNode($e->textContent), $e); makeAbsoluteAttr($base, $e, $attr); } if (strtolower($elem->tagName) == $tag) { makeAbsoluteAttr($base, $elem, $attr); } } }