From 8173f672f06ad2783d3d0112e7b285d2240f488b Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 30 Nov 2010 03:56:34 +0000 Subject: Refs #1986 #2170 #2225 Added ElggPluginManifest, ElggPluginManifestParser, and its parser classes for 1.7 and 1.8 style manifests. Changed load_plugin_manifest() to use new parser. Added initial unit tests. git-svn-id: http://code.elgg.org/elgg/trunk@7481 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggPluginManifestParser.php | 91 +++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 engine/classes/ElggPluginManifestParser.php (limited to 'engine/classes/ElggPluginManifestParser.php') diff --git a/engine/classes/ElggPluginManifestParser.php b/engine/classes/ElggPluginManifestParser.php new file mode 100644 index 000000000..0ce3e3024 --- /dev/null +++ b/engine/classes/ElggPluginManifestParser.php @@ -0,0 +1,91 @@ +manifestObject = $xml; + $this->caller = $caller; + } + + /** + * Returns the manifest XML object + * + * @return XmlElement + */ + public function getManifestObject() { + return $this->manifestObject; + } + + /** + * Return the parsed manifest array + * + * @return array + */ + public function getManifest() { + return $this->manifest; + } + + /** + * Return an attribute in the manifest. + * + * @param string $name Attribute name + * @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]; + } + } + + return false; + } + + /** + * Parse the XML object into an array + * + * @return bool + */ + abstract public function parse(); +} \ No newline at end of file -- cgit v1.2.3