Fix Lines not delimited by CRLF sequence near line # 1 error

This commit is contained in:
savvasha
2019-01-27 11:55:06 +02:00
parent b821d6960b
commit 968f3e6435

View File

@@ -32,21 +32,21 @@ $url = add_query_arg( 'feed', 'sp-ical', get_post_permalink( $post ) );
$url = wordwrap( $url , 60, "\n\t", true );
$output =
"BEGIN:VCALENDAR\n" .
"VERSION:2.0\n" .
"PRODID:-//ThemeBoy//SportsPress//" . strtoupper( $locale ) . "\n" .
"CALSCALE:GREGORIAN\n" .
"METHOD:PUBLISH\n" .
"URL:" . $url . "\n" .
"X-FROM-URL:" . $url . "\n" .
"NAME:" . $post->post_title . "\n" .
"X-WR-CALNAME:" . $post->post_title . "\n" .
"DESCRIPTION:" . $post->post_title . "\n" .
"X-WR-CALDESC:" . $post->post_title . "\n" .
"REFRESH-INTERVAL;VALUE=DURATION:PT2M\n" .
"X-PUBLISHED-TTL:PT2M\n" .
"TZID:" . $timezone . "\n" .
"X-WR-TIMEZONE:" . $timezone . "\n";
"BEGIN:VCALENDAR\r\n" .
"VERSION:2.0\r\n" .
"PRODID:-//ThemeBoy//SportsPress//" . strtoupper( $locale ) . "\r\n" .
"CALSCALE:GREGORIAN\r\n" .
"METHOD:PUBLISH\r\n" .
"URL:" . $url . "\r\n" .
"X-FROM-URL:" . $url . "\r\n" .
"NAME:" . $post->post_title . "\r\n" .
"X-WR-CALNAME:" . $post->post_title . "\r\n" .
"DESCRIPTION:" . $post->post_title . "\r\n" .
"X-WR-CALDESC:" . $post->post_title . "\r\n" .
"REFRESH-INTERVAL;VALUE=DURATION:PT2M\r\n" .
"X-PUBLISHED-TTL:PT2M\r\n" .
"TZID:" . $timezone . "\r\n" .
"X-WR-TIMEZONE:" . $timezone . "\r\n";
// Loop through each event
foreach ( $events as $event):
@@ -96,7 +96,7 @@ foreach ( $events as $event):
$geo = false;
}
}
$location = wordwrap( $location , 60, "\n\t" );
$location = wordwrap( $location , 60, "\r\n\t" );
// Get title or write summary based on scores
$results = array();
@@ -137,28 +137,28 @@ foreach ( $events as $event):
// Append to output string
$output .=
"BEGIN:VEVENT\n" .
"SUMMARY:" . preg_replace('/([\,;])/','\\\$1', $summary) . "\n" .
"UID:$event->ID\n" .
"STATUS:CONFIRMED\n" .
"DTSTAMP:19700101T000000\n".
"DTSTART:" . mysql2date( $date_format, $event->post_date ) . "\n" .
"DTEND:" . $end->format( $date_format ) . "\n" .
"LAST-MODIFIED:" . mysql2date( $date_format, $event->post_modified_gmt ) . "\n";
"BEGIN:VEVENT\r\n" .
"SUMMARY:" . preg_replace('/([\,;])/','\\\$1', $summary) . "\r\n" .
"UID:$event->ID\r\n" .
"STATUS:CONFIRMED\r\n" .
"DTSTAMP:19700101T000000\r\n".
"DTSTART:" . mysql2date( $date_format, $event->post_date ) . "\r\n" .
"DTEND:" . $end->format( $date_format ) . "\r\n" .
"LAST-MODIFIED:" . mysql2date( $date_format, $event->post_modified_gmt ) . "\r\n";
if ( $description ) {
$output .= "DESCRIPTION:" . $description . "\n";
$output .= "DESCRIPTION:" . $description . "\r\n";
}
if ( $location ) {
$output .= "LOCATION:" . $location . "\n";
$output .= "LOCATION:" . $location . "\r\n";
}
if ( $geo ) {
$output .= "GEO:" . $geo . "\n";
$output .= "GEO:" . $geo . "\r\n";
}
$output .= "END:VEVENT\n";
$output .= "END:VEVENT\r\n";
endforeach;
// End output