diff options
author | Evan Prodromou <evan@status.net> | 2010-09-21 14:07:48 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-09-21 14:07:48 -0400 |
commit | 78ed0348b0eaaebf7a51d55adc7e746cc5b43bbf (patch) | |
tree | 26545c5badcfcf54956f67d813c97b2f3eb3c84e /plugins/OStatus/lib | |
parent | dffec9f223c1e45832d274c34f7bd6624cbf87ea (diff) | |
parent | d342899677d208d7e300b29ad3a8d053e4c6f704 (diff) |
Merge remote branch 'gitorious/0.9.x' into 0.9.x
Diffstat (limited to 'plugins/OStatus/lib')
-rw-r--r-- | plugins/OStatus/lib/discovery.php | 4 | ||||
-rw-r--r-- | plugins/OStatus/lib/discoveryhints.php | 1 | ||||
-rw-r--r-- | plugins/OStatus/lib/linkheader.php | 3 | ||||
-rw-r--r-- | plugins/OStatus/lib/magicenvelope.php | 6 | ||||
-rw-r--r-- | plugins/OStatus/lib/ostatusqueuehandler.php | 1 | ||||
-rw-r--r-- | plugins/OStatus/lib/pushinqueuehandler.php | 1 | ||||
-rw-r--r-- | plugins/OStatus/lib/salmon.php | 5 | ||||
-rw-r--r-- | plugins/OStatus/lib/salmonaction.php | 17 | ||||
-rw-r--r-- | plugins/OStatus/lib/xrd.php | 7 | ||||
-rw-r--r-- | plugins/OStatus/lib/xrdaction.php | 1 |
10 files changed, 28 insertions, 18 deletions
diff --git a/plugins/OStatus/lib/discovery.php b/plugins/OStatus/lib/discovery.php index 04c672720..905ece2ca 100644 --- a/plugins/OStatus/lib/discovery.php +++ b/plugins/OStatus/lib/discovery.php @@ -106,8 +106,8 @@ class Discovery } } - // @todo Needs i18n. - throw new Exception('Unable to find services for '. $id . '.'); + // TRANS: Exception. + throw new Exception(sprintf(_m('Unable to find services for %s.'),$id)); } public static function getService($links, $service) { diff --git a/plugins/OStatus/lib/discoveryhints.php b/plugins/OStatus/lib/discoveryhints.php index fa2ead732..a98f4a6d6 100644 --- a/plugins/OStatus/lib/discoveryhints.php +++ b/plugins/OStatus/lib/discoveryhints.php @@ -20,7 +20,6 @@ */ class DiscoveryHints { - static function fromXRD($xrd) { $hints = array(); diff --git a/plugins/OStatus/lib/linkheader.php b/plugins/OStatus/lib/linkheader.php index cd78d31ce..efa3f65ff 100644 --- a/plugins/OStatus/lib/linkheader.php +++ b/plugins/OStatus/lib/linkheader.php @@ -1,4 +1,7 @@ <?php +/** + * @todo Add file header and documentation. + */ class LinkHeader { diff --git a/plugins/OStatus/lib/magicenvelope.php b/plugins/OStatus/lib/magicenvelope.php index bbd4ce17a..03e6f7c66 100644 --- a/plugins/OStatus/lib/magicenvelope.php +++ b/plugins/OStatus/lib/magicenvelope.php @@ -76,7 +76,8 @@ class MagicEnvelope } } } - throw new Exception('Unable to locate signer public key.'); + // TRANS: Exception. + throw new Exception(_m('Unable to locate signer public key.')); } @@ -92,7 +93,6 @@ class MagicEnvelope 'sig' => $signature_alg->sign($armored_text), 'alg' => $signature_alg->getName() ); - } public function toXML($env) { @@ -110,7 +110,6 @@ class MagicEnvelope return $string; } - public function unfold($env) { $dom = new DOMDocument(); @@ -218,5 +217,4 @@ class MagicEnvelope 'sig' => preg_replace('/\s/', '', $sig_element->nodeValue), ); } - } diff --git a/plugins/OStatus/lib/ostatusqueuehandler.php b/plugins/OStatus/lib/ostatusqueuehandler.php index 9814cab9f..5e0ab46a5 100644 --- a/plugins/OStatus/lib/ostatusqueuehandler.php +++ b/plugins/OStatus/lib/ostatusqueuehandler.php @@ -221,5 +221,4 @@ class OStatusQueueHandler extends QueueHandler return $feed; } - } diff --git a/plugins/OStatus/lib/pushinqueuehandler.php b/plugins/OStatus/lib/pushinqueuehandler.php index 1fd29ae30..965d04266 100644 --- a/plugins/OStatus/lib/pushinqueuehandler.php +++ b/plugins/OStatus/lib/pushinqueuehandler.php @@ -22,7 +22,6 @@ * @package FeedSub * @author Brion Vibber <brion@status.net> */ - class PushInQueueHandler extends QueueHandler { function transport() diff --git a/plugins/OStatus/lib/salmon.php b/plugins/OStatus/lib/salmon.php index 631ebc7d8..963da6508 100644 --- a/plugins/OStatus/lib/salmon.php +++ b/plugins/OStatus/lib/salmon.php @@ -89,8 +89,8 @@ class Salmon $magickey->generate($user->id); } } else { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new Exception("Salmon invalid actor for signing."); + // TRANS: Exception. + throw new Exception(_m('Salmon invalid actor for signing.')); } try { @@ -101,7 +101,6 @@ class Salmon return $magic_env->toXML($env); } - public function verifyMagicEnv($text) { $magic_env = new MagicEnvelope(); diff --git a/plugins/OStatus/lib/salmonaction.php b/plugins/OStatus/lib/salmonaction.php index f97c67edd..41bdb4892 100644 --- a/plugins/OStatus/lib/salmonaction.php +++ b/plugins/OStatus/lib/salmonaction.php @@ -38,11 +38,12 @@ class SalmonAction extends Action parent::prepare($args); if ($_SERVER['REQUEST_METHOD'] != 'POST') { - // TRANS: POST is a HTTP command. It should not be translated. + // TRANS: Client error. POST is a HTTP command. It should not be translated. $this->clientError(_m('This method requires a POST.')); } if (empty($_SERVER['CONTENT_TYPE']) || $_SERVER['CONTENT_TYPE'] != 'application/magic-envelope+xml') { + // TRANS: Client error. Do not translate "application/magic-envelope+xml" $this->clientError(_m('Salmon requires "application/magic-envelope+xml".')); } @@ -52,6 +53,7 @@ class SalmonAction extends Action $salmon = new Salmon; if (!$salmon->verifyMagicEnv($xml)) { common_log(LOG_DEBUG, "Salmon signature verification failed."); + // TRANS: Client error. $this->clientError(_m('Salmon signature verification failed.')); } else { $magic_env = new MagicEnvelope(); @@ -63,6 +65,7 @@ class SalmonAction extends Action if ($dom->documentElement->namespaceURI != Activity::ATOM || $dom->documentElement->localName != 'entry') { common_log(LOG_DEBUG, "Got invalid Salmon post: $xml"); + // TRANS: Client error. $this->clientError(_m('Salmon post must be an Atom entry.')); } @@ -111,6 +114,7 @@ class SalmonAction extends Action $this->handleUpdateProfile(); break; default: + // TRANS: Client exception. throw new ClientException(_m("Unrecognized activity type.")); } Event::handle('EndHandleSalmon', array($this->activity)); @@ -119,41 +123,49 @@ class SalmonAction extends Action function handlePost() { + // TRANS: Client exception. throw new ClientException(_m("This target doesn't understand posts.")); } function handleFollow() { + // TRANS: Client exception. throw new ClientException(_m("This target doesn't understand follows.")); } function handleUnfollow() { + // TRANS: Client exception. throw new ClientException(_m("This target doesn't understand unfollows.")); } function handleFavorite() { + // TRANS: Client exception. throw new ClientException(_m("This target doesn't understand favorites.")); } function handleUnfavorite() { + // TRANS: Client exception. throw new ClientException(_m("This target doesn't understand unfavorites.")); } function handleShare() { + // TRANS: Client exception. throw new ClientException(_m("This target doesn't understand share events.")); } function handleJoin() { + // TRANS: Client exception. throw new ClientException(_m("This target doesn't understand joins.")); } function handleLeave() { + // TRANS: Client exception. throw new ClientException(_m("This target doesn't understand leave events.")); } @@ -181,7 +193,8 @@ class SalmonAction extends Action if (empty($actor->id)) { common_log(LOG_ERR, "broken actor: " . var_export($actor, true)); common_log(LOG_ERR, "activity with no actor: " . var_export($this->activity, true)); - throw new Exception("Received a salmon slap from unidentified actor."); + // TRANS: Exception. + throw new Exception(_m('Received a salmon slap from unidentified actor.')); } return Ostatus_profile::ensureActivityObjectProfile($actor); diff --git a/plugins/OStatus/lib/xrd.php b/plugins/OStatus/lib/xrd.php index 145cd64cb..c8cffed9c 100644 --- a/plugins/OStatus/lib/xrd.php +++ b/plugins/OStatus/lib/xrd.php @@ -27,7 +27,6 @@ * @link http://status.net/ */ - class XRD { const XML_NS = 'http://www.w3.org/2000/xmlns/'; @@ -61,11 +60,13 @@ class XRD error_reporting($old); if (!$ok) { - throw new Exception("Invalid XML."); + // TRANS: Exception. + throw new Exception(_m('Invalid XML.')); } $xrd_element = $dom->getElementsByTagName('XRD')->item(0); if (!$xrd_element) { - throw new Exception("Invalid XML, missing XRD root."); + // TRANS: Exception. + throw new Exception(_m('Invalid XML, missing XRD root.')); } // Check for host-meta host diff --git a/plugins/OStatus/lib/xrdaction.php b/plugins/OStatus/lib/xrdaction.php index 91bb87cc2..c8b5beff3 100644 --- a/plugins/OStatus/lib/xrdaction.php +++ b/plugins/OStatus/lib/xrdaction.php @@ -103,5 +103,4 @@ class XrdAction extends Action header('Content-type: application/xrd+xml'); print $xrd->toXML(); } - } |