i18n fixes (gettext domain).
L10n updates.
Whitespace updates.
Some tabs to spaces.
array('group' => $group->nickname));
$widget->out->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'),
+ // TRANS: Link to subscribe to a remote entity.
_m('Subscribe'));
$output->elementEnd('li');
array('tagger' => $profile->nickname, 'peopletag' => $peopletag->tag));
$output->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'),
+ // TRANS: Link to subscribe to a remote entity.
_m('Subscribe'));
$output->elementEnd('li');
'action' => common_local_url('tagprofile', array('id' => @$profile->id))));
$action->elementStart('fieldset');
- $action->element('legend', null, _('Tag remote profile'));
+ // TRANS: Fieldset legend.
+ $action->element('legend', null, _m('Tag remote profile'));
$action->hidden('token', common_session_token());
$user = common_current_user();
$action->elementStart('ul', 'form_data');
$action->elementStart('li');
- $action->input('uri', _('Remote profile'), $action->trimmed('uri'),
- _('OStatus user\'s address, like nickname@example.com or http://example.net/nickname'));
+ // TRANS: Field label.
+ $action->input('uri', _m('LABEL','Remote profile'), $action->trimmed('uri'),
+ // TRANS: Field title.
+ _m('OStatus user\'s address, like nickname@example.com or http://example.net/nickname.'));
$action->elementEnd('li');
$action->elementEnd('ul');
- $action->submit('fetch', _('Fetch'));
+ // TRANS: Button text to fetch remote profile.
+ $action->submit('fetch', _m('BUTTON','Fetch'));
$action->elementEnd('fieldset');
$action->elementEnd('form');
}
} else if (Validate::uri($uri)) {
$oprofile = Ostatus_profile::ensureProfileURL($uri);
} else {
- throw new Exception('Invalid URI');
+ // TRANS: Exception in OStatus when invalid URI was entered.
+ throw new Exception(_m('Invalid URI.'));
}
// redirect to the new profile.
return false;
} catch (Exception $e) {
- $err = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname");
+ // TRANS: Error message in OStatus plugin.
+ $err = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
}
$action->showForm($err);
} else if (Validate::uri($q)) {
$oprofile = Ostatus_profile::ensureProfileURL($q);
} else {
- throw new Exception('Invalid URI');
+ // TRANS: Exception in OStatus when invalid URI was entered.
+ throw new Exception(_m('Invalid URI.'));
}
return $this->filter(array($oprofile->localProfile()));
} catch (Exception $e) {
- $this->msg = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname");
+ // TRANS: Error message in OStatus plugin.
+ $this->msg = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
return array();
}
}
* @param array &$mention in/out param: set of found mentions
* @return boolean hook return value
*/
-
function onEndFindMentions($sender, $text, &$mentions)
{
$matches = array();
}
$url = $notice->url;
- // TRANSLATE: %s is a domain.
- $title = sprintf(_m("Sent from %s via OStatus"), $domain);
+ // TRANS: Title.
+ // TRANS: %s is a domain name.
+ $title = sprintf(_m('Sent from %s via OStatus'), $domain);
return false;
}
}
- return true;
+ return true;
}
/**
}
if (!$oprofile->subscribe()) {
- // TRANS: Exception.
+ // TRANS: Exception thrown when setup of remote subscription fails.
throw new Exception(_m('Could not set up remote subscription.'));
}
}
/**
* Notify remote server and garbage collect unused feeds on unsubscribe.
- * @fixme send these operations to background queues
+ * @todo FIXME: Send these operations to background queues
*
* @param User $user
* @param Profile $other
common_date_iso8601(time()));
$act->time = time();
- $act->title = _m('Unfollow');
+ // TRANS: Title for unfollowing a remote profile.
+ $act->title = _m('TITLE','Unfollow');
// TRANS: Success message for unsubscribe from user attempt through OStatus.
// TRANS: %1$s is the unsubscriber's name, %2$s is the unsubscribed user's name.
$act->content = sprintf(_m('%1$s stopped following %2$s.'),
*
* @return mixed hook return value
*/
-
function onStartJoinGroup($group, $user)
{
$oprofile = Ostatus_profile::staticGet('group_id', $group->id);
if ($oprofile) {
if (!$oprofile->subscribe()) {
+ // TRANS: Exception thrown when setup of remote group membership fails.
throw new Exception(_m('Could not set up remote group membership.'));
}
$act->object = $oprofile->asActivityObject();
$act->time = time();
- $act->title = _m("Join");
+ // TRANS: Title to join a remote group.
+ $act->title = _m('TITLE','Join');
// TRANS: Success message for subscribe to group attempt through OStatus.
// TRANS: %1$s is the member name, %2$s is the subscribed group's name.
$act->content = sprintf(_m('%1$s has joined group %2$s.'),
return true;
} else {
$oprofile->garbageCollect();
- // TRANS: Exception.
- throw new Exception(_m("Failed joining remote group."));
+ // TRANS: Exception thrown when joining a remote group fails.
+ throw new Exception(_m('Failed joining remote group.'));
}
}
}
*
* @return mixed hook return value
*/
-
function onEndLeaveGroup($group, $user)
{
$oprofile = Ostatus_profile::staticGet('group_id', $group->id);
$act->object = $oprofile->asActivityObject();
$act->time = time();
- $act->title = _m("Leave");
+ // TRANS: Title for leaving a remote group.
+ $act->title = _m('TITLE','Leave');
// TRANS: Success message for unsubscribe from group attempt through OStatus.
// TRANS: %1$s is the member name, %2$s is the unsubscribed group's name.
$act->content = sprintf(_m('%1$s has left group %2$s.'),
$oprofile = Ostatus_profile::staticGet('peopletag_id', $peopletag->id);
if ($oprofile) {
if (!$oprofile->subscribe()) {
- throw new Exception(_m('Could not set up remote peopletag subscription.'));
+ // TRANS: Exception thrown when setup of remote people tag subscription fails.
+ throw new Exception(_m('Could not set up remote people tag subscription.'));
}
$sub = $user->getProfile();
$act->object = $oprofile->asActivityObject();
$act->time = time();
- $act->title = _m("Follow list");
- $act->content = sprintf(_m("%s is now following people tagged %s by %s."),
+ // TRANS: Title for remote follow list.
+ $act->title = _m('TITLE','Follow list');
+ // TRANS: Success message for remote list follow through OStatus.
+ // TRANS: %1$s is the subscriber name, %2$s the prople tag, %3$s is the tagger's name.
+ $act->content = sprintf(_m("%1$s is now following people tagged %2$s by %3$s."),
$sub->getBestName(),
$oprofile->getBestName(),
$tagger->getBestName());
return true;
} else {
$oprofile->garbageCollect();
- throw new Exception(_m("Failed subscribing to remote peopletag."));
+ // TRANS: Exception thrown when subscription of remote people tag fails.
+ throw new Exception(_m('Failed subscribing to remote people tag.'));
}
}
}
$act->object = $oprofile->asActivityObject();
$act->time = time();
- $act->title = _m("Unfollow peopletag");
- $act->content = sprintf(_m("%s stopped following the list %s by %s."),
+ $act->title = _m('Unfollow people tag');
+ $act->content = sprintf(_m('%1$s stopped following the list %2$s by %3$s.'),
$sub->getBestName(),
$oprofile->getBestName(),
$tagger->getBestName());
$plist->tagger, $plist->id,
common_date_iso8601(time()));
$act->time = time();
- $act->title = _("Tag");
- $act->content = sprintf(_("%s tagged %s in the list %s"),
+ $act->title = _m('TITLE','Tag');
+ $act->content = sprintf(_m('%1$s tagged %2$s in the list %3$s.'),
$tagger->getBestName(),
$tagged->getBestName(),
$plist->getBestName());
// initiate a PuSH subscription for the person being tagged
if (!$oprofile->subscribe()) {
- throw new Exception(sprintf(_('Could not complete subscription to remote '.
+ throw new Exception(sprintf(_m('Could not complete subscription to remote '.
'profile\'s feed. Tag %s could not be saved.'), $ptag->tag));
return false;
}
$plist->tagger, $plist->id,
common_date_iso8601(time()));
$act->time = time();
- $act->title = _("Untag");
- $act->content = sprintf(_("%s untagged %s from the list %s"),
+ $act->title = _m('TITLE','Untag');
+ $act->content = sprintf(_('%1$s untagged %2$s from the list %3$s.'),
$tagger->getBestName(),
$tagged->getBestName(),
$plist->getBestName());
*
* @return hook return value
*/
-
function onEndDisfavorNotice(Profile $profile, Notice $notice)
{
$user = User::staticGet('id', $profile->id);
$act->title = _m("Profile update");
// TRANS: Ping text for remote profile update through OStatus.
// TRANS: %s is user that updated their profile.
- $act->content = sprintf(_m("%s has updated their profile page."),
+ $act->content = sprintf(_m('%s has updated their profile page.'),
$profile->getBestName());
$act->actor = ActivityObject::fromProfile($profile);
// so we check locally first.
$user = User::staticGet('uri', $uri);
-
+
if (!empty($user)) {
$profile = $user->getProfile();
return false;
function onEndXrdActionLinks(&$xrd, $user)
{
- $xrd->links[] = array('rel' => Discovery::UPDATESFROM,
- 'href' => common_local_url('ApiTimelineUser',
- array('id' => $user->id,
- 'format' => 'atom')),
- 'type' => 'application/atom+xml');
-
- // Salmon
+ $xrd->links[] = array('rel' => Discovery::UPDATESFROM,
+ 'href' => common_local_url('ApiTimelineUser',
+ array('id' => $user->id,
+ 'format' => 'atom')),
+ 'type' => 'application/atom+xml');
+
+ // Salmon
$salmon_url = common_local_url('usersalmon',
array('id' => $user->id));
$url = common_local_url('ostatussub') . '?profile={uri}';
$xrd->links[] = array('rel' => 'http://ostatus.org/schema/1.0/subscribe',
'template' => $url );
-
- return true;
+
+ return true;
}
}
and we have no polling backend. (The fallback hub option can be used
with a 3rd-party service to provide such polling.)
-
Todo:
* better support for feeds that aren't natively oriented at social networking
* make use of tags/categories from feeds
$oprofile = Ostatus_profile::staticGet('group_id', $id);
if ($oprofile) {
// TRANS: Client error.
- $this->clientError(_m("Can't accept remote posts for a remote group."));
+ $this->clientError(_m('Cannot accept remote posts for a remote group.'));
}
return true;
break;
default:
// TRANS: Client exception.
- throw new ClientException("Can't handle that kind of post.");
+ throw new ClientException('Cannot handle that kind of post.');
}
// Notice must be to the attention of this group
$oprofile = $this->ensureProfile();
if (!$oprofile) {
// TRANS: Client error.
- $this->clientError(_m("Can't read profile to set up group membership."));
+ $this->clientError(_m('Cannot read profile to set up group membership.'));
}
if ($oprofile->isGroup()) {
// TRANS: Client error.
- $this->clientError(_m("Groups can't join groups."));
+ $this->clientError(_m('Groups cannot join groups.'));
}
common_log(LOG_INFO, "Remote profile {$oprofile->uri} joining local group {$this->group->nickname}");
{
$oprofile = $this->ensureProfile();
if (!$oprofile) {
- $this->clientError(_m("Can't read profile to cancel group membership."));
+ $this->clientError(_m('Cannot read profile to cancel group membership.'));
}
if ($oprofile->isGroup()) {
- $this->clientError(_m("Groups can't join groups."));
+ $this->clientError(_m('Groups cannot join groups.'));
}
common_log(LOG_INFO, "Remote profile {$oprofile->uri} leaving local group {$this->group->nickname}");
/* Use a session token for CSRF protection. */
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
+ // TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_m('There was a problem with your session token. '.
'Try again, please.'));
return;
$this->elementStart('html');
$this->elementStart('head');
// TRANS: Form title.
- $this->element('title', null, _m('Subscribe to user'));
+ $this->element('title', null, _m('TITLE','Subscribe to user'));
$this->elementEnd('head');
$this->elementStart('body');
$this->showContent();
function showContent()
{
if ($this->group) {
- // TRANS: Form legend.
+ // TRANS: Form legend. %s is a group name.
$header = sprintf(_m('Join group %s'), $this->group);
+ // TRANS: Button text to join a group.
$submit = _m('BUTTON','Join');
} else if ($this->peopletag && $this->tagger) {
- $header = sprintf(_m('Subscribe to people tagged %s by %s'), $this->peopletag, $this->tagger);
- $submit = _m('Subscribe');
+ // TRANS: Form legend. %1$s is a people tag, %2$s is a tagger's name.
+ $header = sprintf(_m('Subscribe to people tagged %1$s by %2$s'), $this->peopletag, $this->tagger);
+ // TRANS: Button text to subscribe to a people tag.
$submit = _m('BUTTON','Subscribe');
// TRANS: Button text.
} else {
- // TRANS: Form legend.
+ // TRANS: Form legend. %s is a nickname.
$header = sprintf(_m('Subscribe to %s'), $this->nickname);
- // TRANS: Button text.
+ // TRANS: Button text to subscribe to a profile.
$submit = _m('BUTTON','Subscribe');
}
$this->elementStart('form', array('id' => 'form_ostatus_connect',
if ($this->group) {
// TRANS: Field label.
$this->input('group', _m('Group nickname'), $this->group,
+ // TRANS: Field title.
_m('Nickname of the group you want to join.'));
} else {
// TRANS: Field label.
$this->input('nickname', _m('User nickname'), $this->nickname,
+ // TRANS: Field title.
_m('Nickname of the user you want to follow.'));
$this->hidden('tagger', $this->tagger);
$this->hidden('peopletag', $this->peopletag);
// TRANS: Field label.
$this->input('profile', _m('Profile Account'), $this->profile,
// TRANS: Tooltip for field label "Profile Account".
- _m('Your account id (e.g. user@identi.ca).'));
+ _m('Your account ID (e.g. user@identi.ca).'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->submit('submit', $submit);
$result = $disco->lookup($acct);
if (!$result) {
// TRANS: Client error.
- $this->clientError(_m("Couldn't look up OStatus account profile."));
+ $this->clientError(_m('Could not look up OStatus account profile.'));
}
foreach ($result->links as $link) {
}
// TRANS: Client error.
- $this->clientError(_m("Couldn't confirm remote profile address."));
+ $this->clientError(_m('Could not confirm remote profile address.'));
}
function connectProfile($subscriber_profile)
$cur = common_current_user();
if ($ptag->hasSubscriber($cur->id)) {
$this->element('div', array('class' => 'error'),
- _m("You are already subscribed to this peopletag."));
+ _m('You are already subscribed to this people tag.'));
$ok = false;
} else {
$ok = true;
// CSRF protection
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
+ // TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_m('There was a problem with your session token. '.
'Try again, please.'));
return;
$disco = new Discovery;
$result = $disco->lookup($acct);
if (!$result) {
- $this->clientError(_m("Couldn't look up OStatus account profile."));
+ $this->clientError(_m('Could not look up OStatus account profile.'));
}
foreach ($result->links as $link) {
}
}
- $this->clientError(_m("Couldn't confirm remote profile address."));
+ $this->clientError(_m('Could not confirm remote profile address.'));
}
function connectProfile($subscriber_profile)
$id = $this->trimmed('id');
if (!$id) {
- $this->clientError(_('No ID.'));
+ $this->clientError(_m('No ID.'));
}
$this->peopletag = Profile_list::staticGet('id', $id);
if (empty($this->peopletag)) {
- $this->clientError(_('No such peopletag.'));
+ $this->clientError(_m('No such people tag.'));
}
$oprofile = Ostatus_profile::staticGet('peopletag_id', $id);
if (!empty($oprofile)) {
- $this->clientError(_m("Can't accept remote posts for a remote peopletag."));
+ $this->clientError(_m('Cannot accept remote posts for a remote people tag.'));
}
return true;
{
$oprofile = $this->ensureProfile();
if (!$oprofile) {
- $this->clientError(_m("Can't read profile to set up profiletag subscription."));
+ $this->clientError(_m('Cannot read profile to set up profile tag subscription.'));
}
if ($oprofile->isGroup()) {
- $this->clientError(_m("Groups can't subscribe to peopletags."));
+ $this->clientError(_m('Groups cannot subscribe to people tags.'));
}
common_log(LOG_INFO, "Remote profile {$oprofile->uri} subscribing to local peopletag ".$this->peopletag->getBestName());
try {
Profile_tag_subscription::add($this->peopletag, $profile);
} catch (Exception $e) {
- $this->serverError(sprintf(_m('Could not subscribe remote user %1$s to peopletag %2$s.'),
+ $this->serverError(sprintf(_m('Could not subscribe remote user %1$s to people tag %2$s.'),
$oprofile->uri, $this->peopletag->getBestName()));
}
}
{
$oprofile = $this->ensureProfile();
if (!$oprofile) {
- $this->clientError(_m("Can't read profile to cancel peopletag membership."));
+ $this->clientError(_m('Cannot read profile to cancel people tag membership.'));
}
if ($oprofile->isGroup()) {
- $this->clientError(_m("Groups can't subscribe to peopletags."));
+ $this->clientError(_m('Groups cannot subscribe to people tags.'));
}
common_log(LOG_INFO, "Remote profile {$oprofile->uri} unsubscribing from local peopletag ".$this->peopletag->getBestName());
Profile_tag_subscription::remove($this->peopletag->tagger, $this->peopletag->tag, $profile->id);
} catch (Exception $e) {
- $this->serverError(sprintf(_m('Could not remove remote user %1$s from peopletag %2$s.'),
+ $this->serverError(sprintf(_m('Could not remove remote user %1$s from people tag %2$s.'),
$oprofile->uri, $this->peopletag->getBestName()));
return;
}
}
/**
-
-
-Things to consider...
-* should we purge incomplete subscriptions that never get a verification pingback?
-* when can we send subscription renewal checks?
- - at next send time probably ok
-* when can we handle trimming of subscriptions?
- - at next send time probably ok
-* should we keep a fail count?
-
-*/
-
+ * Things to consider...
+ * should we purge incomplete subscriptions that never get a verification pingback?
+ * when can we send subscription renewal checks?
+ * - at next send time probably ok
+ * when can we handle trimming of subscriptions?
+ * - at next send time probably ok
+ * should we keep a fail count?
+ */
class PushHubAction extends Action
{
function arg($arg, $def=null)
$verify = $this->arg('hub.verify'); // @fixme may be multiple
if ($verify != 'sync' && $verify != 'async') {
- // TRANS: Client exception.
+ // TRANS: Client exception. %s is sync or async.
throw new ClientException(sprintf(_m('Invalid hub.verify "%s". It must be sync or async.'),$verify));
}
$lease = $this->arg('hub.lease_seconds', null);
if ($mode == 'subscribe' && $lease != '' && !preg_match('/^\d+$/', $lease)) {
- // TRANS: Client exception.
+ // TRANS: Client exception. %s is the invalid lease value.
throw new ClientException(sprintf(_m('Invalid hub.lease "%s". It must be empty or positive integer.'),$lease));
}
$secret = $this->arg('hub.secret', null);
if ($secret != '' && strlen($secret) >= 200) {
- // TRANS: Client exception.
+ // TRANS: Client exception. %s is the invalid hub secret.
throw new ClientException(sprintf(_m('Invalid hub.secret "%s". It must be under 200 bytes.'),$secret));
}
if ($feed == $userFeed) {
$user = User::staticGet('id', $id);
if (!$user) {
- // TRANS: Client exception.
- throw new ClientException(sprintt(_m('Invalid hub.topic "%s". User doesn\'t exist.'),$feed));
+ // TRANS: Client exception. %s is a feed URL.
+ throw new ClientException(sprintt(_m('Invalid hub.topic "%s". User does not exist.'),$feed));
} else {
return true;
}
if ($feed == $groupFeed) {
$user = User_group::staticGet('id', $id);
if (!$user) {
- // TRANS: Client exception.
- throw new ClientException(sprintf(_m('Invalid hub.topic "%s". Group doesn\'t exist.'),$feed));
+ // TRANS: Client exception. %s is a feed URL.
+ throw new ClientException(sprintf(_m('Invalid hub.topic "%s". Group does not exist.'),$feed));
} else {
return true;
}
$list = Profile_list::staticGet('id', $id);
$user = User::staticGet('id', $user);
if (!$list || !$user || $list->tagger != $user->id) {
- throw new ClientException("Invalid hub.topic $feed; people tag doesn't exist.");
+ // TRANS: Client exception. %s is a feed URL.
+ throw new ClientException(sprintf(_m('Invalid hub.topic %s; people tag does not exist.'),$feed));
} else {
return true;
}
case ActivityObject::COMMENT:
break;
default:
- throw new ClientException("Can't handle that kind of post.");
+ throw new ClientException(_m('Cannot handle that kind of post.'));
}
// Notice must either be a) in reply to a notice by this user
{
if (!$object) {
// TRANS: Client exception.
- throw new ClientException(_m('Can\'t favorite/unfavorite without an object.'));
+ throw new ClientException(_m('Cannot favorite/unfavorite without an object.'));
}
switch ($object->type) {
break;
default:
// TRANS: Client exception.
- throw new ClientException(_m('Can\'t handle that kind of object for liking/faving.'));
+ throw new ClientException(_m('Cannot handle that kind of object for liking/faving.'));
}
$notice = Notice::staticGet('uri', $object->id);
// We'll never actually get updates in this mode.
return true;
} else {
+ // TRANS: Server exception.
throw new ServerException(_m('Attempting to start PuSH subscription for feed with no hub.'));
}
}
// We'll never actually get updates in this mode.
return true;
} else {
+ // TRANS: Server exception.
throw new ServerException(_m('Attempting to end PuSH subscription for feed with no hub.'));
}
}
*
* @return array array of column definitions
*/
-
static function schemaDef()
{
return array(
return true;
} else if ($this->group_id && ($this->profile_id || $this->peopletag_id)) {
// TRANS: Server exception. %s is a URI
- throw new ServerException(_m("Invalid ostatus_profile state: two or more IDs set for %s", $this->uri));
+ throw new ServerException(sprintf(_m('Invalid ostatus_profile state: two or more IDs set for %s'), $this->uri));
} else {
// TRANS: Server exception. %s is a URI
- throw new ServerException(_m("Invalid ostatus_profile state: all IDs empty for %s", $this->uri));
+ throw new ServerException(sprintf(_m('Invalid ostatus_profile state: all IDs empty for %s.'), $this->uri));
}
}
return true;
} else if ($this->peopletag_id && ($this->profile_id || $this->group_id)) {
// TRANS: Server exception. %s is a URI
- throw new ServerException(_m("Invalid ostatus_profile state: two or more IDs set for %s", $this->uri));
+ throw new ServerException(sprintf(_m('Invalid ostatus_profile state: two or more IDs set for %s'), $this->uri));
} else {
// TRANS: Server exception. %s is a URI
- throw new ServerException(_m("Invalid ostatus_profile state: all IDs empty for %s", $this->uri));
+ throw new ServerException(sprintf(_m('Invalid ostatus_profile state: all IDs empty for %s.'), $this->uri));
}
}
$object = $this;
}
if ($this->salmonuri) {
-
$text = 'update';
$id = TagURI::mint('%s:%s:%s',
$verb,
* @param DOMElement $feed for context
* @param string $source identifier ("push" or "salmon")
*/
-
public function processEntry($entry, $feed, $source)
{
$activity = new Activity($entry, $feed);
if (Event::handle('StartHandleFeedEntryWithProfile', array($activity, $this)) &&
Event::handle('StartHandleFeedEntry', array($activity))) {
-
// @todo process all activity objects
switch ($activity->objects[0]->type) {
case ActivityObject::ARTICLE:
case ActivityObject::NOTE:
case ActivityObject::STATUS:
case ActivityObject::COMMENT:
- case null:
+ case null:
if ($activity->verb == ActivityVerb::POST) {
$this->processPost($activity, $source);
} else {
break;
default:
// TRANS: Client exception.
- throw new ClientException(_m('Can\'t handle that kind of post.'));
+ throw new ClientException(_m('Cannot handle that kind of post.'));
}
Event::handle('EndHandleFeedEntry', array($activity));
// We mark up the attachment link specially for the HTML output
// so we can fold-out the full version inline.
- // @fixme I18N this tooltip will be saved with the site's default language
+ // @todo FIXME i18n: This tooltip will be saved with the site's default language
// TRANS: Shown when a notice is longer than supported and/or when attachments are present. At runtime
// TRANS: this will usually be replaced with localised text from StatusNet core messages.
$showMoreText = _m('Show more');
* @throws Exception on various error conditions
* @throws OStatusShadowException if this reference would obscure a local user/group
*/
-
public static function ensureProfileURL($profile_url, $hints=array())
{
$oprofile = self::getFromProfileURL($profile_url);
* @return Ostatus_profile
* @throws Exception
*/
-
public static function ensureAtomFeed($feedEl, $hints)
{
$author = ActivityUtils::getFeedAuthor($feedEl);
if (empty($author)) {
// XXX: make some educated guesses here
// TRANS: Feed sub exception.
- throw new FeedSubException(_m('Can\'t find enough profile '.
+ throw new FeedSubException(_m('Cannot find enough profile '.
'information to make a feed.'));
}
}
if (!common_valid_http_url($url)) {
// TRANS: Server exception. %s is a URL.
- throw new ServerException(sprintf(_m("Invalid avatar URL %s."), $url));
+ throw new ServerException(sprintf(_m('Invalid avatar URL %s.'), $url));
}
if ($this->isGroup()) {
if (!$self) {
throw new ServerException(sprintf(
// TRANS: Server exception. %s is a URI.
- _m("Tried to update avatar for unsaved remote profile %s."),
+ _m('Tried to update avatar for unsaved remote profile %s.'),
$this->uri));
}
try {
if (!copy($url, $temp_filename)) {
// TRANS: Server exception. %s is a URL.
- throw new ServerException(sprintf(_m("Unable to fetch avatar from %s."), $url));
+ throw new ServerException(sprintf(_m('Unable to fetch avatar from %s.'), $url));
}
if ($this->isGroup()) {
* @param array $hints
* @return mixed URL string or false
*/
-
public static function getActivityObjectAvatar($object, $hints=array())
{
if ($object->avatarLinks) {
* @param DOMElement $feed
* @return string
*/
-
protected static function getAvatar($actor, $feed)
{
$url = '';
* @return Ostatus_profile
* @throws Exception
*/
-
public static function ensureActorProfile($activity, $hints=array())
{
return self::ensureActivityObjectProfile($activity->actor, $hints);
* @return Ostatus_profile
* @throws Exception
*/
-
public static function ensureActivityObjectProfile($object, $hints=array())
{
$profile = self::getActivityObjectProfile($object);
if (!$homeuri) {
common_log(LOG_DEBUG, __METHOD__ . " empty actor profile URI: " . var_export($activity, true));
- throw new Exception("No profile URI");
+ throw new Exception('No profile URI.');
}
$user = User::staticGet('uri', $homeuri);
if ($user) {
// TRANS: Exception.
- throw new Exception(_m('Local user can\'t be referenced as remote.'));
+ throw new Exception(_m('Local user cannot be referenced as remote.'));
}
if (OStatusPlugin::localGroupFromUrl($homeuri)) {
// TRANS: Exception.
- throw new Exception(_m('Local group can\'t be referenced as remote.'));
+ throw new Exception(_m('Local group cannot be referenced as remote.'));
}
$ptag = Profile_list::staticGet('uri', $homeuri);
if ($ptag) {
$local_user = User::staticGet('id', $ptag->tagger);
if (!empty($local_user)) {
- throw new Exception("Local peopletag can't be referenced as remote.");
+ throw new Exception('Local people tag cannot be referenced as remote.');
}
}
$oprofile->profile_id = $profile->insert();
if (!$oprofile->profile_id) {
// TRANS: Server exception.
- throw new ServerException(_m('Can\'t save local profile.'));
+ throw new ServerException(_m('Cannot save local profile.'));
}
} else if ($object->type == ActivityObject::GROUP) {
$group = new User_group();
$oprofile->group_id = $group->insert();
if (!$oprofile->group_id) {
// TRANS: Server exception.
- throw new ServerException(_m('Can\'t save local profile.'));
+ throw new ServerException(_m('Cannot save local profile.'));
}
} else if ($object->type == ActivityObject::_LIST) {
$ptag = new Profile_list();
$oprofile->peopletag_id = $ptag->insert();
if (!$oprofile->peopletag_id) {
- throw new ServerException("Can't save local peopletag");
+ throw new ServerException('Cannot save local people tag.');
}
}
if (!$ok) {
// TRANS: Server exception.
- throw new ServerException(_m('Can\'t save OStatus profile.'));
+ throw new ServerException(_m('Cannot save OStatus profile.'));
}
$avatar = self::getActivityObjectAvatar($object, $hints);
}
// Try looking it up
-
$oprofile = Ostatus_profile::staticGet('uri', 'acct:'.$addr);
if (!empty($oprofile)) {
$hints = array_merge($hints, $dhints);
// If there's an Hcard, let's grab its info
-
if (array_key_exists('hcard', $hints)) {
if (!array_key_exists('profileurl', $hints) ||
$hints['hcard'] != $hints['profileurl']) {
}
// If we got a feed URL, try that
-
if (array_key_exists('feedurl', $hints)) {
try {
common_log(LOG_INFO, "Discovery on acct:$addr with feed URL " . $hints['feedurl']);
}
// If we got a profile page, try that!
-
if (array_key_exists('profileurl', $hints)) {
try {
common_log(LOG_INFO, "Discovery on acct:$addr with profile URL $profileUrl");
if (!$profile_id) {
common_log_db_error($profile, 'INSERT', __FILE__);
// TRANS: Exception. %s is a webfinger address.
- throw new Exception(sprintf(_m('Couldn\'t save profile for "%s".'),$addr));
+ throw new Exception(sprintf(_m('Could not save profile for "%s".'),$addr));
}
$oprofile = new Ostatus_profile();
if (!$result) {
common_log_db_error($oprofile, 'INSERT', __FILE__);
// TRANS: Exception. %s is a webfinger address.
- throw new Exception(sprintf(_m('Couldn\'t save ostatus_profile for "%s".'),$addr));
+ throw new Exception(sprintf(_m('Could not save ostatus_profile for "%s".'),$addr));
}
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->uri);
}
// TRANS: Exception. %s is a webfinger address.
- throw new Exception(sprintf(_m('Couldn\'t find a valid profile for "%s".'),$addr));
+ throw new Exception(sprintf(_m('Could not find a valid profile for "%s".'),$addr));
}
/**
$oprofile = Ostatus_profile::ensureWebfinger($rest);
break;
default:
- throw new ServerException("Unrecognized URI protocol for profile: $protocol ($uri)");
+ // TRANS: Server exception.
+ // TRANS: %1$s is a protocol, %2$s is a URI.
+ throw new ServerException(sprintf(_m('Unrecognized URI protocol for profile: %1$s (%2$s).'),
+ $protocol,
+ $uri));
break;
}
} else {
- throw new ServerException("No URI protocol for profile: ($uri)");
+ // TRANS: Server exception. %s is a URI.
+ throw new ServerException(sprintf(_m('No URI protocol for profile: %s.'),$uri));
}
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class MagicEnvelope
{
const ENCODING = 'base64url';
return $env['data'];
}
}
-
break;
default:
// TRANS: Client exception.
- throw new ClientException(_m("Unrecognized activity type."));
+ throw new ClientException(_m('Unrecognized activity type.'));
}
Event::handle('EndHandleSalmon', array($this->activity));
Event::handle('EndHandleSalmonTarget', array($this->activity, $this->target));
function handlePost()
{
// TRANS: Client exception.
- throw new ClientException(_m("This target doesn't understand posts."));
+ throw new ClientException(_m('This target does not understand posts.'));
}
function handleFollow()
{
// TRANS: Client exception.
- throw new ClientException(_m("This target doesn't understand follows."));
+ throw new ClientException(_m('This target does not understand follows.'));
}
function handleUnfollow()
{
// TRANS: Client exception.
- throw new ClientException(_m("This target doesn't understand unfollows."));
+ throw new ClientException(_m('This target does not understand unfollows.'));
}
function handleFavorite()
{
// TRANS: Client exception.
- throw new ClientException(_m("This target doesn't understand favorites."));
+ throw new ClientException(_m('This target does not understand favorites.'));
}
function handleUnfavorite()
{
// TRANS: Client exception.
- throw new ClientException(_m("This target doesn't understand unfavorites."));
+ throw new ClientException(_m('This target does not understand unfavorites.'));
}
function handleShare()
{
// TRANS: Client exception.
- throw new ClientException(_m("This target doesn't understand share events."));
+ throw new ClientException(_m('This target does not understand share events.'));
}
function handleJoin()
{
// TRANS: Client exception.
- throw new ClientException(_m("This target doesn't understand joins."));
+ throw new ClientException(_m('This target does not understand joins.'));
}
function handleLeave()
{
// TRANS: Client exception.
- throw new ClientException(_m("This target doesn't understand leave events."));
+ throw new ClientException(_m('This target does not understand leave events.'));
}
function handleTag()
{
- throw new ClientException(_m("This target doesn't understand tag events."));
+ // TRANS: Client exception.
+ throw new ClientException(_m('This target does not understand tag events.'));
}
function handleUntag()
{
- throw new ClientException(_m("This target doesn't understand untag events."));
+ // TRANS: Client exception.
+ throw new ClientException(_m('This target does not understand untag events.'));
}
/**