color.install

  1. 7.x drupal-7.x/modules/color/color.install
  2. 6.x drupal-6.x/modules/color/color.install

File

drupal-6.x/modules/color/color.install
View source
  1. <?php
  2. function color_requirements($phase) {
  3. $requirements = array();
  4. if ($phase == 'runtime') {
  5. // Check GD library
  6. if (function_exists('imagegd2')) {
  7. $info = gd_info();
  8. $requirements['gd'] = array(
  9. 'value' => $info['GD Version'],
  10. );
  11. // Check PNG support
  12. if (function_exists('imagecreatefrompng')) {
  13. $requirements['gd']['severity'] = REQUIREMENT_OK;
  14. }
  15. else {
  16. $requirements['gd']['severity'] = REQUIREMENT_ERROR;
  17. $requirements['gd']['description'] = t('The GD library for PHP is enabled, but was compiled without PNG support. 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'));
  18. }
  19. }
  20. else {
  21. $requirements['gd'] = array(
  22. 'value' => t('Not installed'),
  23. 'severity' => REQUIREMENT_ERROR,
  24. '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')),
  25. );
  26. }
  27. $requirements['gd']['title'] = t('GD library');
  28. }
  29. return $requirements;
  30. }
  31. /**
  32. * Warn site administrator if unsafe CSS color codes are found in the database.
  33. */
  34. function color_update_6001() {
  35. $ret = array();
  36. $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'color_%_palette'");
  37. while ($variable = db_fetch_array($result)) {
  38. $palette = variable_get($variable['name'], array());
  39. foreach ($palette as $key => $color) {
  40. if (!preg_match('/^#([a-f0-9]{3}){1,2}$/iD', $color)) {
  41. drupal_set_message('Some of the custom CSS color codes specified via the color module are invalid. Please examine the themes which are making use of the color module at the <a href="'. url('admin/appearance/settings') .'">Appearance settings</a> page to verify their CSS color values.', 'warning');
  42. }
  43. }
  44. }
  45. return $ret;
  46. }