You are here

function splashify_requirements in Splashify 6

Same name and namespace in other branches
  1. 7 splashify.install \splashify_requirements()

Implements hook_requirements().

Make sure the jStorage library is installed on the site.

File

./splashify.install, line 15

Code

function splashify_requirements($phase) {
  $requirements = array();
  $t = get_t();

  // Make sure we we can access the jStorage library.
  $library_path = splashify_get_library_path('jstorage');
  if ($library_path) {

    // A folder is there, but check that the file actually exists
    $path = $_SERVER['DOCUMENT_ROOT'] . '/' . $library_path . '/';
    $file_integrity = file_exists($path . 'jstorage.min.js');
    if (!$file_integrity) {
      $requirements['splashify_jstorage_integrity'] = array(
        'title' => $t('Splashify library file integrity'),
        'description' => $t('Cannot find the file "jstorage.min.js".
            Splashify will not work correctly without the jStorage library. It
            has not been enabled. See README.txt for installation
            instructions.'),
        'value' => '',
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  else {
    $requirements['splashify_jstorage'] = array(
      'title' => $t('Splashify'),
      'description' => $t('The jStorage library could not be found. See the README.txt file for more information.'),
      'value' => '',
      'severity' => REQUIREMENT_ERROR,
    );
  }
  return $requirements;
}