aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-20 10:17:04 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-20 10:17:04 +0000
commit94a86019bbb2142821cded619ab83bcd460ba4e5 (patch)
treec5a39c28dc00c75d9c846bcfc54e4fe2be732ca0
parent5e010074580898b22d5080cfc22f94869133657d (diff)
downloadelgg-94a86019bbb2142821cded619ab83bcd460ba4e5.tar.gz
elgg-94a86019bbb2142821cded619ab83bcd460ba4e5.tar.bz2
Refs #61 - Added ability to find settings for plugins other than the one you are in.
git-svn-id: https://code.elgg.org/elgg/trunk@1013 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/plugins.php24
1 files changed, 16 insertions, 8 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index 46b42f929..0d19bc049 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -154,11 +154,16 @@
/**
* Shorthand function for finding the plugin settings.
+ *
+ * @param string $plugin_name Optional plugin name, if not specified then it is detected from where you
+ * are calling from.
*/
- function find_plugin_settings()
+ function find_plugin_settings($plugin_name = "")
{
$plugins = get_entities('object', 'plugin');
- $plugin_name = get_plugin_name();
+ $plugin_name = sanitise_string($plugin_name);
+ if (!$plugin_name)
+ $plugin_name = get_plugin_name();
if ($plugins)
{
@@ -175,10 +180,11 @@
*
* @param string $name The name - note, can't be "title".
* @param mixed $value The value.
+ * @param string $plugin_name Optional plugin name, if not specified then it is detected from where you are calling from.
*/
- function set_plugin_setting($name, $value)
+ function set_plugin_setting($name, $value, $plugin_name = "")
{
- $plugin = find_plugin_settings();
+ $plugin = find_plugin_settings($plugin_name);
if (!$plugin)
$plugin = new ElggPlugin();
@@ -197,10 +203,11 @@
* Get setting for a plugin.
*
* @param string $name The name.
+ * @param string $plugin_name Optional plugin name, if not specified then it is detected from where you are calling from.
*/
- function get_plugin_setting($name)
+ function get_plugin_setting($name, $plugin_name = "")
{
- $plugin = find_plugin_settings();
+ $plugin = find_plugin_settings($plugin_name);
if ($plugin)
return $plugin->$name;
@@ -212,10 +219,11 @@
* Clear a plugin setting.
*
* @param string $name The name.
+ * @param string $plugin_name Optional plugin name, if not specified then it is detected from where you are calling from.
*/
- function clear_plugin_setting($name)
+ function clear_plugin_setting($name, $plugin_name = "")
{
- $plugin = find_plugin_settings();
+ $plugin = find_plugin_settings($plugin_name);
if ($plugin)
return $plugin->clearMetaData($name);