function gigpress_show_related($content) { global $is_excerpt, $wpdb, $gpo, $post; if ($is_excerpt == TRUE || !is_object($post)) { $is_excerpt = FALSE; return $content; } else { $shows = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS . " AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE show_related = %d AND show_status != 'deleted' AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id ORDER BY show_date ASC,show_time ASC", $post->ID)); if ($shows != FALSE) { ob_start(); $count = 1; $total_shows = count($shows); foreach ($shows as $show) { $showdata = gigpress_prepare($show, 'related'); include gigpress_template('related'); $count++; } $giginfo = ob_get_clean(); if ($gpo['related_position'] == "before") { $output = $giginfo . $content; } else { $output = $content . $giginfo; } return $output; } else { return $content; } } }
function gigpress_ical() { global $wpdb, $gpo; $further_where = ''; if (isset($_GET['show_id'])) { $further_where .= $wpdb->prepare(' AND s.show_id = %d', $_GET['show_id']); } if (isset($_GET['artist'])) { $further_where .= $wpdb->prepare(' AND s.show_artist_id = %d', $_GET['artist']); } if (isset($_GET['tour'])) { $further_where .= $wpdb->prepare(' AND s.show_tour_id = %d', $_GET['tour']); } if (isset($_GET['venue'])) { $further_where .= $wpdb->prepare(' AND s.show_venue_id = %d', $_GET['venue']); } $shows = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS . " AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE show_status != 'deleted' AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id" . $further_where, $_GET['show_id'])); if ($shows) { $count = 1; $total = count($shows); foreach ($shows as $show) { $showdata = gigpress_prepare($show, 'ical'); if (isset($_GET['artist'])) { $filename = sanitize_title($showdata['artist']) . '-icalendar'; $title = $show->artist_name; } elseif (isset($_GET['tour'])) { $filename = sanitize_title($showdata['tour']) . '-icalendar'; $title = $show->tour_name; } elseif (isset($_GET['venue'])) { $filename = sanitize_title($showdata['venue_plain']) . '-icalendar'; $title = $show->venue_name; } elseif (isset($_GET['show_id'])) { $filename = sanitize_title($showdata['artist']) . '-' . $show->show_date; $title = $show->artist_name . ' - ' . $showdata['date']; } else { $filename = sanitize_title(get_bloginfo('name')) . '-icalendar'; $title = $gpo['rss_title']; } if ($count == 1) { header('Content-type: text/calendar'); header('Content-Disposition: attachment; filename="' . $filename . '.ics"'); echo "BEGIN:VCALENDAR\nX-WR-CALNAME:" . $title . "\nPRODID:GIGPRESS 2.0 WORDPRESS PLUGIN\nVERSION:2.0\nCALSCALE:GREGORIAN\nX-WR-TIMEZONE:Etc/GMT\nMETHOD:PUBLISH\n"; } echo "BEGIN:VEVENT\nSUMMARY;CHARSET=" . get_bloginfo('charset') . ':' . $showdata['calendar_summary'] . "\nDESCRIPTION;CHARSET=" . get_bloginfo('charset') . ':' . $showdata['calendar_details'] . "\nLOCATION;CHARSET=" . get_bloginfo('charset') . ':' . $showdata['calendar_location'] . "\nUID:" . $showdata['calendar_start'] . '-' . $showdata['id'] . '-' . get_bloginfo('admin_email') . "\nURL:" . $showdata['permalink'] . "\nDTSTART;VALUE=DATE;TZID=Etc/GMT:" . $showdata['calendar_start'] . "\nDTEND;VALUE=DATE;TZID=Etc/GMT:" . $showdata['calendar_end'] . "\nDTSTAMP:" . date('Ymd') . 'T' . date('his') . 'Z' . "\nEND:VEVENT\n"; if ($count == $total) { echo "END:VCALENDAR"; } $count++; } } }
function gigpress_show_related($args = array(), $content = '') { global $is_excerpt, $wpdb, $gpo, $post; if ($is_excerpt == TRUE || !is_object($post)) { $is_excerpt = FALSE; return $content; } else { extract(shortcode_atts(array('scope' => 'all', 'sort' => 'asc'), $args)); // Date conditionals based on scope switch ($scope) { case 'upcoming': $date_condition = ">= '" . GIGPRESS_NOW . "'"; break; case 'past': $date_condition = "< '" . GIGPRESS_NOW . "'"; break; case 'all': $date_condition = "!= ''"; } $shows = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS . " AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE show_related = %d AND show_expire " . $date_condition . " AND show_status != 'deleted' AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id ORDER BY show_date " . $sort . ",show_expire " . $sort . ",show_time " . $sort, $post->ID)); if ($shows != FALSE) { ob_start(); $count = 1; $total_shows = count($shows); foreach ($shows as $show) { $showdata = gigpress_prepare($show, 'related'); include gigpress_template('related'); $count++; } $giginfo = ob_get_clean(); if ($gpo['related_position'] == "before") { $output = $giginfo . $content; } else { $output = $content . $giginfo; } return $output; } else { return $content; } } }
function gigpress_sidebar($filter = null) { global $wpdb, $gpo; $further_where = $orderby = ''; // Variables we need for conditionals // Check total number of artists $total_artists = $wpdb->get_var("SELECT count(*) from " . GIGPRESS_ARTISTS); // Check for sorting if (isset($filter['sort'])) { $sort = $filter['sort']; } // Scope switch ($filter['scope']) { case 'today': $date_condition = "show_expire >= '" . GIGPRESS_NOW . "' AND show_date <= '" . GIGPRESS_NOW . "'"; if (!isset($sort)) { $sort = 'asc'; } break; case 'past': $date_condition = "show_expire < '" . GIGPRESS_NOW . "'"; if (!isset($sort)) { $sort = 'desc'; } break; case 'all': $date_condition = "show_date != ''"; if (!isset($sort)) { $sort = 'desc'; } break; default: $date_condition = "show_expire >= '" . GIGPRESS_NOW . "'"; } // Number of shows to list (per artist if grouping by artist) $limit = isset($filter['limit']) && is_numeric($filter['limit']) ? $wpdb->prepare('%d', $filter['limit']) : 5; // Whether or not to display tour grouings $show_tours = isset($filter['show_tours']) && $filter['show_tours'] == 'yes' ? 'yes' : FALSE; // Whether or not to group artists $group_artists = isset($filter['group_artists']) && $filter['group_artists'] == 'yes' ? 'yes' : FALSE; // Order in which to display artists if grouping $artist_order = isset($filter['artist_order']) && $filter['artist_order'] == 'custom' ? 'custom' : 'alphabetical'; // Filtering by artist, tour, or venue? $artist = isset($filter['artist']) ? $filter['artist'] : FALSE; $tour = isset($filter['tour']) ? $filter['tour'] : FALSE; $venue = isset($filter['venue']) ? $filter['venue'] : FALSE; // Display feed links and link to more shows? $show_feeds = isset($filter['show_feeds']) && $filter['show_feeds'] == 'yes' ? 'yes' : FALSE; $link = isset($filter['link_text']) && !empty($gpo['shows_page']) ? wptexturize($filter['link_text']) : FALSE; // Establish the variable parts of the query if ($artist) { $further_where .= ' AND show_artist_id IN(' . $wpdb->prepare('%s', $artist) . ')'; } if ($tour) { $further_where .= ' AND show_tour_id IN(' . $wpdb->prepare('%s', $tour) . ')'; } if ($venue) { $further_where .= ' AND show_venue_id IN(' . $wpdb->prepare('%s', $venue) . ')'; } if ($group_artists) { $orderby = 'a.artist_name ASC,'; } $artist_order = $artist_order == 'custom' ? "artist_order ASC," : ''; ob_start(); // If we're grouping by artist, we'll unfortunately have to first get all artists // Then make a query for each one. Looking for a better way to do this. if ($group_artists && !$tour && !$artist && !$venue && $total_artists > 1) { $artists = $wpdb->get_results("SELECT * FROM " . GIGPRESS_ARTISTS . " ORDER BY " . $artist_order . "artist_name ASC"); foreach ($artists as $artist_group) { $shows = $wpdb->get_results("SELECT * FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS . " AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE " . $date_condition . " AND show_status != 'deleted' AND s.show_artist_id = " . $artist_group->artist_id . " AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id " . $further_where . " ORDER BY s.show_date " . $sort . ",s.show_time " . $sort . " LIMIT " . $limit); if ($shows) { // For each artist group $some_results = TRUE; $current_tour = ''; $i = 0; // Data for artist heading $showdata = array('artist' => wptexturize($artist_group->artist_name), 'artist_id' => $artist_group->artist_id); include gigpress_template('sidebar-artist-heading'); include gigpress_template('sidebar-list-start'); foreach ($shows as $show) { // For each individual show $showdata = gigpress_prepare($show, 'public'); // Close the previous tour if needed if ($show_tours && $current_tour && $showdata['tour'] != $current_tour) { include gigpress_template('sidebar-tour-end'); } // Open the current tour if needed if ($show_tours && $showdata['tour'] && $showdata['tour'] != $current_tour && !$tour) { $current_tour = $showdata['tour']; include gigpress_template('sidebar-tour-heading'); } // Zero-out $current_tour if (empty($showdata['tour'])) { $current_tour = ''; } // Prepare the class $class = $i % 2 ? 'gigpress-alt ' : ''; $i++; $class .= $showdata['tour'] && $show_tours ? 'gigpress-tour ' . $showdata['status'] : $showdata['status']; // Display the show include gigpress_template('sidebar-list'); } // Close the current tour if needed if ($show_tours && $current_tour) { include gigpress_template('sidebar-tour-end'); } // Close the list include gigpress_template('sidebar-list-end'); } } if ($some_results) { // After all artist groups // Display the list footer include gigpress_template('sidebar-list-footer'); } else { // No shows from any artist include gigpress_template('sidebar-list-empty'); } } else { // Not grouping by artists $shows = $wpdb->get_results("SELECT * FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS . " AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE " . $date_condition . " AND show_status != 'deleted' AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id " . $further_where . " ORDER BY s.show_date " . $sort . ",s.show_time " . $sort . " LIMIT " . $limit); if ($shows) { $current_tour = ''; $i = 0; include gigpress_template('sidebar-list-start'); foreach ($shows as $show) { // For each individual show $showdata = gigpress_prepare($show, 'public'); // Close the previous tour if needed if ($show_tours && $current_tour && $showdata['tour'] != $current_tour && !$tour) { include gigpress_template('sidebar-tour-end'); } // Open the current tour if needed if ($show_tours && $showdata['tour'] && $showdata['tour'] != $current_tour && !$tour) { $current_tour = $showdata['tour']; include gigpress_template('sidebar-tour-heading'); } if (!$showdata['tour']) { $current_tour = ''; } // Prepare the class $class = $i % 2 ? 'gigpress-alt ' : ''; $i++; $class .= $showdata['tour'] && $show_tours ? 'gigpress-tour ' . $showdata['status'] : $showdata['status']; // Display the show include gigpress_template('sidebar-list'); } // Close the current tour if needed if ($show_tours && $current_tour && !$tour) { include gigpress_template('sidebar-tour-end'); } // Close the list include gigpress_template('sidebar-list-end'); // Display the list footer include gigpress_template('sidebar-list-footer'); } else { // No shows from any artist include gigpress_template('sidebar-list-empty'); } } echo '<!-- Generated by GigPress ' . GIGPRESS_VERSION . ' --> '; return ob_get_clean(); }
function gigpress_venues() { global $wpdb, $gpo; if (isset($_POST['gpaction']) && $_POST['gpaction'] == "add") { require_once 'handlers.php'; $result = gigpress_add_venue(); } if (isset($_POST['gpaction']) && $_POST['gpaction'] == "update") { require_once 'handlers.php'; $result = gigpress_update_venue(); } if (isset($_GET['gpaction']) && $_GET['gpaction'] == "delete") { require_once 'handlers.php'; gigpress_delete_venue(); } $url_args = isset($_GET['gp-page']) ? '&gp-page=' . $_GET['gp-page'] : ''; ?> <div class="wrap gigpress gp-venues"> <?php screen_icon('gigpress'); ?> <h2><?php _e("Venues", "gigpress"); ?> </h2> <?php $venue_id = isset($_REQUEST['venue_id']) ? $wpdb->prepare('%d', $_REQUEST['venue_id']) : ''; // Check our context to determine what we're populating if (is_array($result)) { // This means we $_POSTed and there were errors $venue_name = gigpress_db_out($_POST['venue_name']); $venue_city = gigpress_db_out($_POST['venue_city']); $venue_address = gigpress_db_out($_POST['venue_address']); $venue_country = $_POST['venue_country']; $venue_url = gigpress_db_out($_POST['venue_url']); $venue_phone = gigpress_db_out($_POST['venue_phone']); } elseif (isset($_GET['gpaction']) && $_GET['gpaction'] == "edit") { // Just loaded for editing $venuedata = $wpdb->get_results("\n\t\t\tSELECT * from " . GIGPRESS_VENUES . " WHERE venue_id = " . $venue_id . " LIMIT 1\n\t\t"); if ($venuedata) { foreach ($venuedata as $venue) { $venue_name = gigpress_db_out($venue->venue_name); $venue_city = gigpress_db_out($venue->venue_city); $venue_address = gigpress_db_out($venue->venue_address); $venue_country = $venue->venue_country; $venue_url = gigpress_db_out($venue->venue_url); $venue_phone = gigpress_db_out($venue->venue_phone); } } else { $load_error = '<div id="message" class="error fade"><p>' . __("Sorry, but we had trouble loading that venue for editing.", "gigpress") . '</div>'; } } else { // New venue entry $venue_name = $venue_city = $venue_address = $venue_url = $venue_phone = $load_error = ''; $venue_country = $gpo['default_country']; } if (isset($_GET['gpaction']) && $_GET['gpaction'] == "edit" && $venuedata || is_array($result) && $result['editing'] == TRUE) { ?> <h3><?php _e("Edit this venue", "gigpress"); ?> </h3> <form method="post" action="<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?page=gigpress-venues" . $url_args; ?> "> <input type="hidden" name="gpaction" value="update" /> <input type="hidden" name="venue_id" value="<?php echo $venue_id; ?> " /> <?php } else { ?> <?php if ($load_error) { echo $load_error; } ?> <h3><?php _e("Add an venue", "gigpress"); ?> </h3> <form method="post" action="<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?page=gigpress-venues" . $url_args; ?> "> <input type="hidden" name="gpaction" value="add" /> <?php } ?> <?php wp_nonce_field('gigpress-action'); ?> <table class="form-table gp-table"> <tr> <th scope="row"><label for="venue_name"><?php _e("Venue name", "gigpress"); ?> :<span class="gp-required">*</span></label></th> <td><input type="text" size="48" name="venue_name" id="venue_name" value="<?php echo $venue_name; ?> "<?php if ($result['venue_name']) { echo ' class="gigpress-error"'; } ?> /></td> </tr> <tr> <th scope="row"><label for="venue_city"><?php _e("Venue city", "gigpress"); ?> :<span class="gp-required">*</span></label></th> <td><input type="text" size="48" name="venue_city" id="venue_city" value="<?php echo $venue_city; ?> "<?php if ($result['venue_city']) { echo ' class="gigpress-error"'; } ?> /></td> </tr> <tr> <th scope="row"><label for="venue_address"><?php _e("Venue address", "gigpress"); ?> :</label></th> <td><input type="text" size="48" name="venue_address" id="venue_address" value="<?php echo $venue_address; ?> " /></td> </tr> <tr> <th scope="row"><label for="venue_country"><?php _e("Venue country", "gigpress"); ?> :</label></th> <td> <select name="venue_country" id="venue_country"> <?php global $gp_countries; foreach ($gp_countries as $code => $name) { $sel = $code == $venue_country ? ' selected="selected"' : ''; echo '<option value="' . $code . '"' . $sel . '>' . $name . '</option>'; } ?> </select> </td> </tr> <tr> <th scope="row"><label for="venue_url"><?php _e("Venue website", "gigpress"); ?> :</label></th> <td><input type="text" size="48" name="venue_url" id="venue_url" value="<?php echo $venue_url; ?> " /></td> </tr> <tr> <th scope="row"><label for="venue_phone"><?php _e("Venue phone", "gigpress"); ?> :</label></th> <td><input type="text" size="48" name="venue_phone" id="venue_phone" value="<?php echo $venue_phone; ?> " /></td> </tr> <tr> <td> </td> <td> <?php if (isset($_GET['gpaction']) && $_GET['gpaction'] == "edit" || is_array($result) && $result['editing'] == TRUE) { ?> <span class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e("Update venue", "gigpress"); ?> " /></span> <?php _e("or", "gigpress"); ?> <a href="<?php bloginfo('wpurl'); ?> /wp-admin/admin.php?page=gigpress-venues<?php echo $url_args; ?> "><?php _e("cancel", "gigpress"); ?> </a> <?php } else { ?> <span class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e("Add venue", "gigpress"); ?> " /></span> <?php } ?> </td> </tr> </table> </form> <h3><?php _e("All venues", "gigpress"); ?> </h3> <div class="tablenav"> <div class="alignleft"> <p><?php _e("Note that you cannot delete a venue while it has shows in the database.", "gigpress"); ?> </p> </div> <?php $venue_count = $wpdb->get_var("SELECT COUNT(*) FROM " . GIGPRESS_VENUES); if ($venue_count) { $pagination_args['page'] = 'gigpress-venues'; $pagination = gigpress_admin_pagination($venue_count, 15, $pagination_args); if ($pagination) { echo $pagination['output']; } } $limit = isset($_GET['gp-page']) ? $pagination['offset'] . ',' . $pagination['records_per_page'] : 15; ?> <div class="clear"></div> </div> <table class="widefat"> <thead> <tr> <th scope="col" class="gp-tiny">ID</th> <th scope="col"><?php _e("Name", "gigpress"); ?> </th> <th scope="col"><?php _e("City", "gigpress"); ?> </th> <th scope="col"><?php _e("Address", "gigpress"); ?> </th> <th scope="col"><?php _e("Country", "gigpress"); ?> </th> <th scope="col"><?php _e("Phone", "gigpress"); ?> </th> <th scope="col" class="gp-centre"><?php _e("Number of shows", "gigpress"); ?> </th> <th class="gp-centre" scope="col"><?php _e("Actions", "gigpress"); ?> </th> </tr> </thead> <tbody> <?php $venues = $wpdb->get_results("SELECT * FROM " . GIGPRESS_VENUES . " ORDER BY venue_name ASC LIMIT " . $limit); if ($venues) { foreach ($venues as $venue) { if ($n = $wpdb->get_var("SELECT count(*) FROM " . GIGPRESS_SHOWS . " WHERE show_venue_id = " . $venue->venue_id . " AND show_status != 'deleted'")) { $count = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-shows&venue_id=' . $venue->venue_id . '">' . $n . '</a>'; } else { $count = 0; } $venuedata = gigpress_prepare($venue, 'venue'); ++$i; $style = $i % 2 ? '' : ' class="alternate"'; // Print out our rows. ?> <tr<?php echo $style; ?> > <td class="gp-tiny"><?php echo $venuedata['venue_id']; ?> </td> <td><?php echo $venuedata['venue']; ?> </td> <td><?php echo $venuedata['city']; ?> </td> <td><?php echo $venuedata['address']; ?> </td> <td><?php echo $venuedata['country']; ?> </td> <td><?php echo $venuedata['venue_phone']; ?> </td> <td class="gp-centre"><?php echo $count; ?> </td> <td class="gp-centre"> <a href="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-venues&gpaction=edit&venue_id=' . $venue->venue_id . $url_args; ?> " class="edit"><?php _e("Edit", "gigpress"); ?> </a> <?php if (!$count) { ?> | <a href="<?php echo wp_nonce_url(get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-venues&gpaction=delete&venue_id=' . $venue->venue_id . $url_args, 'gigpress-action'); ?> " class="delete"><?php _e("Delete", "gigpress"); ?> </a><?php } ?> </td> </tr> <?php } } else { // We don't have any venues, so let's say so ?> <tr><td colspan="7"><strong><?php _e("No venues in the database", "gigpress"); ?> </strong></td></tr> <?php } ?> </tbody> <tfoot> <tr> <th scope="col" class="gp-tiny">ID</th> <th scope="col"><?php _e("Name", "gigpress"); ?> </th> <th scope="col"><?php _e("City", "gigpress"); ?> </th> <th scope="col"><?php _e("Address", "gigpress"); ?> </th> <th scope="col"><?php _e("Country", "gigpress"); ?> </th> <th scope="col"><?php _e("Phone", "gigpress"); ?> </th> <th scope="col" class="gp-centre"><?php _e("Number of shows", "gigpress"); ?> </th> <th class="gp-centre" scope="col"><?php _e("Actions", "gigpress"); ?> </th> </tr> </tfoot> </table> <div class="tablenav"> <?php if ($pagination) { echo $pagination['output']; } ?> </div> </div> <?php }
function gigpress_admin_shows() { if (isset($_REQUEST['gpaction']) && $_REQUEST['gpaction'] == "delete") { require_once 'handlers.php'; gigpress_delete_show(); } if (isset($_GET['gpaction']) && $_GET['gpaction'] == "undo") { require_once 'handlers.php'; gigpress_undo('show'); } if (isset($_POST['gpaction']) && $_POST['gpaction'] == "update") { require_once 'handlers.php'; gigpress_update_show(); } if (isset($_GET['gpaction']) && $_GET['gpaction'] == "trash") { require_once 'handlers.php'; gigpress_empty_trash(); } global $wpdb, $gpo; // Checks for filtering and pagination $url_args = ''; $further_where = ''; $pagination_args = array(); switch ($_GET['scope']) { case 'upcoming': $condition = ">= '" . GIGPRESS_NOW . "'"; $url_args .= '&scope=upcoming'; $pagination_args['scope'] = 'upcoming'; break; case 'past': $condition = "< '" . GIGPRESS_NOW . "'"; $url_args .= '&scope=past'; $pagination_args['scope'] = 'past'; break; default: $condition = 'IS NOT NULL'; } global $current_user; get_currentuserinfo(); switch ($_GET['sort']) { case 'asc': $sort = 'ASC'; update_usermeta($current_user->ID, 'gigpress_sort', $sort); break; case 'desc': $sort = 'DESC'; update_usermeta($current_user->ID, 'gigpress_sort', $sort); break; } if (!isset($_GET['sort'])) { if (!($sort = get_usermeta($current_user->ID, 'gigpress_sort'))) { $sort = 'DESC'; update_usermeta($current_user->ID, 'gigpress_sort', $sort); } } if (isset($_GET['gp-page'])) { $url_args .= '&gp-page=' . $_GET['gp-page']; } if (isset($_GET['artist_id']) && $_GET['artist_id'] != '-1') { $further_where .= ' AND s.show_artist_id = ' . $wpdb->prepare('%d', $_GET['artist_id']) . ' '; $pagination_args['artist_id'] = $_GET['artist_id']; $url_args .= '&artist_id=' . $_GET['artist_id']; } if (isset($_GET['tour_id']) && $_GET['tour_id'] != '-1') { $further_where .= ' AND s.show_tour_id = ' . $wpdb->prepare('%d', $_GET['tour_id']) . ' '; $pagination_args['tour_id'] = $_GET['tour_id']; $url_args .= '&tour_id=' . $_GET['tour_id']; } if (isset($_GET['venue_id']) && $_GET['venue_id'] != '-1') { $further_where .= ' AND s.show_venue_id = ' . $wpdb->prepare('%d', $_GET['venue_id']) . ' '; $pagination_args['venue_id'] = $_GET['venue_id']; $url_args .= '&venue_id=' . $_GET['venue_id']; } // Build pagination $show_count = $wpdb->get_var("SELECT COUNT(*) FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS . " AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE show_expire " . $condition . " AND show_status != 'deleted' AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id " . $further_where . "ORDER BY show_date " . $sort . ",show_time " . $sort); if ($show_count) { $pagination_args['page'] = 'gigpress-shows'; $pagination = gigpress_admin_pagination($show_count, 10, $pagination_args); } $limit = isset($_GET['gp-page']) ? $pagination['offset'] . ',' . $pagination['records_per_page'] : 10; // Build the query $shows = $wpdb->get_results("\n\t\tSELECT * FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS . " AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE show_expire " . $condition . " AND show_status != 'deleted' AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id " . $further_where . "ORDER BY show_date " . $sort . ",show_expire " . $sort . ",show_time " . $sort . " LIMIT " . $limit); ?> <div class="wrap gigpress"> <?php screen_icon('gigpress'); ?> <h2><?php _e("Shows", "gigpress"); ?> </h2> <ul class="subsubsub"> <?php $all = $wpdb->get_var("SELECT COUNT(show_id) FROM " . GIGPRESS_SHOWS . " WHERE show_status != 'deleted'"); $upcoming = $wpdb->get_var("SELECT count(show_id) FROM " . GIGPRESS_SHOWS . " WHERE show_expire >= '" . GIGPRESS_NOW . "' AND show_status != 'deleted'"); $past = $wpdb->get_var("SELECT count(show_id) FROM " . GIGPRESS_SHOWS . " WHERE show_expire < '" . GIGPRESS_NOW . "' AND show_status != 'deleted'"); echo '<li><a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-shows"'; if (!isset($_GET['scope'])) { echo ' class="current"'; } echo '>' . __("All", "gigpress") . '</a> <span class="count">(' . $all . ')</span> | </li>'; echo '<li><a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-shows&scope=upcoming"'; if (isset($_GET['scope']) && $_GET['scope'] == 'upcoming') { echo ' class="current"'; } echo '>' . __("Upcoming", "gigpress") . '</a> <span class="count">(' . $upcoming . ')</span> | </li>'; echo '<li><a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-shows&scope=past"'; if (isset($_GET['scope']) && $_GET['scope'] == 'past') { echo ' class="current"'; } echo '>' . __("Past", "gigpress") . '</a> <span class="count">(' . $past . ')</span></li>'; ?> </ul> <div class="tablenav"> <div class="alignleft"> <form action="" method="get"> <div> <input type="hidden" name="page" value="gigpress-shows" /> <?php if (isset($_GET['scope'])) { ?> <input type="hidden" name="scope" value="<?php echo $_GET['scope']; ?> " /> <?php } ?> <select name="artist_id"> <option value="-1"><?php _e("View all artists", "gigpress"); ?> </option> <?php $artistdata = fetch_gigpress_artists(); if ($artistdata) { foreach ($artistdata as $artist) { $selected = isset($_GET['artist_id']) && $_GET['artist_id'] == $artist->artist_id ? ' selected="selected"' : ''; echo '<option value="' . $artist->artist_id . '"' . $selected . '>' . gigpress_db_out($artist->artist_name) . '</option>'; } } else { echo '<option value="-1">' . __("No artists in the database", "gigpress") . '</option>'; } ?> </select> <select name="tour_id"> <option value="-1"><?php _e("View all tours", "gigpress"); ?> </option> <?php $tourdata = fetch_gigpress_tours(); if ($tourdata) { foreach ($tourdata as $tour) { $selected = isset($_GET['tour_id']) && $_GET['tour_id'] == $tour->tour_id ? ' selected="selected"' : ''; echo '<option value="' . $tour->tour_id . '"' . $selected . '>' . gigpress_db_out($tour->tour_name) . '</option>'; } } else { echo '<option value="-1">' . __("No tours in the database", "gigpress") . '</option>'; } ?> </select> <select name="venue_id"> <option value="-1"><?php _e("View all venues", "gigpress"); ?> </option> <?php $venuedata = fetch_gigpress_venues(); if ($venuedata) { foreach ($venuedata as $venue) { $selected = isset($_GET['venue_id']) && $_GET['venue_id'] == $venue->venue_id ? ' selected="selected"' : ''; echo '<option value="' . $venue->venue_id . '"' . $selected . '>' . gigpress_db_out($venue->venue_name) . '</option>'; } } else { echo '<option value="-1">' . __("No venues in the database", "gigpress") . '</option>'; } ?> </select> <select name="sort"> <option value="desc"<?php if ($sort == 'DESC') { echo ' selected="selected"'; } ?> ><?php _e("Descending", "gigpress"); ?> </option> <option value="asc"<?php if ($sort == 'ASC') { echo ' selected="selected"'; } ?> ><?php _e("Ascending", "gigpress"); ?> </option> </select> <input type="submit" value="Filter" class="button-secondary" /> </div> </form> </div> <?php if ($pagination) { echo $pagination['output']; } ?> <div class="clear"></div> </div> <form action="" method="post"> <?php wp_nonce_field('gigpress-action'); ?> <input type="hidden" name="gpaction" value="delete" /> <table class="widefat"> <thead> <tr> <th scope="col" class="column-cb check-column"><input type="checkbox" /></th> <th scope="col"><?php _e("Date", "gigpress"); ?> </th> <th scope="col"><?php _e("Artist", "gigpress"); ?> </th> <th scope="col"><?php _e("City", "gigpress"); ?> </th> <th scope="col"><?php _e("Venue", "gigpress"); ?> </th> <th scope="col"><?php _e("Country", "gigpress"); ?> </th> <th scope="col"><?php _e("Tour", "gigpress"); ?> </th> <th class="gp-centre" scope="col"><?php _e("Actions", "gigpress"); ?> </th> </tr> </thead> <tfoot> <tr> <th scope="col" class="column-cb check-column"><input type="checkbox" /></th> <th scope="col"><?php _e("Date", "gigpress"); ?> </th> <th scope="col"><?php _e("Artist", "gigpress"); ?> </th> <th scope="col"><?php _e("City", "gigpress"); ?> </th> <th scope="col"><?php _e("Venue", "gigpress"); ?> </th> <th scope="col"><?php _e("Country", "gigpress"); ?> </th> <th scope="col"><?php _e("Tour", "gigpress"); ?> </th> <th class="gp-centre" scope="col"><?php _e("Actions", "gigpress"); ?> </th> </tr> </tfoot> <tbody> <?php // Do we have dates? if ($shows != FALSE) { foreach ($shows as $show) { $showdata = gigpress_prepare($show, 'admin'); ?> <tr class="<?php echo 'gigpress-' . $showdata['status']; ?> "> <th scope="row" class="check-column"><input type="checkbox" name="show_id[]" value="<?php echo $show->show_id; ?> " /></th> <td><span class="gigpress-date"><?php echo $showdata['date']; if ($showdata['end_date']) { echo ' - ' . $showdata['end_date']; } ?> </span> </td> <td><?php echo $showdata['artist']; ?> </td> <td><?php echo $showdata['city']; ?> </td> <td><?php echo $showdata['venue']; if ($showdata['address']) { echo ' (' . $showdata['address'] . ')'; } ?> </td> <td><?php echo $showdata['country']; ?> </td> <td><?php echo $showdata['tour']; ?> </td> <td class="gp-centre"> <a href="<?php bloginfo('wpurl'); ?> /wp-admin/admin.php?page=gigpress/gigpress.php&gpaction=edit&show_id=<?php echo $show->show_id; ?> " class="edit" title="<?php _e("Edit", "gigpress"); ?> "><?php _e("Edit", "gigpress"); ?> </a> | <a href="<?php bloginfo('wpurl'); ?> /wp-admin/admin.php?page=gigpress/gigpress.php&gpaction=copy&show_id=<?php echo $show->show_id; ?> " class="edit" title="<?php _e("Copy", "gigpress"); ?> "><?php _e("Copy", "gigpress"); ?> </a> </td> </tr> <tr class="<?php echo 'alternate' . ' gigpress-' . $showdata['status']; ?> "> <td colspan="8"><small> <?php if ($showdata['time']) { echo $showdata['time'] . '. '; } if ($showdata['price']) { echo __("Price", "gigpress") . ': ' . $showdata['price'] . '. '; } if ($showdata['admittance']) { echo $showdata['admittance'] . '. '; } if ($showdata['ticket_link']) { echo $showdata['ticket_link'] . '. '; } if ($showdata['ticket_phone']) { echo __('Box office', "gigpress") . ': ' . $showdata['ticket_phone'] . '. '; } echo $showdata['notes'] . ' '; echo $showdata['related_edit']; ?> </small></td> </tr> <?php } // end foreach } else { // No results from the query ?> <tr><td colspan="8"><?php _e("Sorry, no shows to display based on your criteria.", "gigpress"); ?> </td></tr> <?php } ?> </tbody> </table> <div class="tablenav"> <div class="alignleft"> <input type="submit" value="<?php _e('Trash selected shows', 'gigpress'); ?> " class="button-secondary" /> <?php if ($tour_count = $wpdb->get_var("SELECT count(*) FROM " . GIGPRESS_TOURS . " WHERE tour_status = 'deleted'")) { $tours = $tour_count; } else { $tours = 0; } if ($show_count = $wpdb->get_var("SELECT count(*) FROM " . GIGPRESS_SHOWS . " WHERE show_status = 'deleted'")) { $shows = $show_count; } else { $shows = 0; } if ($tour_count || $show_count) { echo '<small>' . __("You have", "gigpress") . ' <strong>' . $shows . ' ' . __("shows", "gigpress") . '</strong> ' . __("and", "gigpress") . ' <strong>' . $tours . ' ' . __("tours", "gigpress") . '</strong> ' . __("in your trash", "gigpress") . '.'; if ($shows != 0 || $tours != 0) { echo ' <a href="' . wp_nonce_url(get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-shows&gpaction=trash' . $url_args, 'gigpress-action') . '">' . __("Take out the trash now", "gigpress") . '</a>.'; } echo '</small>'; } ?> </div> <?php if ($pagination) { echo $pagination['output']; } ?> </div> </form> </div> <?php }
function gigpress_shows($filter = null, $content = null) { global $wpdb, $gpo; $further_where = $limit = ''; extract(shortcode_atts(array('tour' => FALSE, 'artist' => FALSE, 'venue' => FALSE, 'limit' => FALSE, 'scope' => 'upcoming', 'sort' => FALSE, 'group_artists' => 'yes', 'artist_order' => 'custom', 'show_menu' => FALSE, 'show_menu_count' => FALSE, 'menu_sort' => FALSE, 'menu_title' => FALSE, 'year' => FALSE, 'month' => FALSE), $filter)); $total_artists = $wpdb->get_var("SELECT count(*) from " . GIGPRESS_ARTISTS); // Date conditionals and sorting based on scope switch ($scope) { case 'upcoming': $date_condition = "show_expire >= '" . GIGPRESS_NOW . "'"; if (empty($sort)) { $sort = 'asc'; } break; case 'past': $date_condition = "show_expire < '" . GIGPRESS_NOW . "'"; if (empty($sort)) { $sort = 'desc'; } break; case 'today': $date_condition = "show_expire >= '" . GIGPRESS_NOW . "' AND show_date <= '" . GIGPRESS_NOW . "'"; if (empty($sort)) { $sort = 'asc'; } break; case 'all': $date_condition = "show_expire != ''"; if (empty($sort)) { $sort = 'desc'; } break; } // Artist, tour and venue filtering if ($artist) { $further_where .= ' AND show_artist_id = ' . $wpdb->prepare('%d', $artist); } if ($tour) { $further_where .= ' AND show_tour_id = ' . $wpdb->prepare('%d', $tour); } if ($venue) { $further_where .= ' AND show_venue_id = ' . $wpdb->prepare('%d', $venue); } // Date filtering // Query vars take precedence over function vars if (isset($_REQUEST['gpy'])) { $year = $_REQUEST['gpy']; if (isset($_REQUEST['gpm'])) { $month = $_REQUEST['gpm']; } else { unset($month); } $no_limit = TRUE; } // Validate year and date parameters if ($year || $month) { if ($year) { if (is_numeric($year) && strlen($year) == 4) { $year = round($year); } else { $year = date('Y', current_time('timestamp')); } } else { // We've only specified a month, so we'll assume the year is current $year = date('Y', current_time('timestamp')); } if ($month) { if ($month == 'current') { $month = date('m', current_time('timestamp')); } elseif (round($month) == 0) { // Probably using a month name $month = date('m', strtotime($month)); } elseif (round($month) < 10) { // Make sure the month is padded through 09 $month = str_pad($month, 2, 0, STR_PAD_LEFT); } elseif (round($month) < 13) { // Between 10 and 12 we're OK $month = $month; } else { // Bogus month value (not a string and > 12) // Sorry, bailing out. Your "month" will be ignored. Dink. $month = FALSE; } $start_month = $end_month = $month; } if (!$month) { $start_month = '01'; $end_month = '12'; } $start = $year . '-' . $start_month . '-01'; $end = $year . '-' . $end_month . '-31'; $further_where .= ' AND show_date BETWEEN ' . $wpdb->prepare('%s', $start) . ' AND ' . $wpdb->prepare('%s', $end); } $limit = $limit && !$no_limit ? ' LIMIT ' . $wpdb->prepare('%d', $limit) : ''; $artist_order = $artist_order == 'custom' ? "artist_order ASC," : ''; // With the new 'all' scope, we should probably have a third message option, but I'm too lazy // Really, there should just be one generic 'no shows' message. Oh well. $no_results_message = $scope == 'upcoming' ? wptexturize($gpo['noupcoming']) : wptexturize($gpo['nopast']); ob_start(); // Are we showing our menu? if ($show_menu) { $menu_options = array(); $menu_options['scope'] = $scope; $menu_options['type'] = $show_menu; if ($menu_title) { $menu_options['title'] = $menu_title; } if ($show_menu_count) { $menu_options['show_count'] = $show_menu_count; } if ($menu_sort) { $menu_options['sort'] = $menu_sort; } if ($artist) { $menu_options['artist'] = $artist; } if ($tour) { $menu_options['tour'] = $tour; } if ($venue) { $menu_options['venue'] = $venue; } include gigpress_template('before-menu'); echo gigpress_menu($menu_options); include gigpress_template('after-menu'); } // If we're grouping by artist, we'll unfortunately have to first get all artists // Then make a query for each one. Looking for a better way to do this. if ($group_artists == 'yes' && !$artist && $total_artists > 1) { $artists = $wpdb->get_results("SELECT * FROM " . GIGPRESS_ARTISTS . " ORDER BY " . $artist_order . "artist_name ASC"); foreach ($artists as $artist_group) { $shows = $wpdb->get_results("SELECT * FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS . " AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE " . $date_condition . " AND show_status != 'deleted' AND s.show_artist_id = " . $artist_group->artist_id . " AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id " . $further_where . " ORDER BY s.show_date " . $sort . ",s.show_expire " . $sort . ",s.show_time " . $sort . $limit); if ($shows) { // For each artist group $some_results = TRUE; $current_tour = ''; $i = 0; $showdata = array('artist' => wptexturize($artist_group->artist_name), 'artist_id' => $artist_group->artist_id); include gigpress_template('shows-artist-heading'); include gigpress_template('shows-list-start'); foreach ($shows as $show) { // For each individual show $showdata = gigpress_prepare($show, 'public'); if ($showdata['tour'] && $showdata['tour'] != $current_tour && !$tour) { $current_tour = $showdata['tour']; include gigpress_template('shows-tour-heading'); } $class = $showdata['status']; ++$i; $class .= $i % 2 ? '' : ' gigpress-alt'; if (!$showdata['tour'] && $current_tour) { $current_tour = ''; $class .= ' divider'; } $class .= $showdata['tour'] && !$tour ? ' gigpress-tour' : ''; include gigpress_template('shows-list'); } include gigpress_template('shows-list-end'); } } if ($some_results) { // After all artist groups include gigpress_template('shows-list-footer'); } else { // No shows from any artist include gigpress_template('shows-list-empty'); } } else { // Not grouping by artists $shows = $wpdb->get_results("\n\t\t\tSELECT * FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS . " AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE " . $date_condition . " AND show_status != 'deleted' AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id " . $further_where . " ORDER BY s.show_date " . $sort . ",s.show_expire " . $sort . ",s.show_time " . $sort . $limit); if ($shows) { $current_tour = ''; $i = 0; include gigpress_template('shows-list-start'); foreach ($shows as $show) { // For each individual show $showdata = gigpress_prepare($show, 'public'); if ($showdata['tour'] && $showdata['tour'] != $current_tour && !$tour) { $current_tour = $showdata['tour']; include gigpress_template('shows-tour-heading'); } $class = $showdata['status']; ++$i; $class .= $i % 2 ? '' : ' gigpress-alt'; if (!$showdata['tour'] && $current_tour) { $current_tour = ''; $class .= ' divider'; } $class .= $showdata['tour'] && !$tour ? ' gigpress-tour' : ''; include gigpress_template('shows-list'); } include gigpress_template('shows-list-end'); include gigpress_template('shows-list-footer'); } else { // No shows to display include gigpress_template('shows-list-empty'); } } echo '<!-- Generated by GigPress ' . GIGPRESS_VERSION . ' --> '; return ob_get_clean(); }
function gigpress_feed() { global $wpdb, $gpo; header('Content-type: text/xml; charset=' . get_bloginfo('charset')); echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'; $filter = ''; $filter .= isset($_GET['tour']) ? $wpdb->prepare('AND s.show_tour_id = %d ', $_GET['tour']) : ''; $filter .= isset($_GET['artist']) ? $wpdb->prepare('AND s.show_artist_id = %d ', $_GET['artist']) : ''; $filter .= isset($_GET['venue']) ? $wpdb->prepare('AND s.show_venue_id = %d ', $_GET['venue']) : ''; $shows = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS . " AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE show_expire >= '" . GIGPRESS_NOW . "' AND show_status != 'deleted' AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id " . $filter . "ORDER BY show_date ASC,show_time ASC")); if ($shows != FALSE) { $count = 1; $total = count($shows); foreach ($shows as $show) { $showdata = gigpress_prepare($show, 'feed'); if ($count == 1) { ?> <channel> <title><?php echo wptexturize($gpo['rss_title']); if (isset($_GET['artist'])) { echo ': ' . $showdata['artist']; } if (isset($_GET['tour'])) { echo ': ' . $showdata['tour']; } if (isset($_GET['venue'])) { echo ': ' . $showdata['venue_plain']; } ?> </title> <description><?php echo wptexturize($gpo['rss_title']); if (isset($_GET['artist'])) { echo ': ' . $showdata['artist']; } if (isset($_GET['tour'])) { echo ': ' . $showdata['tour']; } if (isset($_GET['venue'])) { echo ': ' . $showdata['venue_plain']; } ?> </description> <atom:link href="<?php echo GIGPRESS_RSS; if (isset($_GET['artist'])) { echo '&artist=' . $_GET['artist']; } if (isset($_GET['tour'])) { echo '&tour=' . $_GET['tour']; } if (isset($_GET['venue'])) { echo '&venue=' . $_GET['venue']; } ?> " rel="self" type="application/rss+xml" /> <link><?php echo GIGPRESS_URL; ?> </link> <?php } ?> <item> <title><?php echo $showdata['artist'] . ' ' . __("in", "gigpress") . ' ' . $showdata['city'] . ' ' . __("on", "gigpress") . ' ' . $showdata['date']; ?> </title> <description><?php echo '<![CDATA['; ?> <ul> <li><strong><?php echo wptexturize($gpo['artist_label']); ?> :</strong> <?php echo $showdata['artist']; ?> </li> <?php if ($showdata['tour']) { ?> <li><strong><?php echo wptexturize($gpo['tour_label']); ?> :</strong> <?php echo $showdata['tour']; ?> </li> <?php } ?> <li><strong><?php _e("Date", "gigpress"); ?> :</strong> <?php echo $showdata['date_long']; ?> <?php if ($showdata['end_date']) { echo ' - ' . $showdata['end_date_long']; } ?> </li> <?php if ($showdata['time']) { ?> <li><strong><?php _e("Time", "gigpress"); ?> :</strong> <?php echo $showdata['time']; ?> </li> <?php } ?> <li><strong><?php _e("City", "gigpress"); ?> :</strong> <?php echo $showdata['city']; ?> </li> <li><strong><?php _e("Venue", "gigpress"); ?> :</strong> <?php echo $showdata['venue']; ?> </li> <?php if ($showdata['address']) { ?> <li><strong><?php _e("Address", "gigpress"); ?> :</strong> <?php echo $showdata['address']; ?> </li> <?php } ?> <?php if ($showdata['venue_phone']) { ?> <li><strong><?php _e("Venue phone", "gigpress"); ?> :</strong> <?php echo $showdata['venue_phone']; ?> </li> <?php } ?> <li><strong><?php _e("Country", "gigpress"); ?> :</strong> <?php echo $showdata['country']; ?> </li> <?php if ($showdata['price']) { ?> <li><strong><?php _e("Admission", "gigpress"); ?> :</strong> <?php echo $showdata['price']; ?> </li> <?php } ?> <?php if ($showdata['admittance']) { ?> <li><strong><?php _e("Age restrictions", "gigpress"); ?> :</strong> <?php echo $showdata['admittance']; ?> </li> <?php } ?> <?php if ($showdata['ticket_phone']) { ?> <li><strong><?php _e("Box office", "gigpress"); ?> :</strong> <?php echo $showdata['ticket_phone']; ?> </li> <?php } ?> <?php if ($showdata['ticket_link']) { ?> <li><?php echo $showdata['ticket_link']; ?> </li> <?php } ?> <?php if ($showdata['notes']) { ?> <li><strong><?php _e("Notes", "gigpress"); ?> :</strong> <?php echo $showdata['notes']; ?> </li> <?php } ?> <?php if ($showdata['related_link']) { ?> <li><?php echo $showdata['related_link']; ?> </li> <?php } ?> <li> <?php echo $showdata['gcal']; ?> | <?php echo $showdata['ical']; ?> </li> </ul> ]]></description> <link><?php echo $showdata['permalink']; ?> </link> <guid isPermaLink="false">#show-<?php echo $showdata['id']; ?> </guid> <pubDate><?php echo $showdata['rss_date']; ?> </pubDate> </item> <?php if ($count == $total) { echo '</channel>'; } $count++; } } echo '</rss>'; }