function sheetnode_phpexcel_requirements in Sheetnode 6
Same name and namespace in other branches
- 5 modules/sheetnode_phpexcel/sheetnode_phpexcel.install \sheetnode_phpexcel_requirements()
- 7.2 modules/sheetnode_phpexcel/sheetnode_phpexcel.install \sheetnode_phpexcel_requirements()
- 7 modules/sheetnode_phpexcel/sheetnode_phpexcel.install \sheetnode_phpexcel_requirements()
Implementation of hook_requirements().
File
- modules/
sheetnode_phpexcel/ sheetnode_phpexcel.install, line 6
Code
function sheetnode_phpexcel_requirements($phase) {
$requirements = array();
$t = get_t();
if ($phase == 'runtime') {
// PHPExcel library.
$dir = rtrim(variable_get('sheetnode_phpexcel_library_path', ''), '/');
$satisfied = is_dir($dir) && is_file($dir . '/Classes/PHPExcel.php');
if ($satisfied) {
$version = PHPExcel_Calculation_Functions::VERSION();
}
$requirements['sheetnode_phpexcel_library'] = array(
'title' => $t('PHPExcel library'),
'value' => $satisfied ? $version : $t('PHPExcel NOT found at !dir.', array(
'!dir' => !empty($dir) ? $dir : $t('[empty path]'),
)),
'severity' => $satisfied ? REQUIREMENT_OK : REQUIREMENT_ERROR,
);
// TCPDF library.
$dir = rtrim(variable_get('sheetnode_phpexcel_pdf_renderer_path', ''), '/');
$satisfied = is_dir($dir) && is_file($dir . '/tcpdf.php');
if ($satisfied) {
require_once $dir . '/tcpdf.php';
$tcPDF = new TCPDF();
if (method_exists($tcPDF, 'getTCPDFVersion')) {
$version = 'TCPDF ' . $tcPDF
->getTCPDFVersion();
}
else {
$version = 'TCPDF ' . $t("(version unknown)");
}
}
$requirements['sheetnode_phpexcel_pdf_renderer'] = array(
'title' => $t('TCPDF library'),
'value' => $satisfied ? $version : $t('TCPDF NOT found at !dir.', array(
'!dir' => !empty($dir) ? $dir : $t('[empty path]'),
)),
'severity' => $satisfied ? REQUIREMENT_OK : REQUIREMENT_ERROR,
);
}
return $requirements;
}