Skip to content

Instantly share code, notes, and snippets.

@dontcallmedom
Created November 19, 2013 11:47
Show Gist options
  • Save dontcallmedom/7544230 to your computer and use it in GitHub Desktop.
Save dontcallmedom/7544230 to your computer and use it in GitHub Desktop.
Podio currently exports tasks as iCalendar events, which is both noisy in a calendar view, and doesn't make it possible to integrate them cleanly in a Todo app. This PHP code runs regexp on the iCalendar output from Podio and turns it into a list of VEVENT and VTODO depending on their category (relying on the fact that Podio uses UID prefixed wi…
<?php
$userid= "xxxx"; // get From Podio
$token = "yyyy"; // get From Podio
$cal = file_get_contents("https://api.podio.com/calendar/ics/".$userid."/".$token."/?priority=10");
$begintodo = preg_replace('/BEGIN:VEVENT((?:(?!UID:).)*UID:task)/s','BEGIN:VTODO$1',$cal);
$due = preg_replace('/DTSTART((?:(?!UID:).)*UID:task)/s','DUE$1',$begintodo);
$endtodo = preg_replace('/(UID:task(?:(?!END:VEVENT).)*)END:VEVENT/s', '$1END:VTODO', $due);
print $endtodo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment