Localisation updates for core and extension messages from translatewiki.net
[toast/cookiecaptcha.git] / ConfirmEditHooks.php
1 <?php
2
3 class ConfirmEditHooks {
4
5         /**
6          * Get the global Captcha instance
7          *
8          * @return Captcha
9          */
10         static function getInstance() {
11                 global $wgCaptcha, $wgCaptchaClass;
12                 static $done = false;
13                 if ( !$done ) {
14                         $done = true;
15                         $wgCaptcha = new $wgCaptchaClass;
16                 }
17                 return $wgCaptcha;
18         }
19
20         static function confirmEdit( $editPage, $newtext, $section ) {
21                 return self::getInstance()->confirmEdit( $editPage, $newtext, $section );
22         }
23
24         static function confirmEditMerged( $editPage, $newtext ) {
25                 return self::getInstance()->confirmEditMerged( $editPage, $newtext );
26         }
27
28         static function confirmEditAPI( $editPage, $newtext, &$resultArr ) {
29                 return self::getInstance()->confirmEditAPI( $editPage, $newtext, $resultArr );
30         }
31
32         static function injectUserCreate( &$template ) {
33                 return self::getInstance()->injectUserCreate( $template );
34         }
35
36         static function confirmUserCreate( $u, &$message ) {
37                 return self::getInstance()->confirmUserCreate( $u, $message );
38         }
39
40         static function triggerUserLogin( $user, $password, $retval ) {
41                 return self::getInstance()->triggerUserLogin( $user, $password, $retval );
42         }
43
44         static function injectUserLogin( &$template ) {
45                 return self::getInstance()->injectUserLogin( $template );
46         }
47
48         static function confirmUserLogin( $u, $pass, &$retval ) {
49                 return self::getInstance()->confirmUserLogin( $u, $pass, $retval );
50         }
51
52         static function injectEmailUser( &$form ) {
53                 return self::getInstance()->injectEmailUser( $form );
54         }
55
56         static function confirmEmailUser( $from, $to, $subject, $text, &$error ) {
57                 return self::getInstance()->confirmEmailUser( $from, $to, $subject, $text, $error );
58         }
59 }
60
61 class CaptchaSpecialPage extends UnlistedSpecialPage {
62         public function __construct(){
63                 parent::__construct( 'Captcha' );
64         }
65         function execute( $par ) {
66                 $this->setHeaders();
67                 $instance = ConfirmEditHooks::getInstance();
68                 switch( $par ) {
69                 case "image":
70                         if ( method_exists( $instance, 'showImage' ) )
71                                 return $instance->showImage();
72                 case "help":
73                 default:
74                         return $instance->showHelp();
75                 }
76         }
77 }
78