1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- class ElggPluginManifestParser17 extends \ElggPluginManifestParser {
-
- protected $validAttributes = array(
- 'author', 'version', 'description', 'website',
- 'copyright', 'license', 'licence', 'elgg_version',
-
- 'requires', 'recommends', 'conflicts',
-
- 'name',
- );
-
- public function parse() {
- if (!isset($this->manifestObject->children)) {
- return false;
- }
- $elements = array();
- foreach ($this->manifestObject->children as $element) {
- $key = $element->attributes['key'];
- $value = $element->attributes['value'];
-
- if (array_key_exists($key, $elements)) {
- if (!is_array($elements[$key])) {
- $orig = $elements[$key];
- $elements[$key] = array($orig);
- }
- $elements[$key][] = $value;
- } else {
- $elements[$key] = $value;
- }
- }
- if ($elements && !array_key_exists('name', $elements)) {
- $elements['name'] = $this->caller->getName();
- }
- $this->manifest = $elements;
- if (!$this->manifest) {
- return false;
- }
- return true;
- }
-
- public function getAttribute($name) {
- if (isset($this->manifest[$name])) {
- return $this->manifest[$name];
- }
- return false;
- }
- }
|