diff options
author | Manuel Jiménez Friaza <mjfriaza@openmailbox.org> | 2019-05-19 13:25:00 +0200 |
---|---|---|
committer | Manuel Jiménez Friaza <mjfriaza@openmailbox.org> | 2019-05-19 13:25:00 +0200 |
commit | 429140df97a2c273fba6974147ac2e48e7688263 (patch) | |
tree | 2e337542da1b0f4c9c383dfeb8a7d9eb63990a72 /vendor/sabre/vobject/lib/StringUtil.php | |
parent | f92d2e3f7c6573bd7bab04223c7e28662605c6d8 (diff) | |
parent | af2b263bc74b16601ec7c123a58f0549613aed27 (diff) | |
download | volse-hubzilla-429140df97a2c273fba6974147ac2e48e7688263.tar.gz volse-hubzilla-429140df97a2c273fba6974147ac2e48e7688263.tar.bz2 volse-hubzilla-429140df97a2c273fba6974147ac2e48e7688263.zip |
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'vendor/sabre/vobject/lib/StringUtil.php')
-rw-r--r-- | vendor/sabre/vobject/lib/StringUtil.php | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/vendor/sabre/vobject/lib/StringUtil.php b/vendor/sabre/vobject/lib/StringUtil.php index b8615f2ba..2333d6ab9 100644 --- a/vendor/sabre/vobject/lib/StringUtil.php +++ b/vendor/sabre/vobject/lib/StringUtil.php @@ -9,8 +9,8 @@ namespace Sabre\VObject; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class StringUtil { - +class StringUtil +{ /** * Returns true or false depending on if a string is valid UTF-8. * @@ -18,15 +18,14 @@ class StringUtil { * * @return bool */ - static function isUTF8($str) { - + public static function isUTF8($str) + { // Control characters if (preg_match('%[\x00-\x08\x0B-\x0C\x0E\x0F]%', $str)) { return false; } - return (bool)preg_match('%%u', $str); - + return (bool) preg_match('%%u', $str); } /** @@ -39,12 +38,12 @@ class StringUtil { * * @return string */ - static function convertToUTF8($str) { - + public static function convertToUTF8($str) + { $encoding = mb_detect_encoding($str, ['UTF-8', 'ISO-8859-1', 'WINDOWS-1252'], true); switch ($encoding) { - case 'ISO-8859-1' : + case 'ISO-8859-1': $newStr = utf8_encode($str); break; /* Unreachable code. Not sure yet how we can improve this @@ -53,14 +52,11 @@ class StringUtil { $newStr = iconv('cp1252', 'UTF-8', $str); break; */ - default : + default: $newStr = $str; - } // Removing any control characters - return (preg_replace('%(?:[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F])%', '', $newStr)); - + return preg_replace('%(?:[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F])%', '', $newStr); } - } |