function geshifilter_requirements in GeSHi Filter for syntax highlighting 7
Same name and namespace in other branches
- 8.2 geshifilter.install \geshifilter_requirements()
- 8 geshifilter.install \geshifilter_requirements()
- 5.2 geshifilter.module \geshifilter_requirements()
- 6 geshifilter.module \geshifilter_requirements()
Implements hook_requirements().
File
- ./
geshifilter.module, line 226 - An input filter for syntax highlighting using the GeSHi library.
Code
function geshifilter_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
require_once drupal_get_path('module', 'geshifilter') . '/geshifilter.inc';
// check if GeSHi library is available
$geshi_library = libraries_load('geshi');
if (!$geshi_library['loaded']) {
$requirements[] = array(
'title' => 'GeSHi filter',
'value' => t('GeSHi library not found.'),
'severity' => REQUIREMENT_ERROR,
);
}
elseif (($version = explode('.', GESHI_VERSION)) && !($version[0] == '1' && $version[1] == '0')) {
$requirements[] = array(
'title' => 'GeSHi filter',
'value' => t('GeSHi library invalid version.'),
'description' => t('The detected version of GeSHi library (%version) is not supported. A version from the 1.0.x branch is required.', array(
'%version' => GESHI_VERSION,
)),
'severity' => REQUIREMENT_ERROR,
);
}
else {
$requirements[] = array(
'title' => 'GeSHi filter',
'value' => t('Found GeSHi library version %version', array(
'%version' => GESHI_VERSION,
)),
// GESHI_VERSION is defined in GeSHi library
'severity' => REQUIREMENT_OK,
);
}
// Warn if GeSHi filter is configured to automatically managed external stylesheet when it's not possible
if (variable_get('geshifilter_css_mode', GESHIFILTER_CSS_INLINE) == GESHIFILTER_CSS_CLASSES_AUTOMATIC && !_geshifilter_managed_external_stylesheet_possible()) {
$requirements[] = array(
'title' => 'GeSHi filter CSS mode',
'value' => t('GeSHi filter can not automatically manage an external style sheet when the download method is private.'),
'severity' => REQUIREMENT_ERROR,
'description' => t('Change the CSS mode of the <a href="!geshi">GeSHi filter</a> or change the <a href="!filesystem">download mode</a> to public.', array(
'!geshi' => url('admin/config/content/formats/geshifilter'),
'!filesystem' => url('admin/config/content/file-system'),
)),
);
}
// check for filter conflicts
require_once drupal_get_path('module', 'geshifilter') . '/geshifilter.conflicts.inc';
if (geshifilter_admin_filter_conflicts(TRUE) > 0) {
$requirements[] = array(
'title' => 'GeSHi filter',
'value' => t('Some filter conflicts were detected.'),
'description' => l(t('View and resolve the detected filter conflicts'), 'admin/config/content/formats/geshifilter/filterconflicts'),
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}