/** * Check to make sure that get_ical_link function works as expected * * @uses $post_example_settings */ public function test_get_ical_link_single() { global $post; $post = get_post(Tribe__Events__API::createEvent($this->post_example_settings)); $this->assertTrue($post instanceof WP_Post, 'Check that post creates properly'); $ical_link_single_via_object = Tribe__Events__iCal::get_ical_link('single'); $this->assertNotEmpty(filter_var($ical_link_single_via_object, FILTER_VALIDATE_URL), 'Checking that we get back a valid URL from object'); $ical_link_single_via_function = tribe_get_single_ical_link(); $this->assertNotEmpty(filter_var($ical_link_single_via_function, FILTER_VALIDATE_URL), 'Checking that we get back a valid URL from function'); $this->assertEquals($ical_link_single_via_object, $ical_link_single_via_function, 'Check that the function and object get the same result'); }
protected function present() { global $wp_query; $suggested_filename = date_i18n('YmdHis-') . uniqid() . '.ics'; header('Content-Type: text/calendar'); header('Content-Disposition: attachment; filename=' . $suggested_filename); // Trick TEC into using our post list even within month view $wp_query->posts = $this->events; add_filter('tribe_is_month', '__return_false'); Tribe__Events__iCal::generate_ical_feed(); exit; }
/** * Load the ical template tags * Loaded late due to potential upgrade conflict since moving them from pro * @TODO move this require to be with the rest of the template tag includes in 3.9 */ public function init_ical() { //iCal Tribe__Events__iCal::init(); require_once $this->pluginPath . 'src/functions/template-tags/ical.php'; }
/** * iCal Link * * Returns a sitewide ical link * * @return string URL for ical dump. */ function tribe_get_ical_link() { $output = Tribe__Events__iCal::get_ical_link(); return apply_filters('tribe_get_ical_link', $output); }