You are here

function imagecache_external_requirements in Imagecache External 7.2

Same name and namespace in other branches
  1. 8 imagecache_external.install \imagecache_external_requirements()

Implements hook_requirements().

File

./imagecache_external.install, line 10
(Un)install and update functions.

Code

function imagecache_external_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break at install time.
  $t = get_t();

  // Check the Imagecache External configuration.
  if ($phase == 'runtime') {
    $hosts = variable_get('imagecache_external_hosts', '');
    $use_whitelist = variable_get('imagecache_external_use_whitelist', TRUE);
    if ($use_whitelist && empty($hosts)) {
      $requirements['imagecache_external'] = array(
        'title' => $t('Imagecache External'),
        'value' => $t('Not properly configured'),
        'description' => $t('The configuration is set to use a whitelist but no hostname(s) are configured. <a href="@link">Add one or more trusted hostnames</a> or <a href="@link">disable the whitelist functionality</a>.', array(
          '@link' => url('admin/config/media/imagecache_external'),
        )),
        'severity' => REQUIREMENT_WARNING,
      );
    }
    else {
      $requirements['imagecache_external'] = array(
        'title' => $t('Imagecache External'),
        'value' => $t('Properly configured'),
        'severity' => REQUIREMENT_OK,
      );
    }
  }
  return $requirements;
}