]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #611 from wallabag/fix-french-locale
authorNicolas Lœuillet <nicolas@loeuillet.org>
Mon, 7 Apr 2014 13:15:42 +0000 (15:15 +0200)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Mon, 7 Apr 2014 13:15:42 +0000 (15:15 +0200)
update french locale, thx to @goofy-bz and @Draky50110 #596

inc/3rdparty/libraries/feedwriter/FeedItem.php
inc/3rdparty/libraries/feedwriter/FeedWriter.php

index 7e467ce8562a1a47618a658d79a74337df59042e..3487423f05eadc18fe16fbaf832ea43cabccdbb6 100644 (file)
     */\r
     public function setDescription($description) \r
     {\r
-        $tag = 'description'; \r
-        $this->setElement($tag, $description);\r
+        $this->setElement('description', $description);\r
     }\r
     \r
     /**\r
index 3f95372dc34dba3b6326dffa1aae4b8b4ad1894a..df4c8b4b7981253c841f1950066f4b6115e0b7a3 100755 (executable)
@@ -18,424 +18,423 @@ define('JSONP', 3, true);
  */\r
  class FeedWriter\r
  {\r
-        private $self          = null;     // self URL - http://feed2.w3.org/docs/warning/MissingAtomSelfLink.html\r
-        private $hubs          = array();  // PubSubHubbub hubs\r
-        private $channels      = array();  // Collection of channel elements\r
-        private $items         = array();  // Collection of items as object of FeedItem class.\r
-        private $data          = array();  // Store some other version wise data\r
-        private $CDATAEncoding = array();  // The tag names which have to encoded as CDATA\r
-        private $xsl                   = null;         // stylesheet to render RSS (used by Chrome)\r
-        private $json                  = null;         // JSON object\r
-\r
-        private $version   = null;\r
-\r
-       /**\r
-       * Constructor\r
-       *\r
-       * @param    constant    the version constant (RSS2 or JSON).\r
-       */\r
-       function __construct($version = RSS2)\r
-       {\r
-               $this->version = $version;\r
-\r
-               // Setting default value for assential channel elements\r
-               $this->channels['title']        = $version . ' Feed';\r
-               $this->channels['link']         = 'http://www.ajaxray.com/blog';\r
-\r
-               //Tag names to encode in CDATA\r
-               $this->CDATAEncoding = array('description', 'content:encoded', 'content', 'subtitle', 'summary');\r
-       }\r
-\r
-       public function setFormat($format) {\r
-               $this->version = $format;\r
-       }\r
-\r
-       // Start # public functions ---------------------------------------------\r
-\r
-       /**\r
-       * Set a channel element\r
-       * @access   public\r
-       * @param    srting  name of the channel tag\r
-       * @param    string  content of the channel tag\r
-       * @return   void\r
-       */\r
-       public function setChannelElement($elementName, $content)\r
-       {\r
-               $this->channels[$elementName] = $content ;\r
-       }\r
-\r
-       /**\r
-       * Set multiple channel elements from an array. Array elements\r
-       * should be 'channelName' => 'channelContent' format.\r
-       *\r
-       * @access   public\r
-       * @param    array   array of channels\r
-       * @return   void\r
-       */\r
-       public function setChannelElementsFromArray($elementArray)\r
-       {\r
-               if(! is_array($elementArray)) return;\r
-               foreach ($elementArray as $elementName => $content)\r
-               {\r
-                       $this->setChannelElement($elementName, $content);\r
-               }\r
-       }\r
-\r
-       /**\r
-       * Genarate the actual RSS/JSON file\r
-       *\r
-       * @access   public\r
-       * @return   void\r
-       */\r
-       public function genarateFeed()\r
-       {\r
-               if ($this->version == RSS2) {\r
-//                     header('Content-type: text/xml; charset=UTF-8');\r
-                       // this line prevents Chrome 20 from prompting download\r
-                       // used by Google: https://news.google.com/news/feeds?ned=us&topic=b&output=rss\r
-//                     header('X-content-type-options: nosniff');\r
-               } elseif ($this->version == JSON) {\r
-//                     header('Content-type: application/json; charset=UTF-8');\r
-                       $this->json = new stdClass();\r
-               } elseif ($this->version == JSONP) {\r
-//                     header('Content-type: application/javascript; charset=UTF-8');\r
-                       $this->json = new stdClass();\r
-               }\r
-               $this->printHead();\r
-               $this->printChannels();\r
-               $this->printItems();\r
-               $this->printTale();\r
-               if ($this->version == JSON || $this->version == JSONP) {\r
-                       echo json_encode($this->json);\r
-               }\r
-       }\r
-\r
-       /**\r
-       * Create a new FeedItem.\r
-       *\r
-       * @access   public\r
-       * @return   object  instance of FeedItem class\r
-       */\r
-       public function createNewItem()\r
-       {\r
-               $Item = new FeedItem($this->version);\r
-               return $Item;\r
-       }\r
-\r
-       /**\r
-       * Add a FeedItem to the main class\r
-       *\r
-       * @access   public\r
-       * @param    object  instance of FeedItem class\r
-       * @return   void\r
-       */\r
-       public function addItem($feedItem)\r
-       {\r
-               $this->items[] = $feedItem;\r
-       }\r
-\r
-       // Wrapper functions -------------------------------------------------------------------\r
-\r
-       /**\r
-       * Set the 'title' channel element\r
-       *\r
-       * @access   public\r
-       * @param    srting  value of 'title' channel tag\r
-       * @return   void\r
-       */\r
-       public function setTitle($title)\r
-       {\r
-               $this->setChannelElement('title', $title);\r
-       }\r
-\r
-       /**\r
-       * Add a hub to the channel element\r
-       *\r
-       * @access   public\r
-       * @param    string URL\r
-       * @return   void\r
-       */\r
-       public function addHub($hub)\r
-       {\r
-               $this->hubs[] = $hub;\r
-       }\r
-\r
-       /**\r
-       * Set XSL URL\r
-       *\r
-       * @access   public\r
-       * @param    string URL\r
-       * @return   void\r
-       */\r
-       public function setXsl($xsl)\r
-       {\r
-               $this->xsl = $xsl;\r
-       }\r
-\r
-       /**\r
-       * Set self URL\r
-       *\r
-       * @access   public\r
-       * @param    string URL\r
-       * @return   void\r
-       */\r
-       public function setSelf($self)\r
-       {\r
-               $this->self = $self;\r
-       }\r
-\r
-       /**\r
-       * Set the 'description' channel element\r
-       *\r
-       * @access   public\r
-       * @param    srting  value of 'description' channel tag\r
-       * @return   void\r
-       */\r
-       public function setDescription($desciption)\r
-       {\r
-               $tag = 'description';\r
-               $this->setChannelElement($tag, $desciption);\r
-       }\r
-\r
-       /**\r
-       * Set the 'link' channel element\r
-       *\r
-       * @access   public\r
-       * @param    srting  value of 'link' channel tag\r
-       * @return   void\r
-       */\r
-       public function setLink($link)\r
-       {\r
-               $this->setChannelElement('link', $link);\r
-       }\r
-\r
-       /**\r
-       * Set the 'image' channel element\r
-       *\r
-       * @access   public\r
-       * @param    srting  title of image\r
-       * @param    srting  link url of the imahe\r
-       * @param    srting  path url of the image\r
-       * @return   void\r
-       */\r
-       public function setImage($title, $link, $url)\r
-       {\r
-               $this->setChannelElement('image', array('title'=>$title, 'link'=>$link, 'url'=>$url));\r
-       }\r
-\r
-       // End # public functions ----------------------------------------------\r
-\r
-       // Start # private functions ----------------------------------------------\r
-\r
-       /**\r
-       * Prints the xml and rss namespace\r
-       *\r
-       * @access   private\r
-       * @return   void\r
-       */\r
-       private function printHead()\r
-       {\r
-               if ($this->version == RSS2)\r
-               {\r
-                       $out  = '<?xml version="1.0" encoding="utf-8"?>'."\n";\r
-                       if ($this->xsl) $out .= '<?xml-stylesheet type="text/xsl" href="'.htmlspecialchars($this->xsl).'"?>' . PHP_EOL;\r
-                       $out .= '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/">' . PHP_EOL;\r
-                       echo $out;\r
-               }\r
-               elseif ($this->version == JSON || $this->version == JSONP)\r
-               {\r
-                       $this->json->rss = array('@attributes' => array('version' => '2.0'));\r
-               }\r
-       }\r
-\r
-       /**\r
-       * Closes the open tags at the end of file\r
-       *\r
-       * @access   private\r
-       * @return   void\r
-       */\r
-       private function printTale()\r
-       {\r
-               if ($this->version == RSS2)\r
-               {\r
-                       echo '</channel>',PHP_EOL,'</rss>';\r
-               }\r
-               // do nothing for JSON\r
-       }\r
-\r
-       /**\r
-       * Creates a single node as xml format\r
-       *\r
-       * @access   private\r
-       * @param    string  name of the tag\r
-       * @param    mixed   tag value as string or array of nested tags in 'tagName' => 'tagValue' format\r
-       * @param    array   Attributes(if any) in 'attrName' => 'attrValue' format\r
-       * @return   string  formatted xml tag\r
-       */\r
-       private function makeNode($tagName, $tagContent, $attributes = null)\r
-       {\r
-               if ($this->version == RSS2)\r
-               {\r
-                       $nodeText = '';\r
-                       $attrText = '';\r
-                       if (is_array($attributes))\r
-                       {\r
-                               foreach ($attributes as $key => $value)\r
-                               {\r
-                                       $attrText .= " $key=\"$value\" ";\r
-                               }\r
-                       }\r
-                       $nodeText .= "<{$tagName}{$attrText}>";\r
-                       if (is_array($tagContent))\r
-                       {\r
-                               foreach ($tagContent as $key => $value)\r
-                               {\r
-                                       $nodeText .= $this->makeNode($key, $value);\r
-                               }\r
-                       }\r
-                       else\r
-                       {\r
-                               //$nodeText .= (in_array($tagName, $this->CDATAEncoding))? $tagContent : htmlentities($tagContent);\r
-                               $nodeText .= htmlspecialchars($tagContent);\r
-                       }\r
-                       //$nodeText .= (in_array($tagName, $this->CDATAEncoding))? "]]></$tagName>" : "</$tagName>";\r
-                       $nodeText .= "</$tagName>";\r
-                       return $nodeText . PHP_EOL;\r
-               }\r
-               elseif ($this->version == JSON || $this->version == JSONP)\r
-               {\r
-                       $tagName = (string)$tagName;\r
-                       $tagName = strtr($tagName, ':', '_');\r
-                       $node = null;\r
-                       if (!$tagContent && is_array($attributes) && count($attributes))\r
-                       {\r
-                               $node = array('@attributes' => $this->json_keys($attributes));\r
-                       } else {\r
-                               if (is_array($tagContent)) {\r
-                                       $node = $this->json_keys($tagContent);\r
-                               } else {\r
-                                       $node = $tagContent;\r
-                               }\r
-                       }\r
-                       return $node;\r
-               }\r
-               return ''; // should not get here\r
-       }\r
-\r
-       private function json_keys(array $array) {\r
-               $new = array();\r
-               foreach ($array as $key => $val) {\r
-                       if (is_string($key)) $key = strtr($key, ':', '_');\r
-                       if (is_array($val)) {\r
-                               $new[$key] = $this->json_keys($val);\r
-                       } else {\r
-                               $new[$key] = $val;\r
-                       }\r
-               }\r
-               return $new;\r
-       }\r
-\r
-       /**\r
-       * @desc     Print channels\r
-       * @access   private\r
-       * @return   void\r
-       */\r
-       private function printChannels()\r
-       {\r
-               //Start channel tag\r
-               if ($this->version == RSS2) {\r
-                       echo '<channel>' . PHP_EOL;\r
-                       // add hubs\r
-                       foreach ($this->hubs as $hub) {\r
-                               //echo $this->makeNode('link', '', array('rel'=>'hub', 'href'=>$hub, 'xmlns'=>'http://www.w3.org/2005/Atom'));\r
-                               echo '<link rel="hub"  href="'.htmlspecialchars($hub).'" xmlns="http://www.w3.org/2005/Atom" />' . PHP_EOL;\r
-                       }\r
-                       // add self\r
-                       if (isset($this->self)) {\r
-                               //echo $this->makeNode('link', '', array('rel'=>'self', 'href'=>$this->self, 'xmlns'=>'http://www.w3.org/2005/Atom'));\r
-                               echo '<link rel="self" href="'.htmlspecialchars($this->self).'" xmlns="http://www.w3.org/2005/Atom" />' . PHP_EOL;\r
-                       }\r
-                       //Print Items of channel\r
-                       foreach ($this->channels as $key => $value)\r
-                       {\r
-                               echo $this->makeNode($key, $value);\r
-                       }\r
-               } elseif ($this->version == JSON || $this->version == JSONP) {\r
-                       $this->json->rss['channel'] = (object)$this->json_keys($this->channels);\r
-               }\r
-       }\r
-\r
-       /**\r
-       * Prints formatted feed items\r
-       *\r
-       * @access   private\r
-       * @return   void\r
-       */\r
-       private function printItems()\r
-       {\r
-               foreach ($this->items as $item) {\r
-                       $itemElements = $item->getElements();\r
-\r
-                       echo $this->startItem();\r
-\r
-                       if ($this->version == JSON || $this->version == JSONP) {\r
-                               $json_item = array();\r
-                       }\r
-\r
-                       foreach ($itemElements as $thisElement) {\r
-                               foreach ($thisElement as $instance) {\r
-                                       if ($this->version == RSS2) {\r
-                                               echo $this->makeNode($instance['name'], $instance['content'], $instance['attributes']);\r
-                                       } elseif ($this->version == JSON || $this->version == JSONP) {\r
-                                               $_json_node = $this->makeNode($instance['name'], $instance['content'], $instance['attributes']);\r
-                                               if (count($thisElement) > 1) {\r
-                                                       $json_item[strtr($instance['name'], ':', '_')][] = $_json_node;\r
-                                               } else {\r
-                                                       $json_item[strtr($instance['name'], ':', '_')] = $_json_node;\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-                       echo $this->endItem();\r
-                       if ($this->version == JSON || $this->version == JSONP) {\r
-                               if (count($this->items) > 1) {\r
-                                       $this->json->rss['channel']->item[] = $json_item;\r
-                               } else {\r
-                                       $this->json->rss['channel']->item = $json_item;\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       /**\r
-       * Make the starting tag of channels\r
-       *\r
-       * @access   private\r
-       * @return   void\r
-       */\r
-       private function startItem()\r
-       {\r
-               if ($this->version == RSS2)\r
-               {\r
-                       echo '<item>' . PHP_EOL;\r
-               }\r
-               // nothing for JSON\r
-       }\r
-\r
-       /**\r
-       * Closes feed item tag\r
-       *\r
-       * @access   private\r
-       * @return   void\r
-       */\r
-       private function endItem()\r
-       {\r
-               if ($this->version == RSS2)\r
-               {\r
-                       echo '</item>' . PHP_EOL;\r
-               }\r
-               // nothing for JSON\r
-       }\r
-\r
-       // End # private functions ----------------------------------------------\r
+     private $self          = null;     // self URL - http://feed2.w3.org/docs/warning/MissingAtomSelfLink.html\r
+     private $hubs          = array();  // PubSubHubbub hubs\r
+     private $channels      = array();  // Collection of channel elements\r
+     private $items         = array();  // Collection of items as object of FeedItem class.\r
+     private $data          = array();  // Store some other version wise data\r
+     private $CDATAEncoding = array();  // The tag names which have to encoded as CDATA\r
+     private $xsl            = null;        // stylesheet to render RSS (used by Chrome)\r
+     private $json            = null;        // JSON object\r
+\r
+     private $version   = null;\r
+\r
+    /**\r
+    * Constructor\r
+    *\r
+    * @param    constant    the version constant (RSS2 or JSON).\r
+    */\r
+    function __construct($version = RSS2)\r
+    {\r
+        $this->version = $version;\r
+\r
+        // Setting default value for assential channel elements\r
+        $this->channels['title']        = $version . ' Feed';\r
+        $this->channels['link']         = 'http://www.ajaxray.com/blog';\r
+\r
+        //Tag names to encode in CDATA\r
+        $this->CDATAEncoding = array('description', 'content:encoded', 'content', 'subtitle', 'summary');\r
+    }\r
+\r
+    public function setFormat($format) {\r
+        $this->version = $format;\r
+    }\r
+\r
+    // Start # public functions ---------------------------------------------\r
+\r
+    /**\r
+    * Set a channel element\r
+    * @access   public\r
+    * @param    srting  name of the channel tag\r
+    * @param    string  content of the channel tag\r
+    * @return   void\r
+    */\r
+    public function setChannelElement($elementName, $content)\r
+    {\r
+        $this->channels[$elementName] = $content ;\r
+    }\r
+\r
+    /**\r
+    * Set multiple channel elements from an array. Array elements\r
+    * should be 'channelName' => 'channelContent' format.\r
+    *\r
+    * @access   public\r
+    * @param    array   array of channels\r
+    * @return   void\r
+    */\r
+    public function setChannelElementsFromArray($elementArray)\r
+    {\r
+        if(! is_array($elementArray)) return;\r
+        foreach ($elementArray as $elementName => $content)\r
+        {\r
+            $this->setChannelElement($elementName, $content);\r
+        }\r
+    }\r
+\r
+    /**\r
+    * Genarate the actual RSS/JSON file\r
+    *\r
+    * @access   public\r
+    * @return   void\r
+    */\r
+    public function genarateFeed()\r
+    {\r
+        if ($this->version == RSS2) {\r
+//             header('Content-type: text/xml; charset=UTF-8');\r
+            // this line prevents Chrome 20 from prompting download\r
+            // used by Google: https://news.google.com/news/feeds?ned=us&topic=b&output=rss\r
+//             header('X-content-type-options: nosniff');\r
+        } elseif ($this->version == JSON) {\r
+//             header('Content-type: application/json; charset=UTF-8');\r
+            $this->json = new stdClass();\r
+        } elseif ($this->version == JSONP) {\r
+//             header('Content-type: application/javascript; charset=UTF-8');\r
+            $this->json = new stdClass();\r
+        }\r
+        $this->printHead();\r
+        $this->printChannels();\r
+        $this->printItems();\r
+        $this->printTale();\r
+        if ($this->version == JSON || $this->version == JSONP) {\r
+            echo json_encode($this->json);\r
+        }\r
+    }\r
+\r
+    /**\r
+    * Create a new FeedItem.\r
+    *\r
+    * @access   public\r
+    * @return   object  instance of FeedItem class\r
+    */\r
+    public function createNewItem()\r
+    {\r
+        $Item = new FeedItem($this->version);\r
+        return $Item;\r
+    }\r
+\r
+    /**\r
+    * Add a FeedItem to the main class\r
+    *\r
+    * @access   public\r
+    * @param    object  instance of FeedItem class\r
+    * @return   void\r
+    */\r
+    public function addItem($feedItem)\r
+    {\r
+        $this->items[] = $feedItem;\r
+    }\r
+\r
+    // Wrapper functions -------------------------------------------------------------------\r
+\r
+    /**\r
+    * Set the 'title' channel element\r
+    *\r
+    * @access   public\r
+    * @param    srting  value of 'title' channel tag\r
+    * @return   void\r
+    */\r
+    public function setTitle($title)\r
+    {\r
+        $this->setChannelElement('title', $title);\r
+    }\r
+\r
+    /**\r
+    * Add a hub to the channel element\r
+    *\r
+    * @access   public\r
+    * @param    string URL\r
+    * @return   void\r
+    */\r
+    public function addHub($hub)\r
+    {\r
+        $this->hubs[] = $hub;\r
+    }\r
+\r
+    /**\r
+    * Set XSL URL\r
+    *\r
+    * @access   public\r
+    * @param    string URL\r
+    * @return   void\r
+    */\r
+    public function setXsl($xsl)\r
+    {\r
+        $this->xsl = $xsl;\r
+    }\r
+\r
+    /**\r
+    * Set self URL\r
+    *\r
+    * @access   public\r
+    * @param    string URL\r
+    * @return   void\r
+    */\r
+    public function setSelf($self)\r
+    {\r
+        $this->self = $self;\r
+    }\r
+\r
+    /**\r
+    * Set the 'description' channel element\r
+    *\r
+    * @access   public\r
+    * @param    srting  value of 'description' channel tag\r
+    * @return   void\r
+    */\r
+    public function setDescription($description)\r
+    {\r
+        $this->setChannelElement('description', $description);\r
+    }\r
+\r
+    /**\r
+    * Set the 'link' channel element\r
+    *\r
+    * @access   public\r
+    * @param    srting  value of 'link' channel tag\r
+    * @return   void\r
+    */\r
+    public function setLink($link)\r
+    {\r
+        $this->setChannelElement('link', $link);\r
+    }\r
+\r
+    /**\r
+    * Set the 'image' channel element\r
+    *\r
+    * @access   public\r
+    * @param    srting  title of image\r
+    * @param    srting  link url of the imahe\r
+    * @param    srting  path url of the image\r
+    * @return   void\r
+    */\r
+    public function setImage($title, $link, $url)\r
+    {\r
+        $this->setChannelElement('image', array('title'=>$title, 'link'=>$link, 'url'=>$url));\r
+    }\r
+\r
+    // End # public functions ----------------------------------------------\r
+\r
+    // Start # private functions ----------------------------------------------\r
+\r
+    /**\r
+    * Prints the xml and rss namespace\r
+    *\r
+    * @access   private\r
+    * @return   void\r
+    */\r
+    private function printHead()\r
+    {\r
+        if ($this->version == RSS2)\r
+        {\r
+            $out  = '<?xml version="1.0" encoding="utf-8"?>'."\n";\r
+            if ($this->xsl) $out .= '<?xml-stylesheet type="text/xsl" href="'.htmlspecialchars($this->xsl).'"?>' . PHP_EOL;\r
+            $out .= '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/">' . PHP_EOL;\r
+            echo $out;\r
+        }\r
+        elseif ($this->version == JSON || $this->version == JSONP)\r
+        {\r
+            $this->json->rss = array('@attributes' => array('version' => '2.0'));\r
+        }\r
+    }\r
+\r
+    /**\r
+    * Closes the open tags at the end of file\r
+    *\r
+    * @access   private\r
+    * @return   void\r
+    */\r
+    private function printTale()\r
+    {\r
+        if ($this->version == RSS2)\r
+        {\r
+            echo '</channel>',PHP_EOL,'</rss>';\r
+        }\r
+        // do nothing for JSON\r
+    }\r
+\r
+    /**\r
+    * Creates a single node as xml format\r
+    *\r
+    * @access   private\r
+    * @param    string  name of the tag\r
+    * @param    mixed   tag value as string or array of nested tags in 'tagName' => 'tagValue' format\r
+    * @param    array   Attributes(if any) in 'attrName' => 'attrValue' format\r
+    * @return   string  formatted xml tag\r
+    */\r
+    private function makeNode($tagName, $tagContent, $attributes = null)\r
+    {\r
+        if ($this->version == RSS2)\r
+        {\r
+            $nodeText = '';\r
+            $attrText = '';\r
+            if (is_array($attributes))\r
+            {\r
+                foreach ($attributes as $key => $value)\r
+                {\r
+                    $attrText .= " $key=\"$value\" ";\r
+                }\r
+            }\r
+            $nodeText .= "<{$tagName}{$attrText}>";\r
+            if (is_array($tagContent))\r
+            {\r
+                foreach ($tagContent as $key => $value)\r
+                {\r
+                    $nodeText .= $this->makeNode($key, $value);\r
+                }\r
+            }\r
+            else\r
+            {\r
+                //$nodeText .= (in_array($tagName, $this->CDATAEncoding))? $tagContent : htmlentities($tagContent);\r
+                $nodeText .= htmlspecialchars($tagContent);\r
+            }\r
+            //$nodeText .= (in_array($tagName, $this->CDATAEncoding))? "]]></$tagName>" : "</$tagName>";\r
+            $nodeText .= "</$tagName>";\r
+            return $nodeText . PHP_EOL;\r
+        }\r
+        elseif ($this->version == JSON || $this->version == JSONP)\r
+        {\r
+            $tagName = (string)$tagName;\r
+            $tagName = strtr($tagName, ':', '_');\r
+            $node = null;\r
+            if (!$tagContent && is_array($attributes) && count($attributes))\r
+            {\r
+                $node = array('@attributes' => $this->json_keys($attributes));\r
+            } else {\r
+                if (is_array($tagContent)) {\r
+                    $node = $this->json_keys($tagContent);\r
+                } else {\r
+                    $node = $tagContent;\r
+                }\r
+            }\r
+            return $node;\r
+        }\r
+        return ''; // should not get here\r
+    }\r
+\r
+    private function json_keys(array $array) {\r
+        $new = array();\r
+        foreach ($array as $key => $val) {\r
+            if (is_string($key)) $key = strtr($key, ':', '_');\r
+            if (is_array($val)) {\r
+                $new[$key] = $this->json_keys($val);\r
+            } else {\r
+                $new[$key] = $val;\r
+            }\r
+        }\r
+        return $new;\r
+    }\r
+\r
+    /**\r
+    * @desc     Print channels\r
+    * @access   private\r
+    * @return   void\r
+    */\r
+    private function printChannels()\r
+    {\r
+        //Start channel tag\r
+        if ($this->version == RSS2) {\r
+            echo '<channel>' . PHP_EOL;\r
+            // add hubs\r
+            foreach ($this->hubs as $hub) {\r
+                //echo $this->makeNode('link', '', array('rel'=>'hub', 'href'=>$hub, 'xmlns'=>'http://www.w3.org/2005/Atom'));\r
+                echo '<link rel="hub"  href="'.htmlspecialchars($hub).'" xmlns="http://www.w3.org/2005/Atom" />' . PHP_EOL;\r
+            }\r
+            // add self\r
+            if (isset($this->self)) {\r
+                //echo $this->makeNode('link', '', array('rel'=>'self', 'href'=>$this->self, 'xmlns'=>'http://www.w3.org/2005/Atom'));\r
+                echo '<link rel="self" href="'.htmlspecialchars($this->self).'" xmlns="http://www.w3.org/2005/Atom" />' . PHP_EOL;\r
+            }\r
+            //Print Items of channel\r
+            foreach ($this->channels as $key => $value)\r
+            {\r
+                echo $this->makeNode($key, $value);\r
+            }\r
+        } elseif ($this->version == JSON || $this->version == JSONP) {\r
+            $this->json->rss['channel'] = (object)$this->json_keys($this->channels);\r
+        }\r
+    }\r
+\r
+    /**\r
+    * Prints formatted feed items\r
+    *\r
+    * @access   private\r
+    * @return   void\r
+    */\r
+    private function printItems()\r
+    {\r
+        foreach ($this->items as $item) {\r
+            $itemElements = $item->getElements();\r
+\r
+            echo $this->startItem();\r
+\r
+            if ($this->version == JSON || $this->version == JSONP) {\r
+                $json_item = array();\r
+            }\r
+\r
+            foreach ($itemElements as $thisElement) {\r
+                foreach ($thisElement as $instance) {\r
+                    if ($this->version == RSS2) {\r
+                        echo $this->makeNode($instance['name'], $instance['content'], $instance['attributes']);\r
+                    } elseif ($this->version == JSON || $this->version == JSONP) {\r
+                        $_json_node = $this->makeNode($instance['name'], $instance['content'], $instance['attributes']);\r
+                        if (count($thisElement) > 1) {\r
+                            $json_item[strtr($instance['name'], ':', '_')][] = $_json_node;\r
+                        } else {\r
+                            $json_item[strtr($instance['name'], ':', '_')] = $_json_node;\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+            echo $this->endItem();\r
+            if ($this->version == JSON || $this->version == JSONP) {\r
+                if (count($this->items) > 1) {\r
+                    $this->json->rss['channel']->item[] = $json_item;\r
+                } else {\r
+                    $this->json->rss['channel']->item = $json_item;\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+    * Make the starting tag of channels\r
+    *\r
+    * @access   private\r
+    * @return   void\r
+    */\r
+    private function startItem()\r
+    {\r
+        if ($this->version == RSS2)\r
+        {\r
+            echo '<item>' . PHP_EOL;\r
+        }\r
+        // nothing for JSON\r
+    }\r
+\r
+    /**\r
+    * Closes feed item tag\r
+    *\r
+    * @access   private\r
+    * @return   void\r
+    */\r
+    private function endItem()\r
+    {\r
+        if ($this->version == RSS2)\r
+        {\r
+            echo '</item>' . PHP_EOL;\r
+        }\r
+        // nothing for JSON\r
+    }\r
+\r
+    // End # private functions ----------------------------------------------\r
  }
\ No newline at end of file