/** * Returns the text content wrapped within a HTML comment with boundary * identifier as its comment content. * @return string text content chunck. */ public function flush() { $content = parent::flush(); if (empty($content)) { return ""; } return '<!--' . $this->getBoundary() . '-->' . $content . '<!--//' . $this->getBoundary() . '-->'; }
/** * Renders the output cache control. * This method overrides the parent implementation by capturing the output * from its child controls and saving it into cache, if output cache is needed. * @param THtmlWriter */ public function render($writer) { if ($this->_dataCached) { $writer->write($this->_contents); } else { if ($this->_cacheAvailable) { $textwriter = new TTextWriter(); $multiwriter = new TOutputCacheTextWriterMulti(array($writer->getWriter(), $textwriter)); $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $multiwriter); $stack = $this->getPage()->getCachingStack(); $stack->push($this); parent::render($htmlWriter); $stack->pop(); $content = $textwriter->flush(); $data = array($content, $this->_state, $this->_actions, time()); $this->_cache->set($this->getCacheKey(), $data, $this->getDuration(), $this->getCacheDependency()); } else { parent::render($writer); } } }
public function testRenderWithDocumentPathAndTransformPath() { $expected = "<b>Hello World!</b>\n"; $transform = new TXmlTransform(); $transform->setDocumentPath($this->documentPath); $transform->setTransformPath($this->transformPath); $textWriter = new TTextWriter(); $htmlWriter = new THtmlWriter($textWriter); $transform->render($htmlWriter); $actual = $textWriter->flush(); self::assertEquals($expected, $actual); }
public function testWriteLine() { $writer = new TTextWriter(); $writer->writeLine('some text'); self::assertEquals("some text\n", $writer->flush()); }