+class MWHookException extends MWException {}
+
+/**
+ * Hooks class.
+ *
+ * Used to supersede $wgHooks, because globals are EVIL.
+ */
+class Hooks {
+
+ protected static $handlers = array();
+
+ /**
+ * Attach an event handler to a given hook
+ *
+ * @param $name Mixed: name of hook
+ * @param $callback Mixed: callback function to attach
+ * @return void
+ */
+ public static function register( $name, $callback ) {
+ if( !isset( self::$handlers[$name] ) ) {
+ self::$handlers[$name] = array();
+ }
+
+ self::$handlers[$name][] = $callback;
+ }
+
+ /**
+ * Returns true if a hook has a function registered to it.
+ *
+ * @param $name Mixed: name of hook
+ * @return Boolean: true if a hook has a function registered to it
+ */
+ public static function isRegistered( $name ) {
+ if( !isset( self::$handlers[$name] ) ) {
+ self::$handlers[$name] = array();
+ }
+
+ return ( count( self::$handlers[$name] ) != 0 );
+ }
+
+ /**
+ * Returns an array of all the event functions attached to a hook
+ *
+ * @param $name Mixed: name of the hook
+ * @return array
+ */
+ public static function getHandlers( $name ) {
+ if( !isset( self::$handlers[$name] ) ) {
+ return array();
+ }
+
+ return self::$handlers[$name];
+ }
+
+ /**
+ * Call hook functions defined in Hooks::register
+ *