国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

HTMLPurifier.kses.php 995B

1 个月前
123456789101112131415161718192021222324252627282930
  1. <?php
  2. if (!defined('DEDEINC')) exit ('dedebiz');
  3. /**
  4. * @file
  5. * Emulation layer for code that used kses(), substituting in HTML Purifier.
  6. */
  7. require_once dirname(__FILE__) . '/HTMLPurifier.auto.php';
  8. function kses($string, $allowed_html, $allowed_protocols = null)
  9. {
  10. $config = HTMLPurifier_Config::createDefault();
  11. $allowed_elements = array();
  12. $allowed_attributes = array();
  13. foreach ($allowed_html as $element => $attributes) {
  14. $allowed_elements[$element] = true;
  15. foreach ($attributes as $attribute => $x) {
  16. $allowed_attributes["$element.$attribute"] = true;
  17. }
  18. }
  19. $config->set('HTML.AllowedElements', $allowed_elements);
  20. $config->set('HTML.AllowedAttributes', $allowed_attributes);
  21. if ($allowed_protocols !== null) {
  22. $config->set('URI.AllowedSchemes', $allowed_protocols);
  23. }
  24. $purifier = new HTMLPurifier($config);
  25. return $purifier->purify($string);
  26. }
  27. // vim: et sw=4 sts=4