Advertisement
designerken

filter ical

Oct 8th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. function filter_ical_description($item) {
  2. global $post;
  3. $description = preg_replace( "/[\n\t\r]/", ' ', strip_tags( strip_shortcodes( $eventPost->post_content ) ) );
  4.  
  5. // add fields to iCal output
  6. $item = array();
  7. $item[] = "DTSTART;VALUE=$type:" . $startDate;
  8. $item[] = "DTEND;VALUE=$type:" . $endDate;
  9. $item[] = 'DTSTAMP:' . date( 'Ymd\THis', time() );
  10. $item[] = 'CREATED:' . str_replace( array( '-', ' ', ':' ) , array( '', 'T', '' ) , $eventPost->post_date );
  11. $item[] = 'LAST-MODIFIED:' . str_replace( array( '-', ' ', ':' ) , array( '', 'T', '' ) , $eventPost->post_modified );
  12. $item[] = 'UID:' . $eventPost->ID . '-' . strtotime( $startDate ).'-'.strtotime( $endDate ) . '@' . $blogHome;
  13. $item[] = 'SUMMARY:' . $eventPost->post_title;
  14. $item[] = 'DESCRIPTION:' . str_replace( ',','\,', $description );
  15. $item[] = 'LOCATION:' . html_entity_decode( $tribeEvents->fullAddressString( $eventPost->ID ), ENT_QUOTES );
  16. $item[] = 'URL:' . get_permalink( $eventPost->ID );
  17.  
  18. $item = apply_filters( 'tribe_ical_feed_item', $item, $eventPost );
  19. return $item;
  20. }
  21. add_filter('tribe_ical_feed_item()','filter_ical_description');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement