function feeds_xls_requirements in Feeds XLS 7
Implementation of hook_requirements().
File
- ./
feeds_xls.install, line 6
Code
function feeds_xls_requirements($phase) {
$requirements = array(
'phpexcel' => array(
'title' => t('PHPExcel Library'),
'severity' => REQUIREMENT_OK,
'value' => t('Not found'),
),
);
$file = _feeds_xls_load_phpexcel();
if (!$file) {
$requirements['phpexcel']['severity'] = REQUIREMENT_ERROR;
$requirements['phpexcel']['description'] = t('Please download and install the PHPExcel Library into a location that the Libraries module can find or into the feeds_xls module folder. Note, you must rename the folder "PHPExcel".', array(
'!phpexcel_library' => l('PHPExcel library', 'http://phpexcel.codeplex.com/'),
));
}
if ($requirements['phpexcel']['severity'] == REQUIREMENT_OK && $phase != 'install') {
// Get the version from the file
$phpexcel_file_contents = file_get_contents($file);
$matches = array();
preg_match('/\\*\\ \\@version\\ *.*/', strtolower($phpexcel_file_contents), $matches);
if (count($matches)) {
$matches = explode('version', $matches[0]);
$requirements['phpexcel']['value'] = trim($matches[1]);
}
else {
$requirements['phpexcel']['value'] = 'Unknown version';
}
}
return $requirements;
}