Update translator documentation.
i18n/L10n fixes. Whitespace updates.
This commit is contained in:
parent
8ce0acca33
commit
4110266b68
@ -44,7 +44,7 @@ if (!defined('STATUSNET')) {
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
**/
|
||||
*/
|
||||
class LoggingAggregatorAction extends Action
|
||||
{
|
||||
var $challenge = null;
|
||||
@ -82,25 +82,25 @@ class LoggingAggregatorAction extends Action
|
||||
parent::handle($args);
|
||||
|
||||
if (empty($this->url)) {
|
||||
// TRANS: Form validation error displayed when a URL parameter is missing.
|
||||
$this->showError(_m('A URL parameter is required.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($this->challenge)) {
|
||||
|
||||
// must be a GET
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'GET') {
|
||||
// TRANS: Form validation error displayed when HTTP GET is not used.
|
||||
$this->showError(_m('This resource requires an HTTP GET.'));
|
||||
return;
|
||||
}
|
||||
|
||||
header('Content-Type: text/xml');
|
||||
echo $this->challenge;
|
||||
|
||||
} else {
|
||||
|
||||
// must be a POST
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||
// TRANS: Form validation error displayed when HTTP POST is not used.
|
||||
$this->showError(_m('This resource requires an HTTP POST.'));
|
||||
return;
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
This plugin enables RSSCloud (http://rsscloud.org/) publishing and
|
||||
subscription handling for RSS 2.0 profile feeds (i.e:
|
||||
http://SITE/PATH/api/statuses/user_timeline/USERNAME.rss). When the
|
||||
plugin is enabled, StatusNet acts as both the publisher and hub ('writer' and
|
||||
'cloud' in RSSCloud parlance), but only for local StatusNet feeds. It's
|
||||
not possible to use it as a general purpose hub -- for instance you can't
|
||||
subscribe and get updates to a Wordpress feed from StatusNet using this
|
||||
plugin.
|
||||
This plugin enables RSSCloud (http://rsscloud.org/) publishing and subscription
|
||||
handling for RSS 2.0 profile feeds (i.e:
|
||||
http://SITE/PATH/api/statuses/user_timeline/USERNAME.rss). When the plugin is
|
||||
enabled, StatusNet acts as both the publisher and hub ('writer' and 'cloud' in
|
||||
RSSCloud parlance), but only for local StatusNet feeds. It's not possible to use
|
||||
it as a general purpose hub -- for instance you can't subscribe and get updates
|
||||
to a Wordpress feed from StatusNet using this plugin.
|
||||
|
||||
To use the plugin, add the following to your config.php:
|
||||
|
||||
@ -17,29 +16,28 @@ that looks like this:
|
||||
<cloud domain="SITE" port="80" path="/main/rsscloud/request_notify"
|
||||
registerProcedure="" protocol="http-post"/>
|
||||
|
||||
Aggregators may subscribe by sending a proper REST RSSCloud subscription
|
||||
request (the optional 'domain' parameter with challenge is supported).
|
||||
Subscribing aggregators will be notified ('pinged') when users they have
|
||||
subscribed to post new notices. Currently, REST is the only protocol
|
||||
supported for notifications.
|
||||
Aggregators may subscribe by sending a proper REST RSSCloud subscription request
|
||||
(the optional 'domain' parameter with challenge is supported). Subscribing
|
||||
aggregators will be notified ('pinged') when users they have subscribed to post
|
||||
new notices. Currently, REST is the only protocol supported for notifications.
|
||||
|
||||
Deamon
|
||||
------
|
||||
|
||||
There's also a daemon for offline processing of queued notices with
|
||||
RSSCloud destinations, which will start automatically if/when you run
|
||||
There's also a daemon for offline processing of queued notices with RSSCloud
|
||||
destinations, which will start automatically if/when you run
|
||||
scripts/startdaemons.sh.
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
- Again, only RSS 2.0 profile feeds may be subscribed to, and they have
|
||||
to be the ones with user names in them, like:
|
||||
- Again, only RSS 2.0 profile feeds may be subscribed to, and they have to be
|
||||
the ones with user names in them, like:
|
||||
http://SITE/PATH/api/statuses/user_timeline/USERNAME.rss
|
||||
- Subscriptions are deleted after three notification failures in a row
|
||||
(not sure this is optimal).
|
||||
- The plugin includes a dummy LoggingAggregator class that can be used
|
||||
for end-to-end testing. You probably don't want to mess with it.
|
||||
- Subscriptions are deleted after three notification failures in a row (not sure
|
||||
this is optimal).
|
||||
- The plugin includes a dummy LoggingAggregator class that can be used for
|
||||
end-to-end testing. You probably don't want to mess with it.
|
||||
|
||||
TODO
|
||||
----
|
||||
|
@ -40,7 +40,7 @@ if (!defined('STATUSNET')) {
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
**/
|
||||
*/
|
||||
class RSSCloudNotifier
|
||||
{
|
||||
const MAX_FAILURES = 3;
|
||||
@ -76,7 +76,6 @@ class RSSCloudNotifier
|
||||
$body = $response->getBody();
|
||||
|
||||
if ($status >= 200 && $status < 300) {
|
||||
|
||||
// NOTE: the spec says that the body must contain the string
|
||||
// challenge. It doesn't say that the body must contain the
|
||||
// challenge string ONLY, although that seems to be the way
|
||||
@ -113,7 +112,6 @@ class RSSCloudNotifier
|
||||
*/
|
||||
function postUpdate($endpoint, $feed)
|
||||
{
|
||||
|
||||
$headers = array();
|
||||
$postdata = array('url' => $feed);
|
||||
|
||||
@ -210,9 +208,7 @@ class RSSCloudNotifier
|
||||
common_log_db_error($cloudSub, 'DELETE', __FILE__);
|
||||
common_log(LOG_ERR, 'Could not delete RSSCloud subscription.');
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
common_debug('Updating failure count on RSSCloud subscription. ' .
|
||||
$failCnt);
|
||||
|
||||
|
@ -41,8 +41,7 @@ define('RSSCLOUDPLUGIN_VERSION', '0.1');
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
**/
|
||||
|
||||
*/
|
||||
class RSSCloudPlugin extends Plugin
|
||||
{
|
||||
/**
|
||||
@ -61,7 +60,6 @@ class RSSCloudPlugin extends Plugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function onInitializePlugin()
|
||||
{
|
||||
$this->domain = common_config('rsscloud', 'domain');
|
||||
@ -104,7 +102,6 @@ class RSSCloudPlugin extends Plugin
|
||||
*
|
||||
* @return boolean hook return
|
||||
*/
|
||||
|
||||
function onRouterInitialized($m)
|
||||
{
|
||||
$m->connect('/main/rsscloud/request_notify',
|
||||
@ -127,7 +124,6 @@ class RSSCloudPlugin extends Plugin
|
||||
* @return boolean hook return
|
||||
*
|
||||
*/
|
||||
|
||||
function onAutoload($cls)
|
||||
{
|
||||
switch ($cls)
|
||||
@ -159,7 +155,6 @@ class RSSCloudPlugin extends Plugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function onStartApiRss($action)
|
||||
{
|
||||
if (get_class($action) == 'ApiTimelineUserAction') {
|
||||
@ -242,11 +237,11 @@ class RSSCloudPlugin extends Plugin
|
||||
'author' => 'Zach Copley',
|
||||
'homepage' => 'http://status.net/wiki/Plugin:RSSCloud',
|
||||
'rawdescription' =>
|
||||
// TRANS: Plugin description.
|
||||
_m('The RSSCloud plugin enables your StatusNet instance to publish ' .
|
||||
'real-time updates for profile RSS feeds using the ' .
|
||||
'<a href="http://rsscloud.org/">RSSCloud protocol</a>.'));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ if (!defined('STATUSNET')) {
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @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
|
||||
{
|
||||
/**
|
||||
@ -87,6 +87,7 @@ class RSSCloudRequestNotifyAction extends Action
|
||||
parent::handle($args);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||
// TRANS: Form validation error displayed when POST is not used.
|
||||
$this->showResult(false, _m('Request must be POST.'));
|
||||
return;
|
||||
}
|
||||
@ -104,7 +105,8 @@ class RSSCloudRequestNotifyAction extends Action
|
||||
if (empty($this->protocol)) {
|
||||
$missing[] = 'protocol';
|
||||
} else if (strtolower($this->protocol) != 'http-post') {
|
||||
$msg = _m('Only http-post notifications are supported at this time.');
|
||||
// TRANS: Form validation error displayed when HTTP POST is not used.
|
||||
$msg = _m('Only HTTP POST notifications are supported at this time.');
|
||||
$this->showResult(false, $msg);
|
||||
return;
|
||||
}
|
||||
@ -114,14 +116,18 @@ class RSSCloudRequestNotifyAction extends Action
|
||||
}
|
||||
|
||||
if (!empty($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));
|
||||
// TRANS: List separator.
|
||||
$separator = _m('SEPARATOR',', ');
|
||||
// TRANS: Form validation error displayed when a request body is missing expected parameters.
|
||||
// TRANS: %s is a list of parameters separated by a list separator (default: ", ").
|
||||
$msg = sprintf(_m('The following parameters were missing from the request body: %s.'),implode($separator, $missing));
|
||||
$this->showResult(false, $msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($this->feeds)) {
|
||||
$msg = _m('You must provide at least one valid profile feed url ' .
|
||||
// TRANS: Form validation error displayed when not providing any valid profile feed URLs.
|
||||
$msg = _m('You must provide at least one valid profile feed URL ' .
|
||||
'(url1, url2, url3 ... urlN).');
|
||||
$this->showResult(false, $msg);
|
||||
return;
|
||||
@ -131,21 +137,21 @@ class RSSCloudRequestNotifyAction extends Action
|
||||
// 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)) {
|
||||
|
||||
$nh = $this->getNotifyUrl();
|
||||
common_log(LOG_WARNING,
|
||||
"RSSCloud plugin - $nh tried to subscribe to invalid feed: $feed");
|
||||
|
||||
// TRANS: Form validation error displayed when not providing a valid feed URL.
|
||||
$msg = _m('Feed subscription failed: Not a valid feed.');
|
||||
$this->showResult(false, $msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->testNotificationHandler($feed)) {
|
||||
$msg = _m('Feed subscription failed - ' .
|
||||
'notification handler doesn\'t respond correctly.');
|
||||
// TRANS: Form validation error displayed when feed subscription failed.
|
||||
$msg = _m('Feed subscription failed: ' .
|
||||
'Notification handler does not respond correctly.');
|
||||
$this->showResult(false, $msg);
|
||||
return;
|
||||
}
|
||||
@ -158,6 +164,7 @@ class RSSCloudRequestNotifyAction extends Action
|
||||
// XXX: What to do about deleting stale subscriptions?
|
||||
// 25 hours seems harsh. WordPress doesn't ever remove
|
||||
// subscriptions.
|
||||
// TRANS: Success message after subscribing to one or more feeds.
|
||||
$msg = _m('Thanks for the subscription. ' .
|
||||
'When the feed(s) update(s), you will be notified.');
|
||||
|
||||
@ -222,7 +229,6 @@ class RSSCloudRequestNotifyAction extends Action
|
||||
'RSSCloud plugin - Testing notification handler with challenge: ' .
|
||||
$notifyUrl);
|
||||
return $notifier->challenge($notifyUrl, $feed);
|
||||
|
||||
} else {
|
||||
common_log(LOG_INFO, 'RSSCloud plugin - Testing notification handler: ' .
|
||||
$notifyUrl);
|
||||
@ -291,7 +297,6 @@ class RSSCloudRequestNotifyAction extends Action
|
||||
common_log(LOG_INFO, "RSSCloud plugin - $notifyUrl refreshed subscription" .
|
||||
" to user $user->nickname (id: $user->id).");
|
||||
} else {
|
||||
|
||||
$sub = new RSSCloudSubscription();
|
||||
|
||||
$sub->subscribed = $user->id;
|
||||
|
Loading…
Reference in New Issue
Block a user