You are here

function date_ical_escape_text in Date 5

Same name in this branch
  1. 5 date_api_ical.inc \date_ical_escape_text()
  2. 5 date_ical.inc \date_ical_escape_text()
Same name and namespace in other branches
  1. 5.2 date_api_ical.inc \date_ical_escape_text()
  2. 6.2 date_api_ical.inc \date_ical_escape_text()
  3. 6 date_api_ical.inc \date_ical_escape_text()
  4. 7.3 date_api/date_api_ical.inc \date_ical_escape_text()
  5. 7 date_api/date_api_ical.inc \date_ical_escape_text()
  6. 7.2 date_api/date_api_ical.inc \date_ical_escape_text()

Escape #text elements for safe iCal use

Parameters

$text: Text to escape

Return value

Escaped text

2 calls to date_ical_escape_text()
date_ical_export in ./date_api_ical.inc
Turn an array of events into a valid iCalendar file
date_ical_export in ./date_ical.inc
Turn an array of events into a valid iCalendar file

File

./date_api_ical.inc, line 91
Parse iCal imports and create iCal exports. This file must be included when these functions are needed.

Code

function date_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;
}