Making WordPress.org

Changeset 480


Ignore:
Timestamp:
03/28/2014 03:59:02 PM (11 years ago)
Author:
iandunn
Message:

WordCamp Calendar: Explicitly send a full CRLF.

RFC 2445 requires a full CRLF, but previously we were just sending
n. That may not have mattered at all in the real world, but I've gotten reproducable reports of Google Calendar failing to import any of the events from the feed. This didn't end up fixing the problem, but I'm committing it anyway since the work is already done and it brings the output in line with the RFC.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-api/classes/ics.php

    r162 r480  
    33class WordCamp_API_ICS {
    44    public $ttl = 1; // seconds to live
     5    const CLRF = "\r\n";
    56
    67    function __construct() {
     
    4748            define( 'WPCT_POST_TYPE_ID', 'wordcamp' );
    4849
    49         $ical = 'BEGIN:VCALENDAR
    50 VERSION:2.0
    51 PRODID:-//hacksw/handcal//NONSGML v1.0//EN
    52 ';
     50        $ical = 'BEGIN:VCALENDAR' . self::CLRF;
     51        $ical .= 'VERSION:2.0'  . self::CLRF;
     52        $ical .= 'PRODID:-//hacksw/handcal//NONSGML v1.0//EN' . self::CLRF;
    5353
    5454        $query = new WP_Query( array(
     
    7979            $end = date( 'Ymd', $end );
    8080
    81             $ical .= "BEGIN:VEVENT
    82 UID:$uid
    83 DTSTAMP;VALUE=DATE:$start
    84 DTSTART;VALUE=DATE:$start
    85 DTEND;VALUE=DATE:$end
    86 SUMMARY:$title
    87 END:VEVENT
    88 ";
    89 
     81            $ical .= "BEGIN:VEVENT" . self::CLRF;
     82            $ical .= "UID:$uid" . self::CLRF;
     83            $ical .= "DTSTAMP;VALUE=DATE:$start" . self::CLRF;
     84            $ical .= "DTSTART;VALUE=DATE:$start" . self::CLRF;
     85            $ical .= "DTEND;VALUE=DATE:$end" . self::CLRF;
     86            $ical .= "SUMMARY:$title" . self::CLRF;
     87            $ical .= "END:VEVENT" . self::CLRF;
    9088        }
    9189
Note: See TracChangeset for help on using the changeset viewer.