Code:
function headlines($bid, $cenbox=0) {
global $prefix, $db, $useBoxoverWithnukePIE;
if (!defined('_CHARSET')) define('_CHARSET','ISO-8859-1');
include_once(INCLUDE_PATH.'includes/SimplePie/simplepie.inc');
include_once(INCLUDE_PATH.'includes/SimplePie/idn/idna_convert.class.php');
# Create a new instance of the SimplePie object
$feed = new SimplePie();
# Get Feed Information
$bid = intval($bid);
$result = $db->sql_query('SELECT title, url, refresh FROM '.$prefix.'_blocks WHERE bid=\''.$bid.'\'');
list($title, $url, $refresh) = $db->sql_fetchrow($result);
$title = stripslashes(check_html($title, 'nohtml'));
$refresh = intval($refresh);
# Initialize the whole SimplePie object. Read the feed, process it, parse it, cache it, etc.
$feed->set_feed_url($url);
$feed->set_output_encoding(_CHARSET);
$feed->set_cache_duration($refresh);
$feed->init();
$feed->handle_content_type();
$content = '<font class="content"><table width="100%">';
if (isset($feed->error)) {
# If errors, display it.
$content .= htmlspecialchars($feed->error);
}
else
{
foreach($feed->get_items() as $item) {
// $content .= '·';
$content .= '<tr><td valign="top">•</td><td valign="top">';
// If the item has a permalink back to the original post, link the item's title to it.
if ($item->get_permalink())
{
$content .= '<a href="' . $item->get_permalink() . '" title="';
$item_desc = $item->get_description();
$item_date = $item->get_date('F j, Y');
if ($useBoxoverWithnukePIE)
{
if ($item_desc == check_html($item_desc, 'nohtml')) $item_desc = nl2br($item_desc);
$content .= 'cssbody=[nukePIEbody] cssheader=[nukePIEhdr] header=['.encodeBoxover($item_date . ': ' . check_html($item->get_title(), 'nohtml')).'] body=['.encodeBoxover(xmlentities($item_desc)).'] singleclickstop=[On] ';
}
else
{
$content .= check_html($item_desc, 'nohtml');
}
$content .= '">';
}
$content .= $item_date . ': ' . check_html($item->get_title(), 'nohtml');
if ($item->get_permalink()) $content .= '</a>';
// Check for enclosures. If an item has any, set the first one to the $enclosure variable.
/* if ($enclosure = $item->get_enclosure(0)) {
# Use the embed() method to embed the enclosure into the page inline.
$content .= '<div align="center">';
$content .= '<p>' . $enclosure->embed(array(
'audio' => './for_the_demo/place_audio.png',
'video' => './for_the_demo/place_video.png',
'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>';
$content .= '<p class="footnote" align="center">(' . $enclosure->get_type() . '; ' . $enclosure->get_size() . ' MB)</p>';
$content .= '</div>';
}
*/ $content .= '</td></tr>';
}
}
$siteurl = ereg_replace('http://','',$url);
$siteurl = explode('/',$siteurl);
$content .= '</table></font><br /><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td><a href="http://'.$siteurl[0].'" title="'.$title.'" target="blank"><b>'._HREADMORE.'</b></a></td><td align="right"><a href="http://nukeseo.com" title="nukePIE (c) nukeSEO.com">©</a></td></tr></table>';
if ($cenbox == 0) {
themesidebox($title, $content);
} else {
themecenterbox($title, $content);
}
}
|