From: Antonio Ospite <ao2@ao2.it> Date: Wed, 18 May 2016 20:32:06 +0000 (+0200) Subject: Return a DOMElement instead of a string in Tweeper::generateEnclosure() X-Git-Tag: v0.6~27 X-Git-Url: https://git.ao2.it/tweeper.git/commitdiff_plain/b7350069c36900359b8f26c6e9794f614a40b20e?ds=sidebyside Return a DOMElement instead of a string in Tweeper::generateEnclosure() This make the generated XML have proper indentation in case the <enclosure/> element gets added. --- diff --git a/rss_converter_instagram.com.xsl b/rss_converter_instagram.com.xsl index 5a64a57..f12ecbb 100644 --- a/rss_converter_instagram.com.xsl +++ b/rss_converter_instagram.com.xsl @@ -33,7 +33,7 @@ </xsl:variable> <xsl:template match="display_src"> - <xsl:value-of disable-output-escaping="yes" select="php:function('Tweeper::generateEnclosure', string(text()))"/> + <xsl:copy-of select="php:function('Tweeper::generateEnclosure', string(text()))"/> </xsl:template> <xsl:variable name="user-name" select="//ProfilePage/user/username"/> diff --git a/rss_converter_twitter.com.xsl b/rss_converter_twitter.com.xsl index 0701d5c..6ef86dd 100644 --- a/rss_converter_twitter.com.xsl +++ b/rss_converter_twitter.com.xsl @@ -33,7 +33,7 @@ </xsl:variable> <xsl:template match="a[@data-expanded-url]"> - <xsl:value-of disable-output-escaping="yes" select="php:function('Tweeper::generateEnclosure', string(./@data-expanded-url))"/> + <xsl:copy-of select="php:function('Tweeper::generateEnclosure', string(./@data-expanded-url))"/> </xsl:template> <xsl:variable name="screen-name" select="//div[@class='user-actions btn-group not-following ']/@data-screen-name"/> diff --git a/tweeper.php b/tweeper.php index d84094e..579aae1 100644 --- a/tweeper.php +++ b/tweeper.php @@ -156,9 +156,7 @@ class Tweeper { $enc->setAttribute('length', $url_info['download_content_length']); $enc->setAttribute('type', $url_info['content_type']); - $dom->appendChild($enc); - - return $dom->saveXML($enc); + return $enc; } /**