function _text_captcha_word_pool_validate in CAPTCHA Pack 5
Same name and namespace in other branches
- 8 text_captcha/text_captcha.module \_text_captcha_word_pool_validate()
- 6 text_captcha/text_captcha.inc \_text_captcha_word_pool_validate()
- 7 text_captcha/text_captcha.inc \_text_captcha_word_pool_validate()
Helper function for validating the word pool Locale dependent
3 calls to _text_captcha_word_pool_validate()
- lost_character_captcha_settings_form_validate in text_captcha/
lost_character_captcha/ lost_character_captcha.module - Validation function for the settings form
- phrase_captcha_settings_form_validate in text_captcha/
phrase_captcha/ phrase_captcha.module - Validate function of the administration form
- word_list_captcha_settings_form_validate in text_captcha/
word_list_captcha/ word_list_captcha.module - Validation function for the settings form
File
- text_captcha/
text_captcha.inc, line 122
Code
function _text_captcha_word_pool_validate($name_base, $form_values, $minimum_count, $minimum_length = NULL, $too_short_message = '') {
if (module_exists('locale')) {
global $locale;
$languages = locale_supported_languages();
foreach ($languages['name'] as $lang_code => $lang_name) {
$words = _text_captcha_whitespace_explode($form_values["{$name_base}_{$lang_code}"]);
if (count($words) < $minimum_count) {
form_set_error("{$name_base}_{$lang_code}", t('You should provide at least @num words', array(
'@num' => $minimum_count,
)));
}
// check the minimum word length (if needed)
if ($minimum_length) {
_text_captcha_word_pool_validate_word_length("{$name_base}_{$lang_code}", $words, $minimum_length, $too_short_message);
}
}
}
else {
$words = _text_captcha_whitespace_explode($form_values[$name_base]);
if (count($words) < $minimum_count) {
form_set_error($name_base, t('You should provide at least @num words', array(
'@num' => $minimum_count,
)));
}
if ($minimum_length) {
_text_captcha_word_pool_validate_word_length($name_base, $words, $minimum_length, $too_short_message);
}
}
}