function get_google_plus_url($query_url) { // Try Google+ $url = Photonic_Processor::get_normalized_http_url($query_url); $user_and_album = substr($url, strlen('https://picasaweb.google.com/data/feed/api/')); $user_and_album = explode('/', $user_and_album); foreach ($user_and_album as $key => $value) { if ($value == 'user' && isset($user_and_album[$key + 1])) { $user = $user_and_album[$key + 1]; } else { if ($value == 'album' && isset($user_and_album[$key + 1])) { $album = $user_and_album[$key + 1]; } } } $query_args = substr($query_url, strlen($url)); $new_url = ''; if (isset($user) && isset($album)) { $new_url = 'https://plus.google.com/photos/' . $user . '/albums/' . $album . $query_args; } // https://plus.google.com/photos/104926144534698413096/albums/5818977512257357377 return $new_url; }
private function get_query_url($url, $page_number) { global $photonic_500px_oauth_done; if (stripos($url, '&page=') === false) { $query_url = $url . '&page=' . $page_number; } else { $query_url = $url; } if ($photonic_500px_oauth_done) { $end_point = $this->end_point(); $normalized_url = Photonic_Processor::get_normalized_http_url($query_url); if (strstr($normalized_url, $end_point) > -1) { $params = substr($query_url, strlen($normalized_url) + 1); if (strlen($params) > 1) { $params = substr($params, 1); } $params = Photonic_Processor::parse_parameters($params); $signed_args = $this->sign_call($normalized_url, 'GET', $params); $query_url = $normalized_url . '?' . Photonic_Processor::build_query($signed_args); return $query_url; } return $query_url; } return $query_url; }
/** * Retrieves a list of collection objects for a given user. This first invokes the web-service, then iterates through the collections returned. * For each collection returned it recursively looks for nested collections and sets. * * @param $user_id * @param string $collection_id * @return array */ function get_collection_list($user_id, $collection_id = '') { global $photonic_flickr_api_key, $photonic_flickr_oauth_done; $query = 'https://api.flickr.com/services/rest/?method=flickr.collections.getTree&user_id=' . $user_id . '&api_key=' . $photonic_flickr_api_key; if ($collection_id != '') { $query .= '&collection_id=' . $collection_id; } if ($photonic_flickr_oauth_done) { $end_point = Photonic_Processor::get_normalized_http_url($query); if (strstr($query, $end_point) > -1) { $params = substr($query, strlen($end_point)); if (strlen($params) > 1) { $params = substr($params, 1); } $params = Photonic_Processor::parse_parameters($params); $signed_args = $this->sign_call($end_point, 'GET', $params); $query = $end_point . '?' . Photonic_Processor::build_query($signed_args); } } $feed = Photonic::http($query); if (!is_wp_error($feed) && 200 == $feed['response']['code']) { $feed = $feed['body']; $feed = simplexml_load_string($feed); if (is_a($feed, 'SimpleXMLElement')) { $main_attributes = $feed->attributes(); if ($main_attributes['stat'] == 'ok') { $children = $feed->children(); if (count($children) != 0) { if (isset($feed->collections)) { $collections = $feed->collections; $collections = $collections->collection; $ret = array(); $processed = array(); foreach ($collections as $collection) { $collection_attrs = $collection->attributes(); if (isset($collection_attrs['id'])) { if (!in_array($collection_attrs['id'], $processed)) { $iterative = $this->get_nested_collections($collection, $processed); $ret = array_merge($ret, $iterative); } } } return $ret; } } } } } return array(); }