function column_name($item)
 {
     $term_id = (int) $item->term_id;
     //Build row actions
     $actions = array('edit' => sprintf('<a href="?post_type=event&page=%s&action=%s&event-venue=%s">' . __('Edit') . '</a>', $_REQUEST['page'], 'edit', $item->slug), 'delete' => '<a href="' . wp_nonce_url(sprintf('?post_type=event&page=%s&action=%s&event-venue=%s', $_REQUEST['page'], 'delete', $item->slug), 'eventorganiser_delete_venue_' . $item->slug) . '">' . __('Delete') . ' </a>', 'view' => sprintf('<a href="%s">' . __('View') . '</a>', eo_get_venue_link($term_id)));
     //Return the title contents
     return sprintf('<a href="?post_type=event&page=%1$s&action=%2$s&event-venue=%3$s" class="row-title">%4$s</a>%5$s', $_REQUEST['page'], 'edit', $item->slug, $item->name, $this->row_actions($actions));
 }
 function column_name($item)
 {
     $term_id = (int) $item->term_id;
     $delete_url = add_query_arg('action', 'delete', get_edit_term_link($term_id, 'event-venue', 'event'));
     //Build row actions
     $actions = array('edit' => sprintf('<a href="%s">' . __('Edit') . '</a>', get_edit_term_link($term_id, 'event-venue', 'event')), 'delete' => sprintf('<a href="%s">' . __('Delete') . '</a>', wp_nonce_url($delete_url, 'eventorganiser_delete_venue_' . $item->slug)), 'view' => sprintf('<a href="%s">' . __('View') . '</a>', eo_get_venue_link($term_id)));
     //Return the title contents
     return sprintf('<a href="%1$s" class="row-title">%2$s</a>%3$s', get_edit_term_link($term_id, 'event-venue', 'event'), esc_html($item->name), $this->row_actions($actions));
 }
