private function XCalFormatView::ical_split in Services 6.3
1 call to XCalFormatView::ical_split()
- XCalFormatView::ical_value in servers/
rest_server/ formats/ XCalFormatView.inc
File
- servers/
rest_server/ formats/ XCalFormatView.inc, line 70 - This file will parse the xcal view for the rest server
Class
- XCalFormatView
- @file This file will parse the xcal view for the rest server
Code
private function ical_split($preamble, $value) {
$value = trim($value);
$value = strip_tags($value);
$value = preg_replace('/\\n+/', ' ', $value);
$value = preg_replace('/\\s{2,}/', ' ', $value);
$preamble_len = drupal_strlen($preamble);
$lines = array();
while (drupal_strlen($value) > 75 - $preamble_len) {
$space = 75 - $preamble_len;
$mbcc = $space;
while ($mbcc) {
$line = mb_substr($value, 0, $mbcc);
$oct = drupal_strlen($line);
if ($oct > $space) {
$mbcc -= $oct - $space;
}
else {
$lines[] = $line;
$preamble_len = 1;
// Still take the tab into account
$value = mb_substr($value, $mbcc);
break;
}
}
}
if (!empty($value)) {
$lines[] = $value;
}
return join($lines, "\n ");
}