function parser_simplepie_requirements in FeedAPI 6
Same name and namespace in other branches
- 5 parser_simplepie/parser_simplepie.module \parser_simplepie_requirements()
Implementation of hook_requirements().
File
- parser_simplepie/
parser_simplepie.install, line 11 - Install file for Parser SimplePie module.
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':
if (module_exists('libraries') && file_exists(libraries_get_path('simplepie') . '/simplepie.inc')) {
$path = libraries_get_path('simplepie') . '/simplepie.inc';
}
else {
$path = dirname(__FILE__) . '/simplepie.inc';
}
if (!file_exists($path)) {
$requirements['parser_simplepie'] = array(
'title' => $t("FeedAPI SimplePie"),
'description' => $t("Obtain the !simplepie package from http://simplepie.org/downloads and copy simplepie.inc to the parser_simplepie directory."),
'severity' => $phase == 'install' ? REQUIREMENT_WARNING : REQUIREMENT_ERROR,
'value' => $t('simplepie.inc file missing'),
);
}
elseif ($phase == 'runtime') {
require_once $path;
$requirements['parser_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;
}