You are here

function _captcha_available_challenge_types in CAPTCHA 5.3

Same name and namespace in other branches
  1. 6.2 captcha.admin.inc \_captcha_available_challenge_types()
  2. 6 captcha.admin.inc \_captcha_available_challenge_types()
  3. 7 captcha.admin.inc \_captcha_available_challenge_types()

Return an array with the available CAPTCHA types, for use as options array for a select form elements. The array is an associative array mapping "$module/$type" to "$type ($module)" with $module the module name implementing the CAPTCHA and $type the name of the CAPTCHA type. (It also includes a 'none' => '<none>' option)

2 calls to _captcha_available_challenge_types()
captcha_admin_settings in ./captcha.module
Form builder function for the general CAPTCHA configuration
captcha_point_admin_form in ./captcha.module

File

./captcha.module, line 161
This module enables basic CAPTCHA functionality: administrators can add a CAPTCHA to desired forms that users without the 'skip CAPTCHA' permission (typically anonymous visitors) have to solve.

Code

function _captcha_available_challenge_types() {
  $captcha_types['none'] = '<' . t('none') . '>';
  foreach (module_implements('captcha') as $module) {
    $result = call_user_func_array($module . '_captcha', array(
      'list',
    ));
    if (is_array($result)) {
      foreach ($result as $type) {
        $captcha_types["{$module}/{$type}"] = "{$type} ({$module})";
      }
    }
  }
  return $captcha_types;
}