purifier.class.php 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * ZenTaoPMS - Open-source project management system.
  4. *
  5. * @copyright Copyright 2009-2025 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.chandao.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. *
  8. * A third-party license is embedded for some of the code in this file:
  9. * The use of the source code of this file is also subject to the terms
  10. * and consitions of the license of "htmlpurifier" (LGPL, see
  11. * </lib/vendor/ezyang/htmlpurifier/LICENSE>).
  12. */
  13. require_once dirname(__FILE__, 2) . '/base/delegate/delegate.class.php';
  14. class purifier extends baseDelegate
  15. {
  16. protected static $className = 'HTMLPurifier';
  17. private $config = ['Cache.DefinitionImpl' => null];
  18. public function __construct($config = [])
  19. {
  20. if(empty($config)) $config = $this->config;
  21. $purifierConfig = HTMLPurifier_Config::createDefault();
  22. foreach($config as $key => $value)
  23. {
  24. $purifierConfig->set($key, $value);
  25. }
  26. $this->instance = new static::$className($purifierConfig);
  27. }
  28. }