Check out the demo video. Author: Aakash Chakravarthy Version: 2.3 */ if(!defined('WP_CONTENT_URL')) { $srr_url = get_option('siteurl') . '/wp-content/plugins/' . plugin_basename(dirname(__FILE__)).'/'; }else{ $srr_url = WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)) . '/'; } define('SRR_VERSION', '2.3'); define('SRR_AUTHOR', 'Aakash Chakravarthy'); define('SRR_URL', $srr_url); ## Include the required scripts function srr_public_scripts(){ // jQuery //wp_deregister_script('jquery'); //wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'); wp_enqueue_script('jquery'); // Super RSS Reader JS and CSS wp_register_script('super-rss-reader-js', SRR_URL . 'public/srr-js.js'); wp_enqueue_script(array('jquery', 'super-rss-reader-js')); } add_action('wp_enqueue_scripts', 'srr_public_scripts'); ## Include the required styles function srr_public_styles(){ wp_register_style('super-rss-reader-css', SRR_URL . 'public/srr-css.css'); wp_enqueue_style('super-rss-reader-css'); } add_action('wp_enqueue_scripts', 'srr_public_styles'); ## Default color styles $srr_color_styles = array( 'No style' => 'none', 'Grey' => 'grey', 'Dark' => 'dark', 'Orange' => 'orange' ); ## The main RSS Parser function srr_rss_parser($instance){ $urls = stripslashes($instance['urls']); $count = intval($instance['count']); $show_date = intval($instance['show_date']); $show_desc = intval($instance['show_desc']); $show_author = intval($instance['show_author']); $show_thumb = stripslashes($instance['show_thumb']); $open_newtab = intval($instance['open_newtab']); $strip_desc = intval($instance['strip_desc']); $read_more = htmlspecialchars($instance['read_more']); $color_style = stripslashes($instance['color_style']); $enable_ticker = intval($instance['enable_ticker']); $visible_items = intval($instance['visible_items']); $ticker_speed = intval($instance['ticker_speed']) * 1000; if(empty($urls)){ return ''; } $rand = array(); $url = explode(',', $urls); $ucount = count($url); // Generate the Tabs if($ucount > 1){ echo ''; } for($i=0; $i<$ucount; $i++){ // Get the Feed URL $feedUrl = trim($url[$i]); if(isset($url[$i])){ $rss = fetch_feed($feedUrl); }else{ return ''; } // Check for feed errors if (!is_wp_error( $rss ) ){ $maxitems = $rss->get_item_quantity($count); $rss_items = $rss->get_items(0, $maxitems); $rss_title = esc_attr(strip_tags($rss->get_title())); $rss_desc = esc_attr(strip_tags($rss->get_description())); }else{ echo '

RSS Error: ' . $rss->get_error_message() . '

'; continue; } $randAttr = isset($rand[$i]) ? ' data-id="srr-tab-' . $rand[$i] . '" ' : ''; // Outer Wrap start echo '
'; // Check feed items if ($maxitems == 0){ echo '
No items.
'; }else{ $j=1; // Loop through each feed item foreach ($rss_items as $item){ // Get the link $link = $item->get_link(); while ( stristr($link, 'http') != $link ){ $link = substr($link, 1); } $link = esc_url(strip_tags($link)); // Get the item title $title = esc_attr(strip_tags($item->get_title())); if ( empty($title) ) $title = __('No Title'); // Get the date $date = $item->get_date('j F Y'); // Get thumbnail if present @since v2.2 $thumb = ''; if ($show_thumb == 1 && $enclosure = $item->get_enclosure()){ $thumburl = $enclosure->get_thumbnail(); if(!empty($thumburl)) $thumb = '' . $title . ''; } // Get the description $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) ); if($strip_desc != 0){ $desc = wp_html_excerpt( $desc, $strip_desc ); $rmore = (!empty($read_more)) ? '' . $read_more . '' : ''; if ( '[...]' == substr( $desc, -5 ) ) $desc = substr( $desc, 0, -5 ); elseif ( '[…]' != substr( $desc, -10 ) ) $desc .= ''; $desc = esc_html( $desc ); } $desc = $thumb . $desc . ' ' . $rmore; // Get the author $author = $item->get_author(); if ( is_object($author) ) { $author = $author->get_name(); $author = esc_html(strip_tags($author)); } // Open links in new tab $newtab = ($open_newtab) ? ' target="_blank"' : ''; echo "\n\n\t"; // Display the feed items echo '
'; echo ''; echo '
'; if($show_date && !empty($date)) echo ''; if($show_author && !empty($author)) echo ' - ' . $author . ''; echo '
'; if($show_desc) echo '

