diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-05 20:42:03 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-05 20:42:03 +0000 |
commit | adad5a2ea53a69e58a39c37871d31782c00354a9 (patch) | |
tree | 86781f326878b2cf91d941fe3cebc8ebfa9fec33 | |
parent | 5e49434e45d00606ff1a1976849880264236db94 (diff) | |
download | elgg-adad5a2ea53a69e58a39c37871d31782c00354a9.tar.gz elgg-adad5a2ea53a69e58a39c37871d31782c00354a9.tar.bz2 |
load_plugin_manifest() converts multiple keys with the same name into assoc arrays.
git-svn-id: http://code.elgg.org/elgg/trunk@5627 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/plugins.php | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index b12ea704a..4861ffd09 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -306,14 +306,21 @@ function get_plugin_name($mainfilename = false) { * * Example file: * - * <plugin_manifest> - * <field key="author" value="Curverider Ltd" /> - * <field key="version" value="1.0" /> - * <field key="description" value="My plugin description, keep it short" /> - * <field key="website" value="http://www.elgg.org/" /> - * <field key="copyright" value="(C) Curverider 2008-2010" /> - * <field key="licence" value="GNU Public License version 2" /> - * </plugin_manifest> + * <plugin_manifest> + * <!-- Basic information --> + * <field key="name" value="My Plugin" /> + * <field key="description" value="My Plugin's concise description" /> + * <field key="version" value="1.0" /> + * <field key="category" value="theme" /> + * <field key="category" value="bundled" /> + * <field key="screenshot" value="path/relative/to/my_plugin.jpg" /> + * <field key="screenshot" value="path/relative/to/my_plugin_2.jpg" /> + * + * <field key="author" value="Curverider Ltd" /> + * <field key="website" value="http://www.elgg.org/" /> + * <field key="copyright" value="(C) Curverider 2008-2010" /> + * <field key="licence" value="GNU Public License version 2" /> + * </plugin_manifest> * * @param string $plugin Plugin name. * @return array of values @@ -330,7 +337,17 @@ function load_plugin_manifest($plugin) { $key = $element->attributes['key']; $value = $element->attributes['value']; - $elements[$key] = $value; + // create arrays if multiple fields are set + if (array_key_exists($key, $elements)) { + if (!is_array($elements[$key])) { + $orig = $elements[$key]; + $elements[$key] = array($orig); + } + + $elements[$key][] = $value; + } else { + $elements[$key] = $value; + } } return $elements; |