You are here

function image_captcha_requirements in CAPTCHA 5.3

Same name and namespace in other branches
  1. 8 image_captcha/image_captcha.install \image_captcha_requirements()
  2. 6.2 image_captcha/image_captcha.install \image_captcha_requirements()
  3. 7 image_captcha/image_captcha.install \image_captcha_requirements()

File

image_captcha/image_captcha.module, line 61
Implementation of image CAPTCHA for use with the CAPTCHA module

Code

function image_captcha_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'runtime') {
    if (function_exists('imagegd2')) {
      $gd_info = gd_info();
      if (!$gd_info['FreeType Support']) {
        $requirements['image_captcha_ft'] = array(
          'title' => $t('Image CAPTCHA'),
          'value' => $t('No FreeType support'),
          'description' => $t('FreeType support is required for working with TrueType fonts (.ttf), but the GD library for PHP does not support it.'),
          'severity' => REQUIREMENT_ERROR,
        );
      }
    }
    else {
      $requirements['image_captcha_gd'] = array(
        'title' => $t('Image CAPTCHA'),
        'value' => $t('No GD library'),
        'description' => $t('The GD library for PHP is missing or outdated. Please check the <a href="@url">PHP image documentation</a> for information on how to correct this.', array(
          '@url' => 'http://www.php.net/manual/en/ref.image.php',
        )),
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  return $requirements;
}