[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/extensions/ConfirmEdit/ -> ConfirmEditHooks.php (source)

   1  <?php
   2  
   3  class ConfirmEditHooks {
   4      /**
   5       * Get the global Captcha instance
   6       *
   7       * @return SimpleCaptcha
   8       */
   9  	static function getInstance() {
  10          global $wgCaptcha, $wgCaptchaClass;
  11  
  12          static $done = false;
  13  
  14          if ( !$done ) {
  15              $done = true;
  16              $wgCaptcha = new $wgCaptchaClass;
  17          }
  18  
  19          return $wgCaptcha;
  20      }
  21  
  22  	static function confirmEditMerged( $editPage, $newtext ) {
  23          return self::getInstance()->confirmEditMerged( $editPage, $newtext );
  24      }
  25  
  26  	static function confirmEditAPI( $editPage, $newtext, &$resultArr ) {
  27          return self::getInstance()->confirmEditAPI( $editPage, $newtext, $resultArr );
  28      }
  29      
  30  	static function addNewAccountApiForm( $apiModule, $loginForm ) {
  31          return self::getInstance()->addNewAccountApiForm( $apiModule, $loginForm );
  32      }
  33      
  34  	static function addNewAccountApiResult( $apiModule, $loginPage, &$result ) {
  35          return self::getInstance()->addNewAccountApiResult( $apiModule, $loginPage, $result );
  36      }
  37  
  38  	static function injectUserCreate( &$template ) {
  39          return self::getInstance()->injectUserCreate( $template );
  40      }
  41  
  42  	static function confirmUserCreate( $u, &$message, &$status = null ) {
  43          return self::getInstance()->confirmUserCreate( $u, $message, $status );
  44      }
  45  
  46  	static function triggerUserLogin( $user, $password, $retval ) {
  47          return self::getInstance()->triggerUserLogin( $user, $password, $retval );
  48      }
  49  
  50  	static function injectUserLogin( &$template ) {
  51          return self::getInstance()->injectUserLogin( $template );
  52      }
  53  
  54  	static function confirmUserLogin( $u, $pass, &$retval ) {
  55          return self::getInstance()->confirmUserLogin( $u, $pass, $retval );
  56      }
  57  
  58  	static function injectEmailUser( &$form ) {
  59          return self::getInstance()->injectEmailUser( $form );
  60      }
  61  
  62  	static function confirmEmailUser( $from, $to, $subject, $text, &$error ) {
  63          return self::getInstance()->confirmEmailUser( $from, $to, $subject, $text, $error );
  64      }
  65  
  66      // Default $flags to 1 for backwards-compatible behavior
  67  	public static function APIGetAllowedParams( &$module, &$params, $flags = 1 ) {
  68          return self::getInstance()->APIGetAllowedParams( $module, $params, $flags );
  69      }
  70  
  71  	public static function APIGetParamDescription( &$module, &$desc ) {
  72          return self::getInstance()->APIGetParamDescription( $module, $desc );
  73      }
  74  }
  75  
  76  class CaptchaSpecialPage extends UnlistedSpecialPage {
  77  	public function __construct() {
  78          parent::__construct( 'Captcha' );
  79      }
  80  
  81  	function execute( $par ) {
  82          $this->setHeaders();
  83  
  84          $instance = ConfirmEditHooks::getInstance();
  85  
  86          switch( $par ) {
  87              case "image":
  88                  if ( method_exists( $instance, 'showImage' ) ) {
  89                      return $instance->showImage();
  90                  }
  91              case "help":
  92              default:
  93                  return $instance->showHelp();
  94          }
  95      }
  96  }


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1