<?php header("Content-Type: application/xml; charset=ISO-8859-1"); 
echo '<?xml version="1.0" encoding="ISO-8859-1" ?>' . "\n";

$lTitle = "";
if($_GET['length'] == '1min')
{
	$lTitle = "1";
}
else if ($_GET['length'] == '2min')
{
	$lTitle = "2";
}
else
{
	$lTitle = "4.5";
}
?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
	<title>Mission Network News <?php echo $lTitle; ?> minute podcast</title>
	<itunes:image href="http://www.mnnonline.org/images/mnn_media_circle.png"/>
	<image>
		<url>http://www.mnnonline.org/images/mnn_media_circle.png</url>
		<title>Mission Network News</title>
		<link>http://mnnonline.org</link>
	</image>
	<generator>topher1kenobe via php/mysql</generator>
	<webMaster>webmaster@mnnonline.org</webMaster>
	<itunes:author>Mission Network News</itunes:author>
	<itunes:category text="News &amp; Politics" />
	<itunes:subtitle>1min version</itunes:subtitle>
	<itunes:summary>
		Mission Network News is a mission news service dedicated to keeping Christians informed on evangelical mission activity around the world; in doing so we hope to educate and motivate Christians to prayer, participation, and support of missionary work to help further the Great Commission.
	</itunes:summary>
	<itunes:owner>
		<itunes:name>Greg Yoder</itunes:name>
		<itunes:email>gyoder@mnnonline.org</itunes:email>
	</itunes:owner>
	<itunes:explicit>no</itunes:explicit>
	<link>http://mnnonline.org/</link>
	<description>
		Mission Network News is a mission news service dedicated to keeping Christians informed on evangelical mission activity around the world; in doing so we hope to educate and motivate Christians to prayer, participation, and support of missionary work to help further the Great Commission.
	</description>
	<language>en-us</language>
	<copyright><?php echo date("Y"); ?> Mission Network News 413704</copyright>
	<lastBuildDate><?php echo date("r", strtotime('today')); ?></lastBuildDate>
	<ttl>720</ttl>
	<?php
		require_once('../wp-load.php');

		$timestamp = date("U");

		$today = getdate($timestamp);


		$lArgs = array(
			'meta_key'		  => 'ecpt_news_number',
			'orderby'		  => 'meta_value_num',
			'order'			  => 'ASC',
			'post_type'		  => 'news',
			'post_status'	  => 'publish',
			'suppress_filters' => true,
			'year'			  => $today["year"],
			'monthnum'			 => $today["mon"],
			'day'			  => $today["mday"]
		);


		$lPosts = get_posts($lArgs);



		?>

	<item>
		<description>
			<![CDATA[
				<h3>Today's Headlines</h3>
				<ul>
					<?php
						foreach($lPosts as $key => $post) : setup_postdata( $post );

							$this_date = get_the_date();

							$lPlayer = new MNN_Player;
							$lPlayer->set_year(get_the_date('Y'));
							$lPlayer->set_month(get_the_date('m'));
							$lPlayer->set_day(get_the_date('d'));
							$lPlayer->set_length(isset($_GET['length']) ? $_GET['length'] : '');
							echo '<li>' . get_the_title() . '</li>' . "\n";

							$href = $lPlayer->render_href();

						endforeach;
						wp_reset_postdata();
					?>
				</ul>
			]]>
		</description>
		<title>Mission Network News (<?php echo date("D, d M Y", strtotime($this_date)); ?> - <?php echo $lTitle; ?> min)</title>
		<guid><?php echo $href; ?></guid>
		<link><?php echo $href; ?></link>
		<pubDate><?php echo date("r", strtotime('today')); ?></pubDate>
		<enclosure url="<?php echo $href; ?>" length="" type="audio/mpeg"/>
	</item>
</channel>
</rss>
