simple.php
来自「很棒的在线教学系统」· PHP 代码 · 共 37 行
PHP
37 行
<?phprequire_once 'HTMLPurifier/TagTransform.php';/** * Simple transformation, just change tag name to something else, * and possibly add some styling. This will cover most of the deprecated * tag cases. */class HTMLPurifier_TagTransform_Simple extends HTMLPurifier_TagTransform{ var $style; /** * @param $transform_to Tag name to transform to. * @param $style CSS style to add to the tag */ function HTMLPurifier_TagTransform_Simple($transform_to, $style = null) { $this->transform_to = $transform_to; $this->style = $style; } function transform($tag, $config, &$context) { $new_tag = $tag->copy(); $new_tag->name = $this->transform_to; if (!is_null($this->style) && ($new_tag->type == 'start' || $new_tag->type == 'empty') ) { $this->prependCSS($new_tag->attr, $this->style); } return $new_tag; } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?