diff options
author | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2018-05-04 22:44:22 +0200 |
---|---|---|
committer | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2018-05-09 21:07:25 +0200 |
commit | dafe0afa65171f55146f49f3d45fb4c126073be9 (patch) | |
tree | ecdff36542dad91aa54023b6d6fb928ce5168718 /vendor/sabre/vobject/lib/Property | |
parent | 30d0f9888c049f487769f34d2cce51560bc5925e (diff) | |
download | volse-hubzilla-dafe0afa65171f55146f49f3d45fb4c126073be9.tar.gz volse-hubzilla-dafe0afa65171f55146f49f3d45fb4c126073be9.tar.bz2 volse-hubzilla-dafe0afa65171f55146f49f3d45fb4c126073be9.zip |
:arrow_up: Update libraries.
Updating smarty/smarty (v3.1.31 => v3.1.32)
Updating sabre/vobject (4.1.5 => 4.1.6)
Diffstat (limited to 'vendor/sabre/vobject/lib/Property')
-rw-r--r-- | vendor/sabre/vobject/lib/Property/Text.php | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/vendor/sabre/vobject/lib/Property/Text.php b/vendor/sabre/vobject/lib/Property/Text.php index bb7ab34ee..47a86ccc9 100644 --- a/vendor/sabre/vobject/lib/Property/Text.php +++ b/vendor/sabre/vobject/lib/Property/Text.php @@ -213,16 +213,16 @@ class Text extends Property { $val = $this->getParts(); if (isset($this->minimumPropertyValues[$this->name])) { - $val = array_pad($val, $this->minimumPropertyValues[$this->name], ''); + $val = \array_pad($val, $this->minimumPropertyValues[$this->name], ''); } // Imploding multiple parts into a single value, and splitting the // values with ;. - if (count($val) > 1) { + if (\count($val) > 1) { foreach ($val as $k => $v) { - $val[$k] = str_replace(';', '\;', $v); + $val[$k] = \str_replace(';', '\;', $v); } - $val = implode(';', $val); + $val = \implode(';', $val); } else { $val = $val[0]; } @@ -242,7 +242,7 @@ class Text extends Property { // If the resulting value contains a \n, we must encode it as // quoted-printable. - if (strpos($val, "\n") !== false) { + if (\strpos($val, "\n") !== false) { $str .= ';ENCODING=QUOTED-PRINTABLE:'; $lastLine = $str; @@ -252,40 +252,39 @@ class Text extends Property { // encode newlines for us. Specifically, the \r\n sequence must in // vcards be encoded as =0D=OA and we must insert soft-newlines // every 75 bytes. - for ($ii = 0;$ii < strlen($val);$ii++) { - $ord = ord($val[$ii]); + for ($ii = 0;$ii < \strlen($val);$ii++) { + $ord = \ord($val[$ii]); // These characters are encoded as themselves. if ($ord >= 32 && $ord <= 126) { $lastLine .= $val[$ii]; } else { - $lastLine .= '=' . strtoupper(bin2hex($val[$ii])); + $lastLine .= '=' . \strtoupper(\bin2hex($val[$ii])); } - if (strlen($lastLine) >= 75) { + if (\strlen($lastLine) >= 75) { // Soft line break $out .= $lastLine . "=\r\n "; $lastLine = null; } } - if (!is_null($lastLine)) $out .= $lastLine . "\r\n"; + if (!\is_null($lastLine)) $out .= $lastLine . "\r\n"; return $out; } else { $str .= ':' . $val; - $out = ''; - while (strlen($str) > 0) { - if (strlen($str) > 75) { - $part = mb_strcut($str, 0, 75, 'utf-8'); - $out .= $part . "\r\n"; - $str = ' ' . substr($str, strlen($part)); - } else { - $out .= $str . "\r\n"; - $str = ''; - break; - } - } - return $out; + $str = \preg_replace( + '/( + (?:^.)? # 1 additional byte in first line because of missing single space (see next line) + .{1,74} # max 75 bytes per line (1 byte is used for a single space added after every CRLF) + (?![\x80-\xbf]) # prevent splitting multibyte characters + )/x', + "$1\r\n ", + $str + ); + + // remove single space after last CRLF + return \substr($str, 0, -1); } |