Revision a8cee257
Added by Assos Assos almost 5 years ago
drupal7/sites/all/modules/captcha/captcha.inc | ||
---|---|---|
266 | 266 |
return filter_xss_admin($description); |
267 | 267 |
} |
268 | 268 |
|
269 |
/** |
|
270 |
* Get the error message as configured on the general CAPTCHA settings page. |
|
271 |
* |
|
272 |
* If the locale module is enabled, the error message will be returned |
|
273 |
* for the current language the page is rendered for. This language |
|
274 |
* can optionally been overridden with the $lang_code argument. |
|
275 |
* |
|
276 |
* @param string|null $lang_code |
|
277 |
* an optional language code to get the description for. |
|
278 |
* |
|
279 |
* @return string |
|
280 |
* String with (localized) error message. |
|
281 |
*/ |
|
282 |
function _captcha_get_error_message($lang_code = NULL) { |
|
283 |
// If no language code is given: use the language of the current page. |
|
284 |
global $language; |
|
285 |
$lang_code = isset($lang_code) ? $lang_code : $language->language; |
|
286 |
// The hardcoded but localizable default. |
|
287 |
$default = t('The answer you entered for the CAPTCHA was not correct.', array(), array('langcode' => $lang_code)); |
|
288 |
// Look up the configured error message or fall back on the (localized) default. |
|
289 |
if (module_exists('locale')) { |
|
290 |
$message = variable_get('captcha_error_message_' . $lang_code, $default); |
|
291 |
} |
|
292 |
else { |
|
293 |
$message = variable_get('captcha_error_message', $default); |
|
294 |
} |
|
295 |
return filter_xss_admin($message); |
|
296 |
} |
|
297 |
|
|
269 | 298 |
/** |
270 | 299 |
* Parse or interpret the given captcha_type. |
271 | 300 |
* |
... | ... | |
340 | 369 |
if (count($buttons)) { |
341 | 370 |
// Pick first button. |
342 | 371 |
// TODO: make this more sofisticated? Use cases needed. |
343 |
$placement = $buttons[0]; |
|
372 |
$placement = (isset($buttons[count($buttons) - 1])) ? $buttons[count($buttons) - 1] : $buttons[0];
|
|
344 | 373 |
} |
345 | 374 |
else { |
346 | 375 |
// Use NULL when no buttons were found. |
Also available in: Unified diff
Weekly update of contrib modules