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

📄 pixels.php

📁 很棒的在线教学系统
💻 PHP
字号:
<?phprequire_once 'HTMLPurifier/AttrDef.php';/** * Validates an integer representation of pixels according to the HTML spec. */class HTMLPurifier_AttrDef_HTML_Pixels extends HTMLPurifier_AttrDef{        var $max;        function HTMLPurifier_AttrDef_HTML_Pixels($max = null) {        $this->max = $max;    }        function validate($string, $config, &$context) {                $string = trim($string);        if ($string === '0') return $string;        if ($string === '')  return false;        $length = strlen($string);        if (substr($string, $length - 2) == 'px') {            $string = substr($string, 0, $length - 2);        }        if (!is_numeric($string)) return false;        $int = (int) $string;                if ($int < 0) return '0';                // upper-bound value, extremely high values can        // crash operating systems, see <http://ha.ckers.org/imagecrash.html>        // WARNING, above link WILL crash you if you're using Windows                if ($this->max !== null && $int > $this->max) return (string) $this->max;                return (string) $int;            }        function make($string) {        if ($string === '') $max = null;        else $max = (int) $string;        $class = get_class($this);        return new $class($max);    }    }

⌨️ 快捷键说明

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