aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggPluginManifestParser17.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-03 03:11:49 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-03 03:11:49 +0000
commit4b10b550a2449827c643c896424eb0277c43b049 (patch)
treea0b563666d98f3e32f2b502c2d6474afa3d17d86 /engine/classes/ElggPluginManifestParser17.php
parent4ad5937e6077a60ecc7ee7828fb8975af7491862 (diff)
downloadelgg-4b10b550a2449827c643c896424eb0277c43b049.tar.gz
elgg-4b10b550a2449827c643c896424eb0277c43b049.tar.bz2
Refs #1986 #2170 #2225. Added semantic manifest.xml support and unit tests. Also added plugin dependencies system. See engine/tests/test_files/plugin_18/manifest.xml for examples. Not closing tickets pending discussion.
git-svn-id: http://code.elgg.org/elgg/trunk@7512 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes/ElggPluginManifestParser17.php')
-rw-r--r--engine/classes/ElggPluginManifestParser17.php39
1 files changed, 28 insertions, 11 deletions
diff --git a/engine/classes/ElggPluginManifestParser17.php b/engine/classes/ElggPluginManifestParser17.php
index 49b91ef52..f439b5af0 100644
--- a/engine/classes/ElggPluginManifestParser17.php
+++ b/engine/classes/ElggPluginManifestParser17.php
@@ -4,24 +4,18 @@
*
* @package Elgg.Core
* @subpackage Plugins
+ * @since 1.8
*/
class ElggPluginManifestParser17 extends ElggPluginManifestParser {
/**
* The valid top level attributes and defaults for a 1.7 manifest
*/
protected $validAttributes = array(
- 'author' => null,
- 'version' => null,
- 'description' => null,
- 'website' => null,
- 'copyright' => null,
- 'license' => 'GNU Public License version 2',
- 'elgg_version' => null,
+ 'author', 'version', 'description', 'website',
+ 'copyright', 'license', 'elgg_version',
// were never really used and not enforced in code.
- 'requires' => null,
- 'recommends' => null,
- 'conflicts' => null
+ 'requires', 'recommends', 'conflicts'
);
/**
@@ -30,6 +24,10 @@ class ElggPluginManifestParser17 extends ElggPluginManifestParser {
* @return void
*/
public function parse() {
+ if (!isset($this->manifestObject->children)) {
+ return false;
+ }
+
foreach ($this->manifestObject->children as $element) {
$key = $element->attributes['key'];
$value = $element->attributes['value'];
@@ -47,8 +45,27 @@ class ElggPluginManifestParser17 extends ElggPluginManifestParser {
}
}
- $this->manifest = $elements;
+ if (!$this->manifest = $elements) {
+ return false;
+ }
return true;
}
+
+ /**
+ * Return an attribute in the manifest.
+ *
+ * Overrides ElggPluginManifestParser::getAttribute() because before 1.8
+ * there were no rules...weeeeeeeee!
+ *
+ * @param string $name Attribute name
+ * @return mixed
+ */
+ public function getAttribute($name) {
+ if (isset($this->manifest[$name])) {
+ return $this->manifest[$name];
+ }
+
+ return false;
+ }
} \ No newline at end of file