本文整理汇总了PHP中normalize_html函数的典型用法代码示例。如果您正苦于以下问题:PHP normalize_html函数的具体用法?PHP normalize_html怎么用?PHP normalize_html使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了normalize_html函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIt
function testIt()
{
$tpl = $this->newPHPTAL('input/talesphpwithreplace.01.html');
$res = normalize_html($tpl->execute());
$exp = normalize_html_file('output/talesphpwithreplace.01.html');
$this->assertEquals($exp, $res);
}
示例2: testDoesEscapeHTMLContent
function testDoesEscapeHTMLContent()
{
$tpl = $this->newPHPTAL('input/escape.html');
$exp = normalize_html_file('output/escape.html');
$res = normalize_html($tpl->execute());
$this->assertEquals($exp, $res);
}
示例3: news
public function news($id)
{
$this->load->library('curl');
$this->curl->referer('m.detik.com/kanal/70/');
$this->curl->userAgent('midp 2.0');
$id = decode_href($id);
$html = $this->curl->openGet("http://m.detik.com/read/" . $id);
$this->load->helper('dom');
$dom = str_get_html($html);
$content = $dom->find('div[id=content]', 0);
if ($title = $content->find('h1', 0)) {
$title = $title->innertext;
}
if ($needle = $content->find('p', 0)) {
$strong = $needle->find('strong', 0);
$name = $strong->innertext;
$strong->outertext = '';
$img = $needle->find('img', 0);
$img->outertext = '';
//echo $needle;
//die();
$description = trim($needle->innertext);
$name = normalize_html($name);
$description = normalize_html($description);
}
$elements = array(array('name' => $name, 'description' => $description));
$this->load->library('rafa');
$this->rafa->addHeading('detikbola');
$this->rafa->addList('news', $elements, $title);
$this->rafa->endRafa();
}
示例4: testInheritedMacroSlots
function testInheritedMacroSlots()
{
$tpl = $this->newPHPTAL('input/metal-macro.07.html');
$res = normalize_html($tpl->execute());
$exp = normalize_html_file('output/metal-macro.07.html');
$this->assertEquals($exp, $res);
}
示例5: testWithCondition
function testWithCondition()
{
$tpl = $this->newPHPTAL('input/tal-omit-tag.02.html');
$res = normalize_html($tpl->execute());
$exp = normalize_html_file('output/tal-omit-tag.02.html');
$this->assertEquals($exp, $res);
}
示例6: testMultilineInTemplate
function testMultilineInTemplate()
{
$tpl = $this->newPHPTAL('input/tal-comment.02.html');
$res = normalize_html($tpl->execute());
$exp = normalize_html_file('output/tal-comment.02.html');
$this->assertEquals($exp, $res);
}
示例7: testFlickrStyles
public function testFlickrStyles()
{
Pagination\Pager::style('flickr');
$actual = Pagination\Pager::links(100);
$expected = '<style>.flickr_pagination{margin:10px 0;text-align:center;padding:.3em;cursor:default}.flickr_pagination a,.flickr_pagination em,.flickr_pagination span{padding:.2em .5em}.flickr_pagination .disabled{color:#aaa}.flickr_pagination .current{font-style:normal;font-weight:700;color:#ff0084}.flickr_pagination a{border:1px solid #ddd;color:#0063dc;text-decoration:none}.flickr_pagination a:focus,.flickr_pagination a:hover{border-color:#036;background:#0063dc;color:#fff}.flickr_pagination .page_info{color:#aaa;padding-top:.8em}.flickr_pagination .next_page,.flickr_pagination .previous_page{border-width:2px}.flickr_pagination .previous_page{margin-right:1em}.flickr_pagination .next_page{margin-left:1em}.flickr_pagination .page-count{margin-top:10px}.flickr_pagination .page-count,.flickr_pagination .page-display{font-size:11px;text-align:center;color:#bbb}</style><div class="flickr_pagination"><em class="current">1</em><a href="http://mysite.com/index.php?page=something&offset=25" >2</a><a href="http://mysite.com/index.php?page=something&offset=50" >3</a><a href="http://mysite.com/index.php?page=something&offset=25" >Next »</a><a href="http://mysite.com/index.php?page=something&offset=75" >Last</a><div class="page-count">Page 1 of 4</div><div class="page-display">Displaying records 1 thru 25 of 100</div></div>';
$this->assertEquals(normalize_html($actual), normalize_html($expected));
}
示例8: news
public function news($id)
{
$this->load->library('curl');
$this->curl->referer('www.goal.com/id-ID/news/');
$this->curl->userAgent('midp 2.0');
// Harus terdapat parameter terakhir tetapi terserah
$id = decode_href($id);
$url = "http://www.goal.com/id-ID/news/" . $id;
$html = $this->curl->openGet($url);
$this->load->helper('dom');
$dom = str_get_html($html);
$title = $dom->find('h1', 0)->innertext;
$name = $dom->find('h4', 0)->innertext;
if ($needle = $dom->find('span[id=divAdnetKeyword]', 0)) {
// Hapus text yg tidak penting
foreach ($needle->children() as $child) {
$tag = strtolower($child->tag);
if ($tag != 'br' && $tag != 'em') {
$child->outertext = '';
}
}
$description = trim($needle->innertext);
$description = normalize_html($description);
}
$elements = array(array('name' => $name, 'description' => $description));
$this->load->library('rafa');
$this->rafa->addHeading('goal');
$this->rafa->addList('news', $elements, $title);
$this->rafa->endRafa();
}
示例9: test
function test()
{
$tpl = $this->newPHPTAL('input/overloading-01.html');
$tpl->object = new OverloadTestClass();
$res = normalize_html($tpl->execute());
$exp = normalize_html_file('output/overloading-01.html');
$this->assertEquals($exp, $res);
}
示例10: testClearedOnNestedReexecution
/**
* this is pretty crazy case of PHPTAL being reused while template is still being executed
*/
function testClearedOnNestedReexecution()
{
$tpl = $this->newPHPTAL();
$tpl->tpl = $tpl;
$tpl->setSource('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<hack tal:define="hack php:tpl.setSource("<hacked/>")" tal:content="structure hack/execute"/>');
$this->assertEquals(normalize_html('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><hack><hacked></hacked></hack>'), normalize_html($tpl->execute()));
}
示例11: testTrue
function testTrue()
{
$tpl = $this->newPHPTAL('input/tales-true.html');
$tpl->isNotTrue = false;
$tpl->isTrue = true;
$res = $tpl->execute();
$this->assertEquals(normalize_html_file('output/tales-true.html'), normalize_html($res));
}
示例12: testInContent
function testInContent()
{
$tpl = $this->newPHPTAL('input/php-mode.02.xml');
$res = $tpl->execute();
$exp = normalize_html_file('output/php-mode.02.xml');
$res = normalize_html($res);
$this->assertEquals($exp, $res);
}
示例13: testSimple
function testSimple()
{
$tpl = $this->newPHPTAL('input/content-encoding.xml');
$res = $tpl->execute();
$exp = normalize_html_file('output/content-encoding.xml');
$res = normalize_html($res);
$this->assertEquals($exp, $res);
}
示例14: testNamespaceAware
function testNamespaceAware()
{
$t = $this->newPHPTAL();
$t->addPreFilter(new PHPTAL_PreFilter_StripComments());
$t->setSource('<script xmlns="http://example.com/foo">//<!--
alert("1990s called"); /* && */
//--></script>');
$this->assertEquals(normalize_html('<script xmlns="http://example.com/foo">//</script>'), normalize_html($t->execute()));
}
示例15: testRedefineBuiltinNamespace
function testRedefineBuiltinNamespace()
{
$tpl = $this->newPHPTAL();
$tpl->setSource('<metal:block xmlns:metal="non-zope">
<foo:block xmlns="x" xmlns:foo="http://xml.zope.org/namespaces/tal" content="string:works" />
<metal:block xmlns="http://xml.zope.org/namespaces/i18n" xmlns:metal="http://xml.zope.org/namespaces/tal" metal:content="string:properly" />
</metal:block>');
$this->assertEquals(normalize_html('<metal:block xmlns:metal="non-zope"> works properly </metal:block>'), normalize_html($tpl->execute()));
}