You are here

public static function DateiCalParse::parse_text in Date 8

Parse and clean up ical text elements.

1 call to DateiCalParse::parse_text()
DateiCalParse::parse in date_api/lib/Drupal/date_api/DateiCalParse.php
Returns an array of iCalendar information from an iCalendar file.

File

date_api/lib/Drupal/date_api/DateiCalParse.php, line 538
Parse iCal data.

Class

DateiCalParse
Return an array of iCalendar information from an iCalendar file.

Namespace

Drupal\date_api

Code

public static function parse_text($data, $field = '') {
  if (strstr($field, 'QUOTED-PRINTABLE')) {
    $data = quoted_printable_decode($data);
  }

  // Strip line breaks within element.
  $data = str_replace(array(
    "\r\n ",
    "\n ",
    "\r ",
  ), '', $data);

  // Put in line breaks where encoded.
  $data = str_replace(array(
    "\\n",
    "\\N",
  ), "\n", $data);

  // Remove other escaping.
  $data = stripslashes($data);
  return $data;
}