protected function init($args)
 {
     parent::init($args);
     $this->setContext('retriever', 'api');
     $this->setBaseUrl('http://api.flickr.com/services/rest/');
     if (!isset($args['API_KEY'])) {
         throw new KurogoConfigurationException("Flickr API_KEY required");
     }
     $this->api_key = $args['API_KEY'];
     $this->addFilter('api_key', $this->api_key);
     if (isset($args['USER'])) {
         $this->setContext('type', 'photos');
         $this->addFilter('method', 'flickr.photos.search');
         $this->addFilter('user_id', $args['USER']);
     }
     if (isset($args['PHOTOSET'])) {
         $this->setContext('type', 'photoset');
         $this->addFilter('method', 'flickr.photosets.getPhotos');
         $this->addFilter('photoset_id', $args['PHOTOSET']);
     }
     if (isset($args['GALLERY'])) {
         $this->setContext('type', 'photos');
         $this->addFilter('method', 'flickr.galleries.getPhotos');
         $this->addFilter('gallery_id', $args['GALLERY']);
     }
     if (isset($args['GROUP'])) {
         $this->setContext('type', 'photos');
         $this->addFilter('method', 'flickr.photos.search');
         $this->addFilter('group_id', $args['GROUP']);
     }
     $this->addFilter('extras', implode(',', $this->extraFields));
     $this->addFilter('format', 'php_serial');
 }
 protected function init($args)
 {
     parent::init($args);
     if (!isset($args['SPORT'])) {
         throw new KurogoConfigurationException("Sport must be defined");
     }
     $this->sport = $args['SPORT'];
 }
 protected function init($args)
 {
     parent::init($args);
     if (!isset($args['API_KEY'])) {
         throw new KurogoConfigurationException("Instagram API_KEY required");
     }
     $this->api_key = $args['API_KEY'];
     $this->setBaseUrl('https://api.instagram.com/v1/users/self/feed');
     $this->addFilter('access_token', $this->api_key);
 }
 protected function init($args)
 {
     if (!isset($args['DRUPAL_SERVER_URL'])) {
         throw new KurogoConfigurationException("DRUPAL_SERVER_URL not set");
     }
     if (!isset($args['FEED_VERSION'])) {
         throw new KurogoConfigurationException("FEED_VERSION not set");
     }
     $args['BASE_URL'] = $args['DRUPAL_SERVER_URL'] . "/emergency-contacts-v" . $args['FEED_VERSION'];
     parent::init($args);
 }
Пример #5
0
 public function setOption($option, $value)
 {
     parent::setOption($option, $value);
     switch ($option) {
         case 'channel':
             $this->setBaseUrl('http://vimeo.com/api/v2/channel/' . $value . '/videos.json');
             break;
         case 'author':
             $this->setBaseUrl('http://vimeo.com/api/v2/' . $value . '/videos.json');
             break;
     }
 }
Пример #6
0
 public function setOption($option, $value)
 {
     parent::setOption($option, $value);
     switch ($option) {
         case 'tag':
             $this->addFilter('category', $value);
             break;
         case 'author':
             $this->addFilter('author', $value);
             break;
     }
 }
Пример #7
0
 public function getData(&$response = null)
 {
     // this happens when we start out at the top level of a service instance
     if (!$this->selectedLayer && $this->action == self::ACTION_PLACEMARKS) {
         return array();
     }
     $data = parent::getData();
     if ($data === null) {
         $data = array();
     }
     return $data;
 }
Пример #8
0
 protected function init($args)
 {
     parent::init($args);
     $this->fieldMap = array('userid' => isset($args['KUROGO_USERID_FIELD']) ? $args['KUROGO_USERID_FIELD'] : 'uid', 'email' => isset($args['KUROGO_EMAIL_FIELD']) ? $args['KUROGO_EMAIL_FIELD'] : 'mail', 'fullname' => isset($args['KUROGO_FULLNAME_FIELD']) ? $args['KUROGO_FULLNAME_FIELD'] : '', 'firstname' => isset($args['KUROGO_FIRSTNAME_FIELD']) ? $args['KUROGO_FIRSTNAME_FIELD'] : 'givenname', 'lastname' => isset($args['KUROGO_LASTNAME_FIELD']) ? $args['KUROGO_LASTNAME_FIELD'] : 'sn', 'photodata' => isset($args['KUROGO_PHOTODATA_FIELD']) ? $args['KUROGO_PHOTODATA_FIELD'] : 'jpegphoto', 'phone' => isset($args['KUROGO_PHONE_FIELD']) ? $args['KUROGO_PHONE_FIELD'] : 'telephonenumber');
     if (isset($args['SORTFIELDS']) && is_array($args['SORTFIELDS'])) {
         $this->sortFields = $args['SORTFIELDS'];
     }
     if (isset($args['BASE_URL']) && $args['BASE_URL']) {
         $this->peopleAPI = rtrim($args['BASE_URL'], '/');
     }
     $this->feed = Kurogo::arrayVal($args, 'FEED');
     $this->setContext('fieldMap', $this->fieldMap);
 }
Пример #9
0
 protected function init($args)
 {
     parent::init($args);
     $url = "https://picasaweb.google.com/data/feed/api/";
     if (isset($args['USER'], $args['ALBUM'])) {
         $url .= sprintf("user/%s/albumid/%s", $args['USER'], $args['ALBUM']);
     } else {
         throw new KurogoConfigurationException("USER and ALBUM values must be set for Picasa albums");
     }
     $this->setBaseURL($url);
     $this->addFilter('kind', 'photo');
     $this->addFilter('thumbsize', '72c');
     $this->addFilter('alt', 'json');
 }
