Пример #1
0
/**
 * Retrieve a venue's location suitable for an iCal feed.
 *
 * @since 1.0.0
 *
 * @param int|object $post Venue post ID or object.
 * @return string Venue iCal vCard.
 */
function get_audiotheme_venue_location_ical($venue = null)
{
    $venue = get_audiotheme_venue($venue);
    $output = $venue->name;
    $address = array();
    if (!empty($venue->address)) {
        $address[] = $venue->address;
    }
    $locality = empty($venue->city) ? '' : $venue->city;
    $locality .= empty($locality) && empty($venue->state) ? '' : ', ';
    $locality .= empty($venue->state) ? '' : $venue->state;
    if (!empty($locality)) {
        $address[] = $locality;
    }
    if (!empty($venue->country)) {
        $address[] = $venue->country;
    }
    if (!empty($venue->postal_code)) {
        $address[] = $venue->postal_code;
    }
    if (!empty($address)) {
        $output .= ', ' . join($address, ', ');
    }
    return escape_ical_text($output);
}
 /**
  * Prepares the list of venues for displaying.
  *
  * Modifies the query based on the current view and screen options and
  * begins setting up columns.
  *
  * @since 1.0.0
  */
 function prepare_items()
 {
     global $wp_query, $wpdb;
     $screen = get_current_screen();
     $per_page = get_user_option('gigs_page_audiotheme_venues_per_page');
     $per_page = empty($per_page) ? 20 : $per_page;
     // Set up column headers.
     $columns = $this->get_columns();
     $hidden = get_hidden_columns($screen->id);
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     // Compile the WP_Query args based on the current view and user options.
     $args = array('post_type' => 'audiotheme_venue', 'order' => isset($_REQUEST['order']) && 'desc' === strtolower($_REQUEST['order']) ? 'desc' : 'asc', 'orderby' => !isset($_REQUEST['orderby']) ? 'title' : $_REQUEST['orderby'], 'posts_per_page' => $per_page);
     if (isset($_REQUEST['orderby'])) {
         switch ($_REQUEST['orderby']) {
             case 'gigs':
                 $args['meta_key'] = '_audiotheme_gig_count';
                 $args['orderby'] = 'meta_value_num';
                 break;
             case 'city':
             case 'contact_name':
             case 'contact_phone':
             case 'contact_email':
             case 'country':
             case 'phone':
             case 'state':
             case 'website':
                 $args['meta_key'] = '_audiotheme_' . $_REQUEST['orderby'];
                 $args['orderby'] = 'meta_value';
                 break;
         }
     }
     if (isset($_REQUEST['s'])) {
         $args['s'] = stripslashes($_REQUEST['s']);
     }
     $args['paged'] = $this->get_pagenum();
     // Run the query.
     $items = array();
     $wp_query = new WP_Query($args);
     if (isset($wp_query->posts) && count($wp_query->posts)) {
         foreach ($wp_query->posts as $post) {
             $items[$post->ID] = get_audiotheme_venue($post->ID);
         }
     }
     $this->items = $items;
     $this->set_pagination_args(array('total_items' => $wp_query->found_posts, 'per_page' => $per_page, 'total_pages' => $wp_query->max_num_pages));
 }
Пример #3
0
" itemprop="startDate">
				<time class="dtstart" datetime="<?php 
        echo esc_attr(get_audiotheme_gig_time('c'));
        ?>
">
					<?php 
        echo get_audiotheme_gig_time($date_format);
        ?>
				</time>
			</dd>

			<?php 
        if (!empty($gig->post_title) && audiotheme_gig_has_venue()) {
            ?>
				<dd class="venue"><?php 
            echo esc_html(get_audiotheme_venue($gig->venue->ID)->name);
            ?>
</dd>
			<?php 
        }
        ?>

			<?php 
        if ($gig_description = get_audiotheme_gig_description()) {
            ?>
				<dd class="description"><?php 
            echo wp_strip_all_tags($gig_description);
            ?>
</dd>
			<?php 
        }
