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

📄 csslength.php

📁 基于Php和Mysql的项目管理软件
💻 PHP
字号:
<?phprequire_once 'HTMLPurifier/AttrDef.php';require_once 'HTMLPurifier/AttrDef/Number.php';/** * Represents a Length as defined by CSS. * @warning Be sure not to confuse this with HTMLPurifier_AttrDef_Length! */class HTMLPurifier_AttrDef_CSSLength extends HTMLPurifier_AttrDef{        /**     * Valid unit lookup table.     * @warning The code assumes all units are two characters long.  Be careful     *          if we have to change this behavior!     */    var $units = array('em' => true, 'ex' => true, 'px' => true, 'in' => true,         'cm' => true, 'mm' => true, 'pt' => true, 'pc' => true);    /**     * Instance of HTMLPurifier_AttrDef_Number to defer number validation to     */    var $number_def;        /**     * @param $non_negative Bool indication whether or not negative values are     *                      allowed.     */    function HTMLPurifier_AttrDef_CSSLength($non_negative = false) {        $this->number_def = new HTMLPurifier_AttrDef_Number($non_negative);    }        function validate($length, $config, &$context) {                $length = $this->parseCDATA($length);        if ($length === '') return false;        if ($length === '0') return '0';        $strlen = strlen($length);        if ($strlen === 1) return false; // impossible!                // we assume all units are two characters        $unit = substr($length, $strlen - 2);        $number = substr($length, 0, $strlen - 2);                if (!isset($this->units[$unit])) return false;                $number = $this->number_def->validate($number, $config, $context);        if ($number === false) return false;                return $number . $unit;            }    }?>

⌨️ 快捷键说明

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