1: <?php
2: 3: 4: 5: 6: 7: 8:
9: class ElggPluginManifestParser17 extends ElggPluginManifestParser {
10: 11: 12:
13: protected $validAttributes = array(
14: 'author', 'version', 'description', 'website',
15: 'copyright', 'license', 'licence', 'elgg_version',
16:
17:
18: 'requires', 'recommends', 'conflicts',
19:
20:
21: 'name',
22: );
23:
24: 25: 26: 27: 28:
29: public function parse() {
30: if (!isset($this->manifestObject->children)) {
31: return false;
32: }
33:
34: $elements = array();
35:
36: foreach ($this->manifestObject->children as $element) {
37: $key = $element->attributes['key'];
38: $value = $element->attributes['value'];
39:
40:
41: if (array_key_exists($key, $elements)) {
42: if (!is_array($elements[$key])) {
43: $orig = $elements[$key];
44: $elements[$key] = array($orig);
45: }
46:
47: $elements[$key][] = $value;
48: } else {
49: $elements[$key] = $value;
50: }
51: }
52:
53: if ($elements && !array_key_exists('name', $elements)) {
54: $elements['name'] = $this->caller->getName();
55: }
56:
57: $this->manifest = $elements;
58:
59: if (!$this->manifest) {
60: return false;
61: }
62:
63: return true;
64: }
65:
66: 67: 68: 69: 70: 71: 72: 73: 74:
75: public function getAttribute($name) {
76: if (isset($this->manifest[$name])) {
77: return $this->manifest[$name];
78: }
79:
80: return false;
81: }
82: }
83: