]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/event.php
Added new 'Scroller' plugin from @buttle which aims to replace the out-dated
[quix0rs-gnu-social.git] / lib / event.php
index 31bfd0e5b8a9d61365bab9bfa000273f16d4c404..e6bb41091e1d6f9f104c0b5f50adfb94b1c0092c 100644 (file)
  *
  * @category  Event
  * @package   StatusNet
- * @author    Evan Prodromou <evan@controlyourself.ca>
+ * @author    Evan Prodromou <evan@status.net>
  * @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);
 }
 
@@ -38,9 +38,9 @@ if (!defined('LACONICA')) {
  *
  * @category Event
  * @package  StatusNet
- * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Evan Prodromou <evan@status.net>
  * @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
  */
@@ -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();
+    }
 }