Пример #4
0
/**
 * Display the venue add/edit screen.
 *
 * @since 1.0.0
 */
function audiotheme_venue_edit_screen()
{
    $screen = get_current_screen();
    $post_type_object = get_post_type_object('audiotheme_venue');
    $action = 'add';
    $nonce_field = wp_nonce_field('add-venue', 'audiotheme_venue_nonce', true, false);
    $values = get_default_audiotheme_venue_properties();
    if (isset($_GET['action']) && 'edit' === $_GET['action'] && isset($_GET['venue_id']) && is_numeric($_GET['venue_id'])) {
        $venue_to_edit = get_audiotheme_venue($_GET['venue_id']);
        $action = 'edit';
        $nonce_field = wp_nonce_field('update-venue_' . $venue_to_edit->ID, 'audiotheme_venue_nonce', true, false);
        $values = wp_parse_args(get_object_vars($venue_to_edit), $values);
    }
    extract($values, EXTR_SKIP);
    require AUDIOTHEME_DIR . 'modules/gigs/admin/views/edit-venue.php';
}
Пример #5
0
/**
 * Retrieve the static Google map URL for an address/venue.
 *
 * @since 1.6.0
 * @link https://developers.google.com/maps/documentation/staticmaps/?csw=1
 *
 * @param array $args Array of args.
 * @param int $venue_id Optional. Venue ID.
 * @return string
 */
function get_audiotheme_google_static_map_url($args = array(), $venue_id = 0)
{
    $args = wp_parse_args($args, array('address' => '', 'width' => 640, 'height' => 300));
    // Get the current post and determine if it's a gig with a venue.
    if (empty($args['address']) && ($gig = get_audiotheme_gig())) {
        if ('audiotheme_gig' === get_post_type($gig) && !empty($gig->venue->ID)) {
            $venue_id = $gig->venue->ID;
        }
    }
    // Retrieve the address for the venue.
    if ($venue_id) {
        $venue = get_audiotheme_venue($venue_id);
        $args['address'] = get_audiotheme_venue_address($venue->ID);
        $args['address'] = $args['address'] ? $venue->name . ', ' . $args['address'] : $venue->name;
    }
    $image_url = add_query_arg(array('center' => rawurlencode($args['address']), 'size' => $args['width'] . 'x' . $args['height'], 'scale' => 2, 'format' => 'jpg', 'sensor' => 'false', 'markers' => 'size:small|color:0xff0000|' . rawurlencode($args['address'])), '//maps.googleapis.com/maps/api/staticmap');
    $image_url = apply_filters('audiotheme_google_static_map_url', $image_url, $args, $venue_id);
    // @link https://developers.google.com/maps/documentation/staticmaps/?csw=1#StyledMaps
    $map_styles = apply_filters('audiotheme_google_static_map_styles', array());
    if (!empty($map_styles)) {
        foreach ($map_styles as $styles) {
            $image_url .= '&style=' . audiotheme_build_query($styles);
        }
    }
    return $image_url;
}
Пример #6
0
 * @package AudioTheme
 * @subpackage Template
 * @since 1.2.0
 */
get_header();
?>

<?php 
do_action('audiotheme_before_main_content');
?>

<?php 
while (have_posts()) {
    the_post();
    $gig = get_audiotheme_gig();
    $venue = get_audiotheme_venue($gig->venue->ID);
    ?>

	<dl id="audiotheme-gig" <?php 
    post_class(array('audiotheme-gig-single', 'audiotheme-clearfix'));
    ?>
 itemscope itemtype="http://schema.org/MusicEvent">

		<?php 
    if (audiotheme_gig_has_venue()) {
        ?>

			<dt class="audiotheme-gig-header">
				<?php 
        the_title('<h1 class="audiotheme-gig-title entry-title" itemprop="name">', '</h1>');
        ?>