From fe25ff1e78b426914e961bf787253475e61167a6 Mon Sep 17 00:00:00 2001 From: marcus Date: Thu, 19 Jun 2008 17:15:11 +0000 Subject: Closes #59: Plugin manifest. See register_plugin_manifest() & register_plugin_manifest_basic(). Ref #20. git-svn-id: https://code.elgg.org/elgg/trunk@1001 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/plugins.php | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index cc03bba04..b3c5169a3 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -74,7 +74,53 @@ } return false; } - + + /** + * Register a plugin with a manifest. + * + * It is passed an associated array of values. Currently the following fields are recognised: + * + * 'author', 'description', 'version', 'website' & 'copyright'. + * + * @param array $manifest An associative array representing the manifest. + */ + function register_plugin_manifest(array $manifest) + { + global $CONFIG; + + if (!is_array($CONFIG->plugin_manifests)) + $CONFIG->plugin_manifests = array(); + + $plugin_name = get_plugin_name(); + + if ($plugin_name) + { + $CONFIG->plugin_manifests[$plugin_name] = $manifest; + } + else + throw new PluginException(elgg_echo('PluginException:NoPluginName')); + } + + /** + * Register a basic plugin manifest. + * + * @param string $author The author. + * @param string $description A description of the plugin (don't forget to internationalise this string!) + * @param string $version The version + * @param string $website A link to the plugin's website + * @param string $copyright Copyright information + * @return bool + */ + function register_plugin_manifest_basic($author, $description, $version, $website = "", $copyright = "") + { + return register_plugin_manifest(array( + 'version' => $version, + 'author' => $author, + 'description' => $description, + 'website' => $website, + 'copyright' => $copyright + )); + } /** * PluginException * -- cgit v1.2.3