function _htmlpurifier_version_check in HTML Purifier 6
Same name and namespace in other branches
- 5 htmlpurifier.install \_htmlpurifier_version_check()
Checks the version of HTML Purifier and fatally errors out if there's a problem.
3 calls to _htmlpurifier_version_check()
- htmlpurifier_install in ./
htmlpurifier.install - Implementation of hook_install().
- htmlpurifier_update_6200 in ./
htmlpurifier.install - htmlpurifier_update_6201 in ./
htmlpurifier.install
File
- ./
htmlpurifier.install, line 37
Code
function _htmlpurifier_version_check() {
// This version of HTML Purifier is required
static $req_version = '3.1.0';
// Can't use drupal_get_path, since module may not have been installed.
$module_path = dirname(__FILE__);
$s = DIRECTORY_SEPARATOR;
if (!file_exists("{$module_path}/library/HTMLPurifier.auto.php")) {
echo "<strong>Fatal error:</strong> Could not find HTML Purifier\n installation in {$module_path}{$s}library. Please copy contents\n of the library folder in the HTML Purifier tarball or zip\n to this folder or ensure HTMLPurifier.auto.php exists.\n You can download HTML Purifier at\n <a href=\"http://htmlpurifier.org/download.html\">htmlpurifier.org</a>.\n After you have done so, reload this page.";
exit;
}
require_once "{$module_path}/library/HTMLPurifier.auto.php";
if (!defined('HTMLPurifier::VERSION') || version_compare($old = HTMLPurifier::VERSION, $req_version, '<')) {
echo "<strong>Fatal error:</strong> HTML Purifier {$old} is not compatible\n with this module: HTML Purifier <strong>{$req_version}</strong> or later is required.\n If the required version is a dev version, you will need to\n <a href=\"http://htmlpurifier.org/download.html#Subversion\">check\n code out of Subversion</a> or\n <a href=\"http://htmlpurifier.org/download.html#NightlyBuilds\">download a nightly</a>\n to use this module. Once you have done so, reload this page.";
exit;
}
// Everything looks ok!
return true;
}