⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htmldefinition.php

📁 基于Php和Mysql的项目管理软件
💻 PHP
📖 第 1 页 / 共 2 页
字号:
              new HTMLPurifier_ChildDef_Optional("#PCDATA | p | $e_inline".                  " | $e_misc_inline");        }                $this->info['img']->child  =        $this->info['br']->child   =        $this->info['hr']->child   = new HTMLPurifier_ChildDef_Empty();                $this->info['pre']->child  = $e_pre_content;                $this->info['a']->child    = $e_a_content;                $this->info['table']->child = new HTMLPurifier_ChildDef_Table();                // not a real entity, watch the double underscore        $e__row = new HTMLPurifier_ChildDef_Required('tr');        $this->info['thead']->child = $e__row;        $this->info['tfoot']->child = $e__row;        $this->info['tbody']->child = $e__row;        $this->info['colgroup']->child = new HTMLPurifier_ChildDef_Optional('col');        $this->info['col']->child = new HTMLPurifier_ChildDef_Empty();        $this->info['tr']->child = new HTMLPurifier_ChildDef_Required('th | td');        $this->info['th']->child = $e_Flow;        $this->info['td']->child = $e_Flow;                //////////////////////////////////////////////////////////////////////        // info[]->type : defines the type of the element (block or inline)                // reuses $e_Inline and $e_Block        foreach ($e_Inline->elements as $name => $bool) {            if ($name == '#PCDATA') continue;            $this->info[$name]->type = 'inline';        }                foreach ($e_Block->elements as $name => $bool) {            $this->info[$name]->type = 'block';        }                foreach ($e_Flow->elements as $name => $bool) {            $this->info_flow_elements[$name] = true;        }                //////////////////////////////////////////////////////////////////////        // info[]->excludes : defines elements that aren't allowed in here                // make sure you test using isset() and not !empty()                $this->info['a']->excludes = array('a' => true);        $this->info['pre']->excludes = array_flip(array('img', 'big', 'small',            // technically useless, but good to be indepth            'object', 'applet', 'font', 'basefont'));                //////////////////////////////////////////////////////////////////////        // info[]->attr : defines allowed attributes for elements                // this doesn't include REQUIRED declarations, those are handled        // by the transform classes. It will, however, do simple and slightly        // complex attribute value substitution                // the question of varying allowed attributes is more entangling.                $e_Text = new HTMLPurifier_AttrDef_Text();                // attrs, included in almost every single one except for a few,        // which manually override these in their local definitions        $this->info_global_attr = array(            // core attrs            'class' => new HTMLPurifier_AttrDef_Class(),            'title' => $e_Text,            'style' => new HTMLPurifier_AttrDef_CSS(),            // i18n            'dir'   => new HTMLPurifier_AttrDef_Enum(array('ltr','rtl'), false),            'lang'  => new HTMLPurifier_AttrDef_Lang(),            'xml:lang' => new HTMLPurifier_AttrDef_Lang(),            );                if ($config->get('HTML', 'EnableAttrID')) {            $this->info_global_attr['id'] = new HTMLPurifier_AttrDef_ID();        }                // required attribute stipulation handled in attribute transformation        $this->info['bdo']->attr = array(); // nothing else                $this->info['br']->attr['dir'] = false;        $this->info['br']->attr['lang'] = false;        $this->info['br']->attr['xml:lang'] = false;                $this->info['td']->attr['abbr'] = $e_Text;        $this->info['th']->attr['abbr'] = $e_Text;                $this->setAttrForTableElements('align', new HTMLPurifier_AttrDef_Enum(            array('left', 'center', 'right', 'justify', 'char'), false));                $this->setAttrForTableElements('valign', new HTMLPurifier_AttrDef_Enum(            array('top', 'middle', 'bottom', 'baseline'), false));                $this->info['img']->attr['alt'] = $e_Text;                $e_TFrame = new HTMLPurifier_AttrDef_Enum(array('void', 'above',            'below', 'hsides', 'lhs', 'rhs', 'vsides', 'box', 'border'), false);        $this->info['table']->attr['frame'] = $e_TFrame;                $e_TRules = new HTMLPurifier_AttrDef_Enum(array('none', 'groups',            'rows', 'cols', 'all'), false);        $this->info['table']->attr['rules'] = $e_TRules;                $this->info['table']->attr['summary'] = $e_Text;                $this->info['table']->attr['border'] =            new HTMLPurifier_AttrDef_Pixels();                $e_Length = new HTMLPurifier_AttrDef_Length();        $this->info['table']->attr['cellpadding'] =        $this->info['table']->attr['cellspacing'] =        $this->info['table']->attr['width'] =        $this->info['img']->attr['height'] =        $this->info['img']->attr['width'] = $e_Length;        $this->setAttrForTableElements('charoff', $e_Length);                $e_MultiLength = new HTMLPurifier_AttrDef_MultiLength();        $this->info['col']->attr['width'] =        $this->info['colgroup']->attr['width'] = $e_MultiLength;                $e__NumberSpan = new HTMLPurifier_AttrDef_Integer(false, false, true);        $this->info['colgroup']->attr['span'] =        $this->info['col']->attr['span']   =        $this->info['td']->attr['rowspan'] =        $this->info['th']->attr['rowspan'] =         $this->info['td']->attr['colspan'] =        $this->info['th']->attr['colspan'] = $e__NumberSpan;                if (!$config->get('Attr', 'DisableURI')) {            $e_URI = new HTMLPurifier_AttrDef_URI();            $this->info['a']->attr['href'] =            $this->info['img']->attr['longdesc'] =            $this->info['del']->attr['cite'] =            $this->info['ins']->attr['cite'] =            $this->info['blockquote']->attr['cite'] =            $this->info['q']->attr['cite'] = $e_URI;                        // URI that causes HTTP request            $this->info['img']->attr['src'] = new HTMLPurifier_AttrDef_URI(true);        }                if (!$this->strict) {            $this->info['li']->attr['value'] = new HTMLPurifier_AttrDef_Integer();            $this->info['ol']->attr['start'] = new HTMLPurifier_AttrDef_Integer();        }                //////////////////////////////////////////////////////////////////////        // info_tag_transform : transformations of tags                $this->info_tag_transform['font']   = new HTMLPurifier_TagTransform_Font();        $this->info_tag_transform['menu']   = new HTMLPurifier_TagTransform_Simple('ul');        $this->info_tag_transform['dir']    = new HTMLPurifier_TagTransform_Simple('ul');        $this->info_tag_transform['center'] = new HTMLPurifier_TagTransform_Center();                //////////////////////////////////////////////////////////////////////        // info[]->auto_close : tags that automatically close another                // todo: determine whether or not SGML-like modeling based on        // mandatory/optional end tags would be a better policy                // make sure you test using isset() not !empty()                // these are all block elements: blocks aren't allowed in P        $this->info['p']->auto_close = array_flip(array(                'address', 'blockquote', 'dd', 'dir', 'div', 'dl', 'dt',                'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'ol', 'p', 'pre',                'table', 'ul'            ));                $this->info['li']->auto_close = array('li' => true);                // we need TABLE and heading mismatch code        // we may need to make this more flexible for heading mismatch,        // or we can just create another info                //////////////////////////////////////////////////////////////////////        // info[]->attr_transform_* : attribute transformations in elements        // pre is applied before any validation is done, post is done after                $this->info['h1']->attr_transform_pre[] =        $this->info['h2']->attr_transform_pre[] =        $this->info['h3']->attr_transform_pre[] =        $this->info['h4']->attr_transform_pre[] =        $this->info['h5']->attr_transform_pre[] =        $this->info['h6']->attr_transform_pre[] =        $this->info['p'] ->attr_transform_pre[] =                     new HTMLPurifier_AttrTransform_TextAlign();                $this->info['bdo']->attr_transform_post[] =                    new HTMLPurifier_AttrTransform_BdoDir();                $this->info['img']->attr_transform_post[] =                    new HTMLPurifier_AttrTransform_ImgRequired();                //////////////////////////////////////////////////////////////////////        // info_attr_transform_* : global attribute transformation that is        // unconditionally called. Good for transformations that have complex        // start conditions        // pre is applied before any validation is done, post is done after                $this->info_attr_transform_post[] = new HTMLPurifier_AttrTransform_Lang();                // protect against stdclasses floating around        foreach ($this->info as $key => $obj) {            if (is_a($obj, 'stdclass')) {                unset($this->info[$key]);            }        }                //////////////////////////////////////////////////////////////////////        // info_block_wrapper : wraps inline elements in block context                $block_wrapper = $config->get('HTML', 'BlockWrapper');        if (isset($e_Block->elements[$block_wrapper])) {            $this->info_block_wrapper = $block_wrapper;        } else {            trigger_error('Cannot use non-block element as block wrapper.',                E_USER_ERROR);        }                //////////////////////////////////////////////////////////////////////        // info_parent : parent element of the HTML fragment                $parent = $config->get('HTML', 'Parent');        if (isset($this->info[$parent])) {            $this->info_parent = $parent;        } else {            trigger_error('Cannot use unrecognized element as parent.',                E_USER_ERROR);        }        $this->info_parent_def = $this->info[$this->info_parent];                //////////////////////////////////////////////////////////////////////        // %HTML.Allowed(Elements|Attributes) : cut non-allowed elements                $allowed_elements = $config->get('HTML', 'AllowedElements');        if (is_array($allowed_elements)) {            foreach ($this->info as $name => $d) {                if(!isset($allowed_elements[$name])) unset($this->info[$name]);            }        }        $allowed_attributes = $config->get('HTML', 'AllowedAttributes');        if (is_array($allowed_attributes)) {            foreach ($this->info_global_attr as $attr_key => $info) {                if (!isset($allowed_attributes["*.$attr_key"])) {                    unset($this->info_global_attr[$attr_key]);                }            }            foreach ($this->info as $tag => $info) {                foreach ($info->attr as $attr => $attr_info) {                    if (!isset($allowed_attributes["$tag.$attr"])) {                        unset($this->info[$tag]->attr[$attr]);                    }                }            }        }    }        function setAttrForTableElements($attr, $def) {        $this->info['col']->attr[$attr] =         $this->info['colgroup']->attr[$attr] =         $this->info['tbody']->attr[$attr] =         $this->info['td']->attr[$attr] =         $this->info['tfoot']->attr[$attr] =         $this->info['th']->attr[$attr] =         $this->info['thead']->attr[$attr] =         $this->info['tr']->attr[$attr] = $def;    }    }/** * Structure that stores an element definition. */class HTMLPurifier_ElementDef{        /**     * Associative array of attribute name to HTMLPurifier_AttrDef     * @public     */    var $attr = array();        /**     * List of tag's HTMLPurifier_AttrTransform to be done before validation     * @public     */    var $attr_transform_pre = array();        /**     * List of tag's HTMLPurifier_AttrTransform to be done after validation     * @public     */    var $attr_transform_post = array();        /**     * Lookup table of tags that close this tag.     * @public     */    var $auto_close = array();        /**     * HTMLPurifier_ChildDef of this tag.     * @public     */    var $child;        /**     * Type of the tag: inline or block or unknown?     * @public     */    var $type = 'unknown';        /**     * Lookup table of tags excluded from all descendants of this tag.     * @public     */    var $excludes = array();    }?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -