Exemplo n.º 1
0
 protected function send_feed()
 {
     $this->db->connect($this->db_params);
     $result = parent::send_feed();
     $this->db->disconnect();
     return $result;
 }
Exemplo n.º 2
0
 /**
  * getLovedSongs()
  * Gets user's loved songs. From cache file or from the feed.
  *
  * @return array $songs Returns formatted songs
  */
 public static function getLovedSongs($username = '', $num_songs = 30)
 {
     if (!self::isValidUsername($username)) {
         return array(self::$error);
     }
     // Check Feeder and Cache classes are accessible
     if (!class_exists('Feeder')) {
         return array('Could not find Feeder.class.php.');
     }
     if (!class_exists('Cache')) {
         return array('Could not find Cache.class.php.');
     }
     self::$username = $username;
     self::$num_songs = $num_songs;
     $cache_filename = self::$username . '-loved-tracks.cache';
     $cache_life = 86400;
     // 1 day
     Cache::init($cache_filename, $cache_life);
     if (Cache::cacheFileExists()) {
         return Cache::getCache();
     }
     $song_data = Feeder::getItems(self::getLovedSongsFeed(), self::$num_songs, array('title', 'link'));
     if (!is_array($song_data)) {
         self::$error = "Last.fm loved tracks feed not found";
         return array(self::$error);
     }
     $songs = self::formatSongData($song_data);
     Cache::setCache($songs);
     return $songs;
 }
Exemplo n.º 3
0
 /**
  * getBooksFromShelf()
  * Gets the array of books from a cache_file if found (and less than a week old).
  * If no cache_file is found it creates this array of books and adds them to the cache_file - for fast loading next time
  *
  * @return array Returns a nicely formatted array of books
  */
 private static function getBooksFromShelf()
 {
     $cache_filename = self::$goodreads_id . '-' . self::$shelf . '.cache';
     $cache_life = 604800;
     // 1 week
     Cache::init($cache_filename, $cache_life);
     if (Cache::cacheFileExists()) {
         return Cache::getCache();
     }
     $book_data = Feeder::getItems(self::getGoodreadsFeed(), self::$num_books, array('title', 'author_name'));
     if (!is_array($book_data)) {
         self::$error = "Goodreads feed does not exist. Check user: "******" and shelf: '" . self::$shelf . "' exist";
         return array(self::$error);
     }
     $books = self::formatBookData($book_data);
     Cache::setCache($books);
     return $books;
 }
Exemplo n.º 4
0
Arquivo: feeder.php Projeto: ajb/rfpez
 function NormalizeEntry(FeedEntry $entry)
 {
     $entry->Published() or $entry->Published($entry->TextInfo['time']);
     $entry->Title()->HasAny() or $entry->Title()->Add('text', $entry->TextInfo['title']);
     $entry->Permalink() or $entry->Permalink($this->UrlOfEntry($entry));
     parent::NormalizeEntry($entry);
 }
Exemplo n.º 5
0
<?php

require_once 'feeder.php';
$channel = array('title' => 'My Feed', 'author' => 'Proger_XP proger.xp@gmail.com http://proger.i-forge.net', 'description' => 'Just another PHP Feed', 'category' => 'http://example.com Category Label here.', 'category 2' => 'Second Label', 'icon' => '100x20 http://example.com/icon.gif', 'logo' => '121x83 http://example.com/logo.png');
$entries = array(array('title' => 'My first post', 'updated' => strtotime('22 Jan 2011'), 'author' => 'Proger_XP proger.xp@gmail.com', 'content' => 'Thinking about something to write...', 'content html' => 'Thinking about <em>something</em> to write&hellip;'), array('title' => 'Another filler', 'updated' => strtotime('23 May 2012'), 'author' => 'Proger_XP proger.xp@gmail.com', 'contributor' => 'Camilo http://camilomm.deviantart.com', 'content html' => 'Why? Because he\'s my friend <img src="smile.png" />'));
$feeder = new Feeder();
$feeder->Channel()->SetFromArray($channel);
foreach ($entries as $i => $entry) {
    $feeder->Entry($i, new FeedEntry($entry));
}
$output = new AtomFeed();
$output->Output($feeder);
Exemplo n.º 6
0
 function __construct(array $data = null)
 {
     parent::__construct();
     $data and $this->SetFromArray($data);
 }
