Replace function with return string
This commit is contained in:
@@ -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 ) );
|
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
|
// Get events in calendar
|
||||||
$calendar = new SP_Calendar( $post );
|
$calendar = new SP_Calendar( $post );
|
||||||
$events = $calendar->data();
|
$events = $calendar->data();
|
||||||
@@ -82,7 +77,7 @@ foreach ( $events as $event):
|
|||||||
// Add details to location
|
// Add details to location
|
||||||
$address = sp_array_value( $meta, 'sp_address', false );
|
$address = sp_array_value( $meta, 'sp_address', false );
|
||||||
if ( false !== $address ) {
|
if ( false !== $address ) {
|
||||||
$location = $venue->name . '\, ' . escapeString($address);
|
$location = $venue->name . '\, ' . preg_replace('/([\,;])/','\\\$1', $address);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate geo tag
|
// Generate geo tag
|
||||||
@@ -135,8 +130,8 @@ foreach ( $events as $event):
|
|||||||
// Append to output string
|
// Append to output string
|
||||||
$output .=
|
$output .=
|
||||||
"BEGIN:VEVENT\n" .
|
"BEGIN:VEVENT\n" .
|
||||||
"SUMMARY:" . escapeString($summary) . "\n" .
|
"SUMMARY:" . preg_replace('/([\,;])/','\\\$1', $summary) . "\n" .
|
||||||
"DESCRIPTION:" . escapeString($event->post_content) . "\n" .
|
"DESCRIPTION:" . preg_replace('/([\,;])/','\\\$1', $event->post_content) . "\n" .
|
||||||
"UID:$event->ID\n" .
|
"UID:$event->ID\n" .
|
||||||
"STATUS:CONFIRMED\n" .
|
"STATUS:CONFIRMED\n" .
|
||||||
"DTSTART:" . mysql2date( $date_format, $event->post_date ) . "\n" .
|
"DTSTART:" . mysql2date( $date_format, $event->post_date ) . "\n" .
|
||||||
|
|||||||
Reference in New Issue
Block a user