aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggPluginManifestParser.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/ElggPluginManifestParser.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/ElggPluginManifestParser.php')
-rw-r--r--engine/classes/ElggPluginManifestParser.php27
1 files changed, 19 insertions, 8 deletions
diff --git a/engine/classes/ElggPluginManifestParser.php b/engine/classes/ElggPluginManifestParser.php
index 0ce3e3024..dce46cbb4 100644
--- a/engine/classes/ElggPluginManifestParser.php
+++ b/engine/classes/ElggPluginManifestParser.php
@@ -2,9 +2,24 @@
/**
* Parent class for manifest parsers.
*
+ * Converts manifest.xml files or strings to an array.
+ *
+ * This should be extended by a class that does the actual work
+ * to convert based on the manifest.xml version.
+ *
+ * This class only parses XML to an XmlEntity object and
+ * an array. The array should be used primarily to extract
+ * information since it is quicker to parse once and store
+ * values from the XmlElement object than to parse the object
+ * each time.
+ *
+ * The array should be an exact representation of the manifest.xml
+ * file or string. Any normalization needs to be done in the
+ * calling class / function.
+ *
* @package Elgg.Core
* @subpackage Plugins
- *
+ * @since 1.8
*/
abstract class ElggPluginManifestParser {
/**
@@ -38,7 +53,7 @@ abstract class ElggPluginManifestParser {
/**
* Loads the manifest XML to be parsed.
*
- * @param XmlElement $xml The Manifest XML to be parsed
+ * @param XmlElement $xml The Manifest XML object to be parsed
* @param object $caller The object calling this parser.
*/
public function __construct(XmlElement $xml, $caller) {
@@ -71,12 +86,8 @@ abstract class ElggPluginManifestParser {
* @return mixed
*/
public function getAttribute($name) {
- if (array_key_exists($name, $this->validAttributes)) {
- if (isset($this->manifest[$name])) {
- return $this->manifest[$name];
- } else {
- return $this->validAttributes[$name];
- }
+ if (in_array($name, $this->validAttributes) && isset($this->manifest[$name])) {
+ return $this->manifest[$name];
}
return false;