Exemple #1
0
 public function export(array $arguments, array $params = array())
 {
     $c = new vcalendar();
     $c->setProperty('calscale', 'GREGORIAN');
     $c->setProperty('method', 'PUBLISH');
     // if no post id are specified do not export those properties
     // as they would create a new calendar in outlook.
     // a user reported this in AIOEC-982 and said this would fix it
     if (true === $arguments['do_not_export_as_calendar']) {
         $c->setProperty('X-WR-CALNAME', get_bloginfo('name'));
         $c->setProperty('X-WR-CALDESC', get_bloginfo('description'));
     }
     $c->setProperty('X-FROM-URL', home_url());
     // Timezone setup
     $tz = $this->_registry->get('date.timezone')->get_default_timezone();
     if ($tz) {
         $c->setProperty('X-WR-TIMEZONE', $tz);
         $tz_xprops = array('X-LIC-LOCATION' => $tz);
         iCalUtilityFunctions::createTimezone($c, $tz, $tz_xprops);
     }
     $this->_taxonomy_model = $this->_registry->get('model.taxonomy');
     $post_ids = array();
     foreach ($arguments['events'] as $event) {
         $post_ids[] = $event->get('post_id');
     }
     $this->_taxonomy_model->prepare_meta_for_ics($post_ids);
     $this->_registry->get('controller.content-filter')->clear_the_content_filters();
     foreach ($arguments['events'] as $event) {
         $c = $this->_insert_event_in_calendar($event, $c, true, $params);
     }
     $this->_registry->get('controller.content-filter')->restore_the_content_filters();
     $str = ltrim($c->createCalendar());
     return $str;
 }