* fix some i18n and L10n issues

* update/add translator documentation
* remove superfluous whitespace
This commit is contained in:
Siebrand Mazeland 2011-01-29 00:33:13 +01:00
parent c0bb1a5798
commit 7db24c32d6
19 changed files with 149 additions and 127 deletions

View File

@ -331,8 +331,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
if (Event::handle('StartAtomPubNewActivity', array(&$activity, $this->user, &$saved))) { if (Event::handle('StartAtomPubNewActivity', array(&$activity, $this->user, &$saved))) {
if ($activity->verb != ActivityVerb::POST) { if ($activity->verb != ActivityVerb::POST) {
// TRANS: Client error displayed when not using the POST verb. // TRANS: Client error displayed when not using the POST verb. Do not translate POST.
// TRANS: Do not translate POST.
$this->clientError(_('Can only handle POST activities.')); $this->clientError(_('Can only handle POST activities.'));
return; return;
} }

View File

@ -244,8 +244,7 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
if (Event::handle('StartAtomPubNewActivity', array(&$activity))) { if (Event::handle('StartAtomPubNewActivity', array(&$activity))) {
if ($activity->verb != ActivityVerb::FOLLOW) { if ($activity->verb != ActivityVerb::FOLLOW) {
// TRANS: Client error displayed when not using the POST verb. // TRANS: Client error displayed when not using the follow verb.
// TRANS: Do not translate POST.
$this->clientError(_('Can only handle Follow activities.')); $this->clientError(_('Can only handle Follow activities.'));
return; return;
} }
@ -264,14 +263,17 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
if (empty($profile)) { if (empty($profile)) {
// TRANS: Client exception thrown when subscribing to a non-existing profile. // TRANS: Client exception thrown when subscribing to a non-existing profile.
// TRANS: %s is the unknown profile ID.
$this->clientError(sprintf(_('Unknown profile %s.'), $person->id)); $this->clientError(sprintf(_('Unknown profile %s.'), $person->id));
return; return;
} }
if (Subscription::exists($this->_profile, $profile)) { if (Subscription::exists($this->_profile, $profile)) {
// 409 Conflict // 409 Conflict
$this->clientError(sprintf(_('Already subscribed to %s'), // TRANS: Client error displayed trying to subscribe to an already subscribed profile.
$person->id), // TRANS: %s is the profile the user already has a subscription on.
$this->clientError(sprintf(_('Already subscribed to %s.'),
$person->id),
409); 409);
return; return;
} }

View File

@ -183,11 +183,12 @@ class NewgroupAction extends Action
foreach ($aliases as $alias) { foreach ($aliases as $alias) {
if (!Nickname::isValid($alias)) { if (!Nickname::isValid($alias)) {
// TRANS: Group create form validation error. // TRANS: Group create form validation error.
// TRANS: %s is the invalid alias.
$this->showForm(sprintf(_('Invalid alias: "%s"'), $alias)); $this->showForm(sprintf(_('Invalid alias: "%s"'), $alias));
return; return;
} }
if ($this->nicknameExists($alias)) { if ($this->nicknameExists($alias)) {
// TRANS: Group create form validation error. // TRANS: Group create form validation error. %s is the already used alias.
$this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'), $this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'),
$alias)); $alias));
return; return;
@ -195,7 +196,7 @@ class NewgroupAction extends Action
// XXX assumes alphanum nicknames // XXX assumes alphanum nicknames
if (strcmp($alias, $nickname) == 0) { if (strcmp($alias, $nickname) == 0) {
// TRANS: Group create form validation error. // TRANS: Group create form validation error.
$this->showForm(_('Alias can\'t be the same as nickname.')); $this->showForm(_('Alias cannot be the same as nickname.'));
return; return;
} }
} }

View File

@ -167,15 +167,14 @@ class SubscriptionsAction extends GalleryAction
* *
* @return array of Feed objects * @return array of Feed objects
*/ */
function getFeeds() function getFeeds()
{ {
return array(new Feed(Feed::ATOM, return array(new Feed(Feed::ATOM,
common_local_url('AtomPubSubscriptionFeed', common_local_url('AtomPubSubscriptionFeed',
array('subscriber' => $this->profile->id)), array('subscriber' => $this->profile->id)),
// TRANS: Atom feed title. %s is a profile nickname.
sprintf(_('Subscription feed for %s (Atom)'), sprintf(_('Subscription feed for %s (Atom)'),
$this->profile->nickname))); $this->profile->nickname)));
} }
} }
@ -261,5 +260,4 @@ class SubscriptionsListItem extends SubscriptionListItem
$this->out->elementEnd('form'); $this->out->elementEnd('form');
return; return;
} }
} }

View File

