You are here

function twitter_requirements in Twitter 6.4

Same name and namespace in other branches
  1. 6.5 twitter.install \twitter_requirements()
  2. 7.6 twitter.install \twitter_requirements()
  3. 7.4 twitter.install \twitter_requirements()
  4. 7.5 twitter.install \twitter_requirements()

Implements hook_requirements()

Checks the existance of the Twitter REST library

File

./twitter.install, line 12
Install, update and uninstall functions for the twitter module.

Code

function twitter_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'runtime' || $phase == 'install') {
    $path = 'sites/all/libraries/twitter/twitter.lib.php';
    $requirements['twitter'] = array(
      'title' => $t('Twitter REST API library'),
    );
    if (!file_exists($path)) {
      $requirements['twitter']['value'] = $t('Missing');
      $requirements['twitter']['description'] = $t('The Twitter REST API is missing. ' . 'Download it from ' . '<a href="https://github.com/juampy72/twitter-rest-php" target="_blank">' . 'https://github.com/juampy72/twitter-rest-php</a> and place it at !path', array(
        '!path' => $path,
      ));
      $requirements['twitter']['severity'] = REQUIREMENT_ERROR;
    }
    else {
      $requirements['twitter']['value'] = $t('Installed');
      $requirements['twitter']['severity'] = REQUIREMENT_OK;
    }
  }
  return $requirements;
}