function _eventorganiser_add_venue_admin_bar_edit_menu()
{
    global $wp_admin_bar;
    if (is_admin()) {
        $current_screen = get_current_screen();
        if ('event_page_venues' == $current_screen->base && isset($_GET['action']) && 'edit' == $_GET['action'] && ($tax = get_taxonomy('event-venue')) && $tax->public) {
            $wp_admin_bar->add_menu(array('id' => 'view', 'title' => $tax->labels->view_item, 'href' => eo_get_venue_link($_GET['event-venue'])));
        }
    } else {
        $current_object = get_queried_object();
        if (!eo_is_venue()) {
            return;
        }
        if (($tax = get_taxonomy($current_object->taxonomy)) && current_user_can($tax->cap->edit_terms)) {
            $wp_admin_bar->add_menu(array('id' => 'edit', 'title' => $tax->labels->edit_item, 'href' => get_edit_term_link($current_object->term_id, $current_object->taxonomy)));
        }
    }
}
示例#4
0
function eventorganiser_posterboard_ajax_response()
{
    $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
    $query = empty($_GET['query']) ? array() : $_GET['query'];
    foreach (array('category', 'tag', 'venue') as $tax) {
        if (isset($query['event_' . $tax])) {
            $query['event-' . $tax] = $query['event_' . $tax];
            unset($query['event_' . $tax]);
        }
    }
    if (isset($query['event-venue']) && '%this%' == $query['event-venue']) {
        if (eo_get_venue_slug()) {
            $query['event-venue'] = eo_get_venue_slug();
        } else {
            unset($query['event-venue']);
        }
    }
    if (isset($query['users_events']) && 'true' == strtolower($query['users_events'])) {
        $query['bookee_id'] = get_current_user_id();
    }
    $query = array_merge(array('event_start_after' => 'today', 'posts_per_page' => 10), $query, array('post_type' => 'event', 'paged' => $page, 'post_status' => array('publish', 'private'), 'perm' => 'readable', 'supress_filters' => false));
    $event_query = new WP_Query($query);
    $response = array();
    if ($event_query->have_posts()) {
        global $post;
        while ($event_query->have_posts()) {
            $event_query->the_post();
            $start_format = get_option('time_format');
            if (eo_get_the_start('Y-m-d') == eo_get_the_end('Y-m-d')) {
                $end_format = get_option('time_format');
            } else {
                $end_format = 'j M ' . get_option('time_format');
            }
            $venue_id = eo_get_venue();
            $categories = get_the_terms(get_the_ID(), 'event-category');
            $colour = eo_get_event_color() ? eo_get_event_color() : '#1e8cbe';
            $address = eo_get_venue_address($venue_id);
            $event = array('event_id' => get_the_ID(), 'occurrence_id' => $post->occurrence_id, 'event_title' => get_the_title(), 'event_color' => $colour, 'event_color_light' => eo_color_luminance($colour, 0.3), 'event_start_day' => eo_get_the_start('j'), 'event_start_month' => eo_get_the_start('M'), 'event_content' => get_the_content(), 'event_excerpt' => get_the_excerpt(), 'event_thumbnail' => get_the_post_thumbnail(get_the_ID(), array('200', '200'), array('class' => 'aligncenter')), 'event_permalink' => get_permalink(), 'event_categories' => get_the_term_list(get_the_ID(), 'event-category', '#', ', #', ''), 'event_venue' => $venue_id ? eo_get_venue_name($venue_id) : false, 'event_venue_id' => $venue_id, 'event_venue_city' => $venue_id ? $address['city'] : false, 'event_venue_state' => $venue_id ? $address['state'] : false, 'event_venue_country' => $venue_id ? $address['country'] : false, 'event_venue_url' => $venue_id ? eo_get_venue_link($venue_id) : false, 'event_is_all_day' => eo_is_all_day(), 'event_cat_ids' => $categories ? array_values(wp_list_pluck($categories, 'term_id')) : array(0), 'event_range' => eo_get_the_start($start_format) . ' - ' . eo_get_the_end($end_format));
            $event = apply_filters('eventorganiser_posterboard_item', $event, $event['event_id'], $event['occurrence_id']);
            $response[] = $event;
        }
    }
    wp_reset_postdata();
    echo json_encode($response);
    exit;
}
/**
* Prints the permalink of a venue
* If used with any arguments uses the venue of the current event.
* @uses eo_get_venue_link()
* @since 1.0.0
*
* @param int|string $venue_slug_or_id The venue ID (as an integer) or slug (as a string). Uses venue of current event if empty.
*/
function eo_venue_link($venue_slug_or_id = '')
{
    $venue_id = eo_get_venue_id_by_slugorid($venue_slug_or_id);
    echo eo_get_venue_link($venue_slug_or_id);
}
 static function parse_template($matches)
 {
     global $post;
     $replacement = '';
     switch ($matches[1]) {
         case 'event_title':
             $replacement = get_the_title();
             break;
         case 'start':
         case 'end':
         case 'schedule_start':
         case 'schedule_last':
         case 'schedule_end':
             switch (count($matches)) {
                 case 2:
                     $dateFormat = get_option('date_format');
                     $dateTime = get_option('time_format');
                     break;
                 case 3:
                     $dateFormat = self::eo_clean_input($matches[2]);
                     $dateTime = '';
                     break;
                 case 5:
                     $dateFormat = self::eo_clean_input($matches[3]);
                     $dateTime = self::eo_clean_input($matches[4]);
                     break;
             }
             $format = eo_is_all_day(get_the_ID()) ? $dateFormat : $dateFormat . $dateTime;
             switch ($matches[1]) {
                 case 'start':
                     $replacement = eo_get_the_start($format);
                     break;
                 case 'end':
                     $replacement = eo_get_the_end($format);
                     break;
                 case 'schedule_start':
                     $replacement = eo_get_schedule_start($format);
                     break;
                 case 'schedule_last':
                 case 'schedule_end':
                     $replacement = eo_get_schedule_end($format);
                     break;
             }
             break;
         case 'event_duration':
             $start = eo_get_the_start(DATETIMEOBJ);
             $end = clone eo_get_the_end(DATETIMEOBJ);
             if (eo_is_all_day()) {
                 $end->modify('+1 minute');
             }
             if (function_exists('date_diff')) {
                 $duration = date_diff($start, $end);
                 $replacement = $duration->format($matches[2]);
             } else {
                 $replacement = eo_date_interval($start, $end, $matches[2]);
             }
             $replacement = false;
             break;
         case 'event_tags':
             $replacement = get_the_term_list(get_the_ID(), 'event-tag', '', ', ', '');
             break;
         case 'event_cats':
             $replacement = get_the_term_list(get_the_ID(), 'event-category', '', ', ', '');
             break;
         case 'event_venue':
             $replacement = eo_get_venue_name();
             break;
         case 'event_venue_map':
             if (eo_get_venue()) {
                 $class = isset($matches[2]) ? self::eo_clean_input($matches[2]) : '';
                 $class = !empty($class) ? 'class=' . $class : '';
                 $replacement = eo_get_venue_map(eo_get_venue(), compact('class'));
             }
             break;
         case 'event_venue_url':
             $venue_link = eo_get_venue_link();
             $replacement = !is_wp_error($venue_link) ? $venue_link : '';
             break;
         case 'event_venue_address':
             $address = eo_get_venue_address();
             $replacement = $address['address'];
             break;
         case 'event_venue_postcode':
             $address = eo_get_venue_address();
             $replacement = $address['postcode'];
             break;
         case 'event_venue_city':
             $address = eo_get_venue_address();
             $replacement = $address['city'];
             break;
         case 'event_venue_country':
             $address = eo_get_venue_address();
             $replacement = $address['country'];
             break;
         case 'event_venue_state':
             $address = eo_get_venue_address();
             $replacement = $address['state'];
             break;
         case 'event_venue_city':
             $address = eo_get_venue_address();
             $replacement = $address['city'];
             break;
         case 'event_thumbnail':
             $size = isset($matches[2]) ? self::eo_clean_input($matches[2]) : '';
             $size = !empty($size) ? $size : 'thumbnail';
             $attr = isset($matches[3]) ? self::eo_clean_input($matches[3]) : '';
             //Decode HTML entities as shortcode encodes them
             $attr = html_entity_decode($attr);
             $replacement = get_the_post_thumbnail(get_the_ID(), $size, $attr);
             break;
         case 'event_url':
             $replacement = get_permalink();
             break;
         case 'event_custom_field':
             $field = $matches[2];
             $meta = get_post_meta(get_the_ID(), $field);
             $replacement = implode($meta);
             break;
         case 'event_excerpt':
             $length = isset($matches[2]) ? intval($matches[2]) : 55;
             //Using get_the_excerpt adds a link....
             if (post_password_required($post)) {
                 $output = __('There is no excerpt because this is a protected post.');
             } else {
                 $output = $post->post_excerpt;
             }
             $replacement = eventorganiser_trim_excerpt($output, $length);
             break;
         case 'event_content':
             $replacement = get_the_content();
             break;
         case 'cat_color':
             $replacement = eo_get_event_color();
             break;
         case 'event_title_attr':
             $replacement = get_the_title();
             break;
     }
     return $replacement;
 }
