You are here

function _ascii_art_captcha_get_allowed_characters in CAPTCHA Pack 6

Same name and namespace in other branches
  1. 8 ascii_art_captcha/ascii_art_captcha.module \_ascii_art_captcha_get_allowed_characters()
  2. 5 ascii_art_captcha/ascii_art_captcha.module \_ascii_art_captcha_get_allowed_characters()
  3. 7 ascii_art_captcha/ascii_art_captcha.module \_ascii_art_captcha_get_allowed_characters()

helper function for generating a code, taking the allowed characters into account

1 call to _ascii_art_captcha_get_allowed_characters()
ascii_art_captcha_captcha in ascii_art_captcha/ascii_art_captcha.module
Implementation of hook_captcha

File

ascii_art_captcha/ascii_art_captcha.module, line 35

Code

function _ascii_art_captcha_get_allowed_characters() {
  $allowed_chars = array();
  $allowed_chars_settings = variable_get('ascii_art_captcha_allowed_characters', drupal_map_assoc(array(
    'upper',
    'lower',
    'digit',
  )));
  if ($allowed_chars_settings['upper']) {
    $allowed_chars = array_merge($allowed_chars, array(
      'A',
      'B',
      'C',
      'D',
      'E',
      'F',
      'G',
      'H',
      'I',
      'J',
      'K',
      'L',
      'M',
      'N',
      'P',
      'Q',
      'R',
      'S',
      'T',
      'U',
      'V',
      'W',
      'X',
      'Y',
      'Z',
    ));
  }
  if ($allowed_chars_settings['lower']) {
    $allowed_chars = array_merge($allowed_chars, array(
      'a',
      'b',
      'c',
      'd',
      'e',
      'f',
      'g',
      'h',
      'i',
      'j',
      'k',
      'l',
      'm',
      'n',
      'p',
      'q',
      'r',
      's',
      't',
      'u',
      'v',
      'w',
      'x',
      'y',
      'z',
    ));
  }
  if ($allowed_chars_settings['digit']) {
    $allowed_chars += array_merge($allowed_chars, array(
      '1',
      '2',
      '3',
      '4',
      '5',
      '6',
      '7',
      '8',
      '9',
    ));
  }
  return $allowed_chars;
}