Source for file jAtom10Info.class.php

Documentation is available at jAtom10Info.class.php

  1. <?php
  2. /**
  3. @package     jelix
  4. @subpackage  utils
  5. @author      Yannick Le Guédart
  6. @contributor Laurent Jouanneau
  7. @contributor  Sebastien Romieu
  8. @contributor  Florian Lonqueu-Brochard
  9. @copyright   2006 Yannick Le Guédart
  10. @copyright   2006-2010 Laurent Jouanneau
  11. @copyright   2010 Sébastien Romieu
  12. @copyright   2012 Florian Lonqueu-Brochard
  13. @link        http://www.jelix.org
  14. @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
  15. */
  16.  
  17. require_once(JELIX_LIB_PATH.'utils/jXMLFeedInfo.class.php');
  18.  
  19. class jAtom10Info extends jXMLFeedInfo {
  20.     /**
  21.      * unique id of the channel
  22.      * @var string 
  23.      */
  24.     public $id;
  25.     /**
  26.      * channel url
  27.      * @var string 
  28.      */
  29.     public $selfLink;
  30.     /**
  31.      * author's list
  32.      * each author is an array('name'=>'','email'=>'','uri'=>'')
  33.      * @var array 
  34.      */
  35.     public $authors = array();
  36.     /**
  37.      * related links to the channel
  38.      * each link is an array with this keys : href rel type hreflang title length
  39.      * @var array 
  40.      */
  41.     public $otherLinks = array();
  42.     /**
  43.      * list of contributors
  44.      * each contributor is an array('name'=>'','email'=>'','uri'=>'')
  45.      * @var array 
  46.      */
  47.     public $contributorsarray();
  48.     /**
  49.      * icon url
  50.      * @var string 
  51.      */
  52.     public $icon;
  53.  
  54.     /**
  55.      * version of the generator
  56.      * @var string 
  57.      * @see $generator
  58.      */
  59.     public $generatorVersion;
  60.     /**
  61.      * url of the generator
  62.      * @var string 
  63.      * @see $generator
  64.      */
  65.     public $generatorUrl;
  66.  
  67.     function __construct ()
  68.     {
  69.         $this->_mandatory = array ('title''id''updated');
  70.     }
  71.     
  72.     /**
  73.      * fill item with the given xml node
  74.      */
  75.     public function setFromXML(SimpleXMLElement $feed){
  76.         
  77.         $dt new jDateTime();
  78.         
  79.         foreach ($feed->category as $cat{
  80.             if($cat['term'!= null)
  81.                 $this->categories[= (string)$cat['term'];
  82.         }
  83.         
  84.         $this->description = (string)$feed->subtitle;
  85.         if($feed->subtitle['type'])
  86.             $this->descriptionType = (string)$feed->subtitle['type'];
  87.         $this->generator = (string)$feed->generator;
  88.         $this->image = (string)$feed->logo//or maybe $feed->icon
  89.         $this->title = (string)$feed->title;
  90.         $this->copyright = (string)$feed->rights;
  91.         
  92.         if((string)$feed->updated != ''){
  93.             $dt->setFromString((string)$feed->updatedjDateTime::ISO8601_FORMAT);
  94.             $this->updated = $dt->toString(jDateTime::DB_DTFORMAT);
  95.         }
  96.         
  97.        $attrs_links array('href''rel''type''hreflang''title''length');
  98.         foreach($feed->link as $l){
  99.                 if(($l['rel'== 'alternate' || $l['rel'== null)&& $l['href'!= null)
  100.                     $this->webSiteUrl = (string)$l['href'];
  101.                 else if($l['rel'== 'self' && $l['href'!= null)
  102.                     $this->selfLink = (string)$l['href'];
  103.                 else{
  104.                     $link array();
  105.                     foreach($attrs_links as $a){
  106.                         if($l[$a!= null)
  107.                             $link[$a= (string)$l[$a];
  108.                     }
  109.                     $this->otherLinks[$link;
  110.                 }
  111.         }
  112.         
  113.         foreach ($feed->author as $author{
  114.             $this->authors[array('name' => (string)$author->name'email' =>(string)$author->email'uri' => (string)$author->uri;
  115.         }
  116.  
  117.         foreach ($feed->contributor as $contrib{
  118.             $this->contributors[array('name' => (string)$contrib->name'email' =>(string)$contrib->email'uri' => (string)$contrib->uri;
  119.         }
  120.  
  121.         $this->generatorUrl = (string)$feed->generator['url'];
  122.         $this->generatorVersion = (string)$feed->generator['version'];
  123.         $this->icon = (string)$feed->icon;
  124.         $this->id = (string)$feed->id;
  125.         
  126.     }    
  127. }

Documentation generated on Wed, 04 Jan 2017 22:52:05 +0100 by phpDocumentor 1.4.3