Changeset View
Changeset View
Standalone View
Standalone View
src/applications/calendar/parser/ics/PhutilICSWriter.php
Context not available. | |||||
foreach (phutil_utf8v($line) as $character) { | foreach (phutil_utf8v($line) as $character) { | ||||
// If adding this character would bring the line over 75 bytes, start | // If adding this character would bring the line over 75 bytes, start | ||||
// a new line. | // a new line. | ||||
if (strlen($buf) + strlen($character) > 75) { | if (@strlen($buf) + @strlen($character) > 75) { | ||||
$out[] = $buf."\r\n"; | $out[] = $buf."\r\n"; | ||||
$buf = ' '; | $buf = ' '; | ||||
} | } | ||||
Context not available. | |||||
$properties = array(); | $properties = array(); | ||||
$uid = $event->getUID(); | $uid = $event->getUID(); | ||||
if (!strlen($uid)) { | if (!@strlen($uid)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Unable to write ICS document: event has no UID, but each event '. | 'Unable to write ICS document: event has no UID, but each event '. | ||||
Context not available. | |||||
} | } | ||||
$name = $event->getName(); | $name = $event->getName(); | ||||
if (strlen($name)) { | if (@strlen($name)) { | ||||
$properties[] = $this->newTextProperty( | $properties[] = $this->newTextProperty( | ||||
'SUMMARY', | 'SUMMARY', | ||||
$name); | $name); | ||||
} | } | ||||
$description = $event->getDescription(); | $description = $event->getDescription(); | ||||
if (strlen($description)) { | if (@strlen($description)) { | ||||
$properties[] = $this->newTextProperty( | $properties[] = $this->newTextProperty( | ||||
'DESCRIPTION', | 'DESCRIPTION', | ||||
$description); | $description); | ||||
Context not available. | |||||
// RFC5545 says that we MUST quote it if it has a colon, a semicolon, | // RFC5545 says that we MUST quote it if it has a colon, a semicolon, | ||||
// or a comma, and that we MUST quote it if it's a URI. | // or a comma, and that we MUST quote it if it's a URI. | ||||
if (!preg_match('/^[A-Za-z0-9-]*\z/', $v)) { | if (!@preg_match('/^[A-Za-z0-9-]*\z/', $v)) { | ||||
$v = '"'.$v.'"'; | $v = '"'.$v.'"'; | ||||
} | } | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0