Esempio n. 1
0
 public function configure(Gathering $ga, $post)
 {
     $db = Loader::db();
     $o = $this->createConfigurationObject($ga, $post);
     $r = $db->Execute('insert into GatheringConfiguredDataSources (gaID, gasID, gcdObject) values (?, ?, ?)', array($ga->getGatheringID(), $this->gasID, serialize($o)));
     return GatheringDataSourceConfiguration::getByID($db->Insert_ID());
 }
 public function createGatheringItems(GatheringDataSourceConfiguration $configuration)
 {
     $fp = Loader::helper('feed');
     $feed = $fp->load(self::FLICKR_FEED_URL . '?tags=' . $configuration->getFlickrFeedTags(), false);
     $feed->init();
     $feed->handle_content_type();
     $posts = $feed->get_items(0);
     $gathering = $configuration->getGatheringObject();
     $lastupdated = 0;
     if ($gathering->getGatheringDateLastUpdated()) {
         $lastupdated = strtotime($gathering->getGatheringDateLastUpdated());
     }
     $items = array();
     foreach ($posts as $p) {
         $item = FlickrFeedGatheringItem::add($configuration, $p);
         if (is_object($item)) {
             $items[] = $item;
         }
     }
     return $items;
 }
Esempio n. 3
0
 public function createGatheringItems(GatheringDataSourceConfiguration $configuration)
 {
     $connection = new TwitterOAuth(TWITTER_APP_CONSUMER_KEY, TWITTER_APP_CONSUMER_SECRET, TWITTER_APP_ACCESS_TOKEN, TWITTER_APP_ACCESS_SECRET);
     $tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=" . $configuration->getTwitterUsername() . "&count=50");
     if (!empty($tweets->errors[0])) {
         throw new Exception($tweets->errors[0]->message);
     }
     $gathering = $configuration->getGatheringObject();
     $lastupdated = 0;
     if ($gathering->getGatheringDateLastUpdated()) {
         $lastupdated = strtotime($gathering->getGatheringDateLastUpdated());
     }
     $items = array();
     foreach ($tweets as $tweet) {
         $item = TwitterGatheringItem::add($configuration, $tweet);
         if (is_object($item)) {
             $items[] = $item;
         }
     }
     return $items;
 }
 public function createGatheringItems(GatheringDataSourceConfiguration $configuration)
 {
     $pl = new PageList();
     $pl->ignoreAliases();
     $pl->ignorePermissions();
     $gathering = $configuration->getGatheringObject();
     if ($gathering->getGatheringDateLastUpdated()) {
         $pl->filterByPublicDate($gathering->getGatheringDateLastUpdated(), '>');
     }
     $ptID = $configuration->getPageTypeID();
     if ($ptID > 0) {
         $pl->filterByPageTypeID($ptID);
     }
     $pages = $pl->get();
     $items = array();
     foreach ($pages as $c) {
         $item = PageGatheringItem::add($configuration, $c);
         if (is_object($item)) {
             $items[] = $item;
         }
     }
     return $items;
 }
 public function createGatheringItems(GatheringDataSourceConfiguration $configuration)
 {
     $fp = Loader::helper('feed');
     $feed = $fp->load($configuration->getRssFeedURL(), false);
     $feed->init();
     $feed->handle_content_type();
     $posts = $feed->get_items(0);
     $gathering = $configuration->getGatheringObject();
     $lastupdated = 0;
     if ($gathering->getGatheringDateLastUpdated()) {
         $lastupdated = strtotime($gathering->getGatheringDateLastUpdated());
     }
     $items = array();
     foreach ($posts as $p) {
         $posttime = strtotime($p->get_date('Y-m-d H:i:s'));
         //if ($posttime > $lastupdated) {
         $item = RssFeedGatheringItem::add($configuration, $p);
         //}
         if (is_object($item)) {
             $items[] = $item;
         }
     }
     return $items;
 }
Esempio n. 6
0
 public function createGatheringItems(GatheringDataSourceConfiguration $configuration)
 {
     $twitter = $this->getTwitterService();
     $url = Url::createFromUrl('');
     $url->setPath('/statuses/user_timeline.json');
     $url->setQuery(array('screen_name' => $configuration->getTwitterUsername(), 'count' => 50));
     $tweets = json_decode($twitter->request($url));
     if (!empty($tweets->errors[0])) {
         throw new Exception($tweets->errors[0]->message);
     }
     $gathering = $configuration->getGatheringObject();
     $lastupdated = 0;
     if ($gathering->getGatheringDateLastUpdated()) {
         $lastupdated = strtotime($gathering->getGatheringDateLastUpdated());
     }
     $items = array();
     foreach ($tweets as $tweet) {
         $item = TwitterGatheringItem::add($configuration, $tweet);
         if (is_object($item)) {
             $items[] = $item;
         }
     }
     return $items;
 }