function htmlpurifier_check_version in HTML Purifier 6.2
Same name and namespace in other branches
- 7.2 htmlpurifier.module \htmlpurifier_check_version()
- 7 htmlpurifier.module \htmlpurifier_check_version()
Checks for updates to the HTML Purifier library.
2 calls to htmlpurifier_check_version()
- htmlpurifier_cron in ./
htmlpurifier.module - Implementation of hook_cron().
- htmlpurifier_requirements in ./
htmlpurifier.install - Implementation of hook_requirements().
File
- ./
htmlpurifier.module, line 44 - 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);
variable_set('htmlpurifier_version_check_failed', FALSE);
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');
}
}
}