Use 'saveHTML' when generating HTML from a DOMDocument.
This primarily occurs when modifying article content. If 'saveXML' is used following 'loadHTML' there is the possibility of strangeness, such as a self-closing anchor tag. Note that the DOMDocument used in 'classes/feeditem/atom.php' came from 'loadXML', but we use 'saveHTML' since we're returning HTML content.
This commit is contained in:
parent
153cb6d305
commit
f3774b9d65
16 changed files with 32 additions and 32 deletions
|
@ -69,7 +69,7 @@ class FeedItem_Atom extends FeedItem_Common {
|
||||||
$child = $content->childNodes->item($i);
|
$child = $content->childNodes->item($i);
|
||||||
|
|
||||||
if ($child->hasChildNodes()) {
|
if ($child->hasChildNodes()) {
|
||||||
return $this->doc->saveXML($child);
|
return $this->doc->saveHTML($child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ class FeedItem_Atom extends FeedItem_Common {
|
||||||
$child = $content->childNodes->item($i);
|
$child = $content->childNodes->item($i);
|
||||||
|
|
||||||
if ($child->hasChildNodes()) {
|
if ($child->hasChildNodes()) {
|
||||||
return $this->doc->saveXML($child);
|
return $this->doc->saveHTML($child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Af_Comics_Cad extends Af_ComicFilter {
|
||||||
$basenode = $xpath->query('//div[@class="comicpage"]/a/img')->item(0);
|
$basenode = $xpath->query('//div[@class="comicpage"]/a/img')->item(0);
|
||||||
|
|
||||||
if ($basenode) {
|
if ($basenode) {
|
||||||
$article["content"] = $doc->saveXML($basenode);
|
$article["content"] = $doc->saveHTML($basenode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Af_Comics_ComicClass extends Af_ComicFilter {
|
||||||
$basenode = $xpath->query('//div[@class="comic"]')->item(0);
|
$basenode = $xpath->query('//div[@class="comic"]')->item(0);
|
||||||
|
|
||||||
if ($basenode) {
|
if ($basenode) {
|
||||||
$article["content"] = $doc->saveXML($basenode);
|
$article["content"] = $doc->saveHTML($basenode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Af_Comics_ComicPress extends Af_ComicFilter {
|
||||||
$basenode = $xpath->query('//div[@id="comic"]')->item(0);
|
$basenode = $xpath->query('//div[@id="comic"]')->item(0);
|
||||||
|
|
||||||
if ($basenode) {
|
if ($basenode) {
|
||||||
$article["content"] = $doc->saveXML($basenode);
|
$article["content"] = $doc->saveHTML($basenode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter {
|
||||||
|
|
||||||
if ($basenode) {
|
if ($basenode) {
|
||||||
|
|
||||||
$article["content"] = $doc->saveXML($basenode);
|
$article["content"] = $doc->saveHTML($basenode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Af_Comics_Dilbert extends Af_ComicFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($basenode) {
|
if ($basenode) {
|
||||||
$article["content"] = $doc->saveXML($basenode);
|
$article["content"] = $doc->saveHTML($basenode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add comic title to article type if not empty (mostly Sunday strips)
|
// Add comic title to article type if not empty (mostly Sunday strips)
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Af_Comics_Explosm extends Af_ComicFilter {
|
||||||
$basenode = $xpath->query('(//img[@id="main-comic"])')->item(0);
|
$basenode = $xpath->query('(//img[@id="main-comic"])')->item(0);
|
||||||
|
|
||||||
if ($basenode) {
|
if ($basenode) {
|
||||||
$article["content"] = $doc->saveXML($basenode);
|
$article["content"] = $doc->saveHTML($basenode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Af_Comics_Pa extends Af_ComicFilter {
|
||||||
$basenode = $xpath->query('(//div[@id="comicFrame"])')->item(0);
|
$basenode = $xpath->query('(//div[@id="comicFrame"])')->item(0);
|
||||||
|
|
||||||
if ($basenode) {
|
if ($basenode) {
|
||||||
$article["content"] = $doc->saveXML($basenode);
|
$article["content"] = $doc->saveHTML($basenode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class Af_Comics_Pa extends Af_ComicFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($basenode){
|
if ($basenode){
|
||||||
$article["content"] = $doc->saveXML($basenode);
|
$article["content"] = $doc->saveHTML($basenode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Af_Comics_Pvp extends Af_ComicFilter {
|
||||||
$basenode = $xpath->query('//section[@class="comic-art"]')->item(0);
|
$basenode = $xpath->query('//section[@class="comic-art"]')->item(0);
|
||||||
|
|
||||||
if ($basenode) {
|
if ($basenode) {
|
||||||
$article["content"] = $doc->saveXML($basenode);
|
$article["content"] = $doc->saveHTML($basenode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Af_Comics_Tfd extends Af_ComicFilter {
|
||||||
$basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0);
|
$basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0);
|
||||||
|
|
||||||
if ($basenode) {
|
if ($basenode) {
|
||||||
$article["content"] = $doc->saveXML($basenode);
|
$article["content"] = $doc->saveHTML($basenode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Af_Comics_Twp extends Af_ComicFilter {
|
||||||
$basenode = $xpath->query("//td/center/img")->item(0);
|
$basenode = $xpath->query("//td/center/img")->item(0);
|
||||||
|
|
||||||
if ($basenode) {
|
if ($basenode) {
|
||||||
$article["content"] = $doc->saveXML($basenode);
|
$article["content"] = $doc->saveHTML($basenode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Af_Comics_Whomp extends Af_ComicFilter {
|
||||||
$basenode = $xpath->query('//img[@id="cc-comic"]')->item(0);
|
$basenode = $xpath->query('//img[@id="cc-comic"]')->item(0);
|
||||||
|
|
||||||
if ($basenode) {
|
if ($basenode) {
|
||||||
$article["content"] = $doc->saveXML($basenode);
|
$article["content"] = $doc->saveHTML($basenode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ class Af_Comics extends Plugin {
|
||||||
$tpl->setVariable('ARTICLE_LINK', $article_link, true);
|
$tpl->setVariable('ARTICLE_LINK', $article_link, true);
|
||||||
$tpl->setVariable('ARTICLE_TITLE', date('l, F d, Y'), true);
|
$tpl->setVariable('ARTICLE_TITLE', date('l, F d, Y'), true);
|
||||||
$tpl->setVariable('ARTICLE_EXCERPT', '', true);
|
$tpl->setVariable('ARTICLE_EXCERPT', '', true);
|
||||||
$tpl->setVariable('ARTICLE_CONTENT', $doc->saveXML($node), true);
|
$tpl->setVariable('ARTICLE_CONTENT', $doc->saveHTML($node), true);
|
||||||
|
|
||||||
$tpl->setVariable('ARTICLE_AUTHOR', '', true);
|
$tpl->setVariable('ARTICLE_AUTHOR', '', true);
|
||||||
$tpl->setVariable('ARTICLE_SOURCE_LINK', $site_url, true);
|
$tpl->setVariable('ARTICLE_SOURCE_LINK', $site_url, true);
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Af_Fsckportal extends Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$article["content"] = $doc->saveXML();
|
$article["content"] = $doc->saveHTML();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,7 +364,7 @@ class Af_RedditImgur extends Plugin {
|
||||||
$node = $doc->getElementsByTagName('body')->item(0);
|
$node = $doc->getElementsByTagName('body')->item(0);
|
||||||
|
|
||||||
if ($node && $found) {
|
if ($node && $found) {
|
||||||
$article["content"] = $doc->saveXML($node);
|
$article["content"] = $doc->saveHTML($node);
|
||||||
} else if ($content_link) {
|
} else if ($content_link) {
|
||||||
$article = $this->readability($article, $content_link->getAttribute("href"), $doc, $xpath);
|
$article = $this->readability($article, $content_link->getAttribute("href"), $doc, $xpath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,7 +199,7 @@ class Af_Zz_ImgProxy extends Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($need_saving) $article["content"] = $doc->saveXML();
|
if ($need_saving) $article["content"] = $doc->saveHTML();
|
||||||
|
|
||||||
return $article;
|
return $article;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue