10 defined(
'JPATH_PLATFORM') or die();
36 public function getTweetById($id, $trim_user = null, $entities = null, $my_retweet = null)
39 $this->checkRateLimit(
"statuses",
"show/:id");
42 $path =
'/statuses/show/' . $id .
'.json';
47 if (!is_null($trim_user))
49 $data[
'trim_user'] = $trim_user;
53 if (!is_null($entities))
55 $data[
'include_entities'] = $entities;
59 if (!is_null($my_retweet))
61 $data[
'include_my_retweet'] = $my_retweet;
65 return $this->sendRequest($path,
'GET', $data);
89 public function getUserTimeline($user, $count = 20, $include_rts = null, $no_replies = null, $since_id = 0, $max_id = 0, $trim_user = null,
93 $this->checkRateLimit(
'statuses',
'user_timeline');
98 if (is_numeric($user))
100 $data[
'user_id'] = $user;
102 elseif (is_string($user))
104 $data[
'screen_name'] = $user;
109 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
113 $path =
'/statuses/user_timeline.json';
116 $data[
'count'] = $count;
119 if (!is_null($include_rts))
121 $data[
'include_rts'] = $include_rts;
125 if (!is_null($no_replies))
127 $data[
'exclude_replies'] = $no_replies;
133 $data[
'since_id'] = (int) $since_id;
139 $data[
'max_id'] = (int) $max_id;
143 if (!is_null($trim_user))
145 $data[
'trim_user'] = $trim_user;
149 if (!is_null($contributor))
151 $data[
'contributor_details'] = $contributor;
155 return $this->sendRequest($path,
'GET', $data);
174 public function tweet($status, $in_reply_to_status_id = null, $lat = null, $long = null, $place_id = null, $display_coordinates = null,
178 $path =
'/statuses/update.json';
181 $data = array(
'status' => utf8_encode($status));
184 if ($in_reply_to_status_id)
186 $data[
'in_reply_to_status_id'] = $in_reply_to_status_id;
198 $data[
'long'] = $long;
204 $data[
'place_id'] = $place_id;
208 if (!is_null($display_coordinates))
210 $data[
'display_coordinates'] = $display_coordinates;
214 if (!is_null($trim_user))
216 $data[
'trim_user'] = $trim_user;
220 return $this->sendRequest($path,
'POST', $data);
243 public function getMentions($count = 20, $include_rts = null, $entities = null, $since_id = 0, $max_id = 0,
244 $trim_user = null, $contributor = null)
247 $this->checkRateLimit(
'statuses',
'mentions_timeline');
250 $path =
'/statuses/mentions_timeline.json';
253 $data[
'count'] = $count;
256 if (!is_null($include_rts))
258 $data[
'include_rts'] = $include_rts;
262 if (!is_null($entities))
264 $data[
'include_entities'] = $entities;
270 $data[
'since_id'] = (int) $since_id;
276 $data[
'max_id'] = (int) $max_id;
280 if (!is_null($trim_user))
282 $data[
'trim_user'] = $trim_user;
286 if (!is_null($contributor))
288 $data[
'contributor_details'] = $contributor;
292 return $this->sendRequest($path,
'GET', $data);
312 public function getRetweetsOfMe($count = 20, $since_id = 0, $entities = null, $user_entities = null, $max_id = 0, $trim_user = null)
315 $this->checkRateLimit(
'statuses',
'retweets_of_me');
318 $path =
'/statuses/retweets_of_me.json';
321 $data[
'count'] = $count;
326 $data[
'since_id'] = (int) $since_id;
332 $data[
'max_id'] = (int) $max_id;
336 if (!is_null($trim_user))
338 $data[
'trim_user'] = $trim_user;
342 if (!is_null($entities))
344 $data[
'include_entities'] = $entities;
348 if (!is_null($user_entities))
350 $data[
'include_user_entities'] = $user_entities;
354 return $this->sendRequest($path,
'GET', $data);
372 public function getRetweeters($id, $count = 20, $cursor = null, $stringify_ids = null)
375 $this->checkRateLimit(
'statuses',
'retweeters/ids');
378 $path =
'/statuses/retweeters/ids.json';
384 $data[
'count'] = $count;
387 if (!is_null($cursor))
389 $data[
'cursor'] = $cursor;
393 if (!is_null($stringify_ids))
395 $data[
'stringify_ids'] = $stringify_ids;
399 return $this->sendRequest($path,
'GET', $data);
415 public function getRetweetsById($id, $count = 20, $trim_user = null)
418 $this->checkRateLimit(
'statuses',
'retweets/:id');
421 $path =
'/statuses/retweets/' . $id .
'.json';
424 $data[
'count'] = $count;
427 if (!is_null($trim_user))
429 $data[
'trim_user'] = $trim_user;
433 return $this->sendRequest($path,
'GET', $data);
447 public function deleteTweet($id, $trim_user = null)
450 $path =
'/statuses/destroy/' . $id .
'.json';
455 if (!is_null($trim_user))
457 $data[
'trim_user'] = $trim_user;
461 return $this->sendRequest($path,
'POST', $data);
475 public function retweet($id, $trim_user = null)
478 $path =
'/statuses/retweet/' . $id .
'.json';
483 if (!is_null($trim_user))
485 $data[
'trim_user'] = $trim_user;
489 return $this->sendRequest($path,
'POST', $data);
509 public function tweetWithMedia($status, $media, $in_reply_to_status_id = null, $lat = null, $long = null, $place_id = null,
510 $display_coordinates = null, $sensitive = null)
513 $path =
'/statuses/update_with_media.json';
517 'status' => utf8_encode($status),
518 'media[]' =>
"@{$media}"
521 $header = array(
'Content-Type' =>
'multipart/form-data');
524 if (!is_null($in_reply_to_status_id))
526 $data[
'in_reply_to_status_id'] = $in_reply_to_status_id;
538 $data[
'long'] = $long;
544 $data[
'place_id'] = $place_id;
548 if (!is_null($display_coordinates))
550 $data[
'display_coordinates'] = $display_coordinates;
554 if (!is_null($sensitive))
556 $data[
'possibly_sensitive'] = $sensitive;
560 return $this->sendRequest($path,
'POST', $data, $header);
588 public function getOembed($id = null, $url = null, $maxwidth = null, $hide_media = null, $hide_thread = null, $omit_script = null,
589 $align = null, $related = null, $lang = null)
592 $this->checkRateLimit(
'statuses',
'oembed');
595 $path =
'/statuses/oembed.json';
604 $data[
'url'] = rawurlencode($url);
609 throw new RuntimeException(
'Either the id or url parameters must be specified in a request.');
615 $data[
'maxwidth'] = $maxwidth;
619 if (!is_null($hide_media))
621 $data[
'hide_media'] = $hide_media;
625 if (!is_null($hide_thread))
627 $data[
'hide_thread'] = $hide_thread;
631 if (!is_null($omit_script))
633 $data[
'omit_script'] = $omit_script;
639 $data[
'align'] = $align;
645 $data[
'related'] = $related;
651 $data[
'lang'] = $lang;
655 return $this->sendRequest($path,
'GET', $data);