]> git.wh0rd.org Git - tt-rss.git/commitdiff
Use 'saveHTML' when generating HTML from a DOMDocument.
authorwn_ <invalid@email.com>
Sat, 9 Sep 2017 18:51:59 +0000 (13:51 -0500)
committerwn_ <invalid@email.com>
Sat, 9 Sep 2017 18:51:59 +0000 (13:51 -0500)
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.

16 files changed:
classes/feeditem/atom.php
plugins/af_comics/filters/af_comics_cad.php
plugins/af_comics/filters/af_comics_comicclass.php
plugins/af_comics/filters/af_comics_comicpress.php
plugins/af_comics/filters/af_comics_darklegacy.php
plugins/af_comics/filters/af_comics_dilbert.php
plugins/af_comics/filters/af_comics_explosm.php
plugins/af_comics/filters/af_comics_pa.php
plugins/af_comics/filters/af_comics_pvp.php
plugins/af_comics/filters/af_comics_tfd.php
plugins/af_comics/filters/af_comics_twp.php
plugins/af_comics/filters/af_comics_whomp.php
plugins/af_comics/init.php
plugins/af_fsckportal/init.php
plugins/af_redditimgur/init.php
plugins/af_zz_imgproxy/init.php

index 76d85b2a210267ff49f5f5ef1a8f2ae61d7f31fc..77cd448b862a8d61fafec8d75531f63d9ad245c2 100644 (file)
@@ -69,7 +69,7 @@ class FeedItem_Atom extends FeedItem_Common {
                                                $child = $content->childNodes->item($i);
 
                                                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);
 
                                                if ($child->hasChildNodes()) {
-                                                       return $this->doc->saveXML($child);
+                                                       return $this->doc->saveHTML($child);
                                                }
                                        }
                                }
@@ -197,4 +197,4 @@ class FeedItem_Atom extends FeedItem_Common {
                return $encs;
        }
 
-}
\ No newline at end of file
+}
index 6846f3cb0631b17ae97ac3cb8360a0311374b5cb..d2eb38cafce697ce589ac526cfe8200033139753 100644 (file)
@@ -25,7 +25,7 @@ class Af_Comics_Cad extends Af_ComicFilter {
                                        $basenode = $xpath->query('//div[@class="comicpage"]/a/img')->item(0);
 
                                        if ($basenode) {
-                                               $article["content"] = $doc->saveXML($basenode);
+                                               $article["content"] = $doc->saveHTML($basenode);
                                        }
                                }
 
@@ -36,4 +36,4 @@ class Af_Comics_Cad extends Af_ComicFilter {
 
                return false;
        }
-}
\ No newline at end of file
+}
index 56a5b9cf6ad5193106cd34270e07de5be514e47f..b4b3a962cdbd6642973038449370c774b3223668 100644 (file)
@@ -22,7 +22,7 @@ class Af_Comics_ComicClass extends Af_ComicFilter {
                                        $basenode = $xpath->query('//div[@class="comic"]')->item(0);
 
                                        if ($basenode) {
-                                               $article["content"] = $doc->saveXML($basenode);
+                                               $article["content"] = $doc->saveHTML($basenode);
                                        }
                                }
 
@@ -31,4 +31,4 @@ class Af_Comics_ComicClass extends Af_ComicFilter {
 
                return false;
        }
-}
\ No newline at end of file
+}
index 81994d90bddc082dec57743b22b925349c183901..51d9bab3bc2bcdf1a26f1028a263f708c3b34332 100644 (file)
@@ -27,7 +27,7 @@ class Af_Comics_ComicPress extends Af_ComicFilter {
                                        $basenode = $xpath->query('//div[@id="comic"]')->item(0);
 
                                        if ($basenode) {
-                                               $article["content"] = $doc->saveXML($basenode);
+                                               $article["content"] = $doc->saveHTML($basenode);
                                        }
                                }
 
@@ -36,4 +36,4 @@ class Af_Comics_ComicPress extends Af_ComicFilter {
 
                return false;
        }
-}
\ No newline at end of file
+}
index 33c1eca5cd1092c6d7767e872320213a759f3543..0882514d097f716fabd9c9974ae5089af38a2c7a 100644 (file)
@@ -26,7 +26,7 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter {
 
                                        if ($basenode) {
 
-                                               $article["content"] = $doc->saveXML($basenode);
+                                               $article["content"] = $doc->saveHTML($basenode);
                                        }
                                }
 
@@ -35,4 +35,4 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter {
 
                return false;
        }
-}
\ No newline at end of file
+}
index 565b44657c9c096d75889ccdda6a7ba4ed9e4ec0..a40f8a9ba3f295051aca2cc2a180ec970937caa9 100644 (file)
@@ -49,7 +49,7 @@ class Af_Comics_Dilbert extends Af_ComicFilter {
                                        }
 
                                        if ($basenode) {
-                                               $article["content"] = $doc->saveXML($basenode);
+                                               $article["content"] = $doc->saveHTML($basenode);
                                        }
 
                                        // Add comic title to article type if not empty (mostly Sunday strips)
index 35a2edd41f392d5822e758d5759a1142aa97a61a..c47014da4bd8962ba36edcd767d58de86989a789 100644 (file)
@@ -16,7 +16,7 @@ class Af_Comics_Explosm extends Af_ComicFilter {
                                        $basenode = $xpath->query('(//img[@id="main-comic"])')->item(0);
 
                                        if ($basenode) {
-                                               $article["content"] = $doc->saveXML($basenode);
+                                               $article["content"] = $doc->saveHTML($basenode);
                                        }
                                }
 
@@ -25,4 +25,4 @@ class Af_Comics_Explosm extends Af_ComicFilter {
 
                return false;
        }
