catrope@svn.wikimedia.org wrote:
- Adding SimpleCaptcha::addCaptchaAPI() method that adds CAPTCHA information to an API result array. Other CAPTCHA implementations should override this method with a function that does the same (did this for FancyCaptcha and MathCaptcha)
[snip]
$resultArr['captcha']['type'] = 'simple';
$resultArr['captcha']['id'] = $index;
$resultArr['captcha']['question'] = $captcha['question'];
[snip]
$resultArr['captcha']['type'] = 'image';
$resultArr['captcha']['id'] = $index;
$resultArr['captcha']['url'] = $title->getLocalUrl( 'wpCaptchaId=' . urlencode( $index ) );
[snip]
$resultArr['captcha']['type'] = 'math';
$resultArr['captcha']['id'] = $index;
$resultArr['captcha']['sum'] = $sum;
Hmmm... How is an API client meant to figure out what to do with this captcha data, when there seems to be nothing consistent in how it's presented? How is it meant to display a new type of challenge which might be added in the future?
If you're going to have an API for this, I think it needs at least some minimum future-proofing; otherwise all the clients will break when something is tweaked in the captcha.
-- brion vibber (brion @ wikimedia.org)