options = wp_parse_args( $options, SRR_Options::defaults() ); } public function html(){ $urls = stripslashes( trim( $this->options['urls'] ) ); $tab_titles = stripslashes( $this->options['tab_titles'] ); $count = intval( $this->options['count'] ); $show_date = intval( $this->options['show_date'] ); $show_desc = intval( $this->options['show_desc'] ); $show_author = intval( $this->options['show_author'] ); $show_thumb = stripslashes( $this->options['show_thumb'] ); $open_newtab = intval( $this->options['open_newtab'] ); $add_nofollow = intval( $this->options['add_nofollow'] ); $strip_desc = intval( $this->options['strip_desc'] ); $strip_title = intval( $this->options['strip_title'] ); $date_format = htmlspecialchars( $this->options['date_format'] ); $read_more = htmlspecialchars( $this->options['read_more'] ); $rich_desc = intval( $this->options['rich_desc'] ); $thumbnail_position = htmlspecialchars( $this->options['thumbnail_position'] ); $thumbnail_size = htmlspecialchars( $this->options['thumbnail_size'] ); $thumbnail_default = htmlspecialchars( $this->options['thumbnail_default'] ); $color_theme = stripslashes( $this->options['color_style'] ); $display_type = stripslashes( $this->options['display_type'] ); $visible_items = intval( $this->options['visible_items'] ); $ticker_speed = intval( $this->options['ticker_speed'] ) * 1000; if( empty( $urls ) ){ return ''; } $url_delim = strpos( $urls, ',' ) !== false ? ',' : "\n"; $tab_title_delim = strpos( $tab_titles, ',' ) !== false ? ',' : "\n"; $urls = explode( $url_delim, $urls ); $tab_titles = explode( $tab_title_delim, $tab_titles ); $url_count = count( $urls ); $feeds = array(); $html = ''; $classes = array( 'srr-wrap', 'srr-style-' . $color_theme ); if( $display_type == 'vertical_ticker' ) array_push( $classes, 'srr-vticker' ); $class = implode( ' ', $classes ); // Fetch the feed for( $i=0; $i < $url_count; $i++ ){ $feed_url = trim( $urls[$i] ); $feed = fetch_feed( $feed_url ); if( is_wp_error( $feed ) ){ $feed_title = 'Error'; }else{ $feed_title = ( isset( $tab_titles[$i] ) && !empty( $tab_titles[$i] ) ) ? $tab_titles[$i] : esc_attr( strip_tags( $feed->get_title() ) ); } $feeds[ $feed_url ] = array( 'id' => rand( 100, 999 ), 'feed' => $feed, 'title' => $feed_title ); } // Generate tabs if( $url_count > 1 ){ $html .= '
RSS Error: ' . $feed->get_error_message() . '
' . $desc . '' );
}else{
$desc = str_replace( array( "\n", "\r" ), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) );
$read_more_link = '';
if( $strip_desc != 0 ){
$desc = wp_trim_words( $desc, $strip_desc );
$read_more_link = !empty( $read_more ) ? ' ' . $read_more . '' : '';
if ( '[...]' == substr( $desc, -5 ) ){
$desc = substr( $desc, 0, -5 );
}elseif ( '[…]' != substr( $desc, -10 ) ){
$desc .= '';
}
$desc = esc_html( $desc );
}
$desc = $desc . $read_more_link;
}
}
// Author
$author = $item->get_author();
if ( is_object( $author ) ) {
$author = $author->get_name();
$author = esc_html( strip_tags( $author ) );
}
$t_title = '';
$t_meta = '';
$t_thumb = '';
$t_desc = '';
$t_title .= '';
// Metadata
if( $show_date || $show_author ){
$t_meta .= ''; // End meta
}
if ( $show_thumb ){
$t_thumb .= $thumb;
}
if( $show_desc ){
$t_desc .= '