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


PHP HTMLPurifier_EntityLookup類代碼示例

本文整理匯總了PHP中HTMLPurifier_EntityLookup的典型用法代碼示例。如果您正苦於以下問題:PHP HTMLPurifier_EntityLookup類的具體用法?PHP HTMLPurifier_EntityLookup怎麽用?PHP HTMLPurifier_EntityLookup使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了HTMLPurifier_EntityLookup類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: instance

 /**
  * Retrieves sole instance of the object.
  * @static
  * @param Optional prototype of custom lookup table to overload with.
  */
 static function instance($prototype = false)
 {
     // no references, since PHP doesn't copy unless modified
     static $instance = null;
     if ($prototype) {
         $instance = $prototype;
     } elseif (!$instance) {
         $instance = new HTMLPurifier_EntityLookup();
         $instance->setup();
     }
     return $instance;
 }
開發者ID:fferriere,項目名稱:web,代碼行數:17,代碼來源:EntityLookup.php

示例2: nonSpecialEntityCallback

 /**
  * Callback function for substituteNonSpecialEntities() that does the work.
  * 
  * @warning Though this is public in order to let the callback happen,
  *          calling it directly is not recommended.
  * @param $matches  PCRE matches array, with 0 the entire match, and
  *                  either index 1, 2 or 3 set with a hex value, dec value,
  *                  or string (respectively).
  * @returns Replacement string.
  */
 function nonSpecialEntityCallback($matches)
 {
     // replaces all but big five
     $entity = $matches[0];
     $is_num = @$matches[0][1] === '#';
     if ($is_num) {
         $is_hex = @$entity[2] === 'x';
         $code = $is_hex ? hexdec($matches[1]) : (int) $matches[2];
         // abort for special characters
         if (isset($this->_special_dec2str[$code])) {
             return $entity;
         }
         return HTMLPurifier_Encoder::unichr($code);
     } else {
         if (isset($this->_special_ent2dec[$matches[3]])) {
             return $entity;
         }
         if (!$this->_entity_lookup) {
             $this->_entity_lookup = HTMLPurifier_EntityLookup::instance();
         }
         if (isset($this->_entity_lookup->table[$matches[3]])) {
             return $this->_entity_lookup->table[$matches[3]];
         } else {
             return $entity;
         }
     }
 }
開發者ID:hasshy,項目名稱:sahana-tw,代碼行數:37,代碼來源:EntityParser.php

示例3: test

 public function test()
 {
     $lookup = HTMLPurifier_EntityLookup::instance();
     // latin char
     $this->assertIdentical('â', $lookup->table['acirc']);
     // special char
     $this->assertIdentical('"', $lookup->table['quot']);
     $this->assertIdentical('“', $lookup->table['ldquo']);
     $this->assertIdentical('<', $lookup->table['lt']);
     // expressed strangely in source file
     // symbol char
     $this->assertIdentical('θ', $lookup->table['theta']);
 }
開發者ID:sebbie42,項目名稱:casebox,代碼行數:13,代碼來源:EntityLookupTest.php

示例4: __construct

 public function __construct()
 {
     parent::__construct();
     $this->_entity_lookup = HTMLPurifier_EntityLookup::instance();
 }
開發者ID:Jaaviieer,項目名稱:PrograWeb,代碼行數:5,代碼來源:GeneratorTest.php

示例5: setUp

 public function setUp()
 {
     $this->_entity_lookup = HTMLPurifier_EntityLookup::instance();
     parent::setUp();
 }
開發者ID:ajnok,項目名稱:yii2book,代碼行數:5,代碼來源:EncoderTest.php

示例6: setUp

 public function setUp()
 {
     $this->EntityParser = new HTMLPurifier_EntityParser();
     $this->_entity_lookup = HTMLPurifier_EntityLookup::instance();
 }
開發者ID:sebbie42,項目名稱:casebox,代碼行數:5,代碼來源:EntityParserTest.php


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