diff options
Diffstat (limited to 'engine/classes/ElggPluginManifestParser.php')
-rw-r--r-- | engine/classes/ElggPluginManifestParser.php | 27 |
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; |