Пример #1
0
// 	STOP! DO NOT MODIFY THIS FILE!
//	If you wish to customize the output, you can safely do so by COPYING this file
//	into a new folder called 'gigpress-templates' in your 'wp-content' directory
//	and then making your changes there. When in place, that file will load in place of this one.
// This template is displayed at the very end of our sidebar listing.
// By default, it displays links to RSS and iCal feeds for all upcoming shows,
// or, if we're filtering for a specific artist or tour, just for that specific artist or tour
?>

<?php 
// Show the "more" link if specified
if ($link) {
    ?>
	<p class="gigpress-sidebar-more"><a href="<?php 
    echo gigpress_check_url($gpo['shows_page']);
    ?>
" title="<?php 
    echo $link;
    ?>
"><?php 
    echo $link;
    ?>
</a></p>
<?php 
}
?>

<?php 
// Show the RSS/iCal links if specified
if ($show_feeds) {
Пример #2
0
function gigpress_prepare($show, $scope = 'public')
{
    // This function takes an array for one show ($show)
    // and returns a new array containing the show data
    // prepared for various outputs based on context and GigPress settings
    global $wpdb, $gp_countries, $gpo;
    $target = $gpo['target_blank'] == 1 ? ' target="_blank" title="(' . __("opens in a new window", "gigpress") . ')"' : '';
    $showdata = array();
    $showdata['address_plain'] = $show->venue_address ? wptexturize($show->venue_address) : '';
    $showdata['address_url'] = $show->venue_address ? 'http://maps.google.com/maps?&amp;q=' . urlencode($show->venue_address) . ',' . urlencode($show->venue_city) . ',' . urlencode($show->venue_country) : '';
    $showdata['address'] = $show->venue_address ? '<a href="' . $showdata['address_url'] . '" class="gigpress-address"' . $target . '>' . wptexturize($show->venue_address) . '</a>' : '';
    $showdata['city'] = $show->show_related && $gpo['relatedlink_city'] == 1 && $scope == 'public' ? '<a href="' . gigpress_related_link($show->show_related, "url") . '">' . wptexturize($show->venue_city) . '</a>' : wptexturize($show->venue_city);
    $showdata['country'] = $gpo['country_view'] == 'long' ? wptexturize($gp_countries[$show->venue_country]) : $show->venue_country;
    $showdata['venue'] = $show->venue_url ? '<a href="' . gigpress_check_url($show->venue_url) . '"' . $target . '>' . wptexturize($show->venue_name) . '</a>' : wptexturize($show->venue_name);
    $showdata['venue_id'] = $show->venue_id;
    $showdata['venue_plain'] = wptexturize($show->venue_name);
    $showdata['venue_phone'] = wptexturize($show->venue_phone);
    $showdata['venue_url'] = $show->venue_url ? gigpress_check_url($show->venue_url) : '';
    // Shield these fields when we're calling this function from the venues admin screen
    if ($scope != 'venue') {
        $timeparts = explode(':', $show->show_time);
        $showdata['admittance'] = !empty($show->show_ages) && $show->show_ages != 'Not sure' ? wptexturize($show->show_ages) : '';
        $showdata['artist'] = wptexturize($show->artist_name);
        $showdata['artist_id'] = $show->artist_id;
        $showdata['calendar_summary'] = $show->artist_name . ' ' . __("at", "gigpress") . ' ' . $show->venue_name;
        $showdata['calendar_details'] = '';
        if ($show->tour_name) {
            $showdata['calendar_details'] .= $gpo['tour_label'] . ': ' . $show->tour_name . '. ';
        }
        if ($show->show_price) {
            $showdata['calendar_details'] .= __("Price", "gigpress") . ': ' . $show->show_price . '. ';
        }
        if ($show->show_tix_phone) {
            $showdata['calendar_details'] .= __("Box office", "gigpress") . ': ' . $show->show_tix_phone . '. ';
        }
        if ($show->show_venue_phone) {
            $showdata['calendar_details'] .= __("Venue phone", "gigpress") . ': ' . $show->venue_phone . '. ';
        }
        if ($show->show_notes) {
            $showdata['calendar_details'] .= __("Notes", "gigpress") . ': ' . $show->show_notes . ' ';
        }
        $showdata['calendar_details'] .= $showdata['admittance'];
        $showdata['calendar_details'] = str_replace(array(";", ",", "\n", "\r"), array('\\;', '\\,', ' ', ' '), $showdata['calendar_details']);
        $showdata['calendar_location'] = $show->venue_name . ', ';
        if ($show->venue_address) {
            $showdata['calendar_location'] .= $show->venue_address . ', ';
        }
        $showdata['calendar_location'] .= $show->venue_city . ', ' . $show->venue_country;
        $show->venue_city . ', ' . $show->venue_country;
        $showdata['calendar_start'] = $timeparts[2] == '01' ? str_replace('-', '', $show->show_date) : str_replace(array('-', ':', ' '), array('', '', 'T'), get_gmt_from_date($show->show_date . ' ' . $show->show_time)) . 'Z';
        if ($timeparts[2] == '01') {
            $showdata['calendar_end'] = $show->show_expire == $show->show_date ? $showdata['calendar_start'] : date('Ymd', strtotime($show->show_expire . '+1 day'));
        } else {
            $showdata['calendar_end'] = $show->show_expire == $show->show_date ? $showdata['calendar_start'] : str_replace(array('-', ':', ' '), array('', '', 'T'), get_gmt_from_date($show->show_expire . ' ' . $show->show_time)) . 'Z';
        }
        $showdata['date'] = $show->show_related && $gpo['relatedlink_date'] == 1 && $scope == 'public' ? '<a href="' . gigpress_related_link($show->show_related, "url") . '">' . mysql2date($gpo['date_format'], $show->show_date) . '</a>' : mysql2date($gpo['date_format'], $show->show_date);
        $showdata['date_long'] = mysql2date($gpo['date_format_long'], $show->show_date);
        $showdata['date_mysql'] = $show->show_date;
        $showdata['end_date'] = $show->show_date != $show->show_expire ? mysql2date($gpo['date_format'], $show->show_expire) : '';
        $showdata['end_date_long'] = $show->show_date != $show->show_expire ? mysql2date($gpo['date_format_long'], $show->show_expire) : '';
        $showdata['end_date_mysql'] = $show->show_expire;
        $showdata['ical'] = '<a href="' . GIGPRESS_ICAL . '&amp;show_id=' . $show->show_id . '">' . __("Download iCal", "gigpress") . '</a>';
        $showdata['id'] = $show->show_id;
        $showdata['iso_date'] = $show->show_date . " " . $show->show_time;
        $showdata['iso_end_date'] = $show->show_expire . " " . $show->show_time;
        $showdata['notes'] = wptexturize($show->show_notes);
        $showdata['price'] = wptexturize($show->show_price);
        $showdata['related_id'] = $show->show_related ? $show->show_related : 0;
        $showdata['related_url'] = $show->show_related ? gigpress_related_link($show->show_related, 'url') : '';
        $showdata['related_edit'] = $show->show_related ? gigpress_related_link($show->show_related, 'edit') : '';
        $showdata['related_link'] = $show->show_related ? gigpress_related_link($show->show_related, 'view') : '';
        $showdata['rss_date'] = mysql2date('D, d M Y', $show->show_date, false) . " " . $show->show_time . " " . gigpress_get_O_offset(get_option('gmt_offset'));
        $showdata['status'] = $show->show_status;
        switch ($showdata['status']) {
            case 'active':
                $showdata['ticket_link'] = $show->show_tix_url && $show->show_expire >= GIGPRESS_NOW ? '<a href="' . gigpress_check_url($show->show_tix_url) . '"' . $target . ' class="gigpress-tickets-link">' . __("Buy tickets", "gigpress") . '</a>' : '';
                break;
            case 'soldout':
                $showdata['ticket_link'] = '<strong class="gigpress-soldout">' . __("Sold Out", "gigpress") . '</strong>';
                break;
            case 'cancelled':
                $showdata['ticket_link'] = '<strong class="gigpress-cancelled">' . __("Cancelled", "gigpress") . '</strong>';
                break;
        }
        $showdata['ticket_url'] = $show->show_tix_url ? gigpress_check_url($show->show_tix_url) : '';
        $showdata['ticket_phone'] = wptexturize($show->show_tix_phone);
        $showdata['time'] = $timeparts[2] == '01' ? '' : date($gpo['time_format'], mktime($timeparts[0], $timeparts[1]));
        $showdata['tour'] = wptexturize($show->tour_name);
        $showdata['tour_id'] = $show->tour_id;
        if ($showdata['related_url']) {
            $showdata['permalink'] = $showdata['related_url'];
        } elseif ($gpo['shows_page']) {
            $showdata['permalink'] = gigpress_check_url($gpo['shows_page']);
        } else {
            $showdata['permalink'] = get_bloginfo('home');
        }
        // Google Calendar
        $showdata['gcal'] = '<a href="http://www.google.com/calendar/event?action=TEMPLATE' . '&amp;text=' . urlencode($showdata['calendar_summary']) . '&amp;dates=' . $showdata['calendar_start'] . '/' . $showdata['calendar_end'] . '&amp;sprop=website:' . urlencode(GIGPRESS_URL) . '&amp;sprop=name:' . urlencode($show->artist_name) . '&amp;location=' . urlencode($showdata['calendar_location']) . '&amp;details=' . urlencode($showdata['calendar_details']) . '&amp;trp=true;' . '"' . $target . '>' . __("Add to Google Calendar", "gigpress") . '</a>';
    }
    return $showdata;
}