/**
 * Returns HTML mark-up for a list of event meta information.
 *
 * Uses microformat.
 * @since 1.7
 * @ignore
 * @param int $post_id The event (post) ID. Uses current event if not supplied
 * @return string|bool HTML mark-up. False if an invalid $post_is provided.
*/
function eo_get_event_meta_list($event_id = 0)
{
    $event_id = (int) (empty($event_id) ? get_the_ID() : $event_id);
    if (empty($event_id)) {
        return false;
    }
    $html = '<ul class="eo-event-meta" style="margin:10px 0px;">';
    $venue = get_taxonomy('event-venue');
    if (($venue_id = eo_get_venue($event_id)) && $venue) {
        $html .= sprintf('<li><strong>%s:</strong> <a href="%s">
				<span itemprop="location" itemscope itemtype="http://data-vocabulary.org/Organization">
					<span itemprop="name">%s</span>
					<span itemprop="geo" itemscope itemtype="http://data-vocabulary.org/Geo">
						<meta itemprop="latitude" content="%f" />
						<meta itemprop="longitude" content="%f" />
					</span>
				</span>
			</a></li>', $venue->labels->singular_name, eo_get_venue_link($venue_id), eo_get_venue_name($venue_id), eo_get_venue_lat($venue_id), eo_get_venue_lng($venue_id));
    }
    if (get_the_terms($event_id, 'event-category')) {
        $html .= sprintf('<li><strong>%s:</strong> %s</li>' . "\n", __('Categories', 'eventorganiser'), get_the_term_list($event_id, 'event-category', '', ', ', ''));
    }
    if (get_the_terms($event_id, 'event-tag') && !is_wp_error(get_the_terms($event_id, 'event-tag'))) {
        $html .= sprintf('<li><strong>%s:</strong> %s</li>' . "\n", __('Tags', 'eventorganiser'), get_the_term_list($event_id, 'event-tag', '', ', ', ''));
    }
    $html .= '</ul>';
    /**
     * Filters mark-up for the event details list.
     *
     * The event details list is just a simple list containig details pertaining
     * to the event (venue, categories, tags) etc.
     *
     * @param array $html The generated mark-up
     * @param int $event_id Post ID of the event
     */
    $html = apply_filters('eventorganiser_event_meta_list', $html, $event_id);
    return $html;
}
示例#8
0
/**
 * Returns HTML mark-up for a list of event meta information.
 *
 * Uses microformat.
 * @since 1.7
 * @ignore
 * @param int $post_id The event (post) ID. Uses current event if not supplied
 * @return string|bool HTML mark-up. False if an invalid $post_is provided.
*/
function eo_get_event_meta_list_rcumc($event_id = 0)
{
    $event_id = (int) (empty($event_id) ? get_the_ID() : $event_id);
    if (empty($event_id)) {
        return false;
    }
    $html = '<ul class="eo-event-byline" style="margin:10px 0px;">';
    $venue = get_taxonomy('event-venue');
    if (($venue_id = eo_get_venue($event_id)) && $venue) {
        $html .= sprintf('<ul> <a href="%s">
				<span itemprop="location" itemscope itemtype="http://data-vocabulary.org/Organization">
					<span itemprop="name">%s</span>
					
				</span>
			</a></ul>', eo_get_venue_link($venue_id), eo_get_venue_name($venue_id));
    }
    $html .= '</ul>';
    /**
     * Filters mark-up for the event details list.
     *
     * The event details list is just a simple list containing details pertaining
     * to the event (venue, categories, tags) etc.
     *
     * @param array $html The generated mark-up
     * @param int $event_id Post ID of the event
     */
    $html = apply_filters('eventorganiser_event_meta_list', $html, $event_id);
    return $html;
}
/**
 * Returns HTML mark-up for a list of event meta information.
 *
 * Uses microformat.
 * @since 1.7
 * @ignore
 * @param int $post_id The event (post) ID. Uses current event if not supplied
 * @return string|bool HTML mark-up. False if an invalid $post_is provided.
*/
function eo_get_event_meta_list($post_id = 0)
{
    $post_id = (int) (empty($post_id) ? get_the_ID() : $post_id);
    if (empty($post_id)) {
        return false;
    }
    $html = '<ul class="eo-event-meta" style="margin:10px 0px;">';
    if ($venue_id = eo_get_venue($post_id)) {
        $html .= sprintf('<li><strong>%s:</strong> <a href="%s">
								<span itemprop="location" itemscope itemtype="http://data-vocabulary.org/​Organization">
									<span itemprop="name">%s</span>
									<span itemprop="geo" itemscope itemtype="http://data-vocabulary.org/​Geo">
										<meta itemprop="latitude" content="%f" />
										<meta itemprop="longitude" content="%f" />
     									</span>
								</span></a></li>', __('Venue', 'eventorganiser'), eo_get_venue_link($venue_id), eo_get_venue_name($venue_id), eo_get_venue_lat($venue_id), eo_get_venue_lng($venue_id));
    }
    if (get_the_terms(get_the_ID(), 'event-category')) {
        $html .= sprintf('<li><strong>%s:</strong> %s</li>', __('Categories', 'eventorganiser'), get_the_term_list(get_the_ID(), 'event-category', '', ', ', ''));
    }
    if (get_the_terms(get_the_ID(), 'event-tag') && !is_wp_error(get_the_terms(get_the_ID(), 'event-tag'))) {
        $html .= sprintf('<li><strong>%s:</strong> %s</li>', __('Tags', 'eventorganiser'), get_the_term_list(get_the_ID(), 'event-tag', '', ', ', ''));
    }
    $html .= '</ul>';
    return apply_filters('eventorganiser_event_meta_list', $html, $post_id);
}
 function parse_template($matches)
 {
     global $post;
     $replacement = '';
     $col = array('start' => array('date' => 'StartDate', 'time' => 'StartTime'), 'end' => array('date' => 'EndDate', 'time' => 'FinishTime'), 'schedule_start' => array('date' => 'reoccurrence_start', 'time' => 'StartTime'), 'schedule_end' => array('date' => 'reoccurrence_end', 'time' => 'FinishTime'));
     switch ($matches[1]) {
         case 'event_title':
             $replacement = get_the_title();
             break;
         case 'start':
         case 'end':
         case 'schedule_start':
         case 'schedule_end':
             switch (count($matches)) {
                 case 2:
                     $dateFormat = get_option('date_format');
                     $dateTime = get_option('time_format');
                     break;
                 case 3:
                     $dateFormat = self::eo_clean_input($matches[2]);
                     $dateTime = '';
                     break;
                 case 5:
                     $dateFormat = self::eo_clean_input($matches[3]);
                     $dateTime = self::eo_clean_input($matches[4]);
                     break;
             }
             if (eo_is_all_day(get_the_ID())) {
                 $replacement = eo_format_date($post->{$col}[$matches[1]]['date'] . ' ' . $post->{$col}[$matches[1]]['time'], $dateFormat);
             } else {
                 $replacement = eo_format_date($post->{$col}[$matches[1]]['date'] . ' ' . $post->{$col}[$matches[1]]['time'], $dateFormat . $dateTime);
             }
             break;
         case 'event_tags':
             $replacement = get_the_term_list(get_the_ID(), 'event-tag', '', ', ', '');
             break;
         case 'event_cats':
             $replacement = get_the_term_list(get_the_ID(), 'event-category', '', ', ', '');
             break;
         case 'event_venue':
             $replacement = eo_get_venue_name();
             break;
         case 'event_venue_map':
             if (eo_get_venue()) {
                 $class = isset($matches[2]) ? self::eo_clean_input($matches[2]) : '';
                 $class = !empty($class) ? 'class=' . $class : '';
                 $replacement = do_shortcode('[eo_venue_map ' . $class . ']');
             }
             break;
         case 'event_venue_url':
             $venue_link = eo_get_venue_link();
             $replacement = !is_wp_error($venue_link) ? $venue_link : '';
             break;
         case 'event_venue_address':
             $address = eo_get_venue_address();
             $replacement = $address['address'];
             break;
         case 'event_venue_postcode':
             $address = eo_get_venue_address();
             $replacement = $address['postcode'];
             break;
         case 'event_venue_country':
             $address = eo_get_venue_address();
             $replacement = $address['country'];
             break;
         case 'event_thumbnail':
             $size = isset($matches[2]) ? self::eo_clean_input($matches[2]) : '';
             $size = !empty($size) ? $size : 'thumbnail';
             $replacement = get_the_post_thumbnail(get_the_ID(), $size);
             break;
         case 'event_url':
             $replacement = get_permalink();
             break;
         case 'event_custom_field':
             $field = $matches[2];
             $meta = get_post_meta(get_the_ID(), $field);
             $replacement = implode($meta);
             break;
         case 'event_excerpt':
             //Using get_the_excerpt adds a link....
             if (post_password_required($post)) {
                 $output = __('There is no excerpt because this is a protected post.');
             } else {
                 $output = $post->post_excerpt;
             }
             $replacement = wp_trim_excerpt($output);
             break;
         case 'cat_color':
             $replacement = eo_event_color();
             break;
     }
     return $replacement;
 }