web/wp-content/plugins/gigs-calendar/rss.php
branchwordpress
changeset 109 03b0d1493584
equal deleted inserted replaced
-1:000000000000 109:03b0d1493584
       
     1 <?php
       
     2 
       
     3 header('Content-Type: application/rss+xml; charset=utf-8');
       
     4 define('GIGS_PUBLIC', 1);
       
     5 define('GIGS_RSS', 1);
       
     6 require_once 'ajaxSetup.php';
       
     7 require_once 'version.php';
       
     8 
       
     9 $query = '
       
    10     SELECT p.* 
       
    11     FROM 
       
    12 		' . $wpdb->posts . ' p,
       
    13 		' . TABLE_GIGS . ' g
       
    14     WHERE 
       
    15 		p.ID = g.postID AND
       
    16 		g.date >= CURDATE()
       
    17 	
       
    18     ORDER BY g.date
       
    19 ';
       
    20 
       
    21 $posts = $wpdb->get_results($query);
       
    22 echo '<?xml version="1.0"?>'; 
       
    23 ?>
       
    24 <rss version="2.0">
       
    25 	<channel>
       
    26 		<title><?php bloginfo('name') ?> - <?php _e('Upcoming Gigs feed', $gcd); ?></title>
       
    27 		<?php if ( !empty($options['parent']) ) : ?>
       
    28 			<link><?php echo get_permalink($options['parent']); ?></link>
       
    29 		<?php else : ?>
       
    30 			<link><?php get_bloginfo('wpurl') ?></link>
       
    31 		<?php endif; ?>
       
    32 		
       
    33 		<generator>Gigs Calendar v<?php echo DTC_GIGS_PLUGIN_VERSION ?></generator>
       
    34 		<description></description>
       
    35  <?php if ($posts): ?>
       
    36 	<?php foreach ($posts as $post): ?>
       
    37 		<?php setup_postdata($post); ?>
       
    38 		<?php $g = new gig(); $g->getByPostID($post->ID); $p = $g->getPerformances(); $p->fetch(); ?>
       
    39 		<item>
       
    40 			<title><?php echo the_title() ?></title>
       
    41 			<link><?php the_permalink(); ?></link>
       
    42 			<pubDate><?php echo date('r', strtotime($g->date . ' ' . $p->time)); ?></pubDate>
       
    43 
       
    44 			<description>
       
    45 				<![CDATA[
       
    46 					<?php the_content(); ?>
       
    47 				]]>
       
    48 			</description>
       
    49 			<guid><?php the_guid(); ?></guid>
       
    50 			
       
    51 		</item>
       
    52 
       
    53 	<?php endforeach; ?>
       
    54 <?php endif; ?>
       
    55 	
       
    56 	</channel>
       
    57 </rss>