You are here

function lost_character_process in CAPTCHA Pack 8

Same name and namespace in other branches
  1. 6 text_captcha/lost_character_captcha/lost_character_captcha.module \lost_character_process()
  2. 7 text_captcha/lost_character_captcha/lost_character_captcha.module \lost_character_process()

Process the response before validation.

1 string reference to 'lost_character_process'
lost_character_captcha_captcha in text_captcha/modules/lost_character_captcha/lost_character_captcha.module
Implements hook_captcha().

File

text_captcha/modules/lost_character_captcha/lost_character_captcha.module, line 105
Contains general functionality of the module.

Code

function lost_character_process($element, $edit) {
  $response = $element['#value'];

  // Remove white spaces.
  $parts = _text_captcha_whitespace_explode($response);
  $response = implode('', $parts);

  // Split in utf8 characters, sort and rejoin.
  $characters = _text_captcha_utf8_split($response);
  sort($characters);
  $response = implode('', $characters);

  // Put back in element and return.
  $element['#value'] = $response;
  return $element;
}