/** * Tests GadgetHtmlRenderer->renderGadget() */ public function testRewrite() { preg_match_all('|<script>(.*?)</script>|', $this->gadgetRewriter->rewrite($this->view["content"], $this->gadget), $tmp, PREG_SET_ORDER); $desc_string = $tmp[0][1]; $source_string = "var test='<b>BIG WORDS</b>'"; $this->assertEquals($source_string, $desc_string); }
/** * Rewrites the content, based on shindig's configuration (force_rewrite) and/or the gadget's * spec params, it also injects the required html, css and javascript for the final gadget * using the dom observer methods for the head and body * * @param unknown_type $content * @return unknown */ public function rewriteContent($content) { // Rewrite the content, this will rewrite resource links to proxied versions (if requested), sanitize if configured, and // add the various javascript tags to the document $rewriter = new GadgetRewriter($this->context); $rewriter->addObserver('head', $this, 'addHeadTags'); $rewriter->addObserver('body', $this, 'addBodyTags'); return $rewriter->rewrite($content, $this->gadget, true); }