You are here

function swftools_requirements in SWF Tools 6.3

Same name and namespace in other branches
  1. 6.2 swftools.install \swftools_requirements()

Implementation of hook_requirements().

Check that the zlib extension exists for PHP.

File

./swftools.install, line 22
Install, update and uninstall functions for the SWF Tools module.

Code

function swftools_requirements($phase) {

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

  // Check if the zlib library is loaded
  $has_zlib = extension_loaded('zlib');

  // Generate the requirements array ready for return
  $requirements['swftools'] = array(
    'title' => $t('Zlib library'),
    'description' => $has_zlib ? '' : $t('Without the <a href="@url">zlib library</a> SWF Tools is unable to automatically determine the dimensions of compressed swf files. SWF Tools will work but the size of compressed swf content must be specified, otherwise the content may not appear in some browsers.', array(
      '@url' => 'http://www.php.net/zlib',
    )),
    'value' => $has_zlib ? $t('Enabled') : $t('Not installed'),
    'severity' => $has_zlib ? REQUIREMENT_OK : REQUIREMENT_WARNING,
  );

  // Return the array
  return $requirements;
}