function date_ical_escape_text in Date 7.3
Same name and namespace in other branches
- 5.2 date_api_ical.inc \date_ical_escape_text()
- 5 date_api_ical.inc \date_ical_escape_text()
- 5 date_ical.inc \date_ical_escape_text()
- 6.2 date_api_ical.inc \date_ical_escape_text()
- 6 date_api_ical.inc \date_ical_escape_text()
- 7 date_api/date_api_ical.inc \date_ical_escape_text()
- 7.2 date_api/date_api_ical.inc \date_ical_escape_text()
Escape #text elements for safe iCal use.
Parameters
string $text: Text to escape.
Return value
string Escaped text
File
- date_api/date_api_ical.inc, line 639 
- Parse iCal data.
Code
function date_ical_escape_text($text) {
  $text = drupal_html_to_text($text);
  $text = trim($text);
  // @todo Per #38130 the iCal specs don't want : and " escaped but there was
  // some reason for adding this in. Need to watch this and see if anything
  // breaks.
  // $text = str_replace('"', '\"', $text);
  // $text = str_replace(":", "\:", $text);
  $text = preg_replace("/\\\\b/", "\\\\", $text);
  $text = str_replace(",", "\\,", $text);
  $text = str_replace(";", "\\;", $text);
  $text = str_replace("\n", "\\n ", $text);
  return trim($text);
}