You are here

function _ascii_art_captcha_available_fonts in CAPTCHA Pack 7

Same name and namespace in other branches
  1. 8 ascii_art_captcha/ascii_art_captcha.module \_ascii_art_captcha_available_fonts()
  2. 5 ascii_art_captcha/ascii_art_captcha.module \_ascii_art_captcha_available_fonts()
  3. 6 ascii_art_captcha/ascii_art_captcha.admin.inc \_ascii_art_captcha_available_fonts()

Function to get a list of available fonts

1 call to _ascii_art_captcha_available_fonts()
ascii_art_captcha_settings_form in ascii_art_captcha/ascii_art_captcha.admin.inc
Function for the settings form

File

ascii_art_captcha/ascii_art_captcha.admin.inc, line 66
Functionality and helper functions for ASCII ART CAPTCHA administration.

Code

function _ascii_art_captcha_available_fonts() {
  $available_fonts = array();
  $fontsdirectory = drupal_get_path('module', 'ascii_art_captcha') . '/fonts';
  $pattern = '/ascii_art_captcha_font_([a-zA-Z0-9]+)\\.[iI][nN][cC]$/';
  $directory_files = file_scan_directory($fontsdirectory, $pattern);
  foreach ($directory_files as $font) {
    $regs = array();
    preg_match($pattern, $font->filename, $regs);
    $available_fonts[$regs[1]] = $regs[1];
  }
  asort($available_fonts);
  return $available_fonts;
}