diff --git a/feeds/ical.php b/feeds/ical.php index 3066d412..c34742f4 100644 --- a/feeds/ical.php +++ b/feeds/ical.php @@ -14,11 +14,6 @@ if ( 'sp_calendar' !== get_post_type( $post ) ) { wp_die( __( 'ERROR: This is not a valid feed template.', 'sportspress' ), '', array( 'response' => 404 ) ); } -// Escapes a string of characters -function escapeString($string) { - return preg_replace('/([\,;])/','\\\$1', $string); -} - // Get events in calendar $calendar = new SP_Calendar( $post ); $events = $calendar->data(); @@ -82,7 +77,7 @@ foreach ( $events as $event): // Add details to location $address = sp_array_value( $meta, 'sp_address', false ); if ( false !== $address ) { - $location = $venue->name . '\, ' . escapeString($address); + $location = $venue->name . '\, ' . preg_replace('/([\,;])/','\\\$1', $address); } // Generate geo tag @@ -135,8 +130,8 @@ foreach ( $events as $event): // Append to output string $output .= "BEGIN:VEVENT\n" . - "SUMMARY:" . escapeString($summary) . "\n" . - "DESCRIPTION:" . escapeString($event->post_content) . "\n" . + "SUMMARY:" . preg_replace('/([\,;])/','\\\$1', $summary) . "\n" . + "DESCRIPTION:" . preg_replace('/([\,;])/','\\\$1', $event->post_content) . "\n" . "UID:$event->ID\n" . "STATUS:CONFIRMED\n" . "DTSTART:" . mysql2date( $date_format, $event->post_date ) . "\n" .