diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index 4079a5b3..8a662de2 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -1,4 +1,7 @@ init()) { + try { + if ($r->parse($tmp)) { - $tmpxpath = new DOMXPath($r->dom); + $tmpxpath = new DOMXPath($r->getDOMDocument()); - $entries = $tmpxpath->query('(//a[@href]|//img[@src])'); + $entries = $tmpxpath->query('(//a[@href]|//img[@src])'); - foreach ($entries as $entry) { - if ($entry->hasAttribute("href")) { - $entry->setAttribute("href", - rewrite_relative_url($url, $entry->getAttribute("href"))); - - } - - if ($entry->hasAttribute("src")) { - $entry->setAttribute("src", - rewrite_relative_url($url, $entry->getAttribute("src"))); + foreach ($entries as $entry) { + if ($entry->hasAttribute("href")) { + $entry->setAttribute("href", + rewrite_relative_url($url, $entry->getAttribute("href"))); + + } + + if ($entry->hasAttribute("src")) { + $entry->setAttribute("src", + rewrite_relative_url($url, $entry->getAttribute("src"))); + + } } + $article["content"] = $r->getContent() . "
" . $article["content"]; } - - $article["content"] = $r->articleContent->innerHTML . "
" . $article["content"]; + } catch (ParseException $e) { + // } } }