@ -241,7 +241,7 @@ class Notice extends Memcached_DataObject
* array 'urls' list of attached/referred URLs to save with the * array 'urls' list of attached/referred URLs to save with the
* notice in place of extracting links from content * notice in place of extracting links from content
* boolean 'distribute' whether to distribute the notice, default true * boolean 'distribute' whether to distribute the notice, default true
* *
* @fixme tag override * @fixme tag override
* *
* @return Notice * @return Notice
@ -1240,7 +1240,7 @@ class Notice extends Memcached_DataObject
* Convert a notice into an activity for export. * Convert a notice into an activity for export.
* *
* @param User $cur Current user * @param User $cur Current user
* *
* @return Activity activity object representing this Notice. * @return Activity activity object representing this Notice.
*/ */
@ -1253,11 +1253,11 @@ class Notice extends Memcached_DataObject
} }
$act = new Activity(); $act = new Activity();
if (Event::handle('StartNoticeAsActivity', array($this, &$act))) { if (Event::handle('StartNoticeAsActivity', array($this, &$act))) {
$profile = $this->getProfile(); $profile = $this->getProfile();
$act->actor = ActivityObject::fromProfile($profile); $act->actor = ActivityObject::fromProfile($profile);
$act->verb = ActivityVerb::POST; $act->verb = ActivityVerb::POST;
$act->objects[] = ActivityObject::fromNotice($this); $act->objects[] = ActivityObject::fromNotice($this);
@ -1266,7 +1266,7 @@ class Notice extends Memcached_DataObject
$act->time = strtotime($this->created); $act->time = strtotime($this->created);
$act->link = $this->bestUrl(); $act->link = $this->bestUrl();
$act->content = common_xml_safe_str($this->rendered); $act->content = common_xml_safe_str($this->rendered);
$act->id = $this->uri; $act->id = $this->uri;
$act->title = common_xml_safe_str($this->content); $act->title = common_xml_safe_str($this->content);
@ -1293,9 +1293,9 @@ class Notice extends Memcached_DataObject
$act->enclosures[] = $enclosure; $act->enclosures[] = $enclosure;
} }
} }
$ctx = new ActivityContext(); $ctx = new ActivityContext();
if (!empty($this->reply_to)) { if (!empty($this->reply_to)) {
$reply = Notice::staticGet('id', $this->reply_to); $reply = Notice::staticGet('id', $this->reply_to);
if (!empty($reply)) { if (!empty($reply)) {
@ -1303,29 +1303,29 @@ class Notice extends Memcached_DataObject
$ctx->replyToUrl = $reply->bestUrl(); $ctx->replyToUrl = $reply->bestUrl();
} }
} }
$ctx->location = $this->getLocation(); $ctx->location = $this->getLocation();
$conv = null; $conv = null;
if (!empty($this->conversation)) { if (!empty($this->conversation)) {
$conv = Conversation::staticGet('id', $this->conversation); $conv = Conversation::staticGet('id', $this->conversation);
if (!empty($conv)) { if (!empty($conv)) {
$ctx->conversation = $conv->uri; $ctx->conversation = $conv->uri;
} }
} }
$reply_ids = $this->getReplies(); $reply_ids = $this->getReplies();
foreach ($reply_ids as $id) { foreach ($reply_ids as $id) {
$profile = Profile::staticGet('id', $id); $profile = Profile::staticGet('id', $id);
if (!empty($profile)) { if (!empty($profile)) {
$ctx->attention[] = $profile->getUri(); $ctx->attention[] = $profile->getUri();
} }
} }
$groups = $this->getGroups(); $groups = $this->getGroups();
foreach ($groups as $group) { foreach ($groups as $group) {
$ctx->attention[] = $group->uri; $ctx->attention[] = $group->uri;
} }
@ -1339,7 +1339,7 @@ class Notice extends Memcached_DataObject
$ctx->forwardID = $repeat->uri; $ctx->forwardID = $repeat->uri;
$ctx->forwardUrl = $repeat->bestUrl(); $ctx->forwardUrl = $repeat->bestUrl();
} }
$act->context = $ctx; $act->context = $ctx;
// Source // Source
@ -1349,7 +1349,7 @@ class Notice extends Memcached_DataObject
if (!empty($atom_feed)) { if (!empty($atom_feed)) {
$act->source = new ActivitySource(); $act->source = new ActivitySource();
// XXX: we should store the actual feed ID // XXX: we should store the actual feed ID
$act->source->id = $atom_feed; $act->source->id = $atom_feed;
@ -1362,7 +1362,7 @@ class Notice extends Memcached_DataObject
$act->source->links['self'] = $atom_feed; $act->source->links['self'] = $atom_feed;
$act->source->icon = $profile->avatarUrl(AVATAR_PROFILE_SIZE); $act->source->icon = $profile->avatarUrl(AVATAR_PROFILE_SIZE);
$notice = $profile->getCurrentNotice(); $notice = $profile->getCurrentNotice();
if (!empty($notice)) { if (!empty($notice)) {
@ -1384,7 +1384,7 @@ class Notice extends Memcached_DataObject
Event::handle('EndNoticeAsActivity', array($this, &$act)); Event::handle('EndNoticeAsActivity', array($this, &$act));
} }
self::cacheSet(Cache::codeKey('notice:as-activity:'.$this->id), $act); self::cacheSet(Cache::codeKey('notice:as-activity:'.$this->id), $act);
return $act; return $act;
@ -1395,7 +1395,7 @@ class Notice extends Memcached_DataObject
function asAtomEntry($namespace=false, function asAtomEntry($namespace=false,
$source=false, $source=false,
$author=true, $author=true,
$cur=null) $cur=null)
{ {
$act = $this->asActivity(); $act = $this->asActivity();
@ -1405,7 +1405,7 @@ class Notice extends Memcached_DataObject
/** /**
* Extra notice info for atom entries * Extra notice info for atom entries
* *
* Clients use some extra notice info in the atom stream. * Clients use some extra notice info in the atom stream.
* This gives it to them. * This gives it to them.
* *

View File

@ -4,7 +4,7 @@
* Copyright (C) 2010, StatusNet, Inc. * Copyright (C) 2010, StatusNet, Inc.
* *
* A class for moving an account to a new server * A class for moving an account to a new server
* *
* PHP version 5 * PHP version 5
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class AccountMover extends QueueHandler class AccountMover extends QueueHandler
{ {
function transport() function transport()
@ -61,14 +60,16 @@ class AccountMover extends QueueHandler
$oprofile = Ostatus_profile::ensureProfileURI($remote); $oprofile = Ostatus_profile::ensureProfileURI($remote);
if (empty($oprofile)) { if (empty($oprofile)) {
throw new Exception("Can't locate account {$remote}"); // TRANS: Exception thrown when an account could not be located when it should be moved.
// TRANS: %s is the remote site.
throw new Exception(sprintf(_("Cannot locate account %s."),$remote));
} }
list($svcDocUrl, $username) = self::getServiceDocument($remote); list($svcDocUrl, $username) = self::getServiceDocument($remote);
$sink = new ActivitySink($svcDocUrl, $username, $password); $sink = new ActivitySink($svcDocUrl, $username, $password);
$this->log(LOG_INFO, $this->log(LOG_INFO,
"Moving user {$user->nickname} ". "Moving user {$user->nickname} ".
"to {$remote}."); "to {$remote}.");
@ -100,8 +101,10 @@ class AccountMover extends QueueHandler
$xrd = $discovery->lookup($remote); $xrd = $discovery->lookup($remote);
if (empty($xrd)) { if (empty($xrd)) {
throw new Exception("Can't find XRD for $remote"); // TRANS: Exception thrown when a service document could not be located account move.
} // TRANS: %s is the remote site.
throw new Exception(sprintf(_("Cannot find XRD for %s."),$remote));
}
$svcDocUrl = null; $svcDocUrl = null;
$username = null; $username = null;
@ -123,7 +126,9 @@ class AccountMover extends QueueHandler
} }
if (empty($svcDocUrl)) { if (empty($svcDocUrl)) {
throw new Exception("No AtomPub API service for $remote."); // TRANS: Exception thrown when an account could not be located when it should be moved.
// TRANS: %s is the remote site.
throw new Exception(sprintf(_("No AtomPub API service for %s."),$remote));
} }
return array($svcDocUrl, $username); return array($svcDocUrl, $username);
@ -131,7 +136,7 @@ class AccountMover extends QueueHandler
/** /**
* Log some data * Log some data
* *
* Add a header for our class so we know who did it. * Add a header for our class so we know who did it.
* *
* @param int $level Log level, like LOG_ERR or LOG_INFO * @param int $level Log level, like LOG_ERR or LOG_INFO
@ -139,7 +144,6 @@ class AccountMover extends QueueHandler
* *
* @return void * @return void
*/ */
protected function log($level, $message) protected function log($level, $message)
{ {
common_log($level, "AccountMover: " . $message); common_log($level, "AccountMover: " . $message);

View File

@ -370,11 +370,11 @@ class Activity
$xs->element('title', null, $this->title); $xs->element('title', null, $this->title);
$xs->element('content', array('type' => 'html'), $this->content); $xs->element('content', array('type' => 'html'), $this->content);
if (!empty($this->summary)) { if (!empty($this->summary)) {
$xs->element('summary', null, $this->summary); $xs->element('summary', null, $this->summary);
} }
if (!empty($this->link)) { if (!empty($this->link)) {
$xs->element('link', array('rel' => 'alternate', $xs->element('link', array('rel' => 'alternate',
'type' => 'text/html'), 'type' => 'text/html'),
@ -386,10 +386,10 @@ class Activity
$xs->element('activity:verb', null, $this->verb); $xs->element('activity:verb', null, $this->verb);
$published = self::iso8601Date($this->time); $published = self::iso8601Date($this->time);
$xs->element('published', null, $published); $xs->element('published', null, $published);
$xs->element('updated', null, $published); $xs->element('updated', null, $published);
if ($author) { if ($author) {
$this->actor->outputTo($xs, 'author'); $this->actor->outputTo($xs, 'author');
} }
@ -458,7 +458,7 @@ class Activity
} }
// can be either URLs or enclosure objects // can be either URLs or enclosure objects
foreach ($this->enclosures as $enclosure) { foreach ($this->enclosures as $enclosure) {
if (is_string($enclosure)) { if (is_string($enclosure)) {
$xs->element('link', array('rel' => 'enclosure', $xs->element('link', array('rel' => 'enclosure',
@ -479,7 +479,7 @@ class Activity
if ($source && !empty($this->source)) { if ($source && !empty($this->source)) {
$xs->elementStart('source'); $xs->elementStart('source');
$xs->element('id', null, $this->source->id); $xs->element('id', null, $this->source->id);
$xs->element('title', null, $this->source->title); $xs->element('title', null, $this->source->title);
@ -488,7 +488,7 @@ class Activity
'type' => 'text/html', 'type' => 'text/html',
'href' => $this->source->links['alternate'])); 'href' => $this->source->links['alternate']));
} }
if (array_key_exists('self', $this->source->links)) { if (array_key_exists('self', $this->source->links)) {
$xs->element('link', array('rel' => 'self', $xs->element('link', array('rel' => 'self',
'type' => 'application/atom+xml', 'type' => 'application/atom+xml',
@ -507,7 +507,7 @@ class Activity
if (!empty($this->source->updated)) { if (!empty($this->source->updated)) {
$xs->element('updated', null, $this->source->updated); $xs->element('updated', null, $this->source->updated);
} }
$xs->elementEnd('source'); $xs->elementEnd('source');
} }
@ -524,7 +524,7 @@ class Activity
} }
// For throwing in extra elements; used for statusnet:notice_info // For throwing in extra elements; used for statusnet:notice_info
foreach ($this->extra as $el) { foreach ($this->extra as $el) {
list($tag, $attrs, $content) = $el; list($tag, $attrs, $content) = $el;
$xs->element($tag, $attrs, $content); $xs->element($tag, $attrs, $content);

View File

@ -4,7 +4,7 @@
* Copyright (C) 2010, StatusNet, Inc. * Copyright (C) 2010, StatusNet, Inc.
* *
* Title of module * Title of module
* *
* PHP version 5 * PHP version 5
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -44,14 +44,13 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class ActivityMover extends QueueHandler class ActivityMover extends QueueHandler
{ {
function transport() function transport()
{ {
return 'actmove'; return 'actmove';
} }
function handle($data) function handle($data)
{ {
list ($act, $sink, $userURI, $remoteURI) = $data; list ($act, $sink, $userURI, $remoteURI) = $data;
@ -82,7 +81,7 @@ class ActivityMover extends QueueHandler
function moveActivity($act, $sink, $user, $remote) function moveActivity($act, $sink, $user, $remote)
{ {
if (empty($user)) { if (empty($user)) {
throw new Exception("No such user {$act->actor->id}"); throw new Exception(sprintf(_("No such user %s."),$act->actor->id));
} }
switch ($act->verb) { switch ($act->verb) {
@ -152,7 +151,7 @@ class ActivityMover extends QueueHandler
/** /**
* Log some data * Log some data
* *
* Add a header for our class so we know who did it. * Add a header for our class so we know who did it.
* *
* @param int $level Log level, like LOG_ERR or LOG_INFO * @param int $level Log level, like LOG_ERR or LOG_INFO
@ -160,7 +159,6 @@ class ActivityMover extends QueueHandler
* *
* @return void * @return void
*/ */
protected function log($level, $message) protected function log($level, $message)
{ {
common_log($level, "ActivityMover: " . $message); common_log($level, "ActivityMover: " . $message);

View File

@ -4,7 +4,7 @@
* Copyright (C) 2010, StatusNet, Inc. * Copyright (C) 2010, StatusNet, Inc.
* *
* A remote, atompub-receiving service * A remote, atompub-receiving service
* *
* PHP version 5 * PHP version 5
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class ActivitySink class ActivitySink
{ {
protected $svcDocUrl = null; protected $svcDocUrl = null;
@ -104,6 +103,7 @@ class ActivitySink
break; break;
} }
} }
if (!$takesEntries) { if (!$takesEntries) {
continue; continue;
} }
@ -158,12 +158,18 @@ class ActivitySink
if ($status >= 200 && $status < 300) { if ($status >= 200 && $status < 300) {
return true; return true;
} else if ($status >= 400 && $status < 500) { } else if ($status >= 400 && $status < 500) {
throw new ClientException("{$url} {$status} {$reason}"); // TRANS: Client exception thrown when post to collection fails with a 400 status.
// TRANS: %1$s is a URL, %2$s is the status, %s$s is the fail reason.
throw new ClientException(sprintf(_m('URLSTATUSREASON','%1$s %2$s %3$s'), $url, $status, $reason));
} else if ($status >= 500 && $status < 600) { } else if ($status >= 500 && $status < 600) {
throw new ServerException("{$url} {$status} {$reason}"); // TRANS: Server exception thrown when post to collection fails with a 500 status.
// TRANS: %1$s is a URL, %2$s is the status, %s$s is the fail reason.
throw new ServerException(sprintf(_m('URLSTATUSREASON','%1$s %2$s %3$s'), $url, $status, $reason));
} else { } else {
// That's unexpected. // That's unexpected.
throw new Exception("{$url} {$status} {$reason}"); // TRANS: Exception thrown when post to collection fails with a status that is not handled.
// TRANS: %1$s is a URL, %2$s is the status, %s$s is the fail reason.
throw new Exception(sprintf(_m('URLSTATUSREASON','%1$s %2$s %3$s'), $url, $status, $reason));
} }
} }
} }

View File

@ -45,7 +45,6 @@ if (!defined('STATUSNET')) {
* *
* @see http://groups.google.com/group/webfinger/browse_thread/thread/9f3d93a479e91bbf * @see http://groups.google.com/group/webfinger/browse_thread/thread/9f3d93a479e91bbf
*/ */
class Discovery class Discovery
{ {
const LRDD_REL = 'lrdd'; const LRDD_REL = 'lrdd';
@ -72,12 +71,11 @@ class Discovery
/** /**
* Register a discovery class * Register a discovery class
* *
* @param string $class Class name * @param string $class Class name
* *
* @return void * @return void
*/ */
public function registerMethod($class) public function registerMethod($class)
{ {
$this->methods[] = $class; $this->methods[] = $class;
@ -91,7 +89,6 @@ class Discovery
* *
* @return string normalized acct: or http(s)?: URI * @return string normalized acct: or http(s)?: URI
*/ */
public static function normalize($user_id) public static function normalize($user_id)
{ {
if (substr($user_id, 0, 5) == 'http:' || if (substr($user_id, 0, 5) == 'http:' ||
@ -116,7 +113,6 @@ class Discovery
* *
* @return boolean true if $user_id is a Webfinger, else false * @return boolean true if $user_id is a Webfinger, else false
*/ */
public static function isWebfinger($user_id) public static function isWebfinger($user_id)
{ {
$uri = Discovery::normalize($user_id); $uri = Discovery::normalize($user_id);
@ -131,7 +127,6 @@ class Discovery
* *
* @return XRD XRD object for the user * @return XRD XRD object for the user
*/ */
public function lookup($id) public function lookup($id)
{ {
// Normalize the incoming $id to make sure we have a uri // Normalize the incoming $id to make sure we have a uri
@ -154,7 +149,7 @@ class Discovery
} }
} }
// TRANS: Exception. // TRANS: Exception. %s is an ID.
throw new Exception(sprintf(_('Unable to find services for %s.'), $id)); throw new Exception(sprintf(_('Unable to find services for %s.'), $id));
} }
@ -166,7 +161,6 @@ class Discovery
* *
* @return array $link assoc array representing the link * @return array $link assoc array representing the link
*/ */
public static function getService($links, $service) public static function getService($links, $service)
{ {
if (!is_array($links)) { if (!is_array($links)) {
@ -190,7 +184,6 @@ class Discovery
* *
* @return string replaced values * @return string replaced values
*/ */
public static function applyTemplate($template, $id) public static function applyTemplate($template, $id)
{ {
$template = str_replace('{uri}', urlencode($id), $template); $template = str_replace('{uri}', urlencode($id), $template);
@ -202,10 +195,9 @@ class Discovery
* Fetch an XRD file and parse * Fetch an XRD file and parse
* *
* @param string $url URL of the XRD * @param string $url URL of the XRD
* *
* @return XRD object representing the XRD file * @return XRD object representing the XRD file
*/ */
public static function fetchXrd($url) public static function fetchXrd($url)
{ {
try { try {
@ -236,7 +228,6 @@ class Discovery
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
interface Discovery_LRDD interface Discovery_LRDD
{ {
/** /**
@ -246,7 +237,6 @@ interface Discovery_LRDD
* *
* @return array Links in the XRD file * @return array Links in the XRD file
*/ */
public function discover($uri); public function discover($uri);
} }
@ -263,7 +253,6 @@ interface Discovery_LRDD
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class Discovery_LRDD_Host_Meta implements Discovery_LRDD class Discovery_LRDD_Host_Meta implements Discovery_LRDD
{ {
/** /**
@ -276,7 +265,6 @@ class Discovery_LRDD_Host_Meta implements Discovery_LRDD
* *
* @return array Links in the XRD file * @return array Links in the XRD file
*/ */
public function discover($uri) public function discover($uri)
{ {
if (Discovery::isWebfinger($uri)) { if (Discovery::isWebfinger($uri)) {
@ -313,7 +301,6 @@ class Discovery_LRDD_Host_Meta implements Discovery_LRDD
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class Discovery_LRDD_Link_Header implements Discovery_LRDD class Discovery_LRDD_Link_Header implements Discovery_LRDD
{ {
/** /**
@ -325,9 +312,8 @@ class Discovery_LRDD_Link_Header implements Discovery_LRDD
* *
* @return array Links in the XRD file * @return array Links in the XRD file
* *
* @todo fail out of Webfinger URIs faster * @todo fail out of Webfinger URIs faster
*/ */
public function discover($uri) public function discover($uri)
{ {
try { try {
@ -353,10 +339,9 @@ class Discovery_LRDD_Link_Header implements Discovery_LRDD
* Given a string or array of headers, returns XRD-like assoc array * Given a string or array of headers, returns XRD-like assoc array
* *
* @param string|array $header string or array of strings for headers * @param string|array $header string or array of strings for headers
* *
* @return array Link header in XRD-like format * @return array Link header in XRD-like format
*/ */
protected static function parseHeader($header) protected static function parseHeader($header)
{ {
$lh = new LinkHeader($header); $lh = new LinkHeader($header);
@ -380,7 +365,6 @@ class Discovery_LRDD_Link_Header implements Discovery_LRDD
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class Discovery_LRDD_Link_HTML implements Discovery_LRDD class Discovery_LRDD_Link_HTML implements Discovery_LRDD
{ {
/** /**
@ -393,9 +377,8 @@ class Discovery_LRDD_Link_HTML implements Discovery_LRDD
* *
* @return array Links in XRD-ish assoc array * @return array Links in XRD-ish assoc array
* *
* @todo fail out of Webfinger URIs faster * @todo fail out of Webfinger URIs faster
*/ */
public function discover($uri) public function discover($uri)
{ {
try { try {
@ -421,7 +404,6 @@ class Discovery_LRDD_Link_HTML implements Discovery_LRDD
* *
* @return array array of associative arrays in XRD-ish format * @return array array of associative arrays in XRD-ish format
*/ */
public function parse($html) public function parse($html)
{ {
$links = array(); $links = array();

View File

@ -69,6 +69,7 @@ class ImageFile
($info[2] == IMAGETYPE_XBM && function_exists('imagecreatefromxbm')) || ($info[2] == IMAGETYPE_XBM && function_exists('imagecreatefromxbm')) ||
($info[2] == IMAGETYPE_PNG && function_exists('imagecreatefrompng')))) { ($info[2] == IMAGETYPE_PNG && function_exists('imagecreatefrompng')))) {
// TRANS: Exception thrown when trying to upload an unsupported image file format.
throw new Exception(_('Unsupported image file format.')); throw new Exception(_('Unsupported image file format.'));
return; return;
} }
@ -92,6 +93,7 @@ class ImageFile
return; return;
case UPLOAD_ERR_PARTIAL: case UPLOAD_ERR_PARTIAL:
@unlink($_FILES[$param]['tmp_name']); @unlink($_FILES[$param]['tmp_name']);
// TRANS: Exception thrown when uploading an image and that action could not be completed.
throw new Exception(_('Partial upload.')); throw new Exception(_('Partial upload.'));
return; return;
case UPLOAD_ERR_NO_FILE: case UPLOAD_ERR_NO_FILE:
@ -100,6 +102,7 @@ class ImageFile
default: default:
common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " . common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " .
$_FILES[$param]['error']); $_FILES[$param]['error']);
// TRANS: Exception thrown when uploading an image fails for an unknown reason.
throw new Exception(_('System error uploading file.')); throw new Exception(_('System error uploading file.'));
return; return;
} }
@ -108,6 +111,7 @@ class ImageFile
if (!$info) { if (!$info) {
@unlink($_FILES[$param]['tmp_name']); @unlink($_FILES[$param]['tmp_name']);
// TRANS: Exception thrown when uploading a file as image that is not an image or is a corrupt file.
throw new Exception(_('Not an image or corrupt file.')); throw new Exception(_('Not an image or corrupt file.'));
return; return;
} }
@ -170,6 +174,7 @@ class ImageFile
$targetType = $this->preferredType(); $targetType = $this->preferredType();
if (!file_exists($this->filepath)) { if (!file_exists($this->filepath)) {
// TRANS: Exception thrown during resize when image has been registered as present, but is no longer there.
throw new Exception(_('Lost our file.')); throw new Exception(_('Lost our file.'));
return; return;
} }
@ -207,6 +212,7 @@ class ImageFile
$image_src = imagecreatefromxbm($this->filepath); $image_src = imagecreatefromxbm($this->filepath);
break; break;
default: default:
// TRANS: Exception thrown when trying to resize an unknown file type.
throw new Exception(_('Unknown file type')); throw new Exception(_('Unknown file type'));
return; return;
} }
@ -247,6 +253,7 @@ class ImageFile
imagepng($image_dest, $outpath); imagepng($image_dest, $outpath);
break; break;
default: default:
// TRANS: Exception thrown when trying resize an unknown file type.
throw new Exception(_('Unknown file type')); throw new Exception(_('Unknown file type'));
return; return;
} }

View File

@ -47,7 +47,6 @@ if (!defined('STATUSNET')) {
* *
* @see Discovery * @see Discovery
*/ */
class LinkHeader class LinkHeader
{ {
var $href; var $href;
@ -61,7 +60,6 @@ class LinkHeader
* *
* @return LinkHeader self * @return LinkHeader self
*/ */
function __construct($str) function __construct($str)
{ {
preg_match('/^<[^>]+>/', $str, $uri_reference); preg_match('/^<[^>]+>/', $str, $uri_reference);
@ -78,7 +76,7 @@ class LinkHeader
$params = explode(';', $str); $params = explode(';', $str);
foreach ($params as $param) { foreach ($params as $param) {
if (empty($param)) { if (empty($param)) {
continue; continue;
} }
list($param_name, $param_value) = explode('=', $param, 2); list($param_name, $param_value) = explode('=', $param, 2);
@ -108,7 +106,6 @@ class LinkHeader
* *
* @return LinkHeader discovered header, or null on failure * @return LinkHeader discovered header, or null on failure
*/ */
static function getLink($response, $rel=null, $type=null) static function getLink($response, $rel=null, $type=null)
{ {
$headers = $response->getHeader('Link'); $headers = $response->getHeader('Link');

View File

@ -44,7 +44,6 @@ require_once INSTALLDIR.'/lib/widget.php';
* *
* @see Widget * @see Widget
*/ */
class LoginGroupNav extends Widget class LoginGroupNav extends Widget
{ {
var $action = null; var $action = null;
@ -54,7 +53,6 @@ class LoginGroupNav extends Widget
* *
* @param Action $action current action, used for output * @param Action $action current action, used for output
*/ */
function __construct($action=null) function __construct($action=null)
{ {
parent::__construct($action); parent::__construct($action);
@ -66,7 +64,6 @@ class LoginGroupNav extends Widget
* *
* @return void * @return void
*/ */
function show() function show()
{ {
$action_name = $this->action->trimmed('action'); $action_name = $this->action->trimmed('action');
@ -76,13 +73,17 @@ class LoginGroupNav extends Widget
if (Event::handle('StartLoginGroupNav', array($this->action))) { if (Event::handle('StartLoginGroupNav', array($this->action))) {
$this->action->menuItem(common_local_url('login'), $this->action->menuItem(common_local_url('login'),
_('Login'), // TRANS: Menu item for logging in to the StatusNet site.
_m('MENU','Login'),
// TRANS: Title for menu item for logging in to the StatusNet site.
_('Login with a username and password'), _('Login with a username and password'),
$action_name === 'login'); $action_name === 'login');
if (!(common_config('site','closed') || common_config('site','inviteonly'))) { if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
$this->action->menuItem(common_local_url('register'), $this->action->menuItem(common_local_url('register'),
_('Register'), // TRANS: Menu item for registering with the StatusNet site.
_m('MENU','Register'),
// TRANS: Title for menu item for registering with the StatusNet site.
_('Sign up for a new account'), _('Sign up for a new account'),
$action_name === 'register'); $action_name === 'register');
} }

View File

@ -44,7 +44,6 @@ require_once 'Mail.php';
* *
* @return Mail backend * @return Mail backend
*/ */
function mail_backend() function mail_backend()
{ {
static $backend = null; static $backend = null;
@ -70,7 +69,6 @@ function mail_backend()
* *
* @return boolean success flag * @return boolean success flag
*/ */
function mail_send($recipients, $headers, $body) function mail_send($recipients, $headers, $body)
{ {
// XXX: use Mail_Queue... maybe // XXX: use Mail_Queue... maybe
@ -94,7 +92,6 @@ function mail_send($recipients, $headers, $body)
* *
* @return string mail domain, suitable for making email addresses. * @return string mail domain, suitable for making email addresses.
*/ */
function mail_domain() function mail_domain()
{ {
$maildomain = common_config('mail', 'domain'); $maildomain = common_config('mail', 'domain');
@ -112,7 +109,6 @@ function mail_domain()
* *
* @return string notify from address * @return string notify from address
*/ */
function mail_notify_from() function mail_notify_from()
{ {
$notifyfrom = common_config('mail', 'notifyfrom'); $notifyfrom = common_config('mail', 'notifyfrom');
@ -138,7 +134,6 @@ function mail_notify_from()
* *
* @return boolean success flag * @return boolean success flag
*/ */
function mail_to_user(&$user, $subject, $body, $headers=array(), $address=null) function mail_to_user(&$user, $subject, $body, $headers=array(), $address=null)
{ {
if (!$address) { if (!$address) {
@ -167,7 +162,6 @@ function mail_to_user(&$user, $subject, $body, $headers=array(), $address=null)
* *
* @return success flag * @return success flag
*/ */
function mail_confirm_address($user, $code, $nickname, $address) function mail_confirm_address($user, $code, $nickname, $address)
{ {
// TRANS: Subject for address confirmation email. // TRANS: Subject for address confirmation email.
@ -202,7 +196,6 @@ function mail_confirm_address($user, $code, $nickname, $address)
* *
* @return void * @return void
*/ */
function mail_subscribe_notify($listenee, $listener) function mail_subscribe_notify($listenee, $listener)
{ {
$other = $listener->getProfile(); $other = $listener->getProfile();
@ -220,7 +213,6 @@ function mail_subscribe_notify($listenee, $listener)
* *
* @return void * @return void
*/ */
function mail_subscribe_notify_profile($listenee, $other) function mail_subscribe_notify_profile($listenee, $other)
{ {
if ($other->hasRight(Right::EMAILONSUBSCRIBE) && if ($other->hasRight(Right::EMAILONSUBSCRIBE) &&
@ -490,7 +482,7 @@ function mail_notify_nudge($from, $to)
common_switch_locale($to->language); common_switch_locale($to->language);
// TRANS: Subject for 'nudge' notification email. // TRANS: Subject for 'nudge' notification email.
// TRANS: %s is the nudging user. // TRANS: %s is the nudging user.
$subject = sprintf(_('You\'ve been nudged by %s'), $from->nickname); $subject = sprintf(_('You have been nudged by %s'), $from->nickname);
$from_profile = $from->getProfile(); $from_profile = $from->getProfile();

View File

@ -46,7 +46,6 @@ require_once INSTALLDIR.'/lib/groupminilist.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class ProfileAction extends OwnerDesignAction class ProfileAction extends OwnerDesignAction
{ {
var $page = null; var $page = null;
@ -74,6 +73,7 @@ class ProfileAction extends OwnerDesignAction
$this->user = User::staticGet('nickname', $nickname); $this->user = User::staticGet('nickname', $nickname);
if (!$this->user) { if (!$this->user) {
// TRANS: Client error displayed when calling a profile action without specifying a user.
$this->clientError(_('No such user.'), 404); $this->clientError(_('No such user.'), 404);
return false; return false;
} }
@ -81,6 +81,7 @@ class ProfileAction extends OwnerDesignAction
$this->profile = $this->user->getProfile(); $this->profile = $this->user->getProfile();
if (!$this->profile) { if (!$this->profile) {
// TRANS: Server error displayed when calling a profile action while the specified user does not have a profile.
$this->serverError(_('User has no profile.')); $this->serverError(_('User has no profile.'));
return false; return false;
} }
@ -122,6 +123,7 @@ class ProfileAction extends OwnerDesignAction
'class' => 'section')); 'class' => 'section'));
if (Event::handle('StartShowSubscriptionsMiniList', array($this))) { if (Event::handle('StartShowSubscriptionsMiniList', array($this))) {
$this->elementStart('h2'); $this->elementStart('h2');
// TRANS: H2 text for user subscription statistics.
$this->statsSectionLink('subscriptions', _('Subscriptions')); $this->statsSectionLink('subscriptions', _('Subscriptions'));
$this->elementEnd('h2'); $this->elementEnd('h2');
@ -131,12 +133,14 @@ class ProfileAction extends OwnerDesignAction
$pml = new ProfileMiniList($profile, $this); $pml = new ProfileMiniList($profile, $this);
$cnt = $pml->show(); $cnt = $pml->show();
if ($cnt == 0) { if ($cnt == 0) {
// TRANS: Text for user subscription statistics if the user has no subscriptions.
$this->element('p', null, _('(None)')); $this->element('p', null, _('(None)'));
} }
} }
if ($cnt > PROFILES_PER_MINILIST) { if ($cnt > PROFILES_PER_MINILIST) {
$this->elementStart('p'); $this->elementStart('p');
// TRANS: Text for user subscription statistics if user has more subscriptions than displayed.
$this->statsSectionLink('subscriptions', _('All subscriptions'), 'more'); $this->statsSectionLink('subscriptions', _('All subscriptions'), 'more');
$this->elementEnd('p'); $this->elementEnd('p');
} }
@ -156,6 +160,7 @@ class ProfileAction extends OwnerDesignAction
if (Event::handle('StartShowSubscribersMiniList', array($this))) { if (Event::handle('StartShowSubscribersMiniList', array($this))) {
$this->elementStart('h2'); $this->elementStart('h2');
// TRANS: H2 text for user subscriber statistics.
$this->statsSectionLink('subscribers', _('Subscribers')); $this->statsSectionLink('subscribers', _('Subscribers'));
$this->elementEnd('h2'); $this->elementEnd('h2');
@ -165,12 +170,14 @@ class ProfileAction extends OwnerDesignAction
$sml = new SubscribersMiniList($profile, $this); $sml = new SubscribersMiniList($profile, $this);
$cnt = $sml->show(); $cnt = $sml->show();
if ($cnt == 0) { if ($cnt == 0) {
// TRANS: Text for user subscriber statistics if user has no subscribers.
$this->element('p', null, _('(None)')); $this->element('p', null, _('(None)'));
} }
} }
if ($cnt > PROFILES_PER_MINILIST) { if ($cnt > PROFILES_PER_MINILIST) {
$this->elementStart('p'); $this->elementStart('p');
// TRANS: Text for user subscription statistics if user has more subscribers than displayed.
$this->statsSectionLink('subscribers', _('All subscribers'), 'more'); $this->statsSectionLink('subscribers', _('All subscribers'), 'more');
$this->elementEnd('p'); $this->elementEnd('p');
} }
@ -194,6 +201,7 @@ class ProfileAction extends OwnerDesignAction
$this->elementStart('div', array('id' => 'entity_statistics', $this->elementStart('div', array('id' => 'entity_statistics',
'class' => 'section')); 'class' => 'section'));
// TRANS: H2 text for user statistics.
$this->element('h2', null, _('Statistics')); $this->element('h2', null, _('Statistics'));
$profile = $this->profile; $profile = $this->profile;
@ -201,40 +209,47 @@ class ProfileAction extends OwnerDesignAction
$stats = array( $stats = array(
array( array(
'id' => 'user-id', 'id' => 'user-id',
// TRANS: Label for user statistics.
'label' => _('User ID'), 'label' => _('User ID'),
'value' => $profile->id, 'value' => $profile->id,
), ),
array( array(
'id' => 'member-since', 'id' => 'member-since',
// TRANS: Label for user statistics.
'label' => _('Member since'), 'label' => _('Member since'),
'value' => date('j M Y', strtotime($profile->created)) 'value' => date('j M Y', strtotime($profile->created))
), ),
array( array(
'id' => 'subscriptions', 'id' => 'subscriptions',
// TRANS: Label for user statistics.
'label' => _('Subscriptions'), 'label' => _('Subscriptions'),
'link' => common_local_url('subscriptions', $actionParams), 'link' => common_local_url('subscriptions', $actionParams),
'value' => $profile->subscriptionCount(), 'value' => $profile->subscriptionCount(),
), ),
array( array(
'id' => 'subscribers', 'id' => 'subscribers',
// TRANS: Label for user statistics.
'label' => _('Subscribers'), 'label' => _('Subscribers'),
'link' => common_local_url('subscribers', $actionParams), 'link' => common_local_url('subscribers', $actionParams),
'value' => $profile->subscriberCount(), 'value' => $profile->subscriberCount(),
), ),
array( array(
'id' => 'groups', 'id' => 'groups',
// TRANS: Label for user statistics.
'label' => _('Groups'), 'label' => _('Groups'),
'link' => common_local_url('usergroups', $actionParams), 'link' => common_local_url('usergroups', $actionParams),
'value' => $profile->getGroups()->N, 'value' => $profile->getGroups()->N,
), ),
array( array(
'id' => 'notices', 'id' => 'notices',
// TRANS: Label for user statistics.
'label' => _('Notices'), 'label' => _('Notices'),
'value' => $notice_count, 'value' => $notice_count,
), ),
array( array(
'id' => 'daily_notices', 'id' => 'daily_notices',
// TRANS: Average count of posts made per day since account registration // TRANS: Label for user statistics.
// TRANS: Average count of posts made per day since account registration.
'label' => _('Daily average'), 'label' => _('Daily average'),
'value' => $daily_count 'value' => $daily_count
) )
@ -271,6 +286,7 @@ class ProfileAction extends OwnerDesignAction
'class' => 'section')); 'class' => 'section'));
if (Event::handle('StartShowGroupsMiniList', array($this))) { if (Event::handle('StartShowGroupsMiniList', array($this))) {
$this->elementStart('h2'); $this->elementStart('h2');
// TRANS: H2 text for user group membership statistics.
$this->statsSectionLink('usergroups', _('Groups')); $this->statsSectionLink('usergroups', _('Groups'));
$this->elementEnd('h2'); $this->elementEnd('h2');
@ -278,12 +294,14 @@ class ProfileAction extends OwnerDesignAction
$gml = new GroupMiniList($groups, $this->profile, $this); $gml = new GroupMiniList($groups, $this->profile, $this);
$cnt = $gml->show(); $cnt = $gml->show();
if ($cnt == 0) { if ($cnt == 0) {
// TRANS: Text for user user group membership statistics if user is not a member of any group.
$this->element('p', null, _('(None)')); $this->element('p', null, _('(None)'));
} }
} }
if ($cnt > GROUPS_PER_MINILIST) { if ($cnt > GROUPS_PER_MINILIST) {
$this->elementStart('p'); $this->elementStart('p');
// TRANS: Text for user group membership statistics if user has more subscriptions than displayed.
$this->statsSectionLink('usergroups', _('All groups'), 'more'); $this->statsSectionLink('usergroups', _('All groups'), 'more');
$this->elementEnd('p'); $this->elementEnd('p');
} }
@ -313,4 +331,3 @@ class SubscribersMiniListItem extends ProfileMiniListItem
return $aAttrs; return $aAttrs;
} }
} }

View File

@ -25,7 +25,6 @@
* We extend atomusernoticefeed since it does some nice setup for us. * We extend atomusernoticefeed since it does some nice setup for us.
* *
*/ */
class UserActivityStream extends AtomUserNoticeFeed class UserActivityStream extends AtomUserNoticeFeed
{ {
public $activities = array(); public $activities = array();
@ -50,7 +49,7 @@ class UserActivityStream extends AtomUserNoticeFeed
$this->activities[] = $obj->asActivity(); $this->activities[] = $obj->asActivity();
} }
} }
function renderEntries() function renderEntries()
{ {
foreach ($this->activities as $act) { foreach ($this->activities as $act) {

View File

@ -48,7 +48,6 @@ require_once INSTALLDIR.'/lib/widget.php';
* *
* @see HTMLOutputter * @see HTMLOutputter
*/ */
class UserProfile extends Widget class UserProfile extends Widget
{ {
var $user = null; var $user = null;
@ -73,6 +72,7 @@ class UserProfile extends Widget
$this->out->elementStart('div', array('id' => 'i', $this->out->elementStart('div', array('id' => 'i',
'class' => 'entity_profile vcard author')); 'class' => 'entity_profile vcard author'));
// TRANS: H2 for user profile information.
$this->out->element('h2', null, _('User profile')); $this->out->element('h2', null, _('User profile'));
if (Event::handle('StartProfilePageProfileElements', array(&$this->out, $this->profile))) { if (Event::handle('StartProfilePageProfileElements', array(&$this->out, $this->profile))) {
@ -104,6 +104,7 @@ class UserProfile extends Widget
} }
$this->out->elementStart('dl', 'entity_depiction'); $this->out->elementStart('dl', 'entity_depiction');
// TRANS: DT element in area for user avatar.
$this->out->element('dt', null, _('Photo')); $this->out->element('dt', null, _('Photo'));
$this->out->elementStart('dd'); $this->out->elementStart('dd');
$this->out->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE), $this->out->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE),
@ -116,6 +117,7 @@ class UserProfile extends Widget
$cur = common_current_user(); $cur = common_current_user();
if ($cur && $cur->id == $this->profile->id) { if ($cur && $cur->id == $this->profile->id) {
$this->out->elementStart('dd'); $this->out->elementStart('dd');
// TRANS: Link text for changeing the avatar of the logged in user.
$this->out->element('a', array('href' => common_local_url('avatarsettings')), _('Edit Avatar')); $this->out->element('a', array('href' => common_local_url('avatarsettings')), _('Edit Avatar'));
$this->out->elementEnd('dd'); $this->out->elementEnd('dd');
} }
@ -131,6 +133,7 @@ class UserProfile extends Widget
if (Event::handle('StartProfilePageNickname', array($this->out, $this->profile))) { if (Event::handle('StartProfilePageNickname', array($this->out, $this->profile))) {
$this->out->elementStart('dl', 'entity_nickname'); $this->out->elementStart('dl', 'entity_nickname');
// TRANS: DT for nick name in a profile.
$this->out->element('dt', null, _('Nickname')); $this->out->element('dt', null, _('Nickname'));
$this->out->elementStart('dd'); $this->out->elementStart('dd');
$hasFN = ($this->profile->fullname) ? 'nickname url uid' : 'fn nickname url uid'; $hasFN = ($this->profile->fullname) ? 'nickname url uid' : 'fn nickname url uid';
@ -149,6 +152,7 @@ class UserProfile extends Widget
if (Event::handle('StartProfilePageFullName', array($this->out, $this->profile))) { if (Event::handle('StartProfilePageFullName', array($this->out, $this->profile))) {
if ($this->profile->fullname) { if ($this->profile->fullname) {
$this->out->elementStart('dl', 'entity_fn'); $this->out->elementStart('dl', 'entity_fn');
// TRANS: DT for full name in a profile.
$this->out->element('dt', null, _('Full name')); $this->out->element('dt', null, _('Full name'));
$this->out->elementStart('dd'); $this->out->elementStart('dd');
$this->out->element('span', 'fn', $this->profile->fullname); $this->out->element('span', 'fn', $this->profile->fullname);
@ -164,6 +168,7 @@ class UserProfile extends Widget
if (Event::handle('StartProfilePageLocation', array($this->out, $this->profile))) { if (Event::handle('StartProfilePageLocation', array($this->out, $this->profile))) {
if ($this->profile->location) { if ($this->profile->location) {
$this->out->elementStart('dl', 'entity_location'); $this->out->elementStart('dl', 'entity_location');
// TRANS: DT for location in a profile.
$this->out->element('dt', null, _('Location')); $this->out->element('dt', null, _('Location'));
$this->out->element('dd', 'label', $this->profile->location); $this->out->element('dd', 'label', $this->profile->location);
$this->out->elementEnd('dl'); $this->out->elementEnd('dl');
@ -177,6 +182,7 @@ class UserProfile extends Widget
if (Event::handle('StartProfilePageHomepage', array($this->out, $this->profile))) { if (Event::handle('StartProfilePageHomepage', array($this->out, $this->profile))) {
if ($this->profile->homepage) { if ($this->profile->homepage) {
$this->out->elementStart('dl', 'entity_url'); $this->out->elementStart('dl', 'entity_url');
// TRANS: DT for URL in a profile.
$this->out->element('dt', null, _('URL')); $this->out->element('dt', null, _('URL'));
$this->out->elementStart('dd'); $this->out->elementStart('dd');
$this->out->element('a', array('href' => $this->profile->homepage, $this->out->element('a', array('href' => $this->profile->homepage,
@ -194,6 +200,7 @@ class UserProfile extends Widget
if (Event::handle('StartProfilePageBio', array($this->out, $this->profile))) { if (Event::handle('StartProfilePageBio', array($this->out, $this->profile))) {
if ($this->profile->bio) { if ($this->profile->bio) {
$this->out->elementStart('dl', 'entity_note'); $this->out->elementStart('dl', 'entity_note');
// TRANS: DT for note in a profile.
$this->out->element('dt', null, _('Note')); $this->out->element('dt', null, _('Note'));
$this->out->element('dd', 'note', $this->profile->bio); $this->out->element('dd', 'note', $this->profile->bio);
$this->out->elementEnd('dl'); $this->out->elementEnd('dl');
@ -209,6 +216,7 @@ class UserProfile extends Widget
if (count($tags) > 0) { if (count($tags) > 0) {
$this->out->elementStart('dl', 'entity_tags'); $this->out->elementStart('dl', 'entity_tags');
// TRANS: DT for tags in a profile.
$this->out->element('dt', null, _('Tags')); $this->out->element('dt', null, _('Tags'));
$this->out->elementStart('dd'); $this->out->elementStart('dd');
$this->out->elementStart('ul', 'tags xoxo'); $this->out->elementStart('ul', 'tags xoxo');
@ -233,9 +241,11 @@ class UserProfile extends Widget
{ {
if ($this->profile->hasRole(Profile_role::DELETED)) { if ($this->profile->hasRole(Profile_role::DELETED)) {
$this->out->elementStart('div', 'entity_actions'); $this->out->elementStart('div', 'entity_actions');
// TRANS: H2 for user actions in a profile.
$this->out->element('h2', null, _('User actions')); $this->out->element('h2', null, _('User actions'));
$this->out->elementStart('ul'); $this->out->elementStart('ul');
$this->out->elementStart('p', array('class' => 'profile_deleted')); $this->out->elementStart('p', array('class' => 'profile_deleted'));
// TRANS: Text shown in user profile of not yet compeltely deleted users.
$this->out->text(_('User deletion in progress...')); $this->out->text(_('User deletion in progress...'));
$this->out->elementEnd('p'); $this->out->elementEnd('p');
$this->out->elementEnd('ul'); $this->out->elementEnd('ul');
@ -247,6 +257,7 @@ class UserProfile extends Widget
$cur = common_current_user(); $cur = common_current_user();
$this->out->elementStart('div', 'entity_actions'); $this->out->elementStart('div', 'entity_actions');
// TRANS: H2 for entity actions in a profile.
$this->out->element('h2', null, _('User actions')); $this->out->element('h2', null, _('User actions'));
$this->out->elementStart('ul'); $this->out->elementStart('ul');
@ -262,7 +273,9 @@ class UserProfile extends Widget
if ($cur->id == $this->profile->id) { // your own page if ($cur->id == $this->profile->id) { // your own page
$this->out->elementStart('li', 'entity_edit'); $this->out->elementStart('li', 'entity_edit');
$this->out->element('a', array('href' => common_local_url('profilesettings'), $this->out->element('a', array('href' => common_local_url('profilesettings'),
// TRANS: Link title for link on user profile.
'title' => _('Edit profile settings')), 'title' => _('Edit profile settings')),
// TRANS: Link text for link on user profile.
_('Edit')); _('Edit'));
$this->out->elementEnd('li'); $this->out->elementEnd('li');
} else { // someone else's page } else { // someone else's page
@ -286,7 +299,9 @@ class UserProfile extends Widget
$this->out->elementStart('li', 'entity_send-a-message'); $this->out->elementStart('li', 'entity_send-a-message');
$this->out->element('a', array('href' => common_local_url('newmessage', array('to' => $this->user->id)), $this->out->element('a', array('href' => common_local_url('newmessage', array('to' => $this->user->id)),
// TRANS: Link title for link on user profile.
'title' => _('Send a direct message to this user')), 'title' => _('Send a direct message to this user')),
// TRANS: Link text for link on user profile.
_('Message')); _('Message'));
$this->out->elementEnd('li'); $this->out->elementEnd('li');
@ -328,6 +343,7 @@ class UserProfile extends Widget
$cur->hasRight(Right::SILENCEUSER) || $cur->hasRight(Right::SILENCEUSER) ||
$cur->hasRight(Right::DELETEUSER)) { $cur->hasRight(Right::DELETEUSER)) {
$this->out->elementStart('li', 'entity_moderation'); $this->out->elementStart('li', 'entity_moderation');
// TRANS: Label text on user profile to select a user role.
$this->out->element('p', null, _('Moderate')); $this->out->element('p', null, _('Moderate'));
$this->out->elementStart('ul'); $this->out->elementStart('ul');
if ($cur->hasRight(Right::SANDBOXUSER)) { if ($cur->hasRight(Right::SANDBOXUSER)) {
@ -363,12 +379,15 @@ class UserProfile extends Widget
$this->out->elementEnd('ul'); $this->out->elementEnd('ul');
$this->out->elementEnd('li'); $this->out->elementEnd('li');
} }
if ($isLocal && $cur->hasRight(Right::GRANTROLE)) { if ($isLocal && $cur->hasRight(Right::GRANTROLE)) {
$this->out->elementStart('li', 'entity_role'); $this->out->elementStart('li', 'entity_role');
// TRANS: Label text on user profile to select a user role.
$this->out->element('p', null, _('User role')); $this->out->element('p', null, _('User role'));
$this->out->elementStart('ul'); $this->out->elementStart('ul');
// TRANS: Role that can be set for a user profile.
$this->roleButton('administrator', _m('role', 'Administrator')); $this->roleButton('administrator', _m('role', 'Administrator'));
// TRANS: Role that can be set for a user profile.
$this->roleButton('moderator', _m('role', 'Moderator')); $this->roleButton('moderator', _m('role', 'Moderator'));
$this->out->elementEnd('ul'); $this->out->elementEnd('ul');
$this->out->elementEnd('li'); $this->out->elementEnd('li');
@ -408,6 +427,7 @@ class UserProfile extends Widget
array('nickname' => $this->profile->nickname)); array('nickname' => $this->profile->nickname));
$this->out->element('a', array('href' => $url, $this->out->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'), 'class' => 'entity_remote_subscribe'),
// TRANS: Link text for link that will subscribe to a remote profile.
_('Subscribe')); _('Subscribe'));
} }
} }

View File

@ -26,7 +26,6 @@
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class XRD class XRD
{ {
const XML_NS = 'http://www.w3.org/2000/xmlns/'; const XML_NS = 'http://www.w3.org/2000/xmlns/';
@ -61,12 +60,12 @@ class XRD
if (!$ok) { if (!$ok) {
// TRANS: Exception. // TRANS: Exception.
throw new Exception(_m('Invalid XML.')); throw new Exception(_('Invalid XML.'));
} }
$xrd_element = $dom->getElementsByTagName('XRD')->item(0); $xrd_element = $dom->getElementsByTagName('XRD')->item(0);
if (!$xrd_element) { if (!$xrd_element) {
// TRANS: Exception. // TRANS: Exception.
throw new Exception(_m('Invalid XML, missing XRD root.')); throw new Exception(_('Invalid XML, missing XRD root.'));
} }
// Check for host-meta host // Check for host-meta host

View File

@ -31,7 +31,7 @@ class XrdAction extends Action
const PROFILEPAGE = 'http://webfinger.net/rel/profile-page'; const PROFILEPAGE = 'http://webfinger.net/rel/profile-page';
const UPDATESFROM = 'http://schemas.google.com/g/2010#updates-from'; const UPDATESFROM = 'http://schemas.google.com/g/2010#updates-from';
const HCARD = 'http://microformats.org/profile/hcard'; const HCARD = 'http://microformats.org/profile/hcard';
public $uri; public $uri;
public $user; public $user;
@ -54,39 +54,39 @@ class XrdAction extends Action
} }
if (Event::handle('StartXrdActionAliases', array(&$xrd, $this->user))) { if (Event::handle('StartXrdActionAliases', array(&$xrd, $this->user))) {
// Possible aliases for the user // Possible aliases for the user
$uris = array($this->user->uri, $profile->profileurl); $uris = array($this->user->uri, $profile->profileurl);
// FIXME: Webfinger generation code should live somewhere on its own // FIXME: Webfinger generation code should live somewhere on its own
$path = common_config('site', 'path'); $path = common_config('site', 'path');
if (empty($path)) { if (empty($path)) {
$uris[] = sprintf('acct:%s@%s', $nick, common_config('site', 'server')); $uris[] = sprintf('acct:%s@%s', $nick, common_config('site', 'server'));
} }
foreach ($uris as $uri) { foreach ($uris as $uri) {
if ($uri != $xrd->subject) { if ($uri != $xrd->subject) {
$xrd->alias[] = $uri; $xrd->alias[] = $uri;
} }
} }
Event::handle('EndXrdActionAliases', array(&$xrd, $this->user)); Event::handle('EndXrdActionAliases', array(&$xrd, $this->user));
} }
if (Event::handle('StartXrdActionLinks', array(&$xrd, $this->user))) { if (Event::handle('StartXrdActionLinks', array(&$xrd, $this->user))) {
$xrd->links[] = array('rel' => self::PROFILEPAGE, $xrd->links[] = array('rel' => self::PROFILEPAGE,
'type' => 'text/html', 'type' => 'text/html',
'href' => $profile->profileurl); 'href' => $profile->profileurl);
// hCard // hCard
$xrd->links[] = array('rel' => self::HCARD, $xrd->links[] = array('rel' => self::HCARD,
'type' => 'text/html', 'type' => 'text/html',
'href' => common_local_url('hcard', array('nickname' => $nick))); 'href' => common_local_url('hcard', array('nickname' => $nick)));
// XFN // XFN
$xrd->links[] = array('rel' => 'http://gmpg.org/xfn/11', $xrd->links[] = array('rel' => 'http://gmpg.org/xfn/11',
'type' => 'text/html', 'type' => 'text/html',
@ -96,7 +96,7 @@ class XrdAction extends Action
'type' => 'application/rdf+xml', 'type' => 'application/rdf+xml',
'href' => common_local_url('foaf', 'href' => common_local_url('foaf',
array('nickname' => $nick))); array('nickname' => $nick)));
$xrd->links[] = array('rel' => 'http://apinamespace.org/atom', $xrd->links[] = array('rel' => 'http://apinamespace.org/atom',
'type' => 'application/atomsvc+xml', 'type' => 'application/atomsvc+xml',
'href' => common_local_url('ApiAtomService', array('id' => $nick)), 'href' => common_local_url('ApiAtomService', array('id' => $nick)),
@ -108,7 +108,7 @@ class XrdAction extends Action
} else { } else {
$apiRoot = common_path('index.php/api/', true); $apiRoot = common_path('index.php/api/', true);
} }
$xrd->links[] = array('rel' => 'http://apinamespace.org/twitter', $xrd->links[] = array('rel' => 'http://apinamespace.org/twitter',
'href' => $apiRoot, 'href' => $apiRoot,
'property' => array(array('type' => 'http://apinamespace.org/twitter/username', 'property' => array(array('type' => 'http://apinamespace.org/twitter/username',
@ -120,12 +120,12 @@ class XrdAction extends Action
header('Content-type: application/xrd+xml'); header('Content-type: application/xrd+xml');
print $xrd->toXML(); print $xrd->toXML();
} }
/** /**
* Given a "user id" make sure it's normalized to either a webfinger * Given a "user id" make sure it's normalized to either a webfinger
* acct: uri or a profile HTTP URL. * acct: uri or a profile HTTP URL.
*/ */
public static function normalize($user_id) public static function normalize($user_id)
{ {
if (substr($user_id, 0, 5) == 'http:' || if (substr($user_id, 0, 5) == 'http:' ||