Пример #1
0
 /**
  * Set any extra information to the scheme if present
  * This can be a better readable title, descriptions, whether it's an internal scheme or not, ...
  *
  * @param One_Scheme $scheme
  * @param DOMXPath $xpath
  * @param DOMElement $meta
  */
 protected static function setInformation(One_Scheme $scheme, DOMXPath $xpath, DOMElement $meta)
 {
     $infoSpec = $xpath->query($meta->getNodePath() . '/info');
     if ($infoSpec->length == 1) {
         $info = $infoSpec->item(0);
         if ($info->hasChildNodes()) {
             $child = $info->firstChild;
             do {
                 if ($child->nodeType == XML_ELEMENT_NODE) {
                     $nodeName = $child->nodeName;
                     $content = $child->textContent;
                     if (in_array($nodeName, array('title', 'description', 'image', 'group', 'grouporder'))) {
                         $scheme->set("info.{$nodeName}", $content);
                         //                $scheme->$nodeName = $content;
                     } elseif ($nodeName == 'options') {
                         $options = explode(',', $content);
                         foreach ($options as $option) {
                             $scheme->set("info.options.{$option}", $option);
                         }
                     } else {
                         $scheme->information[$nodeName] = $content;
                     }
                 }
                 $child = $child->nextSibling;
             } while (!is_null($child));
         }
     }
 }