Merge branch 'fix-twitter-uri' into 'master'

Twitter URIs have changed

The #! was deprecated ages ago, and Twitter forces HTTPS these days.

See merge request !43
This commit is contained in:
mmn 2015-12-14 21:07:48 +00:00
commit 0f938ff234

View File

@ -221,7 +221,7 @@ class TwitterImport
*/ */
function makeStatusURI($username, $id) function makeStatusURI($username, $id)
{ {
return 'http://twitter.com/#!/' return 'https://twitter.com/'
. $username . $username
. '/status/' . '/status/'
. $id; . $id;
@ -244,16 +244,19 @@ class TwitterImport
$profile->profileurl = $profileurl; $profile->profileurl = $profileurl;
$profile->limit(1); $profile->limit(1);
if (!$profile->find(true)) {
$profile->profileurl = str_replace('https://', 'http://', $profileurl);
if (!$profile->find(true)) { if (!$profile->find(true)) {
throw new NoResultException($profile); throw new NoResultException($profile);
} }
}
return $profile; return $profile;
} }
protected function ensureProfile($twuser) protected function ensureProfile($twuser)
{ {
// 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/' . $twuser->screen_name; $profileurl = 'https://twitter.com/' . $twuser->screen_name;
try { try {
$profile = $this->getProfileByUrl($twuser->screen_name, $profileurl); $profile = $this->getProfileByUrl($twuser->screen_name, $profileurl);
$this->updateAvatar($twuser, $profile); $this->updateAvatar($twuser, $profile);
@ -539,9 +542,9 @@ class TwitterImport
static function atLink($screenName, $fullName, $orig) static function atLink($screenName, $fullName, $orig)
{ {
if (!empty($fullName)) { if (!empty($fullName)) {
return "<a href='http://twitter.com/#!/{$screenName}' title='{$fullName}'>{$orig}</a>"; return "<a href='https://twitter.com/{$screenName}' title='{$fullName}'>{$orig}</a>";
} else { } else {
return "<a href='http://twitter.com/#!/{$screenName}'>{$orig}</a>"; return "<a href='https://twitter.com/{$screenName}'>{$orig}</a>";
} }
} }