/** * Adds the children of the specified node to the queue of the currently * parsed element. It allows them to be processed. * * @final * @internal * @param Opt_Xml_Node $node */ protected final function _process(Opt_Xml_Node $node) { if (is_null($this->_queue)) { $this->_queue = new SplQueue(); } if ($node->hasChildren()) { foreach ($node as $child) { $this->_queue->enqueue($child); } } }
/** * Processes the opt:use attribute. * * @internal * @param Opt_Xml_Node $node The node the attribute is added to * @param Opt_Xml_Attribute $attr The found attribute. */ public function processAttribute(Opt_Xml_Node $node, Opt_Xml_Attribute $attr) { if (isset($this->_snippets[$attr->getValue()])) { array_push($this->_current, $attr->getValue()); $snippet =& $this->_snippets[$attr->getValue()]; // Move all the stuff to the fake node. if ($node->hasChildren()) { $newNode = new Opt_Xml_Element('opt:_'); $newNode->moveChildren($node); $size = sizeof($snippet); $snippet[$size] = $newNode; $attr->set('snippetObj', $snippet); $attr->set('size', $size); } $node->removeChildren(); // Process the snippets $node->set('escaping', $this->_compiler->get('escaping')); $this->_compiler->set('escaping', $snippet[0]->get('escaping')); foreach ($snippet[0] as $subnode) { $node->appendChild(clone $subnode); } $node->set('call:use', $attr->getValue()); $attr->set('postprocess', true); } }