aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-03-22 08:37:29 +0000
committerMario <mario@mariovavti.com>2024-03-22 08:37:29 +0000
commit1aeb05628b6a2a069c46980efbe628362c9e3e74 (patch)
treee9aed15d0cd74e0c23dcb05c7be8fe9541efdf36 /vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef
parent5b7387459cf4de8f7354d81cb0392c4225714d94 (diff)
parentb464fae3bf22585888c5f3def8eded76fd48ed16 (diff)
downloadvolse-hubzilla-9.0.tar.gz
volse-hubzilla-9.0.tar.bz2
volse-hubzilla-9.0.zip
Merge branch '9.0RC'9.0
Diffstat (limited to 'vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef')
-rw-r--r--vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php32
-rw-r--r--vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php2
2 files changed, 16 insertions, 18 deletions
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php
index 74e24c881..f1ff11636 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php
@@ -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
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php
index 1beeaa5d2..ddc5dfbea 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php
@@ -106,7 +106,7 @@ class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
// If we have Net_IDNA2 support, we can support IRIs by
// punycoding them. (This is the most portable thing to do,
// since otherwise we have to assume browsers support
- } elseif ($config->get('Core.EnableIDNA')) {
+ } elseif ($config->get('Core.EnableIDNA') && class_exists('Net_IDNA2')) {
$idna = new Net_IDNA2(array('encoding' => 'utf8', 'overlong' => false, 'strict' => true));
// we need to encode each period separately
$parts = explode('.', $string);