当前位置: 首页>>代码示例>>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;未经允许,请勿转载。