當前位置: 首頁>>代碼示例>>PHP>>正文


PHP normalize_html函數代碼示例

本文整理匯總了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);
 }
開發者ID:gbisra,項目名稱:Computer-r-us,代碼行數:7,代碼來源:TalesPhpWithReplaceTest.php

示例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);
 }
開發者ID:gbisra,項目名稱:Computer-r-us,代碼行數:7,代碼來源:EscapeHTMLTest.php

示例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();
 }
開發者ID:adrianha,項目名稱:Rafa-Server,代碼行數:31,代碼來源:detikbola.php

示例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);
 }
開發者ID:gbisra,項目名稱:Computer-r-us,代碼行數:7,代碼來源:MetalMacroTest.php

示例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);
 }
開發者ID:ShaeS,項目名稱:Pine-Birch,代碼行數:7,代碼來源:TalOmitTagTest.php

示例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);
 }
開發者ID:gbisra,項目名稱:Computer-r-us,代碼行數:7,代碼來源:TalCommentTest.php

示例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 &raquo;</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));
 }
開發者ID:craftsmancoding,項目名稱:pagination,代碼行數:7,代碼來源:pagerTest.php

示例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();
 }
開發者ID:adrianha,項目名稱:Rafa-Server,代碼行數:30,代碼來源:goal.php

示例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);
 }
開發者ID:gbisra,項目名稱:Computer-r-us,代碼行數:8,代碼來源:OverloadingTest.php

示例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(&quot;&lt;hacked/&gt;&quot;)" 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()));
 }
開發者ID:ShaeS,項目名稱:Pine-Birch,代碼行數:11,代碼來源:DoctypeTest.php

示例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));
 }
開發者ID:gbisra,項目名稱:Computer-r-us,代碼行數:8,代碼來源:TalesTest.php

示例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);
 }
開發者ID:gbisra,項目名稱:Computer-r-us,代碼行數:8,代碼來源:PhpModeTest.php

示例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);
 }
開發者ID:gbisra,項目名稱:Computer-r-us,代碼行數:8,代碼來源:ContentEncodingTest.php

示例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()));
 }
開發者ID:gbisra,項目名稱:Computer-r-us,代碼行數:9,代碼來源:CommentFilterTest.php

示例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()));
 }
開發者ID:ShaeS,項目名稱:Pine-Birch,代碼行數:9,代碼來源:NamespacesTest.php


注:本文中的normalize_html函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。