diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-11-05 11:30:27 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-11-05 11:30:38 +0100 |
commit | 95530f62513a82c385d9378b4a59da57d74092d9 (patch) | |
tree | a4d17994548999b42e99371f381da8c256ee39bf /3rdparty/fguillot/picofeed/lib/PicoFeed/Syndication/Writer.php | |
parent | 57163ad25a7dc63abd8aff8663c185ddad398466 (diff) |
update picofeed, add max size setting, fix #642
Diffstat (limited to '3rdparty/fguillot/picofeed/lib/PicoFeed/Syndication/Writer.php')
-rw-r--r-- | 3rdparty/fguillot/picofeed/lib/PicoFeed/Syndication/Writer.php | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/3rdparty/fguillot/picofeed/lib/PicoFeed/Syndication/Writer.php b/3rdparty/fguillot/picofeed/lib/PicoFeed/Syndication/Writer.php new file mode 100644 index 000000000..3b4557dad --- /dev/null +++ b/3rdparty/fguillot/picofeed/lib/PicoFeed/Syndication/Writer.php @@ -0,0 +1,97 @@ +<?php + +namespace PicoFeed\Syndication; + +use RuntimeException; + +/** + * Base writer class + * + * @author Frederic Guillot + * @package Syndication + * @property string $description Feed description + */ +abstract class Writer +{ + /** + * Dom object + * + * @access protected + * @var \DomDocument + */ + protected $dom; + + /** + * Items + * + * @access public + * @var array + */ + public $items = array(); + + /** + * Author + * + * @access public + * @var array + */ + public $author = array(); + + /** + * Feed URL + * + * @access public + * @var string + */ + public $feed_url = ''; + + /** + * Website URL + * + * @access public + * @var string + */ + public $site_url = ''; + + /** + * Feed title + * + * @access public + * @var string + */ + public $title = ''; + + /** + * Feed modification date (timestamp) + * + * @access public + * @var integer + */ + public $updated = 0; + + /** + * Generate the XML document + * + * @abstract + * @access public + * @param string $filename Optional filename + * @return string + */ + abstract public function execute($filename = ''); + + /** + * Check required properties to generate the output + * + * @access public + * @param array $properties List of properties + * @param mixed $container Object or array container + */ + public function checkRequiredProperties(array $properties, $container) + { + foreach ($properties as $property) { + if ((is_object($container) && ! isset($container->$property)) || (is_array($container) && ! isset($container[$property]))) { + throw new RuntimeException('Required property missing: '.$property); + } + } + } +} |