af_redditimgur: do not process content multiple times
This commit is contained in:
parent
b999f4c75a
commit
a16d7a5d64
|
@ -18,8 +18,10 @@ class Af_RedditImgur extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook_article_filter($article) {
|
function hook_article_filter($article) {
|
||||||
|
$owner_uid = $article["owner_uid"];
|
||||||
|
|
||||||
if (strpos($article["link"], "reddit.com/r/") !== FALSE) {
|
if (strpos($article["link"], "reddit.com/r/") !== FALSE) {
|
||||||
|
if (strpos($article["plugin_data"], "redditimgur,$owner_uid:") === FALSE) {
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
@$doc->loadHTML($article["content"]);
|
@$doc->loadHTML($article["content"]);
|
||||||
|
|
||||||
|
@ -50,9 +52,13 @@ class Af_RedditImgur extends Plugin {
|
||||||
|
|
||||||
if ($node) {
|
if ($node) {
|
||||||
$article["content"] = $doc->saveXML($node, LIBXML_NOEMPTYTAG);
|
$article["content"] = $doc->saveXML($node, LIBXML_NOEMPTYTAG);
|
||||||
|
$article["plugin_data"] = "redditimgur,$owner_uid:" . $article["plugin_data"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (isset($article["stored"]["content"])) {
|
||||||
|
$article["content"] = $article["stored"]["content"];
|
||||||
|
}
|
||||||
|
|
||||||
return $article;
|
return $article;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue