diff options
-rw-r--r-- | engine/lib/plugins.php | 21 | ||||
-rw-r--r-- | languages/en.php | 5 | ||||
-rw-r--r-- | views/default/admin/plugins_opt/plugin.php | 17 |
3 files changed, 42 insertions, 1 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 51d004b7a..abbeeccc5 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -325,6 +325,27 @@ }
/**
+ * This function checks a plugin manifest 'elgg_version' value against the current install
+ * returning TRUE if the elgg_version is <= the current install's version.
+ * @param $manifest_elgg_version_string The build version (eg 2009010201).
+ * @return bool
+ */
+ function check_plugin_compatibility($manifest_elgg_version_string)
+ {
+ $version = get_version();
+
+ if (strpos($manifest_elgg_version_string, '.')===false)
+ {
+ // Using version
+ $req_version = (int)$manifest_elgg_version_string;
+
+ return ($version >= $req_version);
+ }
+
+ return false;
+ }
+
+ /**
* Shorthand function for finding the plugin settings.
*
* @param string $plugin_name Optional plugin name, if not specified then it is detected from where you
diff --git a/languages/en.php b/languages/en.php index d415ba84a..635b46dad 100644 --- a/languages/en.php +++ b/languages/en.php @@ -502,7 +502,10 @@ To remove a widget drag it back to the <b>Widget gallery</b>.", 'admin:plugins:label:copyright' => "Copyright",
'admin:plugins:label:licence' => "Licence",
'admin:plugins:label:website' => "URL",
- "admin:plugins:label:moreinfo" => 'more info',
+ 'admin:plugins:label:moreinfo' => 'more info',
+ 'admin:plugins:label:version' => 'Version',
+ 'admin:plugins:warning:elggversionunknown' => 'Warning: This plugin does not specify a compatible Elgg version.',
+ 'admin:plugins:warning:elggtoolow' => 'Warning: This plugin requires a later version of Elgg!',
'admin:plugins:reorder:yes' => "Plugin %s was reordered successfully.",
'admin:plugins:reorder:no' => "Plugin %s could not be reordered.",
'admin:plugins:disable:yes' => "Plugin %s was disabled successfully.",
diff --git a/views/default/admin/plugins_opt/plugin.php b/views/default/admin/plugins_opt/plugin.php index d4c919e56..be1dc485c 100644 --- a/views/default/admin/plugins_opt/plugin.php +++ b/views/default/admin/plugins_opt/plugin.php @@ -20,6 +20,12 @@ $active = $details['active']; $manifest = $details['manifest']; + // Check elgg version if available + $version_check_valid = false; + if ($manifest['elgg_version']) + $version_check_valid = check_plugin_compatibility($manifest['elgg_version']); + + $ts = time(); $token = generate_action_token($ts); ?> @@ -58,6 +64,17 @@ <?php echo elgg_view("object/plugin", array('plugin' => $plugin, 'entity' => find_plugin_settings($plugin))) ?>
</div>
</div>
+ <?php } ?> + + <?php if ((!$version_check_valid) || (!isset($manifest['elgg_version']))) { ?> + <div id="version_check"> + <?php + if (!isset($manifest['elgg_version'])) + echo elgg_echo('admin:plugins:warning:elggversionunknown'); + else + echo elgg_echo('admin:plugins:warning:elggtoolow'); + ?> + </div> <?php } ?>
<p><a class="manifest_details"><?php echo elgg_echo("admin:plugins:label:moreinfo"); ?></a></p> |