aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggPluginManifestParser17.php
diff options
context:
space:
mode:
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