' . $desc . '

'; echo '
'; // End display $j++; } } // Outer wrap end echo "\n\n
\n\n" ; } } class super_rss_reader_widget extends WP_Widget{ ## Initialize function super_rss_reader_widget(){ $widget_ops = array( 'classname' => 'widget_super_rss_reader', 'description' => "Enhanced RSS feed reader widget with advanced features." ); $control_ops = array('width' => 430, 'height' => 500); parent::WP_Widget('super_rss_reader', 'Super RSS Reader', $widget_ops, $control_ops); } ## Display the Widget function widget($args, $instance){ extract($args); if(empty($instance['title'])){ $title = ''; }else{ $title = $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; } echo $before_widget . $title; echo "\n" . '
' . "\n"; srr_rss_parser($instance); echo "\n" . '
' . "\n"; echo $after_widget; } ## Save settings function update($new_instance, $old_instance){ $instance = $old_instance; $instance['title'] = stripslashes($new_instance['title']); $instance['urls'] = stripslashes($new_instance['urls']); $instance['count'] = intval($new_instance['count']); $instance['show_date'] = intval($new_instance['show_date']); $instance['show_desc'] = intval($new_instance['show_desc']); $instance['show_author'] = intval($new_instance['show_author']); $instance['show_thumb'] = stripslashes($new_instance['show_thumb']); $instance['open_newtab'] = intval($new_instance['open_newtab']); $instance['strip_desc'] = intval($new_instance['strip_desc']); $instance['read_more'] = stripslashes($new_instance['read_more']); $instance['color_style'] = stripslashes($new_instance['color_style']); $instance['enable_ticker'] = intval($new_instance['enable_ticker']); $instance['visible_items'] = intval($new_instance['visible_items']); $instance['ticker_speed'] = intval($new_instance['ticker_speed']); return $instance; } ## HJA Widget form function form($instance){ global $srr_color_styles; $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'urls' => '', 'count' => 5, 'show_date' => 0, 'show_desc' => 1, 'show_author' => 0, 'show_thumb' => 1, 'open_newtab' => 1, 'strip_desc' => 100, 'read_more' => '[...]', 'color_style' => 'none', 'enable_ticker' => 1, 'visible_items' => 5, 'ticker_speed' => 2, )); $title = htmlspecialchars($instance['title']); $urls = htmlspecialchars($instance['urls']); $count = intval($instance['count']); $show_date = intval($instance['show_date']); $show_desc = intval($instance['show_desc']); $show_author = intval($instance['show_author']); $show_thumb = intval($instance['show_thumb']); $open_newtab = intval($instance['open_newtab']); $strip_desc = intval($instance['strip_desc']); $read_more = htmlspecialchars($instance['read_more']); $color_style = stripslashes($instance['color_style']); $enable_ticker = intval($instance['enable_ticker']); $visible_items = intval($instance['visible_items']); $ticker_speed = intval($instance['ticker_speed']); ?>
Can enter multiple RSS/atom feed URLs seperated by a comma.

Settings

/>
/>
/> Show Author
/> />

Other settings

get_field_name('color_style') . '" id="' . $this->get_field_id('color_style') . '">'; foreach($srr_color_styles as $k => $v){ echo ''; } echo ''; ?>
/>
seconds
Like | Donate | Support
Please donate and share this plugin to show your support. Thank you :)