Пример #10
0
 protected function init($args)
 {
     parent::init($args);
     if (!isset($args['token'])) {
         throw new KurogoConfigurationException('Brightcove token not included');
     }
     $this->setOption('token', $args['token']);
     if (!isset($args['playerKey'])) {
         throw new KurogoConfigurationException('Brightcove playerKey not included');
     }
     $this->setOption('playerKey', $args['playerKey']);
     if (!isset($args['playerId'])) {
         throw new KurogoConfigurationException('Brightcove playerId not included');
     }
     $this->setOption('playerId', $args['playerId']);
     $this->setStandardFilters();
     $this->addFilter('command', 'find_all_videos');
 }
Пример #11
0
 protected function init($args)
 {
     parent::init($args);
     if (isset($args['BASE_URL'])) {
         $this->param_baseUrl = $args['BASE_URL'];
     } else {
         $this->param_baseUrl = $this->DEFAULT_BASE_URL;
     }
     if (!isset($args['PARTNER_ID'])) {
         throw new KurogoConfigurationException("Kaltura PARTNER_ID is a required configuration");
     }
     if (!isset($args['FEED_ID'])) {
         throw new KurogoConfigurationException("Kaltura FEED_ID is a required configuration");
     }
     $this->param_partnerId = $args['PARTNER_ID'];
     $this->param_feedId = $args['FEED_ID'];
     $this->setStandardParameters();
     $json = $this->getData();
 }
 protected function init($args)
 {
     parent::init($args);
     $this->setContext('retriever', 'feed');
     if (isset($args['USER'])) {
         $this->setBaseUrl('http://api.flickr.com/services/feeds/photos_public.gne');
         $this->addFilter('id', $args['USER']);
     }
     if (isset($args['PHOTOSET'])) {
         if (!isset($args['USER'])) {
             throw new KurogoConfigurationException("Photoset feeds must contain a USER value");
         }
         $this->setBaseURL('http://api.flickr.com/services/feeds/photoset.gne');
         $this->addFilter('set', $args['PHOTOSET']);
         $this->addFilter('nsid', $args['USER']);
     }
     if (isset($args['GROUP'])) {
         $this->setBaseUrl('http://api.flickr.com/services/feeds/groups_pool.gne');
         $this->addFilter('id', $args['GROUP']);
     }
     $this->addFilter('format', 'php_serial');
 }
 protected function retrieveResponse()
 {
     if (!class_exists('ZipArchive')) {
         throw new KurogoException("class ZipArchive (php-zip) not available");
     }
     $tmpFile = Kurogo::tempFile();
     // this is the same as parent
     if (!($this->requestURL = $this->url())) {
         throw new KurogoDataException("URL could not be determined");
     }
     Kurogo::log(LOG_INFO, "Retrieving {$this->requestURL}", 'url_retriever');
     // get data from parent request and save to temp file which we will
     // unzip and return
     $response = parent::retrieveResponse();
     file_put_contents($tmpFile, $response->getResponse());
     $zip = new ZipArchive();
     if (!$zip->open($tmpFile)) {
         throw new KurogoDataException("Could not open zip file");
     }
     $targetFile = $this->targetFile();
     if ($targetFile) {
         $index = $zip->locateName($targetFile);
     } else {
         $index = 0;
     }
     if ($index === false) {
         // $zip->locateName failed
         throw new KurogoDataException("Could not locate {$this->targetFile} in zip archive");
     }
     $data = $zip->getFromIndex($index);
     unlink($tmpFile);
     $zip->close();
     $response->setResponse($data);
     Kurogo::log(LOG_DEBUG, sprintf("Returned status %d and %d bytes", $response->getCode(), strlen($data)), 'url_retriever');
     return $response;
 }
Пример #14
0
 protected function init($args)
 {
     parent::init($args);
     if ($provider = $this->getOAuthProvider()) {
         $this->initOAuthProvider($provider);
     }
     if (isset($args['OAUTH_CONSUMER_KEY'])) {
         $this->consumerKey = $args['OAUTH_CONSUMER_KEY'];
     }
     if (isset($args['OAUTH_CONSUMER_SECRET'])) {
         $this->consumerSecret = $args['OAUTH_CONSUMER_SECRET'];
     }
     if (isset($args['token'])) {
         $this->token = $args['token'];
     }
     if (isset($args['tokenSecret'])) {
         $this->tokenSecret = $args['tokenSecret'];
     }
     if (isset($args['cert'])) {
         $this->cert = $args['cert'];
     }
     if (isset($args['signatureMethod'])) {
         $this->signatureMethod = $args['signatureMethod'];
     }
 }
 public function cacheKey()
 {
     return URLDataRetriever::cacheKey();
 }
Пример #16
0
 public function init($args)
 {
     parent::init($args);
     if (!isset($args['ACCOUNT'])) {
         throw new KurogoConfigurationException("ACCOUNT must be set for Facebook");
     }
     $this->setUser($args['ACCOUNT']);
     if (!isset($args['OAUTH_CONSUMER_KEY'])) {
         throw new KurogoConfigurationException("OAUTH_CONSUMER_KEY must be set for Facebook");
     }
     $this->clientId = $args['OAUTH_CONSUMER_KEY'];
     if (!isset($args['OAUTH_CONSUMER_SECRET'])) {
         throw new KurogoConfigurationException("OAUTH_CONSUMER_SECRET must be set for Facebook");
     }
     $this->clientSecret = $args['OAUTH_CONSUMER_SECRET'];
 }
Пример #17
0
 public function getData(&$response = null)
 {
     // this happens when we start out at the top level of a service instance
     // Use strlen to protect against a layer id of 0
     if (strlen($this->selectedLayer) == 0 && $this->action == self::ACTION_PLACEMARKS) {
         return array();
     }
     $data = parent::getData($response);
     if ($data === null) {
         $data = array();
     }
     return $data;
 }