コード例 #1
0
 /**
  * Private method to get the rss feed
  * @param string $url A string containg the url of the rss feed being requested
  */
 private static function get_rss_feed($url)
 {
     // Create a new RSS feed
     $rss = new Feed\Rss($url);
     // Set some options
     $rss->set_post_limit(self::$limit_posts_per_source);
     $rss->set_old_limit(self::$old_post_days);
     // Get the data
     return $rss->get_normalized_data();
 }
コード例 #2
0
 /**
  * Method to take in all of the feed data and aggregate it as one feed
  */
 public static function aggregate()
 {
     // Create an array for all of the feed data aggregated together
     $agg_feed_data = array();
     // Loop through each feed
     foreach (self::$feed_urls as $url) {
         // Create a new RSS feed
         $rss = new Feed\Rss($url);
         // Set some options
         $rss->set_post_limit(self::$limit_posts_per_source);
         $rss->set_old_limit(self::$old_post_days);
         // Get the data
         $feed_data = $rss->get_normalized_data();
         // Get the data and merge the returned array into our aggregate array
         $agg_feed_data = array_merge($agg_feed_data, $feed_data);
     }
     // Limit the posts to a set amount
     $agg_feed_data = array_slice($agg_feed_data, 0, self::$limit_posts_total);
     return $agg_feed_data;
 }