Ideas for improved versions.
[toast/cookiecaptcha.git] / ConfirmEditHooks.php
index dcdf49f7b05058b0db6ab32271f3c32b35420ba1..66e51991792678e3ff71af6f2023fe20def016b8 100644 (file)
@@ -1,24 +1,22 @@
 <?php
 
 class ConfirmEditHooks {
-
        /**
         * Get the global Captcha instance
         *
-        * @return Captcha
+        * @return Captcha|SimpleCaptcha
         */
        static function getInstance() {
                global $wgCaptcha, $wgCaptchaClass;
+
                static $done = false;
+
                if ( !$done ) {
                        $done = true;
                        $wgCaptcha = new $wgCaptchaClass;
                }
-               return $wgCaptcha;
-       }
 
-       static function confirmEdit( $editPage, $newtext, $section ) {
-               return self::getInstance()->confirmEdit( $editPage, $newtext, $section );
+               return $wgCaptcha;
        }
 
        static function confirmEditMerged( $editPage, $newtext ) {
@@ -56,23 +54,34 @@ class ConfirmEditHooks {
        static function confirmEmailUser( $from, $to, $subject, $text, &$error ) {
                return self::getInstance()->confirmEmailUser( $from, $to, $subject, $text, $error );
        }
+
+       public static function APIGetAllowedParams( &$module, &$params ) {
+               return self::getInstance()->APIGetAllowedParams( $module, $params );
+       }
+
+       public static function APIGetParamDescription( &$module, &$desc ) {
+               return self::getInstance()->APIGetParamDescription( $module, $desc );
+       }
 }
 
 class CaptchaSpecialPage extends UnlistedSpecialPage {
-       public function __construct(){
+       public function __construct() {
                parent::__construct( 'Captcha' );
        }
+
        function execute( $par ) {
                $this->setHeaders();
+
                $instance = ConfirmEditHooks::getInstance();
+
                switch( $par ) {
-               case "image":
-                       if ( method_exists( $instance, 'showImage' ) )
-                               return $instance->showImage();
-               case "help":
-               default:
-                       return $instance->showHelp();
+                       case "image":
+                               if ( method_exists( $instance, 'showImage' ) ) {
+                                       return $instance->showImage();
+                               }
+                       case "help":
+                       default:
+                               return $instance->showHelp();
                }
        }
 }
-