diff options
-rw-r--r-- | engine/lib/plugins.php | 48 | ||||
-rw-r--r-- | languages/en.php | 4 | ||||
-rw-r--r-- | mod/river/languages/en.php | 15 | ||||
-rw-r--r-- | mod/river/start.php | 4 |
4 files changed, 68 insertions, 3 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 *
diff --git a/languages/en.php b/languages/en.php index 23d7577f5..046349b22 100644 --- a/languages/en.php +++ b/languages/en.php @@ -132,7 +132,9 @@ 'NotImplementedException:XMLRPCMethodNotImplemented' => "XML-RPC method call '%s' not implemented.", 'InvalidParameterException:UnexpectedReturnFormat' => "Call to method '%s' returned an unexpected result.", - 'CallException:NotRPCCall' => "Call does not appear to be a valid XML-RPC call",
+ 'CallException:NotRPCCall' => "Call does not appear to be a valid XML-RPC call", + + 'PluginException:NoPluginName' => "The plugin name could not be found",
/**
* User details
diff --git a/mod/river/languages/en.php b/mod/river/languages/en.php new file mode 100644 index 000000000..13de7e8a3 --- /dev/null +++ b/mod/river/languages/en.php @@ -0,0 +1,15 @@ +<?php + + $english = array( + + /** + * Manifest + */ + + 'river:manifest:description' => "Provide a list of your or your friends recent activity!", + + ); + + add_translation("en",$english); + +?>
\ No newline at end of file diff --git a/mod/river/start.php b/mod/river/start.php index a745bc699..e592aa1f1 100644 --- a/mod/river/start.php +++ b/mod/river/start.php @@ -15,8 +15,10 @@ */ function river_init() { + register_plugin_manifest_basic("Marcus Povey", elgg_echo('river:manifest:description'), "1.0", "http://www.elgg.org", "(C) Curverider 2008"); + add_widget_type('river_widget',sprintf(elgg_echo('river:widget:title'), 'Your'), elgg_echo('river:widget:description')); - add_widget_type('river_widget_friends',sprintf(elgg_echo('river:widget:title:friends'), 'Your'), elgg_echo('river:widget:description:friends')); + add_widget_type('river_widget_friends',sprintf(elgg_echo('river:widget:title:friends'), 'Your'), elgg_echo('river:widget:description:friends')); } register_elgg_event_handler('init','system','river_init'); |