'', 'urls' => '', 'tab_titles' => '', 'count' => 5, 'show_date' => 0, 'show_desc' => 1, 'show_author' => 0, 'show_thumb' => 1, 'open_newtab' => 1, 'strip_desc' => 100, 'add_nofollow' => 1, 'read_more' => '[...]', 'rich_desc' => 0 , 'color_style' => 'none', 'enable_ticker' => 1, 'visible_items' => 5, 'strip_title' => 0, 'ticker_speed' => 4, ); } public static function color_themes(){ return array( 'No style' => 'none', 'Grey' => 'grey', 'Dark' => 'dark', 'Orange' => 'orange', 'Simple modern' => 'smodern' ); } public static function render_feed( $settings ){ $settings = wp_parse_args( $settings, self::default_settings() ); $urls = stripslashes( $settings['urls'] ); $tab_titles = stripslashes( $settings['tab_titles'] ); $count = intval( $settings['count'] ); $show_date = intval( $settings['show_date'] ); $show_desc = intval( $settings['show_desc'] ); $show_author = intval( $settings['show_author'] ); $show_thumb = stripslashes( $settings['show_thumb'] ); $open_newtab = intval( $settings['open_newtab'] ); $add_nofollow = intval( $settings['add_nofollow'] ); $strip_desc = intval( $settings['strip_desc'] ); $strip_title = intval( $settings['strip_title'] ); $read_more = htmlspecialchars( $settings['read_more'] ); $rich_desc = intval( $settings['rich_desc'] ); $color_theme = stripslashes( $settings['color_style'] ); $enable_ticker = intval( $settings['enable_ticker'] ); $visible_items = intval( $settings['visible_items'] ); $ticker_speed = intval( $settings['ticker_speed'] ) * 1000; if( empty( $urls ) ){ return ''; } $url_delim = strpos( $urls, ',' ) !== false ? ',' : "\n"; $tab_title_delim = strpos( $tab_titles, ',' ) !== false ? ',' : "\n"; $rand = array(); $url = explode( $url_delim, $urls ); $tab_title = explode( $tab_title_delim, $tab_titles ); $url_count = count( $url ); // Generating the tabs if( $url_count > 1 ){ echo ''; } // Generating the feed items for( $i=0; $i < $url_count; $i++ ){ // Get the Feed URL $feed_url = trim( $url[$i] ); if( isset( $url[$i] ) ){ $rss = fetch_feed( $feed_url ); }else{ return ''; } if( method_exists( $rss, 'enable_order_by_date' ) ){ $rss->enable_order_by_date( false ); } // Check for feed errors if (!is_wp_error( $rss ) ){ $max_items = $rss->get_item_quantity( $count ); $rss_items = $rss->get_items( 0, $max_items ); $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 ($max_items == 0){ echo '
No items.
'; }else{ $j=1; // Loop through each feed item foreach ($rss_items as $item){ // Getting link $link = $item->get_link(); while ( stristr( $link, 'http' ) != $link ){ $link = substr( $link, 1 ); } $link = esc_url(strip_tags($link)); // Getting title $title = esc_attr(strip_tags($item->get_title())); if ( empty($title) ) $title = __('No Title'); if( $strip_title != 0 ){ $titleLen = strlen($title); $title = wp_html_excerpt( $title, $strip_title ); $title = ($titleLen > $strip_title) ? $title . ' ...' : $title; } // Open links in new tab $new_tab = ($open_newtab) ? ' target="_blank"' : ''; // Add no follow attribute $no_follow = ($add_nofollow) ? ' rel="nofollow"' : ''; // Getting date $date = $item->get_date('j F Y'); // Getting thumbnail if present @since v2.2 $thumb = ''; if ($show_thumb == 1 && $enclosure = $item->get_enclosure()){ $thumb_url = $enclosure->get_thumbnail(); if(!empty($thumb_url)) $thumb = '' . $title . ''; } // Getting description $desc = ''; if( $rich_desc == 1 ){ $desc = strip_tags( str_replace( 'eval', '', $item->get_description() ) , '

'); }else{ $read_more = ''; $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 ); $read_more = ( !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 . ' ' . $read_more; } // Getting the author $author = $item->get_author(); if ( is_object($author) ) { $author = $author->get_name(); $author = esc_html(strip_tags($author)); } echo "\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" ; if ( !is_wp_error($rss) ) $rss->__destruct(); unset($rss); } } } SRR_Widget::init(); ?>