public function output(Pagemill_Data $data, Pagemill_Stream $stream) { $stream->puts('<!--'); foreach ($this->children() as $child) { $child->rawOutput($stream, false); } $stream->puts('-->'); }
protected function rawOutput(Pagemill_Stream $stream, $encode = true) { if ($encode) { $stream->puts($this->doctype->encodeEntities($this->_text)); } else { $stream->puts($this->_text); } }
public function output(\Pagemill_Data $data, \Pagemill_Stream $stream) { if ($this->hasAttribute('template')) { $template = Typeframe_Skin::TemplatePath($data->parseVariables($this->getAttribute('template'))); $this->setAttribute('file', $template); } if ($this->getAttribute('select')) { $select = $this->getAttribute('select'); $temp = new Pagemill_Stream(true); parent::output($data, $temp); $xml = Pagemill_SimpleXmlElement::LoadString($temp->clean()); $parts = $xml->select($select); foreach ($parts as $part) { $stream->puts($part->asXml()); } } else { parent::output($data, $stream); } }
public function output(Pagemill_Data $data, Pagemill_Stream $stream) { $stream->puts("<script"); $stream->puts($this->buildAttributeString($data)); if ($this->children()) { $stream->puts(">/*<![CDATA[*/\n"); foreach ($this->children() as $child) { $tmp = new Pagemill_Stream(true); $child->process($data, $tmp); $stream->puts(html_entity_decode($tmp->clean())); } $stream->puts("\n/*]]>*/"); } else { $stream->puts(">"); } $stream->puts("</script>"); }
public function output(Pagemill_Data $data, Pagemill_Stream $stream) { // Create the element and attribute arrays if ($this->hasAttribute('elements')) { $elements = $data->parseVariables($this->getAttribute('elements')); } else { $elements = self::ELEMENTS; } if ($this->hasAttribute('attributes')) { $attributes = $data->parseVariables($this->getAttribute('attributes')); } else { $attributes = self::ATTRIBUTES; } if ($this->hasAttribute('xelements')) { $elements .= ($elements ? ',' : '') . $this->getAttribute('xelements'); } if ($this->hasAttribute('xattributes')) { $attributes .= ($attributes ? ',' : '') . $this->getAttribute('xattributes'); } $elementArray = array_unique(preg_split('/ *, */', $elements)); $attributeArray = array_unique(preg_split('/ *, */', $attributes)); if (in_array('*', $elementArray)) { $elementArray = array('*'); } if (in_array('*', $attributeArray) || in_array('*.*', $attributeArray)) { $attributeArray = array('*'); } $buffer = new Pagemill_Stream(true); foreach ($this->children() as $child) { $child->rawOutput($buffer, false); } $source = $buffer->clean(); $source = $data->parseVariables($source); if (!trim($source)) { return; } if ($this->getAttribute('use') == 'markdown') { require_once TYPEF_SOURCE_DIR . '/libraries/markdown.php'; $source = Markdown($source); } try { $parser = new Pagemill_Parser(); $doctype = new Pagemill_Doctype_Html(''); // Register the href and src attribute processors for URL shortcuts $doctype->registerAttribute('/href', 'Typeframe_Attribute_Url'); $doctype->registerAttribute('/src', 'Typeframe_Attribute_Url'); $tree = $parser->parse($source, $doctype); } catch (Exception $e) { $lastError = $e->getMessage(); //$stream->puts(htmlentities($source)); //$stream->puts($source); try { $xml = @Pagemill_SimpleXmlElement::LoadHtml("<div id=\"codeblock__\">{$source}</div>"); $select = $xml->select('#codeblock__'); $inner = $select[0]->innerXml(); $parser = new Pagemill_Parser(); $doctype = new Pagemill_Doctype_Html(''); $doctype->registerAttribute('/href', 'Typeframe_Attribute_Url'); $doctype->registerAttribute('/src', 'Typeframe_Attribute_Url'); $tree = $parser->parse('<pm:template>' . trim($inner) . '</pm:template>', $doctype); } catch (Exception $e) { trigger_error($lastError); trigger_error($e->getMessage()); $stream->puts(htmlentities($source)); return; } } $this->_recurseInput($tree, $stream, $elementArray, $attributeArray, $data); }
/** * Output the content of the tag without processing tags or evaluating * expressions. * @param Pagemill_Stream $stream */ protected function rawOutput(Pagemill_Stream $stream) { $stream->puts("<{$this->name()}"); $stream->puts($this->buildRawAttributeString()); if (count($this->children())) { $stream->puts(">"); foreach ($this->children() as $child) { $child->rawOutput($stream); } $stream->puts("</{$this->name()}>"); } else { if ($this->collapse) { $stream->puts("/>"); } else { $stream->puts("></{$this->name()}>"); } } }
public function output(\Pagemill_Data $data, \Pagemill_Stream $stream) { $result = $data->evaluate($this->getAttribute('expr')); $stream->puts($result); }