<?php
include_once('simplepie.inc');
$feed = new SimplePie();
$feed->set_feed_url('http://bear.politicalbear.com/feed');
$feed->enable_cache(false);
$success = $feed->init();
$feed->handle_content_type();
$feed->set_feed_url($_GET['feed']);
$feed->enable_xml_dump(isset($_GET['xmldump']) ? true : false);
$feed->set_favicon_handler('./handler_image.php');
$items = $feed->get_items();
?>
<div class="style8" id="sp_results">
<!-- As long as the feed has data to work with... -->
<?php if ($success): ?>
<div class="chunk focus" >
<!-- If the feed has a link back to the site that publishes it (which 99% of them do), link the feed's title to it. -->
<?php if ($feed->get_link()) echo '<a href="' . $feed->get_link() . '">'; echo $feed->get_title(); if ($feed->get_link()) echo '</a>'; ?> <br />
<!-- If the feed has a description, display it. -->
<?php echo $feed->get_description(); ?> </div>
<?php foreach($feed->get_items(0,1) as $item): ?>
<div class="chunk">
<!-- If the item has a permalink back to the original post (which 99% of them do), link the item's title to it. -->
<div align="center"> <h4><?php if ($item->get_permalink()) echo '<a href="' . $item->get_permalink() . '">'; echo $item->get_title(); if ($item->get_permalink()) echo '</a>'; ?> <span class="footnote"></span></h4> </div>
<?php
// Check for enclosures. If an item has any, set the first one to the $enclosure variable.
if ($enclosure = $item->get_enclosure(1))
{
// Use the embed() method to embed the enclosure into the page inline.
echo '<div align="left">';
echo '<p>' . $enclosure->embed(array(
'audio' => './for_the_demo/place_audio.png',
'video' => './for_the_demo/place_video.png',
'mediaplayer' => './for_the_demo/mediaplayer.swf',
'alt' => '<img src="./for_the_demo/mini_podcast.png" class="download" border="0" title="Download the Podcast (' . $enclosure->get_extension() . '; ' . $enclosure->get_size() . ' MB)" />',
'altclass' => 'download'
)) . '</p>';
echo '<p class="footnote" align="center">(' . $enclosure->get_type();
if ($enclosure->get_size())
{
echo '; ' . $enclosure->get_size() . ' MB';
}
echo ')</p>';
echo '</div>';
}
?>
<!-- Display the item's primary content. -->
<?php echo $item->get_content(); ?>
<!-- Add links to add this post to one of a handful of services. -->
<p class="footnote favicons" align="center">
<a href="<?php echo $item->add_to_blinklist(); ?>" title="Add post to Blinklist"><img src="Images/favicons/blinklist.png" alt="Blinklist" /></a>
<a href="<?php echo $item->add_to_blogmarks(); ?>" title="Add post to Blogmarks"><img src="Images/favicons/blogmarks.png" alt="Blogmarks" /></a>
<a href="<?php echo $item->add_to_delicious(); ?>" title="Add post to del.icio.us"><img src="Images/favicons/delicious.png" alt="del.icio.us" /></a>
<a href="<?php echo $item->add_to_digg(); ?>" title="Digg this!"><img src="Images/favicons/digg.png" alt="Digg" /></a>
<a href="<?php echo $item->add_to_magnolia(); ?>" title="Add post to Ma.gnolia"><img src="Images/favicons/magnolia.png" alt="Ma.gnolia" /></a>
<a href="<?php echo $item->add_to_myweb20(); ?>" title="Add post to My Web 2.0"><img src="Images/favicons/myweb2.png" alt="My Web 2.0" /></a>
<a href="<?php echo $item->add_to_newsvine(); ?>" title="Add post to Newsvine"><img src="Images/favicons/newsvine.png" alt="Newsvine" /></a>
<a href="<?php echo $item->add_to_reddit(); ?>" title="Add post to Reddit"><img src="Images/favicons/reddit.png" alt="Reddit" /></a>
<a href="<?php echo $item->add_to_segnalo(); ?>" title="Add post to Segnalo"><img src="Images/favicons/segnalo.png" alt="Segnalo" /></a>
<a href="<?php echo $item->add_to_simpy(); ?>" title="Add post to Simpy"><img src="Images/favicons/simpy.png" alt="Simpy" /></a>
<a href="<?php echo $item->add_to_spurl(); ?>" title="Add post to Spurl"><img src="Images/favicons/spurl.png" alt="Spurl" /></a>
<a href="<?php echo $item->add_to_wists(); ?>" title="Add post to Wists"><img src="Images/favicons/wists.png" alt="Wists" /></a>
<a href="<?php echo $item->search_technorati(); ?>" title="Who's linking to this post?"><img src="Images/favicons/technorati.png" alt="Technorati" /></a> </p>
</div>
<!-- Stop looping through each item once we've gone through all of them. -->
<?php endforeach; ?>
<!-- From here on, we're no longer using data from the feed. -->
<?php endif; ?>