function ical_escape_text in Event 5.2
Same name and namespace in other branches
- 5 ical.inc \ical_escape_text()
Escape #text elements for safe iCal use
Parameters
$text: Text to escape
Return value
Escaped text
1 call to ical_escape_text()
- ical_export in ./
ical.inc - Turn an array of events into a valid iCalendar file
File
- ./
ical.inc, line 74 - API for event import/export in iCalendar format as outlined in Internet Calendaring and Scheduling Core Object Specification http://www.ietf.org/rfc/rfc2445.txt
Code
function ical_escape_text($text) {
//$text = strip_tags($text);
$text = str_replace('"', '\\"', $text);
$text = str_replace("\\", "\\\\", $text);
$text = str_replace(",", "\\,", $text);
$text = str_replace(":", "\\:", $text);
$text = str_replace(";", "\\;", $text);
$text = str_replace("\n", "\n ", $text);
return $text;
}