summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-12-17 15:57:22 -0800
committerZach Copley <zach@status.net>2010-12-17 15:57:22 -0800
commit073f3e99cb5be798ab020eeedb28357b51f2e90f (patch)
tree00ac8617cef2ffc594725f9c59edfb63f8e7c2de
parent786250e3d9d10dac56f4649e5c4cf8e02fc71570 (diff)
Update Twitter calls to use documented API endpoints
see: http://groups.google.com/group/twitter-api-announce/msg/34b013f4d092737f
-rw-r--r--plugins/TwitterBridge/scripts/initialize_notice_to_status.php2
-rw-r--r--plugins/TwitterBridge/twitter.php2
-rw-r--r--plugins/TwitterBridge/twitterimport.php10
-rw-r--r--plugins/TwitterBridge/twitteroauthclient.php18
4 files changed, 16 insertions, 16 deletions
diff --git a/plugins/TwitterBridge/scripts/initialize_notice_to_status.php b/plugins/TwitterBridge/scripts/initialize_notice_to_status.php
index d1acfd53f..f4a60c479 100644
--- a/plugins/TwitterBridge/scripts/initialize_notice_to_status.php
+++ b/plugins/TwitterBridge/scripts/initialize_notice_to_status.php
@@ -44,7 +44,7 @@ $n->query('SELECT notice.id, notice.uri ' .
'AND notice_to_status.status_id IS NULL');
while ($n->fetch()) {
- if (preg_match('#^http://twitter.com/[\w_.]+/status/(\d+)$#', $n->uri, $match)) {
+ if (preg_match('/^http://twitter.com(/#!)?/[\w_.]+/status/(\d+)$/', $n->uri, $match)) {
$status_id = $match[1];
Notice_to_status::saveNew($n->id, $status_id);
}
diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php
index e8d11f3b6..a993f8ff8 100644
--- a/plugins/TwitterBridge/twitter.php
+++ b/plugins/TwitterBridge/twitter.php
@@ -45,7 +45,7 @@ function add_twitter_user($twitter_id, $screen_name)
$fuser = new Foreign_user();
$fuser->nickname = $screen_name;
- $fuser->uri = 'http://twitter.com/' . $screen_name;
+ $fuser->uri = 'http://twitter.com/#!/' . $screen_name;
$fuser->id = $twitter_id;
$fuser->service = TWITTER_SERVICE;
$fuser->created = common_sql_now();
diff --git a/plugins/TwitterBridge/twitterimport.php b/plugins/TwitterBridge/twitterimport.php
index 143543d8e..3a4c0c43c 100644
--- a/plugins/TwitterBridge/twitterimport.php
+++ b/plugins/TwitterBridge/twitterimport.php
@@ -207,7 +207,7 @@ class TwitterImport
*/
function makeStatusURI($username, $id)
{
- return 'http://twitter.com/'
+ return 'http://twitter.com/#!/'
. $username
. '/status/'
. $id;
@@ -264,7 +264,7 @@ class TwitterImport
function ensureProfile($user)
{
// check to see if there's already a profile for this user
- $profileurl = 'http://twitter.com/' . $user->screen_name;
+ $profileurl = 'http://twitter.com/#!/' . $user->screen_name;
$profile = $this->getProfileByUrl($user->screen_name, $profileurl);
if (!empty($profile)) {
@@ -618,15 +618,15 @@ class TwitterImport
static function tagLink($tag)
{
- return "<a href='https://twitter.com/search?q=%23{$tag}' class='hashtag'>{$tag}</a>";
+ return "<a href='https://search.twitter.com/search?q=%23{$tag}' class='hashtag'>{$tag}</a>";
}
static function atLink($screenName, $fullName=null)
{
if (!empty($fullName)) {
- return "<a href='http://twitter.com/{$screenName}' title='{$fullName}'>{$screenName}</a>";
+ return "<a href='http://twitter.com/#!/{$screenName}' title='{$fullName}'>{$screenName}</a>";
} else {
- return "<a href='http://twitter.com/{$screenName}'>{$screenName}</a>";
+ return "<a href='http://twitter.com/#!/{$screenName}'>{$screenName}</a>";
}
}
diff --git a/plugins/TwitterBridge/twitteroauthclient.php b/plugins/TwitterBridge/twitteroauthclient.php
index 345510a0d..a17911b03 100644
--- a/plugins/TwitterBridge/twitteroauthclient.php
+++ b/plugins/TwitterBridge/twitteroauthclient.php
@@ -43,10 +43,10 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
*/
class TwitterOAuthClient extends OAuthClient
{
- public static $requestTokenURL = 'https://twitter.com/oauth/request_token';
- public static $authorizeURL = 'https://twitter.com/oauth/authorize';
- public static $signinUrl = 'https://twitter.com/oauth/authenticate';
- public static $accessTokenURL = 'https://twitter.com/oauth/access_token';
+ public static $requestTokenURL = 'https://api.twitter.com/oauth/request_token';
+ public static $authorizeURL = 'https://api.twitter.com/oauth/authorize';
+ public static $signinUrl = 'https://api.twitter.com/oauth/authenticate';
+ public static $accessTokenURL = 'https://api.twitter.com/oauth/access_token';
/**
* Constructor
@@ -157,7 +157,7 @@ class TwitterOAuthClient extends OAuthClient
*/
function verifyCredentials()
{
- $url = 'https://twitter.com/account/verify_credentials.json';
+ $url = 'https://api.twitter.com/1/account/verify_credentials.json';
$response = $this->oAuthGet($url);
$twitter_user = json_decode($response);
return $twitter_user;
@@ -175,7 +175,7 @@ class TwitterOAuthClient extends OAuthClient
*/
function statusesUpdate($status, $params=array())
{
- $url = 'https://twitter.com/statuses/update.json';
+ $url = 'https://api.twitter.com/1/statuses/update.json';
if (is_numeric($params)) {
$params = array('in_reply_to_status_id' => intval($params));
}
@@ -200,7 +200,7 @@ class TwitterOAuthClient extends OAuthClient
function statusesHomeTimeline($since_id = null, $max_id = null,
$cnt = null, $page = null)
{
- $url = 'https://twitter.com/statuses/home_timeline.json';
+ $url = 'https://api.twitter.com/1/statuses/home_timeline.json';
$params = array('include_entities' => 'true');
@@ -235,7 +235,7 @@ class TwitterOAuthClient extends OAuthClient
function statusesFriends($id = null, $user_id = null, $screen_name = null,
$page = null)
{
- $url = "https://twitter.com/statuses/friends.json";
+ $url = "https://api.twitter.com/1/statuses/friends.json";
$params = array();
@@ -273,7 +273,7 @@ class TwitterOAuthClient extends OAuthClient
function friendsIds($id = null, $user_id = null, $screen_name = null,
$page = null)
{
- $url = "https://twitter.com/friends/ids.json";
+ $url = "https://api.twitter.com/1/friends/ids.json";
$params = array();