function htmlpurifier_check_version in HTML Purifier 7
Same name and namespace in other branches
- 6.2 htmlpurifier.module \htmlpurifier_check_version()
- 7.2 htmlpurifier.module \htmlpurifier_check_version()
Checks for updates to the HTML Purifier library.
2 calls to htmlpurifier_check_version()
- htmlpurifier_cron in ./
htmlpurifier.module - Implements hook_cron().
- htmlpurifier_requirements in ./
htmlpurifier.install - Implements hook_requirements().
File
- ./
htmlpurifier.module, line 65 - Implements HTML Purifier as a Drupal filter.
Code
function htmlpurifier_check_version($force = FALSE) {
if ($force || !variable_get('htmlpurifier_version_check_failed', FALSE)) {
// Maybe this should be changed in the future:
$result = drupal_http_request('http://htmlpurifier.org/live/VERSION');
if ($result->code == 200) {
$version = trim($result->data);
if (variable_get('html_purifier_version_check_failed', FALSE) == TRUE) {
variable_set('htmlpurifier_version_check_failed', FALSE);
}
$current_version = variable_get('htmlpurifier_version_current', '');
if ($current_version != $version) {
variable_set('htmlpurifier_version_current', $version);
}
return $version;
}
else {
variable_set('htmlpurifier_version_check_failed', TRUE);
// Delete any previously known "latest" version so that people can be
// alerted if a problem appears on a previously working site.
variable_del('htmlpurifier_version_current');
}
}
}