function getRecaptchaData($pubkey, $theme = 'red', $lang = 'en', $error = null, $use_ssl = false, $id = 'recaptcha-image') { $config = DiscussHelper::getConfig(); $my = JFactory::getUser(); // @rule: If recaptcha is disabled for registered users, and current logged in user is registered, we don't want to show the recaptcha images. if (!$config->get('antispam_recaptcha_registered_members') && $my->id > 0) { return false; } if ($pubkey == null || $pubkey == '') { die("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>"); } if ($use_ssl) { $server = RECAPTCHA_API_SECURE_SERVER; } else { $server = RECAPTCHA_API_SERVER; } $errorpart = ""; if ($error) { $errorpart = "&error=" . $error; } // Load headers DiscussRecaptcha::loadHeaders(); // Use AJAX method to prevent operation aborted problems with IE return '<script type="text/javascript"> EasyDiscuss.ready(function($){ Recaptcha.create("' . $pubkey . '", "' . $id . '", { lang: "' . $lang . '", theme: "' . $theme . '", tabindex: 0 }); }); </script> <div id="' . $id . '"></div> '; }