当前位置: 首页>>代码示例>>PHP>>正文


PHP HTMLPurifier_Context::loadArray方法代码示例

本文整理汇总了PHP中HTMLPurifier_Context::loadArray方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLPurifier_Context::loadArray方法的具体用法?PHP HTMLPurifier_Context::loadArray怎么用?PHP HTMLPurifier_Context::loadArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLPurifier_Context的用法示例。


在下文中一共展示了HTMLPurifier_Context::loadArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: assertTransformation

 /**
  * Asserts that a transformation happens
  *
  * This assertion performs several tests on the transform:
  *
  * -# Transforms a start tag with only $name and no attributes
  * -# Transforms a start tag with $name and $attributes
  * -# Transform an end tag
  * -# Transform an empty tag with only $name and no attributes
  * -# Transform an empty tag with $name and $attributes
  *
  * In its current form, it assumes that start and empty tags would be
  * treated the same, and is really ensuring that the tag transform doesn't
  * do anything wonky to the tag type.
  *
  * @param $transformer      HTMLPurifier_TagTransform class to test
  * @param $name             Name of the original tag
  * @param $attributes       Attributes of the original tag
  * @param $expect_name      Name of output tag
  * @param $expect_attributes Attributes of output tag when $attributes
  *                          is included.
  * @param $expect_added_attributes Attributes of output tag when $attributes
  *                          are omitted.
  * @param $config_array     Configuration array for HTMLPurifier_Config
  * @param $context_array    Context array for HTMLPurifier_Context
  */
 protected function assertTransformation($transformer, $name, $attributes, $expect_name, $expect_attributes, $expect_added_attributes = array(), $config_array = array(), $context_array = array())
 {
     $config = HTMLPurifier_Config::createDefault();
     $config->loadArray($config_array);
     $context = new HTMLPurifier_Context();
     $context->loadArray($context_array);
     // start tag transform
     $this->assertIdentical(new HTMLPurifier_Token_Start($expect_name, $expect_added_attributes), $transformer->transform(new HTMLPurifier_Token_Start($name), $config, $context));
     // start tag transform with attributes
     $this->assertIdentical(new HTMLPurifier_Token_Start($expect_name, $expect_attributes), $transformer->transform(new HTMLPurifier_Token_Start($name, $attributes), $config, $context));
     // end tag transform
     $this->assertIdentical(new HTMLPurifier_Token_End($expect_name), $transformer->transform(new HTMLPurifier_Token_End($name), $config, $context));
     // empty tag transform
     $this->assertIdentical(new HTMLPurifier_Token_Empty($expect_name, $expect_added_attributes), $transformer->transform(new HTMLPurifier_Token_Empty($name), $config, $context));
     // empty tag transform with attributes
     $this->assertIdentical(new HTMLPurifier_Token_Empty($expect_name, $expect_attributes), $transformer->transform(new HTMLPurifier_Token_Empty($name, $attributes), $config, $context));
 }
开发者ID:youprofit,项目名称:casebox,代码行数:43,代码来源:TagTransformTest.php

示例2: test_loadArray

 public function test_loadArray()
 {
     // references can be *really* wonky!
     $context_manual = new HTMLPurifier_Context();
     $context_load = new HTMLPurifier_Context();
     $var1 = 1;
     $var2 = 2;
     $context_manual->register('var1', $var1);
     $context_manual->register('var2', $var2);
     // you MUST set up the references when constructing the array,
     // otherwise the registered version will be a copy
     $array = array('var1' => &$var1, 'var2' => &$var2);
     $context_load->loadArray($array);
     $this->assertIdentical($context_manual, $context_load);
     $var1 = 10;
     $var2 = 20;
     $this->assertIdentical($context_manual, $context_load);
 }
开发者ID:Jaaviieer,项目名称:PrograWeb,代码行数:18,代码来源:ContextTest.php


注:本文中的HTMLPurifier_Context::loadArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。