public static function DateiCalParse::escape_text in Date 8
Escape #text elements for safe iCal use.
Parameters
string $text: Text to escape
Return value
string Escaped text
File
- date_api/
lib/ Drupal/ date_api/ DateiCalParse.php, line 621 - Parse iCal data.
Class
- DateiCalParse
- Return an array of iCalendar information from an iCalendar file.
Namespace
Drupal\date_apiCode
public static function 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);
}