setHooks failing in MediaWiki (trying to setup ReCAPTCHA for a custom form)

apps

#1

Hello all,

 I'm looking to build ReCAPTCHA into a custom form on a MediaWiki site. In order to integrate with ReCAPTCHA, I am attempting to use the recaptchalib.php via a home-made extension.  So, to do this, I thought that it would be pretty simple to either make my own Hook via setHook, or magic word via setFunctionHook to allow me to call into the ReCAPTCHA code.  Unfortunately, even my most basic of examples fails to insert text into my one-click-installed MediaWiki (although, it has been able to call my code via logging print outputs).  See the example below for an example:

In MediaWiki:

[size=small][font=Courier]
[/font][/size]

In LocalSettings.php:

[php]require_once($IP.’/extensions/sample.php’);[/php]

In extentions/sample.php:

[php]$wgHooks[‘ParserFirstCallInit’][] = ‘wfSampleParserInit’;
$wgExtensionFunctions[] = ‘wfSampleRender’;

function wfSampleParserInit( Parser &$parser ) {
$parser->setHook(‘sample’, ‘wfSampleRender’);
return true;
}

function wfSampleRender() {
return (‘

test888
’);
}[/php]

I’ve added a log function and see that the wfSampleParserInit() and wfSampleRender() functions are being called. I am also using a modified php.ini to allow me to debug this code and am monitoring for all PHP errors, warnings and notices. Nevertheless, no text is being updated on the Wiki. Has anyone seen this problem before?

One weird thing that I am noticing is that the wfSampleRender() function needs to take zero arguments for me to receive no errors. That would imply that it isn’t being called properly from the setHook() call, but via some $wgExtensionFunctions[] callback (as I would expect it to need at least a $input parameter in wfSampleRender().

Thanks in advance