| @@ -1,8 +1,18 @@ | ||
| 1 | 1 | <?php |
| 2 | -if(isset($event->post_title) && isset($event->time_start) && isset($event->time_end) && isset($event->post_excerpt) && isset($event->address) && isset($event->permalink)){ | |
| 3 | - $timezone_string = get_option('timezone_string'); | |
| 2 | +/** | |
| 3 | + * ICS Export | |
| 4 | + * | |
| 5 | + * @package event-post | |
| 6 | + * @version 6.1.2 | |
| 7 | + * @since 5.4 | |
| 8 | + */ | |
| 9 | + | |
| 10 | +if ( ! defined( 'ABSPATH' ) ) exit; | |
| 11 | + | |
| 12 | +if(isset($event->post_title) && isset($event->time_start) && isset($event->time_end) && isset($event->description) && isset($event->address) && isset($event->permalink)){ | |
| 4 | 13 | $gmt = $this->get_gmt_offset(); |
| 14 | + $post = get_post($event); | |
| 5 | 15 | $allday = ($post->time_start && $post->time_end && date('H:i:s', $post->time_start) == '00:00:00' && date('H:i:s', $post->time_end) == '00:00:00'); |
| 6 | 16 | $date_start = date("Ymd", $event->time_start) . ($allday ? '' : 'T' . date("His", $event->time_start)); |
| 7 | 17 | $date_end = date("Ymd", $event->time_end) . ($allday ? '' : 'T' . date("His", $event->time_end)); |
| 8 | 18 | header("content-type:text/".(isset($mime)?$mime:'calendar')); |
| @@ -11,9 +21,9 @@ | ||
| 11 | 21 | header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
| 12 | 22 | header("Cache-Control: public"); |
| 13 | 23 | header("Content-Disposition: attachment; filename=".$event->permalink.'.'.(isset($format)?$format:'ics').';' ); |
| 14 | 24 | |
| 15 | - $timezone_string = $_GET['tz']; | |
| 25 | + $timezone_string = get_option('timezone_string'); | |
| 16 | 26 | |
| 17 | 27 | $separator = "\n"; |
| 18 | 28 | |
| 19 | 29 | $props = array(); |
| @@ -19,9 +29,9 @@ | ||
| 19 | 29 | $props = array(); |
| 20 | 30 | |
| 21 | 31 | // General |
| 22 | 32 | $props[] = 'BEGIN:VCALENDAR'; |
| 23 | - $props[] = 'PRODID://WordPress//Event-Post V'. file_get_contents(('../VERSION')).'//EN'; | |
| 33 | + $props[] = 'PRODID://WordPress//Event-Post-V'. EventPost()->version .'//EN'; | |
| 24 | 34 | $props[] = 'VERSION:2.0'; |
| 25 | 35 | |
| 26 | 36 | // Timezone |
| 27 | 37 | if(!empty($timezone_string)){ |
| @@ -54,9 +64,9 @@ | ||
| 54 | 64 | 'LOCATION:'.stripslashes($event->address), |
| 55 | 65 | 'DTSTAMP:'.$date_start.(!empty($timezone_string)?'':'Z'), |
| 56 | 66 | 'DTSTART'.(!empty($timezone_string)?';TZID='.$timezone_string:'').':'.$date_start.(!empty($timezone_string)?'':'Z'), |
| 57 | 67 | 'DTEND'.(!empty($timezone_string)?';TZID='.$timezone_string:'').':'.$date_end.(!empty($timezone_string)?'':'Z'), |
| 58 | - 'DESCRIPTION:'.wordwrap($event->post_excerpt), | |
| 68 | + 'DESCRIPTION:'.wordwrap($event->description), | |
| 59 | 69 | 'END:VEVENT' |
| 60 | 70 | ); |
| 61 | 71 | |
| 62 | 72 | // End |
| @@ -61,6 +71,6 @@ | ||
| 61 | 71 | |
| 62 | 72 | // End |
| 63 | 73 | $props[] = 'END:VCALENDAR'; |
| 64 | 74 | |
| 65 | - echo implode($separator, $props); | |
| 66 | -} | |
| 75 | + echo wp_kses_post(implode($separator, $props)); | |
| 76 | +} | |