codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php /* ===================================================================== * podio_ical.php * This script takes a Podio ical feed and converts all tasks to VTASKs instead of VEVENTs * (c) 2013 Globi Web Solutions * v1.1 2013-05-16 - Andreas Huttenrauch * * Please post something nice on your website / blog and link back to www.globi.ca if you find this script useful. * ===================================================================== */ // begin configuration // paste your podio exported ical feed here $file = "http://api.podio.com/calendar/ics/1027582/27S0f324244533459Iw07P6QvZVfgdfgMkz6qY83tjc5qsoPPCn435345UK67dfgdfgHMjgsaFVly/?priority=10"; // and then use the URL of THIS SCRIPT as your ical feed in Thunderbird / Outlook / etc // end configuration $ical = file_get_contents($file); $header = preg_replace('/BEGIN:VEVENT(.*)/is', '', $ical); $icalarray = array(); preg_match_all('/(BEGIN:VEVENT.*?END:VEVENT)/si', $ical, $result, PREG_PATTERN_ORDER); for ($i = 0; $i < count($result[0]); $i++) { $tmpevent = array(); $tmplines = explode("\r\n", $result[0][$i]); foreach ($tmplines as $line) { $tmparray = explode(":",$line,2); if (count($tmparray) >1) { $tmpevent[$tmparray[0]] = $tmparray[1]; } } $icalarray[] = $tmpevent; } foreach ($icalarray as $k => $event) { if (substr($event['UID'],0,5)=="task_") { $icalarray[$k]['BEGIN']='VTODO'; $icalarray[$k]['END']='VTODO'; } } $return = $header; foreach ($icalarray as $event) { foreach ($event as $item => $line) { $return .= $item.':'.$line."\r\n"; } } $return .= 'END:VCALENDAR'."\r\n"; echo $return; ?>
Private
[
?
]
Run code
Submit