You are here

function _image_captcha_available_fonts in CAPTCHA 6

Same name and namespace in other branches
  1. 5.3 image_captcha/image_captcha.admin.inc \_image_captcha_available_fonts()

function to get a list of available fonts

1 call to _image_captcha_available_fonts()
image_captcha_settings_form in image_captcha/image_captcha.admin.inc
Configuration form for image_captcha

File

image_captcha/image_captcha.admin.inc, line 6

Code

function _image_captcha_available_fonts() {
  $available_fonts = array(
    'BUILTIN' => t('Built-in font'),
  );
  $fontsdirectories = array(
    drupal_get_path('module', 'image_captcha') . '/fonts',
    file_directory_path(),
  );
  foreach ($fontsdirectories as $fontsdirectory) {
    foreach (file_scan_directory($fontsdirectory, '\\.[tT][tT][fF]$') as $filename => $font) {
      $available_fonts[$filename] = "{$font->basename} ({$filename})";
    }
  }
  return $available_fonts;
}