Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 3rd, 2012  |  syntax: PHP  |  size: 1.40 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /**
  2.  * Implements hook_requirements().
  3.  */
  4. function godiagram_requirements($phase) {
  5.   $requirements = array();
  6.  
  7.   if ($phase == 'install') {
  8.     $t = get_t();
  9.  
  10.     $requirements['sltxt2png'] = array(
  11.       'title' => $t('SL Txt 2 PNG'),
  12.     );
  13.  
  14.     if (!function_exists('libraries_get_path')) {
  15.       module_load_include('module', 'libraries');
  16.     }
  17.  
  18.     $sltxt2png_path = libraries_get_path('sltxt2png');
  19.  
  20.     if (!is_file($sltxt2png_path . '/sltxt2png.php')) {
  21.       $requirements['sltxt2png']['description'] = $t(
  22.         '<h2>SL Txt 2 PNG library not installed</h2><br />' .
  23.         'You are missing the required files for the SL Txt 2 PNG library. Please download the library from !sltxt2png_url and unzip the files to !sltxt2png_path. After doing this, confirm that the following path exists: !sltxt2png_php_path.',
  24.         array(
  25.           '!sltxt2png_url' => l(
  26.             'http://senseis.xmp.net/?GoWiki%2FSLTxt2PNG',
  27.             'http://senseis.xmp.net/?GoWiki%2FSLTxt2PNG',
  28.             array(
  29.               'external' => TRUE,
  30.             )
  31.           ),
  32.           '!sltxt2png_path' => $sltxt2png_path,
  33.           '!sltxt2png_php_path' => $sltxt2png_path . '/sltxt2png.php',
  34.         )
  35.       );
  36.       $requirements['sltxt2png']['severity'] = REQUIREMENT_ERROR;
  37.     }
  38.     else {
  39.       $requirements['sltxt2png']['severity'] = REQUIREMENT_OK;
  40.     }
  41.   }
  42.  
  43.   return $requirements;
  44. }