Overview

Packages

  • Auth
  • Config
  • Controller
  • Date
  • Db
  • Feed
    • Abstract
    • Writers
  • File
    • Decorator
  • Form
    • Element
  • Image
  • Log
    • Writer
  • Net
    • Exception
  • None
  • PHP
  • PHPMailer
  • Session
  • Util
  • Validate
    • Validator
  • Zend
    • Registry

Classes

  • Feed_Entry
  • Feed_Feed
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Pry Framework
  4:  *
  5:  * LICENSE
  6:  *
  7:  * This source file is subject to the new BSD license that is bundled
  8:  * with this package in the file LICENSE.txt.
  9:  * 
 10:  * @version $Revision: 276 $
 11:  */
 12: 
 13: /**
 14:  * Gestion de la création de flux.
 15:  * <code>
 16:  * $feed = new Feed_Feed();
 17:  * $feed->setTitle('Flux base de connaissance')
 18:  *      ->setDate('Fri, 29 Jan 2010 09:27:22 +0100')
 19:  *      ->setAuthor(array('name'=>'OR','email'=>'oroger@prynel.com'))
 20:  *      ->setDescription('Derniers éléments de la base de connaissance Prynel')
 21:  *      ->setCopyright('prynel')
 22:  *      ->setLink('http://172.16.12.227/prybug/');
 23:  *
 24:  *  $entry = $feed->createEntry();
 25:  *  //$entry->setAuthor(array('name'=>'OR-'.$i,'email'=>'oroger@prynel.com'));
 26:  *  $entry->setTitle('[Digipryn v5] Carré blanc sur les images');
 27:  *  //$entry->setDate('2010-01-28');
 28:  *  $entry->setContent('UN carré blanc apparait sur l\'interface');
 29:  *  //$entry->setId($i);
 30:  *  $entry->setLink('http://172.16.12.227/prynbug/base/8/voir.html');
 31:  *  $feed->setEntry($entry);
 32:  *  
 33:  * 
 34:  *  header('Content-Type : application/xml; charset=utf-8');
 35:  *  // $feed->build('Rss','file.xml');
 36:  *  echo $feed->build('Rss');
 37:  * </code>
 38:  * @category Pry
 39:  * @package Feed
 40:  * @version 1.1.0 
 41:  * @author Olivier ROGER <oroger.fr>
 42:  *       
 43:  */
 44: class Feed_Feed extends Feed_Abstract_Feed
 45: {
 46:     
 47:     /**
 48:      * Tableau des items du flux
 49:      * @access private
 50:      * @var array
 51:      */
 52:     private $entries;
 53:     
 54:     public function __construct()
 55:     {
 56:         $this->author   = array();
 57:         $this->entries  = array();
 58:         $this->date     = time();
 59:         $this->lang     = 'fr-Fr';
 60:     }
 61:     
 62:     /**
 63:      * Créer un élément de flux
 64:      * @return Feed_Entry
 65:      */
 66:     public function createEntry()
 67:     {
 68:         return new Feed_Entry();
 69:     }
 70:     
 71:     /**
 72:      * Enregistre l'élément créé dans le flux
 73:      * @param Feed_Entry $entry
 74:      * @return void
 75:      */
 76:     public function setEntry($entry)
 77:     {
 78:         $this->entries[] = $entry;
 79:     }
 80:     
 81:     /**
 82:      * Récupère tous les éléments du flux
 83:      * @return array
 84:      */
 85:     public function getEntries()
 86:     {
 87:         return $this->entries;
 88:     }
 89:     
 90:     /**
 91:      * Construit le flux avec les infos et les éléments
 92:      * @param string $type Type de flux (Rss, Atom ...)
 93:      * @param string $file Chemin vers le fichier (optionnel)
 94:      * @return string|int
 95:      */
 96:     public function build($type,$file=null)
 97:     {
 98:         $class = 'Feed_Writers_'.$type;
 99:         if(class_exists($class))
100:         {
101:             $build = new $class($this,$file);
102:             return $build->finalize();
103:         }
104:         
105:         throw new InvalidArgumentException('Le type '.$type.' ne semble pas supporté');
106:     }
107: }
108: 
109:  ?>
Pry Framework API documentation generated by ApiGen 2.6.1