diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-19 17:15:11 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-19 17:15:11 +0000 |
commit | fe25ff1e78b426914e961bf787253475e61167a6 (patch) | |
tree | 9220d03819579725d05f74fb134bea7dee6eee1f /engine | |
parent | ded12a563f4973dfaee3cdaf339423bdb0492b65 (diff) | |
download | elgg-fe25ff1e78b426914e961bf787253475e61167a6.tar.gz elgg-fe25ff1e78b426914e961bf787253475e61167a6.tar.bz2 |
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
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/plugins.php | 48 |
1 files changed, 47 insertions, 1 deletions
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 *
|