Esempio n. 1
0
 public function processVariable(Parser $parser)
 {
     $variableName = str_replace(Component::AV_XMLNS . ':', '', $this->nodeName);
     if (!$parser->getTemplate()->hasAssigned($variableName)) {
         throw new Exception("No variable with name '" . $variableName . "' assigned to template.", 90019);
     }
     $contents = (string) $parser->getTemplate()->getAssigned($variableName);
     /* @var $doc DOMDocument */
     $doc = $this->ownerDocument;
     $cdata = $doc->createCDATASection($contents);
     $this->appendChild($cdata);
 }
Esempio n. 2
0
 /**
  * 
  * @param DOMNode $node
  * @return Ajde_Component
  */
 public static function fromNode(Parser $parser, DOMNode $node)
 {
     $componentName = ucfirst(str_replace(self::AC_XMLNS . ':', '', $node->nodeName));
     $className = 'Ajde_Component_' . $componentName;
     $nodeAttributes = $node->attributes;
     $innerXml = $parser->innerXml($node);
     $attributes = array();
     foreach ($nodeAttributes as $attribute) {
         $attributes[$attribute->name] = $attribute->value;
     }
     return new $className($parser, $attributes, $innerXml);
 }