Fix naming conventions for the generate_enclosure functon
authorAntonio Ospite <ao2@ao2.it>
Tue, 17 May 2016 21:04:48 +0000 (23:04 +0200)
committerAntonio Ospite <ao2@ao2.it>
Fri, 20 May 2016 08:55:10 +0000 (10:55 +0200)
Use lowerCamel case for the function name, keep snake_case for the local
variable in the php code, and use a dash-separated case for the xsl
variable.

rss_converter_instagram.com.xsl
rss_converter_twitter.com.xsl
tweeper.php

index aaab2e8..c4fda61 100644 (file)
@@ -24,7 +24,7 @@
     xsl:extension-element-prefixes="php"
     exclude-result-prefixes="php">
 
     xsl:extension-element-prefixes="php"
     exclude-result-prefixes="php">
 
-    <xsl:param name="generateEnclosure"/>
+    <xsl:param name="generate-enclosure"/>
 
     <xsl:output method="xml" indent="yes"/>
 
 
     <xsl:output method="xml" indent="yes"/>
 
@@ -33,7 +33,7 @@
     </xsl:variable>
 
     <xsl:template match="display_src">
     </xsl:variable>
 
     <xsl:template match="display_src">
-        <xsl:value-of disable-output-escaping="yes" select="php:function('Tweeper::generate_enclosure', string(text()))"/>
+        <xsl:value-of disable-output-escaping="yes" select="php:function('Tweeper::generateEnclosure', string(text()))"/>
     </xsl:template>
 
     <xsl:variable name="user-name" select="//ProfilePage/user/username"/>
     </xsl:template>
 
     <xsl:variable name="user-name" select="//ProfilePage/user/username"/>
@@ -92,7 +92,7 @@
                 <a href="{$item-permalink}"><img src="{$item-content-image}" /></a>
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
                 <a href="{$item-permalink}"><img src="{$item-content-image}" /></a>
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
-            <xsl:if test="$generateEnclosure = 1">
+            <xsl:if test="$generate-enclosure = 1">
                 <xsl:apply-templates select="./display_src"/>
             </xsl:if>
         </item>
                 <xsl:apply-templates select="./display_src"/>
             </xsl:if>
         </item>
index 929f8b2..991d525 100644 (file)
@@ -24,7 +24,7 @@
     xsl:extension-element-prefixes="php"
     exclude-result-prefixes="php">
 
     xsl:extension-element-prefixes="php"
     exclude-result-prefixes="php">
 
-    <xsl:param name="generateEnclosure"/>
+    <xsl:param name="generate-enclosure"/>
 
     <xsl:output method="xml" indent="yes"/>
 
 
     <xsl:output method="xml" indent="yes"/>
 
@@ -33,7 +33,7 @@
     </xsl:variable>
 
     <xsl:template match="a[@data-expanded-url]">
     </xsl:variable>
 
     <xsl:template match="a[@data-expanded-url]">
-        <xsl:value-of disable-output-escaping="yes" select="php:function('Tweeper::generate_enclosure', string(./@data-expanded-url))"/>
+        <xsl:value-of disable-output-escaping="yes" 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"/>
     </xsl:template>
 
     <xsl:variable name="screen-name" select="//div[@class='user-actions btn-group not-following ']/@data-screen-name"/>
@@ -62,7 +62,7 @@
                 <xsl:copy-of select="$item-content/node()"/>
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
                 <xsl:copy-of select="$item-content/node()"/>
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
-            <xsl:if test="$generateEnclosure = 1">
+            <xsl:if test="$generate-enclosure = 1">
                 <xsl:apply-templates select="$item-content//a[@data-expanded-url]"/>
             </xsl:if>
         </item>
                 <xsl:apply-templates select="$item-content//a[@data-expanded-url]"/>
             </xsl:if>
         </item>
index 27be95d..f712c87 100644 (file)
@@ -110,7 +110,7 @@ class Tweeper {
   /**
    * Generate an RSS <enclosure/> element.
    */
   /**
    * Generate an RSS <enclosure/> element.
    */
-  public static function generate_enclosure($url) {
+  public static function generateEnclosure($url) {
     $supported_content_types = array(
       "application/ogg",
       "audio/aac",
     $supported_content_types = array(
       "application/ogg",
       "audio/aac",
@@ -203,7 +203,7 @@ class Tweeper {
 
     $xsltProcessor = new XSLTProcessor();
     $xsltProcessor->registerPHPFunctions();
 
     $xsltProcessor = new XSLTProcessor();
     $xsltProcessor->registerPHPFunctions();
-    $xsltProcessor->setParameter('', 'generateEnclosure', $this->generate_enclosure);
+    $xsltProcessor->setParameter('', 'generate-enclosure', $this->generate_enclosure);
     $xsltProcessor->importStylesheet($xslDoc);
 
     return $xsltProcessor;
     $xsltProcessor->importStylesheet($xslDoc);
 
     return $xsltProcessor;