public function replace_urls($document, $tag, $attributes)
{
if (!is_array($attributes)) {
$attributes = array($attributes);
}
if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags)) {
$elements = $document->getElementsByTagName($tag);
foreach ($elements as $element) {
foreach ($attributes as $attribute) {
if ($element->hasAttribute($attribute)) {
$value = $this->registry->call('Misc', 'absolutize_url', array($element->getAttribute($attribute), $this->base));
if ($value !== false) {
$element->setAttribute($attribute, $value);
}
}
}
}
}
}