-}
\ No newline at end of file
+}
index ae5cabec06ee482404c8d5618a70970c83f69640..e6558d8de8b2995fb0e306fc8116bcdf1f1b3966 100644 (file)
@@ -19,7 +19,7 @@ class Af_Comics_Pa extends Af_ComicFilter {
                                        $basenode = $xpath->query('(//div[@id="comicFrame"])')->item(0);
 
                                        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){
-                                               $article["content"] = $doc->saveXML($basenode);
+                                               $article["content"] = $doc->saveHTML($basenode);
                                        }
                                }
 
@@ -71,4 +71,4 @@ class Af_Comics_Pa extends Af_ComicFilter {
 
                return false;
        }
-}
\ No newline at end of file
+}
index 1a1ccab3dde42863e90a37cfa8d5d84037f6647f..cf0b79d78a40961ab60141a4f3a2af5cbb655590 100644 (file)
@@ -19,7 +19,7 @@ class Af_Comics_Pvp extends Af_ComicFilter {
                                        $basenode = $xpath->query('//section[@class="comic-art"]')->item(0);
 
                                        if ($basenode) {
-                                               $article["content"] = $doc->saveXML($basenode);
+                                               $article["content"] = $doc->saveHTML($basenode);
                                        }
                                }
 
@@ -28,4 +28,4 @@ class Af_Comics_Pvp extends Af_ComicFilter {
 
                return false;
        }
-}
\ No newline at end of file
+}
index 78792d25455f941f3b892eb26519f8c662a1fef1..376ec0714702682c8ed673fdba20d53fa18bf866 100644 (file)
@@ -21,7 +21,7 @@ class Af_Comics_Tfd extends Af_ComicFilter {
                                $basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0);
 
                                if ($basenode) {
-                                       $article["content"] = $doc->saveXML($basenode);
+                                       $article["content"] = $doc->saveHTML($basenode);
                                        return true;
                                }
                        }
@@ -29,4 +29,4 @@ class Af_Comics_Tfd extends Af_ComicFilter {
 
                return false;
        }
-}
\ No newline at end of file
+}
index 712d54a1dd789ed26b0765aa95821dea779cb3e8..f53b89b63a13fbc5c104273916bc523da3252e42 100644 (file)
@@ -17,7 +17,7 @@ class Af_Comics_Twp extends Af_ComicFilter {
                                        $basenode = $xpath->query("//td/center/img")->item(0);
 
                                        if ($basenode) {
-                                               $article["content"] = $doc->saveXML($basenode);
+                                               $article["content"] = $doc->saveHTML($basenode);
                                        }
                                }
 
@@ -26,4 +26,4 @@ class Af_Comics_Twp extends Af_ComicFilter {
 
                return false;
        }
-}
\ No newline at end of file
+}
index 3c2e0b0c7dbd0bcf5f1cbbe5f4c268593d7705d6..d574bf5d355f4acda542bceee93333ce3ddef27e 100644 (file)
@@ -24,7 +24,7 @@ class Af_Comics_Whomp extends Af_ComicFilter {
                                $basenode = $xpath->query('//img[@id="cc-comic"]')->item(0);
 
                                if ($basenode) {
-                                       $article["content"] = $doc->saveXML($basenode);
+                                       $article["content"] = $doc->saveHTML($basenode);
                                }
                        }
 
@@ -33,4 +33,4 @@ class Af_Comics_Whomp extends Af_ComicFilter {
 
                return false;
        }
-}
\ No newline at end of file
+}
index 09e9033794875c1f7ce3b60b58c24ebcb08809df..6bd3c23e202eebc6dfeb677730b47f584dc54de9 100644 (file)
@@ -127,7 +127,7 @@ class Af_Comics extends Plugin {
                                                $tpl->setVariable('ARTICLE_LINK', $article_link, true);
                                                $tpl->setVariable('ARTICLE_TITLE', date('l, F d, Y'), 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_SOURCE_LINK', $site_url, true);
@@ -153,4 +153,4 @@ class Af_Comics extends Plugin {
                return 2;
        }
 
-}
\ No newline at end of file
+}
index 40ace5022838eab6897b8b1cf61fe1c79dc714bc..0fa58e9ed99c72576e0d9c3e424da967d15cd7e3 100644 (file)
@@ -37,7 +37,7 @@ class Af_Fsckportal extends Plugin {
                                        }
                                }
 
-                               $article["content"] = $doc->saveXML();
+                               $article["content"] = $doc->saveHTML();
 
                }
 
@@ -48,4 +48,4 @@ class Af_Fsckportal extends Plugin {
                return 2;
        }
 
-}
\ No newline at end of file
+}
index d08dfa7a66c420bac9de158f8a3a36bf376c9c84..ac23a4fa34685f0338e94dceb754a45af5f99e7f 100755 (executable)
@@ -364,7 +364,7 @@ class Af_RedditImgur extends Plugin {
                        $node = $doc->getElementsByTagName('body')->item(0);
 
                        if ($node && $found) {
-                               $article["content"] = $doc->saveXML($node);
+                               $article["content"] = $doc->saveHTML($node);
                        } else if ($content_link) {
                                $article = $this->readability($article, $content_link->getAttribute("href"), $doc, $xpath);
                        }
index c3b3f7fd55247f37e80af4a8e0dc6d7471d68ea9..41fec4ac54a474d0a55d673112c438a55e929bb8 100644 (file)
@@ -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;
        }
@@ -257,4 +257,4 @@ class Af_Zz_ImgProxy extends Plugin {
        function api_version() {
                return 2;
        }
-}
\ No newline at end of file
+}