Source for file jRSS20Info.class.php

Documentation is available at jRSS20Info.class.php

  1. <?php
  2. /**
  3. @package     jelix
  4. @subpackage  utils
  5. @author      Loic Mathaud
  6. @author      Yannick Le Guédart
  7. @contributor Laurent Jouanneau
  8. @contributor  Sebastien Romieu
  9. @contributor  Florian Lonqueu-Brochard
  10. @copyright   2005-2006 Loic Mathaud
  11. @copyright   2006 Yannick Le Guédart
  12. @copyright   2006-2010 Laurent Jouanneau
  13. @copyright   2010 Sébastien Romieu
  14. @copyright   2012 Florian Lonqueu-Brochard
  15. @link        http://www.jelix.org
  16. @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
  17. */
  18.  
  19. require_once(JELIX_LIB_PATH.'utils/jXMLFeedInfo.class.php');
  20.  
  21. class jRSS20Info extends jXMLFeedInfo {
  22.     /**
  23.      * lang of the channel
  24.      * @var string 
  25.      */
  26.     public $language;
  27.     /**
  28.      * email of the content manager
  29.      * @var string 
  30.      */
  31.     public $managingEditor;
  32.     /**
  33.      * email of technical responsible
  34.      * @var string 
  35.      */
  36.     public $webMaster;
  37.     /**
  38.      * publication date
  39.      * format:  yyyy-mm-dd hh:mm:ss
  40.      * @var string 
  41.      */
  42.     public $published;
  43.     /**
  44.      * specification url
  45.      * example : http://blogs.law.harvard.edu/tech/rss
  46.      * @var string 
  47.      */
  48.     public $docs='';
  49.     /**
  50.      * not implemented
  51.      * @var string 
  52.      */
  53.     public $cloud// indicates a webservice from which the user can register to the server
  54.                   // to be aware of modifications
  55.                   //=array('domain'=>'','path'=>'','port'=>'','registerProcedure'=>'', 'protocol'=>'');
  56.     /**
  57.      * time to live of the cache, in minutes
  58.      * @var string 
  59.      */
  60.     public $ttl;
  61.     /**
  62.      * image title
  63.      * @var string 
  64.      */
  65.     public $imageTitle;
  66.     /**
  67.      * web site url corresponding to the image
  68.      * @var string 
  69.      */
  70.     public $imageLink;
  71.     /**
  72.      * width of the image
  73.      * @var string 
  74.      */
  75.     public $imageWidth;
  76.     /**
  77.      * height of the image
  78.      * @var string 
  79.      */
  80.     public $imageHeight;
  81.     /**
  82.      * Description of the image (= title attribute for the img tag)
  83.      * @var string 
  84.      */
  85.     public $imageDescription;
  86.  
  87.     /**
  88.      * Pics rate for this channel
  89.      * @var string 
  90.      */
  91.     public $rating;
  92.     /**
  93.      * field form for the channel
  94.      * it is an array('title'=>'','description'=>'','name'=>'','link'=>'')
  95.      * @var array 
  96.      */
  97.     public $textInput;
  98.     /**
  99.      * list of hours that agregator should ignore
  100.      * ex (10, 21)
  101.      * @var array 
  102.      */
  103.     public $skipHours;
  104.     /**
  105.      * list of day that agregator should ignore
  106.      * ex ('monday', 'tuesday')
  107.      * @var array 
  108.      */
  109.     public $skipDays;
  110.  
  111.     function __construct ({
  112.             $this->_mandatory = array 'title''webSiteUrl''description');
  113.     }
  114.     
  115.     /**
  116.      * fill item with the given xml node
  117.      * @param SimpleXMLElement node representing the channel
  118.      */
  119.     public function setFromXML(SimpleXMLElement $channel){
  120.         
  121.         $dt new jDateTime();
  122.         
  123.         $this->copyright =(string)$channel->copyright;
  124.         $this->description = (string)$channel->description;
  125.         $this->generator = (string)$channel->generator;
  126.         $this->image = (string)$channel->image->url;
  127.         $this->title = (string)$channel->title;
  128.         
  129.         if((string)$channel->lastBuildDate != ''){
  130.             $dt->setFromString((string)$channel->lastBuildDatejDateTime::RFC2822_FORMAT);
  131.             $this->updated = $dt->toString(jDateTime::DB_DTFORMAT);
  132.         }
  133.                 
  134.         if((string)$channel->pubDate != ''){
  135.             $dt->setFromString((string)$channel->pubDatejDateTime::RFC2822_FORMAT);
  136.             $this->published = $dt->toString(jDateTime::DB_DTFORMAT);
  137.         }
  138.  
  139.         $this->webSiteUrl = (string)$channel->link;
  140.         $this->docs = (string)$channel->docs;
  141.         $this->imageHeight = (string)$channel->image->height;
  142.         $this->imageLink = (string)$channel->image->link;
  143.         $this->imageTitle = (string)$channel->image->title;
  144.         $this->imageWidth = (string)$channel->image->width;
  145.         $this->imageDescription = (string)$channel->image->description;
  146.         $this->language = (string)$channel->language;
  147.         $this->managingEditor = (string)$channel->managingEditor;
  148.         $this->rating = (string)$channel->rating;
  149.         
  150.         $categories $channel->category;
  151.         foreach ($categories as $cat{
  152.             $this->categories[= (string)$cat;
  153.         }
  154.         
  155.         $skipDays $channel->skipDays;    
  156.         foreach ($skipDays->day as $day{
  157.             $this->skipDays[= (string)$day;
  158.         }
  159.         
  160.         $skipHours $channel->skipHours;    
  161.         foreach ($skipHours->hour as $hour{
  162.             $this->skipHours[= (string)$hour;
  163.         }
  164.  
  165.         $this->textInput['title'= (string)$channel->textInput->title;
  166.         $this->textInput['description'= (string)$channel->textInput->description;
  167.         $this->textInput['name'= (string)$channel->textInput->name;
  168.         $this->textInput['link'= (string)$channel->textInput->link;
  169.  
  170.         $this->ttl = (string)$channel->ttl;
  171.         $this->webMaster = (string)$channel->webMaster;
  172.     }
  173. }

Documentation generated on Wed, 04 Jan 2017 22:56:33 +0100 by phpDocumentor 1.4.3