mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 23:55:55 +08:00
Resolve #448
This commit is contained in:
parent
d6de75e3b7
commit
ac7eaf3cc1
|
@ -249,7 +249,7 @@ class Component extends Node
|
|||
$result = [];
|
||||
foreach ($this->children as $childGroup) {
|
||||
foreach ($childGroup as $child) {
|
||||
if ($child instanceof Property && strtoupper($child->group) === $group) {
|
||||
if ($child instanceof Property && $child->group && strtoupper($child->group) === $group) {
|
||||
$result[] = $child;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -291,6 +291,11 @@ class VCard extends VObject\Document
|
|||
$this->FN = (string) $this->ORG;
|
||||
$repaired = true;
|
||||
|
||||
// Otherwise, the NICKNAME property may work
|
||||
} elseif (isset($this->NICKNAME)) {
|
||||
$this->FN = (string) $this->NICKNAME;
|
||||
$repaired = true;
|
||||
|
||||
// Otherwise, the EMAIL property may work
|
||||
} elseif (isset($this->EMAIL)) {
|
||||
$this->FN = (string) $this->EMAIL;
|
||||
|
|
|
@ -335,7 +335,7 @@ class Parameter extends Node
|
|||
*/
|
||||
public function xmlSerialize(Xml\Writer $writer)
|
||||
{
|
||||
foreach (is_array($this->value) ? $this->value : explode(',', $this->value) as $value) {
|
||||
foreach (explode(',', $this->value) as $value) {
|
||||
$writer->writeElement('text', $value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,11 @@ class CalAddress extends Text
|
|||
return $input;
|
||||
}
|
||||
list($schema, $everythingElse) = explode(':', $input, 2);
|
||||
$schema = strtolower($schema);
|
||||
if ('mailto' === $schema) {
|
||||
$everythingElse = strtolower($everythingElse);
|
||||
}
|
||||
|
||||
return strtolower($schema).':'.$everythingElse;
|
||||
return $schema.':'.$everythingElse;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,23 +40,11 @@ class StringUtil
|
|||
*/
|
||||
public static function convertToUTF8($str)
|
||||
{
|
||||
$encoding = mb_detect_encoding($str, ['UTF-8', 'ISO-8859-1', 'WINDOWS-1252'], true);
|
||||
|
||||
switch ($encoding) {
|
||||
case 'ISO-8859-1':
|
||||
$newStr = utf8_encode($str);
|
||||
break;
|
||||
/* Unreachable code. Not sure yet how we can improve this
|
||||
* situation.
|
||||
case 'WINDOWS-1252' :
|
||||
$newStr = iconv('cp1252', 'UTF-8', $str);
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
$newStr = $str;
|
||||
if (!mb_check_encoding($str, 'UTF-8') && mb_check_encoding($str, 'ISO-8859-1')) {
|
||||
$str = mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1');
|
||||
}
|
||||
|
||||
// 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])%', '', $str);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,5 +14,5 @@ class Version
|
|||
/**
|
||||
* Full version number.
|
||||
*/
|
||||
const VERSION = '4.4.1';
|
||||
const VERSION = '4.4.2';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue