Exemplo n.º 1
0
<?php

error_reporting(E_ALL | E_STRICT);
require_once dirname(__FILE__) . '/../anewt.lib.php';
anewt_include('rss');
$channel = new AnewtRssChannel('Title', 'http://example.com', 'This is a test');
$channel->set('author', 'Anewt test');
$channel->set('build-date', AnewtDateTime::now());
$item = new AnewtRssItem('test', 'http://example.com/some-item');
$item->set('description', 'The description goes here.');
$item->set('guid', 'http://example.com/some-item');
$item->set('date', AnewtDateTime::now());
$channel->add_item($item);
$item = new AnewtRssItem('another test');
$item->set('description', 'The description goes here.');
$item->set('link', 'http://example.com/another-item');
$item->set('guid', 'http://example.com/another-item');
$item->set('date', AnewtDateTime::now());
$channel->add_item($item);
$channel->flush();
Exemplo n.º 2
0
 /**
  * \private
  *
  * Build an XML element representing this item.
  *
  * This method should not be called directly, it is only used by the
  * AnewtRssChannel class.
  *
  * \return
  *   A XML element representing this item.
  */
 public function _build_element()
 {
     $item = new AnewtXMLDomElement('item');
     /* Loop over all properties of this item */
     foreach ($this->properties as $property => $property_spec) {
         list($tagname, $status, $type) = $property_spec;
         $element = AnewtRssChannel::_build_rss_element($this, $property, $tagname, $status, $type);
         if (is_null($element)) {
             continue;
         }
         $item->append_child($element);
         unset($element);
     }
     return $item;
 }