}
}
+ function addCaptchaAPI(&$resultArr) {
+ $info = $this->pickImage();
+ if( !$info ) {
+ $resultArr['captcha']['error'] = 'Out of images';
+ return;
+ }
+ $index = $this->storeCaptcha( $info );
+ $title = Title::makeTitle( NS_SPECIAL, 'Captcha/image' );
+ $resultArr['captcha']['type'] = 'image';
+ $resultArr['captcha']['mime'] = 'image/png';
+ $resultArr['captcha']['id'] = $index;
+ $resultArr['captcha']['url'] = $title->getLocalUrl( 'wpCaptchaId=' . urlencode( $index ) );
+ }
+
/**
* Insert the captcha prompt into the edit form.
*/
$title = Title::makeTitle( NS_SPECIAL, 'Captcha/image' );
return "<p>" .
- wfElement( 'img', array(
+ Xml::element( 'img', array(
'src' => $title->getLocalUrl( 'wpCaptchaId=' . urlencode( $index ) ),
'width' => $info['width'],
'height' => $info['height'],
'alt' => '' ) ) .
"</p>\n" .
- wfElement( 'input', array(
+ Xml::element( 'input', array(
'type' => 'hidden',
'name' => 'wpCaptchaId',
'id' => 'wpCaptchaId',
'value' => $index ) ) .
"<p>" .
- wfElement( 'input', array(
+ Xml::element( 'input', array(
'name' => 'wpCaptchaWord',
'id' => 'wpCaptchaWord',
'tabindex' => 1 ) ) . // tab in before the edit textarea