i18n/L10n fixes.
Whitespace updates.
* @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;
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;
}
-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:
<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
----
* @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;
$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
*/
function postUpdate($endpoint, $feed)
{
-
$headers = array();
$postdata = array('url' => $feed);
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);
* @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
{
/**
*
* @return void
*/
-
function onInitializePlugin()
{
$this->domain = common_config('rsscloud', 'domain');
*
* @return boolean hook return
*/
-
function onRouterInitialized($m)
{
$m->connect('/main/rsscloud/request_notify',
* @return boolean hook return
*
*/
-
function onAutoload($cls)
{
switch ($cls)
*
* @return void
*/
-
function onStartApiRss($action)
{
if (get_class($action) == 'ApiTimelineUserAction') {
'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;
}
-
}
* @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
{
/**
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;
}
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;
}
}
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;
// 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;
}
// 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.');
'RSSCloud plugin - Testing notification handler with challenge: ' .
$notifyUrl);
return $notifier->challenge($notifyUrl, $feed);
-
} else {
common_log(LOG_INFO, 'RSSCloud plugin - Testing notification handler: ' .
$notifyUrl);
common_log(LOG_INFO, "RSSCloud plugin - $notifyUrl refreshed subscription" .
" to user $user->nickname (id: $user->id).");
} else {
-
$sub = new RSSCloudSubscription();
$sub->subscribed = $user->id;