diff -Naur ../../htmlpurifier/htmlpurifier.install ./htmlpurifier.install
--- ../../htmlpurifier/htmlpurifier.install 2009-10-22 10:40:01.000000000 -0500
+++ ./htmlpurifier.install 2010-04-27 19:56:09.000000000 -0500
@@ -38,6 +38,7 @@
// This version of HTML Purifier is required
static $req_version = '4.0.0';
$requirements = array();
+ $t = get_t();
// Can't use drupal_get_path, since module may not have been installed.
$module_path = dirname(__FILE__);
@@ -45,7 +46,7 @@
if (!file_exists("$module_path/library/HTMLPurifier.auto.php")) {
$requirements['htmlpurifier'] = array (
'severity' => REQUIREMENT_ERROR,
- 'description' => t("Could not find HTML Purifier
+ 'description' => $t("Could not find HTML Purifier
installation in @path. Please copy contents
of the library folder in the HTML Purifier tarball or zip
to this folder or ensure HTMLPurifier.auto.php exists.
@@ -60,7 +61,7 @@
$requirements['htmlpurifier'] = array (
'severity' => REQUIREMENT_ERROR,
- 'description' => t("HTML Purifier @old is not compatible
+ 'description' => $t("HTML Purifier @old is not compatible
with this module: HTML Purifier @required or later is required.
If the required version is a dev version, you will need to
check
@@ -71,7 +72,41 @@
);
}
}
-
+
+ if ($phase=='runtime') {
+ $current = variable_get('htmlpurifier_version_current', FALSE);
+ if (!$current) {
+ htmlpurifier_cron();
+ $current = variable_get('htmlpurifier_version_current', FALSE);
+ }
+ $ours = variable_get('htmlpurifier_version_ours', FALSE);
+ if (!$ours || version_compare($current, $ours, '>')) {
+ // Update our version number if it can't be found, or there's a mismatch.
+ _htmlpurifier_load();
+ $ours = variable_get('htmlpurifier_version_ours', FALSE);
+ }
+ if ($current && $ours && version_compare($current, $ours, '>')) {
+ $requirements['htmlpurifier_library'] = array(
+ 'title' => $t('HTML Purifier Library'),
+ 'value' => $t('The library is out of date'),
+ 'description' => $t('Your version of HTML Purifier is currently out of date; '.
+ 'the most recent version is %version. You can download the latest '.
+ 'version at htmlpurifier.org. '.
+ 'To update, place the contents of HTML Purifier\'s library/
folder in '.
+ 'modules/htmlpurifier/library/
.',
+ array('%version' => $current)),
+ 'severity' => REQUIREMENT_WARNING,
+ );
+ }
+ if (count($requirements) == 0) {
+ $requirements['htmlpurifier'] = array(
+ 'severity' => REQUIREMENT_OK,
+ 'title' => $t('HTML Purifier Library Version'),
+ 'value' => $ours,
+ );
+ }
+ }
+
return $requirements;
}
diff -Naur ../../htmlpurifier/htmlpurifier.module ./htmlpurifier.module
--- ../../htmlpurifier/htmlpurifier.module 2009-12-12 19:10:18.000000000 -0600
+++ ./htmlpurifier.module 2010-04-27 18:42:58.000000000 -0500
@@ -35,35 +35,6 @@
variable_set('htmlpurifier_version_current', $version);
}
-/**
- * Implementation of hook_init().
- * @note
- * Displays any need to update the HTML Purifier library.
- */
-function htmlpurifier_init() {
- if (user_access('access administration pages')) {
- $current = variable_get('htmlpurifier_version_current', FALSE);
- if (!$current) {
- htmlpurifier_cron();
- $current = variable_get('htmlpurifier_version_current', FALSE);
- }
- $ours = variable_get('htmlpurifier_version_ours', FALSE);
- if (!$ours || version_compare($current, $ours, '>')) {
- // Update our version number if it can't be found, or there's a mismatch.
- _htmlpurifier_load();
- $ours = variable_get('htmlpurifier_version_ours', FALSE);
- }
- if ($current && $ours && version_compare($current, $ours, '>')) {
- drupal_set_message(
- t('Your version of HTML Purifier is currently out of date; '.
- 'the most recent version is %version. You can download the latest '.
- 'version at htmlpurifier.org. '.
- 'To update, place the contents of HTML Purifier\'s library/
folder in '.
- 'modules/htmlpurifier/library/
.',
- array('%version' => $current)), 'warning', FALSE);
- }
- }
-}
/**
* Implementation of hook_filter().