function _captcha_get_description in CAPTCHA 7
Same name and namespace in other branches
- 8 captcha.inc \_captcha_get_description()
- 5.3 captcha.module \_captcha_get_description()
- 6.2 captcha.inc \_captcha_get_description()
- 6 captcha.module \_captcha_get_description()
Get the CAPTCHA description as configured on the general CAPTCHA settings page.
If the locale module is enabled, the description will be returned for the current language the page is rendered for. This language can optionally been overridden with the $lang_code argument.
Parameters
string|null $lang_code: an optional language code to get the description for.
Return value
string String with (localized) CAPTCHA description.
3 calls to _captcha_get_description()
- CaptchaBaseWebTestCase::assertCaptchaPresence in ./
captcha.test - Assert that there is a CAPTCHA on the form or not.
- captcha_admin_settings in ./
captcha.admin.inc - Form builder function for the general CAPTCHA configuration.
- captcha_form_alter in ./
captcha.module - Implements of hook_form_alter().
File
- ./
captcha.inc, line 253 - General CAPTCHA functionality and helper functions.
Code
function _captcha_get_description($lang_code = NULL) {
// If no language code is given: use the language of the current page.
global $language;
$lang_code = isset($lang_code) ? $lang_code : $language->language;
// The hardcoded but localizable default.
$default = t('This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.', array(), array(
'langcode' => $lang_code,
));
// Look up the configured CAPTCHA description or fall back on the (localized) default.
if (module_exists('locale')) {
$description = variable_get("captcha_description_{$lang_code}", $default);
}
else {
$description = variable_get('captcha_description', $default);
}
return filter_xss_admin($description);
}