Пример #1
0
 /**
  * Copy attributes from an XML document to $this
  *
  * @param SimpleXMLElement $info
  * @return void
  */
 public function parse($info)
 {
     $this->key = (string) $info->attributes()->key;
     $this->type = (string) $info->attributes()->type;
     $this->file = (string) $info->file;
     $this->label = (string) $info->name;
     // Convert first level variables to CRM_Core_Extension properties
     // and deeper into arrays. An exception for URLS section, since
     // we want them in special format.
     foreach ($info as $attr => $val) {
         if (count($val->children()) == 0) {
             $this->{$attr} = (string) $val;
         } elseif ($attr === 'urls') {
             $this->urls = array();
             foreach ($val->url as $url) {
                 $urlAttr = (string) $url->attributes()->desc;
                 $this->urls[$urlAttr] = (string) $url;
             }
             ksort($this->urls);
         } else {
             $this->{$attr} = CRM_Utils_XML::xmlObjToArray($val);
         }
     }
 }