We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 10f21e1f authored by Evan Prodromou's avatar Evan Prodromou

add class and function doc comments to PuSH plugin

parent 0167ff6d
...@@ -35,27 +35,99 @@ define('DEFAULT_HUB', 'http://pubsubhubbub.appspot.com'); ...@@ -35,27 +35,99 @@ define('DEFAULT_HUB', 'http://pubsubhubbub.appspot.com');
require_once INSTALLDIR.'/plugins/PubSubHubBub/publisher.php'; require_once INSTALLDIR.'/plugins/PubSubHubBub/publisher.php';
/**
* Plugin to provide publisher side of PubSubHubBub (PuSH)
* relationship.
*
* PuSH is a real-time or near-real-time protocol for Atom
* and RSS feeds. More information here:
*
* http://code.google.com/p/pubsubhubbub/
*
* To enable, add the following line to your config.php:
*
* addPlugin('PubSubHubBub');
*
* This will use the Google default hub. If you'd like to use
* another, try:
*
* addPlugin('PubSubHubBub',
* array('hub' => 'http://yourhub.example.net/'));
*
* @category Plugin
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @copyright 2009 Craig Andrews http://candrews.integralblue.com
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
* @link http://status.net/
*/
class PubSubHubBubPlugin extends Plugin class PubSubHubBubPlugin extends Plugin
{ {
/**
* URL of the hub to advertise and publish to.
*/
public $hub = DEFAULT_HUB; public $hub = DEFAULT_HUB;
/**
* Default constructor.
*/
function __construct() function __construct()
{ {
parent::__construct(); parent::__construct();
} }
/**
* Hooks the StartApiAtom event
*
* Adds the necessary bits to advertise PubSubHubBub
* for the Atom feed.
*
* @param Action $action The API action being shown.
*
* @return boolean hook value
*/
function onStartApiAtom($action) function onStartApiAtom($action)
{ {
$action->element('link', array('rel' => 'hub', 'href' => $this->hub), null); $action->element('link', array('rel' => 'hub', 'href' => $this->hub), null);
return true;
} }
/**
* Hooks the StartApiRss event
*
* Adds the necessary bits to advertise PubSubHubBub
* for the RSS 2.0 feeds.
*
* @param Action $action The API action being shown.
*
* @return boolean hook value
*/
function onStartApiRss($action) function onStartApiRss($action)
{ {
$action->element('atom:link', array('rel' => 'hub', $action->element('atom:link', array('rel' => 'hub',
'href' => $this->hub), 'href' => $this->hub),
null); null);
return true;
} }
/**
* Hook for a queued notice.
*
* When a notice has been queued, will ping the
* PuSH hub for each Atom and RSS feed in which
* the notice appears.
*
* @param Notice $notice The notice that's been queued
*
* @return boolean hook value
*/
function onHandleQueuedNotice($notice) function onHandleQueuedNotice($notice)
{ {
$publisher = new Publisher($this->hub); $publisher = new Publisher($this->hub);
...@@ -147,8 +219,21 @@ class PubSubHubBubPlugin extends Plugin ...@@ -147,8 +219,21 @@ class PubSubHubBubPlugin extends Plugin
$this->hub.':'.$publisher->last_response()); $this->hub.':'.$publisher->last_response());
} }
} }
return true;
} }
/**
* Provide version information
*
* Adds this plugin's version data to the global
* version array, for e.g. displaying on the version page.
*
* @param array &$versions array of array of versions
*
* @return boolean hook value
*/
function onPluginVersion(&$versions) function onPluginVersion(&$versions)
{ {
$versions[] = array('name' => 'PubSubHubBub', $versions[] = array('name' => 'PubSubHubBub',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment