You are here

function _image_captcha_available_fonts in CAPTCHA 5.3

Same name and namespace in other branches
  1. 6 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
Helper function for the configuration form for image_captcha Called by image_captcha_settings_form() (which determines the real form_id 'image_captcha_settings_form')

File

image_captcha/image_captcha.admin.inc, line 11
Implementation of the administration UI of the image CAPTCHA module.

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;
}