return null;
}
+ function onEndProfileSettingsActions($out) {
+ $siteName = common_config('site', 'name');
+ $js = 'navigator.registerContentHandler("application/vnd.mozilla.maybe.feed", "'.addslashes(common_local_url('ostatussub', null, array('profile' => '%s'))).'", "'.addslashes($siteName).'")';
+ $out->elementStart('li');
+ $out->element('a',
+ array('href' => 'javascript:'.$js),
+ // TRANS: Option in profile settings to add this instance to Firefox as a feedreader
+ _('Add to Firefox as feedreader'));
+ $out->elementEnd('li');
+ }
+
/**
* Make sure necessary tables are filled out.
*/
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
common_debug('Not a recognized feed type.', __FILE__);
+ } catch (FeedSubNoHubException $e) {
+ // TRANS: Error text.
+ $this->error = _m("Sorry, that feed is not Pubsubhubub enabled.");
+ common_debug('No hub found.', __FILE__);
} catch (Exception $e) {
// Any new ones we forgot about
// TRANS: Error message in OStatus plugin. Do not translate the domain names example.com
}
}
- // Try to get some hCard data
+ if (in_array(
+ preg_replace('/\s*;.*$/', '', $response->getHeader('Content-Type')),
+ array('application/rss+xml', 'application/atom+xml', 'application/xml', 'text/xml'))
+ ) {
+ $hints['feedurl'] = $response->getUrl();
+ } else {
+ // Try to get some hCard data
- $body = $response->getBody();
+ $body = $response->getBody();
- $hcardHints = DiscoveryHints::hcardHints($body, $finalUrl);
+ $hcardHints = DiscoveryHints::hcardHints($body, $finalUrl);
- if (!empty($hcardHints)) {
- $hints = array_merge($hints, $hcardHints);
+ if (!empty($hcardHints)) {
+ $hints = array_merge($hints, $hcardHints);
+ }
}
// Check if they've got an LRDD header
public function onEndShowHeadElements(Action $action)
{
+ if($action instanceof ShowNoticeAction) { // Showing a notice
+ $notice = Notice::getKV('id', $action->arg('notice'));
+
+ try {
+ $flink = Foreign_link::getByUserID($notice->profile_id, TWITTER_SERVICE);
+ $fuser = Foreign_user::getForeignUser($flink->foreign_id, TWITTER_SERVICE);
+ } catch (NoResultException $e) {
+ return true;
+ }
+
+ $statusId = twitter_status_id($notice);
+ if($notice instanceof Notice && $notice->isLocal() && $statusId) {
+ $tweetUrl = 'https://twitter.com/' . $fuser->nickname . '/status/' . $statusId;
+ $action->element('link', array('rel' => 'syndication', 'href' => $tweetUrl));
+ }
+ }
+
if (!($action instanceof AttachmentAction)) {
return true;
}
*/
function makeStatusURI($username, $id)
{
- return 'http://twitter.com/#!/'
+ return 'https://twitter.com/'
. $username
. '/status/'
. $id;
$profile->limit(1);
if (!$profile->find(true)) {
- throw new NoResultException($profile);
+ $profile->profileurl = str_replace('https://', 'http://', $profileurl);
+ if (!$profile->find(true)) {
+ throw new NoResultException($profile);
+ }
}
return $profile;
}
protected function ensureProfile($twuser)
{
// 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 {
$profile = $this->getProfileByUrl($twuser->screen_name, $profileurl);
$this->updateAvatar($twuser, $profile);
static function atLink($screenName, $fullName, $orig)
{
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 {
- return "<a href='http://twitter.com/#!/{$screenName}'>{$orig}</a>";
+ return "<a href='https://twitter.com/{$screenName}'>{$orig}</a>";
}
}
// If it's not a Twitter-style reply, or if the user WANTS to send replies,
// or if it's in reply to a twitter notice
if ( (($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) == FOREIGN_NOTICE_SEND_REPLY) ||
- ((is_twitter_notice($notice->reply_to) || is_twitter_notice($notice->repeat_of))
- && (($flink->noticesync & FOREIGN_NOTICE_RECV) == FOREIGN_NOTICE_RECV)) ||
+ is_twitter_notice($notice->reply_to) || is_twitter_notice($notice->repeat_of) ||
(empty($notice->reply_to) && !preg_match('/^@[a-zA-Z0-9_]{1,15}\b/u', $notice->content)) ){
return true;
}