You are here

function parser_simplepie_requirements in FeedAPI 5

Same name and namespace in other branches
  1. 6 parser_simplepie/parser_simplepie.install \parser_simplepie_requirements()

Implementation of hook_requirements().

File

parser_simplepie/parser_simplepie.module, line 23
Parse the incoming URL with SimplePie then provide a data structure of the feed

Code

function parser_simplepie_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break at install time
  $t = get_t();
  switch ($phase) {
    case 'install':
    case 'runtime':
      $path = drupal_get_path('module', 'parser_simplepie') . '/simplepie.inc';
      if (!file_exists($path)) {
        $requirements['simplepie'] = array(
          'title' => $t("FeedAPI SimplePie"),
          'description' => $t("Obtain the !simplepie package and copy simplepie.inc to the parser_simplepie directory.", array(
            '!simplepie' => l('SimplePie', 'http://simplepie.org/downloads', array(), NULL, NULL, TRUE),
          )),
          'severity' => $phase == 'install' ? REQUIREMENT_WARNING : REQUIREMENT_ERROR,
          'value' => $t('simplepie.inc file missing'),
        );
      }
      elseif ($phase == 'runtime') {
        require_once $path;
        $requirements['simplepie'] = array(
          'title' => $t('SimplePie Parser'),
          'description' => t('The current installed version of SimplePie is !version', array(
            '!version' => '<strong>' . SIMPLEPIE_VERSION . '</strong>',
          )),
          'severity' => REQUIREMENT_OK,
          'value' => $t('Installed correctly'),
        );
      }
  }
  return $requirements;
}