forked from GNUsocial/gnu-social
Update Twitter calls to use documented API endpoints
see: http://groups.google.com/group/twitter-api-announce/msg/34b013f4d092737f
This commit is contained in:
parent
786250e3d9
commit
073f3e99cb
@ -44,7 +44,7 @@ $n->query('SELECT notice.id, notice.uri ' .
|
|||||||
'AND notice_to_status.status_id IS NULL');
|
'AND notice_to_status.status_id IS NULL');
|
||||||
|
|
||||||
while ($n->fetch()) {
|
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];
|
$status_id = $match[1];
|
||||||
Notice_to_status::saveNew($n->id, $status_id);
|
Notice_to_status::saveNew($n->id, $status_id);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ function add_twitter_user($twitter_id, $screen_name)
|
|||||||
$fuser = new Foreign_user();
|
$fuser = new Foreign_user();
|
||||||
|
|
||||||
$fuser->nickname = $screen_name;
|
$fuser->nickname = $screen_name;
|
||||||
$fuser->uri = 'http://twitter.com/' . $screen_name;
|
$fuser->uri = 'http://twitter.com/#!/' . $screen_name;
|
||||||
$fuser->id = $twitter_id;
|
$fuser->id = $twitter_id;
|
||||||
$fuser->service = TWITTER_SERVICE;
|
$fuser->service = TWITTER_SERVICE;
|
||||||
$fuser->created = common_sql_now();
|
$fuser->created = common_sql_now();
|
||||||
|
@ -207,7 +207,7 @@ class TwitterImport
|
|||||||
*/
|
*/
|
||||||
function makeStatusURI($username, $id)
|
function makeStatusURI($username, $id)
|
||||||
{
|
{
|
||||||
return 'http://twitter.com/'
|
return 'http://twitter.com/#!/'
|
||||||
. $username
|
. $username
|
||||||
. '/status/'
|
. '/status/'
|
||||||
. $id;
|
. $id;
|
||||||
@ -264,7 +264,7 @@ class TwitterImport
|
|||||||
function ensureProfile($user)
|
function ensureProfile($user)
|
||||||
{
|
{
|
||||||
// check to see if there's already a profile for this 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);
|
$profile = $this->getProfileByUrl($user->screen_name, $profileurl);
|
||||||
|
|
||||||
if (!empty($profile)) {
|
if (!empty($profile)) {
|
||||||
@ -618,15 +618,15 @@ class TwitterImport
|
|||||||
|
|
||||||
static function tagLink($tag)
|
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)
|
static function atLink($screenName, $fullName=null)
|
||||||
{
|
{
|
||||||
if (!empty($fullName)) {
|
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 {
|
} else {
|
||||||
return "<a href='http://twitter.com/{$screenName}'>{$screenName}</a>";
|
return "<a href='http://twitter.com/#!/{$screenName}'>{$screenName}</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,10 +43,10 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||||||
*/
|
*/
|
||||||
class TwitterOAuthClient extends OAuthClient
|
class TwitterOAuthClient extends OAuthClient
|
||||||
{
|
{
|
||||||
public static $requestTokenURL = 'https://twitter.com/oauth/request_token';
|
public static $requestTokenURL = 'https://api.twitter.com/oauth/request_token';
|
||||||
public static $authorizeURL = 'https://twitter.com/oauth/authorize';
|
public static $authorizeURL = 'https://api.twitter.com/oauth/authorize';
|
||||||
public static $signinUrl = 'https://twitter.com/oauth/authenticate';
|
public static $signinUrl = 'https://api.twitter.com/oauth/authenticate';
|
||||||
public static $accessTokenURL = 'https://twitter.com/oauth/access_token';
|
public static $accessTokenURL = 'https://api.twitter.com/oauth/access_token';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -157,7 +157,7 @@ class TwitterOAuthClient extends OAuthClient
|
|||||||
*/
|
*/
|
||||||
function verifyCredentials()
|
function verifyCredentials()
|
||||||
{
|
{
|
||||||
$url = 'https://twitter.com/account/verify_credentials.json';
|
$url = 'https://api.twitter.com/1/account/verify_credentials.json';
|
||||||
$response = $this->oAuthGet($url);
|
$response = $this->oAuthGet($url);
|
||||||
$twitter_user = json_decode($response);
|
$twitter_user = json_decode($response);
|
||||||
return $twitter_user;
|
return $twitter_user;
|
||||||
@ -175,7 +175,7 @@ class TwitterOAuthClient extends OAuthClient
|
|||||||
*/
|
*/
|
||||||
function statusesUpdate($status, $params=array())
|
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)) {
|
if (is_numeric($params)) {
|
||||||
$params = array('in_reply_to_status_id' => intval($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,
|
function statusesHomeTimeline($since_id = null, $max_id = null,
|
||||||
$cnt = null, $page = 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');
|
$params = array('include_entities' => 'true');
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ class TwitterOAuthClient extends OAuthClient
|
|||||||
function statusesFriends($id = null, $user_id = null, $screen_name = null,
|
function statusesFriends($id = null, $user_id = null, $screen_name = null,
|
||||||
$page = null)
|
$page = null)
|
||||||
{
|
{
|
||||||
$url = "https://twitter.com/statuses/friends.json";
|
$url = "https://api.twitter.com/1/statuses/friends.json";
|
||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ class TwitterOAuthClient extends OAuthClient
|
|||||||
function friendsIds($id = null, $user_id = null, $screen_name = null,
|
function friendsIds($id = null, $user_id = null, $screen_name = null,
|
||||||
$page = null)
|
$page = null)
|
||||||
{
|
{
|
||||||
$url = "https://twitter.com/friends/ids.json";
|
$url = "https://api.twitter.com/1/friends/ids.json";
|
||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user