public function testCatAttributes() { eo_get_event_fullcalendar(array('event-category' => array('foo', 'bar'))); $args = array_pop(EventOrganiser_Shortcodes::$calendars); $this->assertEquals('foo,bar', $args['event_category']); //Reset EventOrganiser_Shortcodes::$calendars = array(); }
static function handle_fullcalendar_shortcode($atts = array()) { global $wp_locale; /* Handle Boolean attributes - this will be passed as strings, we want them as boolean */ $bool_atts = array('key' => 'false', 'tooltip' => 'true', 'weekends' => 'true', 'alldayslot' => 'true', 'users_events' => 'false', 'theme' => 'true', 'isrtl' => $wp_locale->is_rtl() ? 'true' : 'false'); $atts = wp_parse_args($atts, $bool_atts); foreach ($bool_atts as $att => $value) { $atts[$att] = strtolower($atts[$att]) == 'true' ? true : false; } if (isset($atts['venue']) && !isset($atts['event_venue'])) { $atts['event_venue'] = $atts['venue']; unset($atts['venue']); } if (isset($atts['category']) && !isset($atts['event_category'])) { $atts['event_category'] = $atts['category']; unset($atts['category']); } $taxonomies = get_object_taxonomies('event'); foreach ($taxonomies as $tax) { //Shortcode attributes can't contain hyphens $shortcode_attr = str_replace('-', '_', $tax); if (isset($atts[$shortcode_attr])) { $atts[$tax] = $atts[$shortcode_attr]; unset($atts[$shortcode_attr]); } } return eo_get_event_fullcalendar($atts); }
<?php /* Template Name: Calendar Page */ ?> <?php get_header(); ?> <section class="calendar-container"> <h1>Auction Calendar</h1> <div class="calendar"> <?php echo eo_get_event_fullcalendar(); ?> </div> </section> <!-- #calendar-container --> <?php get_footer();
static function handle_fullcalendar_shortcode($atts = array()) { global $wp_locale; /* Handle Boolean attributes - this will be passed as strings, we want them as boolean */ $bool_atts = array('key' => 'false', 'tooltip' => 'true', 'weekends' => 'true', 'alldayslot' => 'true', 'users_events' => 'false', 'theme' => 'true', 'isrtl' => $wp_locale->is_rtl() ? 'true' : 'false'); $atts = wp_parse_args($atts, $bool_atts); foreach ($bool_atts as $att => $value) { $atts[$att] = strtolower($atts[$att]) == 'true' ? true : false; } if (isset($atts['venue']) && !isset($atts['event_venue'])) { $atts['event_venue'] = $atts['venue']; } if (isset($atts['category']) && !isset($atts['event_category'])) { $atts['event_category'] = $atts['category']; } return eo_get_event_fullcalendar($atts); }