diff options
Diffstat (limited to 'engine/classes/ElggPluginManifestParser.php')
| -rw-r--r-- | engine/classes/ElggPluginManifestParser.php | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/engine/classes/ElggPluginManifestParser.php b/engine/classes/ElggPluginManifestParser.php index 0ce3e3024..af152b561 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,10 +53,10 @@ abstract class ElggPluginManifestParser { /** * Loads the manifest XML to be parsed. * - * @param XmlElement $xml The Manifest XML to be parsed - * @param object $caller The object calling this parser. + * @param ElggXmlElement $xml The Manifest XML object to be parsed + * @param object $caller The object calling this parser. */ - public function __construct(XmlElement $xml, $caller) { + public function __construct(ElggXMLElement $xml, $caller) { $this->manifestObject = $xml; $this->caller = $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; @@ -88,4 +99,4 @@ abstract class ElggPluginManifestParser { * @return bool */ abstract public function parse(); -}
\ No newline at end of file +} |
