提交的内容
This commit is contained in:
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Border.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Border.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Color.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Color.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Composite.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Composite.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Filter.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Filter.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Font.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Font.php
vendored
Executable file → Normal file
32
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php
vendored
Executable file → Normal file
32
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php
vendored
Executable file → Normal file
@ -10,23 +10,21 @@ class HTMLPurifier_AttrDef_CSS_FontFamily extends HTMLPurifier_AttrDef
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->mask = '_- ';
|
||||
for ($c = 'a'; $c <= 'z'; $c++) {
|
||||
$this->mask .= $c;
|
||||
}
|
||||
for ($c = 'A'; $c <= 'Z'; $c++) {
|
||||
$this->mask .= $c;
|
||||
}
|
||||
for ($c = '0'; $c <= '9'; $c++) {
|
||||
$this->mask .= $c;
|
||||
} // cast-y, but should be fine
|
||||
// special bytes used by UTF-8
|
||||
for ($i = 0x80; $i <= 0xFF; $i++) {
|
||||
// We don't bother excluding invalid bytes in this range,
|
||||
// because the our restriction of well-formed UTF-8 will
|
||||
// prevent these from ever occurring.
|
||||
$this->mask .= chr($i);
|
||||
}
|
||||
// Lowercase letters
|
||||
$l = range('a', 'z');
|
||||
// Uppercase letters
|
||||
$u = range('A', 'Z');
|
||||
// Digits
|
||||
$d = range('0', '9');
|
||||
// Special bytes used by UTF-8
|
||||
$b = array_map('chr', range(0x80, 0xFF));
|
||||
// All valid characters for the mask
|
||||
$c = array_merge($l, $u, $d, $b);
|
||||
// Concatenate all valid characters into a string
|
||||
// Use '_- ' as an initial value
|
||||
$this->mask = array_reduce($c, function ($carry, $value) {
|
||||
return $carry . $value;
|
||||
}, '_- ');
|
||||
|
||||
/*
|
||||
PHP's internal strcspn implementation is
|
||||
|
||||
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Ident.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Ident.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Length.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Length.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ListStyle.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/ListStyle.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Multiple.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Multiple.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Number.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Number.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Percentage.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Percentage.php
vendored
Executable file → Normal file
46
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Ratio.php
vendored
Normal file
46
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Ratio.php
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Validates a ratio as defined by the CSS spec.
|
||||
*/
|
||||
class HTMLPurifier_AttrDef_CSS_Ratio extends HTMLPurifier_AttrDef
|
||||
{
|
||||
/**
|
||||
* @param string $ratio Ratio to validate
|
||||
* @param HTMLPurifier_Config $config Configuration options
|
||||
* @param HTMLPurifier_Context $context Context
|
||||
*
|
||||
* @return string|boolean
|
||||
*
|
||||
* @warning Some contexts do not pass $config, $context. These
|
||||
* variables should not be used without checking HTMLPurifier_Length
|
||||
*/
|
||||
public function validate($ratio, $config, $context)
|
||||
{
|
||||
$ratio = $this->parseCDATA($ratio);
|
||||
|
||||
$parts = explode('/', $ratio, 2);
|
||||
$length = count($parts);
|
||||
|
||||
if ($length < 1 || $length > 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$num = new \HTMLPurifier_AttrDef_CSS_Number();
|
||||
|
||||
if ($length === 1) {
|
||||
return $num->validate($parts[0], $config, $context);
|
||||
}
|
||||
|
||||
$num1 = $num->validate($parts[0], $config, $context);
|
||||
$num2 = $num->validate($parts[1], $config, $context);
|
||||
|
||||
if ($num1 === false || $num2 === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $num1 . '/' . $num2;
|
||||
}
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/URI.php
vendored
Executable file → Normal file
0
vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/URI.php
vendored
Executable file → Normal file
Reference in New Issue
Block a user