X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fevent.php;h=e6bb41091e1d6f9f104c0b5f50adfb94b1c0092c;hb=5167b1fa408aa486ad75c8ddd3c71cb568dc84a3;hp=4ccee17e666bc770d45b7ebac03f3b77dc918a2d;hpb=7f76c36f24bd51fd4f204f363d5ddf35e9ea9950;p=quix0rs-gnu-social.git diff --git a/lib/event.php b/lib/event.php index 4ccee17e66..e6bb41091e 100644 --- a/lib/event.php +++ b/lib/event.php @@ -1,6 +1,6 @@ . * * @category Event - * @package Laconica - * @author Evan Prodromou - * @copyright 2008 Control Yourself, Inc. + * @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://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } /** * Class for events * - * This "class" two static functions for managing events in the Laconica code. + * This "class" two static functions for managing events in the StatusNet code. * * @category Event - * @package Laconica - * @author Evan Prodromou + * @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://laconi.ca/ + * @link http://status.net/ * * @todo Define a system for using Event instances */ @@ -54,7 +54,7 @@ class Event { /** * Add an event handler * - * To run some code at a particular point in Laconica processing. + * To run some code at a particular point in StatusNet processing. * Named events include receiving an XMPP message, adding a new notice, * or showing part of an HTML page. * @@ -98,7 +98,7 @@ class Event { * on results of handlers. */ - public static function handle($name, $args=array()) { + public static function handle($name, array $args=array()) { $result = null; if (array_key_exists($name, Event::$_handlers)) { foreach (Event::$_handlers[$name] as $handler) { @@ -138,4 +138,17 @@ class Event { } return false; } + + public static function getHandlers($name) + { + return Event::$_handlers[$name]; + } + + /** + * Disables any and all handlers that have been set up so far; + * use only if you know it's safe to reinitialize all plugins. + */ + public static function clearHandlers() { + Event::$_handlers = array(); + } }