X-Git-Url: https://git.toastfreeware.priv.at/toast/cookiecaptcha.git/blobdiff_plain/4eadac72c8f948bfe06ca604b7649eeebb6eb6af..3c4fb15ef913ba30a0b2102ad797f5dfc9883fa8:/FancyCaptcha.class.php diff --git a/FancyCaptcha.class.php b/FancyCaptcha.class.php index abdb2f8..0128417 100644 --- a/FancyCaptcha.class.php +++ b/FancyCaptcha.class.php @@ -24,6 +24,20 @@ class FancyCaptcha extends SimpleCaptcha { } } + 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. */ @@ -43,19 +57,19 @@ class FancyCaptcha extends SimpleCaptcha { $title = Title::makeTitle( NS_SPECIAL, 'Captcha/image' ); return "
" . - wfElement( 'img', array( + Xml::element( 'img', array( 'src' => $title->getLocalUrl( 'wpCaptchaId=' . urlencode( $index ) ), 'width' => $info['width'], 'height' => $info['height'], 'alt' => '' ) ) . "
\n" . - wfElement( 'input', array( + Xml::element( 'input', array( 'type' => 'hidden', 'name' => 'wpCaptchaId', 'id' => 'wpCaptchaId', 'value' => $index ) ) . "" . - wfElement( 'input', array( + Xml::element( 'input', array( 'name' => 'wpCaptchaWord', 'id' => 'wpCaptchaWord', 'tabindex' => 1 ) ) . // tab in before the edit textarea