You are here

function _image_captcha_check_fonts in CAPTCHA 7

Same name and namespace in other branches
  1. 8 image_captcha/image_captcha.module \_image_captcha_check_fonts()
  2. 6.2 image_captcha/image_captcha.module \_image_captcha_check_fonts()

Helper function for checking if the specified fonts are available.

Parameters

array $fonts: paths of fonts to check.

Return value

array list($readable_fonts, $problem_fonts)

2 calls to _image_captcha_check_fonts()
image_captcha_settings_form_validate in image_captcha/image_captcha.admin.inc
Validation function for image_captcha configuration form.
_image_captcha_check_setup in image_captcha/image_captcha.module
Helper function for checking the setup of the Image CAPTCHA.

File

image_captcha/image_captcha.module, line 90
Implements image CAPTCHA for use with the CAPTCHA module

Code

function _image_captcha_check_fonts($fonts) {
  $readable_fonts = array();
  $problem_fonts = array();
  foreach ($fonts as $font) {
    if ($font != 'BUILTIN' && (!is_file($font) || !is_readable($font))) {
      $problem_fonts[] = $font;
    }
    else {
      $readable_fonts[] = $font;
    }
  }
  return array(
    $readable_fonts,
    $problem_fonts,
  );
}