Use php:functionString() in the stylesheets where appropriate
authorAntonio Ospite <ao2@ao2.it>
Mon, 23 May 2016 13:28:07 +0000 (15:28 +0200)
committerAntonio Ospite <ao2@ao2.it>
Mon, 23 May 2016 13:28:07 +0000 (15:28 +0200)
Instead of converting to string in XSL and then calling php:function(),
use directly php:functionString() when calling PHP functions which
actually expect a string argument.

Besides possible performance improvements, this is done mainly for
readability.

rss_converter_dilbert.com.xsl
rss_converter_instagram.com.xsl
rss_converter_twitter.com.xsl

index 85f6648..b6d1975 100644 (file)
@@ -75,7 +75,7 @@
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
             <xsl:if test="$generate-enclosure = 1">
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
             <xsl:if test="$generate-enclosure = 1">
-                <xsl:copy-of select="php:function('Tweeper::generateEnclosure', string($picture-url))"/>
+                <xsl:copy-of select="php:functionString('Tweeper::generateEnclosure', $picture-url)"/>
             </xsl:if>
         </item>
     </xsl:template>
             </xsl:if>
         </item>
     </xsl:template>
index 84fbd81..3efba4d 100644 (file)
@@ -89,7 +89,7 @@
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
             <xsl:if test="$generate-enclosure = 1">
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
             <xsl:if test="$generate-enclosure = 1">
-                <xsl:copy-of select="php:function('Tweeper::generateEnclosure', string($item-content-image))"/>
+                <xsl:copy-of select="php:functionString('Tweeper::generateEnclosure', $item-content-image)"/>
             </xsl:if>
         </item>
     </xsl:template>
             </xsl:if>
         </item>
     </xsl:template>
index 857cf31..c154141 100644 (file)
     </xsl:template>
 
     <xsl:template match="a[@data-expanded-url]" mode="enclosure">
     </xsl:template>
 
     <xsl:template match="a[@data-expanded-url]" mode="enclosure">
-        <xsl:copy-of select="php:function('Tweeper::generateEnclosure', string(./@data-expanded-url))"/>
+        <xsl:copy-of select="php:functionString('Tweeper::generateEnclosure', ./@data-expanded-url)"/>
     </xsl:template>
 
     <xsl:template match="div[@data-image-url]" mode="enclosure">
     </xsl:template>
 
     <xsl:template match="div[@data-image-url]" mode="enclosure">
-        <xsl:copy-of select="php:function('Tweeper::generateEnclosure', string(concat(./@data-image-url, ':orig')))"/>
+        <xsl:copy-of select="php:functionString('Tweeper::generateEnclosure', concat(./@data-image-url, ':orig'))"/>
     </xsl:template>
 
     <xsl:variable name="screen-name" select="//div[@class='user-actions btn-group not-following ']/@data-screen-name"/>
     </xsl:template>
 
     <xsl:variable name="screen-name" select="//div[@class='user-actions btn-group not-following ']/@data-screen-name"/>
                 -->
                 <xsl:variable
                     name="processed-title"
                 -->
                 <xsl:variable
                     name="processed-title"
-                    select="php:function('preg_replace', '@((?&lt;!\()(?:http[s]?://|pic.twitter.com))@', ' \1', string($item-content))"/>
+                    select="php:functionString('preg_replace', '@((?&lt;!\()(?:http[s]?://|pic.twitter.com))@', ' \1', $item-content)"/>
                 <!-- Also strip &nbsp; and &hellip; -->
                 <xsl:value-of select="normalize-space(translate($processed-title, '&#xA0;&#x2026;', ''))"/>
             </title>
                 <!-- Also strip &nbsp; and &hellip; -->
                 <xsl:value-of select="normalize-space(translate($processed-title, '&#xA0;&#x2026;', ''))"/>
             </title>