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


PHP HTMLPurifier_VarParser类代码示例

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


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

示例1: set

 /**
  * Sets a value to configuration.
  * @param $key String key
  * @param $value Mixed value
  */
 public function set($key, $value, $a = null)
 {
     if (strpos($key, '.') === false) {
         $namespace = $key;
         $directive = $value;
         $value = $a;
         $key = "{$key}.{$directive}";
         $this->triggerError("Using deprecated API: use \$config->set('{$key}', ...) instead", E_USER_NOTICE);
     } else {
         list($namespace) = explode('.', $key);
     }
     if ($this->isFinalized('Cannot set directive after finalization')) {
         return;
     }
     if (!isset($this->def->info[$key])) {
         $this->triggerError('Cannot set undefined directive ' . htmlspecialchars($key) . ' to value', E_USER_WARNING);
         return;
     }
     $def = $this->def->info[$key];
     if (isset($def->isAlias)) {
         if ($this->aliasMode) {
             $this->triggerError('Double-aliases not allowed, please fix ' . 'ConfigSchema bug with' . $key, E_USER_ERROR);
             return;
         }
         $this->aliasMode = true;
         $this->set($def->key, $value);
         $this->aliasMode = false;
         $this->triggerError("{$key} is an alias, preferred directive name is {$def->key}", E_USER_NOTICE);
         return;
     }
     // Raw type might be negative when using the fully optimized form
     // of stdclass, which indicates allow_null == true
     $rtype = is_int($def) ? $def : $def->type;
     if ($rtype < 0) {
         $type = -$rtype;
         $allow_null = true;
     } else {
         $type = $rtype;
         $allow_null = isset($def->allow_null);
     }
     try {
         $value = $this->parser->parse($value, $type, $allow_null);
     } catch (HTMLPurifier_VarParserException $e) {
         $this->triggerError('Value for ' . $key . ' is of invalid type, should be ' . HTMLPurifier_VarParser::getTypeName($type), E_USER_WARNING);
         return;
     }
     if (is_string($value) && is_object($def)) {
         // resolve value alias if defined
         if (isset($def->aliases[$value])) {
             $value = $def->aliases[$value];
         }
         // check to see if the value is allowed
         if (isset($def->allowed) && !isset($def->allowed[$value])) {
             $this->triggerError('Value not supported, valid values are: ' . $this->_listify($def->allowed), E_USER_WARNING);
             return;
         }
     }
     $this->plist->set($key, $value);
     // reset definitions if the directives they depend on changed
     // this is a very costly process, so it's discouraged
     // with finalization
     if ($namespace == 'HTML' || $namespace == 'CSS' || $namespace == 'URI') {
         $this->definitions[$namespace] = null;
     }
     $this->serials[$namespace] = false;
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:71,代码来源:Config.php

示例2: errorGeneric

 /**
  * Generic error for if a type didn't work.
  * @param mixed $var
  * @param int $type
  */
 protected function errorGeneric($var, $type)
 {
     $vtype = gettype($var);
     $this->error("Expected type " . HTMLPurifier_VarParser::getTypeName($type) . ", got {$vtype}");
 }
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:10,代码来源:HTMLPurifier.standalone.php

示例3: validate

 /** @deprecated, use HTMLPurifier_VarParser->parse() */
 public function validate($a, $b, $c = false)
 {
     trigger_error("HTMLPurifier_ConfigSchema->validate deprecated, use HTMLPurifier_VarParser->parse instead", E_USER_NOTICE);
     $parser = new HTMLPurifier_VarParser();
     return $parser->parse($a, $b, $c);
 }
开发者ID:webkodex,项目名称:DVWA,代码行数:7,代码来源:ConfigSchema.php


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