feeds' ), 'thefrosty_dashboard_widget_rss' );
}
}
// Function: Print Dashboard Widget
if ( !function_exists( 'thefrosty_dashboard_widget_rss' ) ) {
function thefrosty_dashboard_widget_rss( $sidebar_args ) {
global $wpdb;
extract( array($sidebar_args, EXTR_SKIP));
//echo '
';
$style = '' . "\n";
$domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'siteurl' ) );
include_once( ABSPATH . WPINC . '/class-simplepie.php' );
$feed = new SimplePie();
$feed->set_feed_url( 'http://pipes.yahoo.com/pipes/pipe.run?_id=52c339c010550750e3e64d478b1c96ea&_render=rss' );
if ( false !== strpos( $domain, '/' ) || 'localhost' == $domain || preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $domain ) ) {
$feed->enable_cache( false );
} else {
$feed->enable_cache( true );
$feed->set_cache_location( plugin_dir_path( __FILE__ ) . 'cache' );
}
$feed->init();
$feed->handle_content_type();
$items = $feed->get_item();
echo '
';
if ( empty( $items ) ) {
echo '- No items
';
} else {
echo $style;
foreach( $feed->get_items( 0, 6 ) as $item ) :
$title = esc_attr( strtolower( sanitize_title_with_dashes( htmlentities( $item->get_title() ) ) ) );
$class = str_replace( 'http://', '', $item->get_permalink() );
$class = str_replace( array( '2010.', '2011.', '2012.', '2014.' ), '', $class );
$class = str_replace( array( '.com/', '.net/', '.org/', '.la/' ), ' ', $class );
$class = str_replace( array( '2011/', '2012/', '2013/', '2014/' ), '', $class );
$class = str_replace( array( '01/', '02/', '03/', '04/', '05/', '06/', '07/', '08/', '09/', '10/', '11/', '12/' ), '', $class );
$class = str_replace( $title, '', $class );
$class = str_replace( '/', '', $class );
// Redundant, I know. Can you make a preg_replace for this? ?>
-
get_date('F, jS Y'); ?>
';
}
}
if ( !function_exists( 'thefrosty_dashboard_callback' ) ) {
function thefrosty_dashboard_callback( $sidebar_args ) {
array(
'all_link' => 'http://thefrosty.net/',
'feed_link' => 'http://pipes.yahoo.com/pipes/pipe.run?_id=52c339c010550750e3e64d478b1c96ea&_render=rss',
'width' => 'half', // OR 'fourth', 'third', 'half', 'full' (Default: 'half')
'height' => 'double', // OR 'single', 'double' (Default: 'single')
);
}
}
?>