/** * Returns tumblr auth method * * @param *string * @param *string * @return Eden_Tumblr_Oauth */ public function auth($key, $secret) { //Argument test Eden_Twitter_Error::i()->argument(1, 'string')->argument(2, 'string'); //Argument 2 must be a string return Eden_Tumblr_Oauth::i($key, $secret); }
/** * Check if the response is json format * * @param string * @return boolean */ public function isJson($string) { //argument 1 must be a string Eden_Twitter_Error::i()->argument(1, 'string'); json_decode($string); return json_last_error() == JSON_ERROR_NONE; }
/** * Returns the URL used for login. * * @param string the request key * @param string * @param boolean force user re-login * @return string */ public function getLoginUrl($token, $redirect, $force_login = false) { //Argument tests Eden_Twitter_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'bool'); //Argument 3 must be a boolean //build the query $query = array('oauth_token' => $token, 'oauth_callback' => $redirect, 'force_login' => (int) $force_login); $query = http_build_query($query); return self::AUTHORIZE_URL . '?' . $query; }
/** * Access to Twitter's suggested user list. * * @param string|null * @return array */ public function getSuggestion($lang = NULL) { //Argument 1 must be a string or null Eden_Twitter_Error::i()->argument(1, 'string', 'null'); //if it is not empty if (!is_null($lang)) { //lets put it in our query $query = array('lang' => $lang); } return $this->_getResponse(self::URL_SUGGESTION, $query); }
/** * Returns the top 10 trending topics for a specific * WOEID, if trending information is available for it. * * @param integer * @param string|null * @return array */ public function getList($id, $exclude = NULL) { //Argument Test Eden_Twitter_Error::i()->argument(1, 'int')->argument(2, 'string', 'null'); //Argument 2 must be a string or null $query = array('woeid' => $id); //if it is not empty if (!is_null($exclude)) { //lets put it in query $query['exclude'] = $exclude; } return $this->_getResponse(self::URL_GET_LIST); }
/** * Disables notifications for updates from the * specified user to the authenticating user. * Returns the specified user when successful. * * @param string|int user ID or screen name * @return array */ public function leave($id) { //Argument 1 must be a string or integer Eden_Twitter_Error::i()->argument(1, 'string', 'int'); $query = array(); //if it is integer if (is_int($id)) { //lets put it in our query $query['user_id'] = $id; //else it is string } else { //lets put it in our query $query['screen_name'] = $id; } return $this->_post(self::URL_LEAVE, $query); }
/** * The user specified in the id is blocked by the * authenticated user and reported as a spammer * * @param sting|null * @param string|null * @return array */ public function reportSpam($id = NULL, $name = NULL) { //Argument Test Eden_Twitter_Error::i()->argument(1, 'string', 'null')->argument(2, 'string', 'null'); //Argument 2 must be a string or null //if it is not empty if (!is_null($id)) { //lets put it in query $this->_query['user_id'] = $id; } //if it is not empty if (!is_null($name)) { //lets put it in query $this->_query['screen_name'] = $name; } return $this->_post(self::URL_REPORT_SPAM, $this->_query); }
/** * Returns the locations that Twitter has trending topic information for, closest to a specified location. * * @param float|null * @param float|null * @return array */ public function getClosestTrending($lat = NULL, $long = NULL) { //Argument Test Eden_Twitter_Error::i()->argument(1, 'float', 'null')->argument(2, 'float', 'null'); //Argument 2 must be a float or null //if it is not empty if (!is_null($lat)) { //lets put it in query $this->_query['lat'] = $lat; } //if it is not empty if (!is_null($long)) { //lets put it in query $this->_query['long'] = $long; } return $this->_getResponse(self::URL_TRENDING_CLOSEST, $this->_query); }
/** * Returns the top 30 trending topics * for each day in a given week. * * @param sting|null * @param string|null * @return array */ public function getWeeklyTrends($date = NULL, $exclude = NULL) { //Argument Test Eden_Twitter_Error::i()->argument(1, 'string', 'null')->argument(2, 'string', 'null'); //Argument 2 must be a string or null $query = array(); //if it is not empty if (!is_null($date)) { //lets put it in query $query['date'] = date('Y-m-d', strtotime($date)); } //if it is not empty if (!is_null($exclude)) { //lets put it in query $query['exclude'] = $exclude; } return $this->_getResponse(self::URL_GET_WEEKLY_TRENDS, $query); }
/** * Set wrap link * * @param boolean * @return this */ public function setWrap($wrap) { //Argument 1 must be a boolean Eden_Twitter_Error::i()->argument(1, 'bool'); $this->_wrap = $wrap; return $this; }
/** * Set Max Id * * @param integer * @return this */ public function setMaxId($maxId) { //Argument 1 must be a integer Eden_Twitter_Error::i()->argument(1, 'int'); $this->_query['max_id'] = $maxId; return $this; }
/** * Returns twitter users method * * @param *string * @param *string * @param *string * @param *string * @return Eden_Twitter_Users */ public function users($consumerKey, $consumerSecret, $accessToken, $accessSecret) { //Argument test Eden_Twitter_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'string')->argument(4, 'string'); //Argument 4 must be a string return Eden_Twitter_Users::i($consumerKey, $consumerSecret, $accessToken, $accessSecret); }
/** * Set since id * * @param integer * @return array */ public function setSince($since) { //Argument 1 must be an integer Eden_Twitter_Error::i()->argument(1, 'int'); $this->_since = $since; return $this; }
/** * Set url * * @param string * @return this */ public function setUrl($url) { //Argument 1 must be a string or null Eden_Twitter_Error::i()->argument(1, 'string'); $this->_url = $url; return $this; }
/** * Returns tweets generated before the given date. * * @param string|int unix time for date format * @return this */ public function setUntil($until) { //Argument 1 must be a string Eden_Twitter_Error::i()->argument(1, 'string', 'int'); //if it is a string if (is_string($until)) { //make it a integer date $until = strtotime($until); } //format date $until = date('Y-m-d', $until); $this->_query['until'] = $until; return $this; }
/** * A hint as to the number of results to return. This does not guarantee * that the number of results returned will equal max_results, but instead * informs how many "nearby" results to return. Ideally, only pass in the * number of places you intend to display to the user here. * * @param integer * @return this */ public function setMaxResults($maxResults) { //Argument 1 must be an integer Eden_Twitter_Error::i()->argument(1, 'int'); $this->_query['max_results'] = $maxResults; return $this; }
/** * Returns the current rate limits for methods belonging to the specified resource families. * * @return array */ public function getRateLimitStatus($resources = NULL) { //Argument 1 must be a string or null Eden_Twitter_Error::i()->argument(1, 'string', 'null'); $this->_query['resources'] = $resources; return $this->_getResponse(self::URL_RATE_LIMIT, $this->_query); }
/** * Set per page * * @param integer * @return this */ public function setPerpage($perPage) { //Argument 1 must be an integer Eden_Twitter_Error::i()->argument(1, 'int'); $this->_query['per_page'] = $perPage; return $this; }
public function auth($key, $secret) { Eden_Twitter_Error::i()->argument(1, 'string')->argument(2, 'string'); return Eden_Tumblr_Oauth::i($key, $secret); }
/** * Set max results * * @param integer * @return this */ public function setMax($max) { //Argument 1 must be an integer Eden_Twitter_Error::i()->argument(1, 'int'); $this->_max = $max; return $this; }
/** * Set until * * @param string|int unix time for date format * @return this */ public function setUntil($until) { //Argument 1 must be a string Eden_Twitter_Error::i()->argument(1, 'string', 'int'); if (is_string($until)) { $until = strtotime($until); } $until = date('Y-m-d', $until); $this->_until = $until; return $this; }
/** * Destroys a saved search for the authenticating user. * The authenticating user must be the owner of * saved search id being destroyed. * * @param int search ID * @return array */ public function remove($id) { //Argument 1 must be a integer Eden_Twitter_Error::i()->argument(1, 'int'); $query = array('id' => $id); $url = sprintf(self::URL_REMOVE, $id); return $this->_post($url, $query); }
/** * Un-blocks the user specified in the ID parameter for the * authenticating user. * * @param string|integer either the screen name or user ID * @param boolean * @param boolean * @return array */ public function unblock($id, $entities = false, $status = false) { //Argument Test Eden_Twitter_Error::i()->argument(1, 'string', 'int')->argument(2, 'bool')->argument(3, 'bool'); //Argument 3 must be a boolean $query = array(); //if it is integer if (is_int($id)) { //lets put it in our query $query['user_id'] = $id; //else it is string } else { //lets put it in our query $query['screen_name'] = $id; } //if entities if ($entities) { $query['include_entities'] = 1; } //if status if ($status) { $query['skip_status'] = 1; } return $this->_post(self::URL_REMOVE_BLOCKING, $query); }
/** * Runs a search for users similar to find people * * @param string * @return array */ public function search($search) { //Argument 1 must be a string Eden_Twitter_Error::i()->argument(1, 'string'); $query = array('q' => $search); if ($this->_page) { $query['page'] = $this->_page; } if ($this->_perpage) { $query['per_page'] = $this->_perpage; } if ($this->_entities) { $query['include_entities'] = 1; } return $this->_getResponse(self::URL_SEARCH, $query); }
/** * Updates the specified list. The authenticated user must own * the list to be able to update it. * * @param int|string list ID or slug * @param string * @param string * @param int|string|null owner ID or screen name * @param bool * @return array */ public function update($listId, $name, $description, $ownerId = NULL, $public = true) { Eden_Twitter_Error::i()->argument(1, 'int', 'string')->argument(2, 'string')->argument(3, 'string')->argument(4, 'int', 'string', 'null')->argument(5, 'bool'); //Argument 3 must be an boolean $this->_query['name'] = $name; $this->_query['description'] = $description; //if it is integer if (is_int($listId)) { //lets put it in our query $this->_query['list_id'] = $listId; //else it is string } else { //lets put it in our query $this->_query['slug'] = $listId; } if (!is_null($ownerId)) { //if it is integer if (is_int($ownerId)) { //lets put it in our query $this->_query['owner_id'] = $ownerId; //else it is string } else { //lets put it in our query $this->_query['owner_screen_name'] = $ownerId; } } return $this->_post(self::URL_UPDATE, $this->_query); }
/** * Specifies the number of records to retrieve. Must be less than or equal to 100. * * @param integer * @return this */ public function setCount($count) { //Argument 1 must be an integer Eden_Twitter_Error::i()->argument(1, 'int'); //Prevent sending number greater that 100 if ($count <= 100) { $this->_query['count'] = $count; } else { $this->_query['count'] = 100; } return $this; }
/** * Destroys a saved search for the authenticating user. * The authenticating user must be the owner of * saved search id being destroyed. * * @param int search ID * @return array */ public function remove($id) { //Argument 1 must be a integer Eden_Twitter_Error::i()->argument(1, 'int'); return $this->_post(sprintf(self::URL_REMOVE, $id)); }
/** * Keywords to track. Phrases of keywords are specified by a comma-separated list. * * @param string|array * @return this */ public function setLocation($locations) { //Argument 1 must be a string Eden_Twitter_Error::i()->argument(1, 'string', 'array'); //if it is array if (is_array($track)) { $this->_query['locations'] = implode(',', $locations); //else it is string } else { $this->_query['locations'] = $locations; } return $this; }
/** * Allows one to enable or disable retweets and device notifications * from the specified user. * * @param string|int user ID or screen name * @param boolean * @param boolean * @return array */ public function update($id, $device = false, $retweets = false) { //Argument Test Eden_Twitter_Error::i()->argument(1, 'string', 'int')->argument(2, 'bool')->argument(3, 'bool'); //Argument 3 must be a boolean $query = array(); //if id is string if (is_string($id)) { //lets put it in query $query['screen_name'] = $id; //else it is integer } else { //lets put it in query $query['user_id'] = $id; } if ($device) { //lets put it in query $query['device'] = 1; } if ($retweets) { //lets put it in query $query['retweets'] = 1; } return $this->_post(self::URL_UPDATE, $query); }
/** * Updates the authenticating user's status, * also known as tweeting. * * @param string * @param string * @return array */ public function updateMedia($status, $media) { //Argument Test Eden_Twitter_Error::i()->argument(1, 'string')->argument(2, 'string'); //Argument 2 must be a string //populate fields $query = array('media[]' => $media, 'status' => $status); if ($this->_reply) { $query['in_reply_to_status_id'] = $this->_reply; } if ($this->_latitude) { $query['lat'] = $this->_latitude; } if ($this->_longtitude) { $query['long'] = $this->_longtitude; } if ($this->_place) { $query['place_id'] = $this->_place; } if ($this->_sensitive) { $query['possibly_sensitive'] = 1; } if ($this->_display) { $query['display_coordinates'] = 1; } return $this->_upload(self::URL_UPDATE_MEDIA, $query); }