Exemplo n.º 7
0
 /**
  * getItems()
  * Sets up required properties then gets $value data from the given feed
  *
  * @param string $feed_url  URL of the feed you want to get data from
  * @param int $num_items    Number of feed items you want to get
  * @param array $values     Array of values to get from the feed. E.g. array('title', 'description', link')
  * @return mixed array of feed data or false if no data found
  */
 public static function getItems($feed_url = '', $num_items = 10, $values = array())
 {
     self::$feed_url = $feed_url;
     self::$num_items = $num_items;
     self::$values = $values;
     if (!($entries = self::getEntries())) {
         return false;
     }
     return self::getData($entries);
 }
Exemplo n.º 8
0
<?php

require_once 'feeder.php';
$proger = new FeedPerson();
$proger->Name('Proger_XP');
$proger->EMail('*****@*****.**');
$proger->URL('http://proger.i-forge.net');
$camilo = new FeedPerson();
$camilo->Name('Camilo');
$camilo->URL('http://camilomm.deviantart.com');
$feeder = new Feeder();
$feeder->Channel()->Title()->Add('text', 'My Feed');
$feeder->Channel()->Author(0, $proger);
$feeder->Channel()->Description()->Add('text', 'Just another PHP Feed');
$feeder->Channel()->BaseURL('http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/');
$entry = new FeedEntry();
$entry->Title()->Add('text', 'My first post');
$entry->Updated(strtotime('22 Jan 2011'));
$entry->Author(0, $proger);
$entry->Content()->Add('text', 'Thinking about something to write...');
$entry->Content()->Add('html', 'Thinking about <em>something</em> to write&hellip;');
$feeder->Entry(0, $entry);
$entry = new FeedEntry();
$entry->Title()->Add('text', 'Another filler');
$entry->Updated(strtotime('23 May 2012'));
$entry->Author(0, $proger);
$entry->Contributor(0, $camilo);
$entry->Content()->Add('html', 'Why? Because he\'s my friend <img src="smile.png" />');
$feeder->Entry(1, $entry);
$output = new AtomFeed();
$output->Output($feeder);
Exemplo n.º 9
0
<?php

require "./feeder.php";
$feed = new Feeder('http://xmlfiles.com/examples/simple.xml');
?>
<!-- iba niektore fieldy -->
<table border="0" cellspacing="5" cellpadding="5">
  <tr>
    <th>name</th>
    <th>entry_fee</th>
    <th>start_time</th>
  </tr>
<?php 
foreach ($feed as $element) {
    echo "<tr>\n";
    echo "<td>" . $element->name . "</td>";
    echo "<td>" . $element->entry_fee . "</td>";
    echo "<td>" . $element->start_time . "</td>";
    echo "</tr>\n";
}
?>
</table>

<!-- vsetky fieldy -->
<table border="0" cellspacing="5" cellpadding="5">
  <tr>
<?php 
foreach ($feed->fields() as $field) {
    echo "<th>{$field}</th>";
}
?>
Exemplo n.º 10
0
 protected function signal_log_slot_name()
 {
     return parent::signal_log_slot_name() . ".Misc.Array";
 }
Exemplo n.º 11
0
 protected function signal_log_slot_name()
 {
     return parent::signal_log_slot_name() . ".Info";
 }
Exemplo n.º 12
0
 protected function signal_log_slot_name()
 {
     return parent::signal_log_slot_name() . ".FileRecords";
 }
Exemplo n.º 13
0
 protected function set_params($params)
 {
     return $this->set_query_params($params) && parent::set_params($params);
 }
Exemplo n.º 14
0
 public function feed_data_signal(&$signal)
 {
     if ($this->depth >= $this->mindepth) {
         return parent::feed_data_signal($signal);
     }
     return true;
 }
Exemplo n.º 15
0
 function __construct($core, $wfstorage, $start_params = array())
 {
     $this->wfstorage = $wfstorage;
     parent::__construct($core, $start_params);
 }