From 262eb7120f08a4a7c021c7c1df6a67e1b3c1d27d Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 10 Sep 2010 09:10:53 -0400 Subject: make our own twitter links if Twitter doesn't give us entities --- .../TwitterBridge/daemons/twitterstatusfetcher.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php index f1305696b..b2bcc22bc 100755 --- a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php +++ b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php @@ -713,6 +713,10 @@ class TwitterStatusFetcher extends ParallelizingDaemon $text = $status->text; if (empty($status->entities)) { + common_log(LOG_WARNING, "No entities data for {$status->id}; trying to fake up links ourselves."); + $text = common_replace_urls_callback($text, 'common_linkify'); + $text = preg_replace('/(^|\"\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/e', "'\\1#'.TwitterStatusFetcher::tagLink('\\2')", $text); + $text = preg_replace('/(?:^|\s+)@([a-z0-9A-Z_]{1,64})/e', "'\\1@'.TwitterStatusFetcher::atLink('\\2')", $text); return $text; } @@ -771,12 +775,26 @@ class TwitterStatusFetcher extends ParallelizingDaemon function makeHashtagLink($object) { - return "#{$object->text}"; + return "#" . self::tagLink($object->text); } function makeMentionLink($object) { - return "@{$object->screen_name}"; + return "@".self::atLink($object->screen_name, $object->name); + } + + static function tagLink($tag) + { + return "{$tag}"; + } + + static function atLink($screenName, $fullName=null) + { + if (!empty($fullName)) { + return "{$screenName}"; + } else { + return "{$screenName}"; + } } function saveStatusMentions($notice, $status) -- cgit v1.2.3-54-g00ecf From cfcb8603171cf9dd30fe54ee682a3666c0b21d7e Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 10 Sep 2010 09:21:01 -0400 Subject: use capturing parens for matching at-mentions in twitterstatusfetcher --- plugins/TwitterBridge/daemons/twitterstatusfetcher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php index b2bcc22bc..181be3dcf 100755 --- a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php +++ b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php @@ -716,7 +716,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon common_log(LOG_WARNING, "No entities data for {$status->id}; trying to fake up links ourselves."); $text = common_replace_urls_callback($text, 'common_linkify'); $text = preg_replace('/(^|\"\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/e', "'\\1#'.TwitterStatusFetcher::tagLink('\\2')", $text); - $text = preg_replace('/(?:^|\s+)@([a-z0-9A-Z_]{1,64})/e', "'\\1@'.TwitterStatusFetcher::atLink('\\2')", $text); + $text = preg_replace('/(^|\s+)@([a-z0-9A-Z_]{1,64})/e', "'\\1@'.TwitterStatusFetcher::atLink('\\2')", $text); return $text; } -- cgit v1.2.3-54-g00ecf From f17512cfe603b8f00576cdff10f3a3d71924c000 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 10 Sep 2010 11:50:19 -0700 Subject: Catch exceptions during SubMirror mirror attempt; log & skip that one if found. Should avoid things like RequireValidatedEmailPlugin causing infinite retry loops if the mirror-er isn't validated yet. --- plugins/SubMirror/lib/mirrorqueuehandler.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/SubMirror/lib/mirrorqueuehandler.php b/plugins/SubMirror/lib/mirrorqueuehandler.php index 92b36b5eb..c1a6f65e3 100644 --- a/plugins/SubMirror/lib/mirrorqueuehandler.php +++ b/plugins/SubMirror/lib/mirrorqueuehandler.php @@ -37,7 +37,13 @@ class MirrorQueueHandler extends QueueHandler $mirror->subscribed = $notice->profile_id; if ($mirror->find()) { while ($mirror->fetch()) { - $mirror->mirrorNotice($notice); + try { + $mirror->mirrorNotice($notice); + } catch (Exception $e) { + common_log(LOG_ERR, "Exception trying to mirror notice $notice->id " . + "for subscriber $mirror->subscriber ($mirror->style): " . + $e->getMessage()); + } } } return true; -- cgit v1.2.3-54-g00ecf From 0021c16bd11be5c9e9f0196154b037e604d6bf37 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 13 Sep 2010 12:06:10 -0700 Subject: Declare public options on DisqusPlugin to avoid notice warnings on access if not set. --- plugins/DisqusPlugin.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins') diff --git a/plugins/DisqusPlugin.php b/plugins/DisqusPlugin.php index c07eaaabd..eef40616e 100644 --- a/plugins/DisqusPlugin.php +++ b/plugins/DisqusPlugin.php @@ -71,6 +71,9 @@ if (!defined('STATUSNET')) { class DisqusPlugin extends Plugin { + public $shortname; // Required 'shortname' for actually triggering Disqus. + public $div_style; // Optional CSS chunk for the main
+ function onEndShowContentBlock($action) { if (get_class($action) == 'ShownoticeAction') { -- cgit v1.2.3-54-g00ecf From 95b534c5cee56602dffcc11121908c0f518cab6d Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 15 Sep 2010 14:09:23 -0700 Subject: Move standalone plugin files into subdirectories so they can have locale data, etc added to them at leisure. --- plugins/APC/APCPlugin.php | 119 +++++ plugins/APCPlugin.php | 119 ----- plugins/BlogspamNet/BlogspamNetPlugin.php | 145 ++++++ plugins/BlogspamNetPlugin.php | 145 ------ plugins/CacheLog/CacheLogPlugin.php | 121 +++++ plugins/CacheLogPlugin.php | 121 ----- plugins/DiskCache/DiskCachePlugin.php | 168 +++++++ plugins/DiskCachePlugin.php | 168 ------- plugins/Disqus/DisqusPlugin.php | 171 +++++++ plugins/DisqusPlugin.php | 171 ------- plugins/Echo/EchoPlugin.php | 116 +++++ plugins/EchoPlugin.php | 116 ----- plugins/GeoURL/GeoURLPlugin.php | 131 ++++++ plugins/GeoURLPlugin.php | 131 ------ plugins/Geonames/GeonamesPlugin.php | 510 +++++++++++++++++++++ plugins/GeonamesPlugin.php | 510 --------------------- plugins/GoogleAnalytics/GoogleAnalyticsPlugin.php | 85 ++++ plugins/GoogleAnalyticsPlugin.php | 85 ---- plugins/Linkback/LinkbackPlugin.php | 249 ++++++++++ plugins/LinkbackPlugin.php | 249 ---------- plugins/Memcache/MemcachePlugin.php | 256 +++++++++++ plugins/MemcachePlugin.php | 256 ----------- plugins/Memcached/MemcachedPlugin.php | 227 +++++++++ plugins/MemcachedPlugin.php | 227 --------- plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php | 112 +++++ plugins/PiwikAnalyticsPlugin.php | 112 ----- plugins/Spotify/SpotifyPlugin.php | 113 +++++ plugins/SpotifyPlugin.php | 113 ----- .../SubscriptionThrottlePlugin.php | 175 +++++++ plugins/SubscriptionThrottlePlugin.php | 175 ------- plugins/Template/TemplatePlugin.php | 357 +++++++++++++++ plugins/TemplatePlugin.php | 357 --------------- plugins/UserLimit/UserLimitPlugin.php | 92 ++++ plugins/UserLimitPlugin.php | 92 ---- plugins/WikiHashtags/WikiHashtagsPlugin.php | 113 +++++ plugins/WikiHashtagsPlugin.php | 113 ----- plugins/XCache/XCachePlugin.php | 124 +++++ plugins/XCachePlugin.php | 124 ----- 38 files changed, 3384 insertions(+), 3384 deletions(-) create mode 100644 plugins/APC/APCPlugin.php delete mode 100644 plugins/APCPlugin.php create mode 100644 plugins/BlogspamNet/BlogspamNetPlugin.php delete mode 100644 plugins/BlogspamNetPlugin.php create mode 100644 plugins/CacheLog/CacheLogPlugin.php delete mode 100644 plugins/CacheLogPlugin.php create mode 100644 plugins/DiskCache/DiskCachePlugin.php delete mode 100644 plugins/DiskCachePlugin.php create mode 100644 plugins/Disqus/DisqusPlugin.php delete mode 100644 plugins/DisqusPlugin.php create mode 100644 plugins/Echo/EchoPlugin.php delete mode 100644 plugins/EchoPlugin.php create mode 100644 plugins/GeoURL/GeoURLPlugin.php delete mode 100644 plugins/GeoURLPlugin.php create mode 100644 plugins/Geonames/GeonamesPlugin.php delete mode 100644 plugins/GeonamesPlugin.php create mode 100644 plugins/GoogleAnalytics/GoogleAnalyticsPlugin.php delete mode 100644 plugins/GoogleAnalyticsPlugin.php create mode 100644 plugins/Linkback/LinkbackPlugin.php delete mode 100644 plugins/LinkbackPlugin.php create mode 100644 plugins/Memcache/MemcachePlugin.php delete mode 100644 plugins/MemcachePlugin.php create mode 100644 plugins/Memcached/MemcachedPlugin.php delete mode 100644 plugins/MemcachedPlugin.php create mode 100644 plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php delete mode 100644 plugins/PiwikAnalyticsPlugin.php create mode 100644 plugins/Spotify/SpotifyPlugin.php delete mode 100644 plugins/SpotifyPlugin.php create mode 100644 plugins/SubscriptionThrottle/SubscriptionThrottlePlugin.php delete mode 100644 plugins/SubscriptionThrottlePlugin.php create mode 100644 plugins/Template/TemplatePlugin.php delete mode 100644 plugins/TemplatePlugin.php create mode 100644 plugins/UserLimit/UserLimitPlugin.php delete mode 100644 plugins/UserLimitPlugin.php create mode 100644 plugins/WikiHashtags/WikiHashtagsPlugin.php delete mode 100644 plugins/WikiHashtagsPlugin.php create mode 100644 plugins/XCache/XCachePlugin.php delete mode 100644 plugins/XCachePlugin.php (limited to 'plugins') diff --git a/plugins/APC/APCPlugin.php b/plugins/APC/APCPlugin.php new file mode 100644 index 000000000..666f64b14 --- /dev/null +++ b/plugins/APC/APCPlugin.php @@ -0,0 +1,119 @@ +. + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * A plugin to use APC's variable cache for the cache interface + * + * New plugin interface lets us use alternative cache systems + * for caching. This one uses APC's variable cache. + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class APCPlugin extends Plugin +{ + /** + * Get a value associated with a key + * + * The value should have been set previously. + * + * @param string &$key in; Lookup key + * @param mixed &$value out; value associated with key + * + * @return boolean hook success + */ + + function onStartCacheGet(&$key, &$value) + { + $value = apc_fetch($key); + Event::handle('EndCacheGet', array($key, &$value)); + return false; + } + + /** + * Associate a value with a key + * + * @param string &$key in; Key to use for lookups + * @param mixed &$value in; Value to associate + * @param integer &$flag in; Flag (passed through to Memcache) + * @param integer &$expiry in; Expiry (passed through to Memcache) + * @param boolean &$success out; Whether the set was successful + * + * @return boolean hook success + */ + + function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) + { + $success = apc_store($key, $value, ((is_null($expiry)) ? 0 : $expiry)); + + Event::handle('EndCacheSet', array($key, $value, $flag, + $expiry)); + return false; + } + + /** + * Delete a value associated with a key + * + * @param string &$key in; Key to lookup + * @param boolean &$success out; whether it worked + * + * @return boolean hook success + */ + + function onStartCacheDelete(&$key, &$success) + { + $success = apc_delete($key); + Event::handle('EndCacheDelete', array($key)); + return false; + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'APC', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:APC', + 'rawdescription' => + _m('Use the APC variable cache to cache query results.')); + return true; + } +} + diff --git a/plugins/APCPlugin.php b/plugins/APCPlugin.php deleted file mode 100644 index 666f64b14..000000000 --- a/plugins/APCPlugin.php +++ /dev/null @@ -1,119 +0,0 @@ -. - * - * @category Cache - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - // This check helps protect against security problems; - // your code file can't be executed directly from the web. - exit(1); -} - -/** - * A plugin to use APC's variable cache for the cache interface - * - * New plugin interface lets us use alternative cache systems - * for caching. This one uses APC's variable cache. - * - * @category Cache - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -class APCPlugin extends Plugin -{ - /** - * Get a value associated with a key - * - * The value should have been set previously. - * - * @param string &$key in; Lookup key - * @param mixed &$value out; value associated with key - * - * @return boolean hook success - */ - - function onStartCacheGet(&$key, &$value) - { - $value = apc_fetch($key); - Event::handle('EndCacheGet', array($key, &$value)); - return false; - } - - /** - * Associate a value with a key - * - * @param string &$key in; Key to use for lookups - * @param mixed &$value in; Value to associate - * @param integer &$flag in; Flag (passed through to Memcache) - * @param integer &$expiry in; Expiry (passed through to Memcache) - * @param boolean &$success out; Whether the set was successful - * - * @return boolean hook success - */ - - function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) - { - $success = apc_store($key, $value, ((is_null($expiry)) ? 0 : $expiry)); - - Event::handle('EndCacheSet', array($key, $value, $flag, - $expiry)); - return false; - } - - /** - * Delete a value associated with a key - * - * @param string &$key in; Key to lookup - * @param boolean &$success out; whether it worked - * - * @return boolean hook success - */ - - function onStartCacheDelete(&$key, &$success) - { - $success = apc_delete($key); - Event::handle('EndCacheDelete', array($key)); - return false; - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'APC', - 'version' => STATUSNET_VERSION, - 'author' => 'Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:APC', - 'rawdescription' => - _m('Use the APC variable cache to cache query results.')); - return true; - } -} - diff --git a/plugins/BlogspamNet/BlogspamNetPlugin.php b/plugins/BlogspamNet/BlogspamNetPlugin.php new file mode 100644 index 000000000..d52e6006a --- /dev/null +++ b/plugins/BlogspamNet/BlogspamNetPlugin.php @@ -0,0 +1,145 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @author Brion Vibber + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +define('BLOGSPAMNETPLUGIN_VERSION', '0.1'); + +/** + * Plugin to check submitted notices with blogspam.net + * + * When new notices are saved, we check their text with blogspam.net (or + * a compatible service). + * + * Blogspam.net is supposed to catch blog comment spam, and I found that + * some of its tests (min/max size, bayesian match) gave a lot of false positives. + * So, I've turned those tests off by default. This may not get as many + * hits, but it's better than nothing. + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @see Event + */ + +class BlogspamNetPlugin extends Plugin +{ + var $baseUrl = 'http://test.blogspam.net:8888/'; + + function __construct($url=null) + { + parent::__construct(); + if ($url) { + $this->baseUrl = $url; + } + } + + function onStartNoticeSave($notice) + { + $args = $this->testArgs($notice); + common_debug("Blogspamnet args = " . print_r($args, TRUE)); + $requestBody = xmlrpc_encode_request('testComment', array($args)); + + $request = new HTTPClient($this->baseUrl, HTTPClient::METHOD_POST); + $request->setHeader('Content-Type', 'text/xml'); + $request->setBody($requestBody); + $httpResponse = $request->send(); + + $response = xmlrpc_decode($httpResponse->getBody()); + if (xmlrpc_is_fault($response)) { + throw new ServerException("$response[faultString] ($response[faultCode])", 500); + } else { + common_debug("Blogspamnet results = " . $response); + if (preg_match('/^ERROR(:(.*))?$/', $response, $match)) { + throw new ServerException(sprintf(_("Error from %s: %s"), $this->baseUrl, $match[2]), 500); + } else if (preg_match('/^SPAM(:(.*))?$/', $response, $match)) { + throw new ClientException(sprintf(_("Spam checker results: %s"), $match[2]), 400); + } else if (preg_match('/^OK$/', $response)) { + // don't do anything + } else { + throw new ServerException(sprintf(_("Unexpected response from %s: %s"), $this->baseUrl, $response), 500); + } + } + return true; + } + + function testArgs($notice) + { + $args = array(); + $args['comment'] = $notice->content; + $args['ip'] = $this->getClientIP(); + + if (isset($_SERVER) && array_key_exists('HTTP_USER_AGENT', $_SERVER)) { + $args['agent'] = $_SERVER['HTTP_USER_AGENT']; + } + + $profile = $notice->getProfile(); + + if ($profile && $profile->homepage) { + $args['link'] = $profile->homepage; + } + + if ($profile && $profile->fullname) { + $args['name'] = $profile->fullname; + } else { + $args['name'] = $profile->nickname; + } + + $args['site'] = common_root_url(); + $args['version'] = $this->userAgent(); + + $args['options'] = "max-size=" . common_config('site','textlimit') . ",min-size=0,min-words=0,exclude=bayasian"; + + return $args; + } + + function getClientIP() + { + if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { + // Note: order matters here; use proxy-forwarded stuff first + foreach (array('HTTP_X_FORWARDED_FOR', 'CLIENT-IP', 'REMOTE_ADDR') as $k) { + if (isset($_SERVER[$k])) { + return $_SERVER[$k]; + } + } + } + return '127.0.0.1'; + } + + function userAgent() + { + return 'BlogspamNetPlugin/'.BLOGSPAMNETPLUGIN_VERSION . ' StatusNet/' . STATUSNET_VERSION; + } +} diff --git a/plugins/BlogspamNetPlugin.php b/plugins/BlogspamNetPlugin.php deleted file mode 100644 index d52e6006a..000000000 --- a/plugins/BlogspamNetPlugin.php +++ /dev/null @@ -1,145 +0,0 @@ -. - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @author Brion Vibber - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -define('BLOGSPAMNETPLUGIN_VERSION', '0.1'); - -/** - * Plugin to check submitted notices with blogspam.net - * - * When new notices are saved, we check their text with blogspam.net (or - * a compatible service). - * - * Blogspam.net is supposed to catch blog comment spam, and I found that - * some of its tests (min/max size, bayesian match) gave a lot of false positives. - * So, I've turned those tests off by default. This may not get as many - * hits, but it's better than nothing. - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @see Event - */ - -class BlogspamNetPlugin extends Plugin -{ - var $baseUrl = 'http://test.blogspam.net:8888/'; - - function __construct($url=null) - { - parent::__construct(); - if ($url) { - $this->baseUrl = $url; - } - } - - function onStartNoticeSave($notice) - { - $args = $this->testArgs($notice); - common_debug("Blogspamnet args = " . print_r($args, TRUE)); - $requestBody = xmlrpc_encode_request('testComment', array($args)); - - $request = new HTTPClient($this->baseUrl, HTTPClient::METHOD_POST); - $request->setHeader('Content-Type', 'text/xml'); - $request->setBody($requestBody); - $httpResponse = $request->send(); - - $response = xmlrpc_decode($httpResponse->getBody()); - if (xmlrpc_is_fault($response)) { - throw new ServerException("$response[faultString] ($response[faultCode])", 500); - } else { - common_debug("Blogspamnet results = " . $response); - if (preg_match('/^ERROR(:(.*))?$/', $response, $match)) { - throw new ServerException(sprintf(_("Error from %s: %s"), $this->baseUrl, $match[2]), 500); - } else if (preg_match('/^SPAM(:(.*))?$/', $response, $match)) { - throw new ClientException(sprintf(_("Spam checker results: %s"), $match[2]), 400); - } else if (preg_match('/^OK$/', $response)) { - // don't do anything - } else { - throw new ServerException(sprintf(_("Unexpected response from %s: %s"), $this->baseUrl, $response), 500); - } - } - return true; - } - - function testArgs($notice) - { - $args = array(); - $args['comment'] = $notice->content; - $args['ip'] = $this->getClientIP(); - - if (isset($_SERVER) && array_key_exists('HTTP_USER_AGENT', $_SERVER)) { - $args['agent'] = $_SERVER['HTTP_USER_AGENT']; - } - - $profile = $notice->getProfile(); - - if ($profile && $profile->homepage) { - $args['link'] = $profile->homepage; - } - - if ($profile && $profile->fullname) { - $args['name'] = $profile->fullname; - } else { - $args['name'] = $profile->nickname; - } - - $args['site'] = common_root_url(); - $args['version'] = $this->userAgent(); - - $args['options'] = "max-size=" . common_config('site','textlimit') . ",min-size=0,min-words=0,exclude=bayasian"; - - return $args; - } - - function getClientIP() - { - if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { - // Note: order matters here; use proxy-forwarded stuff first - foreach (array('HTTP_X_FORWARDED_FOR', 'CLIENT-IP', 'REMOTE_ADDR') as $k) { - if (isset($_SERVER[$k])) { - return $_SERVER[$k]; - } - } - } - return '127.0.0.1'; - } - - function userAgent() - { - return 'BlogspamNetPlugin/'.BLOGSPAMNETPLUGIN_VERSION . ' StatusNet/' . STATUSNET_VERSION; - } -} diff --git a/plugins/CacheLog/CacheLogPlugin.php b/plugins/CacheLog/CacheLogPlugin.php new file mode 100644 index 000000000..4c47de80e --- /dev/null +++ b/plugins/CacheLog/CacheLogPlugin.php @@ -0,0 +1,121 @@ +. + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * Log cache access + * + * Note that since most caching plugins return false for StartCache* + * methods, you should add this plugin before them, i.e. + * + * addPlugin('CacheLog'); + * addPlugin('XCache'); + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +class CacheLogPlugin extends Plugin +{ + function onStartCacheGet(&$key, &$value) + { + $this->log(LOG_INFO, "Fetching key '$key'"); + return true; + } + + function onEndCacheGet($key, &$value) + { + if ($value === false) { + $this->log(LOG_INFO, "Cache MISS for key '$key'"); + } else { + $this->log(LOG_INFO, "Cache HIT for key '$key'"); + } + return true; + } + + function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) + { + if (empty($value)) { + if (is_array($value)) { + $this->log(LOG_INFO, "Setting empty array for key '$key'"); + } else if (is_null($value)) { + $this->log(LOG_INFO, "Setting null value for key '$key'"); + } else if (is_string($value)) { + $this->log(LOG_INFO, "Setting empty string for key '$key'"); + } else if (is_integer($value)) { + $this->log(LOG_INFO, "Setting integer 0 for key '$key'"); + } else { + $this->log(LOG_INFO, "Setting empty value '$value' for key '$key'"); + } + } else { + $this->log(LOG_INFO, "Setting non-empty value for key '$key'"); + } + return true; + } + + function onEndCacheSet($key, $value, $flag, $expiry) + { + $this->log(LOG_INFO, "Done setting cache value for key '$key'"); + return true; + } + + function onStartCacheDelete(&$key, &$success) + { + $this->log(LOG_INFO, "Deleting cache value for key '$key'"); + return true; + } + + function onEndCacheDelete($key) + { + $this->log(LOG_INFO, "Done deleting cache value for key '$key'"); + return true; + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'CacheLog', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:CacheLog', + 'description' => + _m('Log reads and writes to the cache')); + return true; + } +} + diff --git a/plugins/CacheLogPlugin.php b/plugins/CacheLogPlugin.php deleted file mode 100644 index 4c47de80e..000000000 --- a/plugins/CacheLogPlugin.php +++ /dev/null @@ -1,121 +0,0 @@ -. - * - * @category Cache - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - // This check helps protect against security problems; - // your code file can't be executed directly from the web. - exit(1); -} - -/** - * Log cache access - * - * Note that since most caching plugins return false for StartCache* - * methods, you should add this plugin before them, i.e. - * - * addPlugin('CacheLog'); - * addPlugin('XCache'); - * - * @category Cache - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 - * @link http://status.net/ - */ - -class CacheLogPlugin extends Plugin -{ - function onStartCacheGet(&$key, &$value) - { - $this->log(LOG_INFO, "Fetching key '$key'"); - return true; - } - - function onEndCacheGet($key, &$value) - { - if ($value === false) { - $this->log(LOG_INFO, "Cache MISS for key '$key'"); - } else { - $this->log(LOG_INFO, "Cache HIT for key '$key'"); - } - return true; - } - - function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) - { - if (empty($value)) { - if (is_array($value)) { - $this->log(LOG_INFO, "Setting empty array for key '$key'"); - } else if (is_null($value)) { - $this->log(LOG_INFO, "Setting null value for key '$key'"); - } else if (is_string($value)) { - $this->log(LOG_INFO, "Setting empty string for key '$key'"); - } else if (is_integer($value)) { - $this->log(LOG_INFO, "Setting integer 0 for key '$key'"); - } else { - $this->log(LOG_INFO, "Setting empty value '$value' for key '$key'"); - } - } else { - $this->log(LOG_INFO, "Setting non-empty value for key '$key'"); - } - return true; - } - - function onEndCacheSet($key, $value, $flag, $expiry) - { - $this->log(LOG_INFO, "Done setting cache value for key '$key'"); - return true; - } - - function onStartCacheDelete(&$key, &$success) - { - $this->log(LOG_INFO, "Deleting cache value for key '$key'"); - return true; - } - - function onEndCacheDelete($key) - { - $this->log(LOG_INFO, "Done deleting cache value for key '$key'"); - return true; - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'CacheLog', - 'version' => STATUSNET_VERSION, - 'author' => 'Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:CacheLog', - 'description' => - _m('Log reads and writes to the cache')); - return true; - } -} - diff --git a/plugins/DiskCache/DiskCachePlugin.php b/plugins/DiskCache/DiskCachePlugin.php new file mode 100644 index 000000000..b709ea3b3 --- /dev/null +++ b/plugins/DiskCache/DiskCachePlugin.php @@ -0,0 +1,168 @@ +. + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * A plugin to cache data on local disk + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class DiskCachePlugin extends Plugin +{ + var $root = '/tmp'; + + function keyToFilename($key) + { + return $this->root . '/' . str_replace(':', '/', $key); + } + + /** + * Get a value associated with a key + * + * The value should have been set previously. + * + * @param string &$key in; Lookup key + * @param mixed &$value out; value associated with key + * + * @return boolean hook success + */ + + function onStartCacheGet(&$key, &$value) + { + $filename = $this->keyToFilename($key); + + if (file_exists($filename)) { + $data = file_get_contents($filename); + if ($data !== false) { + $value = unserialize($data); + } + } + + Event::handle('EndCacheGet', array($key, &$value)); + return false; + } + + /** + * Associate a value with a key + * + * @param string &$key in; Key to use for lookups + * @param mixed &$value in; Value to associate + * @param integer &$flag in; Flag (passed through to Memcache) + * @param integer &$expiry in; Expiry (passed through to Memcache) + * @param boolean &$success out; Whether the set was successful + * + * @return boolean hook success + */ + + function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) + { + $filename = $this->keyToFilename($key); + $parent = dirname($filename); + + $sofar = ''; + + foreach (explode('/', $parent) as $part) { + if (empty($part)) { + continue; + } + $sofar .= '/' . $part; + if (!is_dir($sofar)) { + $this->debug("Creating new directory '$sofar'"); + $success = mkdir($sofar, 0750); + if (!$success) { + $this->log(LOG_ERR, "Can't create directory '$sofar'"); + return false; + } + } + } + + if (is_dir($filename)) { + $success = false; + return false; + } + + // Write to a temp file and move to destination + + $tempname = tempnam(null, 'statusnetdiskcache'); + + $result = file_put_contents($tempname, serialize($value)); + + if ($result === false) { + $this->log(LOG_ERR, "Couldn't write '$key' to temp file '$tempname'"); + return false; + } + + $result = rename($tempname, $filename); + + if (!$result) { + $this->log(LOG_ERR, "Couldn't move temp file '$tempname' to path '$filename' for key '$key'"); + @unlink($tempname); + return false; + } + + Event::handle('EndCacheSet', array($key, $value, $flag, + $expiry)); + + return false; + } + + /** + * Delete a value associated with a key + * + * @param string &$key in; Key to lookup + * @param boolean &$success out; whether it worked + * + * @return boolean hook success + */ + + function onStartCacheDelete(&$key, &$success) + { + $filename = $this->keyToFilename($key); + + if (file_exists($filename) && !is_dir($filename)) { + unlink($filename); + } + + Event::handle('EndCacheDelete', array($key)); + return false; + } +} + diff --git a/plugins/DiskCachePlugin.php b/plugins/DiskCachePlugin.php deleted file mode 100644 index b709ea3b3..000000000 --- a/plugins/DiskCachePlugin.php +++ /dev/null @@ -1,168 +0,0 @@ -. - * - * @category Cache - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - // This check helps protect against security problems; - // your code file can't be executed directly from the web. - exit(1); -} - -/** - * A plugin to cache data on local disk - * - * @category Cache - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -class DiskCachePlugin extends Plugin -{ - var $root = '/tmp'; - - function keyToFilename($key) - { - return $this->root . '/' . str_replace(':', '/', $key); - } - - /** - * Get a value associated with a key - * - * The value should have been set previously. - * - * @param string &$key in; Lookup key - * @param mixed &$value out; value associated with key - * - * @return boolean hook success - */ - - function onStartCacheGet(&$key, &$value) - { - $filename = $this->keyToFilename($key); - - if (file_exists($filename)) { - $data = file_get_contents($filename); - if ($data !== false) { - $value = unserialize($data); - } - } - - Event::handle('EndCacheGet', array($key, &$value)); - return false; - } - - /** - * Associate a value with a key - * - * @param string &$key in; Key to use for lookups - * @param mixed &$value in; Value to associate - * @param integer &$flag in; Flag (passed through to Memcache) - * @param integer &$expiry in; Expiry (passed through to Memcache) - * @param boolean &$success out; Whether the set was successful - * - * @return boolean hook success - */ - - function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) - { - $filename = $this->keyToFilename($key); - $parent = dirname($filename); - - $sofar = ''; - - foreach (explode('/', $parent) as $part) { - if (empty($part)) { - continue; - } - $sofar .= '/' . $part; - if (!is_dir($sofar)) { - $this->debug("Creating new directory '$sofar'"); - $success = mkdir($sofar, 0750); - if (!$success) { - $this->log(LOG_ERR, "Can't create directory '$sofar'"); - return false; - } - } - } - - if (is_dir($filename)) { - $success = false; - return false; - } - - // Write to a temp file and move to destination - - $tempname = tempnam(null, 'statusnetdiskcache'); - - $result = file_put_contents($tempname, serialize($value)); - - if ($result === false) { - $this->log(LOG_ERR, "Couldn't write '$key' to temp file '$tempname'"); - return false; - } - - $result = rename($tempname, $filename); - - if (!$result) { - $this->log(LOG_ERR, "Couldn't move temp file '$tempname' to path '$filename' for key '$key'"); - @unlink($tempname); - return false; - } - - Event::handle('EndCacheSet', array($key, $value, $flag, - $expiry)); - - return false; - } - - /** - * Delete a value associated with a key - * - * @param string &$key in; Key to lookup - * @param boolean &$success out; whether it worked - * - * @return boolean hook success - */ - - function onStartCacheDelete(&$key, &$success) - { - $filename = $this->keyToFilename($key); - - if (file_exists($filename) && !is_dir($filename)) { - unlink($filename); - } - - Event::handle('EndCacheDelete', array($key)); - return false; - } -} - diff --git a/plugins/Disqus/DisqusPlugin.php b/plugins/Disqus/DisqusPlugin.php new file mode 100644 index 000000000..c07eaaabd --- /dev/null +++ b/plugins/Disqus/DisqusPlugin.php @@ -0,0 +1,171 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Zach Copley + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * + * This plugin adds Disqus commenting to your notices. Enabling this + * plugin will make each notice page display the Disqus widget, and + * notice lists will display the number of commments each notice has. + * + * To use this plugin, you need to first register your site with Disqus + * and get a Discus 'shortname' for it. + * + * http://disqus.com + * + * To enable the plugin, put the following in you config.php: + * + * addPlugin( + * 'Disqus', array( + * 'shortname' => 'YOURSHORTNAME', + * 'div_style' => 'width:675px; padding-top:10px; position:relative; float:left;' + * ) + * ); + * + * NOTE: the 'div_style' in an optional parameter that passes in some + * inline CSS when creating the Disqus widget. It's a shortcut to make + * the widget look OK with the default StatusNet theme. If you leave + * it out you'll have to edit your theme CSS files to make the widget + * look good. You can also control the way the widget looks by + * adding style rules to your theme. + * + * See: http://help.disqus.com/entries/100878-css-customization + * + * @category Plugin + * @package StatusNet + * @author Zach Copley + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @see Event + */ + +class DisqusPlugin extends Plugin +{ + function onEndShowContentBlock($action) + { + if (get_class($action) == 'ShownoticeAction') { + + $attrs = array(); + $attrs['id'] = 'disqus_thread'; + + if ($this->div_style) { + $attrs['style'] = $this->div_style; + } + + $action->element('div', $attrs, null); + + $script = <<inlineScript(sprintf($script, $action->notice->id, $this->shortname)); + + $attrs = array(); + + $attrs['id'] = 'disqus_thread_footer'; + + if ($this->div_style) { + $attrs['style'] = $this->div_style; + } + + $action->elementStart('div', $attrs); + $action->elementStart('noscript'); + + $action->raw('Please enable JavaScript to view the '); + $noscriptUrl = 'http://disqus.com/?ref_noscript=' . $this->shortname; + $action->element('a', array('href' => $noscriptUrl), 'comments powered by Disqus.'); + $action->elementEnd('noscript'); + + $action->elementStart('a', array('href' => 'http://disqus.com', 'class' => 'dsq-brlink')); + $action->raw('blog comments powered by '); + $action->element('span', array('class' => 'logo-disqus'), 'Disqus'); + $action->elementEnd('a'); + $action->elementEnd('div'); + } + } + + function onEndShowScripts($action) + { + // fugly + $script = <<inlineScript(sprintf($script, $this->shortname, $this->shortname)); + + return true; + } + + function onStartShowNoticeItem($noticeListItem) + { + if (empty($noticeListItem->notice->is_local)) { + return true; + } + + $noticeListItem->showNotice(); + $noticeListItem->showNoticeInfo(); + + $noticeUrl = $noticeListItem->notice->bestUrl(); + $noticeUrl .= '#disqus_thread'; + + $noticeListItem->out->element( + 'a', array('href' => $noticeUrl, 'class' => 'disqus_count'), 'Comments' + ); + + $noticeListItem->showNoticeOptions(); + Event::handle('EndShowNoticeItem', array($noticeListItem)); + + return false; + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'Disqus', + 'version' => STATUSNET_VERSION, + 'author' => 'Zach Copley', + 'homepage' => 'http://status.net/wiki/Plugin:Disqus', + 'rawdescription' => + _m('Use Disqus'. + ' to add commenting to notice pages.')); + return true; + } +} diff --git a/plugins/DisqusPlugin.php b/plugins/DisqusPlugin.php deleted file mode 100644 index c07eaaabd..000000000 --- a/plugins/DisqusPlugin.php +++ /dev/null @@ -1,171 +0,0 @@ -. - * - * @category Plugin - * @package StatusNet - * @author Zach Copley - * @copyright 2010 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -/** - * - * This plugin adds Disqus commenting to your notices. Enabling this - * plugin will make each notice page display the Disqus widget, and - * notice lists will display the number of commments each notice has. - * - * To use this plugin, you need to first register your site with Disqus - * and get a Discus 'shortname' for it. - * - * http://disqus.com - * - * To enable the plugin, put the following in you config.php: - * - * addPlugin( - * 'Disqus', array( - * 'shortname' => 'YOURSHORTNAME', - * 'div_style' => 'width:675px; padding-top:10px; position:relative; float:left;' - * ) - * ); - * - * NOTE: the 'div_style' in an optional parameter that passes in some - * inline CSS when creating the Disqus widget. It's a shortcut to make - * the widget look OK with the default StatusNet theme. If you leave - * it out you'll have to edit your theme CSS files to make the widget - * look good. You can also control the way the widget looks by - * adding style rules to your theme. - * - * See: http://help.disqus.com/entries/100878-css-customization - * - * @category Plugin - * @package StatusNet - * @author Zach Copley - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @see Event - */ - -class DisqusPlugin extends Plugin -{ - function onEndShowContentBlock($action) - { - if (get_class($action) == 'ShownoticeAction') { - - $attrs = array(); - $attrs['id'] = 'disqus_thread'; - - if ($this->div_style) { - $attrs['style'] = $this->div_style; - } - - $action->element('div', $attrs, null); - - $script = <<inlineScript(sprintf($script, $action->notice->id, $this->shortname)); - - $attrs = array(); - - $attrs['id'] = 'disqus_thread_footer'; - - if ($this->div_style) { - $attrs['style'] = $this->div_style; - } - - $action->elementStart('div', $attrs); - $action->elementStart('noscript'); - - $action->raw('Please enable JavaScript to view the '); - $noscriptUrl = 'http://disqus.com/?ref_noscript=' . $this->shortname; - $action->element('a', array('href' => $noscriptUrl), 'comments powered by Disqus.'); - $action->elementEnd('noscript'); - - $action->elementStart('a', array('href' => 'http://disqus.com', 'class' => 'dsq-brlink')); - $action->raw('blog comments powered by '); - $action->element('span', array('class' => 'logo-disqus'), 'Disqus'); - $action->elementEnd('a'); - $action->elementEnd('div'); - } - } - - function onEndShowScripts($action) - { - // fugly - $script = <<inlineScript(sprintf($script, $this->shortname, $this->shortname)); - - return true; - } - - function onStartShowNoticeItem($noticeListItem) - { - if (empty($noticeListItem->notice->is_local)) { - return true; - } - - $noticeListItem->showNotice(); - $noticeListItem->showNoticeInfo(); - - $noticeUrl = $noticeListItem->notice->bestUrl(); - $noticeUrl .= '#disqus_thread'; - - $noticeListItem->out->element( - 'a', array('href' => $noticeUrl, 'class' => 'disqus_count'), 'Comments' - ); - - $noticeListItem->showNoticeOptions(); - Event::handle('EndShowNoticeItem', array($noticeListItem)); - - return false; - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'Disqus', - 'version' => STATUSNET_VERSION, - 'author' => 'Zach Copley', - 'homepage' => 'http://status.net/wiki/Plugin:Disqus', - 'rawdescription' => - _m('Use Disqus'. - ' to add commenting to notice pages.')); - return true; - } -} diff --git a/plugins/Echo/EchoPlugin.php b/plugins/Echo/EchoPlugin.php new file mode 100644 index 000000000..7b51866eb --- /dev/null +++ b/plugins/Echo/EchoPlugin.php @@ -0,0 +1,116 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Zach Copley + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * Plugin to use Echo (formerly JS-Kit) + * + * This plugin adds an Echo commenting widget to each notice page on + * your site. To get it to work, first you'll have to sign up for Echo + * (a for-pay service) and register your site's URL. + * + * http://aboutecho.com/ + * + * Once you've done that it's pretty straight forward to turn the + * plugin on; just add this to your config.php: + * + * addPlugin( + * 'Echo', + * array('div_style' => 'width:675px; padding-top:10px; position:relative; float:left;') + * ); + * + * NOTE: the 'div_style' in an optional parameter that passes in some + * inline CSS when creating the Echo widget. It's a shortcut to make + * the widget look OK with the default StatusNet theme. If you leave + * it out you'll have to edit your theme CSS files to make the widget + * look good. You can also control the way the widget looks by + * adding style rules to your theme. + * + * See: http://wiki.js-kit.com/Skinning-Guide#UsingCSSnbsptocustomizefontsandcolors + * + * @category Plugin + * @package StatusNet + * @author Zach Copley + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @see Event + */ + +class EchoPlugin extends Plugin +{ + // NOTE: The Echo documentation says that this script will change on + // a per site basis, but I think that's incorrect. It always seems to + // be the same. + public $script = 'http://cdn.js-kit.com/scripts/comments.js'; + + function onEndShowScripts($action) + { + if (get_class($action) == 'ShownoticeAction') { + $action->script($this->script); + } + + return true; + } + + function onEndShowContentBlock($action) + { + if (get_class($action) == 'ShownoticeAction') { + + $attrs = array(); + $attrs['class'] = 'js-kit-comments'; + $attrs['permalink'] = $action->notice->uri; + $attrs['uniq'] = $action->notice->id; + + // NOTE: there are some other attributes that could be useful + // http://wiki.js-kit.com/Echo-Behavior + + if (!empty($this->div_style)) { + $attrs['style'] = $this->div_style; + } + + $action->element('div', $attrs, null); + } + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'Echo', + 'version' => STATUSNET_VERSION, + 'author' => 'Zach Copley', + 'homepage' => 'http://status.net/wiki/Plugin:Echo', + 'rawdescription' => + _m('Use Echo'. + ' to add commenting to notice pages.')); + return true; + } +} diff --git a/plugins/EchoPlugin.php b/plugins/EchoPlugin.php deleted file mode 100644 index 7b51866eb..000000000 --- a/plugins/EchoPlugin.php +++ /dev/null @@ -1,116 +0,0 @@ -. - * - * @category Plugin - * @package StatusNet - * @author Zach Copley - * @copyright 2010 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -/** - * Plugin to use Echo (formerly JS-Kit) - * - * This plugin adds an Echo commenting widget to each notice page on - * your site. To get it to work, first you'll have to sign up for Echo - * (a for-pay service) and register your site's URL. - * - * http://aboutecho.com/ - * - * Once you've done that it's pretty straight forward to turn the - * plugin on; just add this to your config.php: - * - * addPlugin( - * 'Echo', - * array('div_style' => 'width:675px; padding-top:10px; position:relative; float:left;') - * ); - * - * NOTE: the 'div_style' in an optional parameter that passes in some - * inline CSS when creating the Echo widget. It's a shortcut to make - * the widget look OK with the default StatusNet theme. If you leave - * it out you'll have to edit your theme CSS files to make the widget - * look good. You can also control the way the widget looks by - * adding style rules to your theme. - * - * See: http://wiki.js-kit.com/Skinning-Guide#UsingCSSnbsptocustomizefontsandcolors - * - * @category Plugin - * @package StatusNet - * @author Zach Copley - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @see Event - */ - -class EchoPlugin extends Plugin -{ - // NOTE: The Echo documentation says that this script will change on - // a per site basis, but I think that's incorrect. It always seems to - // be the same. - public $script = 'http://cdn.js-kit.com/scripts/comments.js'; - - function onEndShowScripts($action) - { - if (get_class($action) == 'ShownoticeAction') { - $action->script($this->script); - } - - return true; - } - - function onEndShowContentBlock($action) - { - if (get_class($action) == 'ShownoticeAction') { - - $attrs = array(); - $attrs['class'] = 'js-kit-comments'; - $attrs['permalink'] = $action->notice->uri; - $attrs['uniq'] = $action->notice->id; - - // NOTE: there are some other attributes that could be useful - // http://wiki.js-kit.com/Echo-Behavior - - if (!empty($this->div_style)) { - $attrs['style'] = $this->div_style; - } - - $action->element('div', $attrs, null); - } - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'Echo', - 'version' => STATUSNET_VERSION, - 'author' => 'Zach Copley', - 'homepage' => 'http://status.net/wiki/Plugin:Echo', - 'rawdescription' => - _m('Use Echo'. - ' to add commenting to notice pages.')); - return true; - } -} diff --git a/plugins/GeoURL/GeoURLPlugin.php b/plugins/GeoURL/GeoURLPlugin.php new file mode 100644 index 000000000..01178f39c --- /dev/null +++ b/plugins/GeoURL/GeoURLPlugin.php @@ -0,0 +1,131 @@ +. + * + * @category Action + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * Plugin to add ICBM metadata to HTML pages and report data to GeoURL.org + * + * Adds metadata to notice and profile pages that geourl.org and others + * understand. Also, pings geourl.org when a new notice is saved or + * a profile is changed. + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @seeAlso Location + */ + +class GeoURLPlugin extends Plugin +{ + public $ping = 'http://geourl.org/ping/'; + + /** + * Add extra headers for certain pages that geourl.org understands + * + * @param Action $action page being shown + * + * @return boolean event handler flag + */ + + function onEndShowHeadElements($action) + { + $name = $action->trimmed('action'); + + $location = null; + + if ($name == 'showstream') { + $profile = $action->profile; + if (!empty($profile) && !empty($profile->lat) && !empty($profile->lon)) { + $location = $profile->lat . ', ' . $profile->lon; + } + } else if ($name == 'shownotice') { + $notice = $action->profile; + if (!empty($notice) && !empty($notice->lat) && !empty($notice->lon)) { + $location = $notice->lat . ', ' . $notice->lon; + } + } + + if (!empty($location)) { + $action->element('meta', array('name' => 'ICBM', + 'content' => $location)); + $action->element('meta', array('name' => 'DC.title', + 'content' => $action->title())); + } + + return true; + } + + /** + * Report local notices to GeoURL.org when they're created + * + * @param Notice &$notice queued notice + * + * @return boolean event handler flag + */ + + function onHandleQueuedNotice(&$notice) + { + if ($notice->is_local == 1) { + + $request = HTTPClient::start(); + + $url = common_local_url('shownotice', + array('notice' => $notice->id)); + + try { + $request->post($this->ping, + null, + array('p' => $url)); + } catch (HTTP_Request2_Exception $e) { + common_log(LOG_WARNING, + "GeoURL.org ping failed for '$url' ($this->ping)"); + } + } + + return true; + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'GeoURL', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:GeoURL', + 'rawdescription' => + _m('Ping GeoURL when '. + 'new geolocation-enhanced notices are posted.')); + return true; + } +} diff --git a/plugins/GeoURLPlugin.php b/plugins/GeoURLPlugin.php deleted file mode 100644 index 01178f39c..000000000 --- a/plugins/GeoURLPlugin.php +++ /dev/null @@ -1,131 +0,0 @@ -. - * - * @category Action - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -/** - * Plugin to add ICBM metadata to HTML pages and report data to GeoURL.org - * - * Adds metadata to notice and profile pages that geourl.org and others - * understand. Also, pings geourl.org when a new notice is saved or - * a profile is changed. - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @seeAlso Location - */ - -class GeoURLPlugin extends Plugin -{ - public $ping = 'http://geourl.org/ping/'; - - /** - * Add extra headers for certain pages that geourl.org understands - * - * @param Action $action page being shown - * - * @return boolean event handler flag - */ - - function onEndShowHeadElements($action) - { - $name = $action->trimmed('action'); - - $location = null; - - if ($name == 'showstream') { - $profile = $action->profile; - if (!empty($profile) && !empty($profile->lat) && !empty($profile->lon)) { - $location = $profile->lat . ', ' . $profile->lon; - } - } else if ($name == 'shownotice') { - $notice = $action->profile; - if (!empty($notice) && !empty($notice->lat) && !empty($notice->lon)) { - $location = $notice->lat . ', ' . $notice->lon; - } - } - - if (!empty($location)) { - $action->element('meta', array('name' => 'ICBM', - 'content' => $location)); - $action->element('meta', array('name' => 'DC.title', - 'content' => $action->title())); - } - - return true; - } - - /** - * Report local notices to GeoURL.org when they're created - * - * @param Notice &$notice queued notice - * - * @return boolean event handler flag - */ - - function onHandleQueuedNotice(&$notice) - { - if ($notice->is_local == 1) { - - $request = HTTPClient::start(); - - $url = common_local_url('shownotice', - array('notice' => $notice->id)); - - try { - $request->post($this->ping, - null, - array('p' => $url)); - } catch (HTTP_Request2_Exception $e) { - common_log(LOG_WARNING, - "GeoURL.org ping failed for '$url' ($this->ping)"); - } - } - - return true; - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'GeoURL', - 'version' => STATUSNET_VERSION, - 'author' => 'Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:GeoURL', - 'rawdescription' => - _m('Ping GeoURL when '. - 'new geolocation-enhanced notices are posted.')); - return true; - } -} diff --git a/plugins/Geonames/GeonamesPlugin.php b/plugins/Geonames/GeonamesPlugin.php new file mode 100644 index 000000000..3815a31fa --- /dev/null +++ b/plugins/Geonames/GeonamesPlugin.php @@ -0,0 +1,510 @@ +. + * + * @category Action + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * Plugin to convert string locations to Geonames IDs and vice versa + * + * This handles most of the events that Location class emits. It uses + * the geonames.org Web service to convert names like 'Montreal, Quebec, Canada' + * into IDs and lat/lon pairs. + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @seeAlso Location + */ + +class GeonamesPlugin extends Plugin +{ + const LOCATION_NS = 1; + + public $host = 'ws.geonames.org'; + public $username = null; + public $token = null; + public $expiry = 7776000; // 90-day expiry + public $timeout = 2; // Web service timeout in seconds. + public $timeoutWindow = 60; // Further lookups in this process will be disabled for N seconds after a timeout. + public $cachePrefix = null; // Optional shared memcache prefix override + // to share lookups between local instances. + + protected $lastTimeout = null; // timestamp of last web service timeout + + /** + * convert a name into a Location object + * + * @param string $name Name to convert + * @param string $language ISO code for anguage the name is in + * @param Location &$location Location object (may be null) + * + * @return boolean whether to continue (results in $location) + */ + + function onLocationFromName($name, $language, &$location) + { + $loc = $this->getCache(array('name' => $name, + 'language' => $language)); + + if ($loc !== false) { + $location = $loc; + return false; + } + + try { + $geonames = $this->getGeonames('search', + array('maxRows' => 1, + 'q' => $name, + 'lang' => $language, + 'type' => 'xml')); + } catch (Exception $e) { + $this->log(LOG_WARNING, "Error for $name: " . $e->getMessage()); + return true; + } + + if (count($geonames) == 0) { + // no results + $this->setCache(array('name' => $name, + 'language' => $language), + null); + return true; + } + + $n = $geonames[0]; + + $location = new Location(); + + $location->lat = $this->canonical($n->lat); + $location->lon = $this->canonical($n->lng); + $location->names[$language] = (string)$n->name; + $location->location_id = (string)$n->geonameId; + $location->location_ns = self::LOCATION_NS; + + $this->setCache(array('name' => $name, + 'language' => $language), + $location); + + // handled, don't continue processing! + return false; + } + + /** + * convert an id into a Location object + * + * @param string $id Name to convert + * @param string $ns Name to convert + * @param string $language ISO code for language for results + * @param Location &$location Location object (may be null) + * + * @return boolean whether to continue (results in $location) + */ + + function onLocationFromId($id, $ns, $language, &$location) + { + if ($ns != self::LOCATION_NS) { + // It's not one of our IDs... keep processing + return true; + } + + $loc = $this->getCache(array('id' => $id)); + + if ($loc !== false) { + $location = $loc; + return false; + } + + try { + $geonames = $this->getGeonames('hierarchy', + array('geonameId' => $id, + 'lang' => $language)); + } catch (Exception $e) { + $this->log(LOG_WARNING, "Error for ID $id: " . $e->getMessage()); + return false; + } + + $parts = array(); + + foreach ($geonames as $level) { + if (in_array($level->fcode, array('PCLI', 'ADM1', 'PPL'))) { + $parts[] = (string)$level->name; + } + } + + $last = $geonames[count($geonames)-1]; + + if (!in_array($level->fcode, array('PCLI', 'ADM1', 'PPL'))) { + $parts[] = (string)$last->name; + } + + $location = new Location(); + + $location->location_id = (string)$last->geonameId; + $location->location_ns = self::LOCATION_NS; + $location->lat = $this->canonical($last->lat); + $location->lon = $this->canonical($last->lng); + + $location->names[$language] = implode(', ', array_reverse($parts)); + + $this->setCache(array('id' => (string)$last->geonameId), + $location); + + // We're responsible for this namespace; nobody else + // can resolve it + + return false; + } + + /** + * convert a lat/lon pair into a Location object + * + * Given a lat/lon, we try to find a Location that's around + * it or nearby. We prefer populated places (cities, towns, villages). + * + * @param string $lat Latitude + * @param string $lon Longitude + * @param string $language ISO code for language for results + * @param Location &$location Location object (may be null) + * + * @return boolean whether to continue (results in $location) + */ + + function onLocationFromLatLon($lat, $lon, $language, &$location) + { + // Make sure they're canonical + + $lat = $this->canonical($lat); + $lon = $this->canonical($lon); + + $loc = $this->getCache(array('lat' => $lat, + 'lon' => $lon)); + + if ($loc !== false) { + $location = $loc; + return false; + } + + try { + $geonames = $this->getGeonames('findNearbyPlaceName', + array('lat' => $lat, + 'lng' => $lon, + 'lang' => $language)); + } catch (Exception $e) { + $this->log(LOG_WARNING, "Error for coords $lat, $lon: " . $e->getMessage()); + return true; + } + + if (count($geonames) == 0) { + // no results + $this->setCache(array('lat' => $lat, + 'lon' => $lon), + null); + return true; + } + + $n = $geonames[0]; + + $parts = array(); + + $location = new Location(); + + $parts[] = (string)$n->name; + + if (!empty($n->adminName1)) { + $parts[] = (string)$n->adminName1; + } + + if (!empty($n->countryName)) { + $parts[] = (string)$n->countryName; + } + + $location->location_id = (string)$n->geonameId; + $location->location_ns = self::LOCATION_NS; + $location->lat = $this->canonical($n->lat); + $location->lon = $this->canonical($n->lng); + + $location->names[$language] = implode(', ', $parts); + + $this->setCache(array('lat' => $lat, + 'lon' => $lon), + $location); + + // Success! We handled it, so no further processing + + return false; + } + + /** + * Human-readable name for a location + * + * Given a location, we try to retrieve a human-readable name + * in the target language. + * + * @param Location $location Location to get the name for + * @param string $language ISO code for language to find name in + * @param string &$name Place to put the name + * + * @return boolean whether to continue + */ + + function onLocationNameLanguage($location, $language, &$name) + { + if ($location->location_ns != self::LOCATION_NS) { + // It's not one of our IDs... keep processing + return true; + } + + $id = $location->location_id; + + $n = $this->getCache(array('id' => $id, + 'language' => $language)); + + if ($n !== false) { + $name = $n; + return false; + } + + try { + $geonames = $this->getGeonames('hierarchy', + array('geonameId' => $id, + 'lang' => $language)); + } catch (Exception $e) { + $this->log(LOG_WARNING, "Error for ID $id: " . $e->getMessage()); + return false; + } + + if (count($geonames) == 0) { + $this->setCache(array('id' => $id, + 'language' => $language), + null); + return false; + } + + $parts = array(); + + foreach ($geonames as $level) { + if (in_array($level->fcode, array('PCLI', 'ADM1', 'PPL'))) { + $parts[] = (string)$level->name; + } + } + + $last = $geonames[count($geonames)-1]; + + if (!in_array($level->fcode, array('PCLI', 'ADM1', 'PPL'))) { + $parts[] = (string)$last->name; + } + + if (count($parts)) { + $name = implode(', ', array_reverse($parts)); + $this->setCache(array('id' => $id, + 'language' => $language), + $name); + } + + return false; + } + + /** + * Human-readable URL for a location + * + * Given a location, we try to retrieve a geonames.org URL. + * + * @param Location $location Location to get the url for + * @param string &$url Place to put the url + * + * @return boolean whether to continue + */ + + function onLocationUrl($location, &$url) + { + if ($location->location_ns != self::LOCATION_NS) { + // It's not one of our IDs... keep processing + return true; + } + + $url = 'http://www.geonames.org/' . $location->location_id; + + // it's been filled, so don't process further. + return false; + } + + /** + * Machine-readable name for a location + * + * Given a location, we try to retrieve a geonames.org URL. + * + * @param Location $location Location to get the url for + * @param string &$url Place to put the url + * + * @return boolean whether to continue + */ + + function onLocationRdfUrl($location, &$url) + { + if ($location->location_ns != self::LOCATION_NS) { + // It's not one of our IDs... keep processing + return true; + } + + $url = 'http://sws.geonames.org/' . $location->location_id . '/'; + + // it's been filled, so don't process further. + return false; + } + + function getCache($attrs) + { + $c = common_memcache(); + + if (empty($c)) { + return null; + } + + $key = $this->cacheKey($attrs); + + $value = $c->get($key); + + return $value; + } + + function setCache($attrs, $loc) + { + $c = common_memcache(); + + if (empty($c)) { + return null; + } + + $key = $this->cacheKey($attrs); + + $result = $c->set($key, $loc, 0, time() + $this->expiry); + + return $result; + } + + function cacheKey($attrs) + { + $key = 'geonames:' . + implode(',', array_keys($attrs)) . ':'. + common_keyize(implode(',', array_values($attrs))); + if ($this->cachePrefix) { + return $this->cachePrefix . ':' . $key; + } else { + return common_cache_key($key); + } + } + + function wsUrl($method, $params) + { + if (!empty($this->username)) { + $params['username'] = $this->username; + } + + if (!empty($this->token)) { + $params['token'] = $this->token; + } + + $str = http_build_query($params, null, '&'); + + return 'http://'.$this->host.'/'.$method.'?'.$str; + } + + function getGeonames($method, $params) + { + if ($this->lastTimeout && (time() - $this->lastTimeout < $this->timeoutWindow)) { + throw new Exception("skipping due to recent web service timeout"); + } + + $client = HTTPClient::start(); + $client->setConfig('connect_timeout', $this->timeout); + $client->setConfig('timeout', $this->timeout); + + try { + $result = $client->get($this->wsUrl($method, $params)); + } catch (Exception $e) { + common_log(LOG_ERR, __METHOD__ . ": " . $e->getMessage()); + $this->lastTimeout = time(); + throw $e; + } + + if (!$result->isOk()) { + throw new Exception("HTTP error code " . $result->getStatus()); + } + + $body = $result->getBody(); + + if (empty($body)) { + throw new Exception("Empty HTTP body in response"); + } + + // This will throw an exception if the XML is mal-formed + + $document = new SimpleXMLElement($body); + + // No children, usually no results + + $children = $document->children(); + + if (count($children) == 0) { + return array(); + } + + if (isset($document->status)) { + throw new Exception("Error #".$document->status['value']." ('".$document->status['message']."')"); + } + + // Array of elements, >0 elements + + return $document->geoname; + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'Geonames', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:Geonames', + 'rawdescription' => + _m('Uses Geonames service to get human-readable '. + 'names for locations based on user-provided lat/long pairs.')); + return true; + } + + function canonical($coord) + { + $coord = rtrim($coord, "0"); + $coord = rtrim($coord, "."); + + return $coord; + } +} diff --git a/plugins/GeonamesPlugin.php b/plugins/GeonamesPlugin.php deleted file mode 100644 index 3815a31fa..000000000 --- a/plugins/GeonamesPlugin.php +++ /dev/null @@ -1,510 +0,0 @@ -. - * - * @category Action - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -/** - * Plugin to convert string locations to Geonames IDs and vice versa - * - * This handles most of the events that Location class emits. It uses - * the geonames.org Web service to convert names like 'Montreal, Quebec, Canada' - * into IDs and lat/lon pairs. - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @seeAlso Location - */ - -class GeonamesPlugin extends Plugin -{ - const LOCATION_NS = 1; - - public $host = 'ws.geonames.org'; - public $username = null; - public $token = null; - public $expiry = 7776000; // 90-day expiry - public $timeout = 2; // Web service timeout in seconds. - public $timeoutWindow = 60; // Further lookups in this process will be disabled for N seconds after a timeout. - public $cachePrefix = null; // Optional shared memcache prefix override - // to share lookups between local instances. - - protected $lastTimeout = null; // timestamp of last web service timeout - - /** - * convert a name into a Location object - * - * @param string $name Name to convert - * @param string $language ISO code for anguage the name is in - * @param Location &$location Location object (may be null) - * - * @return boolean whether to continue (results in $location) - */ - - function onLocationFromName($name, $language, &$location) - { - $loc = $this->getCache(array('name' => $name, - 'language' => $language)); - - if ($loc !== false) { - $location = $loc; - return false; - } - - try { - $geonames = $this->getGeonames('search', - array('maxRows' => 1, - 'q' => $name, - 'lang' => $language, - 'type' => 'xml')); - } catch (Exception $e) { - $this->log(LOG_WARNING, "Error for $name: " . $e->getMessage()); - return true; - } - - if (count($geonames) == 0) { - // no results - $this->setCache(array('name' => $name, - 'language' => $language), - null); - return true; - } - - $n = $geonames[0]; - - $location = new Location(); - - $location->lat = $this->canonical($n->lat); - $location->lon = $this->canonical($n->lng); - $location->names[$language] = (string)$n->name; - $location->location_id = (string)$n->geonameId; - $location->location_ns = self::LOCATION_NS; - - $this->setCache(array('name' => $name, - 'language' => $language), - $location); - - // handled, don't continue processing! - return false; - } - - /** - * convert an id into a Location object - * - * @param string $id Name to convert - * @param string $ns Name to convert - * @param string $language ISO code for language for results - * @param Location &$location Location object (may be null) - * - * @return boolean whether to continue (results in $location) - */ - - function onLocationFromId($id, $ns, $language, &$location) - { - if ($ns != self::LOCATION_NS) { - // It's not one of our IDs... keep processing - return true; - } - - $loc = $this->getCache(array('id' => $id)); - - if ($loc !== false) { - $location = $loc; - return false; - } - - try { - $geonames = $this->getGeonames('hierarchy', - array('geonameId' => $id, - 'lang' => $language)); - } catch (Exception $e) { - $this->log(LOG_WARNING, "Error for ID $id: " . $e->getMessage()); - return false; - } - - $parts = array(); - - foreach ($geonames as $level) { - if (in_array($level->fcode, array('PCLI', 'ADM1', 'PPL'))) { - $parts[] = (string)$level->name; - } - } - - $last = $geonames[count($geonames)-1]; - - if (!in_array($level->fcode, array('PCLI', 'ADM1', 'PPL'))) { - $parts[] = (string)$last->name; - } - - $location = new Location(); - - $location->location_id = (string)$last->geonameId; - $location->location_ns = self::LOCATION_NS; - $location->lat = $this->canonical($last->lat); - $location->lon = $this->canonical($last->lng); - - $location->names[$language] = implode(', ', array_reverse($parts)); - - $this->setCache(array('id' => (string)$last->geonameId), - $location); - - // We're responsible for this namespace; nobody else - // can resolve it - - return false; - } - - /** - * convert a lat/lon pair into a Location object - * - * Given a lat/lon, we try to find a Location that's around - * it or nearby. We prefer populated places (cities, towns, villages). - * - * @param string $lat Latitude - * @param string $lon Longitude - * @param string $language ISO code for language for results - * @param Location &$location Location object (may be null) - * - * @return boolean whether to continue (results in $location) - */ - - function onLocationFromLatLon($lat, $lon, $language, &$location) - { - // Make sure they're canonical - - $lat = $this->canonical($lat); - $lon = $this->canonical($lon); - - $loc = $this->getCache(array('lat' => $lat, - 'lon' => $lon)); - - if ($loc !== false) { - $location = $loc; - return false; - } - - try { - $geonames = $this->getGeonames('findNearbyPlaceName', - array('lat' => $lat, - 'lng' => $lon, - 'lang' => $language)); - } catch (Exception $e) { - $this->log(LOG_WARNING, "Error for coords $lat, $lon: " . $e->getMessage()); - return true; - } - - if (count($geonames) == 0) { - // no results - $this->setCache(array('lat' => $lat, - 'lon' => $lon), - null); - return true; - } - - $n = $geonames[0]; - - $parts = array(); - - $location = new Location(); - - $parts[] = (string)$n->name; - - if (!empty($n->adminName1)) { - $parts[] = (string)$n->adminName1; - } - - if (!empty($n->countryName)) { - $parts[] = (string)$n->countryName; - } - - $location->location_id = (string)$n->geonameId; - $location->location_ns = self::LOCATION_NS; - $location->lat = $this->canonical($n->lat); - $location->lon = $this->canonical($n->lng); - - $location->names[$language] = implode(', ', $parts); - - $this->setCache(array('lat' => $lat, - 'lon' => $lon), - $location); - - // Success! We handled it, so no further processing - - return false; - } - - /** - * Human-readable name for a location - * - * Given a location, we try to retrieve a human-readable name - * in the target language. - * - * @param Location $location Location to get the name for - * @param string $language ISO code for language to find name in - * @param string &$name Place to put the name - * - * @return boolean whether to continue - */ - - function onLocationNameLanguage($location, $language, &$name) - { - if ($location->location_ns != self::LOCATION_NS) { - // It's not one of our IDs... keep processing - return true; - } - - $id = $location->location_id; - - $n = $this->getCache(array('id' => $id, - 'language' => $language)); - - if ($n !== false) { - $name = $n; - return false; - } - - try { - $geonames = $this->getGeonames('hierarchy', - array('geonameId' => $id, - 'lang' => $language)); - } catch (Exception $e) { - $this->log(LOG_WARNING, "Error for ID $id: " . $e->getMessage()); - return false; - } - - if (count($geonames) == 0) { - $this->setCache(array('id' => $id, - 'language' => $language), - null); - return false; - } - - $parts = array(); - - foreach ($geonames as $level) { - if (in_array($level->fcode, array('PCLI', 'ADM1', 'PPL'))) { - $parts[] = (string)$level->name; - } - } - - $last = $geonames[count($geonames)-1]; - - if (!in_array($level->fcode, array('PCLI', 'ADM1', 'PPL'))) { - $parts[] = (string)$last->name; - } - - if (count($parts)) { - $name = implode(', ', array_reverse($parts)); - $this->setCache(array('id' => $id, - 'language' => $language), - $name); - } - - return false; - } - - /** - * Human-readable URL for a location - * - * Given a location, we try to retrieve a geonames.org URL. - * - * @param Location $location Location to get the url for - * @param string &$url Place to put the url - * - * @return boolean whether to continue - */ - - function onLocationUrl($location, &$url) - { - if ($location->location_ns != self::LOCATION_NS) { - // It's not one of our IDs... keep processing - return true; - } - - $url = 'http://www.geonames.org/' . $location->location_id; - - // it's been filled, so don't process further. - return false; - } - - /** - * Machine-readable name for a location - * - * Given a location, we try to retrieve a geonames.org URL. - * - * @param Location $location Location to get the url for - * @param string &$url Place to put the url - * - * @return boolean whether to continue - */ - - function onLocationRdfUrl($location, &$url) - { - if ($location->location_ns != self::LOCATION_NS) { - // It's not one of our IDs... keep processing - return true; - } - - $url = 'http://sws.geonames.org/' . $location->location_id . '/'; - - // it's been filled, so don't process further. - return false; - } - - function getCache($attrs) - { - $c = common_memcache(); - - if (empty($c)) { - return null; - } - - $key = $this->cacheKey($attrs); - - $value = $c->get($key); - - return $value; - } - - function setCache($attrs, $loc) - { - $c = common_memcache(); - - if (empty($c)) { - return null; - } - - $key = $this->cacheKey($attrs); - - $result = $c->set($key, $loc, 0, time() + $this->expiry); - - return $result; - } - - function cacheKey($attrs) - { - $key = 'geonames:' . - implode(',', array_keys($attrs)) . ':'. - common_keyize(implode(',', array_values($attrs))); - if ($this->cachePrefix) { - return $this->cachePrefix . ':' . $key; - } else { - return common_cache_key($key); - } - } - - function wsUrl($method, $params) - { - if (!empty($this->username)) { - $params['username'] = $this->username; - } - - if (!empty($this->token)) { - $params['token'] = $this->token; - } - - $str = http_build_query($params, null, '&'); - - return 'http://'.$this->host.'/'.$method.'?'.$str; - } - - function getGeonames($method, $params) - { - if ($this->lastTimeout && (time() - $this->lastTimeout < $this->timeoutWindow)) { - throw new Exception("skipping due to recent web service timeout"); - } - - $client = HTTPClient::start(); - $client->setConfig('connect_timeout', $this->timeout); - $client->setConfig('timeout', $this->timeout); - - try { - $result = $client->get($this->wsUrl($method, $params)); - } catch (Exception $e) { - common_log(LOG_ERR, __METHOD__ . ": " . $e->getMessage()); - $this->lastTimeout = time(); - throw $e; - } - - if (!$result->isOk()) { - throw new Exception("HTTP error code " . $result->getStatus()); - } - - $body = $result->getBody(); - - if (empty($body)) { - throw new Exception("Empty HTTP body in response"); - } - - // This will throw an exception if the XML is mal-formed - - $document = new SimpleXMLElement($body); - - // No children, usually no results - - $children = $document->children(); - - if (count($children) == 0) { - return array(); - } - - if (isset($document->status)) { - throw new Exception("Error #".$document->status['value']." ('".$document->status['message']."')"); - } - - // Array of elements, >0 elements - - return $document->geoname; - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'Geonames', - 'version' => STATUSNET_VERSION, - 'author' => 'Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:Geonames', - 'rawdescription' => - _m('Uses Geonames service to get human-readable '. - 'names for locations based on user-provided lat/long pairs.')); - return true; - } - - function canonical($coord) - { - $coord = rtrim($coord, "0"); - $coord = rtrim($coord, "."); - - return $coord; - } -} diff --git a/plugins/GoogleAnalytics/GoogleAnalyticsPlugin.php b/plugins/GoogleAnalytics/GoogleAnalyticsPlugin.php new file mode 100644 index 000000000..c646bf113 --- /dev/null +++ b/plugins/GoogleAnalytics/GoogleAnalyticsPlugin.php @@ -0,0 +1,85 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @copyright 2008 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * Plugin to use Google Analytics + * + * This plugin will spoot out the correct JavaScript spell to invoke Google Analytics on a page. + * + * Note that Google Analytics is not compatible with the Franklin Street Statement; consider using + * Piwik (http://www.piwik.org/) instead! + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @see Event + */ + +class GoogleAnalyticsPlugin extends Plugin +{ + var $code = null; + + function __construct($code=null) + { + $this->code = $code; + parent::__construct(); + } + + function onEndShowScripts($action) + { + $js1 = 'var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");'. + 'document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));'; + $js2 = sprintf('try{'. + 'var pageTracker = _gat._getTracker("%s");'. + 'pageTracker._trackPageview();'. + '} catch(err) {}', + $this->code); + $action->inlineScript($js1); + $action->inlineScript($js2); + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'GoogleAnalytics', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:GoogleAnalytics', + 'rawdescription' => + _m('Use Google Analytics'. + ' to track Web access.')); + return true; + } +} diff --git a/plugins/GoogleAnalyticsPlugin.php b/plugins/GoogleAnalyticsPlugin.php deleted file mode 100644 index c646bf113..000000000 --- a/plugins/GoogleAnalyticsPlugin.php +++ /dev/null @@ -1,85 +0,0 @@ -. - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @copyright 2008 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -/** - * Plugin to use Google Analytics - * - * This plugin will spoot out the correct JavaScript spell to invoke Google Analytics on a page. - * - * Note that Google Analytics is not compatible with the Franklin Street Statement; consider using - * Piwik (http://www.piwik.org/) instead! - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @see Event - */ - -class GoogleAnalyticsPlugin extends Plugin -{ - var $code = null; - - function __construct($code=null) - { - $this->code = $code; - parent::__construct(); - } - - function onEndShowScripts($action) - { - $js1 = 'var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");'. - 'document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));'; - $js2 = sprintf('try{'. - 'var pageTracker = _gat._getTracker("%s");'. - 'pageTracker._trackPageview();'. - '} catch(err) {}', - $this->code); - $action->inlineScript($js1); - $action->inlineScript($js2); - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'GoogleAnalytics', - 'version' => STATUSNET_VERSION, - 'author' => 'Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:GoogleAnalytics', - 'rawdescription' => - _m('Use Google Analytics'. - ' to track Web access.')); - return true; - } -} diff --git a/plugins/Linkback/LinkbackPlugin.php b/plugins/Linkback/LinkbackPlugin.php new file mode 100644 index 000000000..8e44beae1 --- /dev/null +++ b/plugins/Linkback/LinkbackPlugin.php @@ -0,0 +1,249 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +require_once('Auth/Yadis/Yadis.php'); + +define('LINKBACKPLUGIN_VERSION', '0.1'); + +/** + * Plugin to do linkbacks for notices containing URLs + * + * After new notices are saved, we check their text for URLs. If there + * are URLs, we test each URL to see if it supports any + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @see Event + */ + +class LinkbackPlugin extends Plugin +{ + var $notice = null; + + function __construct() + { + parent::__construct(); + } + + function onHandleQueuedNotice($notice) + { + if ($notice->is_local == 1) { + // Try to avoid actually mucking with the + // notice content + $c = $notice->content; + $this->notice = $notice; + // Ignoring results + common_replace_urls_callback($c, + array($this, 'linkbackUrl')); + } + return true; + } + + function linkbackUrl($url) + { + common_log(LOG_DEBUG,"Attempting linkback for " . $url); + + $orig = $url; + $url = htmlspecialchars_decode($orig); + $scheme = parse_url($url, PHP_URL_SCHEME); + if (!in_array($scheme, array('http', 'https'))) { + return $orig; + } + + // XXX: Do a HEAD first to save some time/bandwidth + + $fetcher = Auth_Yadis_Yadis::getHTTPFetcher(); + + $result = $fetcher->get($url, + array('User-Agent: ' . $this->userAgent(), + 'Accept: application/html+xml,text/html')); + + if (!in_array($result->status, array('200', '206'))) { + return $orig; + } + + $pb = null; + $tb = null; + + if (array_key_exists('X-Pingback', $result->headers)) { + $pb = $result->headers['X-Pingback']; + } else if (preg_match('//', + $result->body, + $match)) { + $pb = $match[1]; + } + + if (!empty($pb)) { + $this->pingback($result->final_url, $pb); + } else { + $tb = $this->getTrackback($result->body, $result->final_url); + if (!empty($tb)) { + $this->trackback($result->final_url, $tb); + } + } + + return $orig; + } + + function pingback($url, $endpoint) + { + $args = array($this->notice->uri, $url); + + if (!extension_loaded('xmlrpc')) { + if (!dl('xmlrpc.so')) { + common_log(LOG_ERR, "Can't pingback; xmlrpc extension not available."); + return; + } + } + + $request = HTTPClient::start(); + try { + $response = $request->post($endpoint, + array('Content-Type: text/xml'), + xmlrpc_encode_request('pingback.ping', $args)); + $response = xmlrpc_decode($response->getBody()); + if (xmlrpc_is_fault($response)) { + common_log(LOG_WARNING, + "Pingback error for '$url' ($endpoint): ". + "$response[faultString] ($response[faultCode])"); + } else { + common_log(LOG_INFO, + "Pingback success for '$url' ($endpoint): ". + "'$response'"); + } + } catch (HTTP_Request2_Exception $e) { + common_log(LOG_WARNING, + "Pingback request failed for '$url' ($endpoint)"); + } + } + + // Largely cadged from trackback_cls.php by + // Ran Aroussi , GPL2 or any later version + // http://phptrackback.sourceforge.net/ + + function getTrackback($text, $url) + { + if (preg_match_all('/()/sm', $text, $match, PREG_SET_ORDER)) { + for ($i = 0; $i < count($match); $i++) { + if (preg_match('|dc:identifier="' . preg_quote($url) . '"|ms', $match[$i][1])) { + $rdf_array[] = trim($match[$i][1]); + } + } + + // Loop through the RDFs array and extract trackback URIs + + $tb_array = array(); // <- holds list of trackback URIs + + if (!empty($rdf_array)) { + + for ($i = 0; $i < count($rdf_array); $i++) { + if (preg_match('/trackback:ping="([^"]+)"/', $rdf_array[$i], $array)) { + $tb_array[] = trim($array[1]); + break; + } + } + } + + // Return Trackbacks + + if (empty($tb_array)) { + return null; + } else { + return $tb_array[0]; + } + } + + if (preg_match_all('/(]*?rel=[\'"]trackback[\'"][^>]*?>)/', $text, $match)) { + foreach ($match[1] as $atag) { + if (preg_match('/href=[\'"]([^\'"]*?)[\'"]/', $atag, $url)) { + return $url[1]; + } + } + } + + return null; + + } + + function trackback($url, $endpoint) + { + $profile = $this->notice->getProfile(); + + $args = array('title' => sprintf(_('%1$s\'s status on %2$s'), + $profile->nickname, + common_exact_date($this->notice->created)), + 'excerpt' => $this->notice->content, + 'url' => $this->notice->uri, + 'blog_name' => $profile->nickname); + + $fetcher = Auth_Yadis_Yadis::getHTTPFetcher(); + + $result = $fetcher->post($endpoint, + http_build_query($args), + array('User-Agent: ' . $this->userAgent())); + + if ($result->status != '200') { + common_log(LOG_WARNING, + "Trackback error for '$url' ($endpoint): ". + "$result->body"); + } else { + common_log(LOG_INFO, + "Trackback success for '$url' ($endpoint): ". + "'$result->body'"); + } + } + + function userAgent() + { + return 'LinkbackPlugin/'.LINKBACKPLUGIN_VERSION . + ' StatusNet/' . STATUSNET_VERSION; + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'Linkback', + 'version' => LINKBACKPLUGIN_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:Linkback', + 'rawdescription' => + _m('Notify blog authors when their posts have been linked in '. + 'microblog notices using '. + 'Pingback '. + 'or Trackback protocols.')); + return true; + } +} diff --git a/plugins/LinkbackPlugin.php b/plugins/LinkbackPlugin.php deleted file mode 100644 index 8e44beae1..000000000 --- a/plugins/LinkbackPlugin.php +++ /dev/null @@ -1,249 +0,0 @@ -. - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -require_once('Auth/Yadis/Yadis.php'); - -define('LINKBACKPLUGIN_VERSION', '0.1'); - -/** - * Plugin to do linkbacks for notices containing URLs - * - * After new notices are saved, we check their text for URLs. If there - * are URLs, we test each URL to see if it supports any - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @see Event - */ - -class LinkbackPlugin extends Plugin -{ - var $notice = null; - - function __construct() - { - parent::__construct(); - } - - function onHandleQueuedNotice($notice) - { - if ($notice->is_local == 1) { - // Try to avoid actually mucking with the - // notice content - $c = $notice->content; - $this->notice = $notice; - // Ignoring results - common_replace_urls_callback($c, - array($this, 'linkbackUrl')); - } - return true; - } - - function linkbackUrl($url) - { - common_log(LOG_DEBUG,"Attempting linkback for " . $url); - - $orig = $url; - $url = htmlspecialchars_decode($orig); - $scheme = parse_url($url, PHP_URL_SCHEME); - if (!in_array($scheme, array('http', 'https'))) { - return $orig; - } - - // XXX: Do a HEAD first to save some time/bandwidth - - $fetcher = Auth_Yadis_Yadis::getHTTPFetcher(); - - $result = $fetcher->get($url, - array('User-Agent: ' . $this->userAgent(), - 'Accept: application/html+xml,text/html')); - - if (!in_array($result->status, array('200', '206'))) { - return $orig; - } - - $pb = null; - $tb = null; - - if (array_key_exists('X-Pingback', $result->headers)) { - $pb = $result->headers['X-Pingback']; - } else if (preg_match('//', - $result->body, - $match)) { - $pb = $match[1]; - } - - if (!empty($pb)) { - $this->pingback($result->final_url, $pb); - } else { - $tb = $this->getTrackback($result->body, $result->final_url); - if (!empty($tb)) { - $this->trackback($result->final_url, $tb); - } - } - - return $orig; - } - - function pingback($url, $endpoint) - { - $args = array($this->notice->uri, $url); - - if (!extension_loaded('xmlrpc')) { - if (!dl('xmlrpc.so')) { - common_log(LOG_ERR, "Can't pingback; xmlrpc extension not available."); - return; - } - } - - $request = HTTPClient::start(); - try { - $response = $request->post($endpoint, - array('Content-Type: text/xml'), - xmlrpc_encode_request('pingback.ping', $args)); - $response = xmlrpc_decode($response->getBody()); - if (xmlrpc_is_fault($response)) { - common_log(LOG_WARNING, - "Pingback error for '$url' ($endpoint): ". - "$response[faultString] ($response[faultCode])"); - } else { - common_log(LOG_INFO, - "Pingback success for '$url' ($endpoint): ". - "'$response'"); - } - } catch (HTTP_Request2_Exception $e) { - common_log(LOG_WARNING, - "Pingback request failed for '$url' ($endpoint)"); - } - } - - // Largely cadged from trackback_cls.php by - // Ran Aroussi , GPL2 or any later version - // http://phptrackback.sourceforge.net/ - - function getTrackback($text, $url) - { - if (preg_match_all('/()/sm', $text, $match, PREG_SET_ORDER)) { - for ($i = 0; $i < count($match); $i++) { - if (preg_match('|dc:identifier="' . preg_quote($url) . '"|ms', $match[$i][1])) { - $rdf_array[] = trim($match[$i][1]); - } - } - - // Loop through the RDFs array and extract trackback URIs - - $tb_array = array(); // <- holds list of trackback URIs - - if (!empty($rdf_array)) { - - for ($i = 0; $i < count($rdf_array); $i++) { - if (preg_match('/trackback:ping="([^"]+)"/', $rdf_array[$i], $array)) { - $tb_array[] = trim($array[1]); - break; - } - } - } - - // Return Trackbacks - - if (empty($tb_array)) { - return null; - } else { - return $tb_array[0]; - } - } - - if (preg_match_all('/(]*?rel=[\'"]trackback[\'"][^>]*?>)/', $text, $match)) { - foreach ($match[1] as $atag) { - if (preg_match('/href=[\'"]([^\'"]*?)[\'"]/', $atag, $url)) { - return $url[1]; - } - } - } - - return null; - - } - - function trackback($url, $endpoint) - { - $profile = $this->notice->getProfile(); - - $args = array('title' => sprintf(_('%1$s\'s status on %2$s'), - $profile->nickname, - common_exact_date($this->notice->created)), - 'excerpt' => $this->notice->content, - 'url' => $this->notice->uri, - 'blog_name' => $profile->nickname); - - $fetcher = Auth_Yadis_Yadis::getHTTPFetcher(); - - $result = $fetcher->post($endpoint, - http_build_query($args), - array('User-Agent: ' . $this->userAgent())); - - if ($result->status != '200') { - common_log(LOG_WARNING, - "Trackback error for '$url' ($endpoint): ". - "$result->body"); - } else { - common_log(LOG_INFO, - "Trackback success for '$url' ($endpoint): ". - "'$result->body'"); - } - } - - function userAgent() - { - return 'LinkbackPlugin/'.LINKBACKPLUGIN_VERSION . - ' StatusNet/' . STATUSNET_VERSION; - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'Linkback', - 'version' => LINKBACKPLUGIN_VERSION, - 'author' => 'Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:Linkback', - 'rawdescription' => - _m('Notify blog authors when their posts have been linked in '. - 'microblog notices using '. - 'Pingback '. - 'or Trackback protocols.')); - return true; - } -} diff --git a/plugins/Memcache/MemcachePlugin.php b/plugins/Memcache/MemcachePlugin.php new file mode 100644 index 000000000..c3ca5c135 --- /dev/null +++ b/plugins/Memcache/MemcachePlugin.php @@ -0,0 +1,256 @@ +. + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * A plugin to use memcache for the cache interface + * + * This used to be encoded as config-variable options in the core code; + * it's now broken out to a separate plugin. The same interface can be + * implemented by other plugins. + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class MemcachePlugin extends Plugin +{ + static $cacheInitialized = false; + + private $_conn = null; + public $servers = array('127.0.0.1;11211'); + + public $compressThreshold = 20480; + public $compressMinSaving = 0.2; + + public $persistent = null; + + public $defaultExpiry = 86400; // 24h + + /** + * Initialize the plugin + * + * Note that onStartCacheGet() may have been called before this! + * + * @return boolean flag value + */ + + function onInitializePlugin() + { + if (self::$cacheInitialized) { + $this->persistent = true; + } else { + // If we're a parent command-line process we need + // to be able to close out the connection after + // forking, so disable persistence. + // + // We'll turn it back on again the second time + // through which will either be in a child process, + // or a single-process script which is switching + // configurations. + $this->persistent = (php_sapi_name() == 'cli') ? false : true; + } + $this->_ensureConn(); + self::$cacheInitialized = true; + return true; + } + + /** + * Get a value associated with a key + * + * The value should have been set previously. + * + * @param string &$key in; Lookup key + * @param mixed &$value out; value associated with key + * + * @return boolean hook success + */ + + function onStartCacheGet(&$key, &$value) + { + $this->_ensureConn(); + $value = $this->_conn->get($key); + Event::handle('EndCacheGet', array($key, &$value)); + return false; + } + + /** + * Associate a value with a key + * + * @param string &$key in; Key to use for lookups + * @param mixed &$value in; Value to associate + * @param integer &$flag in; Flag empty or Cache::COMPRESSED + * @param integer &$expiry in; Expiry (passed through to Memcache) + * @param boolean &$success out; Whether the set was successful + * + * @return boolean hook success + */ + + function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) + { + $this->_ensureConn(); + if ($expiry === null) { + $expiry = $this->defaultExpiry; + } + $success = $this->_conn->set($key, $value, $this->flag(intval($flag)), $expiry); + Event::handle('EndCacheSet', array($key, $value, $flag, + $expiry)); + return false; + } + + /** + * Atomically increment an existing numeric key value. + * Existing expiration time will not be changed. + * + * @param string &$key in; Key to use for lookups + * @param int &$step in; Amount to increment (default 1) + * @param mixed &$value out; Incremented value, or false if key not set. + * + * @return boolean hook success + */ + function onStartCacheIncrement(&$key, &$step, &$value) + { + $this->_ensureConn(); + $value = $this->_conn->increment($key, $step); + Event::handle('EndCacheIncrement', array($key, $step, $value)); + return false; + } + + /** + * Delete a value associated with a key + * + * @param string &$key in; Key to lookup + * @param boolean &$success out; whether it worked + * + * @return boolean hook success + */ + + function onStartCacheDelete(&$key, &$success) + { + $this->_ensureConn(); + $success = $this->_conn->delete($key); + Event::handle('EndCacheDelete', array($key)); + return false; + } + + function onStartCacheReconnect(&$success) + { + if (empty($this->_conn)) { + // nothing to do + return true; + } + if ($this->persistent) { + common_log(LOG_ERR, "Cannot close persistent memcached connection"); + $success = false; + } else { + common_log(LOG_INFO, "Closing memcached connection"); + $success = $this->_conn->close(); + $this->_conn = null; + } + return false; + } + + /** + * Ensure that a connection exists + * + * Checks the instance $_conn variable and connects + * if it is empty. + * + * @return void + */ + + private function _ensureConn() + { + if (empty($this->_conn)) { + $this->_conn = new Memcache(); + + if (is_array($this->servers)) { + $servers = $this->servers; + } else { + $servers = array($this->servers); + } + foreach ($servers as $server) { + if (strpos($server, ';') !== false) { + list($host, $port) = explode(';', $server); + } else { + $host = $server; + $port = 11211; + } + + $this->_conn->addServer($host, $port, $this->persistent); + } + + // Compress items stored in the cache if they're over threshold in size + // (default 2KiB) and the compression would save more than min savings + // ratio (default 0.2). + + // Allows the cache to store objects larger than 1MB (if they + // compress to less than 1MB), and improves cache memory efficiency. + + $this->_conn->setCompressThreshold($this->compressThreshold, + $this->compressMinSaving); + } + } + + /** + * Translate general flags to Memcached-specific flags + * @param int $flag + * @return int + */ + protected function flag($flag) + { + $out = 0; + if ($flag & Cache::COMPRESSED == Cache::COMPRESSED) { + $out |= MEMCACHE_COMPRESSED; + } + return $out; + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'Memcache', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou, Craig Andrews', + 'homepage' => 'http://status.net/wiki/Plugin:Memcache', + 'rawdescription' => + _m('Use Memcached to cache query results.')); + return true; + } +} + diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php deleted file mode 100644 index c3ca5c135..000000000 --- a/plugins/MemcachePlugin.php +++ /dev/null @@ -1,256 +0,0 @@ -. - * - * @category Cache - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - // This check helps protect against security problems; - // your code file can't be executed directly from the web. - exit(1); -} - -/** - * A plugin to use memcache for the cache interface - * - * This used to be encoded as config-variable options in the core code; - * it's now broken out to a separate plugin. The same interface can be - * implemented by other plugins. - * - * @category Cache - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -class MemcachePlugin extends Plugin -{ - static $cacheInitialized = false; - - private $_conn = null; - public $servers = array('127.0.0.1;11211'); - - public $compressThreshold = 20480; - public $compressMinSaving = 0.2; - - public $persistent = null; - - public $defaultExpiry = 86400; // 24h - - /** - * Initialize the plugin - * - * Note that onStartCacheGet() may have been called before this! - * - * @return boolean flag value - */ - - function onInitializePlugin() - { - if (self::$cacheInitialized) { - $this->persistent = true; - } else { - // If we're a parent command-line process we need - // to be able to close out the connection after - // forking, so disable persistence. - // - // We'll turn it back on again the second time - // through which will either be in a child process, - // or a single-process script which is switching - // configurations. - $this->persistent = (php_sapi_name() == 'cli') ? false : true; - } - $this->_ensureConn(); - self::$cacheInitialized = true; - return true; - } - - /** - * Get a value associated with a key - * - * The value should have been set previously. - * - * @param string &$key in; Lookup key - * @param mixed &$value out; value associated with key - * - * @return boolean hook success - */ - - function onStartCacheGet(&$key, &$value) - { - $this->_ensureConn(); - $value = $this->_conn->get($key); - Event::handle('EndCacheGet', array($key, &$value)); - return false; - } - - /** - * Associate a value with a key - * - * @param string &$key in; Key to use for lookups - * @param mixed &$value in; Value to associate - * @param integer &$flag in; Flag empty or Cache::COMPRESSED - * @param integer &$expiry in; Expiry (passed through to Memcache) - * @param boolean &$success out; Whether the set was successful - * - * @return boolean hook success - */ - - function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) - { - $this->_ensureConn(); - if ($expiry === null) { - $expiry = $this->defaultExpiry; - } - $success = $this->_conn->set($key, $value, $this->flag(intval($flag)), $expiry); - Event::handle('EndCacheSet', array($key, $value, $flag, - $expiry)); - return false; - } - - /** - * Atomically increment an existing numeric key value. - * Existing expiration time will not be changed. - * - * @param string &$key in; Key to use for lookups - * @param int &$step in; Amount to increment (default 1) - * @param mixed &$value out; Incremented value, or false if key not set. - * - * @return boolean hook success - */ - function onStartCacheIncrement(&$key, &$step, &$value) - { - $this->_ensureConn(); - $value = $this->_conn->increment($key, $step); - Event::handle('EndCacheIncrement', array($key, $step, $value)); - return false; - } - - /** - * Delete a value associated with a key - * - * @param string &$key in; Key to lookup - * @param boolean &$success out; whether it worked - * - * @return boolean hook success - */ - - function onStartCacheDelete(&$key, &$success) - { - $this->_ensureConn(); - $success = $this->_conn->delete($key); - Event::handle('EndCacheDelete', array($key)); - return false; - } - - function onStartCacheReconnect(&$success) - { - if (empty($this->_conn)) { - // nothing to do - return true; - } - if ($this->persistent) { - common_log(LOG_ERR, "Cannot close persistent memcached connection"); - $success = false; - } else { - common_log(LOG_INFO, "Closing memcached connection"); - $success = $this->_conn->close(); - $this->_conn = null; - } - return false; - } - - /** - * Ensure that a connection exists - * - * Checks the instance $_conn variable and connects - * if it is empty. - * - * @return void - */ - - private function _ensureConn() - { - if (empty($this->_conn)) { - $this->_conn = new Memcache(); - - if (is_array($this->servers)) { - $servers = $this->servers; - } else { - $servers = array($this->servers); - } - foreach ($servers as $server) { - if (strpos($server, ';') !== false) { - list($host, $port) = explode(';', $server); - } else { - $host = $server; - $port = 11211; - } - - $this->_conn->addServer($host, $port, $this->persistent); - } - - // Compress items stored in the cache if they're over threshold in size - // (default 2KiB) and the compression would save more than min savings - // ratio (default 0.2). - - // Allows the cache to store objects larger than 1MB (if they - // compress to less than 1MB), and improves cache memory efficiency. - - $this->_conn->setCompressThreshold($this->compressThreshold, - $this->compressMinSaving); - } - } - - /** - * Translate general flags to Memcached-specific flags - * @param int $flag - * @return int - */ - protected function flag($flag) - { - $out = 0; - if ($flag & Cache::COMPRESSED == Cache::COMPRESSED) { - $out |= MEMCACHE_COMPRESSED; - } - return $out; - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'Memcache', - 'version' => STATUSNET_VERSION, - 'author' => 'Evan Prodromou, Craig Andrews', - 'homepage' => 'http://status.net/wiki/Plugin:Memcache', - 'rawdescription' => - _m('Use Memcached to cache query results.')); - return true; - } -} - diff --git a/plugins/Memcached/MemcachedPlugin.php b/plugins/Memcached/MemcachedPlugin.php new file mode 100644 index 000000000..77b989b95 --- /dev/null +++ b/plugins/Memcached/MemcachedPlugin.php @@ -0,0 +1,227 @@ +. + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @author Craig Andrews + * @copyright 2009 StatusNet, Inc. + * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * A plugin to use memcached for the cache interface + * + * This used to be encoded as config-variable options in the core code; + * it's now broken out to a separate plugin. The same interface can be + * implemented by other plugins. + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @author Craig Andrews + * @copyright 2009 StatusNet, Inc. + * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class MemcachedPlugin extends Plugin +{ + static $cacheInitialized = false; + + private $_conn = null; + public $servers = array('127.0.0.1;11211'); + + public $defaultExpiry = 86400; // 24h + + /** + * Initialize the plugin + * + * Note that onStartCacheGet() may have been called before this! + * + * @return boolean flag value + */ + + function onInitializePlugin() + { + $this->_ensureConn(); + self::$cacheInitialized = true; + return true; + } + + /** + * Get a value associated with a key + * + * The value should have been set previously. + * + * @param string &$key in; Lookup key + * @param mixed &$value out; value associated with key + * + * @return boolean hook success + */ + + function onStartCacheGet(&$key, &$value) + { + $this->_ensureConn(); + $value = $this->_conn->get($key); + Event::handle('EndCacheGet', array($key, &$value)); + return false; + } + + /** + * Associate a value with a key + * + * @param string &$key in; Key to use for lookups + * @param mixed &$value in; Value to associate + * @param integer &$flag in; Flag empty or Cache::COMPRESSED + * @param integer &$expiry in; Expiry (passed through to Memcache) + * @param boolean &$success out; Whether the set was successful + * + * @return boolean hook success + */ + + function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) + { + $this->_ensureConn(); + if ($expiry === null) { + $expiry = $this->defaultExpiry; + } + $success = $this->_conn->set($key, $value, $expiry); + Event::handle('EndCacheSet', array($key, $value, $flag, + $expiry)); + return false; + } + + /** + * Atomically increment an existing numeric key value. + * Existing expiration time will not be changed. + * + * @param string &$key in; Key to use for lookups + * @param int &$step in; Amount to increment (default 1) + * @param mixed &$value out; Incremented value, or false if key not set. + * + * @return boolean hook success + */ + function onStartCacheIncrement(&$key, &$step, &$value) + { + $this->_ensureConn(); + $value = $this->_conn->increment($key, $step); + Event::handle('EndCacheIncrement', array($key, $step, $value)); + return false; + } + + /** + * Delete a value associated with a key + * + * @param string &$key in; Key to lookup + * @param boolean &$success out; whether it worked + * + * @return boolean hook success + */ + + function onStartCacheDelete(&$key, &$success) + { + $this->_ensureConn(); + $success = $this->_conn->delete($key); + Event::handle('EndCacheDelete', array($key)); + return false; + } + + function onStartCacheReconnect(&$success) + { + // nothing to do + return true; + } + + /** + * Ensure that a connection exists + * + * Checks the instance $_conn variable and connects + * if it is empty. + * + * @return void + */ + + private function _ensureConn() + { + if (empty($this->_conn)) { + $this->_conn = new Memcached(common_config('site', 'nickname')); + + if (!count($this->_conn->getServerList())) { + if (is_array($this->servers)) { + $servers = $this->servers; + } else { + $servers = array($this->servers); + } + foreach ($servers as $server) { + if (strpos($server, ';') !== false) { + list($host, $port) = explode(';', $server); + } else { + $host = $server; + $port = 11211; + } + + $this->_conn->addServer($host, $port); + } + + // Compress items stored in the cache. + + // Allows the cache to store objects larger than 1MB (if they + // compress to less than 1MB), and improves cache memory efficiency. + + $this->_conn->setOption(Memcached::OPT_COMPRESSION, true); + } + } + } + + /** + * Translate general flags to Memcached-specific flags + * @param int $flag + * @return int + */ + protected function flag($flag) + { + //no flags are presently supported + return $flag; + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'Memcached', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou, Craig Andrews', + 'homepage' => 'http://status.net/wiki/Plugin:Memcached', + 'rawdescription' => + _m('Use Memcached to cache query results.')); + return true; + } +} + diff --git a/plugins/MemcachedPlugin.php b/plugins/MemcachedPlugin.php deleted file mode 100644 index 77b989b95..000000000 --- a/plugins/MemcachedPlugin.php +++ /dev/null @@ -1,227 +0,0 @@ -. - * - * @category Cache - * @package StatusNet - * @author Evan Prodromou - * @author Craig Andrews - * @copyright 2009 StatusNet, Inc. - * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - // This check helps protect against security problems; - // your code file can't be executed directly from the web. - exit(1); -} - -/** - * A plugin to use memcached for the cache interface - * - * This used to be encoded as config-variable options in the core code; - * it's now broken out to a separate plugin. The same interface can be - * implemented by other plugins. - * - * @category Cache - * @package StatusNet - * @author Evan Prodromou - * @author Craig Andrews - * @copyright 2009 StatusNet, Inc. - * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -class MemcachedPlugin extends Plugin -{ - static $cacheInitialized = false; - - private $_conn = null; - public $servers = array('127.0.0.1;11211'); - - public $defaultExpiry = 86400; // 24h - - /** - * Initialize the plugin - * - * Note that onStartCacheGet() may have been called before this! - * - * @return boolean flag value - */ - - function onInitializePlugin() - { - $this->_ensureConn(); - self::$cacheInitialized = true; - return true; - } - - /** - * Get a value associated with a key - * - * The value should have been set previously. - * - * @param string &$key in; Lookup key - * @param mixed &$value out; value associated with key - * - * @return boolean hook success - */ - - function onStartCacheGet(&$key, &$value) - { - $this->_ensureConn(); - $value = $this->_conn->get($key); - Event::handle('EndCacheGet', array($key, &$value)); - return false; - } - - /** - * Associate a value with a key - * - * @param string &$key in; Key to use for lookups - * @param mixed &$value in; Value to associate - * @param integer &$flag in; Flag empty or Cache::COMPRESSED - * @param integer &$expiry in; Expiry (passed through to Memcache) - * @param boolean &$success out; Whether the set was successful - * - * @return boolean hook success - */ - - function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) - { - $this->_ensureConn(); - if ($expiry === null) { - $expiry = $this->defaultExpiry; - } - $success = $this->_conn->set($key, $value, $expiry); - Event::handle('EndCacheSet', array($key, $value, $flag, - $expiry)); - return false; - } - - /** - * Atomically increment an existing numeric key value. - * Existing expiration time will not be changed. - * - * @param string &$key in; Key to use for lookups - * @param int &$step in; Amount to increment (default 1) - * @param mixed &$value out; Incremented value, or false if key not set. - * - * @return boolean hook success - */ - function onStartCacheIncrement(&$key, &$step, &$value) - { - $this->_ensureConn(); - $value = $this->_conn->increment($key, $step); - Event::handle('EndCacheIncrement', array($key, $step, $value)); - return false; - } - - /** - * Delete a value associated with a key - * - * @param string &$key in; Key to lookup - * @param boolean &$success out; whether it worked - * - * @return boolean hook success - */ - - function onStartCacheDelete(&$key, &$success) - { - $this->_ensureConn(); - $success = $this->_conn->delete($key); - Event::handle('EndCacheDelete', array($key)); - return false; - } - - function onStartCacheReconnect(&$success) - { - // nothing to do - return true; - } - - /** - * Ensure that a connection exists - * - * Checks the instance $_conn variable and connects - * if it is empty. - * - * @return void - */ - - private function _ensureConn() - { - if (empty($this->_conn)) { - $this->_conn = new Memcached(common_config('site', 'nickname')); - - if (!count($this->_conn->getServerList())) { - if (is_array($this->servers)) { - $servers = $this->servers; - } else { - $servers = array($this->servers); - } - foreach ($servers as $server) { - if (strpos($server, ';') !== false) { - list($host, $port) = explode(';', $server); - } else { - $host = $server; - $port = 11211; - } - - $this->_conn->addServer($host, $port); - } - - // Compress items stored in the cache. - - // Allows the cache to store objects larger than 1MB (if they - // compress to less than 1MB), and improves cache memory efficiency. - - $this->_conn->setOption(Memcached::OPT_COMPRESSION, true); - } - } - } - - /** - * Translate general flags to Memcached-specific flags - * @param int $flag - * @return int - */ - protected function flag($flag) - { - //no flags are presently supported - return $flag; - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'Memcached', - 'version' => STATUSNET_VERSION, - 'author' => 'Evan Prodromou, Craig Andrews', - 'homepage' => 'http://status.net/wiki/Plugin:Memcached', - 'rawdescription' => - _m('Use Memcached to cache query results.')); - return true; - } -} - diff --git a/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php new file mode 100644 index 000000000..b353d7255 --- /dev/null +++ b/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php @@ -0,0 +1,112 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @author Tobias Diekershoff + * @copyright 2008 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * Plugin to use Piwik Analytics (based on the Google Analytics plugin by Evan) + * + * This plugin will spoot out the correct JavaScript spell to invoke + * Piwik Analytics on a page. + * + * To use this plugin add the following to your config.php + * + * addPlugin('PiwikAnalytics', array('piwikroot' => 'example.com/piwik/', + * 'piwikId' => 'id')); + * + * Replace 'example.com/piwik/' with the URL to your Piwik installation and + * make sure you don't forget the final /. + * Replace 'id' with the ID your statusnet installation has in your Piwik + * analytics setup - for example '8'. + * + */ + +class PiwikAnalyticsPlugin extends Plugin +{ + /** the base of your Piwik installation */ + public $piwikroot = null; + /** the Piwik Id of your statusnet installation */ + public $piwikId = null; + + /** + * constructor + * + * @param string $root Piwik root URL + * @param string $id Piwik ID of this app + */ + + function __construct($root=null, $id=null) + { + $this->piwikroot = $root; + $this->piwikId = $id; + parent::__construct(); + } + + /** + * Called when all scripts have been shown + * + * @param Action $action Current action + * + * @return boolean ignored + */ + + function onEndShowScripts($action) + { + $piwikCode1 = <<piwikroot}" : "http://{$this->piwikroot}"); +document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); +ENDOFPIWIK; + $piwikCode2 = <<piwikId}); + piwikTracker.trackPageView(); + piwikTracker.enableLinkTracking(); +} catch( err ) {} +ENDOFPIWIK; + + $action->inlineScript($piwikCode1); + $action->inlineScript($piwikCode2); + return true; + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'PiwikAnalytics', + 'version' => STATUSNET_VERSION, + 'author' => 'Tobias Diekershoff, Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:Piwik', + 'rawdescription' => + _m('Use Piwik Open Source Web analytics software.')); + return true; + } + +} diff --git a/plugins/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalyticsPlugin.php deleted file mode 100644 index b353d7255..000000000 --- a/plugins/PiwikAnalyticsPlugin.php +++ /dev/null @@ -1,112 +0,0 @@ -. - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @author Tobias Diekershoff - * @copyright 2008 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -/** - * Plugin to use Piwik Analytics (based on the Google Analytics plugin by Evan) - * - * This plugin will spoot out the correct JavaScript spell to invoke - * Piwik Analytics on a page. - * - * To use this plugin add the following to your config.php - * - * addPlugin('PiwikAnalytics', array('piwikroot' => 'example.com/piwik/', - * 'piwikId' => 'id')); - * - * Replace 'example.com/piwik/' with the URL to your Piwik installation and - * make sure you don't forget the final /. - * Replace 'id' with the ID your statusnet installation has in your Piwik - * analytics setup - for example '8'. - * - */ - -class PiwikAnalyticsPlugin extends Plugin -{ - /** the base of your Piwik installation */ - public $piwikroot = null; - /** the Piwik Id of your statusnet installation */ - public $piwikId = null; - - /** - * constructor - * - * @param string $root Piwik root URL - * @param string $id Piwik ID of this app - */ - - function __construct($root=null, $id=null) - { - $this->piwikroot = $root; - $this->piwikId = $id; - parent::__construct(); - } - - /** - * Called when all scripts have been shown - * - * @param Action $action Current action - * - * @return boolean ignored - */ - - function onEndShowScripts($action) - { - $piwikCode1 = <<piwikroot}" : "http://{$this->piwikroot}"); -document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); -ENDOFPIWIK; - $piwikCode2 = <<piwikId}); - piwikTracker.trackPageView(); - piwikTracker.enableLinkTracking(); -} catch( err ) {} -ENDOFPIWIK; - - $action->inlineScript($piwikCode1); - $action->inlineScript($piwikCode2); - return true; - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'PiwikAnalytics', - 'version' => STATUSNET_VERSION, - 'author' => 'Tobias Diekershoff, Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:Piwik', - 'rawdescription' => - _m('Use Piwik Open Source Web analytics software.')); - return true; - } - -} diff --git a/plugins/Spotify/SpotifyPlugin.php b/plugins/Spotify/SpotifyPlugin.php new file mode 100644 index 000000000..e7a5a5382 --- /dev/null +++ b/plugins/Spotify/SpotifyPlugin.php @@ -0,0 +1,113 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Nick Holliday + * @copyright Nick Holliday + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @see Event + */ +if (!defined('STATUSNET')) { + exit(1); +} +define('SPOTIFYPLUGIN_VERSION', '0.1'); + +/** + * Plugin to create pretty Spotify URLs + * + * The Spotify API is called before the notice is saved to gather artist and track information. + * + * @category Plugin + * @package StatusNet + * @author Nick Holliday + * @copyright Nick Holliday + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @see Event + */ + +class SpotifyPlugin extends Plugin +{ + + function __construct() + { + parent::__construct(); + } + + function onStartNoticeSave($notice) + { + $notice->rendered = preg_replace_callback('/spotify:[a-z]{5,6}:[a-z0-9]{22}/i', + "renderSpotifyURILink", + $notice->rendered); + + $notice->rendered = preg_replace_callback('/http:\/\/open.spotify.com\/[a-z]{5,6}\/[a-z0-9]{22}<\/a>/i', + "renderSpotifyHTTPLink", + $notice->rendered); + + return true; + } + + function userAgent() + { + return 'SpotifyPlugin/'.SPOTIFYPLUGIN_VERSION . + ' StatusNet/' . STATUSNET_VERSION; + } +} + +function doSpotifyLookup($uri, $isArtist) +{ + $request = HTTPClient::start(); + $response = $request->get('http://ws.spotify.com/lookup/1/?uri=' . $uri); + if ($response->isOk()) { + $xml = simplexml_load_string($response->getBody()); + + if($isArtist) + return $xml->name; + else + return $xml->artist->name . ' - ' . $xml->name; + } +} + +function renderSpotifyURILink($match) +{ + $isArtist = false; + if(preg_match('/artist/', $match[0]) > 0) $isArtist = true; + + $name = doSpotifyLookup($match[0], $isArtist); + return "" . $name . ""; +} + +function renderSpotifyHTTPLink($match) +{ + $match[0] = preg_replace('/http:\/\/open.spotify.com\//i', 'spotify:', $match[0]); + $match[0] = preg_replace('/<\/a>/', '', $match[0]); + $match[0] = preg_replace('/\//', ':', $match[0]); + + $isArtist = false; + if(preg_match('/artist/', $match[0]) > 0) $isArtist = true; + + $name = doSpotifyLookup($match[0], $isArtist); + return "" . $name . ""; +} diff --git a/plugins/SpotifyPlugin.php b/plugins/SpotifyPlugin.php deleted file mode 100644 index e7a5a5382..000000000 --- a/plugins/SpotifyPlugin.php +++ /dev/null @@ -1,113 +0,0 @@ -. - * - * @category Plugin - * @package StatusNet - * @author Nick Holliday - * @copyright Nick Holliday - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @see Event - */ -if (!defined('STATUSNET')) { - exit(1); -} -define('SPOTIFYPLUGIN_VERSION', '0.1'); - -/** - * Plugin to create pretty Spotify URLs - * - * The Spotify API is called before the notice is saved to gather artist and track information. - * - * @category Plugin - * @package StatusNet - * @author Nick Holliday - * @copyright Nick Holliday - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @see Event - */ - -class SpotifyPlugin extends Plugin -{ - - function __construct() - { - parent::__construct(); - } - - function onStartNoticeSave($notice) - { - $notice->rendered = preg_replace_callback('/spotify:[a-z]{5,6}:[a-z0-9]{22}/i', - "renderSpotifyURILink", - $notice->rendered); - - $notice->rendered = preg_replace_callback('/http:\/\/open.spotify.com\/[a-z]{5,6}\/[a-z0-9]{22}<\/a>/i', - "renderSpotifyHTTPLink", - $notice->rendered); - - return true; - } - - function userAgent() - { - return 'SpotifyPlugin/'.SPOTIFYPLUGIN_VERSION . - ' StatusNet/' . STATUSNET_VERSION; - } -} - -function doSpotifyLookup($uri, $isArtist) -{ - $request = HTTPClient::start(); - $response = $request->get('http://ws.spotify.com/lookup/1/?uri=' . $uri); - if ($response->isOk()) { - $xml = simplexml_load_string($response->getBody()); - - if($isArtist) - return $xml->name; - else - return $xml->artist->name . ' - ' . $xml->name; - } -} - -function renderSpotifyURILink($match) -{ - $isArtist = false; - if(preg_match('/artist/', $match[0]) > 0) $isArtist = true; - - $name = doSpotifyLookup($match[0], $isArtist); - return "" . $name . ""; -} - -function renderSpotifyHTTPLink($match) -{ - $match[0] = preg_replace('/http:\/\/open.spotify.com\//i', 'spotify:', $match[0]); - $match[0] = preg_replace('/<\/a>/', '', $match[0]); - $match[0] = preg_replace('/\//', ':', $match[0]); - - $isArtist = false; - if(preg_match('/artist/', $match[0]) > 0) $isArtist = true; - - $name = doSpotifyLookup($match[0], $isArtist); - return "" . $name . ""; -} diff --git a/plugins/SubscriptionThrottle/SubscriptionThrottlePlugin.php b/plugins/SubscriptionThrottle/SubscriptionThrottlePlugin.php new file mode 100644 index 000000000..114113360 --- /dev/null +++ b/plugins/SubscriptionThrottle/SubscriptionThrottlePlugin.php @@ -0,0 +1,175 @@ +. + * + * @category Throttle + * @package StatusNet + * @author Evan Prodromou + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * Subscription throttle + * + * @category Throttle + * @package StatusNet + * @author Evan Prodromou + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +class SubscriptionThrottlePlugin extends Plugin +{ + public $subLimits = array(86400 => 100, + 3600 => 50); + + public $groupLimits = array(86400 => 50, + 3600 => 25); + + /** + * Filter subscriptions to see if they're coming too fast. + * + * @param User $user The user subscribing + * @param User $other The user being subscribed to + * + * @return boolean hook value + */ + + function onStartSubscribe($user, $other) + { + foreach ($this->subLimits as $seconds => $limit) { + $sub = $this->_getNthSub($user, $limit); + + if (!empty($sub)) { + $subtime = strtotime($sub->created); + $now = time(); + if ($now - $subtime < $seconds) { + throw new Exception(_("Too many subscriptions. Take a break and try again later.")); + } + } + } + + return true; + } + + /** + * Filter group joins to see if they're coming too fast. + * + * @param Group $group The group being joined + * @param User $user The user joining + * + * @return boolean hook value + */ + + function onStartJoinGroup($group, $user) + { + foreach ($this->groupLimits as $seconds => $limit) { + $mem = $this->_getNthMem($user, $limit); + if (!empty($mem)) { + + $jointime = strtotime($mem->created); + $now = time(); + if ($now - $jointime < $seconds) { + throw new Exception(_("Too many memberships. Take a break and try again later.")); + } + } + } + + return true; + } + + /** + * Get the Nth most recent subscription for this user + * + * @param User $user The user to get subscriptions for + * @param integer $n How far to count back + * + * @return Subscription a subscription or null + */ + + private function _getNthSub($user, $n) + { + $sub = new Subscription(); + + $sub->subscriber = $user->id; + $sub->orderBy('created DESC'); + $sub->limit($n - 1, 1); + + if ($sub->find(true)) { + return $sub; + } else { + return null; + } + } + + /** + * Get the Nth most recent group membership for this user + * + * @param User $user The user to get memberships for + * @param integer $n How far to count back + * + * @return Group_member a membership or null + */ + + private function _getNthMem($user, $n) + { + $mem = new Group_member(); + + $mem->profile_id = $user->id; + $mem->orderBy('created DESC'); + $mem->limit($n - 1, 1); + + if ($mem->find(true)) { + return $mem; + } else { + return null; + } + } + + /** + * Return plugin version data for display + * + * @param array &$versions Array of version arrays + * + * @return boolean hook value + */ + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'SubscriptionThrottle', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:SubscriptionThrottle', + 'rawdescription' => + _m('Configurable limits for subscriptions and group memberships.')); + return true; + } +} + diff --git a/plugins/SubscriptionThrottlePlugin.php b/plugins/SubscriptionThrottlePlugin.php deleted file mode 100644 index 114113360..000000000 --- a/plugins/SubscriptionThrottlePlugin.php +++ /dev/null @@ -1,175 +0,0 @@ -. - * - * @category Throttle - * @package StatusNet - * @author Evan Prodromou - * @copyright 2010 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - // This check helps protect against security problems; - // your code file can't be executed directly from the web. - exit(1); -} - -/** - * Subscription throttle - * - * @category Throttle - * @package StatusNet - * @author Evan Prodromou - * @copyright 2010 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 - * @link http://status.net/ - */ - -class SubscriptionThrottlePlugin extends Plugin -{ - public $subLimits = array(86400 => 100, - 3600 => 50); - - public $groupLimits = array(86400 => 50, - 3600 => 25); - - /** - * Filter subscriptions to see if they're coming too fast. - * - * @param User $user The user subscribing - * @param User $other The user being subscribed to - * - * @return boolean hook value - */ - - function onStartSubscribe($user, $other) - { - foreach ($this->subLimits as $seconds => $limit) { - $sub = $this->_getNthSub($user, $limit); - - if (!empty($sub)) { - $subtime = strtotime($sub->created); - $now = time(); - if ($now - $subtime < $seconds) { - throw new Exception(_("Too many subscriptions. Take a break and try again later.")); - } - } - } - - return true; - } - - /** - * Filter group joins to see if they're coming too fast. - * - * @param Group $group The group being joined - * @param User $user The user joining - * - * @return boolean hook value - */ - - function onStartJoinGroup($group, $user) - { - foreach ($this->groupLimits as $seconds => $limit) { - $mem = $this->_getNthMem($user, $limit); - if (!empty($mem)) { - - $jointime = strtotime($mem->created); - $now = time(); - if ($now - $jointime < $seconds) { - throw new Exception(_("Too many memberships. Take a break and try again later.")); - } - } - } - - return true; - } - - /** - * Get the Nth most recent subscription for this user - * - * @param User $user The user to get subscriptions for - * @param integer $n How far to count back - * - * @return Subscription a subscription or null - */ - - private function _getNthSub($user, $n) - { - $sub = new Subscription(); - - $sub->subscriber = $user->id; - $sub->orderBy('created DESC'); - $sub->limit($n - 1, 1); - - if ($sub->find(true)) { - return $sub; - } else { - return null; - } - } - - /** - * Get the Nth most recent group membership for this user - * - * @param User $user The user to get memberships for - * @param integer $n How far to count back - * - * @return Group_member a membership or null - */ - - private function _getNthMem($user, $n) - { - $mem = new Group_member(); - - $mem->profile_id = $user->id; - $mem->orderBy('created DESC'); - $mem->limit($n - 1, 1); - - if ($mem->find(true)) { - return $mem; - } else { - return null; - } - } - - /** - * Return plugin version data for display - * - * @param array &$versions Array of version arrays - * - * @return boolean hook value - */ - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'SubscriptionThrottle', - 'version' => STATUSNET_VERSION, - 'author' => 'Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:SubscriptionThrottle', - 'rawdescription' => - _m('Configurable limits for subscriptions and group memberships.')); - return true; - } -} - diff --git a/plugins/Template/TemplatePlugin.php b/plugins/Template/TemplatePlugin.php new file mode 100644 index 000000000..80625c5b7 --- /dev/null +++ b/plugins/Template/TemplatePlugin.php @@ -0,0 +1,357 @@ + + * @copyright 2009 Megapump, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://megapump.com/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +define('TEMPLATEPLUGIN_VERSION', '0.1'); + +class TemplatePlugin extends Plugin { + + var $blocks = array(); + + function __construct() { + parent::__construct(); + } + + // capture the RouterInitialized event + // and connect a new API method + // for updating the template + function onRouterInitialized( $m ) { + $m->connect( 'template/update', array( + 'action' => 'template', + )); + } + + // <%styles%> + // <%scripts%> + // <%search%> + // <%feeds%> + // <%description%> + // <%head%> + function onStartShowHead( &$act ) { + $this->clear_xmlWriter($act); + $act->extraHead(); + $this->blocks['head'] = $act->xw->flush(); + $act->showStylesheets(); + $this->blocks['styles'] = $act->xw->flush(); + $act->showScripts(); + $this->blocks['scripts'] = $act->xw->flush(); + $act->showFeeds(); + $this->blocks['feeds'] = $act->xw->flush(); + $act->showOpenSearch(); + $this->blocks['search'] = $act->xw->flush(); + $act->showDescription(); + $this->blocks['description'] = $act->xw->flush(); + return false; + } + + // <%bodytext%> + function onStartShowContentBlock( &$act ) { + $this->clear_xmlWriter($act); + return true; + } + function onEndShowContentBlock( &$act ) { + $this->blocks['bodytext'] = $act->xw->flush(); + } + + // <%localnav%> + function onStartShowLocalNavBlock( &$act ) { + $this->clear_xmlWriter($act); + return true; + } + function onEndShowLocalNavBlock( &$act ) { + $this->blocks['localnav'] = $act->xw->flush(); + } + + // <%export%> + function onStartShowExportData( &$act ) { + $this->clear_xmlWriter($act); + return true; + } + function onEndShowExportData( &$act ) { + $this->blocks['export'] = $act->xw->flush(); + } + + // <%subscriptions%> + // <%subscribers%> + // <%groups%> + // <%statistics%> + // <%cloud%> + // <%groupmembers%> + // <%groupstatistics%> + // <%groupcloud%> + // <%popular%> + // <%groupsbyposts%> + // <%featuredusers%> + // <%groupsbymembers%> + function onStartShowSections( &$act ) { + global $action; + $this->clear_xmlWriter($act); + switch ($action) { + case "showstream": + $act->showSubscriptions(); + $this->blocks['subscriptions'] = $act->xw->flush(); + $act->showSubscribers(); + $this->blocks['subscribers'] = $act->xw->flush(); + $act->showGroups(); + $this->blocks['groups'] = $act->xw->flush(); + $act->showStatistics(); + $this->blocks['statistics'] = $act->xw->flush(); + $cloud = new PersonalTagCloudSection($act, $act->user); + $cloud->show(); + $this->blocks['cloud'] = $act->xw->flush(); + break; + case "showgroup": + $act->showMembers(); + $this->blocks['groupmembers'] = $act->xw->flush(); + $act->showStatistics(); + $this->blocks['groupstatistics'] = $act->xw->flush(); + $cloud = new GroupTagCloudSection($act, $act->group); + $cloud->show(); + $this->blocks['groupcloud'] = $act->xw->flush(); + break; + case "public": + $pop = new PopularNoticeSection($act); + $pop->show(); + $this->blocks['popular'] = $act->xw->flush(); + $gbp = new GroupsByPostsSection($act); + $gbp->show(); + $this->blocks['groupsbyposts'] = $act->xw->flush(); + $feat = new FeaturedUsersSection($act); + $feat->show(); + $this->blocks['featuredusers'] = $act->xw->flush(); + break; + case "groups": + $gbp = new GroupsByPostsSection($act); + $gbp->show(); + $this->blocks['groupsbyposts'] = $act->xw->flush(); + $gbm = new GroupsByMembersSection($act); + $gbm->show(); + $this->blocks['groupsbymembers'] = $act->xw->flush(); + break; + } + return false; + } + + // <%logo%> + // <%nav%> + // <%notice%> + // <%noticeform%> + function onStartShowHeader( &$act ) { + $this->clear_xmlWriter($act); + $act->showLogo(); + $this->blocks['logo'] = $act->xw->flush(); + $act->showPrimaryNav(); + $this->blocks['nav'] = $act->xw->flush(); + $act->showSiteNotice(); + $this->blocks['notice'] = $act->xw->flush(); + if (common_logged_in()) { + $act->showNoticeForm(); + } else { + $act->showAnonymousMessage(); + } + $this->blocks['noticeform'] = $act->xw->flush(); + return false; + } + + // <%secondarynav%> + // <%licenses%> + function onStartShowFooter( &$act ) { + $this->clear_xmlWriter($act); + $act->showSecondaryNav(); + $this->blocks['secondarynav'] = $act->xw->flush(); + $act->showLicenses(); + $this->blocks['licenses'] = $act->xw->flush(); + return false; + } + + // capture the EndHTML event + // and include the template + function onEndEndHTML($act) { + + global $action, $tags; + + // set the action and title values + $vars = array( + 'action'=>$action, + 'title'=>$act->title(). " - ". common_config('site', 'name') + ); + + // use the PHP template + // unless statusnet config: + // $config['template']['mode'] = 'html'; + if (!(common_config('template', 'mode') == 'html')) { + $tpl_file = $this->templateFolder() . '/index.php'; + $tags = array_merge($vars,$this->blocks); + include $tpl_file; + return; + } + + $tpl_file = $this->templateFolder() . '/index.html'; + + // read the static template + $output = file_get_contents( $tpl_file ); + + $tags = array(); + + // get a list of the <%tags%> in the template + $pattern='/<%([a-z]+)%>/'; + + if ( 1 <= preg_match_all( $pattern, $output, $found )) + $tags[] = $found; + + // for each found tag, set its value from the rendered blocks + foreach( $tags[0][1] as $pos=>$tag ) { + if (isset($this->blocks[$tag])) + $vars[$tag] = $this->blocks[$tag]; + + // didn't find a block for the tag + elseif (!isset($vars[$tag])) + $vars[$tag] = ''; + } + + // replace the tags in the template + foreach( $vars as $key=>$val ) + $output = str_replace( '<%'.$key.'%>', $val, $output ); + + echo $output; + + return true; + + } + function templateFolder() { + return 'tpl'; + } + + // catching the StartShowHTML event to halt the rendering + function onStartShowHTML( &$act ) { + $this->clear_xmlWriter($act); + return true; + } + + // clear the xmlWriter + function clear_xmlWriter( &$act ) { + $act->xw->openMemory(); + $act->xw->setIndent(true); + } + +} + +/** + * Action for updating the template remotely + * + * "template/update" -- a POST method that requires a single + * parameter "template", containing the new template code + * + * @category Plugin + * @package StatusNet + * @author Brian Hendrickson + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://megapump.com/ + * + */ + +class TemplateAction extends Action +{ + + function prepare($args) { + parent::prepare($args); + return true; + } + + function handle($args) { + + parent::handle($args); + + if (!isset($_SERVER['PHP_AUTH_USER'])) { + + // not authenticated, show login form + header('WWW-Authenticate: Basic realm="StatusNet API"'); + + // cancelled the browser login form + $this->clientError(_('Authentication error!'), $code = 401); + + } else { + + $nick = $_SERVER['PHP_AUTH_USER']; + $pass = $_SERVER['PHP_AUTH_PW']; + + // check username and password + $user = common_check_user($nick,$pass); + + if ($user) { + + // verify that user is admin + if (!($user->id == 1)) + $this->clientError(_('Only User #1 can update the template.'), $code = 401); + + // open the old template + $tpl_file = $this->templateFolder() . '/index.html'; + $fp = fopen( $tpl_file, 'w+' ); + + // overwrite with the new template + fwrite($fp, $this->arg('template')); + fclose($fp); + + header('HTTP/1.1 200 OK'); + header('Content-type: text/plain'); + print "Template Updated!"; + + } else { + + // bad username and password + $this->clientError(_('Authentication error!'), $code = 401); + + } + + } + } + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'Template', + 'version' => TEMPLATEPLUGIN_VERSION, + 'author' => 'Brian Hendrickson', + 'homepage' => 'http://status.net/wiki/Plugin:Template', + 'rawdescription' => + _m('Use an HTML template for Web output.')); + return true; + } + +} + +/** + * Function for retrieving a statusnet display section + * + * requires one parameter, the name of the section + * section names are listed in the comments of the TemplatePlugin class + * + * @category Plugin + * @package StatusNet + * @author Brian Hendrickson + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://megapump.com/ + * + */ + +function section($tagname) { + global $tags; + if (isset($tags[$tagname])) + return $tags[$tagname]; +} + diff --git a/plugins/TemplatePlugin.php b/plugins/TemplatePlugin.php deleted file mode 100644 index 80625c5b7..000000000 --- a/plugins/TemplatePlugin.php +++ /dev/null @@ -1,357 +0,0 @@ - - * @copyright 2009 Megapump, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://megapump.com/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -define('TEMPLATEPLUGIN_VERSION', '0.1'); - -class TemplatePlugin extends Plugin { - - var $blocks = array(); - - function __construct() { - parent::__construct(); - } - - // capture the RouterInitialized event - // and connect a new API method - // for updating the template - function onRouterInitialized( $m ) { - $m->connect( 'template/update', array( - 'action' => 'template', - )); - } - - // <%styles%> - // <%scripts%> - // <%search%> - // <%feeds%> - // <%description%> - // <%head%> - function onStartShowHead( &$act ) { - $this->clear_xmlWriter($act); - $act->extraHead(); - $this->blocks['head'] = $act->xw->flush(); - $act->showStylesheets(); - $this->blocks['styles'] = $act->xw->flush(); - $act->showScripts(); - $this->blocks['scripts'] = $act->xw->flush(); - $act->showFeeds(); - $this->blocks['feeds'] = $act->xw->flush(); - $act->showOpenSearch(); - $this->blocks['search'] = $act->xw->flush(); - $act->showDescription(); - $this->blocks['description'] = $act->xw->flush(); - return false; - } - - // <%bodytext%> - function onStartShowContentBlock( &$act ) { - $this->clear_xmlWriter($act); - return true; - } - function onEndShowContentBlock( &$act ) { - $this->blocks['bodytext'] = $act->xw->flush(); - } - - // <%localnav%> - function onStartShowLocalNavBlock( &$act ) { - $this->clear_xmlWriter($act); - return true; - } - function onEndShowLocalNavBlock( &$act ) { - $this->blocks['localnav'] = $act->xw->flush(); - } - - // <%export%> - function onStartShowExportData( &$act ) { - $this->clear_xmlWriter($act); - return true; - } - function onEndShowExportData( &$act ) { - $this->blocks['export'] = $act->xw->flush(); - } - - // <%subscriptions%> - // <%subscribers%> - // <%groups%> - // <%statistics%> - // <%cloud%> - // <%groupmembers%> - // <%groupstatistics%> - // <%groupcloud%> - // <%popular%> - // <%groupsbyposts%> - // <%featuredusers%> - // <%groupsbymembers%> - function onStartShowSections( &$act ) { - global $action; - $this->clear_xmlWriter($act); - switch ($action) { - case "showstream": - $act->showSubscriptions(); - $this->blocks['subscriptions'] = $act->xw->flush(); - $act->showSubscribers(); - $this->blocks['subscribers'] = $act->xw->flush(); - $act->showGroups(); - $this->blocks['groups'] = $act->xw->flush(); - $act->showStatistics(); - $this->blocks['statistics'] = $act->xw->flush(); - $cloud = new PersonalTagCloudSection($act, $act->user); - $cloud->show(); - $this->blocks['cloud'] = $act->xw->flush(); - break; - case "showgroup": - $act->showMembers(); - $this->blocks['groupmembers'] = $act->xw->flush(); - $act->showStatistics(); - $this->blocks['groupstatistics'] = $act->xw->flush(); - $cloud = new GroupTagCloudSection($act, $act->group); - $cloud->show(); - $this->blocks['groupcloud'] = $act->xw->flush(); - break; - case "public": - $pop = new PopularNoticeSection($act); - $pop->show(); - $this->blocks['popular'] = $act->xw->flush(); - $gbp = new GroupsByPostsSection($act); - $gbp->show(); - $this->blocks['groupsbyposts'] = $act->xw->flush(); - $feat = new FeaturedUsersSection($act); - $feat->show(); - $this->blocks['featuredusers'] = $act->xw->flush(); - break; - case "groups": - $gbp = new GroupsByPostsSection($act); - $gbp->show(); - $this->blocks['groupsbyposts'] = $act->xw->flush(); - $gbm = new GroupsByMembersSection($act); - $gbm->show(); - $this->blocks['groupsbymembers'] = $act->xw->flush(); - break; - } - return false; - } - - // <%logo%> - // <%nav%> - // <%notice%> - // <%noticeform%> - function onStartShowHeader( &$act ) { - $this->clear_xmlWriter($act); - $act->showLogo(); - $this->blocks['logo'] = $act->xw->flush(); - $act->showPrimaryNav(); - $this->blocks['nav'] = $act->xw->flush(); - $act->showSiteNotice(); - $this->blocks['notice'] = $act->xw->flush(); - if (common_logged_in()) { - $act->showNoticeForm(); - } else { - $act->showAnonymousMessage(); - } - $this->blocks['noticeform'] = $act->xw->flush(); - return false; - } - - // <%secondarynav%> - // <%licenses%> - function onStartShowFooter( &$act ) { - $this->clear_xmlWriter($act); - $act->showSecondaryNav(); - $this->blocks['secondarynav'] = $act->xw->flush(); - $act->showLicenses(); - $this->blocks['licenses'] = $act->xw->flush(); - return false; - } - - // capture the EndHTML event - // and include the template - function onEndEndHTML($act) { - - global $action, $tags; - - // set the action and title values - $vars = array( - 'action'=>$action, - 'title'=>$act->title(). " - ". common_config('site', 'name') - ); - - // use the PHP template - // unless statusnet config: - // $config['template']['mode'] = 'html'; - if (!(common_config('template', 'mode') == 'html')) { - $tpl_file = $this->templateFolder() . '/index.php'; - $tags = array_merge($vars,$this->blocks); - include $tpl_file; - return; - } - - $tpl_file = $this->templateFolder() . '/index.html'; - - // read the static template - $output = file_get_contents( $tpl_file ); - - $tags = array(); - - // get a list of the <%tags%> in the template - $pattern='/<%([a-z]+)%>/'; - - if ( 1 <= preg_match_all( $pattern, $output, $found )) - $tags[] = $found; - - // for each found tag, set its value from the rendered blocks - foreach( $tags[0][1] as $pos=>$tag ) { - if (isset($this->blocks[$tag])) - $vars[$tag] = $this->blocks[$tag]; - - // didn't find a block for the tag - elseif (!isset($vars[$tag])) - $vars[$tag] = ''; - } - - // replace the tags in the template - foreach( $vars as $key=>$val ) - $output = str_replace( '<%'.$key.'%>', $val, $output ); - - echo $output; - - return true; - - } - function templateFolder() { - return 'tpl'; - } - - // catching the StartShowHTML event to halt the rendering - function onStartShowHTML( &$act ) { - $this->clear_xmlWriter($act); - return true; - } - - // clear the xmlWriter - function clear_xmlWriter( &$act ) { - $act->xw->openMemory(); - $act->xw->setIndent(true); - } - -} - -/** - * Action for updating the template remotely - * - * "template/update" -- a POST method that requires a single - * parameter "template", containing the new template code - * - * @category Plugin - * @package StatusNet - * @author Brian Hendrickson - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://megapump.com/ - * - */ - -class TemplateAction extends Action -{ - - function prepare($args) { - parent::prepare($args); - return true; - } - - function handle($args) { - - parent::handle($args); - - if (!isset($_SERVER['PHP_AUTH_USER'])) { - - // not authenticated, show login form - header('WWW-Authenticate: Basic realm="StatusNet API"'); - - // cancelled the browser login form - $this->clientError(_('Authentication error!'), $code = 401); - - } else { - - $nick = $_SERVER['PHP_AUTH_USER']; - $pass = $_SERVER['PHP_AUTH_PW']; - - // check username and password - $user = common_check_user($nick,$pass); - - if ($user) { - - // verify that user is admin - if (!($user->id == 1)) - $this->clientError(_('Only User #1 can update the template.'), $code = 401); - - // open the old template - $tpl_file = $this->templateFolder() . '/index.html'; - $fp = fopen( $tpl_file, 'w+' ); - - // overwrite with the new template - fwrite($fp, $this->arg('template')); - fclose($fp); - - header('HTTP/1.1 200 OK'); - header('Content-type: text/plain'); - print "Template Updated!"; - - } else { - - // bad username and password - $this->clientError(_('Authentication error!'), $code = 401); - - } - - } - } - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'Template', - 'version' => TEMPLATEPLUGIN_VERSION, - 'author' => 'Brian Hendrickson', - 'homepage' => 'http://status.net/wiki/Plugin:Template', - 'rawdescription' => - _m('Use an HTML template for Web output.')); - return true; - } - -} - -/** - * Function for retrieving a statusnet display section - * - * requires one parameter, the name of the section - * section names are listed in the comments of the TemplatePlugin class - * - * @category Plugin - * @package StatusNet - * @author Brian Hendrickson - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://megapump.com/ - * - */ - -function section($tagname) { - global $tags; - if (isset($tags[$tagname])) - return $tags[$tagname]; -} - diff --git a/plugins/UserLimit/UserLimitPlugin.php b/plugins/UserLimit/UserLimitPlugin.php new file mode 100644 index 000000000..ab3187299 --- /dev/null +++ b/plugins/UserLimit/UserLimitPlugin.php @@ -0,0 +1,92 @@ +. + * + * @category Action + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * Plugin to limit number of users that can register (best for cloud providers) + * + * For cloud providers whose freemium model is based on how many + * users can register. We use it on the StatusNet Cloud. + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @seeAlso Location + */ + +class UserLimitPlugin extends Plugin +{ + public $maxUsers = null; + + function onStartUserRegister(&$user, &$profile) + { + $this->_checkMaxUsers(); + return true; + } + + function onStartRegistrationTry($action) + { + $this->_checkMaxUsers(); + return true; + } + + function _checkMaxUsers() + { + if (!is_null($this->maxUsers)) { + + $cls = new User(); + + $cnt = $cls->count(); + + if ($cnt >= $this->maxUsers) { + $msg = sprintf(_('Cannot register; maximum number of users (%d) reached.'), + $this->maxUsers); + + throw new ClientException($msg); + } + } + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'UserLimit', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:UserLimit', + 'description' => + _m('Limit the number of users who can register.')); + return true; + } +} diff --git a/plugins/UserLimitPlugin.php b/plugins/UserLimitPlugin.php deleted file mode 100644 index ab3187299..000000000 --- a/plugins/UserLimitPlugin.php +++ /dev/null @@ -1,92 +0,0 @@ -. - * - * @category Action - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -/** - * Plugin to limit number of users that can register (best for cloud providers) - * - * For cloud providers whose freemium model is based on how many - * users can register. We use it on the StatusNet Cloud. - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @seeAlso Location - */ - -class UserLimitPlugin extends Plugin -{ - public $maxUsers = null; - - function onStartUserRegister(&$user, &$profile) - { - $this->_checkMaxUsers(); - return true; - } - - function onStartRegistrationTry($action) - { - $this->_checkMaxUsers(); - return true; - } - - function _checkMaxUsers() - { - if (!is_null($this->maxUsers)) { - - $cls = new User(); - - $cnt = $cls->count(); - - if ($cnt >= $this->maxUsers) { - $msg = sprintf(_('Cannot register; maximum number of users (%d) reached.'), - $this->maxUsers); - - throw new ClientException($msg); - } - } - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'UserLimit', - 'version' => STATUSNET_VERSION, - 'author' => 'Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:UserLimit', - 'description' => - _m('Limit the number of users who can register.')); - return true; - } -} diff --git a/plugins/WikiHashtags/WikiHashtagsPlugin.php b/plugins/WikiHashtags/WikiHashtagsPlugin.php new file mode 100644 index 000000000..c6c976b8f --- /dev/null +++ b/plugins/WikiHashtags/WikiHashtagsPlugin.php @@ -0,0 +1,113 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @copyright 2008 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * Plugin to use WikiHashtags + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @see Event + */ + +class WikiHashtagsPlugin extends Plugin +{ + const VERSION = '0.1'; + + function __construct($code=null) + { + parent::__construct(); + } + + function onStartShowSections($action) + { + $name = $action->trimmed('action'); + + if ($name == 'tag') { + + $taginput = $action->trimmed('tag'); + $tag = common_canonical_tag($taginput); + + if (!empty($tag)) { + + $url = sprintf('http://hashtags.wikia.com/index.php?title=%s&action=render', + urlencode($tag)); + $editurl = sprintf('http://hashtags.wikia.com/index.php?title=%s&action=edit', + urlencode($tag)); + + $request = HTTPClient::start(); + $response = $request->get($url); + $html = $response->getBody(); + + $action->elementStart('div', array('id' => 'wikihashtags', 'class' => 'section')); + + if ($response->isOk() && !empty($html)) { + $action->element('style', null, + "span.editsection { display: none }\n". + "table.toc { display: none }"); + $action->raw($html); + $action->elementStart('p'); + $action->element('a', array('href' => $editurl, + 'title' => sprintf(_('Edit the article for #%s on WikiHashtags'), $tag)), + _('Edit')); + $action->element('a', array('href' => 'http://www.gnu.org/copyleft/fdl.html', + 'title' => _('Shared under the terms of the GNU Free Documentation License'), + 'rel' => 'license'), + 'GNU FDL'); + $action->elementEnd('p'); + } else { + $action->element('a', array('href' => $editurl), + sprintf(_('Start the article for #%s on WikiHashtags'), $tag)); + } + + $action->elementEnd('div'); + } + } + + return true; + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'WikiHashtags', + 'version' => self::VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:WikiHashtags', + 'rawdescription' => + _m('Gets hashtag descriptions from WikiHashtags.')); + return true; + } +} diff --git a/plugins/WikiHashtagsPlugin.php b/plugins/WikiHashtagsPlugin.php deleted file mode 100644 index c6c976b8f..000000000 --- a/plugins/WikiHashtagsPlugin.php +++ /dev/null @@ -1,113 +0,0 @@ -. - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @copyright 2008 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -/** - * Plugin to use WikiHashtags - * - * @category Plugin - * @package StatusNet - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @see Event - */ - -class WikiHashtagsPlugin extends Plugin -{ - const VERSION = '0.1'; - - function __construct($code=null) - { - parent::__construct(); - } - - function onStartShowSections($action) - { - $name = $action->trimmed('action'); - - if ($name == 'tag') { - - $taginput = $action->trimmed('tag'); - $tag = common_canonical_tag($taginput); - - if (!empty($tag)) { - - $url = sprintf('http://hashtags.wikia.com/index.php?title=%s&action=render', - urlencode($tag)); - $editurl = sprintf('http://hashtags.wikia.com/index.php?title=%s&action=edit', - urlencode($tag)); - - $request = HTTPClient::start(); - $response = $request->get($url); - $html = $response->getBody(); - - $action->elementStart('div', array('id' => 'wikihashtags', 'class' => 'section')); - - if ($response->isOk() && !empty($html)) { - $action->element('style', null, - "span.editsection { display: none }\n". - "table.toc { display: none }"); - $action->raw($html); - $action->elementStart('p'); - $action->element('a', array('href' => $editurl, - 'title' => sprintf(_('Edit the article for #%s on WikiHashtags'), $tag)), - _('Edit')); - $action->element('a', array('href' => 'http://www.gnu.org/copyleft/fdl.html', - 'title' => _('Shared under the terms of the GNU Free Documentation License'), - 'rel' => 'license'), - 'GNU FDL'); - $action->elementEnd('p'); - } else { - $action->element('a', array('href' => $editurl), - sprintf(_('Start the article for #%s on WikiHashtags'), $tag)); - } - - $action->elementEnd('div'); - } - } - - return true; - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'WikiHashtags', - 'version' => self::VERSION, - 'author' => 'Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:WikiHashtags', - 'rawdescription' => - _m('Gets hashtag descriptions from WikiHashtags.')); - return true; - } -} diff --git a/plugins/XCache/XCachePlugin.php b/plugins/XCache/XCachePlugin.php new file mode 100644 index 000000000..2baa290ed --- /dev/null +++ b/plugins/XCache/XCachePlugin.php @@ -0,0 +1,124 @@ +. + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * A plugin to use XCache's variable cache for the cache interface + * + * New plugin interface lets us use alternative cache systems + * for caching. This one uses XCache's variable cache. + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class XCachePlugin extends Plugin +{ + /** + * Get a value associated with a key + * + * The value should have been set previously. + * + * @param string &$key in; Lookup key + * @param mixed &$value out; value associated with key + * + * @return boolean hook success + */ + + function onStartCacheGet(&$key, &$value) + { + if (!xcache_isset($key)) { + $value = false; + } else { + $value = xcache_get($key); + $value = unserialize($value); + } + Event::handle('EndCacheGet', array($key, &$value)); + return false; + } + + /** + * Associate a value with a key + * + * @param string &$key in; Key to use for lookups + * @param mixed &$value in; Value to associate + * @param integer &$flag in; Flag (passed through to Memcache) + * @param integer &$expiry in; Expiry (passed through to Memcache) + * @param boolean &$success out; Whether the set was successful + * + * @return boolean hook success + */ + + function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) + { + $success = xcache_set($key, serialize($value)); + + Event::handle('EndCacheSet', array($key, $value, $flag, + $expiry)); + return false; + } + + /** + * Delete a value associated with a key + * + * @param string &$key in; Key to lookup + * @param boolean &$success out; whether it worked + * + * @return boolean hook success + */ + + function onStartCacheDelete(&$key, &$success) + { + $success = xcache_unset($key); + Event::handle('EndCacheDelete', array($key)); + return false; + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'XCache', + 'version' => STATUSNET_VERSION, + 'author' => 'Craig Andrews', + 'homepage' => 'http://status.net/wiki/Plugin:XCache', + 'rawdescription' => + _m('Use the XCache variable cache to cache query results.')); + return true; + } +} + diff --git a/plugins/XCachePlugin.php b/plugins/XCachePlugin.php deleted file mode 100644 index 2baa290ed..000000000 --- a/plugins/XCachePlugin.php +++ /dev/null @@ -1,124 +0,0 @@ -. - * - * @category Cache - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - // This check helps protect against security problems; - // your code file can't be executed directly from the web. - exit(1); -} - -/** - * A plugin to use XCache's variable cache for the cache interface - * - * New plugin interface lets us use alternative cache systems - * for caching. This one uses XCache's variable cache. - * - * @category Cache - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -class XCachePlugin extends Plugin -{ - /** - * Get a value associated with a key - * - * The value should have been set previously. - * - * @param string &$key in; Lookup key - * @param mixed &$value out; value associated with key - * - * @return boolean hook success - */ - - function onStartCacheGet(&$key, &$value) - { - if (!xcache_isset($key)) { - $value = false; - } else { - $value = xcache_get($key); - $value = unserialize($value); - } - Event::handle('EndCacheGet', array($key, &$value)); - return false; - } - - /** - * Associate a value with a key - * - * @param string &$key in; Key to use for lookups - * @param mixed &$value in; Value to associate - * @param integer &$flag in; Flag (passed through to Memcache) - * @param integer &$expiry in; Expiry (passed through to Memcache) - * @param boolean &$success out; Whether the set was successful - * - * @return boolean hook success - */ - - function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) - { - $success = xcache_set($key, serialize($value)); - - Event::handle('EndCacheSet', array($key, $value, $flag, - $expiry)); - return false; - } - - /** - * Delete a value associated with a key - * - * @param string &$key in; Key to lookup - * @param boolean &$success out; whether it worked - * - * @return boolean hook success - */ - - function onStartCacheDelete(&$key, &$success) - { - $success = xcache_unset($key); - Event::handle('EndCacheDelete', array($key)); - return false; - } - - function onPluginVersion(&$versions) - { - $versions[] = array('name' => 'XCache', - 'version' => STATUSNET_VERSION, - 'author' => 'Craig Andrews', - 'homepage' => 'http://status.net/wiki/Plugin:XCache', - 'rawdescription' => - _m('Use the XCache variable cache to cache query results.')); - return true; - } -} - -- cgit v1.2.3-54-g00ecf From 097d0bd2faad9e067367e88e4ad166b14b0f98b6 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 16 Sep 2010 14:43:27 -0700 Subject: Ticket #2731: Fix for regression in posting to remote groups (regression in 2d4e0693c88bb8cad47f917db3ac5ecfacf28619) Changes in 2d4e0693c88bb8cad47f917db3ac5ecfacf28619 changed Ostatus_profile::filterReplies() (which sorts out the local, remote, and group recipients on incoming remote messages) from checking for remote profiles with a safe call to Ostatus_profile::staticGet() to calls through Ostatus_profile::ensureProfileURL() and Ostatus_profile::ensureWebfinger(), which throw exceptions and thus abort processing. Since this was done before checking for local groups, the filter would fail when the ensure* functions determined it was looking at a local group and rightfully refused to create a remote group profile for it. Changing the calls to the ensure* functions was done so we can record remote reply recipients for future reply-to-reply processing (the staticGet() call was a cheaper way to do a lookup when we knew we only actually had to process groups that somebody signed up to); most important fix is simply to actually check for the exception! :) Here I'm changing the order of processing so we do the local group lookup first -- where it's nice and safe -- and then when we do the remote checks, we'll go ahead and gracefully skip that entry if the full remote lookup fails, so we'll still process any following recipients. --- plugins/OStatus/classes/Ostatus_profile.php | 33 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'plugins') diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 19fe5169b..11ca67b25 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -703,23 +703,7 @@ class Ostatus_profile extends Memcached_DataObject continue; } - // Is the recipient a remote group? - $oprofile = Ostatus_profile::ensureProfileURI($recipient); - - if ($oprofile) { - if ($oprofile->isGroup()) { - // Deliver to local members of this remote group. - // @fixme sender verification? - $groups[] = $oprofile->group_id; - } else { - // may be canonicalized or something - $replies[] = $oprofile->uri; - } - continue; - } - // Is the recipient a local group? - // @fixme uri on user_group isn't reliable yet // $group = User_group::staticGet('uri', $recipient); $id = OStatusPlugin::localGroupFromUrl($recipient); if ($id) { @@ -738,7 +722,22 @@ class Ostatus_profile extends Memcached_DataObject } } - common_log(LOG_DEBUG, "Skipping reply to unrecognized profile $recipient"); + // Is the recipient a remote user or group? + try { + $oprofile = Ostatus_profile::ensureProfileURI($recipient); + if ($oprofile->isGroup()) { + // Deliver to local members of this remote group. + // @fixme sender verification? + $groups[] = $oprofile->group_id; + } else { + // may be canonicalized or something + $replies[] = $oprofile->uri; + } + continue; + } catch (Exception $e) { + // Neither a recognizable local nor remote user! + common_log(LOG_DEBUG, "Skipping reply to unrecognized profile $recipient: " . $e->getMessage()); + } } $attention_uris = $replies; -- cgit v1.2.3-54-g00ecf From 89c561c9cf381a1068e4d78dd9ff1f42f709c4ce Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 16 Sep 2010 14:43:27 -0700 Subject: Ticket #2731: Fix for regression in posting to remote groups (regression in 2d4e0693c88bb8cad47f917db3ac5ecfacf28619) Changes in 2d4e0693c88bb8cad47f917db3ac5ecfacf28619 changed Ostatus_profile::filterReplies() (which sorts out the local, remote, and group recipients on incoming remote messages) from checking for remote profiles with a safe call to Ostatus_profile::staticGet() to calls through Ostatus_profile::ensureProfileURL() and Ostatus_profile::ensureWebfinger(), which throw exceptions and thus abort processing. Since this was done before checking for local groups, the filter would fail when the ensure* functions determined it was looking at a local group and rightfully refused to create a remote group profile for it. Changing the calls to the ensure* functions was done so we can record remote reply recipients for future reply-to-reply processing (the staticGet() call was a cheaper way to do a lookup when we knew we only actually had to process groups that somebody signed up to); most important fix is simply to actually check for the exception! :) Here I'm changing the order of processing so we do the local group lookup first -- where it's nice and safe -- and then when we do the remote checks, we'll go ahead and gracefully skip that entry if the full remote lookup fails, so we'll still process any following recipients. --- plugins/OStatus/classes/Ostatus_profile.php | 33 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'plugins') diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 19fe5169b..11ca67b25 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -703,23 +703,7 @@ class Ostatus_profile extends Memcached_DataObject continue; } - // Is the recipient a remote group? - $oprofile = Ostatus_profile::ensureProfileURI($recipient); - - if ($oprofile) { - if ($oprofile->isGroup()) { - // Deliver to local members of this remote group. - // @fixme sender verification? - $groups[] = $oprofile->group_id; - } else { - // may be canonicalized or something - $replies[] = $oprofile->uri; - } - continue; - } - // Is the recipient a local group? - // @fixme uri on user_group isn't reliable yet // $group = User_group::staticGet('uri', $recipient); $id = OStatusPlugin::localGroupFromUrl($recipient); if ($id) { @@ -738,7 +722,22 @@ class Ostatus_profile extends Memcached_DataObject } } - common_log(LOG_DEBUG, "Skipping reply to unrecognized profile $recipient"); + // Is the recipient a remote user or group? + try { + $oprofile = Ostatus_profile::ensureProfileURI($recipient); + if ($oprofile->isGroup()) { + // Deliver to local members of this remote group. + // @fixme sender verification? + $groups[] = $oprofile->group_id; + } else { + // may be canonicalized or something + $replies[] = $oprofile->uri; + } + continue; + } catch (Exception $e) { + // Neither a recognizable local nor remote user! + common_log(LOG_DEBUG, "Skipping reply to unrecognized profile $recipient: " . $e->getMessage()); + } } $attention_uris = $replies; -- cgit v1.2.3-54-g00ecf From ca3d803f1dd9050b850a455a47ad06c0ad3e32e7 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 10:25:13 +0200 Subject: Update i18n/L10n. --- plugins/Minify/MinifyPlugin.php | 3 +-- plugins/Minify/minify.php | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/Minify/MinifyPlugin.php b/plugins/Minify/MinifyPlugin.php index 13010e75a..6c1e49eb9 100644 --- a/plugins/Minify/MinifyPlugin.php +++ b/plugins/Minify/MinifyPlugin.php @@ -177,8 +177,7 @@ class MinifyPlugin extends Plugin 'author' => 'Craig Andrews', 'homepage' => 'http://status.net/wiki/Plugin:Minify', 'rawdescription' => - _m('The Minify plugin minifies your CSS and Javascript, removing whitespace and comments.')); + _m('The Minify plugin minifies StatusNet\'s CSS and JavaScript, removing whitespace and comments.')); return true; } } - diff --git a/plugins/Minify/minify.php b/plugins/Minify/minify.php index 64727f5e7..9a59c4223 100644 --- a/plugins/Minify/minify.php +++ b/plugins/Minify/minify.php @@ -46,11 +46,11 @@ class MinifyAction extends Action if(file_exists($this->file)) { return true; } else { - $this->clientError(_('f parameter is not a valid path'),404); + $this->clientError(_m('The parameter "f" is not a valid path.'),404); return false; } }else{ - $this->clientError(_('f parameter is required'),500); + $this->clientError(_m('The parameter "f" is required but missing.'),500); return false; } } @@ -108,10 +108,9 @@ class MinifyAction extends Action header('Content-Type: ' . self::TYPE_CSS); break; default: - $this->clientError(_('File type not supported'),500); + $this->clientError(_m('File type not supported.'),500); return false; } return $out; } } - -- cgit v1.2.3-54-g00ecf From 14fa75898330bad3fca0d57d1ad0c7fae7a6237b Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 10:30:45 +0200 Subject: Update L10n --- plugins/NoticeTitle/NoticeTitlePlugin.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/NoticeTitle/NoticeTitlePlugin.php b/plugins/NoticeTitle/NoticeTitlePlugin.php index 9f53173db..dea0417f5 100644 --- a/plugins/NoticeTitle/NoticeTitlePlugin.php +++ b/plugins/NoticeTitle/NoticeTitlePlugin.php @@ -123,7 +123,7 @@ class NoticeTitlePlugin extends Plugin 'author' => 'Evan Prodromou', 'homepage' => $url, 'rawdescription' => - _m('Adds optional titles to notices')); + _m('Adds optional titles to notices.')); return true; } @@ -164,7 +164,7 @@ class NoticeTitlePlugin extends Plugin $title = $action->trimmed('notice_title'); if (!empty($title)) { if (mb_strlen($title) > Notice_title::MAXCHARS) { - throw new Exception(sprintf(_m("Notice title too long (max %d)", + throw new Exception(sprintf(_m("The notice title is too long (max %d characters).", Notice_title::MAXCHARS))); } } @@ -296,7 +296,7 @@ class NoticeTitlePlugin extends Plugin if (!empty($title)) { $action->element('title', null, // TRANS: Page title. %1$s is the title, %2$s is the site name. - sprintf(_("%1\$s - %2\$s"), + sprintf(_m("%1\$s - %2\$s"), $title, common_config('site', 'name'))); } @@ -328,4 +328,3 @@ class NoticeTitlePlugin extends Plugin return true; } } - -- cgit v1.2.3-54-g00ecf From 90ce201684239e070039af28ee43fc0477bd41ac Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 10:32:54 +0200 Subject: Update L10n. --- plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php b/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php index 6756f1993..611f5e5c7 100644 --- a/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php +++ b/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php @@ -57,8 +57,7 @@ class OpenExternalLinkTargetPlugin extends Plugin 'author' => 'Sarven Capadisli', 'homepage' => 'http://status.net/wiki/Plugin:OpenExternalLinkTarget', 'rawdescription' => - _m('Opens external links (i.e., with rel=external) on a new window or tab')); + _m('Opens external links (e.g., with rel=external) on a new window or tab.')); return true; } } - -- cgit v1.2.3-54-g00ecf From 596d2c212ab2f808aa011269bea00222dc7e5e8e Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 10:41:13 +0200 Subject: Update i18n/L10n. --- plugins/Recaptcha/RecaptchaPlugin.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/Recaptcha/RecaptchaPlugin.php b/plugins/Recaptcha/RecaptchaPlugin.php index 7cc34c568..0c46a33e0 100644 --- a/plugins/Recaptcha/RecaptchaPlugin.php +++ b/plugins/Recaptcha/RecaptchaPlugin.php @@ -2,7 +2,7 @@ /** * StatusNet, the distributed open-source microblogging tool * - * Plugin to show reCaptcha when a user registers + * Plugin to show reCaptcha when a user registers * * PHP version 5 * @@ -61,14 +61,14 @@ class RecaptchaPlugin extends Plugin function onEndRegistrationFormData($action) { $action->elementStart('li'); - $action->raw(''); + $action->raw(''); // AJAX API will fill this div out. // We're calling that instead of the regular one so we stay compatible // with application/xml+xhtml output as for mobile. $action->element('div', array('id' => 'recaptcha')); $action->elementEnd('li'); - + $action->recaptchaPluginNeedsOutput = true; return true; } @@ -83,7 +83,7 @@ class RecaptchaPlugin extends Plugin $url = "http://api.recaptcha.net/js/recaptcha_ajax.js"; } $action->script($url); - + // And when we're ready, fill out the captcha! $key = json_encode($this->public_key); $action->inlinescript("\$(function(){Recaptcha.create($key, 'recaptcha');});"); @@ -100,9 +100,9 @@ class RecaptchaPlugin extends Plugin if (!$resp->is_valid) { if($this->display_errors) { - $action->showForm ("(reCAPTCHA error: " . $resp->error . ")"); + $action->showForm(sprintf(_("(reCAPTCHA error: %s)", $resp->error))); } - $action->showForm("Captcha does not match!"); + $action->showForm(_m("Captcha does not match!")); return false; } } -- cgit v1.2.3-54-g00ecf From eed0b24f231e9285981df1d9fe74ba612b5d4790 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 11:25:11 +0200 Subject: * i18n/L10n updates * superfluous whitespace removed --- plugins/RSSCloud/LoggingAggregator.php | 15 +++-------- plugins/RSSCloud/RSSCloudNotifier.php | 2 -- plugins/RSSCloud/RSSCloudPlugin.php | 3 +-- plugins/RSSCloud/RSSCloudQueueHandler.php | 1 - plugins/RSSCloud/RSSCloudRequestNotify.php | 40 ++++++++---------------------- plugins/RSSCloud/RSSCloudSubscription.php | 1 - 6 files changed, 16 insertions(+), 46 deletions(-) (limited to 'plugins') diff --git a/plugins/RSSCloud/LoggingAggregator.php b/plugins/RSSCloud/LoggingAggregator.php index e37eed16a..c7d7a40e3 100644 --- a/plugins/RSSCloud/LoggingAggregator.php +++ b/plugins/RSSCloud/LoggingAggregator.php @@ -47,7 +47,6 @@ if (!defined('STATUSNET')) { **/ class LoggingAggregatorAction extends Action { - var $challenge = null; var $url = null; @@ -58,7 +57,6 @@ class LoggingAggregatorAction extends Action * * @return boolean false if user doesn't exist */ - function prepare($args) { parent::prepare($args); @@ -79,22 +77,20 @@ class LoggingAggregatorAction extends Action * * @return void */ - function handle($args) { parent::handle($args); if (empty($this->url)) { - $this->showError('Hey, you have to provide a url parameter.'); + $this->showError(_('A URL parameter is required.')); return; } if (!empty($this->challenge)) { // must be a GET - if ($_SERVER['REQUEST_METHOD'] != 'GET') { - $this->showError('This resource requires an HTTP GET.'); + $this->showError(_m('This resource requires an HTTP GET.')); return; } @@ -104,9 +100,8 @@ class LoggingAggregatorAction extends Action } else { // must be a POST - if ($_SERVER['REQUEST_METHOD'] != 'POST') { - $this->showError('This resource requires an HTTP POST.'); + $this->showError(_m('This resource requires an HTTP POST.')); return; } @@ -128,7 +123,6 @@ class LoggingAggregatorAction extends Action * * @return void */ - function showError($msg) { header('HTTP/1.1 400 Bad Request'); @@ -136,5 +130,4 @@ class LoggingAggregatorAction extends Action echo "\n"; echo "\n"; } - -} \ No newline at end of file +} diff --git a/plugins/RSSCloud/RSSCloudNotifier.php b/plugins/RSSCloud/RSSCloudNotifier.php index 9e7b53680..1f0eab47e 100644 --- a/plugins/RSSCloud/RSSCloudNotifier.php +++ b/plugins/RSSCloud/RSSCloudNotifier.php @@ -235,6 +235,4 @@ class RSSCloudNotifier } } } - } - diff --git a/plugins/RSSCloud/RSSCloudPlugin.php b/plugins/RSSCloud/RSSCloudPlugin.php index c1951cdbf..bba0be515 100644 --- a/plugins/RSSCloud/RSSCloudPlugin.php +++ b/plugins/RSSCloud/RSSCloudPlugin.php @@ -247,10 +247,9 @@ class RSSCloudPlugin extends Plugin 'rawdescription' => _m('The RSSCloud plugin enables your StatusNet instance to publish ' . 'real-time updates for profile RSS feeds using the ' . - 'RSSCloud protocol".')); + 'RSSCloud protocol.')); return true; } } - diff --git a/plugins/RSSCloud/RSSCloudQueueHandler.php b/plugins/RSSCloud/RSSCloudQueueHandler.php index ef11eda2e..8a0997748 100644 --- a/plugins/RSSCloud/RSSCloudQueueHandler.php +++ b/plugins/RSSCloud/RSSCloudQueueHandler.php @@ -38,4 +38,3 @@ class RSSCloudQueueHandler extends QueueHandler return $notifier->notify($profile); } } - diff --git a/plugins/RSSCloud/RSSCloudRequestNotify.php b/plugins/RSSCloud/RSSCloudRequestNotify.php index 030529534..41b868578 100644 --- a/plugins/RSSCloud/RSSCloudRequestNotify.php +++ b/plugins/RSSCloud/RSSCloudRequestNotify.php @@ -41,7 +41,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ **/ - class RSSCloudRequestNotifyAction extends Action { /** @@ -51,7 +50,6 @@ class RSSCloudRequestNotifyAction extends Action * * @return boolean false if user doesn't exist */ - function prepare($args) { parent::prepare($args); @@ -84,13 +82,12 @@ class RSSCloudRequestNotifyAction extends Action * * @return void */ - function handle($args) { parent::handle($args); if ($_SERVER['REQUEST_METHOD'] != 'POST') { - $this->showResult(false, 'Request must be POST.'); + $this->showResult(false, _m('Request must be POST.')); return; } @@ -107,7 +104,7 @@ class RSSCloudRequestNotifyAction extends Action if (empty($this->protocol)) { $missing[] = 'protocol'; } else if (strtolower($this->protocol) != 'http-post') { - $msg = 'Only http-post notifications are supported at this time.'; + $msg = _m('Only http-post notifications are supported at this time.'); $this->showResult(false, $msg); return; } @@ -117,15 +114,15 @@ class RSSCloudRequestNotifyAction extends Action } if (!empty($missing)) { - $msg = 'The following parameters were missing from the request body: ' . - implode(', ', $missing) . '.'; + // TRANS: %s is a comma separated list of parameters. + $msg = sprintf(_m('The following parameters were missing from the request body: %s.'),implode(', ', $missing)); $this->showResult(false, $msg); return; } if (empty($this->feeds)) { - $msg = 'You must provide at least one valid profile feed url ' . - '(url1, url2, url3 ... urlN).'; + $msg = _m('You must provide at least one valid profile feed url ' . + '(url1, url2, url3 ... urlN).'); $this->showResult(false, $msg); return; } @@ -133,7 +130,6 @@ class RSSCloudRequestNotifyAction extends Action // We have to validate everything before saving anything. // We only return one success or failure no matter how // many feeds the subscriber is trying to subscribe to - foreach ($this->feeds as $feed) { if (!$this->validateFeed($feed)) { @@ -142,18 +138,17 @@ class RSSCloudRequestNotifyAction extends Action common_log(LOG_WARNING, "RSSCloud plugin - $nh tried to subscribe to invalid feed: $feed"); - $msg = 'Feed subscription failed - Not a valid feed.'; + $msg = _m('Feed subscription failed - Not a valid feed.'); $this->showResult(false, $msg); return; } if (!$this->testNotificationHandler($feed)) { - $msg = 'Feed subscription failed - ' . - 'notification handler doesn\'t respond correctly.'; + $msg = _m('Feed subscription failed - ' . + 'notification handler doesn\'t respond correctly.'); $this->showResult(false, $msg); return; } - } foreach ($this->feeds as $feed) { @@ -163,9 +158,8 @@ class RSSCloudRequestNotifyAction extends Action // XXX: What to do about deleting stale subscriptions? // 25 hours seems harsh. WordPress doesn't ever remove // subscriptions. - - $msg = 'Thanks for the subscription. ' . - 'When the feed(s) update(s) we\'ll notify you.'; + $msg = _m('Thanks for the subscription. ' . + 'When the feed(s) update(s) we\'ll notify you.'); $this->showResult(true, $msg); } @@ -178,7 +172,6 @@ class RSSCloudRequestNotifyAction extends Action * * @return void */ - function validateFeed($feed) { $user = $this->userFromFeed($feed); @@ -196,7 +189,6 @@ class RSSCloudRequestNotifyAction extends Action * * @return array $feeds the list of feeds */ - function getFeeds() { $feeds = array(); @@ -218,7 +210,6 @@ class RSSCloudRequestNotifyAction extends Action * * @return boolean success result */ - function testNotificationHandler($feed) { $notifyUrl = $this->getNotifyUrl(); @@ -226,9 +217,7 @@ class RSSCloudRequestNotifyAction extends Action $notifier = new RSSCloudNotifier(); if (isset($this->domain)) { - // 'domain' param set, so we have to use GET and send a challenge - common_log(LOG_INFO, 'RSSCloud plugin - Testing notification handler with challenge: ' . $notifyUrl); @@ -248,7 +237,6 @@ class RSSCloudRequestNotifyAction extends Action * * @return string notification handler url */ - function getNotifyUrl() { if (isset($this->domain)) { @@ -267,12 +255,10 @@ class RSSCloudRequestNotifyAction extends Action * * @return boolean success */ - function userFromFeed($feed) { // We only do canonical RSS2 profile feeds (specified by ID), e.g.: // http://www.example.com/api/statuses/user_timeline/2.rss - $path = common_path('api/statuses/user_timeline/'); $valid = '%^' . $path . '(?.*)\.rss$%'; @@ -293,7 +279,6 @@ class RSSCloudRequestNotifyAction extends Action * * @return boolean success result */ - function saveSubscription($feed) { $user = $this->userFromFeed($feed); @@ -334,7 +319,6 @@ class RSSCloudRequestNotifyAction extends Action * * @return boolean success result */ - function showResult($success, $msg) { $this->startXML(); @@ -343,6 +327,4 @@ class RSSCloudRequestNotifyAction extends Action 'msg' => $msg)); $this->endXML(); } - } - diff --git a/plugins/RSSCloud/RSSCloudSubscription.php b/plugins/RSSCloud/RSSCloudSubscription.php index 396c604e7..595af8844 100644 --- a/plugins/RSSCloud/RSSCloudSubscription.php +++ b/plugins/RSSCloud/RSSCloudSubscription.php @@ -75,5 +75,4 @@ class RSSCloudSubscription extends Memcached_DataObject { return false; } - } -- cgit v1.2.3-54-g00ecf From 11a98ea41f0702defad84a7923e91afa5aa35b72 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 11:27:37 +0200 Subject: * L10n update * superfluous whitespace removed. --- plugins/TinyMCE/TinyMCEPlugin.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/TinyMCE/TinyMCEPlugin.php b/plugins/TinyMCE/TinyMCEPlugin.php index ca16f6059..2ec4b7160 100644 --- a/plugins/TinyMCE/TinyMCEPlugin.php +++ b/plugins/TinyMCE/TinyMCEPlugin.php @@ -48,7 +48,6 @@ if (!defined('STATUSNET')) { */ class TinyMCEPlugin extends Plugin { - var $html; function onEndShowScripts($action) @@ -74,7 +73,7 @@ class TinyMCEPlugin extends Plugin 'author' => 'Evan Prodromou', 'homepage' => 'http://status.net/wiki/Plugin:TinyMCE', 'rawdescription' => - _m('Use TinyMCE library to allow rich text editing in the browser')); + _m('Use TinyMCE library to allow rich text editing in the browser.')); return true; } @@ -108,7 +107,7 @@ class TinyMCEPlugin extends Plugin /** * Hook for new-notice form processing to take our HTML goodies; * won't affect API posting etc. - * + * * @param NewNoticeAction $action * @param User $user * @param string $content @@ -159,9 +158,9 @@ class TinyMCEPlugin extends Plugin /** * Format the attachment placeholder img with the final version. - * + * * @param DOMElement $img - * @param MediaFile $media + * @param MediaFile $media */ private function formatAttachment($img, $media) { @@ -321,5 +320,4 @@ END_OF_SCRIPT; return $scr; } - } -- cgit v1.2.3-54-g00ecf From b99b0555fdfbaac36213b7c342cc2fb5eca1b583 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 11:36:40 +0200 Subject: Update L10n. --- plugins/TabFocus/TabFocusPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/TabFocus/TabFocusPlugin.php b/plugins/TabFocus/TabFocusPlugin.php index 46e329d8a..dd8a97276 100644 --- a/plugins/TabFocus/TabFocusPlugin.php +++ b/plugins/TabFocus/TabFocusPlugin.php @@ -51,7 +51,7 @@ class TabFocusPlugin extends Plugin 'author' => 'Craig Andrews and Paul Irish', 'homepage' => 'http://status.net/wiki/Plugin:TabFocus', 'rawdescription' => - _m('TabFocus changes the notice form behavior so that, while in the text area, pressing the tab key focuses the "Send" button, matching the behavor of Twitter.')); + _m('TabFocus changes the notice form behavior so that, while in the text area, pressing the tab key focuses the "Send" button, matching the behavior of Twitter.')); return true; } } -- cgit v1.2.3-54-g00ecf From 2d119df6d392699e46556780d1fdc17f4c424e3a Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 11:43:17 +0200 Subject: * update i18n/L10n * remove superfluous whitespace --- plugins/Imap/ImapPlugin.php | 8 ++++---- plugins/Imap/imapmanager.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/Imap/ImapPlugin.php b/plugins/Imap/ImapPlugin.php index 66be799d3..1661ed86e 100644 --- a/plugins/Imap/ImapPlugin.php +++ b/plugins/Imap/ImapPlugin.php @@ -51,16 +51,16 @@ class ImapPlugin extends Plugin function initialize(){ if(!isset($this->mailbox)){ - throw new Exception("must specify a mailbox"); + throw new Exception(_m("A mailbox must be specified.")); } if(!isset($this->user)){ - throw new Exception("must specify a user"); + throw new Exception(_m("A user must be specified."); } if(!isset($this->password)){ - throw new Exception("must specify a password"); + throw new Exception(_m("A password must be specified.")); } if(!isset($this->poll_frequency)){ - throw new Exception("must specify a poll_frequency"); + throw new Exception(_m("A poll_frequency must be specified.")); } return true; diff --git a/plugins/Imap/imapmanager.php b/plugins/Imap/imapmanager.php index 0bbd42e78..68b8b7d87 100644 --- a/plugins/Imap/imapmanager.php +++ b/plugins/Imap/imapmanager.php @@ -92,12 +92,12 @@ class ImapManager extends IoManager { return $this->check_mailbox() > 0; } - + function pollInterval() { return $this->plugin->poll_frequency; } - + protected function connect() { $this->conn = imap_open($this->plugin->mailbox, $this->plugin->user, $this->plugin->password); -- cgit v1.2.3-54-g00ecf From f0716819ec206e6b407c7cefcc463e946127bacf Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 11:45:50 +0200 Subject: * update i18n/L10n * remove superfluous whitespace --- plugins/ClientSideShorten/ClientSideShortenPlugin.php | 4 +--- plugins/ClientSideShorten/shorten.php | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/ClientSideShorten/ClientSideShortenPlugin.php b/plugins/ClientSideShorten/ClientSideShortenPlugin.php index 57f5ad89e..27a3a56f7 100644 --- a/plugins/ClientSideShorten/ClientSideShortenPlugin.php +++ b/plugins/ClientSideShorten/ClientSideShortenPlugin.php @@ -71,9 +71,7 @@ class ClientSideShortenPlugin extends Plugin 'author' => 'Craig Andrews', 'homepage' => 'http://status.net/wiki/Plugin:ClientSideShorten', 'rawdescription' => - _m('ClientSideShorten causes the web interface\'s notice form to automatically shorten urls as they entered, and before the notice is submitted.')); + _m('ClientSideShorten causes the web interface\'s notice form to automatically shorten URLs as they entered, and before the notice is submitted.')); return true; } - } - diff --git a/plugins/ClientSideShorten/shorten.php b/plugins/ClientSideShorten/shorten.php index f67cbf3b2..8c2fc1b3c 100644 --- a/plugins/ClientSideShorten/shorten.php +++ b/plugins/ClientSideShorten/shorten.php @@ -66,4 +66,3 @@ class ShortenAction extends Action print $shortened_text; } } - -- cgit v1.2.3-54-g00ecf From 1ee1f6621f16140c332eec796fb9a344192393f6 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 11:50:27 +0200 Subject: * update i18n/L10n * remove superfluous whitespace --- plugins/RegisterThrottle/RegisterThrottlePlugin.php | 3 +-- plugins/RegisterThrottle/Registration_ip.php | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) (limited to 'plugins') diff --git a/plugins/RegisterThrottle/RegisterThrottlePlugin.php b/plugins/RegisterThrottle/RegisterThrottlePlugin.php index 05709b780..89c1d3d00 100644 --- a/plugins/RegisterThrottle/RegisterThrottlePlugin.php +++ b/plugins/RegisterThrottle/RegisterThrottlePlugin.php @@ -113,7 +113,6 @@ class RegisterThrottlePlugin extends Plugin * @return boolean hook value * */ - function onStartRegistrationTry($action) { $ipaddress = $this->_getIpAddress(); @@ -134,7 +133,7 @@ class RegisterThrottlePlugin extends Plugin $now = time(); $this->debug("Comparing {$regtime} to {$now}"); if ($now - $regtime < $seconds) { - throw new Exception(_("Too many registrations. Take a break and try again later.")); + throw new Exception(_m("Too many registrations. Take a break and try again later.")); } } } diff --git a/plugins/RegisterThrottle/Registration_ip.php b/plugins/RegisterThrottle/Registration_ip.php index 7e61d089e..5c7396b9b 100644 --- a/plugins/RegisterThrottle/Registration_ip.php +++ b/plugins/RegisterThrottle/Registration_ip.php @@ -42,7 +42,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ - class Registration_ip extends Memcached_DataObject { public $__table = 'registration_ip'; // table name @@ -59,7 +58,6 @@ class Registration_ip extends Memcached_DataObject * @return User_greeting_count object found, or null for no hits * */ - function staticGet($k, $v=null) { return Memcached_DataObject::staticGet('Registration_ip', $k, $v); @@ -70,7 +68,6 @@ class Registration_ip extends Memcached_DataObject * * @return array array of column definitions */ - function table() { return array('user_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, @@ -86,7 +83,6 @@ class Registration_ip extends Memcached_DataObject * * @return array key definitions */ - function keys() { return array('user_id' => 'K'); @@ -100,7 +96,6 @@ class Registration_ip extends Memcached_DataObject * * @return array key definitions */ - function keyTypes() { return $this->keys(); @@ -116,7 +111,6 @@ class Registration_ip extends Memcached_DataObject * * @return array magic three-false array that stops auto-incrementing. */ - function sequenceKey() { return array(false, false, false); -- cgit v1.2.3-54-g00ecf From 26a9963dad3e7bbea6f5f7069f2272a58ee87891 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 11:52:35 +0200 Subject: Update L10n. --- plugins/RegisterThrottle/RegisterThrottlePlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/RegisterThrottle/RegisterThrottlePlugin.php b/plugins/RegisterThrottle/RegisterThrottlePlugin.php index 89c1d3d00..b6e9a9026 100644 --- a/plugins/RegisterThrottle/RegisterThrottlePlugin.php +++ b/plugins/RegisterThrottle/RegisterThrottlePlugin.php @@ -196,7 +196,7 @@ class RegisterThrottlePlugin extends Plugin 'author' => 'Evan Prodromou', 'homepage' => 'http://status.net/wiki/Plugin:RegisterThrottle', 'description' => - _m('Throttles excessive registration from a single IP.')); + _m('Throttles excessive registration from a single IP address.')); return true; } -- cgit v1.2.3-54-g00ecf From f8e91ab33f414e0c0ffbb4d6f312909d196413ce Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 12:05:27 +0200 Subject: Add translator hints. --- plugins/AutoSandbox/AutoSandboxPlugin.php | 1 + plugins/PoweredByStatusNet/PoweredByStatusNetPlugin.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/AutoSandbox/AutoSandboxPlugin.php b/plugins/AutoSandbox/AutoSandboxPlugin.php index 870eda86f..16683e140 100644 --- a/plugins/AutoSandbox/AutoSandboxPlugin.php +++ b/plugins/AutoSandbox/AutoSandboxPlugin.php @@ -75,6 +75,7 @@ class AutoSandboxPlugin extends Plugin $contactuser = User::staticGet('nickname', $this->contact); if (!empty($contactuser)) { $contactlink = "@uri\">$contactuser->nickname"; + // TRANS: $contactlink is a clickable e-mailaddress. $instr = _m("Note you will initially be \"sandboxed\" so your posts will not appear in the public timeline. ". 'Send a message to $contactlink to speed up the unsandboxing process.'); } diff --git a/plugins/PoweredByStatusNet/PoweredByStatusNetPlugin.php b/plugins/PoweredByStatusNet/PoweredByStatusNetPlugin.php index fb4eff738..f2e2fcbaf 100644 --- a/plugins/PoweredByStatusNet/PoweredByStatusNetPlugin.php +++ b/plugins/PoweredByStatusNet/PoweredByStatusNetPlugin.php @@ -47,6 +47,7 @@ class PoweredByStatusNetPlugin extends Plugin { $action->text(' '); $action->elementStart('span', 'poweredby'); + // TRANS: %s is a URL to status.net with "StatusNet" (localised) as link text. $action->raw(sprintf(_m('powered by %s'), sprintf('%s', _m('StatusNet')))); @@ -62,7 +63,7 @@ class PoweredByStatusNetPlugin extends Plugin 'author' => 'Sarven Capadisli', 'homepage' => 'http://status.net/wiki/Plugin:PoweredByStatusNet', 'rawdescription' => - _m('Outputs powered by StatusNet after site name.')); + _m('Outputs "powered by StatusNet" after site name.')); return true; } } -- cgit v1.2.3-54-g00ecf From 03e600b797e2ca4dc918143325cc0961949f2f55 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 14:31:03 +0200 Subject: Update i18n/L10n --- .../CasAuthentication/CasAuthenticationPlugin.php | 22 +++++++++++++--------- plugins/CasAuthentication/caslogin.php | 5 ++--- 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'plugins') diff --git a/plugins/CasAuthentication/CasAuthenticationPlugin.php b/plugins/CasAuthentication/CasAuthenticationPlugin.php index 1662db3eb..6b751a0aa 100644 --- a/plugins/CasAuthentication/CasAuthenticationPlugin.php +++ b/plugins/CasAuthentication/CasAuthenticationPlugin.php @@ -79,8 +79,10 @@ class CasAuthenticationPlugin extends AuthenticationPlugin $action_name = $action->trimmed('action'); $action->menuItem(common_local_url('caslogin'), + // TRANS: Menu item. CAS is Central Authentication Service. _m('CAS'), - _m('Login or register with CAS'), + // TRANS: Tooltip for menu item. CAS is Central Authentication Service. + _m('Login or register with CAS.'), $action_name === 'caslogin'); return true; @@ -93,9 +95,11 @@ class CasAuthenticationPlugin extends AuthenticationPlugin switch ($name) { case 'login': - $instr = '(Have an account with CAS? ' . - 'Try our [CAS login]'. - '(%%action.caslogin%%)!)'; + // TRANS: Invitation to users with a CAS account to log in using the service. + // TRANS: "[CAS login]" is a link description. (%%action.caslogin%%) is the URL. + // TRANS: These two elements may not be separated. + $instr = _m('(Have an account with CAS? ' . + 'Try our [CAS login](%%action.caslogin%%)!)'); break; default: return true; @@ -121,13 +125,13 @@ class CasAuthenticationPlugin extends AuthenticationPlugin function onInitializePlugin(){ parent::onInitializePlugin(); if(!isset($this->server)){ - throw new Exception("must specify a server"); + throw new Exception(_m("Specifying a server is required."); } if(!isset($this->port)){ - throw new Exception("must specify a port"); + throw new Exception(_m("Specifying a port is required."); } if(!isset($this->path)){ - throw new Exception("must specify a path"); + throw new Exception(_m("Specifying a path is required."); } //These values need to be accessible to a action object //I can't think of any other way than global variables @@ -146,8 +150,8 @@ class CasAuthenticationPlugin extends AuthenticationPlugin 'version' => STATUSNET_VERSION, 'author' => 'Craig Andrews', 'homepage' => 'http://status.net/wiki/Plugin:CasAuthentication', - 'rawdescription' => - _m('The CAS Authentication plugin allows for StatusNet to handle authentication through CAS (Central Authentication Service).')); + // TRANS: Plugin description. CAS is Central Authentication Service. + 'rawdescription' => _m('The CAS Authentication plugin allows for StatusNet to handle authentication through CAS (Central Authentication Service).')); return true; } } diff --git a/plugins/CasAuthentication/caslogin.php b/plugins/CasAuthentication/caslogin.php index a66774dc1..846774e7c 100644 --- a/plugins/CasAuthentication/caslogin.php +++ b/plugins/CasAuthentication/caslogin.php @@ -36,13 +36,13 @@ class CasloginAction extends Action $casTempPassword = common_good_rand(16); $user = common_check_user(phpCAS::getUser(), $casTempPassword); if (!$user) { - $this->serverError(_('Incorrect username or password.')); + $this->serverError(_m('Incorrect username or password.')); return; } // success! if (!common_set_user($user)) { - $this->serverError(_('Error setting user. You are probably not authorized.')); + $this->serverError(_m('Error setting user. You are probably not authorized.')); return; } @@ -69,7 +69,6 @@ class CasloginAction extends Action } common_redirect($url, 303); - } } } -- cgit v1.2.3-54-g00ecf From 09c99461e5dfeba443398c4c7b38c35104328b5e Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 14:35:04 +0200 Subject: * update L10n * remove superfluous whitespace --- plugins/WikiHowProfile/WikiHowProfilePlugin.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'plugins') diff --git a/plugins/WikiHowProfile/WikiHowProfilePlugin.php b/plugins/WikiHowProfile/WikiHowProfilePlugin.php index b72bd55d6..fa683c483 100644 --- a/plugins/WikiHowProfile/WikiHowProfilePlugin.php +++ b/plugins/WikiHowProfile/WikiHowProfilePlugin.php @@ -47,7 +47,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ - class WikiHowProfilePlugin extends Plugin { function onPluginVersion(&$versions) @@ -57,7 +56,7 @@ class WikiHowProfilePlugin extends Plugin 'author' => 'Brion Vibber', 'homepage' => 'http://status.net/wiki/Plugin:Sample', 'rawdescription' => - _m('Fetches avatar and other profile info for WikiHow users when setting up an account via OpenID.')); + _m('Fetches avatar and other profile information for WikiHow users when setting up an account via OpenID.')); return true; } @@ -107,14 +106,14 @@ class WikiHowProfilePlugin extends Plugin /** * Given a user's WikiHow profile URL, find their avatar. - * + * * @param string $profileUrl user page on the wiki - * + * * @return array of data; possible members: * 'avatar' => full URL to avatar image - * + * * @throws Exception on various low-level failures - * + * * @todo pull location, web site, and about sections -- they aren't currently marked up cleanly. */ private function fetchProfile($profileUrl) @@ -169,14 +168,14 @@ class WikiHowProfilePlugin extends Plugin private function saveAvatar($user, $url) { if (!common_valid_http_url($url)) { - throw new ServerException(sprintf(_m("Invalid avatar URL %s"), $url)); + throw new ServerException(sprintf(_m("Invalid avatar URL %s."), $url)); } // @fixme this should be better encapsulated // ripped from OStatus via oauthstore.php (for old OMB client) $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar'); if (!copy($url, $temp_filename)) { - throw new ServerException(sprintf(_m("Unable to fetch avatar from %s"), $url)); + throw new ServerException(sprintf(_m("Unable to fetch avatar from %s."), $url)); } $profile = $user->getProfile(); @@ -191,6 +190,4 @@ class WikiHowProfilePlugin extends Plugin rename($temp_filename, Avatar::path($filename)); $profile->setOriginal($filename); } - } - -- cgit v1.2.3-54-g00ecf From 977472bcf69e20e795bc697e9f839c261a17a5a8 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 14:39:06 +0200 Subject: remove superfluous whitespace --- plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins') diff --git a/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php b/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php index af75b96e0..719dba89c 100644 --- a/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php +++ b/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php @@ -170,4 +170,3 @@ class RequireValidatedEmailPlugin extends Plugin return true; } } - -- cgit v1.2.3-54-g00ecf From 34f95c26fd9f51c730d05287d5b201a6cbedc285 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 15:10:49 +0200 Subject: * FIXME/CHECKMEs added for (possible) bad i18n * translator hints added * superfluous whitespace removed --- plugins/Mapstraction/MapstractionPlugin.php | 8 ++------ plugins/Mapstraction/allmap.php | 9 +++++++-- plugins/Mapstraction/map.php | 2 -- plugins/Mapstraction/usermap.php | 7 ++++--- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'plugins') diff --git a/plugins/Mapstraction/MapstractionPlugin.php b/plugins/Mapstraction/MapstractionPlugin.php index e7240a644..c4ba6464e 100644 --- a/plugins/Mapstraction/MapstractionPlugin.php +++ b/plugins/Mapstraction/MapstractionPlugin.php @@ -44,7 +44,6 @@ if (!defined('STATUSNET')) { * * @seeAlso Location */ - class MapstractionPlugin extends Plugin { const VERSION = STATUSNET_VERSION; @@ -64,7 +63,6 @@ class MapstractionPlugin extends Plugin * * @return boolean event handler return */ - function onRouterInitialized($m) { $m->connect(':nickname/all/map', @@ -85,7 +83,6 @@ class MapstractionPlugin extends Plugin * * @return boolean event handler return */ - function onAutoload($cls) { switch ($cls) @@ -109,7 +106,6 @@ class MapstractionPlugin extends Plugin * * @return boolean event handler return */ - function onEndShowScripts($action) { $actionName = $action->trimmed('action'); @@ -190,6 +186,7 @@ class MapstractionPlugin extends Plugin array('nickname' => $action->trimmed('nickname'))); $action->element('a', array('href' => $mapUrl), + // TRANS: Clickable item to allow opening the map in full size. _m("Full size")); $action->elementEnd('div'); @@ -203,8 +200,7 @@ class MapstractionPlugin extends Plugin 'homepage' => 'http://status.net/wiki/Plugin:Mapstraction', 'rawdescription' => _m('Show maps of users\' and friends\' notices '. - 'with Mapstraction '. - 'JavaScript library.')); + 'with Mapstraction.')); return true; } } diff --git a/plugins/Mapstraction/allmap.php b/plugins/Mapstraction/allmap.php index 5dab670e2..fa05ccc7a 100644 --- a/plugins/Mapstraction/allmap.php +++ b/plugins/Mapstraction/allmap.php @@ -42,7 +42,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class AllmapAction extends MapAction { function prepare($args) @@ -63,16 +62,22 @@ class AllmapAction extends MapAction function title() { if (!empty($this->profile->fullname)) { + // @todo FIXME: Bad i18n. Should be "%1$s (%2$s)". $base = $this->profile->fullname . ' (' . $this->user->nickname . ') '; } else { $base = $this->user->nickname; } if ($this->page == 1) { + // TRANS: Page title. + // TRANS: %s is a user nickname. return sprintf(_m("%s friends map"), $base); } else { - return sprintf(_m("%s friends map, page %d"), + // @todo CHECKME: does this even happen? May not be needed. + // TRANS: Page title. + // TRANS: %1$s is a user nickname, %2$d is a page number. + return sprintf(_m("%1$s friends map, page %2$d"), $base, $this->page); } diff --git a/plugins/Mapstraction/map.php b/plugins/Mapstraction/map.php index 7dab8e10a..50ff82b67 100644 --- a/plugins/Mapstraction/map.php +++ b/plugins/Mapstraction/map.php @@ -42,7 +42,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class MapAction extends OwnerDesignAction { var $profile = null; @@ -116,7 +115,6 @@ class MapAction extends OwnerDesignAction * * @return boolean event handler return */ - function showScripts() { parent::showScripts(); diff --git a/plugins/Mapstraction/usermap.php b/plugins/Mapstraction/usermap.php index 094334f60..0ee956159 100644 --- a/plugins/Mapstraction/usermap.php +++ b/plugins/Mapstraction/usermap.php @@ -42,10 +42,8 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class UsermapAction extends MapAction { - function prepare($args) { if(parent::prepare($args)) { @@ -61,14 +59,17 @@ class UsermapAction extends MapAction function title() { if (!empty($this->profile->fullname)) { - $base = $this->profile->fullname . ' (' . $this->user->nickname . ') '; + // @todo FIXME: Bad i18n. Should be '%1$s (%2$s)' + $base = $this->profile->fullname . ' (' . $this->user->nickname . ')'; } else { $base = $this->user->nickname; } if ($this->page == 1) { + // @todo CHECKME: inconsisten with paged variant below. " map" missing. return $base; } else { + // @todo CHECKME: Is the part ", page %2$d" relevant here? return sprintf(_m("%s map, page %d"), $base, $this->page); -- cgit v1.2.3-54-g00ecf From edb411b4aeec6a19f5d127b619bdbe108b01f264 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 15:23:17 +0200 Subject: * L10n updates and translator documentation added. * superfluous whitespace removed. --- plugins/Sample/SamplePlugin.php | 8 -------- plugins/Sample/User_greeting_count.php | 16 ++++++---------- 2 files changed, 6 insertions(+), 18 deletions(-) (limited to 'plugins') diff --git a/plugins/Sample/SamplePlugin.php b/plugins/Sample/SamplePlugin.php index 913741226..ef69121a9 100644 --- a/plugins/Sample/SamplePlugin.php +++ b/plugins/Sample/SamplePlugin.php @@ -101,7 +101,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ - class SamplePlugin extends Plugin { /** @@ -129,7 +128,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function initialize() { return true; @@ -143,7 +141,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function cleanup() { return true; @@ -168,7 +165,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function onCheckSchema() { $schema = Schema::get(); @@ -201,7 +197,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function onAutoload($cls) { $dir = dirname(__FILE__); @@ -231,7 +226,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function onRouterInitialized($m) { $m->connect('main/hello', @@ -256,7 +250,6 @@ class SamplePlugin extends Plugin * * @see Action */ - function onEndPrimaryNav($action) { // common_local_url() gets the correct URL for the action name @@ -278,4 +271,3 @@ class SamplePlugin extends Plugin return true; } } - diff --git a/plugins/Sample/User_greeting_count.php b/plugins/Sample/User_greeting_count.php index fc0cbd28f..38d68c91e 100644 --- a/plugins/Sample/User_greeting_count.php +++ b/plugins/Sample/User_greeting_count.php @@ -70,7 +70,6 @@ class User_greeting_count extends Memcached_DataObject * @return User_greeting_count object found, or null for no hits * */ - function staticGet($k, $v=null) { return Memcached_DataObject::staticGet('User_greeting_count', $k, $v); @@ -84,7 +83,6 @@ class User_greeting_count extends Memcached_DataObject * * @return array array of column definitions */ - function table() { return array('user_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, @@ -100,7 +98,6 @@ class User_greeting_count extends Memcached_DataObject * * @return array list of key field names */ - function keys() { return array_keys($this->keyTypes()); @@ -118,7 +115,6 @@ class User_greeting_count extends Memcached_DataObject * 'K' for primary key: for compound keys, add an entry for each component; * 'U' for unique keys: compound keys are not well supported here. */ - function keyTypes() { return array('user_id' => 'K'); @@ -134,7 +130,6 @@ class User_greeting_count extends Memcached_DataObject * * @return array magic three-false array that stops auto-incrementing. */ - function sequenceKey() { return array(false, false, false); @@ -150,7 +145,6 @@ class User_greeting_count extends Memcached_DataObject * * @return User_greeting_count instance for this user, with count already incremented. */ - static function inc($user_id) { $gc = User_greeting_count::staticGet('user_id', $user_id); @@ -165,12 +159,12 @@ class User_greeting_count extends Memcached_DataObject $result = $gc->insert(); if (!$result) { - throw Exception(sprintf(_m("Could not save new greeting count for %d"), + // TRANS: Exception thrown when the user greeting count could not be saved in the database. + // TRANS: %d is a user ID (number). + throw Exception(sprintf(_m("Could not save new greeting count for %d."), $user_id)); } - } else { - $orig = clone($gc); $gc->greeting_count++; @@ -178,7 +172,9 @@ class User_greeting_count extends Memcached_DataObject $result = $gc->update($orig); if (!$result) { - throw Exception(sprintf(_m("Could not increment greeting count for %d"), + // TRANS: Exception thrown when the user greeting count could not be saved in the database. + // TRANS: %d is a user ID (number). + throw Exception(sprintf(_m("Could not increment greeting count for %d."), $user_id)); } } -- cgit v1.2.3-54-g00ecf From 52ccc8e521d47713643f558daf93855a875a6c73 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 15:26:48 +0200 Subject: * update L10n * remove superfluous whitespace --- plugins/Sample/hello.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/Sample/hello.php b/plugins/Sample/hello.php index dfbd0ad4f..a793ac6de 100644 --- a/plugins/Sample/hello.php +++ b/plugins/Sample/hello.php @@ -46,7 +46,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ - class HelloAction extends Action { var $user = null; @@ -67,7 +66,6 @@ class HelloAction extends Action * * @return boolean success flag */ - function prepare($args) { parent::prepare($args); @@ -93,7 +91,6 @@ class HelloAction extends Action * * @return void */ - function handle($args) { parent::handle($args); @@ -108,13 +105,12 @@ class HelloAction extends Action * * @return string Title of the page */ - function title() { if (empty($this->user)) { return _m('Hello'); } else { - return sprintf(_m('Hello, %s'), $this->user->nickname); + return sprintf(_m('Hello, %s!'), $this->user->nickname); } } @@ -130,7 +126,6 @@ class HelloAction extends Action * * @return void */ - function showContent() { if (empty($this->user)) { @@ -162,7 +157,6 @@ class HelloAction extends Action * * @return boolean is read only action? */ - function isReadOnly($args) { return false; -- cgit v1.2.3-54-g00ecf From 326e351d448382ae85588f1d7d69e7bf507eebe4 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 15:38:15 +0200 Subject: Fix typo. --- plugins/Blacklist/BlacklistPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/Blacklist/BlacklistPlugin.php b/plugins/Blacklist/BlacklistPlugin.php index 000834838..bc8b82492 100644 --- a/plugins/Blacklist/BlacklistPlugin.php +++ b/plugins/Blacklist/BlacklistPlugin.php @@ -231,7 +231,7 @@ class BlacklistPlugin extends Plugin $url = htmlspecialchars_decode($url); if (!$this->_checkUrl($url)) { - $msg = sprintf(_m("You may not use UTL \"%s\" in notices."), + $msg = sprintf(_m("You may not use URL \"%s\" in notices."), $url); throw new ClientException($msg); } -- cgit v1.2.3-54-g00ecf From cfe60815bc5e96a7711cd836ab829d297aaba269 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 17:14:00 +0200 Subject: Remove superfluous whitespace. --- plugins/Gravatar/GravatarPlugin.php | 18 +++++++++--------- plugins/Gravatar/README | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'plugins') diff --git a/plugins/Gravatar/GravatarPlugin.php b/plugins/Gravatar/GravatarPlugin.php index 8a9721ea9..208262d0e 100644 --- a/plugins/Gravatar/GravatarPlugin.php +++ b/plugins/Gravatar/GravatarPlugin.php @@ -34,17 +34,17 @@ class GravatarPlugin extends Plugin { return true; } - + function onStartAvatarFormData($action) { $user = common_current_user(); $hasGravatar = $this->hasGravatar($user->id); - + if($hasGravatar) { return false; } } - + function onEndAvatarFormData($action) { $user = common_current_user(); @@ -91,7 +91,7 @@ class GravatarPlugin extends Plugin _m('To use a Gravatar first enter in an email address.')); } } - + function onStartAvatarSaveForm($action) { if ($action->arg('add')) { @@ -131,19 +131,19 @@ class GravatarPlugin extends Plugin } return false; } - + function gravatar_save() { $cur = common_current_user(); - + if(empty($cur->email)) { return array('message' => _m('You do not have a email set in your profile.'), 'success' => false); } //Get rid of previous Avatar $this->gravatar_remove(); - + foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) { $gravatar = new Avatar(); $gravatar->profile_id = $cur->id; @@ -181,7 +181,7 @@ class GravatarPlugin extends Plugin return array('message' => _m('Gravatar removed.'), 'success' => true); } - + function gravatar_url($email, $size) { $url = "http://www.gravatar.com/avatar.php?gravatar_id=". @@ -202,4 +202,4 @@ class GravatarPlugin extends Plugin return true; } -} \ No newline at end of file +} diff --git a/plugins/Gravatar/README b/plugins/Gravatar/README index 9337e24a0..263904808 100644 --- a/plugins/Gravatar/README +++ b/plugins/Gravatar/README @@ -10,4 +10,4 @@ addPlugin('Gravatar', array()); ToDo: Site default all on for gravatar by default Migration Script -Localize \ No newline at end of file +Localize -- cgit v1.2.3-54-g00ecf From 1c5e00df3035b2f0280ad98d028742adef2b09c4 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 17:16:48 +0200 Subject: Fix typo. --- plugins/Gravatar/GravatarPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/Gravatar/GravatarPlugin.php b/plugins/Gravatar/GravatarPlugin.php index 208262d0e..f415541bf 100644 --- a/plugins/Gravatar/GravatarPlugin.php +++ b/plugins/Gravatar/GravatarPlugin.php @@ -138,7 +138,7 @@ class GravatarPlugin extends Plugin $cur = common_current_user(); if(empty($cur->email)) { - return array('message' => _m('You do not have a email set in your profile.'), + return array('message' => _m('You do not have a email address set in your profile.'), 'success' => false); } //Get rid of previous Avatar -- cgit v1.2.3-54-g00ecf From ba6538ed78df3049fa59aed0855b0e3af54c994f Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 18 Sep 2010 17:45:18 +0200 Subject: * i18n/L10n updates * whitespace updates. --- plugins/TwitterBridge/TwitterBridgePlugin.php | 13 +---- plugins/TwitterBridge/Twitter_synch_status.php | 10 ---- .../TwitterBridge/daemons/synctwitterfriends.php | 7 --- .../TwitterBridge/daemons/twitterstatusfetcher.php | 24 +-------- plugins/TwitterBridge/twitter.php | 7 --- plugins/TwitterBridge/twitteradminpanel.php | 14 +---- plugins/TwitterBridge/twitterauthorization.php | 59 +++++++++++----------- plugins/TwitterBridge/twitterlogin.php | 9 ++-- plugins/TwitterBridge/twitteroauthclient.php | 1 - plugins/TwitterBridge/twittersettings.php | 8 +-- 10 files changed, 39 insertions(+), 113 deletions(-) (limited to 'plugins') diff --git a/plugins/TwitterBridge/TwitterBridgePlugin.php b/plugins/TwitterBridge/TwitterBridgePlugin.php index 34b82ef83..94d4d9e47 100644 --- a/plugins/TwitterBridge/TwitterBridgePlugin.php +++ b/plugins/TwitterBridge/TwitterBridgePlugin.php @@ -45,7 +45,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php'; * @link http://status.net/ * @link http://twitter.com/ */ - class TwitterBridgePlugin extends Plugin { @@ -55,7 +54,6 @@ class TwitterBridgePlugin extends Plugin /** * Initializer for the plugin. */ - function initialize() { // Allow the key and secret to be passed in @@ -86,7 +84,6 @@ class TwitterBridgePlugin extends Plugin * * @return boolean result */ - static function hasKeys() { $ckey = common_config('twitter', 'consumer_key'); @@ -113,7 +110,6 @@ class TwitterBridgePlugin extends Plugin * * @return boolean hook return */ - function onRouterInitialized($m) { $m->connect('admin/twitter', array('action' => 'twitteradminpanel')); @@ -310,7 +306,6 @@ class TwitterBridgePlugin extends Plugin * * @return boolean hook value */ - function onPluginVersion(&$versions) { $versions[] = array( @@ -319,8 +314,8 @@ class TwitterBridgePlugin extends Plugin 'author' => 'Zach Copley, Julien C', 'homepage' => 'http://status.net/wiki/Plugin:TwitterBridge', 'rawdescription' => _m( - 'The Twitter "bridge" plugin allows you to integrate ' . - 'your StatusNet instance with ' . + 'The Twitter "bridge" plugin allows integration ' . + 'of a StatusNet instance with ' . 'Twitter.' ) ); @@ -374,7 +369,6 @@ class TwitterBridgePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function onCheckSchema() { $schema = Schema::get(); @@ -416,7 +410,6 @@ class TwitterBridgePlugin extends Plugin * * @return boolean hook value */ - function onStartDeleteOwnNotice(User $user, Notice $notice) { $n2s = Notice_to_status::staticGet('notice_id', $notice->id); @@ -452,7 +445,6 @@ class TwitterBridgePlugin extends Plugin * @param Notice $notice being favored * @return hook return value */ - function onEndFavorNotice(Profile $profile, Notice $notice) { $flink = Foreign_link::getByUserID($profile->id, @@ -489,7 +481,6 @@ class TwitterBridgePlugin extends Plugin * * @return hook return value */ - function onEndDisfavorNotice(Profile $profile, Notice $notice) { $flink = Foreign_link::getByUserID($profile->id, diff --git a/plugins/TwitterBridge/Twitter_synch_status.php b/plugins/TwitterBridge/Twitter_synch_status.php index 2a5f1fd60..a8337862c 100644 --- a/plugins/TwitterBridge/Twitter_synch_status.php +++ b/plugins/TwitterBridge/Twitter_synch_status.php @@ -48,7 +48,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ - class Twitter_synch_status extends Memcached_DataObject { public $__table = 'twitter_synch_status'; // table name @@ -67,7 +66,6 @@ class Twitter_synch_status extends Memcached_DataObject * @return Twitter_synch_status object found, or null for no hits * */ - function staticGet($k, $v=null) { throw new Exception("Use pkeyGet() for this class."); @@ -81,7 +79,6 @@ class Twitter_synch_status extends Memcached_DataObject * @return Twitter_synch_status object found, or null for no hits * */ - function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Twitter_synch_status', $kv); @@ -95,7 +92,6 @@ class Twitter_synch_status extends Memcached_DataObject * * @return array array of column definitions */ - function table() { return array('foreign_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, @@ -115,7 +111,6 @@ class Twitter_synch_status extends Memcached_DataObject * * @return array list of key field names */ - function keys() { return array_keys($this->keyTypes()); @@ -133,7 +128,6 @@ class Twitter_synch_status extends Memcached_DataObject * 'K' for primary key: for compound keys, add an entry for each component; * 'U' for unique keys: compound keys are not well supported here. */ - function keyTypes() { return array('foreign_id' => 'K', @@ -150,7 +144,6 @@ class Twitter_synch_status extends Memcached_DataObject * * @return array magic three-false array that stops auto-incrementing. */ - function sequenceKey() { return array(false, false, false); @@ -174,7 +167,6 @@ class Twitter_synch_status extends Memcached_DataObject 'timeline' => $timeline)); if (empty($tss)) { - $tss = new Twitter_synch_status(); $tss->foreign_id = $foreign_id; @@ -186,9 +178,7 @@ class Twitter_synch_status extends Memcached_DataObject $tss->insert(); return true; - } else { - $orig = clone($tss); $tss->last_id = $last_id; diff --git a/plugins/TwitterBridge/daemons/synctwitterfriends.php b/plugins/TwitterBridge/daemons/synctwitterfriends.php index 02546a02c..38a8b89eb 100755 --- a/plugins/TwitterBridge/daemons/synctwitterfriends.php +++ b/plugins/TwitterBridge/daemons/synctwitterfriends.php @@ -45,7 +45,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitteroauthclient.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class SyncTwitterFriendsDaemon extends ParallelizingDaemon { /** @@ -59,7 +58,6 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon * @return void * **/ - function __construct($id = null, $interval = 60, $max_children = 2, $debug = null) { @@ -71,7 +69,6 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon * * @return string Name of the daemon. */ - function name() { return ('synctwitterfriends.' . $this->_id); @@ -110,12 +107,10 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon } function childTask($flink) { - // Each child ps needs its own DB connection // Note: DataObject::getDatabaseConnection() creates // a new connection if there isn't one already - $conn = &$flink->getDatabaseConnection(); $this->subscribeTwitterFriends($flink); @@ -127,7 +122,6 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon // XXX: Couldn't find a less brutal way to blow // away a cached connection - global $_DB_DATAOBJECT; unset($_DB_DATAOBJECT['CONNECTIONS']); } @@ -277,4 +271,3 @@ if (have_option('d') || have_option('debug')) { $syncer = new SyncTwitterFriendsDaemon($id, 60, 2, $debug); $syncer->runOnce(); - diff --git a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php index f1305696b..31129b96d 100755 --- a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php +++ b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php @@ -62,7 +62,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitteroauthclient.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class TwitterStatusFetcher extends ParallelizingDaemon { /** @@ -87,7 +86,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon * * @return string Name of the daemon. */ - function name() { return ('twitterstatusfetcher.'.$this->_id); @@ -99,7 +97,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon * * @return array flinks an array of Foreign_link objects */ - function getObjects() { global $_DB_DATAOBJECT; @@ -133,12 +130,10 @@ class TwitterStatusFetcher extends ParallelizingDaemon } function childTask($flink) { - // Each child ps needs its own DB connection // Note: DataObject::getDatabaseConnection() creates // a new connection if there isn't one already - $conn = &$flink->getDatabaseConnection(); $this->getTimeline($flink); @@ -150,7 +145,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon // XXX: Couldn't find a less brutal way to blow // away a cached connection - global $_DB_DATAOBJECT; unset($_DB_DATAOBJECT['CONNECTIONS']); } @@ -201,9 +195,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon // Reverse to preserve order foreach (array_reverse($timeline) as $status) { - // Hacktastic: filter out stuff coming from this StatusNet - $source = mb_strtolower(common_config('integration', 'source')); if (preg_match("/$source/", mb_strtolower($status->source))) { @@ -214,7 +206,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon // Don't save it if the user is protected // FIXME: save it but treat it as private - if ($status->user->protected) { continue; } @@ -232,7 +223,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon } // Okay, record the time we synced with Twitter for posterity - $flink->last_noticesync = common_sql_now(); $flink->update(); } @@ -250,7 +240,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon $statusUri = $this->makeStatusURI($status->user->screen_name, $status->id); // check to see if we've already imported the status - $n2s = Notice_to_status::staticGet('status_id', $status->id); if (!empty($n2s)) { @@ -263,7 +252,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon } // If it's a retweet, save it as a repeat! - if (!empty($status->retweeted_status)) { common_log(LOG_INFO, "Status {$status->id} is a retweet of {$status->retweeted_status->id}."); $original = $this->saveStatus($status->retweeted_status); @@ -273,7 +261,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon $author = $original->getProfile(); // TRANS: Message used to repeat a notice. RT is the abbreviation of 'retweet'. // TRANS: %1$s is the repeated user's name, %2$s is the repeated notice. - $content = sprintf(_('RT @%1$s %2$s'), + $content = sprintf(_m('RT @%1$s %2$s'), $author->nickname, $original->content); @@ -365,7 +353,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon * * @return string URI */ - function makeStatusURI($username, $id) { return 'http://twitter.com/' @@ -383,7 +370,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon * * @return mixed value the first Profile with that url, or null */ - function getProfileByUrl($nickname, $profileurl) { $profile = new Profile(); @@ -407,7 +393,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon * * @return mixed value a matching Notice or null */ - function checkDupe($profile, $statusUri) { $notice = new Notice(); @@ -426,7 +411,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon function ensureProfile($user) { // check to see if there's already a profile for this user - $profileurl = 'http://twitter.com/' . $user->screen_name; $profile = $this->getProfileByUrl($user->screen_name, $profileurl); @@ -440,7 +424,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon return $profile; } else { - common_debug($this->name() . ' - Adding profile and remote profile ' . "for Twitter user: $profileurl."); @@ -472,7 +455,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon $remote_pro = Remote_profile::staticGet('uri', $profileurl); if (empty($remote_pro)) { - $remote_pro = new Remote_profile(); $remote_pro->id = $id; @@ -619,7 +601,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon $avatar = $profile->getAvatar($sizes[$size]); // Delete the avatar, if present - if ($avatar) { $avatar->delete(); } @@ -644,10 +625,8 @@ class TwitterStatusFetcher extends ParallelizingDaemon $avatar->height = 48; break; default: - // Note: Twitter's big avatars are a different size than // StatusNet's (StatusNet's = 96) - $avatar->width = 73; $avatar->height = 73; } @@ -822,4 +801,3 @@ if (have_option('d') || have_option('debug')) { $fetcher = new TwitterStatusFetcher($id, 60, 2, $debug); $fetcher->runOnce(); - diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index 90b0f0f14..3bff0af72 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -69,7 +69,6 @@ function save_twitter_user($twitter_id, $screen_name) { // Check to see whether the Twitter user is already in the system, // and update its screen name and uri if so. - $fuser = Foreign_user::getForeignUser($twitter_id, TWITTER_SERVICE); if (!empty($fuser)) { @@ -87,9 +86,7 @@ function save_twitter_user($twitter_id, $screen_name) } } else { - // Kill any old, invalid records for this screen name - $fuser = Foreign_user::getByNickname($screen_name, TWITTER_SERVICE); if (!empty($fuser)) { @@ -110,13 +107,11 @@ function save_twitter_user($twitter_id, $screen_name) } function is_twitter_bound($notice, $flink) { - // Check to see if notice should go to Twitter if (!empty($flink) && ($flink->noticesync & FOREIGN_NOTICE_SEND)) { // If it's not a Twitter-style reply, or if the user WANTS to send replies, // or if it's in reply to a twitter notice - if (!preg_match('/^@[a-zA-Z0-9_]{1,15}\b/u', $notice->content) || ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) || is_twitter_notice($notice->reply_to)) { @@ -242,7 +237,6 @@ function broadcast_oauth($notice, $flink) { } // Notice crossed the great divide - $msg = sprintf('Twitter bridge - posted notice %d to Twitter using ' . 'OAuth for User %s (user id %d).', $notice->id, @@ -378,4 +372,3 @@ function mail_twitter_bridge_removed($user) common_switch_locale(); return mail_to_user($user, $subject, $body); } - diff --git a/plugins/TwitterBridge/twitteradminpanel.php b/plugins/TwitterBridge/twitteradminpanel.php index 69f8da078..d05a2c6b3 100644 --- a/plugins/TwitterBridge/twitteradminpanel.php +++ b/plugins/TwitterBridge/twitteradminpanel.php @@ -40,7 +40,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class TwitteradminpanelAction extends AdminPanelAction { /** @@ -48,7 +47,6 @@ class TwitteradminpanelAction extends AdminPanelAction * * @return string page title */ - function title() { return _m('Twitter'); @@ -59,7 +57,6 @@ class TwitteradminpanelAction extends AdminPanelAction * * @return string instructions */ - function getInstructions() { return _m('Twitter bridge settings'); @@ -70,7 +67,6 @@ class TwitteradminpanelAction extends AdminPanelAction * * @return void */ - function showForm() { $form = new TwitterAdminPanelForm($this); @@ -83,7 +79,6 @@ class TwitteradminpanelAction extends AdminPanelAction * * @return void */ - function saveSettings() { static $settings = array( @@ -173,7 +168,6 @@ class TwitterAdminPanelForm extends AdminForm * * @return int ID of the form */ - function id() { return 'twitteradminpanel'; @@ -184,7 +178,6 @@ class TwitterAdminPanelForm extends AdminForm * * @return string class of the form */ - function formClass() { return 'form_settings'; @@ -195,7 +188,6 @@ class TwitterAdminPanelForm extends AdminForm * * @return string URL of the action */ - function action() { return common_local_url('twitteradminpanel'); @@ -206,7 +198,6 @@ class TwitterAdminPanelForm extends AdminForm * * @return void */ - function formData() { $this->out->elementStart( @@ -239,7 +230,7 @@ class TwitterAdminPanelForm extends AdminForm if (!empty($globalConsumerKey) && !empty($globalConsumerSec)) { $this->li(); - $this->out->element('p', 'form_guide', _('Note: a global consumer key and secret are set.')); + $this->out->element('p', 'form_guide', _m('Note: a global consumer key and secret are set.')); $this->unli(); } @@ -292,9 +283,8 @@ class TwitterAdminPanelForm extends AdminForm * * @return void */ - function formActions() { - $this->out->submit('submit', _('Save'), 'submit', null, _('Save Twitter settings')); + $this->out->submit('submit', _m('Save'), 'submit', null, _m('Save Twitter settings')); } } diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php index 7a896e168..931a03723 100644 --- a/plugins/TwitterBridge/twitterauthorization.php +++ b/plugins/TwitterBridge/twitterauthorization.php @@ -117,13 +117,13 @@ class TwitterauthorizationAction extends Action $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { - $this->showForm(_('There was a problem with your session token. Try again, please.')); + $this->showForm(_m('There was a problem with your session token. Try again, please.')); return; } if ($this->arg('create')) { if (!$this->boolean('license')) { - $this->showForm(_('You can\'t register if you don\'t agree to the license.'), + $this->showForm(_m('You can\'t register if you don\'t agree to the license.'), $this->trimmed('newname')); return; } @@ -132,7 +132,7 @@ class TwitterauthorizationAction extends Action $this->connectNewUser(); } else { common_debug('Twitter bridge - ' . print_r($this->args, true)); - $this->showForm(_('Something weird happened.'), + $this->showForm(_m('Something weird happened.'), $this->trimmed('newname')); } } else { @@ -231,7 +231,6 @@ class TwitterauthorizationAction extends Action } if (common_logged_in()) { - // Save the access token and Twitter user info $user = common_current_user(); @@ -298,7 +297,7 @@ class TwitterauthorizationAction extends Action if (empty($flink_id)) { common_log_db_error($flink, 'INSERT', __FILE__); - $this->serverError(_('Couldn\'t link your Twitter account.')); + $this->serverError(_m('Couldn\'t link your Twitter account.')); } return $flink_id; @@ -310,13 +309,13 @@ class TwitterauthorizationAction extends Action $this->element('div', array('class' => 'error'), $this->error); } else { $this->element('div', 'instructions', - sprintf(_('This is the first time you\'ve logged into %s so we must connect your Twitter account to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name'))); + sprintf(_m('This is the first time you\'ve logged into %s so we must connect your Twitter account to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name'))); } } function title() { - return _('Twitter Account Setup'); + return _m('Twitter Account Setup'); } function showForm($error=null, $username=null) @@ -349,7 +348,7 @@ class TwitterauthorizationAction extends Action 'class' => 'form_settings', 'action' => common_local_url('twitterauthorization'))); $this->elementStart('fieldset', array('id' => 'settings_twitter_connect_options')); - $this->element('legend', null, _('Connection options')); + $this->element('legend', null, _m('Connection options')); $this->elementStart('ul', 'form_data'); $this->elementStart('li'); $this->element('input', array('type' => 'checkbox', @@ -358,7 +357,7 @@ class TwitterauthorizationAction extends Action 'name' => 'license', 'value' => 'true')); $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license')); - $message = _('My text and files are available under %s ' . + $message = _m('My text and files are available under %s ' . 'except this private data: password, ' . 'email address, IM address, and phone number.'); $link = 'text(_m('Disconnecting your Faceboook ' . 'would make it impossible to log in! Please ')); $this->element('a', array('href' => common_local_url('passwordsettings')), + // TRANS: Preceded by "Please " and followed by " first." _m('set a password')); - + // TRANS: Preceded by "Please set a password". $this->text(_m(' first.')); $this->elementEnd('p'); } else { diff --git a/plugins/Facebook/facebookaction.php b/plugins/Facebook/facebookaction.php index f65b97c86..467c6af84 100644 --- a/plugins/Facebook/facebookaction.php +++ b/plugins/Facebook/facebookaction.php @@ -219,22 +219,22 @@ class FacebookAction extends Action function showInstructions() { - $this->elementStart('div', array('class' => 'facebook_guide')); $this->elementStart('dl', array('class' => 'system_notice')); $this->element('dt', null, 'Page Notice'); $loginmsg_part1 = _m('To use the %s Facebook Application you need to login ' . - 'with your username and password. Don\'t have a username yet? '); + 'with your username and password. Don\'t have a username yet?'); $loginmsg_part2 = _m(' a new account.'); $this->elementStart('dd'); $this->elementStart('p'); $this->text(sprintf($loginmsg_part1, common_config('site', 'name'))); + // @todo FIXME: Bad i18n. Patchwork message in two parts. $this->element('a', array('href' => common_local_url('register')), _m('Register')); - $this->text($loginmsg_part2); + $this->text( " " . $loginmsg_part2); $this->elementEnd('p'); $this->elementEnd('dd'); diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index 3bff0af72..d984698ee 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -30,7 +30,6 @@ function add_twitter_user($twitter_id, $screen_name) // Clear out any bad old foreign_users with the new user's legit URL // This can happen when users move around or fakester accounts get // repoed, and things like that. - $luser = Foreign_user::getForeignUser($twitter_id, TWITTER_SERVICE); if (!empty($luser)) { @@ -135,7 +134,6 @@ function broadcast_twitter($notice) TWITTER_SERVICE); // Don't bother with basic auth, since it's no longer allowed - if (!empty($flink) && TwitterOAuthClient::isPackedToken($flink->credentials)) { if (!empty($notice->repeat_of) && is_twitter_notice($notice->repeat_of)) { $retweet = retweet_notice($flink, Notice::staticGet('id', $notice->repeat_of)); @@ -224,7 +222,6 @@ function broadcast_oauth($notice, $flink) { // This could represent a failure posting, // or the Twitter API might just be behaving flakey. - $errmsg = sprintf('Twitter bridge - No data returned by Twitter API when ' . 'trying to post notice %d for User %s (user id %d).', $notice->id, @@ -347,7 +344,6 @@ function remove_twitter_link($flink) * * @return boolean success flag */ - function mail_twitter_bridge_removed($user) { $profile = $user->getProfile(); @@ -360,8 +356,8 @@ function mail_twitter_bridge_removed($user) $body = sprintf(_m('Hi, %1$s. We\'re sorry to inform you that your ' . 'link to Twitter has been disabled. We no longer seem to have ' . - 'permission to update your Twitter status. (Did you revoke ' . - '%3$s\'s access?)' . "\n\n" . + 'permission to update your Twitter status. Did you maybe revoke ' . + '%3$s\'s access?' . "\n\n" . 'You can re-enable your Twitter bridge by visiting your ' . "Twitter settings page:\n\n\t%2\$s\n\n" . "Regards,\n%3\$s\n"), diff --git a/plugins/TwitterBridge/twittersettings.php b/plugins/TwitterBridge/twittersettings.php index 6b087353a..dab8ab34f 100644 --- a/plugins/TwitterBridge/twittersettings.php +++ b/plugins/TwitterBridge/twittersettings.php @@ -128,6 +128,7 @@ class TwittersettingsAction extends ConnectSettingsAction if (!$user->password) { $this->elementStart('p', array('class' => 'form_guide')); + // @todo FIXME: Bad i18n (patchwork in three parts). $this->text(_m('Disconnecting your Twitter ' . 'could make it impossible to log in! Please ')); $this->element('a', @@ -180,7 +181,7 @@ class TwittersettingsAction extends ConnectSettingsAction if (common_config('twitterimport','enabled')) { $this->elementStart('li'); $this->checkbox('noticerecv', - _m('Import my Friends Timeline.'), + _m('Import my friends timeline.'), ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_RECV) : false); -- cgit v1.2.3-54-g00ecf From 159e3e7b7138b4425c64e01c498f21ccb14026c6 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Sep 2010 00:13:06 +0200 Subject: Fix typo --- plugins/Gravatar/GravatarPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/Gravatar/GravatarPlugin.php b/plugins/Gravatar/GravatarPlugin.php index 23f04e7db..e4782cb9f 100644 --- a/plugins/Gravatar/GravatarPlugin.php +++ b/plugins/Gravatar/GravatarPlugin.php @@ -138,7 +138,7 @@ class GravatarPlugin extends Plugin $cur = common_current_user(); if(empty($cur->email)) { - return array('message' => _m('You do not have a email address set in your profile.'), + return array('message' => _m('You do not have an email address set in your profile.'), 'success' => false); } //Get rid of previous Avatar -- cgit v1.2.3-54-g00ecf From 8b44063ca14d3101d39b081ec85421a221b45bb7 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Sep 2010 00:17:24 +0200 Subject: * L10n update * superfluous whitespace removed --- plugins/CacheLog/CacheLogPlugin.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/CacheLog/CacheLogPlugin.php b/plugins/CacheLog/CacheLogPlugin.php index 4c47de80e..5b0b43935 100644 --- a/plugins/CacheLog/CacheLogPlugin.php +++ b/plugins/CacheLog/CacheLogPlugin.php @@ -50,7 +50,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ - class CacheLogPlugin extends Plugin { function onStartCacheGet(&$key, &$value) @@ -114,8 +113,7 @@ class CacheLogPlugin extends Plugin 'author' => 'Evan Prodromou', 'homepage' => 'http://status.net/wiki/Plugin:CacheLog', 'description' => - _m('Log reads and writes to the cache')); + _m('Log reads and writes to the cache.')); return true; } } - -- cgit v1.2.3-54-g00ecf From 1564b6aa49f47ac59ea15eef2f138b17d2c35cff Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Sep 2010 00:19:02 +0200 Subject: * L10n update * remove superfluous whitespace --- plugins/GoogleAnalytics/GoogleAnalyticsPlugin.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/GoogleAnalytics/GoogleAnalyticsPlugin.php b/plugins/GoogleAnalytics/GoogleAnalyticsPlugin.php index c646bf113..bb937ec5b 100644 --- a/plugins/GoogleAnalytics/GoogleAnalyticsPlugin.php +++ b/plugins/GoogleAnalytics/GoogleAnalyticsPlugin.php @@ -47,7 +47,6 @@ if (!defined('STATUSNET')) { * * @see Event */ - class GoogleAnalyticsPlugin extends Plugin { var $code = null; @@ -79,7 +78,7 @@ class GoogleAnalyticsPlugin extends Plugin 'homepage' => 'http://status.net/wiki/Plugin:GoogleAnalytics', 'rawdescription' => _m('Use Google Analytics'. - ' to track Web access.')); + ' to track web access.')); return true; } } -- cgit v1.2.3-54-g00ecf From 53cfa5349f1f9c964d5a8136399f03a85bc6d484 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Sep 2010 00:20:16 +0200 Subject: * L10n update * superfluous whitespace removed. --- plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php index b353d7255..777fd9c5d 100644 --- a/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php +++ b/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php @@ -49,7 +49,6 @@ if (!defined('STATUSNET')) { * analytics setup - for example '8'. * */ - class PiwikAnalyticsPlugin extends Plugin { /** the base of your Piwik installation */ @@ -63,7 +62,6 @@ class PiwikAnalyticsPlugin extends Plugin * @param string $root Piwik root URL * @param string $id Piwik ID of this app */ - function __construct($root=null, $id=null) { $this->piwikroot = $root; @@ -78,7 +76,6 @@ class PiwikAnalyticsPlugin extends Plugin * * @return boolean ignored */ - function onEndShowScripts($action) { $piwikCode1 = << 'Tobias Diekershoff, Evan Prodromou', 'homepage' => 'http://status.net/wiki/Plugin:Piwik', 'rawdescription' => - _m('Use Piwik Open Source Web analytics software.')); + _m('Use Piwik Open Source web analytics software.')); return true; } - } -- cgit v1.2.3-54-g00ecf From f1d78942b37d40c3aaa31ed52bc37a76a958dd66 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Sep 2010 00:23:10 +0200 Subject: L10n updates. --- plugins/RSSCloud/RSSCloudRequestNotify.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/RSSCloud/RSSCloudRequestNotify.php b/plugins/RSSCloud/RSSCloudRequestNotify.php index 41b868578..e9c0eab5f 100644 --- a/plugins/RSSCloud/RSSCloudRequestNotify.php +++ b/plugins/RSSCloud/RSSCloudRequestNotify.php @@ -138,7 +138,7 @@ class RSSCloudRequestNotifyAction extends Action common_log(LOG_WARNING, "RSSCloud plugin - $nh tried to subscribe to invalid feed: $feed"); - $msg = _m('Feed subscription failed - Not a valid feed.'); + $msg = _m('Feed subscription failed: Not a valid feed.'); $this->showResult(false, $msg); return; } @@ -159,7 +159,7 @@ class RSSCloudRequestNotifyAction extends Action // 25 hours seems harsh. WordPress doesn't ever remove // subscriptions. $msg = _m('Thanks for the subscription. ' . - 'When the feed(s) update(s) we\'ll notify you.'); + 'When the feed(s) update(s), you will be notified.'); $this->showResult(true, $msg); } -- cgit v1.2.3-54-g00ecf From 8135f7d9605ef16d56b6588f3ebea333891d17ef Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Sep 2010 00:24:48 +0200 Subject: Update pot files for plugins. --- plugins/Adsense/locale/Adsense.pot | 2 +- plugins/AutoSandbox/locale/AutoSandbox.pot | 5 +- plugins/Autocomplete/locale/Autocomplete.pot | 2 +- plugins/BitlyUrl/locale/BitlyUrl.pot | 2 +- plugins/Blacklist/locale/Blacklist.pot | 4 +- .../CasAuthentication/locale/CasAuthentication.pot | 41 +++- .../ClientSideShorten/locale/ClientSideShorten.pot | 4 +- .../DirectionDetector/locale/DirectionDetector.pot | 2 +- .../locale/EmailAuthentication.pot | 2 +- plugins/Facebook/locale/Facebook.pot | 27 ++- plugins/FirePHP/locale/FirePHP.pot | 2 +- plugins/Gravatar/locale/Gravatar.pot | 6 +- plugins/Imap/locale/Imap.pot | 18 +- plugins/InfiniteScroll/locale/InfiniteScroll.pot | 2 +- .../locale/LdapAuthentication.pot | 2 +- .../LdapAuthorization/locale/LdapAuthorization.pot | 2 +- plugins/LilUrl/locale/LilUrl.pot | 2 +- plugins/Mapstraction/locale/Mapstraction.pot | 26 +-- plugins/Minify/locale/Minify.pot | 18 +- plugins/MobileProfile/locale/MobileProfile.pot | 2 +- plugins/NoticeTitle/locale/NoticeTitle.pot | 10 +- plugins/OStatus/locale/OStatus.pot | 8 +- .../locale/OpenExternalLinkTarget.pot | 4 +- plugins/OpenID/locale/OpenID.pot | 2 +- plugins/PostDebug/locale/PostDebug.pot | 2 +- .../locale/PoweredByStatusNet.pot | 13 +- plugins/PtitUrl/locale/PtitUrl.pot | 2 +- plugins/RSSCloud/locale/RSSCloud.pot | 46 +++- plugins/Recaptcha/locale/Recaptcha.pot | 10 +- .../RegisterThrottle/locale/RegisterThrottle.pot | 14 +- .../locale/RequireValidatedEmail.pot | 2 +- .../locale/ReverseUsernameAuthentication.pot | 2 +- plugins/Sample/locale/Sample.pot | 33 ++- plugins/SimpleUrl/locale/SimpleUrl.pot | 2 +- plugins/SubMirror/locale/SubMirror.pot | 64 ++++-- plugins/TabFocus/locale/TabFocus.pot | 4 +- plugins/TightUrl/locale/TightUrl.pot | 2 +- plugins/TinyMCE/locale/TinyMCE.pot | 6 +- plugins/TwitterBridge/locale/TwitterBridge.pot | 253 ++++++++++++++++----- plugins/WikiHowProfile/locale/WikiHowProfile.pot | 16 +- 40 files changed, 478 insertions(+), 188 deletions(-) (limited to 'plugins') diff --git a/plugins/Adsense/locale/Adsense.pot b/plugins/Adsense/locale/Adsense.pot index d4bed3af5..6d69f639c 100644 --- a/plugins/Adsense/locale/Adsense.pot +++ b/plugins/Adsense/locale/Adsense.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:07+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/AutoSandbox/locale/AutoSandbox.pot b/plugins/AutoSandbox/locale/AutoSandbox.pot index c6712c6b8..ff4f38776 100644 --- a/plugins/AutoSandbox/locale/AutoSandbox.pot +++ b/plugins/AutoSandbox/locale/AutoSandbox.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -26,7 +26,8 @@ msgid "" "the public timeline." msgstr "" -#: AutoSandboxPlugin.php:78 +#. TRANS: $contactlink is a clickable e-mailaddress. +#: AutoSandboxPlugin.php:79 msgid "" "Note you will initially be \"sandboxed\" so your posts will not appear in " "the public timeline. Send a message to $contactlink to speed up the " diff --git a/plugins/Autocomplete/locale/Autocomplete.pot b/plugins/Autocomplete/locale/Autocomplete.pot index 2fd61cfde..27f74bf09 100644 --- a/plugins/Autocomplete/locale/Autocomplete.pot +++ b/plugins/Autocomplete/locale/Autocomplete.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/BitlyUrl/locale/BitlyUrl.pot b/plugins/BitlyUrl/locale/BitlyUrl.pot index 12012ba88..4c4455da9 100644 --- a/plugins/BitlyUrl/locale/BitlyUrl.pot +++ b/plugins/BitlyUrl/locale/BitlyUrl.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/Blacklist/locale/Blacklist.pot b/plugins/Blacklist/locale/Blacklist.pot index 88db86ebd..f6bb591a8 100644 --- a/plugins/Blacklist/locale/Blacklist.pot +++ b/plugins/Blacklist/locale/Blacklist.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -38,7 +38,7 @@ msgstr "" #: BlacklistPlugin.php:234 #, php-format -msgid "You may not use UTL \"%s\" in notices." +msgid "You may not use URL \"%s\" in notices." msgstr "" #: BlacklistPlugin.php:338 diff --git a/plugins/CasAuthentication/locale/CasAuthentication.pot b/plugins/CasAuthentication/locale/CasAuthentication.pot index b5c45eb68..203fd5ede 100644 --- a/plugins/CasAuthentication/locale/CasAuthentication.pot +++ b/plugins/CasAuthentication/locale/CasAuthentication.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:07+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,15 +16,38 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: CasAuthenticationPlugin.php:82 +#. TRANS: Menu item. CAS is Central Authentication Service. +#: CasAuthenticationPlugin.php:83 msgid "CAS" msgstr "" -#: CasAuthenticationPlugin.php:83 -msgid "Login or register with CAS" +#. TRANS: Tooltip for menu item. CAS is Central Authentication Service. +#: CasAuthenticationPlugin.php:85 +msgid "Login or register with CAS." +msgstr "" + +#. TRANS: Invitation to users with a CAS account to log in using the service. +#. TRANS: "[CAS login]" is a link description. (%%action.caslogin%%) is the URL. +#. TRANS: These two elements may not be separated. +#: CasAuthenticationPlugin.php:101 +#, php-format +msgid "(Have an account with CAS? Try our [CAS login](%%action.caslogin%%)!)" +msgstr "" + +#: CasAuthenticationPlugin.php:128 +msgid "Specifying a server is required." +msgstr "" + +#: CasAuthenticationPlugin.php:131 +msgid "Specifying a port is required." +msgstr "" + +#: CasAuthenticationPlugin.php:134 +msgid "Specifying a path is required." msgstr "" -#: CasAuthenticationPlugin.php:150 +#. TRANS: Plugin description. CAS is Central Authentication Service. +#: CasAuthenticationPlugin.php:154 msgid "" "The CAS Authentication plugin allows for StatusNet to handle authentication " "through CAS (Central Authentication Service)." @@ -33,3 +56,11 @@ msgstr "" #: caslogin.php:28 msgid "Already logged in." msgstr "" + +#: caslogin.php:39 +msgid "Incorrect username or password." +msgstr "" + +#: caslogin.php:45 +msgid "Error setting user. You are probably not authorized." +msgstr "" diff --git a/plugins/ClientSideShorten/locale/ClientSideShorten.pot b/plugins/ClientSideShorten/locale/ClientSideShorten.pot index d2b4862dd..8ef97c61b 100644 --- a/plugins/ClientSideShorten/locale/ClientSideShorten.pot +++ b/plugins/ClientSideShorten/locale/ClientSideShorten.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -19,7 +19,7 @@ msgstr "" #: ClientSideShortenPlugin.php:74 msgid "" "ClientSideShorten causes the web interface's notice form to automatically " -"shorten urls as they entered, and before the notice is submitted." +"shorten URLs as they entered, and before the notice is submitted." msgstr "" #: shorten.php:56 diff --git a/plugins/DirectionDetector/locale/DirectionDetector.pot b/plugins/DirectionDetector/locale/DirectionDetector.pot index d0199a040..995bc42ec 100644 --- a/plugins/DirectionDetector/locale/DirectionDetector.pot +++ b/plugins/DirectionDetector/locale/DirectionDetector.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/EmailAuthentication/locale/EmailAuthentication.pot b/plugins/EmailAuthentication/locale/EmailAuthentication.pot index b0d096a49..469435c6b 100644 --- a/plugins/EmailAuthentication/locale/EmailAuthentication.pot +++ b/plugins/EmailAuthentication/locale/EmailAuthentication.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:07+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/Facebook/locale/Facebook.pot b/plugins/Facebook/locale/Facebook.pot index 14bd372d6..09f027c4e 100644 --- a/plugins/Facebook/locale/Facebook.pot +++ b/plugins/Facebook/locale/Facebook.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -39,7 +39,7 @@ msgstr "" msgid "There is already a local user linked with this Facebook." msgstr "" -#: FBConnectAuth.php:90 FBConnectSettings.php:164 +#: FBConnectAuth.php:90 FBConnectSettings.php:167 msgid "There was a problem with your session token. Try again, please." msgstr "" @@ -265,14 +265,14 @@ msgstr "" msgid "Settings" msgstr "" -#: facebookaction.php:228 +#: facebookaction.php:227 #, php-format msgid "" "To use the %s Facebook Application you need to login with your username and " -"password. Don't have a username yet? " +"password. Don't have a username yet?" msgstr "" -#: facebookaction.php:230 +#: facebookaction.php:229 msgid " a new account." msgstr "" @@ -349,32 +349,35 @@ msgstr "" msgid "Disconnect my account from Facebook" msgstr "" -#: FBConnectSettings.php:124 +#. TRANS: Followed by a link containing text "set a password". +#: FBConnectSettings.php:126 msgid "" "Disconnecting your Faceboook would make it impossible to log in! Please " msgstr "" -#: FBConnectSettings.php:128 +#. TRANS: Preceded by "Please " and followed by " first." +#: FBConnectSettings.php:131 msgid "set a password" msgstr "" -#: FBConnectSettings.php:130 +#. TRANS: Preceded by "Please set a password". +#: FBConnectSettings.php:133 msgid " first." msgstr "" -#: FBConnectSettings.php:142 +#: FBConnectSettings.php:145 msgid "Disconnect" msgstr "" -#: FBConnectSettings.php:178 +#: FBConnectSettings.php:181 msgid "Couldn't delete link to Facebook." msgstr "" -#: FBConnectSettings.php:194 +#: FBConnectSettings.php:197 msgid "You have disconnected from Facebook." msgstr "" -#: FBConnectSettings.php:197 +#: FBConnectSettings.php:200 msgid "Not sure what you're trying to do." msgstr "" diff --git a/plugins/FirePHP/locale/FirePHP.pot b/plugins/FirePHP/locale/FirePHP.pot index c4b10a499..ebcc8d3fe 100644 --- a/plugins/FirePHP/locale/FirePHP.pot +++ b/plugins/FirePHP/locale/FirePHP.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:07+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/Gravatar/locale/Gravatar.pot b/plugins/Gravatar/locale/Gravatar.pot index 9a71b8166..fda09b797 100644 --- a/plugins/Gravatar/locale/Gravatar.pot +++ b/plugins/Gravatar/locale/Gravatar.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -45,11 +45,11 @@ msgid "To use a Gravatar first enter in an email address." msgstr "" #: GravatarPlugin.php:141 -msgid "You do not have a email set in your profile." +msgid "You do not have an email address set in your profile." msgstr "" #: GravatarPlugin.php:159 -msgid "Failed to save Gravatar to the DB." +msgid "Failed to save Gravatar to the database." msgstr "" #: GravatarPlugin.php:163 diff --git a/plugins/Imap/locale/Imap.pot b/plugins/Imap/locale/Imap.pot index 9d807a3d3..1f7497446 100644 --- a/plugins/Imap/locale/Imap.pot +++ b/plugins/Imap/locale/Imap.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:07+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,6 +20,22 @@ msgstr "" msgid "Error" msgstr "" +#: ImapPlugin.php:54 +msgid "A mailbox must be specified." +msgstr "" + +#: ImapPlugin.php:57 +msgid "A user must be specified." +msgstr "" + +#: ImapPlugin.php:60 +msgid "A password must be specified." +msgstr "" + +#: ImapPlugin.php:63 +msgid "A poll_frequency must be specified." +msgstr "" + #: ImapPlugin.php:103 msgid "" "The IMAP plugin allows for StatusNet to check a POP or IMAP mailbox for " diff --git a/plugins/InfiniteScroll/locale/InfiniteScroll.pot b/plugins/InfiniteScroll/locale/InfiniteScroll.pot index 52f9ef1ea..b1af9664f 100644 --- a/plugins/InfiniteScroll/locale/InfiniteScroll.pot +++ b/plugins/InfiniteScroll/locale/InfiniteScroll.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/LdapAuthentication/locale/LdapAuthentication.pot b/plugins/LdapAuthentication/locale/LdapAuthentication.pot index ce84cbf0e..d40dd5ebd 100644 --- a/plugins/LdapAuthentication/locale/LdapAuthentication.pot +++ b/plugins/LdapAuthentication/locale/LdapAuthentication.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/LdapAuthorization/locale/LdapAuthorization.pot b/plugins/LdapAuthorization/locale/LdapAuthorization.pot index 11e7fc5c8..60a7106f9 100644 --- a/plugins/LdapAuthorization/locale/LdapAuthorization.pot +++ b/plugins/LdapAuthorization/locale/LdapAuthorization.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:07+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/LilUrl/locale/LilUrl.pot b/plugins/LilUrl/locale/LilUrl.pot index 2785ee800..66505e5f8 100644 --- a/plugins/LilUrl/locale/LilUrl.pot +++ b/plugins/LilUrl/locale/LilUrl.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/Mapstraction/locale/Mapstraction.pot b/plugins/Mapstraction/locale/Mapstraction.pot index 3d7f71f89..7a971cabe 100644 --- a/plugins/Mapstraction/locale/Mapstraction.pot +++ b/plugins/Mapstraction/locale/Mapstraction.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,39 +16,37 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: MapstractionPlugin.php:182 +#: MapstractionPlugin.php:178 msgid "Map" msgstr "" -#: MapstractionPlugin.php:193 +#. TRANS: Clickable item to allow opening the map in full size. +#: MapstractionPlugin.php:190 msgid "Full size" msgstr "" -#: MapstractionPlugin.php:205 +#: MapstractionPlugin.php:202 msgid "" "Show maps of users' and friends' notices with Mapstraction JavaScript library." +"mapstraction.com/\">Mapstraction." msgstr "" -#: map.php:73 +#: map.php:72 msgid "No such user." msgstr "" -#: map.php:80 +#: map.php:79 msgid "User has no profile." msgstr "" -#: allmap.php:72 +#. TRANS: Page title. +#. TRANS: %s is a user nickname. +#: allmap.php:74 #, php-format msgid "%s friends map" msgstr "" -#: allmap.php:75 -#, php-format -msgid "%s friends map, page %d" -msgstr "" - -#: usermap.php:72 +#: usermap.php:73 #, php-format msgid "%s map, page %d" msgstr "" diff --git a/plugins/Minify/locale/Minify.pot b/plugins/Minify/locale/Minify.pot index 2f65c5df2..2425d50bc 100644 --- a/plugins/Minify/locale/Minify.pot +++ b/plugins/Minify/locale/Minify.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,8 +16,20 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" +#: minify.php:49 +msgid "The parameter \"f\" is not a valid path." +msgstr "" + +#: minify.php:53 +msgid "The parameter \"f\" is required but missing." +msgstr "" + +#: minify.php:111 +msgid "File type not supported." +msgstr "" + #: MinifyPlugin.php:180 msgid "" -"The Minify plugin minifies your CSS and Javascript, removing whitespace and " -"comments." +"The Minify plugin minifies StatusNet's CSS and JavaScript, removing " +"whitespace and comments." msgstr "" diff --git a/plugins/MobileProfile/locale/MobileProfile.pot b/plugins/MobileProfile/locale/MobileProfile.pot index c4af49a22..7c58516b1 100644 --- a/plugins/MobileProfile/locale/MobileProfile.pot +++ b/plugins/MobileProfile/locale/MobileProfile.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/NoticeTitle/locale/NoticeTitle.pot b/plugins/NoticeTitle/locale/NoticeTitle.pot index 1a451ba74..f5a962831 100644 --- a/plugins/NoticeTitle/locale/NoticeTitle.pot +++ b/plugins/NoticeTitle/locale/NoticeTitle.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,5 +17,11 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: NoticeTitlePlugin.php:126 -msgid "Adds optional titles to notices" +msgid "Adds optional titles to notices." +msgstr "" + +#. TRANS: Page title. %1$s is the title, %2$s is the site name. +#: NoticeTitlePlugin.php:299 +#, php-format +msgid "%1$s - %2$s" msgstr "" diff --git a/plugins/OStatus/locale/OStatus.pot b/plugins/OStatus/locale/OStatus.pot index 3dc6fd6ad..b3a9074a2 100644 --- a/plugins/OStatus/locale/OStatus.pot +++ b/plugins/OStatus/locale/OStatus.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -71,17 +71,17 @@ msgstr "" msgid "Show more" msgstr "" -#: classes/Ostatus_profile.php:1035 +#: classes/Ostatus_profile.php:1034 #, php-format msgid "Invalid avatar URL %s." msgstr "" -#: classes/Ostatus_profile.php:1045 +#: classes/Ostatus_profile.php:1044 #, php-format msgid "Tried to update avatar for unsaved remote profile %s." msgstr "" -#: classes/Ostatus_profile.php:1053 +#: classes/Ostatus_profile.php:1052 #, php-format msgid "Unable to fetch avatar from %s." msgstr "" diff --git a/plugins/OpenExternalLinkTarget/locale/OpenExternalLinkTarget.pot b/plugins/OpenExternalLinkTarget/locale/OpenExternalLinkTarget.pot index 2fbe4cfa2..4ceaddf18 100644 --- a/plugins/OpenExternalLinkTarget/locale/OpenExternalLinkTarget.pot +++ b/plugins/OpenExternalLinkTarget/locale/OpenExternalLinkTarget.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,5 +17,5 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: OpenExternalLinkTargetPlugin.php:60 -msgid "Opens external links (i.e., with rel=external) on a new window or tab" +msgid "Opens external links (e.g., with rel=external) on a new window or tab." msgstr "" diff --git a/plugins/OpenID/locale/OpenID.pot b/plugins/OpenID/locale/OpenID.pot index 0a84e060d..033eab320 100644 --- a/plugins/OpenID/locale/OpenID.pot +++ b/plugins/OpenID/locale/OpenID.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/PostDebug/locale/PostDebug.pot b/plugins/PostDebug/locale/PostDebug.pot index 0e9d76803..1d67b7510 100644 --- a/plugins/PostDebug/locale/PostDebug.pot +++ b/plugins/PostDebug/locale/PostDebug.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/PoweredByStatusNet/locale/PoweredByStatusNet.pot b/plugins/PoweredByStatusNet/locale/PoweredByStatusNet.pot index 1997cc04a..77c1822c4 100644 --- a/plugins/PoweredByStatusNet/locale/PoweredByStatusNet.pot +++ b/plugins/PoweredByStatusNet/locale/PoweredByStatusNet.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,17 +16,18 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: PoweredByStatusNetPlugin.php:50 +#. TRANS: %s is a URL to status.net with "StatusNet" (localised) as link text. +#: PoweredByStatusNetPlugin.php:51 #, php-format msgid "powered by %s" msgstr "" -#: PoweredByStatusNetPlugin.php:52 +#: PoweredByStatusNetPlugin.php:53 msgid "StatusNet" msgstr "" -#: PoweredByStatusNetPlugin.php:65 +#: PoweredByStatusNetPlugin.php:66 msgid "" -"Outputs powered by StatusNet after site " -"name." +"Outputs \"powered by StatusNet\" after " +"site name." msgstr "" diff --git a/plugins/PtitUrl/locale/PtitUrl.pot b/plugins/PtitUrl/locale/PtitUrl.pot index b2f5947af..c7a8b0667 100644 --- a/plugins/PtitUrl/locale/PtitUrl.pot +++ b/plugins/PtitUrl/locale/PtitUrl.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/RSSCloud/locale/RSSCloud.pot b/plugins/RSSCloud/locale/RSSCloud.pot index c7b28632b..56de24825 100644 --- a/plugins/RSSCloud/locale/RSSCloud.pot +++ b/plugins/RSSCloud/locale/RSSCloud.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,9 +16,51 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" +#: RSSCloudRequestNotify.php:90 +msgid "Request must be POST." +msgstr "" + +#: RSSCloudRequestNotify.php:107 +msgid "Only http-post notifications are supported at this time." +msgstr "" + +#. TRANS: %s is a comma separated list of parameters. +#: RSSCloudRequestNotify.php:118 +#, php-format +msgid "The following parameters were missing from the request body: %s." +msgstr "" + +#: RSSCloudRequestNotify.php:124 +msgid "" +"You must provide at least one valid profile feed url (url1, url2, url3 ... " +"urlN)." +msgstr "" + +#: RSSCloudRequestNotify.php:141 +msgid "Feed subscription failed: Not a valid feed." +msgstr "" + +#: RSSCloudRequestNotify.php:147 +msgid "" +"Feed subscription failed - notification handler doesn't respond correctly." +msgstr "" + +#: RSSCloudRequestNotify.php:161 +msgid "" +"Thanks for the subscription. When the feed(s) update(s), you will be notified." +msgstr "" + +#: LoggingAggregator.php:93 +msgid "This resource requires an HTTP GET." +msgstr "" + +#: LoggingAggregator.php:104 +msgid "This resource requires an HTTP POST." +msgstr "" + #: RSSCloudPlugin.php:248 msgid "" "The RSSCloud plugin enables your StatusNet instance to publish real-time " "updates for profile RSS feeds using the RSSCloud protocol\"." +"\">RSSCloud protocol." msgstr "" diff --git a/plugins/Recaptcha/locale/Recaptcha.pot b/plugins/Recaptcha/locale/Recaptcha.pot index 855a1a11a..547f73ba1 100644 --- a/plugins/Recaptcha/locale/Recaptcha.pot +++ b/plugins/Recaptcha/locale/Recaptcha.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:07+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,6 +16,14 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" +#: RecaptchaPlugin.php:64 +msgid "Captcha" +msgstr "" + +#: RecaptchaPlugin.php:105 +msgid "Captcha does not match!" +msgstr "" + #: RecaptchaPlugin.php:117 msgid "" "Uses Recaptcha service to add a " diff --git a/plugins/RegisterThrottle/locale/RegisterThrottle.pot b/plugins/RegisterThrottle/locale/RegisterThrottle.pot index 40327d16f..97539f9a0 100644 --- a/plugins/RegisterThrottle/locale/RegisterThrottle.pot +++ b/plugins/RegisterThrottle/locale/RegisterThrottle.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,14 +16,18 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: RegisterThrottlePlugin.php:122 RegisterThrottlePlugin.php:161 +#: RegisterThrottlePlugin.php:121 RegisterThrottlePlugin.php:160 msgid "Cannot find IP address." msgstr "" -#: RegisterThrottlePlugin.php:167 +#: RegisterThrottlePlugin.php:136 +msgid "Too many registrations. Take a break and try again later." +msgstr "" + +#: RegisterThrottlePlugin.php:166 msgid "Cannot find user after successful registration." msgstr "" -#: RegisterThrottlePlugin.php:200 -msgid "Throttles excessive registration from a single IP." +#: RegisterThrottlePlugin.php:199 +msgid "Throttles excessive registration from a single IP address." msgstr "" diff --git a/plugins/RequireValidatedEmail/locale/RequireValidatedEmail.pot b/plugins/RequireValidatedEmail/locale/RequireValidatedEmail.pot index 13c04c338..f2128e794 100644 --- a/plugins/RequireValidatedEmail/locale/RequireValidatedEmail.pot +++ b/plugins/RequireValidatedEmail/locale/RequireValidatedEmail.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:07+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/ReverseUsernameAuthentication/locale/ReverseUsernameAuthentication.pot b/plugins/ReverseUsernameAuthentication/locale/ReverseUsernameAuthentication.pot index df2523cb4..c0e66561c 100644 --- a/plugins/ReverseUsernameAuthentication/locale/ReverseUsernameAuthentication.pot +++ b/plugins/ReverseUsernameAuthentication/locale/ReverseUsernameAuthentication.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/Sample/locale/Sample.pot b/plugins/Sample/locale/Sample.pot index 66bcb775d..b58819655 100644 --- a/plugins/Sample/locale/Sample.pot +++ b/plugins/Sample/locale/Sample.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,38 +17,47 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" -#: User_greeting_count.php:168 +#. TRANS: Exception thrown when the user greeting count could not be saved in the database. +#. TRANS: %d is a user ID (number). +#: User_greeting_count.php:164 #, php-format -msgid "Could not save new greeting count for %d" +msgid "Could not save new greeting count for %d." msgstr "" -#: User_greeting_count.php:181 +#. TRANS: Exception thrown when the user greeting count could not be saved in the database. +#. TRANS: %d is a user ID (number). +#: User_greeting_count.php:177 #, php-format -msgid "Could not increment greeting count for %d" +msgid "Could not increment greeting count for %d." msgstr "" -#: SamplePlugin.php:266 hello.php:115 +#: SamplePlugin.php:259 hello.php:111 msgid "Hello" msgstr "" -#: SamplePlugin.php:266 +#: SamplePlugin.php:259 msgid "A warm greeting" msgstr "" -#: SamplePlugin.php:277 +#: SamplePlugin.php:270 msgid "A sample plugin to show basics of development for new hackers." msgstr "" -#: hello.php:117 hello.php:141 +#: hello.php:113 #, php-format -msgid "Hello, %s" +msgid "Hello, %s!" msgstr "" -#: hello.php:138 +#: hello.php:133 msgid "Hello, stranger!" msgstr "" -#: hello.php:143 +#: hello.php:136 +#, php-format +msgid "Hello, %s" +msgstr "" + +#: hello.php:138 #, php-format msgid "I have greeted you %d time." msgid_plural "I have greeted you %d times." diff --git a/plugins/SimpleUrl/locale/SimpleUrl.pot b/plugins/SimpleUrl/locale/SimpleUrl.pot index 7edf70abf..8fd5aa6be 100644 --- a/plugins/SimpleUrl/locale/SimpleUrl.pot +++ b/plugins/SimpleUrl/locale/SimpleUrl.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/SubMirror/locale/SubMirror.pot b/plugins/SubMirror/locale/SubMirror.pot index f34de8f9f..b46307704 100644 --- a/plugins/SubMirror/locale/SubMirror.pot +++ b/plugins/SubMirror/locale/SubMirror.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,94 +16,114 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: SubMirrorPlugin.php:92 +#: SubMirrorPlugin.php:90 msgid "Pull feeds into your timeline!" msgstr "" #. TRANS: SubMirror plugin menu item on user settings page. -#: SubMirrorPlugin.php:111 +#: SubMirrorPlugin.php:109 msgctxt "MENU" msgid "Mirroring" msgstr "" #. TRANS: SubMirror plugin tooltip for user settings menu item. -#: SubMirrorPlugin.php:113 +#: SubMirrorPlugin.php:111 msgid "Configure mirroring of posts from other feeds" msgstr "" -#: lib/editmirrorform.php:84 +#: lib/editmirrorform.php:83 msgctxt "LABEL" msgid "Remote feed:" msgstr "" -#: lib/editmirrorform.php:88 +#: lib/editmirrorform.php:87 msgctxt "LABEL" msgid "Local user" msgstr "" -#: lib/editmirrorform.php:94 +#: lib/editmirrorform.php:93 msgid "Mirroring style" msgstr "" -#: lib/editmirrorform.php:96 +#: lib/editmirrorform.php:95 msgid "" "Repeat: reference the original user's post (sometimes shows as 'RT @blah')" msgstr "" -#: lib/editmirrorform.php:97 +#: lib/editmirrorform.php:96 msgid "Repost the content under my account" msgstr "" -#: lib/editmirrorform.php:116 +#: lib/editmirrorform.php:115 msgid "Save" msgstr "" -#: lib/editmirrorform.php:118 +#: lib/editmirrorform.php:117 msgid "Stop mirroring" msgstr "" -#: lib/addmirrorform.php:62 +#: lib/addmirrorform.php:59 msgid "Web page or feed URL:" msgstr "" -#: lib/addmirrorform.php:67 +#: lib/addmirrorform.php:64 +msgctxt "BUTTON" msgid "Add feed" msgstr "" -#: actions/basemirror.php:73 +#: actions/basemirror.php:71 msgid "Invalid feed URL." msgstr "" #. TRANS: Error message returned to user when setting up feed mirroring, but we were unable to resolve the given URL to a working feed. -#: actions/basemirror.php:85 +#: actions/basemirror.php:83 msgid "Invalid profile for mirroring." msgstr "" -#: actions/basemirror.php:103 +#: actions/basemirror.php:101 msgid "Can't mirror a StatusNet group at this time." msgstr "" -#: actions/editmirror.php:70 +#: actions/basemirror.php:115 +msgid "This action only accepts POST requests." +msgstr "" + +#: actions/basemirror.php:123 +msgid "There was a problem with your session token. Try again, please." +msgstr "" + +#: actions/basemirror.php:133 +msgid "Not logged in." +msgstr "" + +#: actions/basemirror.php:156 +msgid "Subscribed" +msgstr "" + +#: actions/editmirror.php:68 msgid "Requested invalid profile to edit." msgstr "" -#: actions/editmirror.php:88 +#: actions/editmirror.php:86 msgid "Bad form data." msgstr "" -#: actions/editmirror.php:96 -msgid "Requested edit of missing mirror" +#. TRANS: Client error thrown when a mirror request is made and no result is retrieved. +#: actions/editmirror.php:95 +msgid "Requested edit of missing mirror." msgstr "" -#: actions/addmirror.php:74 +#: actions/addmirror.php:72 msgid "Could not subscribe to feed." msgstr "" +#. TRANS: Title. #: actions/mirrorsettings.php:42 msgid "Feed mirror settings" msgstr "" -#: actions/mirrorsettings.php:53 +#. TRANS: Instructions. +#: actions/mirrorsettings.php:54 msgid "" "You can mirror updates from many RSS and Atom feeds into your StatusNet " "timeline!" diff --git a/plugins/TabFocus/locale/TabFocus.pot b/plugins/TabFocus/locale/TabFocus.pot index 6de47bf08..31cc25966 100644 --- a/plugins/TabFocus/locale/TabFocus.pot +++ b/plugins/TabFocus/locale/TabFocus.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -19,6 +19,6 @@ msgstr "" #: TabFocusPlugin.php:54 msgid "" "TabFocus changes the notice form behavior so that, while in the text area, " -"pressing the tab key focuses the \"Send\" button, matching the behavor of " +"pressing the tab key focuses the \"Send\" button, matching the behavior of " "Twitter." msgstr "" diff --git a/plugins/TightUrl/locale/TightUrl.pot b/plugins/TightUrl/locale/TightUrl.pot index ea0821eee..41026d711 100644 --- a/plugins/TightUrl/locale/TightUrl.pot +++ b/plugins/TightUrl/locale/TightUrl.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/plugins/TinyMCE/locale/TinyMCE.pot b/plugins/TinyMCE/locale/TinyMCE.pot index 788762ba8..c42fea871 100644 --- a/plugins/TinyMCE/locale/TinyMCE.pot +++ b/plugins/TinyMCE/locale/TinyMCE.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,6 +16,6 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: TinyMCEPlugin.php:77 -msgid "Use TinyMCE library to allow rich text editing in the browser" +#: TinyMCEPlugin.php:76 +msgid "Use TinyMCE library to allow rich text editing in the browser." msgstr "" diff --git a/plugins/TwitterBridge/locale/TwitterBridge.pot b/plugins/TwitterBridge/locale/TwitterBridge.pot index b5f906174..625ab8376 100644 --- a/plugins/TwitterBridge/locale/TwitterBridge.pot +++ b/plugins/TwitterBridge/locale/TwitterBridge.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,16 +16,16 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: twitter.php:363 +#: twitter.php:353 msgid "Your Twitter bridge has been disabled." msgstr "" -#: twitter.php:367 +#: twitter.php:357 #, php-format msgid "" "Hi, %1$s. We're sorry to inform you that your link to Twitter has been " "disabled. We no longer seem to have permission to update your Twitter " -"status. (Did you revoke %3$s's access?)\n" +"status. Did you maybe revoke %3$s's access?\n" "\n" "You can re-enable your Twitter bridge by visiting your Twitter settings " "page:\n" @@ -36,92 +36,133 @@ msgid "" "%3$s\n" msgstr "" -#: TwitterBridgePlugin.php:156 TwitterBridgePlugin.php:179 -#: TwitterBridgePlugin.php:296 twitteradminpanel.php:54 +#: TwitterBridgePlugin.php:151 TwitterBridgePlugin.php:174 +#: TwitterBridgePlugin.php:291 twitteradminpanel.php:52 msgid "Twitter" msgstr "" -#: TwitterBridgePlugin.php:157 +#: TwitterBridgePlugin.php:152 msgid "Login or register using Twitter" msgstr "" -#: TwitterBridgePlugin.php:180 +#: TwitterBridgePlugin.php:175 msgid "Twitter integration options" msgstr "" -#: TwitterBridgePlugin.php:297 +#: TwitterBridgePlugin.php:292 msgid "Twitter bridge configuration" msgstr "" -#: TwitterBridgePlugin.php:322 +#: TwitterBridgePlugin.php:316 msgid "" -"The Twitter \"bridge\" plugin allows you to integrate your StatusNet " -"instance with Twitter." +"The Twitter \"bridge\" plugin allows integration of a StatusNet instance " +"with Twitter." msgstr "" -#: twitteradminpanel.php:65 +#: twitteradminpanel.php:62 msgid "Twitter bridge settings" msgstr "" -#: twitteradminpanel.php:150 +#: twitteradminpanel.php:145 msgid "Invalid consumer key. Max length is 255 characters." msgstr "" -#: twitteradminpanel.php:156 +#: twitteradminpanel.php:151 msgid "Invalid consumer secret. Max length is 255 characters." msgstr "" -#: twitteradminpanel.php:216 +#: twitteradminpanel.php:207 msgid "Twitter application settings" msgstr "" -#: twitteradminpanel.php:222 +#: twitteradminpanel.php:213 msgid "Consumer key" msgstr "" -#: twitteradminpanel.php:223 +#: twitteradminpanel.php:214 msgid "Consumer key assigned by Twitter" msgstr "" -#: twitteradminpanel.php:231 +#: twitteradminpanel.php:222 msgid "Consumer secret" msgstr "" -#: twitteradminpanel.php:232 +#: twitteradminpanel.php:223 msgid "Consumer secret assigned by Twitter" msgstr "" -#: twitteradminpanel.php:249 +#: twitteradminpanel.php:233 +msgid "Note: a global consumer key and secret are set." +msgstr "" + +#: twitteradminpanel.php:240 msgid "Integration source" msgstr "" -#: twitteradminpanel.php:250 +#: twitteradminpanel.php:241 msgid "Name of your Twitter application" msgstr "" -#: twitteradminpanel.php:262 +#: twitteradminpanel.php:253 msgid "Options" msgstr "" -#: twitteradminpanel.php:269 +#: twitteradminpanel.php:260 msgid "Enable \"Sign-in with Twitter\"" msgstr "" -#: twitteradminpanel.php:271 +#: twitteradminpanel.php:262 msgid "Allow users to login with their Twitter credentials" msgstr "" -#: twitteradminpanel.php:278 +#: twitteradminpanel.php:269 msgid "Enable Twitter import" msgstr "" -#: twitteradminpanel.php:280 +#: twitteradminpanel.php:271 msgid "" "Allow users to import their Twitter friends' timelines. Requires daemons to " "be manually configured." msgstr "" +#: twitteradminpanel.php:288 twittersettings.php:200 +msgid "Save" +msgstr "" + +#: twitteradminpanel.php:288 +msgid "Save Twitter settings" +msgstr "" + +#: twitterlogin.php:56 +msgid "Already logged in." +msgstr "" + +#: twitterlogin.php:64 +msgid "Twitter Login" +msgstr "" + +#: twitterlogin.php:69 +msgid "Login with your Twitter account" +msgstr "" + +#: twitterlogin.php:87 +msgid "Sign in with Twitter" +msgstr "" + +#: twitterauthorization.php:120 twittersettings.php:226 +msgid "There was a problem with your session token. Try again, please." +msgstr "" + +#: twitterauthorization.php:126 +msgid "You can't register if you don't agree to the license." +msgstr "" + +#: twitterauthorization.php:135 +msgid "Something weird happened." +msgstr "" + #: twitterauthorization.php:181 twitterauthorization.php:229 +#: twitterauthorization.php:300 msgid "Couldn't link your Twitter account." msgstr "" @@ -129,99 +170,197 @@ msgstr "" msgid "Couldn't link your Twitter account: oauth_token mismatch." msgstr "" -#: twittersettings.php:59 +#: twitterauthorization.php:312 +#, php-format +msgid "" +"This is the first time you've logged into %s so we must connect your Twitter " +"account to a local account. You can either create a new account, or connect " +"with your existing account, if you have one." +msgstr "" + +#: twitterauthorization.php:318 +msgid "Twitter Account Setup" +msgstr "" + +#: twitterauthorization.php:351 +msgid "Connection options" +msgstr "" + +#: twitterauthorization.php:360 +#, php-format +msgid "" +"My text and files are available under %s except this private data: password, " +"email address, IM address, and phone number." +msgstr "" + +#: twitterauthorization.php:381 +msgid "Create new account" +msgstr "" + +#: twitterauthorization.php:383 +msgid "Create a new user with this nickname." +msgstr "" + +#: twitterauthorization.php:386 +msgid "New nickname" +msgstr "" + +#: twitterauthorization.php:388 +msgid "1-64 lowercase letters or numbers, no punctuation or spaces" +msgstr "" + +#: twitterauthorization.php:391 +msgid "Create" +msgstr "" + +#: twitterauthorization.php:396 +msgid "Connect existing account" +msgstr "" + +#: twitterauthorization.php:398 +msgid "" +"If you already have an account, login with your username and password to " +"connect it to your Twitter account." +msgstr "" + +#: twitterauthorization.php:401 +msgid "Existing nickname" +msgstr "" + +#: twitterauthorization.php:404 +msgid "Password" +msgstr "" + +#: twitterauthorization.php:407 +msgid "Connect" +msgstr "" + +#: twitterauthorization.php:423 twitterauthorization.php:432 +msgid "Registration not allowed." +msgstr "" + +#: twitterauthorization.php:439 +msgid "Not a valid invitation code." +msgstr "" + +#: twitterauthorization.php:449 +msgid "Nickname must have only lowercase letters and numbers and no spaces." +msgstr "" + +#: twitterauthorization.php:454 +msgid "Nickname not allowed." +msgstr "" + +#: twitterauthorization.php:459 +msgid "Nickname already in use. Try another one." +msgstr "" + +#: twitterauthorization.php:474 +msgid "Error registering user." +msgstr "" + +#: twitterauthorization.php:485 twitterauthorization.php:523 +#: twitterauthorization.php:543 +msgid "Error connecting user to Twitter." +msgstr "" + +#: twitterauthorization.php:505 +msgid "Invalid username or password." +msgstr "" + +#: twittersettings.php:58 msgid "Twitter settings" msgstr "" -#: twittersettings.php:70 +#: twittersettings.php:69 msgid "" "Connect your Twitter account to share your updates with your Twitter friends " "and vice-versa." msgstr "" -#: twittersettings.php:118 +#: twittersettings.php:116 msgid "Twitter account" msgstr "" -#: twittersettings.php:123 +#: twittersettings.php:121 msgid "Connected Twitter account" msgstr "" -#: twittersettings.php:128 +#: twittersettings.php:126 msgid "Disconnect my account from Twitter" msgstr "" -#: twittersettings.php:133 +#: twittersettings.php:132 msgid "Disconnecting your Twitter could make it impossible to log in! Please " msgstr "" -#: twittersettings.php:137 +#: twittersettings.php:136 msgid "set a password" msgstr "" -#: twittersettings.php:139 +#: twittersettings.php:138 msgid " first." msgstr "" -#: twittersettings.php:143 +#. TRANS: %1$s is the current website name. +#: twittersettings.php:142 #, php-format msgid "" "Keep your %1$s account but disconnect from Twitter. You can use your %1$s " "password to log in." msgstr "" -#: twittersettings.php:151 +#: twittersettings.php:150 msgid "Disconnect" msgstr "" -#: twittersettings.php:158 +#: twittersettings.php:157 msgid "Preferences" msgstr "" -#: twittersettings.php:162 +#: twittersettings.php:161 msgid "Automatically send my notices to Twitter." msgstr "" -#: twittersettings.php:169 +#: twittersettings.php:168 msgid "Send local \"@\" replies to Twitter." msgstr "" -#: twittersettings.php:176 +#: twittersettings.php:175 msgid "Subscribe to my Twitter friends here." msgstr "" -#: twittersettings.php:185 -msgid "Import my Friends Timeline." -msgstr "" - -#: twittersettings.php:201 -msgid "Save" +#: twittersettings.php:184 +msgid "Import my friends timeline." msgstr "" -#: twittersettings.php:203 +#: twittersettings.php:202 msgid "Add" msgstr "" -#: twittersettings.php:228 -msgid "There was a problem with your session token. Try again, please." -msgstr "" - -#: twittersettings.php:238 +#: twittersettings.php:236 msgid "Unexpected form submission." msgstr "" -#: twittersettings.php:257 +#: twittersettings.php:254 msgid "Couldn't remove Twitter user." msgstr "" -#: twittersettings.php:261 +#: twittersettings.php:258 msgid "Twitter account disconnected." msgstr "" -#: twittersettings.php:282 twittersettings.php:292 +#: twittersettings.php:278 twittersettings.php:288 msgid "Couldn't save Twitter preferences." msgstr "" -#: twittersettings.php:296 +#: twittersettings.php:292 msgid "Twitter preferences saved." msgstr "" + +#. TRANS: Message used to repeat a notice. RT is the abbreviation of 'retweet'. +#. TRANS: %1$s is the repeated user's name, %2$s is the repeated notice. +#: daemons/twitterstatusfetcher.php:264 +#, php-format +msgid "RT @%1$s %2$s" +msgstr "" diff --git a/plugins/WikiHowProfile/locale/WikiHowProfile.pot b/plugins/WikiHowProfile/locale/WikiHowProfile.pot index a1e49c769..6da28186c 100644 --- a/plugins/WikiHowProfile/locale/WikiHowProfile.pot +++ b/plugins/WikiHowProfile/locale/WikiHowProfile.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-14 22:56+0000\n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,18 +16,18 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: WikiHowProfilePlugin.php:60 +#: WikiHowProfilePlugin.php:59 msgid "" -"Fetches avatar and other profile info for WikiHow users when setting up an " -"account via OpenID." +"Fetches avatar and other profile information for WikiHow users when setting " +"up an account via OpenID." msgstr "" -#: WikiHowProfilePlugin.php:172 +#: WikiHowProfilePlugin.php:171 #, php-format -msgid "Invalid avatar URL %s" +msgid "Invalid avatar URL %s." msgstr "" -#: WikiHowProfilePlugin.php:179 +#: WikiHowProfilePlugin.php:178 #, php-format -msgid "Unable to fetch avatar from %s" +msgid "Unable to fetch avatar from %s." msgstr "" -- cgit v1.2.3-54-g00ecf From cf3f69368778b0aadea015bfd68c1665b1678712 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Sep 2010 00:25:52 +0200 Subject: Remove superfluous whitespace. --- plugins/Facebook/FBConnectSettings.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'plugins') diff --git a/plugins/Facebook/FBConnectSettings.php b/plugins/Facebook/FBConnectSettings.php index 7599bc826..ee0b7d13c 100644 --- a/plugins/Facebook/FBConnectSettings.php +++ b/plugins/Facebook/FBConnectSettings.php @@ -50,7 +50,6 @@ class FBConnectSettingsAction extends ConnectSettingsAction * * @return string Title of the page */ - function title() { return _m('Facebook Connect Settings'); @@ -61,7 +60,6 @@ class FBConnectSettingsAction extends ConnectSettingsAction * * @return instructions for use */ - function getInstructions() { return _m('Manage how your account connects to Facebook'); @@ -74,7 +72,6 @@ class FBConnectSettingsAction extends ConnectSettingsAction * * @return void */ - function showContent() { $user = common_current_user(); @@ -158,7 +155,6 @@ class FBConnectSettingsAction extends ConnectSettingsAction * * @return void */ - function handlePost() { // CSRF protection @@ -202,5 +198,4 @@ class FBConnectSettingsAction extends ConnectSettingsAction } } - } -- cgit v1.2.3-54-g00ecf From 8dafb4c61274bfd925b9be9a490c09374b48914e Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Sep 2010 00:26:47 +0200 Subject: Add pot files. --- plugins/APC/locale/APC.pot | 23 ++++++++++++++++++++ plugins/CacheLog/locale/CacheLog.pot | 21 ++++++++++++++++++ plugins/Disqus/locale/Disqus.pot | 23 ++++++++++++++++++++ plugins/Echo/locale/Echo.pot | 23 ++++++++++++++++++++ plugins/GeoURL/locale/GeoURL.pot | 23 ++++++++++++++++++++ plugins/Geonames/locale/Geonames.pot | 23 ++++++++++++++++++++ plugins/GoogleAnalytics/locale/GoogleAnalytics.pot | 23 ++++++++++++++++++++ plugins/Linkback/locale/Linkback.pot | 25 ++++++++++++++++++++++ plugins/Memcache/locale/Memcache.pot | 22 +++++++++++++++++++ plugins/Memcached/locale/Memcached.pot | 22 +++++++++++++++++++ plugins/PiwikAnalytics/locale/PiwikAnalytics.pot | 23 ++++++++++++++++++++ .../locale/SubscriptionThrottle.pot | 21 ++++++++++++++++++ plugins/UserLimit/locale/UserLimit.pot | 21 ++++++++++++++++++ plugins/WikiHashtags/locale/WikiHashtags.pot | 23 ++++++++++++++++++++ plugins/XCache/locale/XCache.pot | 23 ++++++++++++++++++++ 15 files changed, 339 insertions(+) create mode 100644 plugins/APC/locale/APC.pot create mode 100644 plugins/CacheLog/locale/CacheLog.pot create mode 100644 plugins/Disqus/locale/Disqus.pot create mode 100644 plugins/Echo/locale/Echo.pot create mode 100644 plugins/GeoURL/locale/GeoURL.pot create mode 100644 plugins/Geonames/locale/Geonames.pot create mode 100644 plugins/GoogleAnalytics/locale/GoogleAnalytics.pot create mode 100644 plugins/Linkback/locale/Linkback.pot create mode 100644 plugins/Memcache/locale/Memcache.pot create mode 100644 plugins/Memcached/locale/Memcached.pot create mode 100644 plugins/PiwikAnalytics/locale/PiwikAnalytics.pot create mode 100644 plugins/SubscriptionThrottle/locale/SubscriptionThrottle.pot create mode 100644 plugins/UserLimit/locale/UserLimit.pot create mode 100644 plugins/WikiHashtags/locale/WikiHashtags.pot create mode 100644 plugins/XCache/locale/XCache.pot (limited to 'plugins') diff --git a/plugins/APC/locale/APC.pot b/plugins/APC/locale/APC.pot new file mode 100644 index 000000000..122a51f97 --- /dev/null +++ b/plugins/APC/locale/APC.pot @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: APCPlugin.php:115 +msgid "" +"Use the APC variable cache " +"to cache query results." +msgstr "" diff --git a/plugins/CacheLog/locale/CacheLog.pot b/plugins/CacheLog/locale/CacheLog.pot new file mode 100644 index 000000000..4e0e4112b --- /dev/null +++ b/plugins/CacheLog/locale/CacheLog.pot @@ -0,0 +1,21 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: CacheLogPlugin.php:117 +msgid "Log reads and writes to the cache." +msgstr "" diff --git a/plugins/Disqus/locale/Disqus.pot b/plugins/Disqus/locale/Disqus.pot new file mode 100644 index 000000000..0f9ae44a5 --- /dev/null +++ b/plugins/Disqus/locale/Disqus.pot @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: DisqusPlugin.php:167 +msgid "" +"Use Disqus to add commenting to notice " +"pages." +msgstr "" diff --git a/plugins/Echo/locale/Echo.pot b/plugins/Echo/locale/Echo.pot new file mode 100644 index 000000000..5f45d2a99 --- /dev/null +++ b/plugins/Echo/locale/Echo.pot @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: EchoPlugin.php:112 +msgid "" +"Use Echo to add commenting to notice " +"pages." +msgstr "" diff --git a/plugins/GeoURL/locale/GeoURL.pot b/plugins/GeoURL/locale/GeoURL.pot new file mode 100644 index 000000000..3bc63b851 --- /dev/null +++ b/plugins/GeoURL/locale/GeoURL.pot @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: GeoURLPlugin.php:127 +msgid "" +"Ping GeoURL when new geolocation-enhanced " +"notices are posted." +msgstr "" diff --git a/plugins/Geonames/locale/Geonames.pot b/plugins/Geonames/locale/Geonames.pot new file mode 100644 index 000000000..1d91af301 --- /dev/null +++ b/plugins/Geonames/locale/Geonames.pot @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: GeonamesPlugin.php:498 +msgid "" +"Uses Geonames service to get human-" +"readable names for locations based on user-provided lat/long pairs." +msgstr "" diff --git a/plugins/GoogleAnalytics/locale/GoogleAnalytics.pot b/plugins/GoogleAnalytics/locale/GoogleAnalytics.pot new file mode 100644 index 000000000..4006ccf1f --- /dev/null +++ b/plugins/GoogleAnalytics/locale/GoogleAnalytics.pot @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: GoogleAnalyticsPlugin.php:81 +msgid "" +"Use Google Analytics to " +"track web access." +msgstr "" diff --git a/plugins/Linkback/locale/Linkback.pot b/plugins/Linkback/locale/Linkback.pot new file mode 100644 index 000000000..f97eccdcc --- /dev/null +++ b/plugins/Linkback/locale/Linkback.pot @@ -0,0 +1,25 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: LinkbackPlugin.php:243 +msgid "" +"Notify blog authors when their posts have been linked in microblog notices " +"using Pingback " +"or Trackback protocols." +msgstr "" diff --git a/plugins/Memcache/locale/Memcache.pot b/plugins/Memcache/locale/Memcache.pot new file mode 100644 index 000000000..cba1fe73b --- /dev/null +++ b/plugins/Memcache/locale/Memcache.pot @@ -0,0 +1,22 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: MemcachePlugin.php:252 +msgid "" +"Use Memcached to cache query results." +msgstr "" diff --git a/plugins/Memcached/locale/Memcached.pot b/plugins/Memcached/locale/Memcached.pot new file mode 100644 index 000000000..3748566bd --- /dev/null +++ b/plugins/Memcached/locale/Memcached.pot @@ -0,0 +1,22 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: MemcachedPlugin.php:223 +msgid "" +"Use Memcached to cache query results." +msgstr "" diff --git a/plugins/PiwikAnalytics/locale/PiwikAnalytics.pot b/plugins/PiwikAnalytics/locale/PiwikAnalytics.pot new file mode 100644 index 000000000..2578147a2 --- /dev/null +++ b/plugins/PiwikAnalytics/locale/PiwikAnalytics.pot @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: PiwikAnalyticsPlugin.php:108 +msgid "" +"Use Piwik Open Source web analytics " +"software." +msgstr "" diff --git a/plugins/SubscriptionThrottle/locale/SubscriptionThrottle.pot b/plugins/SubscriptionThrottle/locale/SubscriptionThrottle.pot new file mode 100644 index 000000000..f0fb4dd3c --- /dev/null +++ b/plugins/SubscriptionThrottle/locale/SubscriptionThrottle.pot @@ -0,0 +1,21 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: SubscriptionThrottlePlugin.php:171 +msgid "Configurable limits for subscriptions and group memberships." +msgstr "" diff --git a/plugins/UserLimit/locale/UserLimit.pot b/plugins/UserLimit/locale/UserLimit.pot new file mode 100644 index 000000000..fcce8f676 --- /dev/null +++ b/plugins/UserLimit/locale/UserLimit.pot @@ -0,0 +1,21 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: UserLimitPlugin.php:89 +msgid "Limit the number of users who can register." +msgstr "" diff --git a/plugins/WikiHashtags/locale/WikiHashtags.pot b/plugins/WikiHashtags/locale/WikiHashtags.pot new file mode 100644 index 000000000..cae1daa5a --- /dev/null +++ b/plugins/WikiHashtags/locale/WikiHashtags.pot @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: WikiHashtagsPlugin.php:110 +msgid "" +"Gets hashtag descriptions from WikiHashtags." +msgstr "" diff --git a/plugins/XCache/locale/XCache.pot b/plugins/XCache/locale/XCache.pot new file mode 100644 index 000000000..82992fc82 --- /dev/null +++ b/plugins/XCache/locale/XCache.pot @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: XCachePlugin.php:120 +msgid "" +"Use the XCache variable cache to " +"cache query results." +msgstr "" -- cgit v1.2.3-54-g00ecf From 5a6f6162061985c9d0e67b7d25b94b5a53205ace Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Sep 2010 15:17:36 +0200 Subject: * i18n/L10n update * translator comments added * remove superfluous whitespace --- plugins/OStatus/OStatusPlugin.php | 37 +++++++----- plugins/OStatus/actions/groupsalmon.php | 30 ++++++---- plugins/OStatus/actions/hostmeta.php | 1 - plugins/OStatus/actions/ostatusgroup.php | 8 ++- plugins/OStatus/actions/ostatusinit.php | 22 +++++-- plugins/OStatus/actions/ostatussub.php | 42 ++++++++----- plugins/OStatus/actions/ownerxrd.php | 2 +- plugins/OStatus/actions/pushcallback.php | 26 ++++---- plugins/OStatus/actions/pushhub.php | 37 ++++++------ plugins/OStatus/actions/usersalmon.php | 48 ++++++++------- plugins/OStatus/actions/userxrd.php | 8 +-- plugins/OStatus/classes/FeedSub.php | 9 +-- plugins/OStatus/classes/HubSub.php | 13 ++-- plugins/OStatus/classes/Magicsig.php | 4 -- plugins/OStatus/classes/Ostatus_profile.php | 93 +++++++++++++++-------------- plugins/OStatus/classes/Ostatus_source.php | 4 -- plugins/OStatus/lib/discovery.php | 4 +- plugins/OStatus/lib/discoveryhints.php | 1 - plugins/OStatus/lib/linkheader.php | 3 + plugins/OStatus/lib/magicenvelope.php | 6 +- plugins/OStatus/lib/ostatusqueuehandler.php | 1 - plugins/OStatus/lib/pushinqueuehandler.php | 1 - plugins/OStatus/lib/salmon.php | 5 +- plugins/OStatus/lib/salmonaction.php | 17 +++++- plugins/OStatus/lib/xrd.php | 7 ++- plugins/OStatus/lib/xrdaction.php | 1 - 26 files changed, 236 insertions(+), 194 deletions(-) (limited to 'plugins') diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 77bc9872b..2dddfcbe2 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -223,6 +223,7 @@ class OStatusPlugin extends Plugin array('nickname' => $profile->nickname)); $output->element('a', array('href' => $url, 'class' => 'entity_remote_subscribe'), + // TRANS: Link description for link to subscribe to a remote user. _m('Subscribe')); $output->elementEnd('li'); @@ -241,6 +242,7 @@ class OStatusPlugin extends Plugin array('group' => $group->nickname)); $output->element('a', array('href' => $url, 'class' => 'entity_remote_subscribe'), + // TRANS: Link description for link to join a remote group. _m('Join')); } @@ -453,6 +455,7 @@ class OStatusPlugin extends Plugin } $url = $notice->url; + // TRANSLATE: %s is a domain. $title = sprintf(_m("Sent from %s via OStatus"), $domain); return false; } @@ -524,6 +527,7 @@ class OStatusPlugin extends Plugin } if (!$oprofile->subscribe()) { + // TRANS: Exception. throw new Exception(_m('Could not set up remote subscription.')); } } @@ -563,10 +567,10 @@ class OStatusPlugin extends Plugin common_date_iso8601(time())); $act->time = time(); - $act->title = _("Follow"); + $act->title = _m("Follow"); // TRANS: Success message for subscribe to user attempt through OStatus. // TRANS: %1$s is the subscriber name, %2$s is the subscribed user's name. - $act->content = sprintf(_("%1$s is now following %2$s."), + $act->content = sprintf(_m('%1$s is now following %2$s.'), $subscriber->getBestName(), $other->getBestName()); @@ -613,10 +617,10 @@ class OStatusPlugin extends Plugin common_date_iso8601(time())); $act->time = time(); - $act->title = _("Unfollow"); + $act->title = _m('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(_("%1$s stopped following %2$s."), + $act->content = sprintf(_m('%1$s stopped following %2$s.'), $profile->getBestName(), $other->getBestName()); @@ -671,6 +675,7 @@ class OStatusPlugin extends Plugin return true; } else { $oprofile->garbageCollect(); + // TRANS: Exception. throw new Exception(_m("Failed joining remote group.")); } } @@ -729,7 +734,6 @@ class OStatusPlugin extends Plugin * @param Notice $notice being favored * @return hook return value */ - function onEndFavorNotice(Profile $profile, Notice $notice) { $user = User::staticGet('id', $profile->id); @@ -753,10 +757,10 @@ class OStatusPlugin extends Plugin common_date_iso8601(time())); $act->time = time(); - $act->title = _("Favor"); + $act->title = _m('Favor'); // TRANS: Success message for adding a favorite notice through OStatus. // TRANS: %1$s is the favoring user's name, %2$s is URI to the favored notice. - $act->content = sprintf(_("%1$s marked notice %2$s as a favorite."), + $act->content = sprintf(_m('%1$s marked notice %2$s as a favorite.'), $profile->getBestName(), $notice->uri); @@ -799,10 +803,10 @@ class OStatusPlugin extends Plugin $notice->id, common_date_iso8601(time())); $act->time = time(); - $act->title = _("Disfavor"); + $act->title = _m('Disfavor'); // TRANS: Success message for remove a favorite notice through OStatus. // TRANS: %1$s is the unfavoring user's name, %2$s is URI to the no longer favored notice. - $act->content = sprintf(_("%1$s marked notice %2$s as no longer a favorite."), + $act->content = sprintf(_m('%1$s marked notice %2$s as no longer a favorite.'), $profile->getBestName(), $notice->uri); @@ -876,8 +880,9 @@ class OStatusPlugin extends Plugin $action->elementStart('p', array('id' => 'entity_remote_subscribe', 'class' => 'entity_subscribe')); $action->element('a', array('href' => common_local_url($target), - 'class' => 'entity_remote_subscribe') - , _m('Remote')); // @todo: i18n: Add translator hint for this text. + 'class' => 'entity_remote_subscribe'), + // TRANS: Link text for link to remote subscribe. + _m('Remote')); $action->elementEnd('p'); $action->elementEnd('div'); } @@ -916,6 +921,7 @@ class OStatusPlugin extends Plugin $profile->id, common_date_iso8601(time())); $act->time = time(); + // TRANS: Title for activity. $act->title = _m("Profile update"); // TRANS: Ping text for remote profile update through OStatus. // TRANS: %s is user that updated their profile. @@ -948,7 +954,8 @@ class OStatusPlugin extends Plugin array('nickname' => $profileUser->nickname)); $output->element('a', array('href' => $url, 'class' => 'entity_remote_subscribe'), - _m('Subscribe')); // @todo: i18n: Add context. + // TRANS: Link text for a user to subscribe to an OStatus user. + _m('Subscribe')); $output->elementEnd('li'); } } @@ -962,9 +969,9 @@ class OStatusPlugin extends Plugin 'version' => STATUSNET_VERSION, 'author' => 'Evan Prodromou, James Walker, Brion Vibber, Zach Copley', 'homepage' => 'http://status.net/wiki/Plugin:OStatus', - 'rawdescription' => - _m('Follow people across social networks that implement '. - 'OStatus.')); // @todo i18n: Add translator hint. + // TRANS: Plugin description. + 'rawdescription' => _m('Follow people across social networks that implement '. + 'OStatus.')); return true; } diff --git a/plugins/OStatus/actions/groupsalmon.php b/plugins/OStatus/actions/groupsalmon.php index 5094dccf0..3a3d63fe2 100644 --- a/plugins/OStatus/actions/groupsalmon.php +++ b/plugins/OStatus/actions/groupsalmon.php @@ -17,15 +17,14 @@ * along with this program. If not, see . */ -/** - * @package OStatusPlugin - * @author James Walker - */ - if (!defined('STATUSNET')) { exit(1); } +/** + * @package OStatusPlugin + * @author James Walker + */ class GroupsalmonAction extends SalmonAction { var $group = null; @@ -37,17 +36,20 @@ class GroupsalmonAction extends SalmonAction $id = $this->trimmed('id'); if (!$id) { - $this->clientError(_('No ID.')); + // TRANS: Client error. + $this->clientError(_m('No ID.')); } $this->group = User_group::staticGet('id', $id); if (empty($this->group)) { - $this->clientError(_('No such group.')); + // TRANS: Client error. + $this->clientError(_m('No such group.')); } $oprofile = Ostatus_profile::staticGet('group_id', $id); if ($oprofile) { + // TRANS: Client error. $this->clientError(_m("Can't accept remote posts for a remote group.")); } @@ -57,7 +59,6 @@ class GroupsalmonAction extends SalmonAction /** * We've gotten a post event on the Salmon backchannel, probably a reply. */ - function handlePost() { // @fixme process all objects? @@ -69,18 +70,20 @@ class GroupsalmonAction extends SalmonAction case ActivityObject::COMMENT: break; default: + // TRANS: Client exception. throw new ClientException("Can't handle that kind of post."); } // Notice must be to the attention of this group - $context = $this->activity->context; if (empty($context->attention)) { + // TRANS: Client exception. throw new ClientException("Not to the attention of anyone."); } else { $uri = common_local_url('groupbyid', array('id' => $this->group->id)); if (!in_array($uri, $context->attention)) { + // TRANS: Client exception. throw new ClientException("Not to the attention of this group."); } } @@ -116,14 +119,15 @@ class GroupsalmonAction extends SalmonAction * currently we're doing the main logic in joingroup action * and so have to repeat it here. */ - function handleJoin() { $oprofile = $this->ensureProfile(); if (!$oprofile) { + // TRANS: Client error. $this->clientError(_m("Can't read profile to set up group membership.")); } if ($oprofile->isGroup()) { + // TRANS: Client error. $this->clientError(_m("Groups can't join groups.")); } @@ -137,7 +141,7 @@ class GroupsalmonAction extends SalmonAction } if (Group_block::isBlocked($this->group, $profile)) { - $this->clientError(_('You have been blocked from that group by the admin.'), 403); + $this->clientError(_m('You have been blocked from that group by the admin.'), 403); return false; } @@ -151,6 +155,7 @@ class GroupsalmonAction extends SalmonAction //Event::handle('EndJoinGroup', array($this->group, $profile)); //} } catch (Exception $e) { + // TRANS: Server error. %1$s is a profile URI, %2$s is a group nickname. $this->serverError(sprintf(_m('Could not join remote user %1$s to group %2$s.'), $oprofile->uri, $this->group->nickname)); } @@ -159,7 +164,6 @@ class GroupsalmonAction extends SalmonAction /** * A remote user left our group. */ - function handleLeave() { $oprofile = $this->ensureProfile(); @@ -180,10 +184,10 @@ class GroupsalmonAction extends SalmonAction //Event::handle('EndLeaveGroup', array($this->group, $profile)); //} } catch (Exception $e) { + // TRANS: Server error. %1$s is a profile URI, %2$s is a group nickname. $this->serverError(sprintf(_m('Could not remove remote user %1$s from group %2$s.'), $oprofile->uri, $this->group->nickname)); return; } } - } diff --git a/plugins/OStatus/actions/hostmeta.php b/plugins/OStatus/actions/hostmeta.php index 8ca07f916..db4c913e1 100644 --- a/plugins/OStatus/actions/hostmeta.php +++ b/plugins/OStatus/actions/hostmeta.php @@ -26,7 +26,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class HostMetaAction extends Action { - function handle() { parent::handle(); diff --git a/plugins/OStatus/actions/ostatusgroup.php b/plugins/OStatus/actions/ostatusgroup.php index 1861e866f..7db00ffbe 100644 --- a/plugins/OStatus/actions/ostatusgroup.php +++ b/plugins/OStatus/actions/ostatusgroup.php @@ -72,13 +72,16 @@ class OStatusGroupAction extends OStatusSubAction $this->elementStart('ul', 'form_data'); $this->elementStart('li'); $this->input('profile', + // TRANS: Field label. _m('Join group'), $this->profile_uri, + // TRANS: Tooltip for field label "Join group". _m("OStatus group's address, like http://example.net/group/nickname.")); $this->elementEnd('li'); $this->elementEnd('ul'); - $this->submit('validate', _m('Continue')); + // TRANS: Button text. + $this->submit('validate', _m('BUTTON','Continue')); $this->elementEnd('fieldset'); @@ -156,7 +159,6 @@ class OStatusGroupAction extends OStatusSubAction * * @return string Title of the page */ - function title() { // TRANS: Page title for OStatus remote group join form @@ -168,9 +170,9 @@ class OStatusGroupAction extends OStatusSubAction * * @return instructions for use */ - function getInstructions() { + // TRANS: Instructions. return _m('You can subscribe to groups from other supported sites. Paste the group\'s profile URI below:'); } diff --git a/plugins/OStatus/actions/ostatusinit.php b/plugins/OStatus/actions/ostatusinit.php index 0c991aba9..f576823e3 100644 --- a/plugins/OStatus/actions/ostatusinit.php +++ b/plugins/OStatus/actions/ostatusinit.php @@ -27,7 +27,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class OStatusInitAction extends Action { - var $nickname; var $group; var $profile; @@ -38,6 +37,7 @@ class OStatusInitAction extends Action parent::prepare($args); if (common_logged_in()) { + // TRANS: Client error. $this->clientError(_m('You can use the local subscription!')); return false; } @@ -78,6 +78,7 @@ class OStatusInitAction extends Action $this->xw->startDocument('1.0', 'UTF-8'); $this->elementStart('html'); $this->elementStart('head'); + // TRANS: Form title. $this->element('title', null, _m('Subscribe to user')); $this->elementEnd('head'); $this->elementStart('body'); @@ -92,11 +93,15 @@ class OStatusInitAction extends Action function showContent() { if ($this->group) { + // TRANS: Form legend. $header = sprintf(_m('Join group %s'), $this->group); - $submit = _m('Join'); + // TRANS: Button text. + $submit = _m('BUTTON','Join'); } else { + // TRANS: Form legend. $header = sprintf(_m('Subscribe to %s'), $this->nickname); - $submit = _m('Subscribe'); + // TRANS: Button text. + $submit = _m('BUTTON','Subscribe'); } $this->elementStart('form', array('id' => 'form_ostatus_connect', 'method' => 'post', @@ -108,12 +113,15 @@ class OStatusInitAction extends Action $this->elementStart('ul', 'form_data'); $this->elementStart('li', array('id' => 'ostatus_nickname')); + // TRANS: Field label. $this->input('nickname', _m('User nickname'), $this->nickname, _m('Nickname of the user you want to follow.')); $this->hidden('group', $this->group); // pass-through for magic links $this->elementEnd('li'); $this->elementStart('li', array('id' => 'ostatus_profile')); + // 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).')); $this->elementEnd('li'); $this->elementEnd('ul'); @@ -135,6 +143,7 @@ class OStatusInitAction extends Action } elseif (strpos($this->profile, '@') !== false) { $this->connectWebfinger($this->profile); } else { + // TRANS: Client error. $this->clientError(_m("Must provide a remote profile.")); } } @@ -146,6 +155,7 @@ class OStatusInitAction extends Action $disco = new Discovery; $result = $disco->lookup($acct); if (!$result) { + // TRANS: Client error. $this->clientError(_m("Couldn't look up OStatus account profile.")); } @@ -158,6 +168,7 @@ class OStatusInitAction extends Action } } + // TRANS: Client error. $this->clientError(_m("Couldn't confirm remote profile address.")); } @@ -183,6 +194,7 @@ class OStatusInitAction extends Action if ($user) { return common_local_url('userbyid', array('id' => $user->id)); } else { + // TRANS: Client error. $this->clientError("No such user."); } } else if ($this->group) { @@ -190,16 +202,18 @@ class OStatusInitAction extends Action if ($group) { return common_local_url('groupbyid', array('id' => $group->group_id)); } else { + // TRANS: Client error. $this->clientError("No such group."); } } else { + // TRANS: Client error. $this->clientError("No local user or group nickname provided."); } } function title() { + // TRANS: Page title. return _m('OStatus Connect'); } - } diff --git a/plugins/OStatus/actions/ostatussub.php b/plugins/OStatus/actions/ostatussub.php index 4cbd7d034..493b51965 100644 --- a/plugins/OStatus/actions/ostatussub.php +++ b/plugins/OStatus/actions/ostatussub.php @@ -62,13 +62,15 @@ class OStatusSubAction extends Action $this->elementStart('ul', 'form_data'); $this->elementStart('li'); $this->input('profile', + // TRANS: Field label for a field that takes an OStatus user address. _m('Subscribe to'), $this->profile_uri, - _m("OStatus user's address, like nickname@example.com or http://example.net/nickname")); // @todo i18n FIXME: needs context/translator hint. + // TRANS: Tooltip for field label "Subscribe to". + _m('OStatus user\'s address, like nickname@example.com or http://example.net/nickname')); $this->elementEnd('li'); $this->elementEnd('ul'); - - $this->submit('validate', _m('Continue')); // @todo i18n FIXME: needs context/translator hint. + // TRANS: Button text. + $this->submit('validate', _m('BUTTON','Continue')); $this->elementEnd('fieldset'); @@ -103,10 +105,14 @@ class OStatusSubAction extends Action $this->hidden('profile', $this->profile_uri); if ($this->oprofile->isGroup()) { $this->submit('submit', _m('Join'), 'submit', null, - _m('Join this group')); // @todo i18n FIXME: needs context/translator hint. + // TRANS: Button text. + // TRANS: Tooltip for button "Join". + _m('BUTTON','Join this group')); } else { - $this->submit('submit', _m('Confirm'), 'submit', null, - _m('Subscribe to this user')); // @todo i18n FIXME: needs context/translator hint. + // TRANS: Button text. + $this->submit('submit', _m('BUTTON','Confirm'), 'submit', null, + // TRANS: Tooltip for button "Confirm". + _m('Subscribe to this user')); } $this->elementEnd('fieldset'); $this->elementEnd('form'); @@ -156,7 +162,7 @@ class OStatusSubAction extends Action $this->elementStart('div', 'entity_profile vcard'); $this->elementStart('dl', 'entity_depiction'); - $this->element('dt', null, _('Photo')); + $this->element('dt', null, _m('Photo')); $this->elementStart('dd'); $this->element('img', array('src' => $avatar, 'class' => 'photo avatar', @@ -167,7 +173,7 @@ class OStatusSubAction extends Action $this->elementEnd('dl'); $this->elementStart('dl', 'entity_nickname'); - $this->element('dt', null, _('Nickname')); + $this->element('dt', null, _m('Nickname')); $this->elementStart('dd'); $hasFN = ($fullname !== '') ? 'nickname' : 'fn nickname'; $this->elementStart('a', array('href' => $profile, @@ -188,7 +194,7 @@ class OStatusSubAction extends Action } if (!is_null($location)) { $this->elementStart('dl', 'entity_location'); - $this->element('dt', null, _('Location')); + $this->element('dt', null, _m('Location')); $this->elementStart('dd', 'label'); $this->raw($location); $this->elementEnd('dd'); @@ -197,7 +203,7 @@ class OStatusSubAction extends Action if (!is_null($homepage)) { $this->elementStart('dl', 'entity_url'); - $this->element('dt', null, _('URL')); + $this->element('dt', null, _m('URL')); $this->elementStart('dd'); $this->elementStart('a', array('href' => $homepage, 'class' => 'url')); @@ -209,7 +215,7 @@ class OStatusSubAction extends Action if (!is_null($note)) { $this->elementStart('dl', 'entity_note'); - $this->element('dt', null, _('Note')); + $this->element('dt', null, _m('Note')); $this->elementStart('dd', 'note'); $this->raw($note); $this->elementEnd('dd'); @@ -244,31 +250,39 @@ class OStatusSubAction extends Action } else if (Validate::uri($this->profile_uri)) { $this->oprofile = Ostatus_profile::ensureProfileURL($this->profile_uri); } else { + // TRANS: Error text. $this->error = _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."); common_debug('Invalid address format.', __FILE__); return false; } return true; } catch (FeedSubBadURLException $e) { + // TRANS: Error text. $this->error = _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."); common_debug('Invalid URL or could not reach server.', __FILE__); } catch (FeedSubBadResponseException $e) { + // TRANS: Error text. $this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later."); common_debug('Cannot read feed; server returned error.', __FILE__); } catch (FeedSubEmptyException $e) { + // TRANS: Error text. $this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later."); common_debug('Cannot read feed; server returned an empty page.', __FILE__); } catch (FeedSubBadHTMLException $e) { + // TRANS: Error text. $this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later."); common_debug('Bad HTML, could not find feed link.', __FILE__); } catch (FeedSubNoFeedException $e) { + // TRANS: Error text. $this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later."); common_debug('Could not find a feed linked from this URL.', __FILE__); } catch (FeedSubUnrecognizedTypeException $e) { + // TRANS: Error text. $this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later."); common_debug('Not a recognized feed type.', __FILE__); } catch (Exception $e) { // Any new ones we forgot about + // TRANS: Error text. $this->error = _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."); common_debug(sprintf('Bad feed URL: %s %s', get_class($e), $e->getMessage()), __FILE__); } @@ -350,7 +364,7 @@ class OStatusSubAction extends Action // CSRF protection $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { - $this->showForm(_('There was a problem with your session token. '. + $this->showForm(_m('There was a problem with your session token. '. 'Try again, please.')); return; } @@ -377,6 +391,7 @@ class OStatusSubAction extends Action $this->xw->startDocument('1.0', 'UTF-8'); $this->elementStart('html'); $this->elementStart('head'); + // TRANS: Form title. $this->element('title', null, _m('Subscribe to user')); $this->elementEnd('head'); $this->elementStart('body'); @@ -408,6 +423,7 @@ class OStatusSubAction extends Action function getInstructions() { + // TRANS: Instructions. return _m('You can subscribe to users from other supported sites. Paste their address or profile URI below:'); } @@ -426,7 +442,6 @@ class OStatusSubAction extends Action * * @return void */ - function showContent() { if ($this->oprofile) { @@ -459,5 +474,4 @@ class OStatusSubAction extends Action function showNoticeForm() { // nop } - } diff --git a/plugins/OStatus/actions/ownerxrd.php b/plugins/OStatus/actions/ownerxrd.php index 3fcb982b8..9e84f72ec 100644 --- a/plugins/OStatus/actions/ownerxrd.php +++ b/plugins/OStatus/actions/ownerxrd.php @@ -34,7 +34,7 @@ class OwnerxrdAction extends XrdAction $this->user = User::siteOwner(); if (!$this->user) { - $this->clientError(_('No such user.'), 404); + $this->clientError(_m('No such user.'), 404); return false; } diff --git a/plugins/OStatus/actions/pushcallback.php b/plugins/OStatus/actions/pushcallback.php index 6c6978745..701a39c16 100644 --- a/plugins/OStatus/actions/pushcallback.php +++ b/plugins/OStatus/actions/pushcallback.php @@ -24,7 +24,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } - class PushCallbackAction extends Action { function handle() @@ -46,13 +45,13 @@ class PushCallbackAction extends Action $feedid = $this->arg('feed'); common_log(LOG_INFO, "POST for feed id $feedid"); if (!$feedid) { - throw new ServerException('Empty or invalid feed id.', 400); + throw new ServerException(_m('Empty or invalid feed id.'), 400); } $feedsub = FeedSub::staticGet('id', $feedid); if (!$feedsub) { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ServerException('Unknown PuSH feed id ' . $feedid, 400); + // TRANS: Server exception. %s is a feed ID. + throw new ServerException(sprintf(_m('Unknown PuSH feed id %s'),$feedid), 400); } $hmac = ''; @@ -84,30 +83,31 @@ class PushCallbackAction extends Action $verify_token = $this->arg('hub_verify_token'); if ($mode != 'subscribe' && $mode != 'unsubscribe') { - throw new ClientException("Bad hub.mode $mode", 404); + // TRANS: Client exception. %s is an invalid value for hub.mode. + throw new ClientException(sprintf(_m('Bad hub.mode "$s".',$mode)), 404); } $feedsub = FeedSub::staticGet('uri', $topic); if (!$feedsub) { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Bad hub.topic feed $topic.", 404); + // TRANS: Client exception. %s is an invalid feed name. + throw new ClientException(sprintf(_m('Bad hub.topic feed "%s".'),$topic), 404); } if ($feedsub->verify_token !== $verify_token) { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Bad hub.verify_token $token for $topic.", 404); + // TRANS: Client exception. %1$s the invalid token, %2$s is the topic for which the invalid token was given. + throw new ClientException(sprintf(_m('Bad hub.verify_token %1$s for %2$s.'),$token,$topic), 404); } if ($mode == 'subscribe') { // We may get re-sub requests legitimately. if ($feedsub->sub_state != 'subscribe' && $feedsub->sub_state != 'active') { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Unexpected subscribe request for $topic.", 404); + // TRANS: Client exception. %s is an invalid topic. + throw new ClientException(sprintf(_m('Unexpected subscribe request for %s.'),$topic), 404); } } else { if ($feedsub->sub_state != 'unsubscribe') { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Unexpected unsubscribe request for $topic.", 404); + // TRANS: Client exception. %s is an invalid topic. + throw new ClientException(sprintf(_m('Unexpected unsubscribe request for %s.'),$topic), 404); } } diff --git a/plugins/OStatus/actions/pushhub.php b/plugins/OStatus/actions/pushhub.php index 6909b8539..68035ab5c 100644 --- a/plugins/OStatus/actions/pushhub.php +++ b/plugins/OStatus/actions/pushhub.php @@ -62,11 +62,11 @@ class PushHubAction extends Action $this->subunsub($mode); break; case "publish": - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Publishing outside feeds not supported.", 400); + // TRANS: Client exception. + throw new ClientException(_m('Publishing outside feeds not supported.'), 400); default: - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Unrecognized mode '$mode'.", 400); + // TRANS: Client exception. %s is a mode. + throw new ClientException(sprintf(_m('Unrecognized mode "%s".'),$mode), 400); } } @@ -85,28 +85,28 @@ class PushHubAction extends Action $topic = $this->argUrl('hub.topic'); if (!$this->recognizedFeed($topic)) { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Unsupported hub.topic $topic; this hub only serves local user and group Atom feeds."); + // TRANS: Client exception. %s is a topic. + throw new ClientException(sprintf(_m('Unsupported hub.topic %s this hub only serves local user and group Atom feeds.'),$topic)); } $verify = $this->arg('hub.verify'); // @fixme may be multiple if ($verify != 'sync' && $verify != 'async') { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Invalid hub.verify $verify; must be sync or async."); + // TRANS: Client exception. + 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)) { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Invalid hub.lease $lease; must be empty or positive integer."); + // TRANS: Client exception. + throw new ClientException(sprintf(_m('Invalid hub.lease "%s". It must be empty or positive integer.'),$lease)); } $token = $this->arg('hub.verify_token', null); $secret = $this->arg('hub.secret', null); if ($secret != '' && strlen($secret) >= 200) { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Invalid hub.secret $secret; must be under 200 bytes."); + // TRANS: Client exception. + throw new ClientException(sprintf(_m('Invalid hub.secret "%s". It must be under 200 bytes.'),$secret)); } $sub = HubSub::staticGet($topic, $callback); @@ -157,8 +157,8 @@ class PushHubAction extends Action if ($feed == $userFeed) { $user = User::staticGet('id', $id); if (!$user) { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Invalid hub.topic $feed; user doesn't exist."); + // TRANS: Client exception. + throw new ClientException(sprintt(_m('Invalid hub.topic "%s". User doesn\'t exist.'),$feed)); } else { return true; } @@ -166,8 +166,8 @@ class PushHubAction extends Action if ($feed == $groupFeed) { $user = User_group::staticGet('id', $id); if (!$user) { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Invalid hub.topic $feed; group doesn't exist."); + // TRANS: Client exception. + throw new ClientException(sprintf(_m('Invalid hub.topic "%s". Group doesn\'t exist.'),$feed)); } else { return true; } @@ -190,8 +190,9 @@ class PushHubAction extends Action if (Validate::uri($url, $params)) { return $url; } else { - // @todo i18n FIXME: added i18n and use sprintf when using parameters. - throw new ClientException("Invalid URL passed for $arg: '$url'"); + // TRANS: Client exception. + // TRANS: %1$s is this argument to the method this exception occurs in, %2$s is a URL. + throw new ClientException(sprintf(_m('Invalid URL passed for %1$s: "%2$s"'),$arg,$url)); } } diff --git a/plugins/OStatus/actions/usersalmon.php b/plugins/OStatus/actions/usersalmon.php index 06a72bf02..e78c65330 100644 --- a/plugins/OStatus/actions/usersalmon.php +++ b/plugins/OStatus/actions/usersalmon.php @@ -17,15 +17,14 @@ * along with this program. If not, see . */ -/** - * @package OStatusPlugin - * @author James Walker - */ - if (!defined('STATUSNET')) { exit(1); } +/** + * @package OStatusPlugin + * @author James Walker + */ class UsersalmonAction extends SalmonAction { function prepare($args) @@ -35,13 +34,13 @@ class UsersalmonAction extends SalmonAction $id = $this->trimmed('id'); if (!$id) { - $this->clientError(_('No ID.')); + $this->clientError(_m('No ID.')); } $this->user = User::staticGet('id', $id); if (empty($this->user)) { - $this->clientError(_('No such user.')); + $this->clientError(_m('No such user.')); } return true; @@ -78,20 +77,24 @@ class UsersalmonAction extends SalmonAction if (!empty($context->replyToID)) { $notice = Notice::staticGet('uri', $context->replyToID); if (empty($notice)) { - throw new ClientException("In reply to unknown notice"); + // TRANS: Client exception. + throw new ClientException(_m('In reply to unknown notice.')); } if ($notice->profile_id != $this->user->id && !in_array($this->user->id, $notice->getReplies())) { - throw new ClientException("In reply to a notice not by this user and not mentioning this user"); + // TRANS: Client exception. + throw new ClientException(_m('In reply to a notice not by this user and not mentioning this user.')); } } else if (!empty($context->attention)) { if (!in_array($this->user->uri, $context->attention) && !in_array(common_profile_url($this->user->nickname), $context->attention)) { common_log(LOG_ERR, "{$this->user->uri} not in attention list (".implode(',', $context->attention).")"); - throw new ClientException("To the attention of user(s) not including this one!"); + // TRANS: Client exception. + throw new ClientException('To the attention of user(s), not including this one.'); } } else { - throw new ClientException("Not to anyone in reply to anything!"); + // TRANS: Client exception. + throw new ClientException('Not to anyone in reply to anything.'); } $existing = Notice::staticGet('uri', $this->activity->objects[0]->id); @@ -108,7 +111,6 @@ class UsersalmonAction extends SalmonAction * We've gotten a follow/subscribe notification from a remote user. * Save a subscription relationship for them. */ - function handleFollow() { $oprofile = $this->ensureProfile(); @@ -152,11 +154,13 @@ class UsersalmonAction extends SalmonAction 'notice_id' => $notice->id)); if (!empty($old)) { - throw new ClientException("We already know that's a fave!"); + // TRANS: Client exception. + throw new ClientException(_('This is already a favorite.')); } if (!Fave::addNew($profile, $notice)) { - throw new ClientException("Could not save new favorite."); + // TRANS: Client exception. + throw new ClientException(_m('Could not save new favorite.')); } } @@ -172,7 +176,8 @@ class UsersalmonAction extends SalmonAction $fave = Fave::pkeyGet(array('user_id' => $profile->id, 'notice_id' => $notice->id)); if (empty($fave)) { - throw new ClientException("Notice wasn't favorited!"); + // TRANS: Client exception. + throw new ClientException(_('Notice wasn\'t favorited!')); } $fave->delete(); @@ -186,7 +191,8 @@ class UsersalmonAction extends SalmonAction function getNotice($object) { if (!$object) { - throw new ClientException("Can't favorite/unfavorite without an object."); + // TRANS: Client exception. + throw new ClientException(_m('Can\'t favorite/unfavorite without an object.')); } switch ($object->type) { @@ -197,20 +203,22 @@ class UsersalmonAction extends SalmonAction case ActivityObject::COMMENT: break; default: - throw new ClientException("Can't handle that kind of object for liking/faving."); + // TRANS: Client exception. + throw new ClientException(_m('Can\'t handle that kind of object for liking/faving.')); } $notice = Notice::staticGet('uri', $object->id); if (empty($notice)) { - throw new ClientException("Notice with ID $object->id unknown."); + // TRANS: Client exception. %s is an object ID. + throw new ClientException(sprintf(_m('Notice with ID %s unknown.'),$object->id)); } if ($notice->profile_id != $this->user->id) { - throw new ClientException("Notice with ID $object->id not posted by $this->user->id."); + // TRANS: Client exception. %1$s is a notice ID, %2$s is a user ID. + throw new ClientException(sprintf(_m('Notice with ID %1$s not posted by %2$s.'),$object->id,$this->user->id)); } return $notice; } - } diff --git a/plugins/OStatus/actions/userxrd.php b/plugins/OStatus/actions/userxrd.php index dd720568b..9aa7c0306 100644 --- a/plugins/OStatus/actions/userxrd.php +++ b/plugins/OStatus/actions/userxrd.php @@ -17,16 +17,14 @@ * along with this program. If not, see . */ +if (!defined('STATUSNET')) { exit(1); } + /** * @package OStatusPlugin * @maintainer James Walker */ - -if (!defined('STATUSNET')) { exit(1); } - class UserxrdAction extends XrdAction { - function prepare($args) { parent::prepare($args); @@ -46,7 +44,7 @@ class UserxrdAction extends XrdAction $this->user = User::staticGet('uri', $this->uri); } if (!$this->user) { - $this->clientError(_('No such user.'), 404); + $this->clientError(_m('No such user.'), 404); return false; } diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php index 6f9e0856a..58beec673 100644 --- a/plugins/OStatus/classes/FeedSub.php +++ b/plugins/OStatus/classes/FeedSub.php @@ -39,7 +39,6 @@ PuSH subscription flow: hub sends us updates via POST */ - class FeedDBException extends FeedSubException { public $obj; @@ -88,7 +87,6 @@ class FeedSub extends Memcached_DataObject * * @return array array of column definitions */ - function table() { return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, @@ -143,7 +141,6 @@ class FeedSub extends Memcached_DataObject * * @return array key definitions */ - function keys() { return array_keys($this->keyTypes()); @@ -157,7 +154,6 @@ class FeedSub extends Memcached_DataObject * * @return array key definitions */ - function keyTypes() { return array('id' => 'K', 'uri' => 'U'); @@ -249,7 +245,7 @@ class FeedSub extends Memcached_DataObject // We'll never actually get updates in this mode. return true; } else { - throw new ServerException("Attempting to start PuSH subscription for feed with no hub."); + throw new ServerException(_m('Attempting to start PuSH subscription for feed with no hub.')); } } @@ -279,7 +275,7 @@ class FeedSub extends Memcached_DataObject // We'll never actually get updates in this mode. return true; } else { - throw new ServerException("Attempting to end PuSH subscription for feed with no hub."); + throw new ServerException(_m('Attempting to end PuSH subscription for feed with no hub.')); } } @@ -500,5 +496,4 @@ class FeedSub extends Memcached_DataObject } return false; } - } diff --git a/plugins/OStatus/classes/HubSub.php b/plugins/OStatus/classes/HubSub.php index e01ae4e79..825d36ebd 100644 --- a/plugins/OStatus/classes/HubSub.php +++ b/plugins/OStatus/classes/HubSub.php @@ -54,7 +54,6 @@ class HubSub extends Memcached_DataObject * * @return array array of column definitions */ - function table() { return array('hashkey' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, @@ -112,7 +111,6 @@ class HubSub extends Memcached_DataObject * * @return array key definitions */ - function keyTypes() { return array('hashkey' => 'K'); @@ -206,8 +204,8 @@ class HubSub extends Memcached_DataObject if ($status >= 200 && $status < 300) { common_log(LOG_INFO, "Verified $mode of $this->callback:$this->topic"); } else { - // @todo i18n FIXME: add i18n and use sprintf for parameter. - throw new ClientException("Hub subscriber verification returned HTTP $status"); + // TRANS: Client exception. %s is a HTTP status code. + throw new ClientException(sprintf(_m('Hub subscriber verification returned HTTP %s.'),$status)); } $old = HubSub::staticGet($this->topic, $this->callback); @@ -353,10 +351,9 @@ class HubSub extends Memcached_DataObject if ($response->isOk()) { return true; } else { - throw new Exception("Callback returned status: " . - $response->getStatus() . - "; body: " . - trim($response->getBody())); + // TRANS: Exception. %1$s is a response status code, %2$s is the body of the response. + throw new Exception(sprintf(_m('Callback returned status: %1$s. Body: %2$s'), + $response->getStatus(),trim($response->getBody()))); } } } diff --git a/plugins/OStatus/classes/Magicsig.php b/plugins/OStatus/classes/Magicsig.php index e39a6d8f7..20025c37a 100644 --- a/plugins/OStatus/classes/Magicsig.php +++ b/plugins/OStatus/classes/Magicsig.php @@ -31,7 +31,6 @@ require_once 'Crypt/RSA.php'; class Magicsig extends Memcached_DataObject { - const PUBLICKEYREL = 'magic-public-key'; public $__table = 'magicsig'; @@ -86,7 +85,6 @@ class Magicsig extends Memcached_DataObject 64, false)); } - function keys() { return array_keys($this->keyTypes()); @@ -126,7 +124,6 @@ class Magicsig extends Memcached_DataObject $this->insert(); } - public function toString($full_pair = true) { $mod = Magicsig::base64_url_encode($this->publicKey->modulus->toBytes()); @@ -197,7 +194,6 @@ class Magicsig extends Memcached_DataObject case 'RSA-SHA256': return 'sha256'; } - } public function sign($bytes) diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 11ca67b25..402d1967f 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -21,7 +21,6 @@ * @package OStatusPlugin * @maintainer Brion Vibber */ - class Ostatus_profile extends Memcached_DataObject { public $__table = 'ostatus_profile'; @@ -51,7 +50,6 @@ class Ostatus_profile extends Memcached_DataObject * * @return array array of column definitions */ - function table() { return array('uri' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, @@ -92,7 +90,6 @@ class Ostatus_profile extends Memcached_DataObject * * @return array key definitions */ - function keys() { return array_keys($this->keyTypes()); @@ -106,7 +103,6 @@ class Ostatus_profile extends Memcached_DataObject * * @return array key definitions */ - function keyTypes() { return array('uri' => 'K', 'profile_id' => 'U', 'group_id' => 'U', 'feeduri' => 'U'); @@ -188,11 +184,11 @@ class Ostatus_profile extends Memcached_DataObject } else if ($this->group_id && !$this->profile_id) { return true; } else if ($this->group_id && $this->profile_id) { - // @todo i18n FIXME: use sprintf and add i18n. - throw new ServerException("Invalid ostatus_profile state: both group and profile IDs set for $this->uri."); + // TRANS: Server exception. + throw new ServerException(sprintf(_m('Invalid ostatus_profile state: both group and profile IDs set for %s.'),$this->uri)); } else { - // @todo i18n FIXME: use sprintf and add i18n. - throw new ServerException("Invalid ostatus_profile state: both group and profile IDs empty for $this->uri."); + // TRANS: Server exception. + throw new ServerException(sprintf(_m('Invalid ostatus_profile state: both group and profile IDs empty for %s.'),$this->uri)); } } @@ -280,7 +276,9 @@ class Ostatus_profile extends Memcached_DataObject if ($type == 'object') { $type = get_class($actor); } - throw new ServerException("Invalid actor passed to " . __METHOD__ . ": " . $type); + // TRANS: Server exception. + // TRANS: %1$s is the method name the exception occured in, %2$s is the actor type. + throw new ServerException(sprintf(_m('Invalid actor passed to %1$s: %2$s.'),__METHOD__,$type)); } if ($object == null) { $object = $this; @@ -372,8 +370,8 @@ class Ostatus_profile extends Memcached_DataObject } else if ($entry instanceof Notice) { return $preamble . $entry->asAtomEntry(true, true); } else { - // @todo i18n FIXME: use sprintf and add i18n. - throw new ServerException("Invalid type passed to Ostatus_profile::notify; must be XML string or Activity entry."); + // TRANS: Server exception. + throw new ServerException(_m('Invalid type passed to Ostatus_profile::notify. It must be XML string or Activity entry.')); } } @@ -403,7 +401,7 @@ class Ostatus_profile extends Memcached_DataObject } else if ($feed->localName == 'rss') { // @fixme check namespace $this->processRssFeed($feed, $source); } else { - throw new Exception("Unknown feed format."); + throw new Exception(_m('Unknown feed format.')); } } @@ -426,7 +424,7 @@ class Ostatus_profile extends Memcached_DataObject $channels = $rss->getElementsByTagName('channel'); if ($channels->length == 0) { - throw new Exception("RSS feed without a channel."); + throw new Exception(_m('RSS feed without a channel.')); } else if ($channels->length > 1) { common_log(LOG_WARNING, __METHOD__ . ": more than one channel in an RSS feed"); } @@ -470,7 +468,8 @@ class Ostatus_profile extends Memcached_DataObject } break; default: - throw new ClientException("Can't handle that kind of post."); + // TRANS: Client exception. + throw new ClientException(_m('Can\'t handle that kind of post.')); } Event::handle('EndHandleFeedEntry', array($activity)); @@ -552,8 +551,8 @@ class Ostatus_profile extends Memcached_DataObject $sourceContent = $note->title; } else { // @fixme fetch from $sourceUrl? - // @todo i18n FIXME: use sprintf and add i18n. - throw new ClientException("No content for notice {$sourceUri}."); + // TRANS: Client exception. %s is a source URL. + throw new ClientException(sprintf(_m('No content for notice %s.'),$sourceUri)); } // Get (safe!) HTML and text versions of the content @@ -584,14 +583,17 @@ class Ostatus_profile extends Memcached_DataObject // We mark up the attachment link specially for the HTML output // so we can fold-out the full version inline. + + // TRANS: Shown when a notice is longer than supported and/or when attachments are present. + $showMoreText = _m('Show more'); $attachUrl = common_local_url('attachment', array('attachment' => $attachment->id)); $rendered = common_render_text($shortSummary) . '' . + ' title="'. htmlspecialchars($showMoreText) . '">' . '…' . - ''; // @todo i18n FIXME: add translator hint/context. + ''; } } @@ -775,8 +777,8 @@ class Ostatus_profile extends Memcached_DataObject $response = $client->get($profile_url); if (!$response->isOk()) { - // @todo i18n FIXME: use sprintf and add i18n. - throw new Exception("Could not reach profile page: " . $profile_url); + // TRANS: Exception. %s is a profile URL. + throw new Exception(sprintf(_m('Could not reach profile page %s.'),$profile_url)); } // Check if we have a non-canonical URL @@ -833,8 +835,8 @@ class Ostatus_profile extends Memcached_DataObject return self::ensureFeedURL($feedurl, $hints); } - // @todo i18n FIXME: use sprintf and add i18n. - throw new Exception("Could not find a feed URL for profile page " . $finalUrl); + // TRANS: Exception. + throw new Exception(sprintf(_m('Could not find a feed URL for profile page %s.'),$finalUrl)); } /** @@ -866,7 +868,7 @@ class Ostatus_profile extends Memcached_DataObject $user = User::staticGet('id', $profile->id); if (!empty($user)) { - // @todo i18n FIXME: use sprintf and add i18n. + // @todo i18n FIXME: use sprintf and add i18n (?) throw new OStatusShadowException($profile, "'$profile_url' is the profile for local user '{$user->nickname}'."); } @@ -971,8 +973,7 @@ class Ostatus_profile extends Memcached_DataObject } // XXX: make some educated guesses here - - throw new FeedSubException("Can't find enough profile information to make a feed."); + throw new FeedSubException(_m('Can\'t find enough profile information to make a feed.')); } /** @@ -1270,13 +1271,13 @@ class Ostatus_profile extends Memcached_DataObject $user = User::staticGet('uri', $homeuri); if ($user) { - // @todo i18n FIXME: add i18n. - throw new Exception("Local user can't be referenced as remote."); + // TRANS: Exception. + throw new Exception(_m('Local user can\'t be referenced as remote.')); } if (OStatusPlugin::localGroupFromUrl($homeuri)) { - // @todo i18n FIXME: add i18n. - throw new Exception("Local group can't be referenced as remote."); + // TRANS: Exception. + throw new Exception(_m('Local group can\'t be referenced as remote.')); } if (array_key_exists('feedurl', $hints)) { @@ -1327,8 +1328,8 @@ class Ostatus_profile extends Memcached_DataObject $oprofile->profile_id = $profile->insert(); if (!$oprofile->profile_id) { - // @todo i18n FIXME: add i18n. - throw new ServerException("Can't save local profile."); + // TRANS: Exception. + throw new ServerException(_m('Can\'t save local profile.')); } } else { $group = new User_group(); @@ -1338,16 +1339,16 @@ class Ostatus_profile extends Memcached_DataObject $oprofile->group_id = $group->insert(); if (!$oprofile->group_id) { - // @todo i18n FIXME: add i18n. - throw new ServerException("Can't save local profile."); + // TRANS: Exception. + throw new ServerException(_m('Can\'t save local profile.')); } } $ok = $oprofile->insert(); if (!$ok) { - // @todo i18n FIXME: add i18n. - throw new ServerException("Can't save OStatus profile."); + // TRANS: Exception. + throw new ServerException(_m('Can\'t save OStatus profile.')); } $avatar = self::getActivityObjectAvatar($object, $hints); @@ -1605,8 +1606,8 @@ class Ostatus_profile extends Memcached_DataObject if ($uri !== false) { if (is_null($uri)) { // Negative cache entry - // @todo i18n FIXME: add i18n. - throw new Exception('Not a valid webfinger address.'); + // TRANS: Exception. + throw new Exception(_m('Not a valid webfinger address.')); } $oprofile = Ostatus_profile::staticGet('uri', $uri); if (!empty($oprofile)) { @@ -1633,8 +1634,8 @@ class Ostatus_profile extends Memcached_DataObject // Save negative cache entry so we don't waste time looking it up again. // @fixme distinguish temporary failures? self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), null); - // @todo i18n FIXME: add i18n. - throw new Exception('Not a valid webfinger address.'); + // TRANS: Exception. + throw new Exception(_m('Not a valid webfinger address.')); } $hints = array('webfinger' => $addr); @@ -1715,8 +1716,8 @@ class Ostatus_profile extends Memcached_DataObject if (!$profile_id) { common_log_db_error($profile, 'INSERT', __FILE__); - // @todo i18n FIXME: add i18n and use sprintf for parameter. - throw new Exception("Couldn't save profile for '$addr'."); + // TRANS: Exception. %s is a webfinger address. + throw new Exception(sprintf(_m('Couldn\'t save profile for "%s".'),$addr)); } $oprofile = new Ostatus_profile(); @@ -1734,16 +1735,16 @@ class Ostatus_profile extends Memcached_DataObject if (!$result) { common_log_db_error($oprofile, 'INSERT', __FILE__); - // @todo i18n FIXME: add i18n and use sprintf for parameter. - throw new Exception("Couldn't save ostatus_profile for '$addr'."); + // TRANS: Exception. %s is a webfinger address. + throw new Exception(sprintf(_m('Couldn\'t save ostatus_profile for "%s".'),$addr)); } self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->uri); return $oprofile; } - // @todo i18n FIXME: add i18n and use sprintf for parameter. - throw new Exception("Couldn't find a valid profile for '$addr'"); + // TRANS: Exception. %s is a webfinger address. + throw new Exception(sprintf(_m('Couldn\'t find a valid profile for "%s".'),$addr)); } /** @@ -1785,7 +1786,7 @@ class Ostatus_profile extends Memcached_DataObject if ($file_id === false) { common_log_db_error($file, "INSERT", __FILE__); - throw new ServerException(_('Could not store HTML content of long post as file.')); + throw new ServerException(_m('Could not store HTML content of long post as file.')); } return $file; diff --git a/plugins/OStatus/classes/Ostatus_source.php b/plugins/OStatus/classes/Ostatus_source.php index e6ce7d442..b76bbce56 100644 --- a/plugins/OStatus/classes/Ostatus_source.php +++ b/plugins/OStatus/classes/Ostatus_source.php @@ -21,7 +21,6 @@ * @package OStatusPlugin * @maintainer Brion Vibber */ - class Ostatus_source extends Memcached_DataObject { public $__table = 'ostatus_source'; @@ -43,7 +42,6 @@ class Ostatus_source extends Memcached_DataObject * * @return array array of column definitions */ - function table() { return array('notice_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, @@ -69,7 +67,6 @@ class Ostatus_source extends Memcached_DataObject * * @return array key definitions */ - function keys() { return array_keys($this->keyTypes()); @@ -83,7 +80,6 @@ class Ostatus_source extends Memcached_DataObject * * @return array key definitions */ - function keyTypes() { return array('notice_id' => 'K'); 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 @@ $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 */ - 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(); } - } -- cgit v1.2.3-54-g00ecf From ecafae84728e05387f3e488b36e583dec9ee3e2b Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Sep 2010 15:52:53 +0200 Subject: * Remove trailing newline in e-mail message. * Superfluous whitespace removed. --- plugins/TwitterBridge/twitter.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index d984698ee..f913e4aea 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -318,11 +318,9 @@ function remove_twitter_link($flink) // Notify the user that her Twitter bridge is down if (isset($user->email)) { - $result = mail_twitter_bridge_removed($user); if (!$result) { - $msg = 'Unable to send email to notify ' . "$user->nickname (user id: $user->id) " . 'that their Twitter bridge link was ' . @@ -331,7 +329,6 @@ function remove_twitter_link($flink) common_log(LOG_WARNING, $msg); } } - } /** @@ -360,7 +357,7 @@ function mail_twitter_bridge_removed($user) '%3$s\'s access?' . "\n\n" . 'You can re-enable your Twitter bridge by visiting your ' . "Twitter settings page:\n\n\t%2\$s\n\n" . - "Regards,\n%3\$s\n"), + "Regards,\n%3\$s"), $profile->getBestName(), common_local_url('twittersettings'), common_config('site', 'name')); -- cgit v1.2.3-54-g00ecf From 74785c64f86293a1e81ae8497cc88172fc30ef1b Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Sep 2010 16:32:19 +0200 Subject: * L10n i18n update * add translator hints * update whitespace * added a bunch of @todos. --- plugins/Facebook/FBC_XDReceiver.php | 8 ++--- plugins/Facebook/FBConnectAuth.php | 32 +++++++++++------ plugins/Facebook/FBConnectLogin.php | 2 ++ plugins/Facebook/FBConnectSettings.php | 8 +++-- plugins/Facebook/FacebookPlugin.php | 61 +++++++++------------------------ plugins/Facebook/facebookaction.php | 40 ++++++++------------- plugins/Facebook/facebookadminpanel.php | 13 +------ plugins/Facebook/facebookhome.php | 33 ++++++++---------- plugins/Facebook/facebookinvite.php | 15 ++++---- plugins/Facebook/facebooklogin.php | 8 ++--- plugins/Facebook/facebooknoticeform.php | 26 +++++--------- plugins/Facebook/facebookremove.php | 2 -- plugins/Facebook/facebooksettings.php | 12 +++---- plugins/Facebook/facebookutil.php | 15 -------- 14 files changed, 103 insertions(+), 172 deletions(-) (limited to 'plugins') diff --git a/plugins/Facebook/FBC_XDReceiver.php b/plugins/Facebook/FBC_XDReceiver.php index 2bc790d5a..bf4b59bba 100644 --- a/plugins/Facebook/FBC_XDReceiver.php +++ b/plugins/Facebook/FBC_XDReceiver.php @@ -1,4 +1,7 @@ elementEnd('html'); } - } - diff --git a/plugins/Facebook/FBConnectAuth.php b/plugins/Facebook/FBConnectAuth.php index 8eba7fc13..f06dffaaa 100644 --- a/plugins/Facebook/FBConnectAuth.php +++ b/plugins/Facebook/FBConnectAuth.php @@ -60,12 +60,10 @@ class FBConnectauthAction extends Action parent::handle($args); if (common_is_real_login()) { - // User is already logged in. Does she already have a linked Facebook acct? $flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_CONNECT_SERVICE); if (!empty($flink)) { - // User already has a linked Facebook account and shouldn't be here common_debug('Facebook Connect Plugin - ' . 'There is already a local user (' . $flink->user_id . @@ -74,8 +72,7 @@ class FBConnectauthAction extends Action // We don't want these cookies getFacebook()->clear_cookie_state(); - $this->clientError(_m('There is already a local user linked with this Facebook.')); - + $this->clientError(_m('There is already a local user linked with this Facebook account.')); } else { // User came from the Facebook connect settings tab, and @@ -102,7 +99,7 @@ class FBConnectauthAction extends Action } else { common_debug('Facebook Connect Plugin - ' . print_r($this->args, true)); - $this->showForm(_m('Something weird happened.'), + $this->showForm(_m('An unknown error has occured.'), $this->trimmed('newname')); } } else { @@ -116,12 +113,14 @@ class FBConnectauthAction extends Action $this->element('div', array('class' => 'error'), $this->error); } else { $this->element('div', 'instructions', + // TRANS: %s is the site name. sprintf(_m('This is the first time you\'ve logged into %s so we must connect your Facebook to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name'))); } } function title() { + // TRANS: Page title. return _m('Facebook Account Setup'); } @@ -155,6 +154,7 @@ class FBConnectauthAction extends Action 'class' => 'form_settings', 'action' => common_local_url('FBConnectAuth'))); $this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options')); + // TRANS: Legend. $this->element('legend', null, _m('Connection options')); $this->elementStart('ul', 'form_data'); $this->elementStart('li'); @@ -164,7 +164,8 @@ class FBConnectauthAction extends Action 'name' => 'license', 'value' => 'true')); $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license')); - $message = _('My text and files are available under %s ' . + // TRANS: %s is the name of the license used by the user for their status updates. + $message = _m('My text and files are available under %s ' . 'except this private data: password, ' . 'email address, IM address, and phone number.'); $link = 'reqFbScripts($action)) { - // XXX: Horrible hack to make Safari, FF2, and Chrome work with // Facebook Connect. These browser cannot use Facebook's // DOM parsing routines unless the mime type of the page is @@ -238,9 +229,7 @@ class FacebookPlugin extends Plugin 'lang' => $language)); return false; - } else { - return true; } } @@ -255,7 +244,6 @@ class FacebookPlugin extends Plugin * @return void * */ - function onEndShowScripts($action) { if ($this->reqFbScripts($action)) { @@ -306,12 +294,10 @@ class FacebookPlugin extends Plugin $js = sprintf($js, $apikey, $login_url, $logout_url); // Compress the bugger down a bit - $js = str_replace(' ', '', $js); $action->inlineScript($js); } - } /** @@ -323,7 +309,6 @@ class FacebookPlugin extends Plugin * @return void * */ - function onEndShowFooter($action) { if ($this->reqFbScripts($action)) { @@ -340,7 +325,6 @@ class FacebookPlugin extends Plugin * @return void * */ - function onEndShowStatusNetStyles($action) { if ($this->reqFbScripts($action)) { @@ -357,7 +341,6 @@ class FacebookPlugin extends Plugin * * @return boolean true */ - function reqFbScripts($action) { if (!self::hasKeys()) { @@ -365,7 +348,6 @@ class FacebookPlugin extends Plugin } // If you're logged in w/FB Connect, you always need the FB stuff - $fbuid = $this->loggedIn(); if (!empty($fbuid)) { @@ -373,7 +355,6 @@ class FacebookPlugin extends Plugin } // List of actions that require FB stuff - $needy = array('FBConnectLoginAction', 'FBConnectauthAction', 'FBConnectSettingsAction'); @@ -383,7 +364,6 @@ class FacebookPlugin extends Plugin } return false; - } /** @@ -391,7 +371,6 @@ class FacebookPlugin extends Plugin * * @return mixed $fbuid the Facebook ID of the logged in user, or null */ - function loggedIn() { $user = common_current_user(); @@ -403,12 +382,9 @@ class FacebookPlugin extends Plugin $fbuid = 0; if (!empty($flink)) { - try { - $facebook = getFacebook(); $fbuid = $facebook->get_loggedin_user(); - } catch (Exception $e) { common_log(LOG_WARNING, 'Facebook Connect Plugin - ' . 'Problem getting Facebook user: ' . @@ -432,17 +408,14 @@ class FacebookPlugin extends Plugin * @return void * */ - function onStartPrimaryNav($action) { if (self::hasKeys()) { $user = common_current_user(); if (!empty($user)) { - $fbuid = $this->loggedIn(); if (!empty($fbuid)) { - /* Default FB silhouette pic for FB users who haven't uploaded a profile pic yet. */ @@ -455,7 +428,7 @@ class FacebookPlugin extends Plugin $action->element('img', array('id' => 'fbc_profile-pic', 'src' => (!empty($url)) ? $url : $silhouetteUrl, - 'alt' => 'Facebook Connect User', + 'alt' => _m('Facebook Connect User'), 'width' => '16'), ''); $iconurl = common_path('plugins/Facebook/fbfavicon.ico'); @@ -477,18 +450,20 @@ class FacebookPlugin extends Plugin * * @return void */ - function onEndLoginGroupNav(&$action) { if (self::hasKeys()) { - $action_name = $action->trimmed('action'); $action->menuItem(common_local_url('FBConnectLogin'), - _m('Facebook'), + // @todo CHECKME: Should be 'Facebook Login'? + // TRANS: Menu item. + _m('MENU','Facebook'), + // TRANS: Tooltip for menu item "Facebook". _m('Login or register using Facebook'), 'FBConnectLogin' === $action_name); } + return true; } @@ -499,18 +474,20 @@ class FacebookPlugin extends Plugin * * @return void */ - function onEndConnectSettingsNav(&$action) { if (self::hasKeys()) { - $action_name = $action->trimmed('action'); $action->menuItem(common_local_url('FBConnectSettings'), - _m('Facebook'), + // @todo CHECKME: Should be 'Facebook Connect'? + // TRANS: Menu item tab. + _m('MENU','Facebook'), + // TRANS: Tooltip for menu item "Facebook". _m('Facebook Connect Settings'), $action_name === 'FBConnectSettings'); } + return true; } @@ -521,7 +498,6 @@ class FacebookPlugin extends Plugin * * @return void */ - function onStartLogout($action) { if (self::hasKeys()) { @@ -550,14 +526,12 @@ class FacebookPlugin extends Plugin * * @return string $url the url for the user's Facebook avatar */ - function getProfilePicURL($fbuid) { $facebook = getFacebook(); $url = null; try { - $fqry = 'SELECT pic_square FROM user WHERE uid = %s'; $result = $facebook->api_client->fql_query(sprintf($fqry, $fbuid)); @@ -582,7 +556,6 @@ class FacebookPlugin extends Plugin * * @return boolean hook return */ - function onStartEnqueueNotice($notice, &$transports) { if (self::hasKeys() && $notice->isLocal()) { @@ -613,14 +586,14 @@ class FacebookPlugin extends Plugin 'version' => self::VERSION, 'author' => 'Zach Copley', 'homepage' => 'http://status.net/wiki/Plugin:Facebook', + // TRANS: Plugin description. 'rawdescription' => _m( - 'The Facebook plugin allows you to integrate ' . - 'your StatusNet instance with ' . + 'The Facebook plugin allows integrating ' . + 'StatusNet instances with ' . 'Facebook ' . 'and Facebook Connect.' ) ); return true; } - } diff --git a/plugins/Facebook/facebookaction.php b/plugins/Facebook/facebookaction.php index 467c6af84..4c15fc039 100644 --- a/plugins/Facebook/facebookaction.php +++ b/plugins/Facebook/facebookaction.php @@ -36,7 +36,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebooknoticeform.php'; class FacebookAction extends Action { - var $facebook = null; var $fbuid = null; var $flink = null; @@ -102,7 +101,6 @@ class FacebookAction extends Action * * @return void */ - function startHTML($type=null) { $this->showStylesheets(); @@ -143,7 +141,6 @@ class FacebookAction extends Action function showHead($error, $success) { - if ($error) { $this->element("h1", null, $error); } @@ -168,7 +165,10 @@ class FacebookAction extends Action $this->elementStart('li', array('class' => ($this->action == 'facebookhome') ? 'current' : 'facebook_home')); $this->element('a', - array('href' => 'index.php', 'title' => _m('Home')), _m('Home')); + // TRANS: Link description for 'Home' link that leads to a start page. + array('href' => 'index.php', 'title' => _m('MENU','Home')), + // TRANS: Tooltip for 'Home' link that leads to a start page. + _m('Home')); $this->elementEnd('li'); if (common_config('invite', 'enabled')) { @@ -176,7 +176,10 @@ class FacebookAction extends Action array('class' => ($this->action == 'facebookinvite') ? 'current' : 'facebook_invite')); $this->element('a', - array('href' => 'invite.php', 'title' => _m('Invite')), _m('Invite')); + // TRANS: Link description for 'Invite' link that leads to a page where friends can be invited. + array('href' => 'invite.php', 'title' => _m('MENU','Invite')), + // TRANS: Tooltip for 'Invite' link that leads to a page where friends can be invited. + _m('Invite')); $this->elementEnd('li'); } @@ -185,7 +188,10 @@ class FacebookAction extends Action ($this->action == 'facebooksettings') ? 'current' : 'facebook_settings')); $this->element('a', array('href' => 'settings.php', - 'title' => _m('Settings')), _m('Settings')); + // TRANS: Link description for 'Settings' link that leads to a page user preferences can be set. + 'title' => _m('MENU','Settings')), + // TRANS: Tooltip for 'Settings' link that leads to a page user preferences can be set. + _m('Settings')); $this->elementEnd('li'); $this->elementEnd('ul'); @@ -272,7 +278,8 @@ class FacebookAction extends Action $this->elementEnd('li'); $this->elementEnd('ul'); - $this->submit('submit', _m('Login')); + // TRANS: Login button. + $this->submit('submit', _m('BUTTON','Login')); $this->elementEnd('fieldset'); $this->elementEnd('form'); @@ -283,7 +290,6 @@ class FacebookAction extends Action $this->elementEnd('div'); $this->elementEnd('div'); - } function updateProfileBox($notice) @@ -356,7 +362,6 @@ class FacebookAction extends Action function saveNewNotice() { - $user = $this->flink->getUser(); $content = $this->trimmed('status_textarea'); @@ -368,6 +373,7 @@ class FacebookAction extends Action $content_shortened = common_shorten_links($content); if (Notice::contentTooLong($content_shortened)) { + // @todo FIXME: i18n: Needs plural. $this->showPage(sprintf(_m('That\'s too long. Max notice size is %d chars.'), Notice::maxContent())); return; @@ -379,9 +385,7 @@ class FacebookAction extends Action $cmd = $inter->handle_command($user, $content_shortened); if ($cmd) { - // XXX fix this - $cmd->execute(new WebChannel()); return; } @@ -398,12 +402,10 @@ class FacebookAction extends Action } } - } class FacebookNoticeList extends NoticeList { - /** * constructor * @@ -423,7 +425,6 @@ class FacebookNoticeList extends NoticeList * * @return int count of notices listed. */ - function show() { $this->out->elementStart('div', array('id' =>'notices_primary')); @@ -459,17 +460,14 @@ class FacebookNoticeList extends NoticeList * @return FacebookNoticeListItem a list item for displaying the notice * formatted for display in the Facebook App. */ - function newListItem($notice) { return new FacebookNoticeListItem($notice, $this); } - } class FacebookNoticeListItem extends NoticeListItem { - /** * constructor * @@ -477,7 +475,6 @@ class FacebookNoticeListItem extends NoticeListItem * * @param Notice $notice The notice we'll display */ - function __construct($notice, $out=null) { parent::__construct($notice, $out); @@ -491,7 +488,6 @@ class FacebookNoticeListItem extends NoticeListItem * * @return void */ - function show() { $this->showStart(); @@ -502,12 +498,10 @@ class FacebookNoticeListItem extends NoticeListItem $this->showEnd(); } - } class FacebookProfileBoxNotice extends FacebookNoticeListItem { - /** * constructor * @@ -515,7 +509,6 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem * * @param Notice $notice The notice we'll display */ - function __construct($notice, $out=null) { parent::__construct($notice, $out); @@ -527,7 +520,6 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem * * @return void */ - function show() { $this->showNotice(); @@ -537,7 +529,6 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem function showAppLink() { - $this->facebook = getFacebook(); $app_props = $this->facebook->api_client->Admin_getAppProperties( @@ -551,5 +542,4 @@ class FacebookProfileBoxNotice extends FacebookNoticeListItem $this->out->text($this->app_name); $this->out->elementEnd('a'); } - } diff --git a/plugins/Facebook/facebookadminpanel.php b/plugins/Facebook/facebookadminpanel.php index ae1c7302f..ae26c7d3e 100644 --- a/plugins/Facebook/facebookadminpanel.php +++ b/plugins/Facebook/facebookadminpanel.php @@ -40,7 +40,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class FacebookadminpanelAction extends AdminPanelAction { /** @@ -48,7 +47,6 @@ class FacebookadminpanelAction extends AdminPanelAction * * @return string page title */ - function title() { return _m('Facebook'); @@ -59,7 +57,6 @@ class FacebookadminpanelAction extends AdminPanelAction * * @return string instructions */ - function getInstructions() { return _m('Facebook integration settings'); @@ -70,7 +67,6 @@ class FacebookadminpanelAction extends AdminPanelAction * * @return void */ - function showForm() { $form = new FacebookAdminPanelForm($this); @@ -83,7 +79,6 @@ class FacebookadminpanelAction extends AdminPanelAction * * @return void */ - function saveSettings() { static $settings = array( @@ -100,7 +95,6 @@ class FacebookadminpanelAction extends AdminPanelAction } // This throws an exception on validation errors - $this->validate($values); // assert(all values are valid); @@ -145,7 +139,6 @@ class FacebookAdminPanelForm extends AdminForm * * @return int ID of the form */ - function id() { return 'facebookadminpanel'; @@ -156,7 +149,6 @@ class FacebookAdminPanelForm extends AdminForm * * @return string class of the form */ - function formClass() { return 'form_settings'; @@ -167,7 +159,6 @@ class FacebookAdminPanelForm extends AdminForm * * @return string URL of the action */ - function action() { return common_local_url('facebookadminpanel'); @@ -178,7 +169,6 @@ class FacebookAdminPanelForm extends AdminForm * * @return void */ - function formData() { $this->out->elementStart( @@ -215,9 +205,8 @@ class FacebookAdminPanelForm extends AdminForm * * @return void */ - function formActions() { - $this->out->submit('submit', _('Save'), 'submit', null, _('Save Facebook settings')); + $this->out->submit('submit', _m('Save'), 'submit', null, _m('Save Facebook settings')); } } diff --git a/plugins/Facebook/facebookhome.php b/plugins/Facebook/facebookhome.php index 60782f63c..6090f988c 100644 --- a/plugins/Facebook/facebookhome.php +++ b/plugins/Facebook/facebookhome.php @@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php'; class FacebookhomeAction extends FacebookAction { - var $page = null; function prepare($argarray) @@ -54,7 +53,6 @@ class FacebookhomeAction extends FacebookAction } if ($this->flink) { - $this->user = $this->flink->getUser(); // If this is the first time the user has started the app @@ -82,18 +80,14 @@ class FacebookhomeAction extends FacebookAction // Facebook status update permission? Then show the main page // of the app $this->showPage(); - } else { - // User hasn't authenticated yet, prompt for creds $this->login(); } - } function login() { - $this->showStylesheets(); $nickname = common_canonical_nickname($this->trimmed('nickname')); @@ -102,13 +96,11 @@ class FacebookhomeAction extends FacebookAction $msg = null; if ($nickname) { - if (common_check_user($nickname, $password)) { - $user = User::staticGet('nickname', $nickname); if (!$user) { - $this->showLoginForm(_m("Server error - couldn't get user!")); + $this->showLoginForm(_m("Server error: Couldn't get user!")); } $flink = DB_DataObject::factory('foreign_link'); @@ -126,7 +118,6 @@ class FacebookhomeAction extends FacebookAction $this->getUpdatePermission(); return; - } else { $msg = _m('Incorrect username or password.'); } @@ -134,7 +125,6 @@ class FacebookhomeAction extends FacebookAction $this->showLoginForm($msg); $this->showFooter(); - } function setDefaults() @@ -155,8 +145,15 @@ class FacebookhomeAction extends FacebookAction function title() { if ($this->page > 1) { - return sprintf(_m("%s and friends, page %d"), $this->user->nickname, $this->page); + // @todo FIXME: Core should have methods to get "Full name (nickname)" in a localised form + // so that this can be used consistenly throughout StatusNet without having to implement it + // over and over.. + // TRANS: Page title. + // TRANS: %1$s is a user nickname, %2$s is a page number. + return sprintf(_m("%1$s and friends, page %2$d"), $this->user->nickname, $this->page); } else { + // TRANS: Page title. + // TRANS: %s is a user nickname return sprintf(_m("%s and friends"), $this->user->nickname); } } @@ -175,17 +172,16 @@ class FacebookhomeAction extends FacebookAction function showNoticeList($notice) { - $nl = new NoticeList($notice, $this); return $nl->show(); } function getUpdatePermission() { - $this->showStylesheets(); $this->elementStart('div', array('class' => 'facebook_guide')); + // TRANS: Instructions. %s is the application name. $instructions = sprintf(_m('If you would like the %s app to automatically update ' . 'your Facebook status with your latest notice, you need ' . 'to give it permission.'), $this->app_name); @@ -209,6 +205,7 @@ class FacebookhomeAction extends FacebookAction '&next_cancel=' . $next . '&submit=skip'; $this->elementStart('span', array('class' => 'facebook-button')); + // @todo FIXME: sprintf not needed here? $this->element('a', array('href' => $auth_url), sprintf(_m('Okay, do it!'), $this->app_name)); $this->elementEnd('span'); @@ -216,13 +213,13 @@ class FacebookhomeAction extends FacebookAction $this->elementEnd('li'); $this->elementStart('li', array('id' => 'fb-permissions-item')); - $this->submit('skip', _m('Skip')); + // TRANS: Button text. Clicking the button will skip updating Facebook permissions. + $this->submit('skip', _m('BUTTON','Skip')); $this->elementEnd('li'); $this->elementEnd('ul'); $this->elementEnd('form'); $this->elementEnd('div'); - } /** @@ -238,7 +235,6 @@ class FacebookhomeAction extends FacebookAction */ function pagination($have_before, $have_after, $page, $action, $args=null) { - // Does a little before-after block for next/prev page // XXX: Fix so this uses common_local_url() if possible. @@ -254,6 +250,7 @@ class FacebookhomeAction extends FacebookAction $newargs = $args ? array_merge($args, $pargs) : $pargs; $this->elementStart('li', array('class' => 'nav_prev')); $this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'prev'), + // TRANS: Pagination link. _m('After')); $this->elementEnd('li'); } @@ -262,6 +259,7 @@ class FacebookhomeAction extends FacebookAction $newargs = $args ? array_merge($args, $pargs) : $pargs; $this->elementStart('li', array('class' => 'nav_next')); $this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'next'), + // TRANS: Pagination link. _m('Before')); $this->elementEnd('li'); } @@ -271,5 +269,4 @@ class FacebookhomeAction extends FacebookAction $this->elementEnd('dl'); } } - } diff --git a/plugins/Facebook/facebookinvite.php b/plugins/Facebook/facebookinvite.php index e02c7bf3e..a50eace12 100644 --- a/plugins/Facebook/facebookinvite.php +++ b/plugins/Facebook/facebookinvite.php @@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php'; class FacebookinviteAction extends FacebookAction { - function handle($args) { parent::handle($args); @@ -41,7 +40,6 @@ class FacebookinviteAction extends FacebookAction * * @return void */ - function showForm($error=null) { $this->error = $error; @@ -56,7 +54,6 @@ class FacebookinviteAction extends FacebookAction * * @return void */ - function showContent() { if ($this->arg('ids')) { @@ -68,9 +65,10 @@ class FacebookinviteAction extends FacebookAction function showSuccessContent() { - - $this->element('h2', null, sprintf(_m('Thanks for inviting your friends to use %s'), + // TRANS: %s is the name of the site. + $this->element('h2', null, sprintf(_m('Thanks for inviting your friends to use %s.'), common_config('site', 'name'))); + // TRANS: Followed by an unordered list with invited friends. $this->element('p', null, _m('Invitations have been sent to the following users:')); $friend_ids = $_POST['ids']; // XXX: Hmm... is this the best way to access the list? @@ -85,8 +83,7 @@ class FacebookinviteAction extends FacebookAction $this->elementEnd('li'); } - $this->elementEnd("ul"); - + $this->elementEnd('ul'); } function showFormContent() @@ -100,6 +97,7 @@ class FacebookinviteAction extends FacebookAction 'type' => common_config('site', 'name'), 'content' => $content)); $this->hidden('invite', 'true'); + // TRANS: %s is the name of the site. $actiontext = sprintf(_m('Invite your friends to use %s'), common_config('site', 'name')); $multi_params = array('showborder' => 'false'); @@ -122,6 +120,7 @@ class FacebookinviteAction extends FacebookAction if ($exclude_ids) { + // TRANS: %s is the name of the site. $this->element('h2', null, sprintf(_m('Friends already using %s:'), common_config('site', 'name'))); $this->elementStart('ul', array('id' => 'facebook-friends')); @@ -140,7 +139,7 @@ class FacebookinviteAction extends FacebookAction function title() { + // TRANS: Page title. return sprintf(_m('Send invitations')); } - } diff --git a/plugins/Facebook/facebooklogin.php b/plugins/Facebook/facebooklogin.php index 7a173ddae..1961be57b 100644 --- a/plugins/Facebook/facebooklogin.php +++ b/plugins/Facebook/facebooklogin.php @@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php'; class FacebookinviteAction extends FacebookAction { - function handle($args) { parent::handle($args); @@ -37,6 +36,7 @@ class FacebookinviteAction extends FacebookAction $this->facebook->api_client->data_getUserPreference( FACEBOOK_PROMPTED_UPDATE_PREF) == 'true') { + // @todo FIXME: Missing i18n? echo '

REDIRECT TO HOME

'; } } else { @@ -46,7 +46,6 @@ class FacebookinviteAction extends FacebookAction function showContent() { - // If the user has opted not to initially allow the app to have // Facebook status update permission, store that preference. Only // promt the user the first time she uses the app @@ -56,7 +55,6 @@ class FacebookinviteAction extends FacebookAction } if ($this->flink) { - $this->user = $this->flink->getUser(); // If this is the first time the user has started the app @@ -69,7 +67,6 @@ class FacebookinviteAction extends FacebookAction return; } } - } else { $this->showLoginForm(); } @@ -88,6 +85,8 @@ class FacebookinviteAction extends FacebookAction function title() { + // @todo FIXME: Give a more precise description? Suggestion: "Login with Facebook Connect" + // TRANS: Page title. return sprintf(_m('Login')); } @@ -95,5 +94,4 @@ class FacebookinviteAction extends FacebookAction { } - } diff --git a/plugins/Facebook/facebooknoticeform.php b/plugins/Facebook/facebooknoticeform.php index 5989147f4..d52222c93 100644 --- a/plugins/Facebook/facebooknoticeform.php +++ b/plugins/Facebook/facebooknoticeform.php @@ -2,7 +2,7 @@ /** * StatusNet, the distributed open-source microblogging tool * - * Form for posting a notice from within the Facebook App. + * Form for posting a notice from within the Facebook App. * * This is a stripped down version of the normal NoticeForm (sans * location stuff and media upload stuff). I'm not sure we can share the @@ -53,31 +53,26 @@ require_once INSTALLDIR . '/lib/form.php'; * * @see HTMLOutputter */ - class FacebookNoticeForm extends Form { /** * Current action, used for returning to this page. */ - var $action = null; /** * Pre-filled content of the form */ - var $content = null; /** * The current user */ - var $user = null; /** * The notice being replied to */ - var $inreplyto = null; /** @@ -87,7 +82,6 @@ class FacebookNoticeForm extends Form * @param string $action action to return to, if any * @param string $content content to pre-fill */ - function __construct($out=null, $action=null, $content=null, $post_action=null, $user=null, $inreplyto=null) { parent::__construct($out); @@ -102,7 +96,7 @@ class FacebookNoticeForm extends Form } else { $this->user = common_current_user(); } - + // Note: Facebook doesn't allow multipart/form-data posting to // canvas pages, so don't try to set it--no file uploads, at // least not this way. It can be done using multiple servers @@ -114,7 +108,6 @@ class FacebookNoticeForm extends Form * * @return string ID of the form */ - function id() { return 'form_notice'; @@ -125,7 +118,6 @@ class FacebookNoticeForm extends Form * * @return string class of the form */ - function formClass() { return 'form_notice'; @@ -136,7 +128,6 @@ class FacebookNoticeForm extends Form * * @return string URL of the action */ - function action() { return $this->post_action; @@ -149,7 +140,8 @@ class FacebookNoticeForm extends Form */ function formLegend() { - $this->out->element('legend', null, _('Send a notice')); + // TRANS: Legend. + $this->out->element('legend', null, _m('Send a notice')); } /** @@ -157,12 +149,12 @@ class FacebookNoticeForm extends Form * * @return void */ - function formData() { if (Event::handle('StartShowNoticeFormData', array($this))) { $this->out->element('label', array('for' => 'notice_data-text'), - sprintf(_('What\'s up, %s?'), $this->user->nickname)); + // TRANS: Field label. + sprintf(_m('What\'s up, %s?'), $this->user->nickname)); // XXX: vary by defined max size $this->out->element('textarea', array('id' => 'notice_data-text', 'cols' => 35, @@ -174,7 +166,7 @@ class FacebookNoticeForm extends Form if ($contentLimit > 0) { $this->out->elementStart('dl', 'form_note'); - $this->out->element('dt', null, _('Available characters')); + $this->out->element('dt', null, _m('Available characters')); $this->out->element('dd', array('id' => 'notice_text-count'), $contentLimit); $this->out->elementEnd('dl'); @@ -194,13 +186,13 @@ class FacebookNoticeForm extends Form * * @return void */ - function formActions() { $this->out->element('input', array('id' => 'notice_action-submit', 'class' => 'submit', 'name' => 'status_submit', 'type' => 'submit', - 'value' => _('Send'))); + // TRANS: Button text. + 'value' => _m('BUTTON','Send'))); } } diff --git a/plugins/Facebook/facebookremove.php b/plugins/Facebook/facebookremove.php index 09cb33342..b048a435f 100644 --- a/plugins/Facebook/facebookremove.php +++ b/plugins/Facebook/facebookremove.php @@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php'; class FacebookremoveAction extends FacebookAction { - function handle($args) { parent::handle($args); @@ -65,5 +64,4 @@ class FacebookremoveAction extends FacebookAction 'unsuccessfully tried to remove a foreign link to Facebook!'); } } - } diff --git a/plugins/Facebook/facebooksettings.php b/plugins/Facebook/facebooksettings.php index f94a346b5..1379b9a9c 100644 --- a/plugins/Facebook/facebooksettings.php +++ b/plugins/Facebook/facebooksettings.php @@ -25,7 +25,6 @@ require_once INSTALLDIR . '/plugins/Facebook/facebookaction.php'; class FacebooksettingsAction extends FacebookAction { - function handle($args) { parent::handle($args); @@ -40,7 +39,6 @@ class FacebooksettingsAction extends FacebookAction * * @return void */ - function showContent() { if ($this->arg('save')) { @@ -62,6 +60,7 @@ class FacebooksettingsAction extends FacebookAction if ($result === false) { $this->showForm(_m('There was a problem saving your sync preferences!')); } else { + // TRANS: Confirmation that synchronisation settings have been saved into the system. $this->showForm(_m('Sync preferences saved.'), true); } } @@ -99,16 +98,16 @@ class FacebooksettingsAction extends FacebookAction $this->elementStart('li'); - $this->submit('save', _m('Save')); + // TRANS: Submit button to save synchronisation settings. + $this->submit('save', _m('BUTTON','Save')); $this->elementEnd('li'); $this->elementEnd('ul'); $this->elementEnd('form'); - } else { - + // TRANS: %s is the application name. $instructions = sprintf(_m('If you would like %s to automatically update ' . 'your Facebook status with your latest notice, you need ' . 'to give it permission.'), $this->app_name); @@ -127,12 +126,11 @@ class FacebooksettingsAction extends FacebookAction $this->elementEnd('li'); $this->elementEnd('ul'); } - } function title() { + // TRANS: Page title for synchronisation settings. return _m('Sync preferences'); } - } diff --git a/plugins/Facebook/facebookutil.php b/plugins/Facebook/facebookutil.php index 1290fed55..e78856f7c 100644 --- a/plugins/Facebook/facebookutil.php +++ b/plugins/Facebook/facebookutil.php @@ -45,13 +45,11 @@ function getFacebook() } function isFacebookBound($notice, $flink) { - if (empty($flink)) { return false; } // Avoid a loop - if ($notice->source == 'Facebook') { common_log(LOG_INFO, "Skipping notice $notice->id because its " . 'source is Facebook.'); @@ -59,7 +57,6 @@ function isFacebookBound($notice, $flink) { } // If the user does not want to broadcast to Facebook, move along - if (!($flink->noticesync & FOREIGN_NOTICE_SEND == FOREIGN_NOTICE_SEND)) { common_log(LOG_INFO, "Skipping notice $notice->id " . 'because user has FOREIGN_NOTICE_SEND bit off.'); @@ -68,14 +65,12 @@ function isFacebookBound($notice, $flink) { // If it's not a reply, or if the user WANTS to send @-replies, // then, yeah, it can go to Facebook. - if (!preg_match('/@[a-zA-Z0-9_]{1,15}\b/u', $notice->content) || ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY)) { return true; } return false; - } function facebookBroadcastNotice($notice) @@ -87,16 +82,12 @@ function facebookBroadcastNotice($notice) ); if (isFacebookBound($notice, $flink)) { - // Okay, we're good to go, update the FB status - $fbuid = $flink->foreign_id; $user = $flink->getUser(); try { - // Check permissions - common_debug( 'FacebookPlugin - checking for publish_stream permission for user ' . "$user->nickname ($user->id), Facebook UID: $fbuid" @@ -105,7 +96,6 @@ function facebookBroadcastNotice($notice) // NOTE: $facebook->api_client->users_hasAppPermission('publish_stream', $fbuid) // has been returning bogus results, so we're using FQL to check for // publish_stream permission now - $fql = "SELECT publish_stream FROM permissions WHERE uid = $fbuid"; $result = $facebook->api_client->fql_query($fql); @@ -152,7 +142,6 @@ function facebookBroadcastNotice($notice) } // Post to Facebook - if ($notice->hasAttachments() && $canPublish == 1) { publishStream($notice, $user, $fbuid); } elseif ($canUpdate == 1 || $canPublish == 1) { @@ -165,7 +154,6 @@ function facebookBroadcastNotice($notice) } // Finally, attempt to update the user's profile box - if ($canPublish == 1 || $canUpdate == 1) { updateProfileBox($facebook, $flink, $notice, $user); } @@ -412,7 +400,6 @@ function remove_facebook_app($flink) common_log(LOG_WARNING, $msg); } - } /** @@ -423,7 +410,6 @@ function remove_facebook_app($flink) * * @return boolean success flag */ - function mail_facebook_app_removed($user) { $profile = $user->getProfile(); @@ -447,5 +433,4 @@ function mail_facebook_app_removed($user) common_switch_locale(); return mail_to_user($user, $subject, $body); - } -- cgit v1.2.3-54-g00ecf From c932c0fdc14af781853aedea89ada2f10f46ea8f Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 19 Sep 2010 17:44:29 +0200 Subject: Update pot files for plugins. --- plugins/CacheLog/locale/CacheLog.pot | 4 +- plugins/Facebook/locale/Facebook.pot | 298 +++++++---- plugins/GoogleAnalytics/locale/GoogleAnalytics.pot | 4 +- plugins/OStatus/locale/OStatus.pot | 587 ++++++++++++++++++--- plugins/PiwikAnalytics/locale/PiwikAnalytics.pot | 4 +- plugins/RSSCloud/locale/RSSCloud.pot | 5 +- plugins/TwitterBridge/locale/TwitterBridge.pot | 8 +- 7 files changed, 729 insertions(+), 181 deletions(-) (limited to 'plugins') diff --git a/plugins/CacheLog/locale/CacheLog.pot b/plugins/CacheLog/locale/CacheLog.pot index 4e0e4112b..fbcd6dd08 100644 --- a/plugins/CacheLog/locale/CacheLog.pot +++ b/plugins/CacheLog/locale/CacheLog.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"POT-Creation-Date: 2010-09-19 15:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,6 +16,6 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: CacheLogPlugin.php:117 +#: CacheLogPlugin.php:116 msgid "Log reads and writes to the cache." msgstr "" diff --git a/plugins/Facebook/locale/Facebook.pot b/plugins/Facebook/locale/Facebook.pot index 09f027c4e..e6215df01 100644 --- a/plugins/Facebook/locale/Facebook.pot +++ b/plugins/Facebook/locale/Facebook.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"POT-Creation-Date: 2010-09-19 15:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: facebookutil.php:439 +#: facebookutil.php:425 #, php-format msgid "" "Hi, %1$s. We're sorry to inform you that we are unable to update your " @@ -35,23 +35,24 @@ msgstr "" msgid "You must be logged into Facebook to use Facebook Connect." msgstr "" -#: FBConnectAuth.php:77 -msgid "There is already a local user linked with this Facebook." +#: FBConnectAuth.php:75 +msgid "There is already a local user linked with this Facebook account." msgstr "" -#: FBConnectAuth.php:90 FBConnectSettings.php:167 +#: FBConnectAuth.php:87 FBConnectSettings.php:166 msgid "There was a problem with your session token. Try again, please." msgstr "" -#: FBConnectAuth.php:95 +#: FBConnectAuth.php:92 msgid "You can't register if you don't agree to the license." msgstr "" -#: FBConnectAuth.php:105 -msgid "Something weird happened." +#: FBConnectAuth.php:102 +msgid "An unknown error has occured." msgstr "" -#: FBConnectAuth.php:119 +#. TRANS: %s is the site name. +#: FBConnectAuth.php:117 #, php-format msgid "" "This is the first time you've logged into %s so we must connect your " @@ -59,360 +60,469 @@ msgid "" "with your existing account, if you have one." msgstr "" -#: FBConnectAuth.php:125 +#. TRANS: Page title. +#: FBConnectAuth.php:124 msgid "Facebook Account Setup" msgstr "" +#. TRANS: Legend. #: FBConnectAuth.php:158 msgid "Connection options" msgstr "" -#: FBConnectAuth.php:183 -msgid "Create new account" +#. TRANS: %s is the name of the license used by the user for their status updates. +#: FBConnectAuth.php:168 +#, php-format +msgid "" +"My text and files are available under %s except this private data: password, " +"email address, IM address, and phone number." msgstr "" +#. TRANS: Legend. #: FBConnectAuth.php:185 +msgid "Create new account" +msgstr "" + +#: FBConnectAuth.php:187 msgid "Create a new user with this nickname." msgstr "" -#: FBConnectAuth.php:188 +#. TRANS: Field label. +#: FBConnectAuth.php:191 msgid "New nickname" msgstr "" -#: FBConnectAuth.php:190 +#: FBConnectAuth.php:193 msgid "1-64 lowercase letters or numbers, no punctuation or spaces" msgstr "" -#: FBConnectAuth.php:193 +#. TRANS: Submit button. +#: FBConnectAuth.php:197 +msgctxt "BUTTON" msgid "Create" msgstr "" -#: FBConnectAuth.php:198 +#: FBConnectAuth.php:203 msgid "Connect existing account" msgstr "" -#: FBConnectAuth.php:200 +#: FBConnectAuth.php:205 msgid "" "If you already have an account, login with your username and password to " "connect it to your Facebook." msgstr "" -#: FBConnectAuth.php:203 +#. TRANS: Field label. +#: FBConnectAuth.php:209 msgid "Existing nickname" msgstr "" -#: FBConnectAuth.php:206 facebookaction.php:271 +#: FBConnectAuth.php:212 facebookaction.php:277 msgid "Password" msgstr "" -#: FBConnectAuth.php:209 +#. TRANS: Submit button. +#: FBConnectAuth.php:216 +msgctxt "BUTTON" msgid "Connect" msgstr "" -#: FBConnectAuth.php:225 FBConnectAuth.php:234 +#. TRANS: Client error trying to register with registrations not allowed. +#. TRANS: Client error trying to register with registrations 'invite only'. +#: FBConnectAuth.php:233 FBConnectAuth.php:243 msgid "Registration not allowed." msgstr "" -#: FBConnectAuth.php:241 +#. TRANS: Client error trying to register with an invalid invitation code. +#: FBConnectAuth.php:251 msgid "Not a valid invitation code." msgstr "" -#: FBConnectAuth.php:251 +#: FBConnectAuth.php:261 msgid "Nickname must have only lowercase letters and numbers and no spaces." msgstr "" -#: FBConnectAuth.php:256 +#: FBConnectAuth.php:266 msgid "Nickname not allowed." msgstr "" -#: FBConnectAuth.php:261 +#: FBConnectAuth.php:271 msgid "Nickname already in use. Try another one." msgstr "" -#: FBConnectAuth.php:279 FBConnectAuth.php:313 FBConnectAuth.php:333 +#: FBConnectAuth.php:289 FBConnectAuth.php:323 FBConnectAuth.php:343 msgid "Error connecting user to Facebook." msgstr "" -#: FBConnectAuth.php:299 +#: FBConnectAuth.php:309 msgid "Invalid username or password." msgstr "" -#: facebooklogin.php:91 facebookaction.php:249 facebookaction.php:275 +#. TRANS: Page title. +#: facebooklogin.php:90 facebookaction.php:255 msgid "Login" msgstr "" -#: facebookhome.php:111 -msgid "Server error - couldn't get user!" +#. TRANS: Legend. +#: facebooknoticeform.php:144 +msgid "Send a notice" msgstr "" -#: facebookhome.php:131 -msgid "Incorrect username or password." +#. TRANS: Field label. +#: facebooknoticeform.php:157 +#, php-format +msgid "What's up, %s?" msgstr "" -#: facebookhome.php:158 -#, php-format -msgid "%s and friends, page %d" +#: facebooknoticeform.php:169 +msgid "Available characters" +msgstr "" + +#. TRANS: Button text. +#: facebooknoticeform.php:196 +msgctxt "BUTTON" +msgid "Send" msgstr "" -#: facebookhome.php:160 +#: facebookhome.php:103 +msgid "Server error: Couldn't get user!" +msgstr "" + +#: facebookhome.php:122 +msgid "Incorrect username or password." +msgstr "" + +#. TRANS: Page title. +#. TRANS: %s is a user nickname +#: facebookhome.php:157 #, php-format msgid "%s and friends" msgstr "" -#: facebookhome.php:189 +#. TRANS: Instructions. %s is the application name. +#: facebookhome.php:185 #, php-format msgid "" "If you would like the %s app to automatically update your Facebook status " "with your latest notice, you need to give it permission." msgstr "" -#: facebookhome.php:213 +#: facebookhome.php:210 msgid "Okay, do it!" msgstr "" -#: facebookhome.php:219 +#. TRANS: Button text. Clicking the button will skip updating Facebook permissions. +#: facebookhome.php:217 +msgctxt "BUTTON" msgid "Skip" msgstr "" -#: facebookhome.php:248 facebookaction.php:330 +#: facebookhome.php:244 facebookaction.php:336 msgid "Pagination" msgstr "" -#: facebookhome.php:257 facebookaction.php:339 +#. TRANS: Pagination link. +#: facebookhome.php:254 facebookaction.php:345 msgid "After" msgstr "" -#: facebookhome.php:265 facebookaction.php:347 +#. TRANS: Pagination link. +#: facebookhome.php:263 facebookaction.php:353 msgid "Before" msgstr "" -#: facebookinvite.php:72 +#. TRANS: %s is the name of the site. +#: facebookinvite.php:69 #, php-format -msgid "Thanks for inviting your friends to use %s" +msgid "Thanks for inviting your friends to use %s." msgstr "" -#: facebookinvite.php:74 +#. TRANS: Followed by an unordered list with invited friends. +#: facebookinvite.php:72 msgid "Invitations have been sent to the following users:" msgstr "" -#: facebookinvite.php:94 +#: facebookinvite.php:91 #, php-format msgid "You have been invited to %s" msgstr "" -#: facebookinvite.php:103 +#. TRANS: %s is the name of the site. +#: facebookinvite.php:101 #, php-format msgid "Invite your friends to use %s" msgstr "" -#: facebookinvite.php:125 +#. TRANS: %s is the name of the site. +#: facebookinvite.php:124 #, php-format msgid "Friends already using %s:" msgstr "" +#. TRANS: Page title. #: facebookinvite.php:143 msgid "Send invitations" msgstr "" -#: FacebookPlugin.php:195 FacebookPlugin.php:488 FacebookPlugin.php:510 -#: facebookadminpanel.php:54 +#. TRANS: Menu item. +#. TRANS: Menu item tab. +#: FacebookPlugin.php:188 FacebookPlugin.php:461 FacebookPlugin.php:485 +msgctxt "MENU" msgid "Facebook" msgstr "" -#: FacebookPlugin.php:196 +#. TRANS: Tooltip for menu item "Facebook". +#: FacebookPlugin.php:190 msgid "Facebook integration configuration" msgstr "" -#: FacebookPlugin.php:489 +#: FacebookPlugin.php:431 +msgid "Facebook Connect User" +msgstr "" + +#. TRANS: Tooltip for menu item "Facebook". +#: FacebookPlugin.php:463 msgid "Login or register using Facebook" msgstr "" -#: FacebookPlugin.php:511 FBConnectSettings.php:56 +#. TRANS: Tooltip for menu item "Facebook". +#. TRANS: Page title. +#: FacebookPlugin.php:487 FBConnectSettings.php:55 msgid "Facebook Connect Settings" msgstr "" -#: FacebookPlugin.php:617 +#: FacebookPlugin.php:591 msgid "" -"The Facebook plugin allows you to integrate your StatusNet instance with Facebook and Facebook Connect." +"The Facebook plugin allows integrating StatusNet instances with Facebook and Facebook Connect." msgstr "" #: FBConnectLogin.php:33 msgid "Already logged in." msgstr "" -#: FBConnectLogin.php:41 +#. TRANS: Instructions. +#: FBConnectLogin.php:42 msgid "Login with your Facebook Account" msgstr "" -#: FBConnectLogin.php:55 +#. TRANS: Page title. +#: FBConnectLogin.php:57 msgid "Facebook Login" msgstr "" -#: facebookremove.php:58 +#: facebookremove.php:57 msgid "Couldn't remove Facebook user." msgstr "" +#. TRANS: Link description for 'Home' link that leads to a start page. +#: facebookaction.php:169 +msgctxt "MENU" +msgid "Home" +msgstr "" + +#. TRANS: Tooltip for 'Home' link that leads to a start page. #: facebookaction.php:171 msgid "Home" msgstr "" -#: facebookaction.php:179 +#. TRANS: Link description for 'Invite' link that leads to a page where friends can be invited. +#: facebookaction.php:180 +msgctxt "MENU" +msgid "Invite" +msgstr "" + +#. TRANS: Tooltip for 'Invite' link that leads to a page where friends can be invited. +#: facebookaction.php:182 msgid "Invite" msgstr "" -#: facebookaction.php:188 +#. TRANS: Link description for 'Settings' link that leads to a page user preferences can be set. +#: facebookaction.php:192 +msgctxt "MENU" msgid "Settings" msgstr "" -#: facebookaction.php:227 +#. TRANS: Tooltip for 'Settings' link that leads to a page user preferences can be set. +#: facebookaction.php:194 +msgid "Settings" +msgstr "" + +#: facebookaction.php:233 #, php-format msgid "" "To use the %s Facebook Application you need to login with your username and " "password. Don't have a username yet?" msgstr "" -#: facebookaction.php:229 +#: facebookaction.php:235 msgid " a new account." msgstr "" -#: facebookaction.php:236 +#: facebookaction.php:242 msgid "Register" msgstr "" -#: facebookaction.php:268 +#: facebookaction.php:274 msgid "Nickname" msgstr "" -#: facebookaction.php:281 +#. TRANS: Login button. +#: facebookaction.php:282 +msgctxt "BUTTON" +msgid "Login" +msgstr "" + +#: facebookaction.php:288 msgid "Lost or forgotten password?" msgstr "" -#: facebookaction.php:365 +#: facebookaction.php:370 msgid "No notice content!" msgstr "" -#: facebookaction.php:371 +#: facebookaction.php:377 #, php-format msgid "That's too long. Max notice size is %d chars." msgstr "" -#: facebookaction.php:430 +#: facebookaction.php:431 msgid "Notices" msgstr "" -#: facebookadminpanel.php:65 +#: facebookadminpanel.php:52 +msgid "Facebook" +msgstr "" + +#: facebookadminpanel.php:62 msgid "Facebook integration settings" msgstr "" -#: facebookadminpanel.php:129 +#: facebookadminpanel.php:123 msgid "Invalid Facebook API key. Max length is 255 characters." msgstr "" -#: facebookadminpanel.php:135 +#: facebookadminpanel.php:129 msgid "Invalid Facebook API secret. Max length is 255 characters." msgstr "" -#: facebookadminpanel.php:188 +#: facebookadminpanel.php:178 msgid "Facebook application settings" msgstr "" -#: facebookadminpanel.php:194 +#: facebookadminpanel.php:184 msgid "API key" msgstr "" -#: facebookadminpanel.php:195 +#: facebookadminpanel.php:185 msgid "API key provided by Facebook" msgstr "" -#: facebookadminpanel.php:203 +#: facebookadminpanel.php:193 msgid "Secret" msgstr "" -#: facebookadminpanel.php:204 +#: facebookadminpanel.php:194 msgid "API secret provided by Facebook" msgstr "" -#: FBConnectSettings.php:67 +#: facebookadminpanel.php:210 +msgid "Save" +msgstr "" + +#: facebookadminpanel.php:210 +msgid "Save Facebook settings" +msgstr "" + +#. TRANS: Instructions. +#: FBConnectSettings.php:66 msgid "Manage how your account connects to Facebook" msgstr "" -#: FBConnectSettings.php:92 +#: FBConnectSettings.php:90 msgid "There is no Facebook user connected to this account." msgstr "" -#: FBConnectSettings.php:100 +#: FBConnectSettings.php:98 msgid "Connected Facebook user" msgstr "" -#: FBConnectSettings.php:119 +#. TRANS: Legend. +#: FBConnectSettings.php:118 msgid "Disconnect my account from Facebook" msgstr "" #. TRANS: Followed by a link containing text "set a password". -#: FBConnectSettings.php:126 +#: FBConnectSettings.php:125 msgid "" "Disconnecting your Faceboook would make it impossible to log in! Please " msgstr "" #. TRANS: Preceded by "Please " and followed by " first." -#: FBConnectSettings.php:131 +#: FBConnectSettings.php:130 msgid "set a password" msgstr "" #. TRANS: Preceded by "Please set a password". -#: FBConnectSettings.php:133 +#: FBConnectSettings.php:132 msgid " first." msgstr "" +#. TRANS: Submit button. #: FBConnectSettings.php:145 +msgctxt "BUTTON" msgid "Disconnect" msgstr "" -#: FBConnectSettings.php:181 +#: FBConnectSettings.php:180 msgid "Couldn't delete link to Facebook." msgstr "" -#: FBConnectSettings.php:197 +#: FBConnectSettings.php:196 msgid "You have disconnected from Facebook." msgstr "" -#: FBConnectSettings.php:200 +#: FBConnectSettings.php:199 msgid "Not sure what you're trying to do." msgstr "" -#: facebooksettings.php:63 +#: facebooksettings.php:61 msgid "There was a problem saving your sync preferences!" msgstr "" -#: facebooksettings.php:65 +#. TRANS: Confirmation that synchronisation settings have been saved into the system. +#: facebooksettings.php:64 msgid "Sync preferences saved." msgstr "" -#: facebooksettings.php:88 +#: facebooksettings.php:87 msgid "Automatically update my Facebook status with my notices." msgstr "" -#: facebooksettings.php:95 +#: facebooksettings.php:94 msgid "Send \"@\" replies to Facebook." msgstr "" +#. TRANS: Submit button to save synchronisation settings. #: facebooksettings.php:102 +msgctxt "BUTTON" msgid "Save" msgstr "" -#: facebooksettings.php:112 +#. TRANS: %s is the application name. +#: facebooksettings.php:111 #, php-format msgid "" "If you would like %s to automatically update your Facebook status with your " "latest notice, you need to give it permission." msgstr "" -#: facebooksettings.php:125 +#: facebooksettings.php:124 #, php-format msgid "Allow %s to update my Facebook status" msgstr "" -#: facebooksettings.php:135 +#. TRANS: Page title for synchronisation settings. +#: facebooksettings.php:134 msgid "Sync preferences" msgstr "" diff --git a/plugins/GoogleAnalytics/locale/GoogleAnalytics.pot b/plugins/GoogleAnalytics/locale/GoogleAnalytics.pot index 4006ccf1f..111eee88e 100644 --- a/plugins/GoogleAnalytics/locale/GoogleAnalytics.pot +++ b/plugins/GoogleAnalytics/locale/GoogleAnalytics.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"POT-Creation-Date: 2010-09-19 15:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: GoogleAnalyticsPlugin.php:81 +#: GoogleAnalyticsPlugin.php:80 msgid "" "Use Google Analytics to " "track web access." diff --git a/plugins/OStatus/locale/OStatus.pot b/plugins/OStatus/locale/OStatus.pot index b3a9074a2..882e8d308 100644 --- a/plugins/OStatus/locale/OStatus.pot +++ b/plugins/OStatus/locale/OStatus.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"POT-Creation-Date: 2010-09-19 15:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,309 +16,746 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: OStatusPlugin.php:226 OStatusPlugin.php:951 actions/ostatusinit.php:99 +#. TRANS: Link description for link to subscribe to a remote user. +#. TRANS: Link text for a user to subscribe to an OStatus user. +#: OStatusPlugin.php:227 OStatusPlugin.php:958 msgid "Subscribe" msgstr "" -#: OStatusPlugin.php:244 OStatusPlugin.php:663 actions/ostatussub.php:105 -#: actions/ostatusinit.php:96 +#. TRANS: Link description for link to join a remote group. +#: OStatusPlugin.php:246 OStatusPlugin.php:667 actions/ostatussub.php:107 msgid "Join" msgstr "" -#: OStatusPlugin.php:456 +#. TRANSLATE: %s is a domain. +#: OStatusPlugin.php:459 #, php-format msgid "Sent from %s via OStatus" msgstr "" -#: OStatusPlugin.php:527 +#. TRANS: Exception. +#: OStatusPlugin.php:531 msgid "Could not set up remote subscription." msgstr "" -#: OStatusPlugin.php:647 +#: OStatusPlugin.php:570 +msgid "Follow" +msgstr "" + +#. TRANS: Success message for subscribe to user attempt through OStatus. +#. TRANS: %1$s is the subscriber name, %2$s is the subscribed user's name. +#: OStatusPlugin.php:573 +#, php-format +msgid "%1$s is now following %2$s." +msgstr "" + +#: OStatusPlugin.php:620 +msgid "Unfollow" +msgstr "" + +#. 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. +#: OStatusPlugin.php:623 +#, php-format +msgid "%1$s stopped following %2$s." +msgstr "" + +#: OStatusPlugin.php:651 msgid "Could not set up remote group membership." msgstr "" -#: OStatusPlugin.php:674 +#. TRANS: Exception. +#: OStatusPlugin.php:679 msgid "Failed joining remote group." msgstr "" -#: OStatusPlugin.php:714 +#: OStatusPlugin.php:719 msgid "Leave" msgstr "" -#: OStatusPlugin.php:880 +#: OStatusPlugin.php:760 +msgid "Favor" +msgstr "" + +#. TRANS: Success message for adding a favorite notice through OStatus. +#. TRANS: %1$s is the favoring user's name, %2$s is URI to the favored notice. +#: OStatusPlugin.php:763 +#, php-format +msgid "%1$s marked notice %2$s as a favorite." +msgstr "" + +#: OStatusPlugin.php:806 +msgid "Disfavor" +msgstr "" + +#. TRANS: Success message for remove a favorite notice through OStatus. +#. TRANS: %1$s is the unfavoring user's name, %2$s is URI to the no longer favored notice. +#: OStatusPlugin.php:809 +#, php-format +msgid "%1$s marked notice %2$s as no longer a favorite." +msgstr "" + +#. TRANS: Link text for link to remote subscribe. +#: OStatusPlugin.php:885 msgid "Remote" msgstr "" -#: OStatusPlugin.php:919 +#. TRANS: Title for activity. +#: OStatusPlugin.php:925 msgid "Profile update" msgstr "" #. TRANS: Ping text for remote profile update through OStatus. #. TRANS: %s is user that updated their profile. -#: OStatusPlugin.php:922 +#: OStatusPlugin.php:928 #, php-format msgid "%s has updated their profile page." msgstr "" -#: OStatusPlugin.php:966 +#. TRANS: Plugin description. +#: OStatusPlugin.php:973 msgid "" "Follow people across social networks that implement OStatus." msgstr "" -#: classes/Ostatus_profile.php:592 +#: classes/FeedSub.php:248 +msgid "Attempting to start PuSH subscription for feed with no hub." +msgstr "" + +#: classes/FeedSub.php:278 +msgid "Attempting to end PuSH subscription for feed with no hub." +msgstr "" + +#. TRANS: Server exception. +#: classes/Ostatus_profile.php:188 +#, php-format +msgid "Invalid ostatus_profile state: both group and profile IDs set for %s." +msgstr "" + +#. TRANS: Server exception. +#: classes/Ostatus_profile.php:191 +#, php-format +msgid "Invalid ostatus_profile state: both group and profile IDs empty for %s." +msgstr "" + +#. TRANS: Server exception. +#. TRANS: %1$s is the method name the exception occured in, %2$s is the actor type. +#: classes/Ostatus_profile.php:281 +#, php-format +msgid "Invalid actor passed to %1$s: %2$s." +msgstr "" + +#. TRANS: Server exception. +#: classes/Ostatus_profile.php:374 +msgid "" +"Invalid type passed to Ostatus_profile::notify. It must be XML string or " +"Activity entry." +msgstr "" + +#: classes/Ostatus_profile.php:404 +msgid "Unknown feed format." +msgstr "" + +#: classes/Ostatus_profile.php:427 +msgid "RSS feed without a channel." +msgstr "" + +#. TRANS: Client exception. +#: classes/Ostatus_profile.php:472 +msgid "Can't handle that kind of post." +msgstr "" + +#. TRANS: Client exception. %s is a source URL. +#: classes/Ostatus_profile.php:555 +#, php-format +msgid "No content for notice %s." +msgstr "" + +#. TRANS: Shown when a notice is longer than supported and/or when attachments are present. +#: classes/Ostatus_profile.php:588 msgid "Show more" msgstr "" -#: classes/Ostatus_profile.php:1034 +#. TRANS: Exception. %s is a profile URL. +#: classes/Ostatus_profile.php:781 +#, php-format +msgid "Could not reach profile page %s." +msgstr "" + +#. TRANS: Exception. +#: classes/Ostatus_profile.php:839 +#, php-format +msgid "Could not find a feed URL for profile page %s." +msgstr "" + +#: classes/Ostatus_profile.php:976 +msgid "Can't find enough profile information to make a feed." +msgstr "" + +#: classes/Ostatus_profile.php:1035 #, php-format msgid "Invalid avatar URL %s." msgstr "" -#: classes/Ostatus_profile.php:1044 +#: classes/Ostatus_profile.php:1045 #, php-format msgid "Tried to update avatar for unsaved remote profile %s." msgstr "" -#: classes/Ostatus_profile.php:1052 +#: classes/Ostatus_profile.php:1053 #, php-format msgid "Unable to fetch avatar from %s." msgstr "" -#. TRANS: POST is a HTTP command. It should not be translated. +#. TRANS: Exception. +#: classes/Ostatus_profile.php:1275 +msgid "Local user can't be referenced as remote." +msgstr "" + +#. TRANS: Exception. +#: classes/Ostatus_profile.php:1280 +msgid "Local group can't be referenced as remote." +msgstr "" + +#. TRANS: Exception. +#: classes/Ostatus_profile.php:1332 classes/Ostatus_profile.php:1343 +msgid "Can't save local profile." +msgstr "" + +#. TRANS: Exception. +#: classes/Ostatus_profile.php:1351 +msgid "Can't save OStatus profile." +msgstr "" + +#. TRANS: Exception. +#: classes/Ostatus_profile.php:1610 classes/Ostatus_profile.php:1638 +msgid "Not a valid webfinger address." +msgstr "" + +#. TRANS: Exception. %s is a webfinger address. +#: classes/Ostatus_profile.php:1720 +#, php-format +msgid "Couldn't save profile for \"%s\"." +msgstr "" + +#. TRANS: Exception. %s is a webfinger address. +#: classes/Ostatus_profile.php:1739 +#, php-format +msgid "Couldn't save ostatus_profile for \"%s\"." +msgstr "" + +#. TRANS: Exception. %s is a webfinger address. +#: classes/Ostatus_profile.php:1747 +#, php-format +msgid "Couldn't find a valid profile for \"%s\"." +msgstr "" + +#: classes/Ostatus_profile.php:1789 +msgid "Could not store HTML content of long post as file." +msgstr "" + +#. TRANS: Client exception. %s is a HTTP status code. +#: classes/HubSub.php:208 +#, php-format +msgid "Hub subscriber verification returned HTTP %s." +msgstr "" + +#. TRANS: Exception. %1$s is a response status code, %2$s is the body of the response. +#: classes/HubSub.php:355 +#, php-format +msgid "Callback returned status: %1$s. Body: %2$s" +msgstr "" + +#. TRANS: Client error. POST is a HTTP command. It should not be translated. #: lib/salmonaction.php:42 msgid "This method requires a POST." msgstr "" -#: lib/salmonaction.php:46 +#. TRANS: Client error. Do not translate "application/magic-envelope+xml" +#: lib/salmonaction.php:47 msgid "Salmon requires \"application/magic-envelope+xml\"." msgstr "" -#: lib/salmonaction.php:55 +#. TRANS: Client error. +#: lib/salmonaction.php:57 msgid "Salmon signature verification failed." msgstr "" -#: lib/salmonaction.php:66 +#. TRANS: Client error. +#: lib/salmonaction.php:69 msgid "Salmon post must be an Atom entry." msgstr "" -#: lib/salmonaction.php:114 +#. TRANS: Client exception. +#: lib/salmonaction.php:118 msgid "Unrecognized activity type." msgstr "" -#: lib/salmonaction.php:122 +#. TRANS: Client exception. +#: lib/salmonaction.php:127 msgid "This target doesn't understand posts." msgstr "" -#: lib/salmonaction.php:127 +#. TRANS: Client exception. +#: lib/salmonaction.php:133 msgid "This target doesn't understand follows." msgstr "" -#: lib/salmonaction.php:132 +#. TRANS: Client exception. +#: lib/salmonaction.php:139 msgid "This target doesn't understand unfollows." msgstr "" -#: lib/salmonaction.php:137 +#. TRANS: Client exception. +#: lib/salmonaction.php:145 msgid "This target doesn't understand favorites." msgstr "" -#: lib/salmonaction.php:142 +#. TRANS: Client exception. +#: lib/salmonaction.php:151 msgid "This target doesn't understand unfavorites." msgstr "" -#: lib/salmonaction.php:147 +#. TRANS: Client exception. +#: lib/salmonaction.php:157 msgid "This target doesn't understand share events." msgstr "" -#: lib/salmonaction.php:152 +#. TRANS: Client exception. +#: lib/salmonaction.php:163 msgid "This target doesn't understand joins." msgstr "" -#: lib/salmonaction.php:157 +#. TRANS: Client exception. +#: lib/salmonaction.php:169 msgid "This target doesn't understand leave events." msgstr "" +#. TRANS: Exception. +#: lib/salmonaction.php:197 +msgid "Received a salmon slap from unidentified actor." +msgstr "" + +#. TRANS: Exception. +#: lib/discovery.php:110 +#, php-format +msgid "Unable to find services for %s." +msgstr "" + +#. TRANS: Exception. +#: lib/xrd.php:64 +msgid "Invalid XML." +msgstr "" + +#. TRANS: Exception. +#: lib/xrd.php:69 +msgid "Invalid XML, missing XRD root." +msgstr "" + +#. TRANS: Exception. +#: lib/magicenvelope.php:80 +msgid "Unable to locate signer public key." +msgstr "" + +#. TRANS: Exception. +#: lib/salmon.php:93 +msgid "Salmon invalid actor for signing." +msgstr "" + #: tests/gettext-speedtest.php:57 msgid "Feeds" msgstr "" -#: actions/ostatusgroup.php:75 +#. TRANS: Client exception. +#: actions/pushhub.php:66 +msgid "Publishing outside feeds not supported." +msgstr "" + +#. TRANS: Client exception. %s is a mode. +#: actions/pushhub.php:69 +#, php-format +msgid "Unrecognized mode \"%s\"." +msgstr "" + +#. TRANS: Client exception. %s is a topic. +#: actions/pushhub.php:89 +#, php-format +msgid "" +"Unsupported hub.topic %s this hub only serves local user and group Atom " +"feeds." +msgstr "" + +#. TRANS: Client exception. +#: actions/pushhub.php:95 +#, php-format +msgid "Invalid hub.verify \"%s\". It must be sync or async." +msgstr "" + +#. TRANS: Client exception. +#: actions/pushhub.php:101 +#, php-format +msgid "Invalid hub.lease \"%s\". It must be empty or positive integer." +msgstr "" + +#. TRANS: Client exception. +#: actions/pushhub.php:109 +#, php-format +msgid "Invalid hub.secret \"%s\". It must be under 200 bytes." +msgstr "" + +#. TRANS: Client exception. +#: actions/pushhub.php:161 +#, php-format +msgid "Invalid hub.topic \"%s\". User doesn't exist." +msgstr "" + +#. TRANS: Client exception. +#: actions/pushhub.php:170 +#, php-format +msgid "Invalid hub.topic \"%s\". Group doesn't exist." +msgstr "" + +#. TRANS: Client exception. +#. TRANS: %1$s is this argument to the method this exception occurs in, %2$s is a URL. +#: actions/pushhub.php:195 +#, php-format +msgid "Invalid URL passed for %1$s: \"%2$s\"" +msgstr "" + +#: actions/userxrd.php:47 actions/ownerxrd.php:37 actions/usersalmon.php:43 +msgid "No such user." +msgstr "" + +#. TRANS: Client error. +#: actions/usersalmon.php:37 actions/groupsalmon.php:40 +msgid "No ID." +msgstr "" + +#. TRANS: Client exception. +#: actions/usersalmon.php:81 +msgid "In reply to unknown notice." +msgstr "" + +#. TRANS: Client exception. +#: actions/usersalmon.php:86 +msgid "In reply to a notice not by this user and not mentioning this user." +msgstr "" + +#. TRANS: Client exception. +#: actions/usersalmon.php:163 +msgid "Could not save new favorite." +msgstr "" + +#. TRANS: Client exception. +#: actions/usersalmon.php:195 +msgid "Can't favorite/unfavorite without an object." +msgstr "" + +#. TRANS: Client exception. +#: actions/usersalmon.php:207 +msgid "Can't handle that kind of object for liking/faving." +msgstr "" + +#. TRANS: Client exception. %s is an object ID. +#: actions/usersalmon.php:214 +#, php-format +msgid "Notice with ID %s unknown." +msgstr "" + +#. TRANS: Client exception. %1$s is a notice ID, %2$s is a user ID. +#: actions/usersalmon.php:219 +#, php-format +msgid "Notice with ID %1$s not posted by %2$s." +msgstr "" + +#. TRANS: Field label. +#: actions/ostatusgroup.php:76 msgid "Join group" msgstr "" -#: actions/ostatusgroup.php:77 +#. TRANS: Tooltip for field label "Join group". +#: actions/ostatusgroup.php:79 msgid "OStatus group's address, like http://example.net/group/nickname." msgstr "" -#: actions/ostatusgroup.php:81 actions/ostatussub.php:71 +#. TRANS: Button text. +#: actions/ostatusgroup.php:84 actions/ostatussub.php:73 +msgctxt "BUTTON" msgid "Continue" msgstr "" -#: actions/ostatusgroup.php:100 +#: actions/ostatusgroup.php:103 msgid "You are already a member of this group." msgstr "" #. TRANS: OStatus remote group subscription dialog error. -#: actions/ostatusgroup.php:135 +#: actions/ostatusgroup.php:138 msgid "Already a member!" msgstr "" #. TRANS: OStatus remote group subscription dialog error. -#: actions/ostatusgroup.php:146 +#: actions/ostatusgroup.php:149 msgid "Remote group join failed!" msgstr "" #. TRANS: OStatus remote group subscription dialog error. -#: actions/ostatusgroup.php:150 +#: actions/ostatusgroup.php:153 msgid "Remote group join aborted!" msgstr "" #. TRANS: Page title for OStatus remote group join form -#: actions/ostatusgroup.php:163 +#: actions/ostatusgroup.php:165 msgid "Confirm joining remote group" msgstr "" -#: actions/ostatusgroup.php:174 +#. TRANS: Instructions. +#: actions/ostatusgroup.php:176 msgid "" "You can subscribe to groups from other supported sites. Paste the group's " "profile URI below:" msgstr "" -#: actions/groupsalmon.php:51 +#. TRANS: Client error. +#: actions/groupsalmon.php:47 +msgid "No such group." +msgstr "" + +#. TRANS: Client error. +#: actions/groupsalmon.php:53 msgid "Can't accept remote posts for a remote group." msgstr "" -#: actions/groupsalmon.php:124 +#. TRANS: Client error. +#: actions/groupsalmon.php:127 msgid "Can't read profile to set up group membership." msgstr "" -#: actions/groupsalmon.php:127 actions/groupsalmon.php:170 +#. TRANS: Client error. +#: actions/groupsalmon.php:131 actions/groupsalmon.php:174 msgid "Groups can't join groups." msgstr "" -#: actions/groupsalmon.php:154 +#: actions/groupsalmon.php:144 +msgid "You have been blocked from that group by the admin." +msgstr "" + +#. TRANS: Server error. %1$s is a profile URI, %2$s is a group nickname. +#: actions/groupsalmon.php:159 #, php-format msgid "Could not join remote user %1$s to group %2$s." msgstr "" -#: actions/groupsalmon.php:167 +#: actions/groupsalmon.php:171 msgid "Can't read profile to cancel group membership." msgstr "" -#: actions/groupsalmon.php:183 +#. TRANS: Server error. %1$s is a profile URI, %2$s is a group nickname. +#: actions/groupsalmon.php:188 #, php-format msgid "Could not remove remote user %1$s from group %2$s." msgstr "" -#: actions/ostatussub.php:65 +#. TRANS: Field label for a field that takes an OStatus user address. +#: actions/ostatussub.php:66 msgid "Subscribe to" msgstr "" -#: actions/ostatussub.php:67 +#. TRANS: Tooltip for field label "Subscribe to". +#: actions/ostatussub.php:69 msgid "" "OStatus user's address, like nickname@example.com or http://example.net/" "nickname" msgstr "" -#: actions/ostatussub.php:106 +#. TRANS: Button text. +#. TRANS: Tooltip for button "Join". +#: actions/ostatussub.php:110 +msgctxt "BUTTON" msgid "Join this group" msgstr "" -#. TRANS: Page title for OStatus remote subscription form -#: actions/ostatussub.php:108 actions/ostatussub.php:400 +#. TRANS: Button text. +#: actions/ostatussub.php:113 +msgctxt "BUTTON" msgid "Confirm" msgstr "" -#: actions/ostatussub.php:109 +#. TRANS: Tooltip for button "Confirm". +#: actions/ostatussub.php:115 msgid "Subscribe to this user" msgstr "" -#: actions/ostatussub.php:130 +#: actions/ostatussub.php:136 msgid "You are already subscribed to this user." msgstr "" -#: actions/ostatussub.php:247 actions/ostatussub.php:253 -#: actions/ostatussub.php:272 +#: actions/ostatussub.php:165 +msgid "Photo" +msgstr "" + +#: actions/ostatussub.php:176 +msgid "Nickname" +msgstr "" + +#: actions/ostatussub.php:197 +msgid "Location" +msgstr "" + +#: actions/ostatussub.php:206 +msgid "URL" +msgstr "" + +#: actions/ostatussub.php:218 +msgid "Note" +msgstr "" + +#. TRANS: Error text. +#: actions/ostatussub.php:254 actions/ostatussub.php:261 +#: actions/ostatussub.php:286 msgid "" "Sorry, we could not reach that address. Please make sure that the OStatus " "address is like nickname@example.com or http://example.net/nickname." msgstr "" -#: actions/ostatussub.php:256 actions/ostatussub.php:259 -#: actions/ostatussub.php:262 actions/ostatussub.php:265 -#: actions/ostatussub.php:268 +#. TRANS: Error text. +#: actions/ostatussub.php:265 actions/ostatussub.php:269 +#: actions/ostatussub.php:273 actions/ostatussub.php:277 +#: actions/ostatussub.php:281 msgid "" "Sorry, we could not reach that feed. Please try that OStatus address again " "later." msgstr "" #. TRANS: OStatus remote subscription dialog error. -#: actions/ostatussub.php:301 +#: actions/ostatussub.php:315 msgid "Already subscribed!" msgstr "" #. TRANS: OStatus remote subscription dialog error. -#: actions/ostatussub.php:306 +#: actions/ostatussub.php:320 msgid "Remote subscription failed!" msgstr "" -#: actions/ostatussub.php:380 actions/ostatusinit.php:81 +#: actions/ostatussub.php:367 actions/ostatusinit.php:63 +msgid "There was a problem with your session token. Try again, please." +msgstr "" + +#. TRANS: Form title. +#: actions/ostatussub.php:395 actions/ostatusinit.php:82 msgid "Subscribe to user" msgstr "" -#: actions/ostatussub.php:411 +#. TRANS: Page title for OStatus remote subscription form +#: actions/ostatussub.php:415 +msgid "Confirm" +msgstr "" + +#. TRANS: Instructions. +#: actions/ostatussub.php:427 msgid "" "You can subscribe to users from other supported sites. Paste their address " "or profile URI below:" msgstr "" +#. TRANS: Client error. #: actions/ostatusinit.php:41 msgid "You can use the local subscription!" msgstr "" -#: actions/ostatusinit.php:63 -msgid "There was a problem with your session token. Try again, please." -msgstr "" - -#: actions/ostatusinit.php:95 +#. TRANS: Form legend. +#: actions/ostatusinit.php:97 #, php-format msgid "Join group %s" msgstr "" -#: actions/ostatusinit.php:98 +#. TRANS: Button text. +#: actions/ostatusinit.php:99 +msgctxt "BUTTON" +msgid "Join" +msgstr "" + +#. TRANS: Form legend. +#: actions/ostatusinit.php:102 #, php-format msgid "Subscribe to %s" msgstr "" -#: actions/ostatusinit.php:111 +#. TRANS: Button text. +#: actions/ostatusinit.php:104 +msgctxt "BUTTON" +msgid "Subscribe" +msgstr "" + +#. TRANS: Field label. +#: actions/ostatusinit.php:117 msgid "User nickname" msgstr "" -#: actions/ostatusinit.php:112 +#: actions/ostatusinit.php:118 msgid "Nickname of the user you want to follow." msgstr "" -#: actions/ostatusinit.php:116 +#. TRANS: Field label. +#: actions/ostatusinit.php:123 msgid "Profile Account" msgstr "" -#: actions/ostatusinit.php:117 +#. TRANS: Tooltip for field label "Profile Account". +#: actions/ostatusinit.php:125 msgid "Your account id (e.g. user@identi.ca)." msgstr "" -#: actions/ostatusinit.php:138 +#. TRANS: Client error. +#: actions/ostatusinit.php:147 msgid "Must provide a remote profile." msgstr "" -#: actions/ostatusinit.php:149 +#. TRANS: Client error. +#: actions/ostatusinit.php:159 msgid "Couldn't look up OStatus account profile." msgstr "" -#: actions/ostatusinit.php:161 +#. TRANS: Client error. +#: actions/ostatusinit.php:172 msgid "Couldn't confirm remote profile address." msgstr "" -#: actions/ostatusinit.php:202 +#. TRANS: Page title. +#: actions/ostatusinit.php:217 msgid "OStatus Connect" msgstr "" + +#: actions/pushcallback.php:48 +msgid "Empty or invalid feed id." +msgstr "" + +#. TRANS: Server exception. %s is a feed ID. +#: actions/pushcallback.php:54 +#, php-format +msgid "Unknown PuSH feed id %s" +msgstr "" + +#. TRANS: Client exception. %s is an invalid feed name. +#: actions/pushcallback.php:93 +#, php-format +msgid "Bad hub.topic feed \"%s\"." +msgstr "" + +#. TRANS: Client exception. %1$s the invalid token, %2$s is the topic for which the invalid token was given. +#: actions/pushcallback.php:98 +#, php-format +msgid "Bad hub.verify_token %1$s for %2$s." +msgstr "" + +#. TRANS: Client exception. %s is an invalid topic. +#: actions/pushcallback.php:105 +#, php-format +msgid "Unexpected subscribe request for %s." +msgstr "" + +#. TRANS: Client exception. %s is an invalid topic. +#: actions/pushcallback.php:110 +#, php-format +msgid "Unexpected unsubscribe request for %s." +msgstr "" diff --git a/plugins/PiwikAnalytics/locale/PiwikAnalytics.pot b/plugins/PiwikAnalytics/locale/PiwikAnalytics.pot index 2578147a2..2afaaaa2d 100644 --- a/plugins/PiwikAnalytics/locale/PiwikAnalytics.pot +++ b/plugins/PiwikAnalytics/locale/PiwikAnalytics.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"POT-Creation-Date: 2010-09-19 15:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: PiwikAnalyticsPlugin.php:108 +#: PiwikAnalyticsPlugin.php:105 msgid "" "Use Piwik Open Source web analytics " "software." diff --git a/plugins/RSSCloud/locale/RSSCloud.pot b/plugins/RSSCloud/locale/RSSCloud.pot index 56de24825..c91f21f33 100644 --- a/plugins/RSSCloud/locale/RSSCloud.pot +++ b/plugins/RSSCloud/locale/RSSCloud.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"POT-Creation-Date: 2010-09-19 15:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -47,7 +47,8 @@ msgstr "" #: RSSCloudRequestNotify.php:161 msgid "" -"Thanks for the subscription. When the feed(s) update(s), you will be notified." +"Thanks for the subscription. When the feed(s) update(s), you will be " +"notified." msgstr "" #: LoggingAggregator.php:93 diff --git a/plugins/TwitterBridge/locale/TwitterBridge.pot b/plugins/TwitterBridge/locale/TwitterBridge.pot index 625ab8376..5a75bc5f8 100644 --- a/plugins/TwitterBridge/locale/TwitterBridge.pot +++ b/plugins/TwitterBridge/locale/TwitterBridge.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-18 22:06+0000\n" +"POT-Creation-Date: 2010-09-19 15:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,11 +16,11 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: twitter.php:353 +#: twitter.php:350 msgid "Your Twitter bridge has been disabled." msgstr "" -#: twitter.php:357 +#: twitter.php:354 #, php-format msgid "" "Hi, %1$s. We're sorry to inform you that your link to Twitter has been " @@ -33,7 +33,7 @@ msgid "" "\t%2$s\n" "\n" "Regards,\n" -"%3$s\n" +"%3$s" msgstr "" #: TwitterBridgePlugin.php:151 TwitterBridgePlugin.php:174 -- cgit v1.2.3-54-g00ecf From 667cfcc84a98a3552d604b359cbd1093e254d842 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 19:36:09 +0200 Subject: * add onPluginVersion() * remove superfluous whitespace. --- plugins/BlankAd/BlankAdPlugin.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/BlankAd/BlankAdPlugin.php b/plugins/BlankAd/BlankAdPlugin.php index 0e2719aed..d7182ebc2 100644 --- a/plugins/BlankAd/BlankAdPlugin.php +++ b/plugins/BlankAd/BlankAdPlugin.php @@ -51,7 +51,6 @@ if (!defined('STATUSNET')) { * * @seeAlso Location */ - class BlankAdPlugin extends UAPPlugin { /** @@ -61,7 +60,6 @@ class BlankAdPlugin extends UAPPlugin * * @return void */ - protected function showMediumRectangle($action) { $action->element('img', @@ -78,7 +76,6 @@ class BlankAdPlugin extends UAPPlugin * * @return void */ - protected function showRectangle($action) { $action->element('img', @@ -95,7 +92,6 @@ class BlankAdPlugin extends UAPPlugin * * @return void */ - protected function showWideSkyscraper($action) { $action->element('img', @@ -112,7 +108,6 @@ class BlankAdPlugin extends UAPPlugin * * @return void */ - protected function showLeaderboard($action) { $action->element('img', @@ -121,4 +116,15 @@ class BlankAdPlugin extends UAPPlugin 'src' => common_path('plugins/BlankAd/redpixel.png')), ''); } -} \ No newline at end of file + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'BlankAdPlugin', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:BlankAdPlugin', + 'rawdescription' => + _m('Plugin for testing ad layout')); + return true; + } +} -- cgit v1.2.3-54-g00ecf From a4a39a2cc36df617f5e076f38034d672a1208cd6 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 19:37:43 +0200 Subject: FIx inconsistencies in onPluginVersion() --- plugins/BlankAd/BlankAdPlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/BlankAd/BlankAdPlugin.php b/plugins/BlankAd/BlankAdPlugin.php index d7182ebc2..49243aeea 100644 --- a/plugins/BlankAd/BlankAdPlugin.php +++ b/plugins/BlankAd/BlankAdPlugin.php @@ -119,12 +119,12 @@ class BlankAdPlugin extends UAPPlugin function onPluginVersion(&$versions) { - $versions[] = array('name' => 'BlankAdPlugin', + $versions[] = array('name' => 'BlankAd', 'version' => STATUSNET_VERSION, 'author' => 'Evan Prodromou', 'homepage' => 'http://status.net/wiki/Plugin:BlankAdPlugin', 'rawdescription' => - _m('Plugin for testing ad layout')); + _m('Plugin for testing ad layout.')); return true; } } -- cgit v1.2.3-54-g00ecf From 7f3731e2badc9db38e75e7a145dbccaf533fd59a Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 19:38:00 +0200 Subject: Add onPluginVersion() --- plugins/Adsense/AdsensePlugin.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'plugins') diff --git a/plugins/Adsense/AdsensePlugin.php b/plugins/Adsense/AdsensePlugin.php index c02430a58..3d733e150 100644 --- a/plugins/Adsense/AdsensePlugin.php +++ b/plugins/Adsense/AdsensePlugin.php @@ -198,4 +198,15 @@ class AdsensePlugin extends UAPPlugin } return true; } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'BlankAdPlugin', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:Adsense', + 'rawdescription' => + _m('Plugin to add Google Adsense to StatusNet sites.')); + return true; + } } -- cgit v1.2.3-54-g00ecf From 2236e2eaf0c20442df49090725dea4ec98eb69bd Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 19:38:36 +0200 Subject: Remove superfluous whitespace. --- plugins/APC/APCPlugin.php | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins') diff --git a/plugins/APC/APCPlugin.php b/plugins/APC/APCPlugin.php index 666f64b14..006977900 100644 --- a/plugins/APC/APCPlugin.php +++ b/plugins/APC/APCPlugin.php @@ -116,4 +116,3 @@ class APCPlugin extends Plugin return true; } } - -- cgit v1.2.3-54-g00ecf From 3005f26aa23cf8fb8dca0a5ffed284e054fb77b9 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 19:42:56 +0200 Subject: Add onPluginVersion() --- plugins/BlogspamNet/BlogspamNetPlugin.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/BlogspamNet/BlogspamNetPlugin.php b/plugins/BlogspamNet/BlogspamNetPlugin.php index d52e6006a..51a86b4f3 100644 --- a/plugins/BlogspamNet/BlogspamNetPlugin.php +++ b/plugins/BlogspamNet/BlogspamNetPlugin.php @@ -53,7 +53,6 @@ define('BLOGSPAMNETPLUGIN_VERSION', '0.1'); * * @see Event */ - class BlogspamNetPlugin extends Plugin { var $baseUrl = 'http://test.blogspam.net:8888/'; @@ -142,4 +141,15 @@ class BlogspamNetPlugin extends Plugin { return 'BlogspamNetPlugin/'.BLOGSPAMNETPLUGIN_VERSION . ' StatusNet/' . STATUSNET_VERSION; } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'BlogspamNet', + 'version' => BLOGSPAMNETPLUGIN_VERSION, + 'author' => 'Evan Prodromou, Brion Vibber', + 'homepage' => 'http://status.net/wiki/Plugin:BlogspamNet', + 'rawdescription' => + _m('Plugin to check submitted notices with blogspam.net.')); + return true; + } } -- cgit v1.2.3-54-g00ecf From f975c1732936c3380048769bdf7ec55c24086856 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 19:45:43 +0200 Subject: Add onPluginVersion() --- plugins/Comet/CometPlugin.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/Comet/CometPlugin.php b/plugins/Comet/CometPlugin.php index 29cb3004b..70b324b5c 100644 --- a/plugins/Comet/CometPlugin.php +++ b/plugins/Comet/CometPlugin.php @@ -42,7 +42,6 @@ require_once INSTALLDIR.'/plugins/Realtime/RealtimePlugin.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class CometPlugin extends RealtimePlugin { public $server = null; @@ -104,4 +103,15 @@ class CometPlugin extends RealtimePlugin } return '/' . implode('/', $path); } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'Comet', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:Comet', + 'rawdescription' => + _m('Plugin to do "real time" updates using Comet/Bayeux.')); + return true; + } } -- cgit v1.2.3-54-g00ecf From dfa164069d2dd69c49d1d7eb4182bfffd86329d4 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 19:46:01 +0200 Subject: Superfluous whitespace removed. --- plugins/Blacklist/BlacklistPlugin.php | 1 - plugins/ClientSideShorten/shorten.php | 1 - 2 files changed, 2 deletions(-) (limited to 'plugins') diff --git a/plugins/Blacklist/BlacklistPlugin.php b/plugins/Blacklist/BlacklistPlugin.php index bc8b82492..10f89ef72 100644 --- a/plugins/Blacklist/BlacklistPlugin.php +++ b/plugins/Blacklist/BlacklistPlugin.php @@ -348,7 +348,6 @@ class BlacklistPlugin extends Plugin * * @return boolean hook value */ - function onAdminPanelCheck($name, &$isOK) { if ($name == 'blacklist') { diff --git a/plugins/ClientSideShorten/shorten.php b/plugins/ClientSideShorten/shorten.php index 8c2fc1b3c..53c2cf5d1 100644 --- a/plugins/ClientSideShorten/shorten.php +++ b/plugins/ClientSideShorten/shorten.php @@ -41,7 +41,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ShortenAction extends Action { private $text; -- cgit v1.2.3-54-g00ecf From 96794672012bcbfa9a2e5613f8d176846ec7d1b3 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 19:59:13 +0200 Subject: Add onPluginVersion() --- plugins/DiskCache/DiskCachePlugin.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/DiskCache/DiskCachePlugin.php b/plugins/DiskCache/DiskCachePlugin.php index b709ea3b3..47d4b153c 100644 --- a/plugins/DiskCache/DiskCachePlugin.php +++ b/plugins/DiskCache/DiskCachePlugin.php @@ -164,5 +164,15 @@ class DiskCachePlugin extends Plugin Event::handle('EndCacheDelete', array($key)); return false; } -} + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'DiskCache', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:DiskCache', + 'rawdescription' => + _m('Plugin to implement cache interface with disk files.')); + return true; + } +} -- cgit v1.2.3-54-g00ecf From b4887a075696b022e699da393613a8d39741f16b Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 20:00:33 +0200 Subject: Add FIXME for bad message implementation. --- plugins/Disqus/DisqusPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/Disqus/DisqusPlugin.php b/plugins/Disqus/DisqusPlugin.php index c07eaaabd..681be19dc 100644 --- a/plugins/Disqus/DisqusPlugin.php +++ b/plugins/Disqus/DisqusPlugin.php @@ -68,7 +68,6 @@ if (!defined('STATUSNET')) { * * @see Event */ - class DisqusPlugin extends Plugin { function onEndShowContentBlock($action) @@ -106,6 +105,7 @@ ENDOFSCRIPT; $action->elementStart('div', $attrs); $action->elementStart('noscript'); + // @todo FIXME: No i18n yet, because of bad implementation. Should be one string. $action->raw('Please enable JavaScript to view the '); $noscriptUrl = 'http://disqus.com/?ref_noscript=' . $this->shortname; $action->element('a', array('href' => $noscriptUrl), 'comments powered by Disqus.'); -- cgit v1.2.3-54-g00ecf From c0bc3b3042b5964c958d93c53270511674ac95c9 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 20:39:28 +0200 Subject: Superfluous whitespace removed. --- plugins/Echo/EchoPlugin.php | 1 - plugins/EmailAuthentication/EmailAuthenticationPlugin.php | 2 -- 2 files changed, 3 deletions(-) (limited to 'plugins') diff --git a/plugins/Echo/EchoPlugin.php b/plugins/Echo/EchoPlugin.php index 7b51866eb..cd8d8c0e7 100644 --- a/plugins/Echo/EchoPlugin.php +++ b/plugins/Echo/EchoPlugin.php @@ -65,7 +65,6 @@ if (!defined('STATUSNET')) { * * @see Event */ - class EchoPlugin extends Plugin { // NOTE: The Echo documentation says that this script will change on diff --git a/plugins/EmailAuthentication/EmailAuthenticationPlugin.php b/plugins/EmailAuthentication/EmailAuthenticationPlugin.php index 4c018537b..689d6231d 100644 --- a/plugins/EmailAuthentication/EmailAuthenticationPlugin.php +++ b/plugins/EmailAuthentication/EmailAuthenticationPlugin.php @@ -34,7 +34,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { class EmailAuthenticationPlugin extends Plugin { //---interface implementation---// - function onStartCheckPassword($nickname, $password, &$authenticatedUser) { if(strpos($nickname, '@')) @@ -62,4 +61,3 @@ class EmailAuthenticationPlugin extends Plugin return true; } } - -- cgit v1.2.3-54-g00ecf From e0952bf56bea07f0a1ef1ec26803594cd7f97fdd Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 20:40:55 +0200 Subject: Superfluous whitespace removed. --- plugins/Enjit/enjitqueuehandler.php | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins') diff --git a/plugins/Enjit/enjitqueuehandler.php b/plugins/Enjit/enjitqueuehandler.php index 14085cc5e..56fc396d1 100644 --- a/plugins/Enjit/enjitqueuehandler.php +++ b/plugins/Enjit/enjitqueuehandler.php @@ -80,5 +80,4 @@ class EnjitQueueHandler extends QueueHandler return $response->isOk(); } - } -- cgit v1.2.3-54-g00ecf From 2475e25e7850d203e90c5f188e80580d41e60a48 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 20 Sep 2010 11:49:39 -0700 Subject: Update DirectionDetector plugin to 0.2.0 from everplays --- .../DirectionDetector/DirectionDetectorPlugin.php | 85 +++++++++++++--------- .../DirectionDetector/jquery.DirectionDetector.js | 61 ++++++++++++++++ 2 files changed, 113 insertions(+), 33 deletions(-) create mode 100644 plugins/DirectionDetector/jquery.DirectionDetector.js (limited to 'plugins') diff --git a/plugins/DirectionDetector/DirectionDetectorPlugin.php b/plugins/DirectionDetector/DirectionDetectorPlugin.php index b1362b166..2a85725e3 100644 --- a/plugins/DirectionDetector/DirectionDetectorPlugin.php +++ b/plugins/DirectionDetector/DirectionDetectorPlugin.php @@ -1,4 +1,5 @@ + * @author Behrooz shabani (everplays) - * @copyright 2009-2010 Behrooz shabani * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * */ if (!defined('STATUSNET')) { - exit(1); + exit(1); } -define('DIRECTIONDETECTORPLUGIN_VERSION', '0.1.2'); +define('DIRECTIONDETECTORPLUGIN_VERSION', '0.2.0'); class DirectionDetectorPlugin extends Plugin { /** * SN plugin API, here we will make changes on rendered column - * - * @param object $notice notice is going to be saved */ public function onStartNoticeSave(&$notice){ if(!preg_match('//', $notice->rendered) && self::isRTL($notice->content)) @@ -44,32 +43,48 @@ class DirectionDetectorPlugin extends Plugin { /** * SN plugin API, here we will add css needed for modifiyed rendered - * - * @param */ - public function onEndShowStatusNetStyles($xml){ - $xml->element('style', array('type' => 'text/css'), 'span.rtl {display:block;direction:rtl;text-align:right;float:right;width:490px;} .notice .author {float:left}'); + public function onEndShowStatusNetStyles(&$xml){ + $xml->element('style', array('type' => 'text/css'), 'span.rtl {display:block;direction:rtl;text-align:right;float:right;} .notice .author {float:left}'); + } + + /** + * is passed string a rtl content or not + */ + public static function isRTL($content){ + self::getClearText($content); + $words = explode(' ', $content); + $rtl = 0; + foreach($words as &$str) + if(self::startsWithRTLCharacter($str)) + $rtl++; + else + $rtl--; + if($rtl>0)// if number of rtl words is more than ltr words so it's a rtl content + return true; + elseif($rtl==0) + // check first word again + return self::startsWithRTLCharacter($words[0]); + return false; } + /** - * checks that passed string is a RTL language or not - * - * @param string $str String to be checked + * checks that passed string starts with a RTL language or not */ - public static function isRTL($str){ - self::getClearText($str); + public static function startsWithRTLCharacter(&$str){ if( is_array($cc = self::utf8ToUnicode(mb_substr($str, 0, 1, 'utf-8'))) ) $cc = $cc[0]; else return false; - if($cc>=1536 && $cc<=1791) // Arabic, Persian, Urdu, Kurdish, ... + if($cc>=1536 && $cc<=1791) // arabic, persian, urdu, kurdish, ... return true; - if($cc>=65136 && $cc<=65279) // Arabic peresent 2 + if($cc>=65136 && $cc<=65279) // arabic peresent 2 return true; - if($cc>=64336 && $cc<=65023) // Arabic peresent 1 + if($cc>=64336 && $cc<=65023) // arabic peresent 1 return true; - if($cc>=1424 && $cc<=1535) // Hebrew + if($cc>=1424 && $cc<=1535) // hebrew return true; - if($cc>=64256 && $cc<=64335) // Hebrew peresent + if($cc>=64256 && $cc<=64335) // hebrew peresent return true; if($cc>=1792 && $cc<=1871) // Syriac return true; @@ -83,25 +98,30 @@ class DirectionDetectorPlugin extends Plugin { } /** - * clears text from replies, tags, groups, repeats & whitespaces - * - * @param string &$str string to be cleared + * clears text from replys, tags, groups, reteets & whitespaces */ private static function getClearText(&$str){ $str = preg_replace('/@[^ ]+|![^ ]+|#[^ ]+/u', '', $str); // reply, tag, group $str = preg_replace('/^RT[: ]{1}| RT | RT: |^RD[: ]{1}| RD | RD: |[♺♻:]/u', '', $str); // redent, retweet $str = preg_replace("/[ \r\t\n]+/", ' ', trim($str)); // remove spaces } + + /** + * adds javascript to do same thing on input textarea + */ + function onEndShowScripts($action){ + if (common_logged_in()) { + $action->script('plugins/DirectionDetector/jquery.DirectionDetector.js'); + } + } /** - * Takes a UTF-8 string and returns an array of ints representing the - * Unicode characters. Astral planes are supported i.e. the ints in the - * output can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates - * are not allowed. ### modified ### returns first character code - * - * Returns false if the input string isn't a valid UTF-8 octet sequence. + * Takes an UTF-8 string and returns an array of ints representing the + * Unicode characters. Astral planes are supported ie. the ints in the + * output can be > 0xFFFF. O$ccurrances of the BOM are ignored. Surrogates + * are not allowed. */ - private static function utf8ToUnicode($str){ + private static function utf8ToUnicode(&$str){ $mState = 0; // cached expected number of octets after the current octet // until the beginning of the next UTF8 character sequence $mUcs4 = 0; // cached Unicode character @@ -199,7 +219,7 @@ class DirectionDetectorPlugin extends Plugin { } } else { /* ((0xC0 & (*in) != 0x80) && (mState != 0)) - * + * * Incomplete multi-octet sequence. */ return false; @@ -216,9 +236,8 @@ class DirectionDetectorPlugin extends Plugin { $versions[] = array( 'name' => 'Direction detector', 'version' => DIRECTIONDETECTORPLUGIN_VERSION, - 'author' => 'Behrooz Shabani', - // TRANS: Direction detector plugin description. - 'rawdescription' => _m('Shows notices with right-to-left content in correct direction.') + 'author' => 'behrooz shabani', + 'rawdescription' => _m('shows notices with right-to-left content in correct direction.') ); return true; } diff --git a/plugins/DirectionDetector/jquery.DirectionDetector.js b/plugins/DirectionDetector/jquery.DirectionDetector.js new file mode 100644 index 000000000..6808bcabd --- /dev/null +++ b/plugins/DirectionDetector/jquery.DirectionDetector.js @@ -0,0 +1,61 @@ + +/** + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * @category Plugin + * @package StatusNet + * @author Behrooz shabani (everplays) - + * @copyright 2009-2010 Behrooz shabani + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * + */ + +(function($){ + $.fn.isRTL = function(str){ + if(typeof str != typeof "" || str.length<1) + return false; + var cc = str.charCodeAt(0); + if(cc>=1536 && cc<=1791) // arabic, persian, ... + return true; + if(cc>=65136 && cc<=65279) // arabic peresent 2 + return true; + if(cc>=64336 && cc<=65023) // arabic peresent 1 + return true; + if(cc>=1424 && cc<=1535) // hebrew + return true; + if(cc>=64256 && cc<=64335) // hebrew peresent + return true; + if(cc>=1792 && cc<=1871) // Syriac + return true; + if(cc>=1920 && cc<=1983) // Thaana + return true; + if(cc>=1984 && cc<=2047) // NKo + return true; + if(cc>=11568 && cc<=11647) // Tifinagh + return true; + return false; + }; + $(document).ready(function(){ + var tArea = $("#notice_data-text"); + var tCleaner = new RegExp('@[^ ]+|![^ ]+|#[^ ]+|^RT[: ]{1}| RT | RT: |^RD[: ]{1}| RD | RD: |[♺♻:]+', 'g') + tArea.keyup(function(){ + var cleaned = tArea.val().replace(tCleaner, '').replace(/^[ ]+/, ''); + if($().isRTL(cleaned)) + tArea.css('direction', 'rtl'); + else + tArea.css('direction', 'ltr'); + }); + }); +})(jQuery); -- cgit v1.2.3-54-g00ecf From 500f8e5a8727bc09e0b935813482881a468af10b Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 20:54:30 +0200 Subject: * i18n/L10n updates. * remove superfluous whitespace. --- plugins/FirePHP/FirePHPPlugin.php | 1 - plugins/GeoURL/GeoURLPlugin.php | 3 --- plugins/Geonames/GeonamesPlugin.php | 7 ----- plugins/Gravatar/GravatarPlugin.php | 1 - plugins/Imap/imapmanager.php | 2 +- plugins/LdapCommon/LdapCommon.php | 22 +++++++--------- plugins/LdapCommon/MemcacheSchemaCache.php | 42 +++++++++++++++--------------- plugins/LilUrl/LilUrlPlugin.php | 3 +-- plugins/Linkback/LinkbackPlugin.php | 2 -- plugins/Memcache/MemcachePlugin.php | 7 ----- 10 files changed, 32 insertions(+), 58 deletions(-) (limited to 'plugins') diff --git a/plugins/FirePHP/FirePHPPlugin.php b/plugins/FirePHP/FirePHPPlugin.php index d984ec1af..27f760c81 100644 --- a/plugins/FirePHP/FirePHPPlugin.php +++ b/plugins/FirePHP/FirePHPPlugin.php @@ -69,4 +69,3 @@ class FirePHPPlugin extends Plugin return true; } } - diff --git a/plugins/GeoURL/GeoURLPlugin.php b/plugins/GeoURL/GeoURLPlugin.php index 01178f39c..91da81a5a 100644 --- a/plugins/GeoURL/GeoURLPlugin.php +++ b/plugins/GeoURL/GeoURLPlugin.php @@ -46,7 +46,6 @@ if (!defined('STATUSNET')) { * * @seeAlso Location */ - class GeoURLPlugin extends Plugin { public $ping = 'http://geourl.org/ping/'; @@ -58,7 +57,6 @@ class GeoURLPlugin extends Plugin * * @return boolean event handler flag */ - function onEndShowHeadElements($action) { $name = $action->trimmed('action'); @@ -94,7 +92,6 @@ class GeoURLPlugin extends Plugin * * @return boolean event handler flag */ - function onHandleQueuedNotice(&$notice) { if ($notice->is_local == 1) { diff --git a/plugins/Geonames/GeonamesPlugin.php b/plugins/Geonames/GeonamesPlugin.php index 3815a31fa..310641ce6 100644 --- a/plugins/Geonames/GeonamesPlugin.php +++ b/plugins/Geonames/GeonamesPlugin.php @@ -46,7 +46,6 @@ if (!defined('STATUSNET')) { * * @seeAlso Location */ - class GeonamesPlugin extends Plugin { const LOCATION_NS = 1; @@ -71,7 +70,6 @@ class GeonamesPlugin extends Plugin * * @return boolean whether to continue (results in $location) */ - function onLocationFromName($name, $language, &$location) { $loc = $this->getCache(array('name' => $name, @@ -129,7 +127,6 @@ class GeonamesPlugin extends Plugin * * @return boolean whether to continue (results in $location) */ - function onLocationFromId($id, $ns, $language, &$location) { if ($ns != self::LOCATION_NS) { @@ -198,7 +195,6 @@ class GeonamesPlugin extends Plugin * * @return boolean whether to continue (results in $location) */ - function onLocationFromLatLon($lat, $lon, $language, &$location) { // Make sure they're canonical @@ -276,7 +272,6 @@ class GeonamesPlugin extends Plugin * * @return boolean whether to continue */ - function onLocationNameLanguage($location, $language, &$name) { if ($location->location_ns != self::LOCATION_NS) { @@ -344,7 +339,6 @@ class GeonamesPlugin extends Plugin * * @return boolean whether to continue */ - function onLocationUrl($location, &$url) { if ($location->location_ns != self::LOCATION_NS) { @@ -368,7 +362,6 @@ class GeonamesPlugin extends Plugin * * @return boolean whether to continue */ - function onLocationRdfUrl($location, &$url) { if ($location->location_ns != self::LOCATION_NS) { diff --git a/plugins/Gravatar/GravatarPlugin.php b/plugins/Gravatar/GravatarPlugin.php index e4782cb9f..dd8ff7217 100644 --- a/plugins/Gravatar/GravatarPlugin.php +++ b/plugins/Gravatar/GravatarPlugin.php @@ -132,7 +132,6 @@ class GravatarPlugin extends Plugin return false; } - function gravatar_save() { $cur = common_current_user(); diff --git a/plugins/Imap/imapmanager.php b/plugins/Imap/imapmanager.php index 68b8b7d87..e2f8c6d54 100644 --- a/plugins/Imap/imapmanager.php +++ b/plugins/Imap/imapmanager.php @@ -44,7 +44,7 @@ class ImapManager extends IoManager */ public static function get() { - throw new Exception('ImapManager should be created using it\'s constructor, not the static get method'); + throw new Exception(_m('ImapManager should be created using its constructor, not the using the static get method.')); } /** diff --git a/plugins/LdapCommon/LdapCommon.php b/plugins/LdapCommon/LdapCommon.php index 1f1647a75..7dea1f0ed 100644 --- a/plugins/LdapCommon/LdapCommon.php +++ b/plugins/LdapCommon/LdapCommon.php @@ -60,13 +60,13 @@ class LdapCommon $this->ldap_config = $this->get_ldap_config(); if(!isset($this->host)){ - throw new Exception("must specify a host"); + throw new Exception(_m("A host must be specified.")); } if(!isset($this->basedn)){ - throw new Exception("must specify a basedn"); + throw new Exception(_m('"basedn" must be specified.')); } if(!isset($this->attributes['username'])){ - throw new Exception("username attribute must be set."); + throw new Exception(_m('The username attribute must be set.')); } } @@ -173,7 +173,7 @@ class LdapCommon $ldap = $this->get_ldap_connection($config); $entry = $this->get_user($username,array(),$ldap); - + $newCryptedPassword = $this->hashPassword($newpassword, $this->password_encoding); if ($newCryptedPassword===false) { return false; @@ -254,15 +254,14 @@ class LdapCommon * @return string The hashed password. * */ - - function hashPassword( $passwordClear, $encodageType ) + function hashPassword( $passwordClear, $encodageType ) { $encodageType = strtolower( $encodageType ); switch( $encodageType ) { - case 'crypt': - $cryptedPassword = '{CRYPT}' . crypt($passwordClear,$this->randomSalt(2)); + case 'crypt': + $cryptedPassword = '{CRYPT}' . crypt($passwordClear,$this->randomSalt(2)); break; - + case 'ext_des': // extended des crypt. see OpenBSD crypt man page. if ( ! defined( 'CRYPT_EXT_DES' ) || CRYPT_EXT_DES == 0 ) {return FALSE;} //Your system crypt library does not support extended DES encryption. @@ -345,8 +344,7 @@ class LdapCommon * @param int $length The length of the salt string to generate. * @return string The generated salt string. */ - - function randomSalt( $length ) + function randomSalt( $length ) { $possible = '0123456789'. 'abcdefghijklmnopqrstuvwxyz'. @@ -360,10 +358,8 @@ class LdapCommon return $str; } - } class LdapInvalidCredentialsException extends Exception { - } diff --git a/plugins/LdapCommon/MemcacheSchemaCache.php b/plugins/LdapCommon/MemcacheSchemaCache.php index 4ee2e8e16..960164fd3 100644 --- a/plugins/LdapCommon/MemcacheSchemaCache.php +++ b/plugins/LdapCommon/MemcacheSchemaCache.php @@ -1,5 +1,5 @@ c = $cfg['c']; @@ -57,18 +57,18 @@ class MemcacheSchemaCache implements Net_LDAP2_SchemaCache } /** - * Store a schema object in the cache - * - * This method will be called, if Net_LDAP2 has fetched a fresh - * schema object from LDAP and wants to init or refresh the cache. - * - * To invalidate the cache and cause Net_LDAP2 to refresh the cache, - * you can call this method with null or false as value. - * The next call to $ldap->schema() will then refresh the caches object. - * - * @param mixed $schema The object that should be cached - * @return true|Net_LDAP2_Error|false - */ + * Store a schema object in the cache + * + * This method will be called, if Net_LDAP2 has fetched a fresh + * schema object from LDAP and wants to init or refresh the cache. + * + * To invalidate the cache and cause Net_LDAP2 to refresh the cache, + * you can call this method with null or false as value. + * The next call to $ldap->schema() will then refresh the caches object. + * + * @param mixed $schema The object that should be cached + * @return true|Net_LDAP2_Error|false + */ public function storeSchema($schema) { return $this->c->set($this->cacheKey, $schema); } diff --git a/plugins/LilUrl/LilUrlPlugin.php b/plugins/LilUrl/LilUrlPlugin.php index 1c3d6f84b..bd98026fe 100644 --- a/plugins/LilUrl/LilUrlPlugin.php +++ b/plugins/LilUrl/LilUrlPlugin.php @@ -40,7 +40,7 @@ class LilUrlPlugin extends UrlShortenerPlugin function onInitializePlugin(){ parent::onInitializePlugin(); if(!isset($this->serviceUrl)){ - throw new Exception("must specify a serviceUrl"); + throw new Exception(_m('A serviceUrl must be specified.')); } } @@ -71,4 +71,3 @@ class LilUrlPlugin extends UrlShortenerPlugin return true; } } - diff --git a/plugins/Linkback/LinkbackPlugin.php b/plugins/Linkback/LinkbackPlugin.php index 8e44beae1..797572d7f 100644 --- a/plugins/Linkback/LinkbackPlugin.php +++ b/plugins/Linkback/LinkbackPlugin.php @@ -49,7 +49,6 @@ define('LINKBACKPLUGIN_VERSION', '0.1'); * * @see Event */ - class LinkbackPlugin extends Plugin { var $notice = null; @@ -154,7 +153,6 @@ class LinkbackPlugin extends Plugin // Largely cadged from trackback_cls.php by // Ran Aroussi , GPL2 or any later version // http://phptrackback.sourceforge.net/ - function getTrackback($text, $url) { if (preg_match_all('/()/sm', $text, $match, PREG_SET_ORDER)) { diff --git a/plugins/Memcache/MemcachePlugin.php b/plugins/Memcache/MemcachePlugin.php index c3ca5c135..f0c473c31 100644 --- a/plugins/Memcache/MemcachePlugin.php +++ b/plugins/Memcache/MemcachePlugin.php @@ -48,7 +48,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class MemcachePlugin extends Plugin { static $cacheInitialized = false; @@ -70,7 +69,6 @@ class MemcachePlugin extends Plugin * * @return boolean flag value */ - function onInitializePlugin() { if (self::$cacheInitialized) { @@ -101,7 +99,6 @@ class MemcachePlugin extends Plugin * * @return boolean hook success */ - function onStartCacheGet(&$key, &$value) { $this->_ensureConn(); @@ -121,7 +118,6 @@ class MemcachePlugin extends Plugin * * @return boolean hook success */ - function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) { $this->_ensureConn(); @@ -160,7 +156,6 @@ class MemcachePlugin extends Plugin * * @return boolean hook success */ - function onStartCacheDelete(&$key, &$success) { $this->_ensureConn(); @@ -194,7 +189,6 @@ class MemcachePlugin extends Plugin * * @return void */ - private function _ensureConn() { if (empty($this->_conn)) { @@ -253,4 +247,3 @@ class MemcachePlugin extends Plugin return true; } } - -- cgit v1.2.3-54-g00ecf From d055b63187b262682c10d18b361b7e828948cad9 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 20 Sep 2010 12:00:39 -0700 Subject: DirectionDetector plugin: cleanup on reference usage & code comments. Changed getClearText() to return its value instead of changing the input to keep things clearer to maintainers. --- .../DirectionDetector/DirectionDetectorPlugin.php | 37 ++++++++++++++++------ 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/DirectionDetector/DirectionDetectorPlugin.php b/plugins/DirectionDetector/DirectionDetectorPlugin.php index 2a85725e3..26eb89696 100644 --- a/plugins/DirectionDetector/DirectionDetectorPlugin.php +++ b/plugins/DirectionDetector/DirectionDetectorPlugin.php @@ -34,8 +34,10 @@ define('DIRECTIONDETECTORPLUGIN_VERSION', '0.2.0'); class DirectionDetectorPlugin extends Plugin { /** * SN plugin API, here we will make changes on rendered column + * + * @param object $notice notice is going to be saved */ - public function onStartNoticeSave(&$notice){ + public function onStartNoticeSave($notice){ if(!preg_match('//', $notice->rendered) && self::isRTL($notice->content)) $notice->rendered = ''.$notice->rendered.''; return true; @@ -43,19 +45,24 @@ class DirectionDetectorPlugin extends Plugin { /** * SN plugin API, here we will add css needed for modifiyed rendered + * + * @param Action $xml */ - public function onEndShowStatusNetStyles(&$xml){ + public function onEndShowStatusNetStyles($xml){ $xml->element('style', array('type' => 'text/css'), 'span.rtl {display:block;direction:rtl;text-align:right;float:right;} .notice .author {float:left}'); } /** * is passed string a rtl content or not + * + * @param string $content + * @return boolean */ public static function isRTL($content){ - self::getClearText($content); + $content = self::getClearText($content); $words = explode(' ', $content); $rtl = 0; - foreach($words as &$str) + foreach($words as $str) if(self::startsWithRTLCharacter($str)) $rtl++; else @@ -70,8 +77,11 @@ class DirectionDetectorPlugin extends Plugin { /** * checks that passed string starts with a RTL language or not + * + * @param string $str + * @return boolean */ - public static function startsWithRTLCharacter(&$str){ + public static function startsWithRTLCharacter($str){ if( is_array($cc = self::utf8ToUnicode(mb_substr($str, 0, 1, 'utf-8'))) ) $cc = $cc[0]; else @@ -99,15 +109,21 @@ class DirectionDetectorPlugin extends Plugin { /** * clears text from replys, tags, groups, reteets & whitespaces + * + * @param string $str + * @return string */ - private static function getClearText(&$str){ + private static function getClearText($str){ $str = preg_replace('/@[^ ]+|![^ ]+|#[^ ]+/u', '', $str); // reply, tag, group $str = preg_replace('/^RT[: ]{1}| RT | RT: |^RD[: ]{1}| RD | RD: |[♺♻:]/u', '', $str); // redent, retweet $str = preg_replace("/[ \r\t\n]+/", ' ', trim($str)); // remove spaces + return $str; } /** * adds javascript to do same thing on input textarea + * + * @param Action $action */ function onEndShowScripts($action){ if (common_logged_in()) { @@ -120,8 +136,11 @@ class DirectionDetectorPlugin extends Plugin { * Unicode characters. Astral planes are supported ie. the ints in the * output can be > 0xFFFF. O$ccurrances of the BOM are ignored. Surrogates * are not allowed. + * + * @param string $str + * @return mixed array of ints, or false on invalid input */ - private static function utf8ToUnicode(&$str){ + private static function utf8ToUnicode($str){ $mState = 0; // cached expected number of octets after the current octet // until the beginning of the next UTF8 character sequence $mUcs4 = 0; // cached Unicode character @@ -236,8 +255,8 @@ class DirectionDetectorPlugin extends Plugin { $versions[] = array( 'name' => 'Direction detector', 'version' => DIRECTIONDETECTORPLUGIN_VERSION, - 'author' => 'behrooz shabani', - 'rawdescription' => _m('shows notices with right-to-left content in correct direction.') + 'author' => 'Behrooz Shabani', + 'rawdescription' => _m('Shows notices with right-to-left content in correct direction.') ); return true; } -- cgit v1.2.3-54-g00ecf From a3de417ca54c1cc1a99b25880e944335c43bbdc2 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 20 Sep 2010 12:02:04 -0700 Subject: DirectionDetector plugin: tabs to spaces --- .../DirectionDetector/DirectionDetectorPlugin.php | 410 ++++++++++----------- 1 file changed, 205 insertions(+), 205 deletions(-) (limited to 'plugins') diff --git a/plugins/DirectionDetector/DirectionDetectorPlugin.php b/plugins/DirectionDetector/DirectionDetectorPlugin.php index 26eb89696..ac6b43c1f 100644 --- a/plugins/DirectionDetector/DirectionDetectorPlugin.php +++ b/plugins/DirectionDetector/DirectionDetectorPlugin.php @@ -26,240 +26,240 @@ */ if (!defined('STATUSNET')) { - exit(1); + exit(1); } define('DIRECTIONDETECTORPLUGIN_VERSION', '0.2.0'); class DirectionDetectorPlugin extends Plugin { - /** - * SN plugin API, here we will make changes on rendered column + /** + * SN plugin API, here we will make changes on rendered column * * @param object $notice notice is going to be saved - */ - public function onStartNoticeSave($notice){ - if(!preg_match('//', $notice->rendered) && self::isRTL($notice->content)) - $notice->rendered = ''.$notice->rendered.''; - return true; - } + */ + public function onStartNoticeSave($notice){ + if(!preg_match('//', $notice->rendered) && self::isRTL($notice->content)) + $notice->rendered = ''.$notice->rendered.''; + return true; + } - /** - * SN plugin API, here we will add css needed for modifiyed rendered + /** + * SN plugin API, here we will add css needed for modifiyed rendered * * @param Action $xml - */ - public function onEndShowStatusNetStyles($xml){ - $xml->element('style', array('type' => 'text/css'), 'span.rtl {display:block;direction:rtl;text-align:right;float:right;} .notice .author {float:left}'); - } - - /** - * is passed string a rtl content or not + */ + public function onEndShowStatusNetStyles($xml){ + $xml->element('style', array('type' => 'text/css'), 'span.rtl {display:block;direction:rtl;text-align:right;float:right;} .notice .author {float:left}'); + } + + /** + * is passed string a rtl content or not * * @param string $content * @return boolean - */ - public static function isRTL($content){ - $content = self::getClearText($content); - $words = explode(' ', $content); - $rtl = 0; - foreach($words as $str) - if(self::startsWithRTLCharacter($str)) - $rtl++; - else - $rtl--; - if($rtl>0)// if number of rtl words is more than ltr words so it's a rtl content - return true; - elseif($rtl==0) - // check first word again - return self::startsWithRTLCharacter($words[0]); - return false; - } - - /** - * checks that passed string starts with a RTL language or not + */ + public static function isRTL($content){ + $content = self::getClearText($content); + $words = explode(' ', $content); + $rtl = 0; + foreach($words as $str) + if(self::startsWithRTLCharacter($str)) + $rtl++; + else + $rtl--; + if($rtl>0)// if number of rtl words is more than ltr words so it's a rtl content + return true; + elseif($rtl==0) + // check first word again + return self::startsWithRTLCharacter($words[0]); + return false; + } + + /** + * checks that passed string starts with a RTL language or not * * @param string $str * @return boolean - */ - public static function startsWithRTLCharacter($str){ - if( is_array($cc = self::utf8ToUnicode(mb_substr($str, 0, 1, 'utf-8'))) ) - $cc = $cc[0]; - else - return false; - if($cc>=1536 && $cc<=1791) // arabic, persian, urdu, kurdish, ... - return true; - if($cc>=65136 && $cc<=65279) // arabic peresent 2 - return true; - if($cc>=64336 && $cc<=65023) // arabic peresent 1 - return true; - if($cc>=1424 && $cc<=1535) // hebrew - return true; - if($cc>=64256 && $cc<=64335) // hebrew peresent - return true; - if($cc>=1792 && $cc<=1871) // Syriac - return true; - if($cc>=1920 && $cc<=1983) // Thaana - return true; - if($cc>=1984 && $cc<=2047) // NKo - return true; - if($cc>=11568 && $cc<=11647) // Tifinagh - return true; - return false; - } + */ + public static function startsWithRTLCharacter($str){ + if( is_array($cc = self::utf8ToUnicode(mb_substr($str, 0, 1, 'utf-8'))) ) + $cc = $cc[0]; + else + return false; + if($cc>=1536 && $cc<=1791) // arabic, persian, urdu, kurdish, ... + return true; + if($cc>=65136 && $cc<=65279) // arabic peresent 2 + return true; + if($cc>=64336 && $cc<=65023) // arabic peresent 1 + return true; + if($cc>=1424 && $cc<=1535) // hebrew + return true; + if($cc>=64256 && $cc<=64335) // hebrew peresent + return true; + if($cc>=1792 && $cc<=1871) // Syriac + return true; + if($cc>=1920 && $cc<=1983) // Thaana + return true; + if($cc>=1984 && $cc<=2047) // NKo + return true; + if($cc>=11568 && $cc<=11647) // Tifinagh + return true; + return false; + } - /** - * clears text from replys, tags, groups, reteets & whitespaces + /** + * clears text from replys, tags, groups, reteets & whitespaces * * @param string $str * @return string - */ - private static function getClearText($str){ - $str = preg_replace('/@[^ ]+|![^ ]+|#[^ ]+/u', '', $str); // reply, tag, group - $str = preg_replace('/^RT[: ]{1}| RT | RT: |^RD[: ]{1}| RD | RD: |[♺♻:]/u', '', $str); // redent, retweet - $str = preg_replace("/[ \r\t\n]+/", ' ', trim($str)); // remove spaces + */ + private static function getClearText($str){ + $str = preg_replace('/@[^ ]+|![^ ]+|#[^ ]+/u', '', $str); // reply, tag, group + $str = preg_replace('/^RT[: ]{1}| RT | RT: |^RD[: ]{1}| RD | RD: |[♺♻:]/u', '', $str); // redent, retweet + $str = preg_replace("/[ \r\t\n]+/", ' ', trim($str)); // remove spaces return $str; - } - - /** - * adds javascript to do same thing on input textarea + } + + /** + * adds javascript to do same thing on input textarea * * @param Action $action - */ - function onEndShowScripts($action){ - if (common_logged_in()) { - $action->script('plugins/DirectionDetector/jquery.DirectionDetector.js'); - } - } + */ + function onEndShowScripts($action){ + if (common_logged_in()) { + $action->script('plugins/DirectionDetector/jquery.DirectionDetector.js'); + } + } - /** - * Takes an UTF-8 string and returns an array of ints representing the - * Unicode characters. Astral planes are supported ie. the ints in the - * output can be > 0xFFFF. O$ccurrances of the BOM are ignored. Surrogates - * are not allowed. + /** + * Takes an UTF-8 string and returns an array of ints representing the + * Unicode characters. Astral planes are supported ie. the ints in the + * output can be > 0xFFFF. O$ccurrances of the BOM are ignored. Surrogates + * are not allowed. * * @param string $str * @return mixed array of ints, or false on invalid input - */ - private static function utf8ToUnicode($str){ - $mState = 0; // cached expected number of octets after the current octet - // until the beginning of the next UTF8 character sequence - $mUcs4 = 0; // cached Unicode character - $mBytes = 1; // cached expected number of octets in the current sequence - $out = array(); - $len = strlen($str); + */ + private static function utf8ToUnicode($str){ + $mState = 0; // cached expected number of octets after the current octet + // until the beginning of the next UTF8 character sequence + $mUcs4 = 0; // cached Unicode character + $mBytes = 1; // cached expected number of octets in the current sequence + $out = array(); + $len = strlen($str); - for($i = 0; $i < $len; $i++) { - $in = ord($str{$i}); - if (0 == $mState) { - // When mState is zero we expect either a US-ASCII character or a - // multi-octet sequence. - if (0 == (0x80 & ($in))) { - // US-ASCII, pass straight through. - $out[] = $in; - $mBytes = 1; - } elseif (0xC0 == (0xE0 & ($in))) { - // First octet of 2 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x1F) << 6; - $mState = 1; - $mBytes = 2; - } elseif (0xE0 == (0xF0 & ($in))) { - // First octet of 3 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x0F) << 12; - $mState = 2; - $mBytes = 3; - } elseif (0xF0 == (0xF8 & ($in))) { - // First octet of 4 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x07) << 18; - $mState = 3; - $mBytes = 4; - } elseif (0xF8 == (0xFC & ($in))) { - /* First octet of 5 octet sequence. - * - * This is illegal because the encoded codepoint must be either - * (a) not the shortest form or - * (b) outside the Unicode range of 0-0x10FFFF. - * Rather than trying to resynchronize, we will carry on until the end - * of the sequence and let the later error handling code catch it. - */ - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x03) << 24; - $mState = 4; - $mBytes = 5; - } elseif (0xFC == (0xFE & ($in))) { - // First octet of 6 octet sequence, see comments for 5 octet sequence. - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 1) << 30; - $mState = 5; - $mBytes = 6; - } else { - /* Current octet is neither in the US-ASCII range nor a legal first - * octet of a multi-octet sequence. - */ - return false; - } - } else { - // When mState is non-zero, we expect a continuation of the multi-octet - // sequence - if (0x80 == (0xC0 & ($in))) { - // Legal continuation. - $shift = ($mState - 1) * 6; - $tmp = $in; - $tmp = ($tmp & 0x0000003F) << $shift; - $mUcs4 |= $tmp; - if (0 == --$mState) { - /* End of the multi-octet sequence. mUcs4 now contains the final - * Unicode codepoint to be output - * - * Check for illegal sequences and codepoints. - */ - // From Unicode 3.1, non-shortest form is illegal - if ( - ((2 == $mBytes) && ($mUcs4 < 0x0080)) || - ((3 == $mBytes) && ($mUcs4 < 0x0800)) || - ((4 == $mBytes) && ($mUcs4 < 0x10000)) || - (4 < $mBytes) || - // From Unicode 3.2, surrogate characters are illegal - (($mUcs4 & 0xFFFFF800) == 0xD800) || - // Codepoints outside the Unicode range are illegal - ($mUcs4 > 0x10FFFF) - ){ - return false; - } - if (0xFEFF != $mUcs4) { - $out[] = $mUcs4; - } - //initialize UTF8 cache - $mState = 0; - $mUcs4 = 0; - $mBytes = 1; - } - } else { - /* ((0xC0 & (*in) != 0x80) && (mState != 0)) - * - * Incomplete multi-octet sequence. - */ - return false; - } - } - } - return $out; - } + for($i = 0; $i < $len; $i++) { + $in = ord($str{$i}); + if (0 == $mState) { + // When mState is zero we expect either a US-ASCII character or a + // multi-octet sequence. + if (0 == (0x80 & ($in))) { + // US-ASCII, pass straight through. + $out[] = $in; + $mBytes = 1; + } elseif (0xC0 == (0xE0 & ($in))) { + // First octet of 2 octet sequence + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 0x1F) << 6; + $mState = 1; + $mBytes = 2; + } elseif (0xE0 == (0xF0 & ($in))) { + // First octet of 3 octet sequence + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 0x0F) << 12; + $mState = 2; + $mBytes = 3; + } elseif (0xF0 == (0xF8 & ($in))) { + // First octet of 4 octet sequence + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 0x07) << 18; + $mState = 3; + $mBytes = 4; + } elseif (0xF8 == (0xFC & ($in))) { + /* First octet of 5 octet sequence. + * + * This is illegal because the encoded codepoint must be either + * (a) not the shortest form or + * (b) outside the Unicode range of 0-0x10FFFF. + * Rather than trying to resynchronize, we will carry on until the end + * of the sequence and let the later error handling code catch it. + */ + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 0x03) << 24; + $mState = 4; + $mBytes = 5; + } elseif (0xFC == (0xFE & ($in))) { + // First octet of 6 octet sequence, see comments for 5 octet sequence. + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 1) << 30; + $mState = 5; + $mBytes = 6; + } else { + /* Current octet is neither in the US-ASCII range nor a legal first + * octet of a multi-octet sequence. + */ + return false; + } + } else { + // When mState is non-zero, we expect a continuation of the multi-octet + // sequence + if (0x80 == (0xC0 & ($in))) { + // Legal continuation. + $shift = ($mState - 1) * 6; + $tmp = $in; + $tmp = ($tmp & 0x0000003F) << $shift; + $mUcs4 |= $tmp; + if (0 == --$mState) { + /* End of the multi-octet sequence. mUcs4 now contains the final + * Unicode codepoint to be output + * + * Check for illegal sequences and codepoints. + */ + // From Unicode 3.1, non-shortest form is illegal + if ( + ((2 == $mBytes) && ($mUcs4 < 0x0080)) || + ((3 == $mBytes) && ($mUcs4 < 0x0800)) || + ((4 == $mBytes) && ($mUcs4 < 0x10000)) || + (4 < $mBytes) || + // From Unicode 3.2, surrogate characters are illegal + (($mUcs4 & 0xFFFFF800) == 0xD800) || + // Codepoints outside the Unicode range are illegal + ($mUcs4 > 0x10FFFF) + ){ + return false; + } + if (0xFEFF != $mUcs4) { + $out[] = $mUcs4; + } + //initialize UTF8 cache + $mState = 0; + $mUcs4 = 0; + $mBytes = 1; + } + } else { + /* ((0xC0 & (*in) != 0x80) && (mState != 0)) + * + * Incomplete multi-octet sequence. + */ + return false; + } + } + } + return $out; + } - /** - * plugin details - */ - function onPluginVersion(&$versions){ - $versions[] = array( - 'name' => 'Direction detector', - 'version' => DIRECTIONDETECTORPLUGIN_VERSION, - 'author' => 'Behrooz Shabani', - 'rawdescription' => _m('Shows notices with right-to-left content in correct direction.') - ); - return true; - } + /** + * plugin details + */ + function onPluginVersion(&$versions){ + $versions[] = array( + 'name' => 'Direction detector', + 'version' => DIRECTIONDETECTORPLUGIN_VERSION, + 'author' => 'Behrooz Shabani', + 'rawdescription' => _m('Shows notices with right-to-left content in correct direction.') + ); + return true; + } } /* -- cgit v1.2.3-54-g00ecf From 5cc08ccd079e026370bcba142328bfaa6b57f14d Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 21:11:05 +0200 Subject: Superfluous whitespace removed. --- plugins/Memcached/MemcachedPlugin.php | 6 ------ plugins/Minify/MinifyPlugin.php | 1 - 2 files changed, 7 deletions(-) (limited to 'plugins') diff --git a/plugins/Memcached/MemcachedPlugin.php b/plugins/Memcached/MemcachedPlugin.php index 77b989b95..3b3383d49 100644 --- a/plugins/Memcached/MemcachedPlugin.php +++ b/plugins/Memcached/MemcachedPlugin.php @@ -69,7 +69,6 @@ class MemcachedPlugin extends Plugin * * @return boolean flag value */ - function onInitializePlugin() { $this->_ensureConn(); @@ -87,7 +86,6 @@ class MemcachedPlugin extends Plugin * * @return boolean hook success */ - function onStartCacheGet(&$key, &$value) { $this->_ensureConn(); @@ -107,7 +105,6 @@ class MemcachedPlugin extends Plugin * * @return boolean hook success */ - function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) { $this->_ensureConn(); @@ -146,7 +143,6 @@ class MemcachedPlugin extends Plugin * * @return boolean hook success */ - function onStartCacheDelete(&$key, &$success) { $this->_ensureConn(); @@ -169,7 +165,6 @@ class MemcachedPlugin extends Plugin * * @return void */ - private function _ensureConn() { if (empty($this->_conn)) { @@ -224,4 +219,3 @@ class MemcachedPlugin extends Plugin return true; } } - diff --git a/plugins/Minify/MinifyPlugin.php b/plugins/Minify/MinifyPlugin.php index 6c1e49eb9..b37531165 100644 --- a/plugins/Minify/MinifyPlugin.php +++ b/plugins/Minify/MinifyPlugin.php @@ -51,7 +51,6 @@ class MinifyPlugin extends Plugin * * @return boolean hook return */ - function onStartInitializeRouter($m) { $m->connect('main/min', -- cgit v1.2.3-54-g00ecf From a58877a2f8b580c47a9b73128dba1f3a7b2c38c4 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 21:12:07 +0200 Subject: * i18n/L10n update. * added onPluginVersion(). * superfluous whitespace removed. --- plugins/Meteor/MeteorPlugin.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/Meteor/MeteorPlugin.php b/plugins/Meteor/MeteorPlugin.php index ec8c9e217..a48c52b56 100644 --- a/plugins/Meteor/MeteorPlugin.php +++ b/plugins/Meteor/MeteorPlugin.php @@ -42,7 +42,6 @@ require_once INSTALLDIR.'/plugins/Realtime/RealtimePlugin.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class MeteorPlugin extends RealtimePlugin { public $webserver = null; @@ -112,7 +111,8 @@ class MeteorPlugin extends RealtimePlugin // May throw an exception. $this->_socket = stream_socket_client("tcp://{$controlserver}:{$this->controlport}", $errno, $errstr, $timeout, $flags); if (!$this->_socket) { - throw new Exception("Couldn't connect to {$controlserver} on {$this->controlport}"); + // TRANS: Exception. %1$s is the control server, %2$s is the control port. + throw new Exception(sprintf(_m('Couldn\'t connect to %1$s on %2$s.'),$controlserver,$this->controlport)); } } @@ -124,7 +124,8 @@ class MeteorPlugin extends RealtimePlugin $cnt = fwrite($this->_socket, $cmd); $result = fgets($this->_socket); if (preg_match('/^ERR (.*)$/', $result, $matches)) { - throw new Exception('Error adding meteor message "'.$matches[1].'"'); + // TRANS: Exception. %s is the Meteor message that could not be added. + throw new Exception(sprintf(_m('Error adding meteor message "%s"'),$matches[1])); } // TODO: parse and deal with result } @@ -146,4 +147,15 @@ class MeteorPlugin extends RealtimePlugin } return implode('-', $path); } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'Meteor', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:Meteor', + 'rawdescription' => + _m('Plugin to do "real time" updates using Comet/Bayeux.')); + return true; + } } -- cgit v1.2.3-54-g00ecf From bccbe8f519d8368ed86d08969d0639e401b46ba7 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 20 Sep 2010 21:12:43 +0200 Subject: * i18n/L10n update. * superfluous whitespace removed. --- plugins/MobileProfile/MobileProfilePlugin.php | 60 +++++++++++---------------- 1 file changed, 24 insertions(+), 36 deletions(-) (limited to 'plugins') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 72a6a04fb..b042bf7ed 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -36,7 +36,6 @@ define('PAGE_TYPE_PREFS_MOBILEPROFILE', require_once INSTALLDIR.'/plugins/Mobile/WAP20Plugin.php'; - /** * Superclass for plugin to output XHTML Mobile Profile * @@ -46,7 +45,6 @@ require_once INSTALLDIR.'/plugins/Mobile/WAP20Plugin.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class MobileProfilePlugin extends WAP20Plugin { public $DTD = null; @@ -60,14 +58,13 @@ class MobileProfilePlugin extends WAP20Plugin parent::__construct(); } - function onStartShowHTML($action) { // XXX: This should probably graduate to WAP20Plugin // If they are on the mobile site, serve them MP if ((common_config('site', 'mobileserver').'/'. - common_config('site', 'path').'/' == + common_config('site', 'path').'/' == $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])) { $this->serveMobile = true; @@ -78,18 +75,18 @@ class MobileProfilePlugin extends WAP20Plugin //if (strstr('application/vnd.wap.xhtml+xml', $type) !== false) { // $this->serveMobile = true; //} else { - // If they are a mobile device that supports WAP 2.0, + // If they are a mobile device that supports WAP 2.0, // serve them MP // XXX: Browser sniffing sucks - // I really don't like going through this every page, + // I really don't like going through this every page, // perhaps use $_SESSION or cookies - // May be better to group the devices in terms of + // May be better to group the devices in terms of // low,mid,high-end - // Or, detect the mobile devices based on their support for + // Or, detect the mobile devices based on their support for // MP 1.0, 1.1, or 1.2 may be ideal. Possible? $this->mobiledevices = array( @@ -165,11 +162,11 @@ class MobileProfilePlugin extends WAP20Plugin } //} - // If they are okay with MP, and the site has a mobile server, + // If they are okay with MP, and the site has a mobile server, // redirect there - if ($this->serveMobile && + if ($this->serveMobile && common_config('site', 'mobileserver') !== false && - (common_config('site', 'mobileserver') != + (common_config('site', 'mobileserver') != common_config('site', 'server'))) { // FIXME: Redirect to equivalent page on mobile site instead @@ -193,8 +190,8 @@ class MobileProfilePlugin extends WAP20Plugin $type = common_negotiate_type($cp, $sp); if (!$type) { - throw new ClientException(_('This page is not available in a '. - 'media type you accept'), 406); + throw new ClientException(_m('This page is not available in a '. + 'media type you accept.'), 406); } //} @@ -217,7 +214,6 @@ class MobileProfilePlugin extends WAP20Plugin return false; } - function setMobileFeatures($useragent) { $mobiledeviceInputFileType = array( @@ -234,7 +230,6 @@ class MobileProfilePlugin extends WAP20Plugin } } - function onStartShowStatusNetStyles($action) { if (!$this->serveMobile) { @@ -262,7 +257,6 @@ class MobileProfilePlugin extends WAP20Plugin return false; } - function onStartShowUAStyles($action) { if (!$this->serveMobile) { return true; @@ -288,18 +282,17 @@ class MobileProfilePlugin extends WAP20Plugin return false; } - function _showLogo($action) { $action->elementStart('address', 'vcard'); $action->elementStart('a', array('class' => 'url home bookmark', 'href' => common_local_url('public'))); - if (common_config('site', 'mobilelogo') || - file_exists(Theme::file('logo.png')) || + if (common_config('site', 'mobilelogo') || + file_exists(Theme::file('logo.png')) || file_exists(Theme::file('mobilelogo.png'))) { $action->element('img', array('class' => 'photo', - 'src' => (common_config('site', 'mobilelogo')) ? common_config('site', 'mobilelogo') : + 'src' => (common_config('site', 'mobilelogo')) ? common_config('site', 'mobilelogo') : ((file_exists(Theme::file('mobilelogo.png'))) ? (Theme::path('mobilelogo.png')) : Theme::path('logo.png')), 'alt' => common_config('site', 'name'))); } @@ -308,44 +301,42 @@ class MobileProfilePlugin extends WAP20Plugin $action->elementEnd('address'); } - function _showPrimaryNav($action) { $user = common_current_user(); $action->elementStart('ul', array('id' => 'site_nav_global_primary')); if ($user) { $action->menuItem(common_local_url('all', array('nickname' => $user->nickname)), - _('Home')); + _m('Home')); $action->menuItem(common_local_url('profilesettings'), - _('Account')); + _m('Account')); $action->menuItem(common_local_url('oauthconnectionssettings'), - _('Connect')); + _m('Connect')); if ($user->hasRight(Right::CONFIGURESITE)) { $action->menuItem(common_local_url('siteadminpanel'), - _('Admin'), _('Change site configuration'), false, 'nav_admin'); + _m('Admin'), _m('Change site configuration'), false, 'nav_admin'); } if (common_config('invite', 'enabled')) { $action->menuItem(common_local_url('invite'), - _('Invite')); + _m('Invite')); } $action->menuItem(common_local_url('logout'), - _('Logout')); + _m('Logout')); } else { if (!common_config('site', 'closed')) { $action->menuItem(common_local_url('register'), - _('Register')); + _m('Register')); } $action->menuItem(common_local_url('login'), - _('Login')); + _m('Login')); } if ($user || !common_config('site', 'private')) { $action->menuItem(common_local_url('peoplesearch'), - _('Search')); + _m('Search')); } $action->elementEnd('ul'); } - function onStartShowNoticeFormData($form) { if (!$this->serveMobile) { @@ -367,11 +358,11 @@ class MobileProfilePlugin extends WAP20Plugin if (common_config('attachments', 'uploads')) { if ($this->mobileFeatures['inputfiletype']) { - $form->out->element('label', array('for' => 'notice_data-attach'), _('Attach')); + $form->out->element('label', array('for' => 'notice_data-attach'), _m('Attach')); $form->out->element('input', array('id' => 'notice_data-attach', 'type' => 'file', 'name' => 'attach', - 'title' => _('Attach a file'))); + 'title' => _m('Attach a file'))); $form->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota')); } } @@ -383,7 +374,6 @@ class MobileProfilePlugin extends WAP20Plugin return false; } - function onStartShowAside($action) { if ($this->serveMobile) { @@ -391,13 +381,11 @@ class MobileProfilePlugin extends WAP20Plugin } } - function onStartShowScripts($action) { } - function _common_path($relative, $ssl=false) { $pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : ''; -- cgit v1.2.3-54-g00ecf From 64cdbe6c5578df1dc49d8e3dd72451ab0ac96bd2 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 20 Sep 2010 13:42:58 -0700 Subject: Ticket #2750: fixes to HTTP caching behavior across login/logout boundaries * now ignoring if-modified-since if we failed an etag if-none-match comparison, per spec * now including a hash of user id/nickname in most etags, so we'll update the view properly after login/logout For API methods, checking the API-auth'ed user. (Many change results to include things like 'you're subscribed to this user' or 'this is one of your favorites', so user info is again needed) There'll still be some last-modified stamps that aren't including user info properly, probably. --- actions/apidirectmessage.php | 1 + actions/apigrouplist.php | 1 + actions/apigrouplistall.php | 1 + actions/apigroupmembership.php | 1 + actions/apigroupshow.php | 1 + actions/apistatusesshow.php | 1 + actions/apisubscriptions.php | 1 + actions/apitimelinefavorites.php | 1 + actions/apitimelinefriends.php | 1 + actions/apitimelinegroup.php | 1 + actions/apitimelinehome.php | 1 + actions/apitimelinementions.php | 1 + actions/apitimelinepublic.php | 1 + actions/apitimelinetag.php | 1 + actions/apitimelineuser.php | 1 + actions/shownotice.php | 1 + lib/action.php | 15 ++++++++++----- lib/util.php | 23 +++++++++++++++++++++++ plugins/Autocomplete/autocomplete.php | 1 + 19 files changed, 50 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/actions/apidirectmessage.php b/actions/apidirectmessage.php index 7a0f46274..e7ea38dfa 100644 --- a/actions/apidirectmessage.php +++ b/actions/apidirectmessage.php @@ -357,6 +357,7 @@ class ApiDirectMessageAction extends ApiAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), strtotime($this->messages[0]->created), strtotime($this->messages[$last]->created) diff --git a/actions/apigrouplist.php b/actions/apigrouplist.php index 148c802f4..319a1e424 100644 --- a/actions/apigrouplist.php +++ b/actions/apigrouplist.php @@ -213,6 +213,7 @@ class ApiGroupListAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->groups[0]->created), diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php index a8317608d..cc7cd901d 100644 --- a/actions/apigrouplistall.php +++ b/actions/apigrouplistall.php @@ -204,6 +204,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), strtotime($this->groups[0]->created), strtotime($this->groups[$last]->created)) diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index ffd5c7c7d..b7f3064b5 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.php @@ -183,6 +183,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->group->id, strtotime($this->profiles[0]->created), diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index 2998e505e..9b90e6b38 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -149,6 +149,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->group->id, strtotime($this->group->modified)) diff --git a/actions/apistatusesshow.php b/actions/apistatusesshow.php index 476820a43..84f8079db 100644 --- a/actions/apistatusesshow.php +++ b/actions/apistatusesshow.php @@ -194,6 +194,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->notice->id, strtotime($this->notice->created)) diff --git a/actions/apisubscriptions.php b/actions/apisubscriptions.php index 63d65f289..749d16f06 100644 --- a/actions/apisubscriptions.php +++ b/actions/apisubscriptions.php @@ -181,6 +181,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, isset($this->ids_only) ? 'IDs' : 'Profiles', diff --git a/actions/apitimelinefavorites.php b/actions/apitimelinefavorites.php index 7228960c0..f5ce5d2fd 100644 --- a/actions/apitimelinefavorites.php +++ b/actions/apitimelinefavorites.php @@ -259,6 +259,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->notices[0]->created), diff --git a/actions/apitimelinefriends.php b/actions/apitimelinefriends.php index 40ce35979..c96391c12 100644 --- a/actions/apitimelinefriends.php +++ b/actions/apitimelinefriends.php @@ -346,6 +346,7 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->notices[0]->created), diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php index 7a40fd808..5138a4b5e 100644 --- a/actions/apitimelinegroup.php +++ b/actions/apitimelinegroup.php @@ -229,6 +229,7 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->group->id, strtotime($this->notices[0]->created), diff --git a/actions/apitimelinehome.php b/actions/apitimelinehome.php index 27eb74169..1ceb3d902 100644 --- a/actions/apitimelinehome.php +++ b/actions/apitimelinehome.php @@ -254,6 +254,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->notices[0]->created), diff --git a/actions/apitimelinementions.php b/actions/apitimelinementions.php index ed1ad20e3..354dc58b6 100644 --- a/actions/apitimelinementions.php +++ b/actions/apitimelinementions.php @@ -244,6 +244,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->notices[0]->created), diff --git a/actions/apitimelinepublic.php b/actions/apitimelinepublic.php index f90164288..0119b504a 100644 --- a/actions/apitimelinepublic.php +++ b/actions/apitimelinepublic.php @@ -311,6 +311,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), strtotime($this->notices[0]->created), strtotime($this->notices[$last]->created)) diff --git a/actions/apitimelinetag.php b/actions/apitimelinetag.php index c7ec172ae..712703694 100644 --- a/actions/apitimelinetag.php +++ b/actions/apitimelinetag.php @@ -232,6 +232,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->tag, strtotime($this->notices[0]->created), diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index 17a283663..0c97aad21 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -234,6 +234,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, strtotime($this->notices[0]->created), diff --git a/actions/shownotice.php b/actions/shownotice.php index 9c5d83441..86df5f9f3 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -151,6 +151,7 @@ class ShownoticeAction extends OwnerDesignAction strtotime($this->avatar->modified) : 0; return 'W/"' . implode(':', array($this->arg('action'), + common_user_cache_hash(), common_language(), $this->notice->id, strtotime($this->notice->created), diff --git a/lib/action.php b/lib/action.php index 5c4b4a7b7..5dcf78dcc 100644 --- a/lib/action.php +++ b/lib/action.php @@ -1018,17 +1018,22 @@ class Action extends HTMLOutputter // lawsuit } } + $checked = false; if ($etag) { $if_none_match = (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER)) ? $_SERVER['HTTP_IF_NONE_MATCH'] : null; - if ($if_none_match && $this->_hasEtag($etag, $if_none_match)) { - header('HTTP/1.1 304 Not Modified'); - // Better way to do this? - exit(0); + if ($if_none_match) { + // If this check fails, ignore the if-modified-since below. + $checked = true; + if ($this->_hasEtag($etag, $if_none_match)) { + header('HTTP/1.1 304 Not Modified'); + // Better way to do this? + exit(0); + } } } - if ($lm && array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) { + if (!$checked && $lm && array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) { $if_modified_since = $_SERVER['HTTP_IF_MODIFIED_SINCE']; $ims = strtotime($if_modified_since); if ($lm <= $ims) { diff --git a/lib/util.php b/lib/util.php index 6d2e99b2a..e0457140e 100644 --- a/lib/util.php +++ b/lib/util.php @@ -494,6 +494,29 @@ function common_is_real_login() return common_logged_in() && $_SESSION['real_login']; } +/** + * Get a hash portion for HTTP caching Etags and such including + * info on the current user's session. If login/logout state changes, + * or we've changed accounts, or we've renamed the current user, + * we'll get a new hash value. + * + * This should not be considered secure information. + * + * @param User $user (optional; uses common_current_user() if left out) + * @return string + */ +function common_user_cache_hash($user=false) +{ + if ($user === false) { + $user = common_current_user(); + } + if ($user) { + return crc32($user->id . ':' . $user->nickname); + } else { + return '0'; + } +} + // get canonical version of nickname for comparison function common_canonical_nickname($nickname) { diff --git a/plugins/Autocomplete/autocomplete.php b/plugins/Autocomplete/autocomplete.php index 5a010572f..a4e2d9baa 100644 --- a/plugins/Autocomplete/autocomplete.php +++ b/plugins/Autocomplete/autocomplete.php @@ -79,6 +79,7 @@ class AutocompleteAction extends Action function etag() { return '"' . implode(':', array($this->arg('action'), + common_user_cache_hash(), crc32($this->arg('q')), //the actual string can have funny characters in we don't want showing up in the etag $this->arg('limit'), $this->lastModified())) . '"'; -- cgit v1.2.3-54-g00ecf From f9e04993dd965ba0bbf812742ee17f900c541be0 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 20 Sep 2010 16:26:50 -0700 Subject: Bump up HTTP timeout for OStatus remote-tests.php to 60 seconds; when running without queues and with only bcmath, salmon key generation is absurdly slow. --- plugins/OStatus/tests/remote-tests.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/OStatus/tests/remote-tests.php b/plugins/OStatus/tests/remote-tests.php index c2c9a5d97..64c60a8a4 100644 --- a/plugins/OStatus/tests/remote-tests.php +++ b/plugins/OStatus/tests/remote-tests.php @@ -4,6 +4,8 @@ if (php_sapi_name() != 'cli') { die('not for web'); } +define('TIMEOUT', 60); // ssslllloowwwww salmon if queues are off + define('INSTALLDIR', dirname(dirname(dirname(dirname(__FILE__))))); set_include_path(INSTALLDIR . '/extlib' . PATH_SEPARATOR . get_include_path()); @@ -188,7 +190,7 @@ class SNTestClient extends TestBase { $url = $this->basepath . '/' . $path; - $http = new HTTP_Request2($url, 'POST'); + $http = new HTTP_Request2($url, 'POST', array('timeout' => TIMEOUT)); if ($auth) { $http->setAuth($this->username, $this->password, HTTP_Request2::AUTH_BASIC); } @@ -215,7 +217,7 @@ class SNTestClient extends TestBase protected function web($path, $form, $params=array()) { $url = $this->basepath . '/' . $path; - $http = new HTTP_Request2($url, 'GET'); + $http = new HTTP_Request2($url, 'GET', array('timeout' => TIMEOUT)); $response = $http->send(); $dom = $this->checkWeb($url, 'GET', $response); -- cgit v1.2.3-54-g00ecf From 8d019c03ee7a2a3a25bfb3f2afa25951eac06428 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Sep 2010 18:04:28 -0400 Subject: Do not allow blank passwords when authenticating against LDAP. --- plugins/LdapCommon/LdapCommon.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins') diff --git a/plugins/LdapCommon/LdapCommon.php b/plugins/LdapCommon/LdapCommon.php index 7dea1f0ed..159b2d265 100644 --- a/plugins/LdapCommon/LdapCommon.php +++ b/plugins/LdapCommon/LdapCommon.php @@ -144,6 +144,12 @@ class LdapCommon if(!$entry){ return false; }else{ + if(empty($password)) { + //NET_LDAP2 will do an anonymous bind if bindpw is not set / empty string + //which causes all login attempts that involve a blank password to appear + //to succeed. Which is obviously not good. + return false; + } $config = $this->get_ldap_config(); $config['binddn']=$entry->dn(); $config['bindpw']=$password; -- cgit v1.2.3-54-g00ecf