wp_widget_rss_output

The timeline below displays how wordpress function wp_widget_rss_output has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (!empty($link) && stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if (str_ends_with($summary, '[...]')) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 9.5

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (!empty($link) && stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 5.9

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (!empty($link) && stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 8.6

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (!empty($link) && stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 5.8

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (!empty($link) && stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 7.8

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 7.2

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .10

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 6.2

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .10

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 5.2

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .11

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 5.5

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss  RSS url.
 * @param array               $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 4.2

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .12

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 5.4

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') !== $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' === substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ('' === $link) {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 3.2

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .14

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 5.3

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 2.3

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .20

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 2.2

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .17

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 1.2

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .15

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 0.3

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .20

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 0.2

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .18

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 9.3

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .22

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . esc_html($rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 4.7

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p><strong>' . __('RSS Error:') . '</strong> ' . $rss->get_error_message() . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 6.3

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .25

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), esc_html($rss->get_error_message())) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 5.4

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .30

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), esc_html($rss->get_error_message())) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 5.3

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .28

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), esc_html($rss->get_error_message())) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 4.4

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .30

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), esc_html($rss->get_error_message())) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 4.3

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .29

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), esc_html($rss->get_error_message())) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 3.4

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .30

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), esc_html($rss->get_error_message())) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 2.4

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .34

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), esc_html($rss->get_error_message())) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 1.5

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .40

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), esc_html($rss->get_error_message())) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 1.4

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .37

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), esc_html($rss->get_error_message())) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 0.4

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .37

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), esc_html($rss->get_error_message())) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 4.0

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0);
    $args = wp_parse_args($args, $default_args);
    $items = (int) $args['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $args['show_summary'];
    $show_author = (int) $args['show_author'];
    $show_date = (int) $args['show_date'];
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_html(trim(strip_tags($item->get_title())));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(wp_trim_words($desc, 55, ' [&hellip;]'));
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 3.9

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0);
    $args = wp_parse_args($args, $default_args);
    extract($args, EXTR_SKIP);
    $items = (int) $items;
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $show_summary;
    $show_author = (int) $show_author;
    $show_date = (int) $show_date;
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_attr(strip_tags($item->get_title()));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
        $desc = esc_attr(strip_tags($desc));
        $desc = trim(str_replace(array("\n", "\r"), ' ', $desc));
        $desc = wp_html_excerpt($desc, 360);
        $summary = '';
        if ($show_summary) {
            $summary = $desc;
            // Append ellipsis. Change existing [...] to [&hellip;].
            if ('[...]' == substr($summary, -5)) {
                $summary = substr($summary, 0, -5) . '[&hellip;]';
            } elseif ('[&hellip;]' != substr($summary, -10) && $desc !== $summary) {
                $summary .= ' [&hellip;]';
            }
            $summary = '<div class="rssSummary">' . esc_html($summary) . '</div>';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } elseif ($show_summary) {
            echo "<li><a class='rsswidget' href='{$link}'>{$title}</a>{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}' title='{$desc}'>{$title}</a>{$date}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 7.5

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0);
    $args = wp_parse_args($args, $default_args);
    extract($args, EXTR_SKIP);
    $items = (int) $items;
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $show_summary;
    $show_author = (int) $show_author;
    $show_date = (int) $show_date;
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_attr(strip_tags($item->get_title()));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = str_replace(array("\n", "\r"), ' ', esc_attr(strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset')))));
        $excerpt = wp_html_excerpt($desc, 360);
        // Append ellipsis. Change existing [...] to [&hellip;].
        if ('[...]' == substr($excerpt, -5)) {
            $excerpt = substr($excerpt, 0, -5) . '[&hellip;]';
        } elseif ('[&hellip;]' != substr($excerpt, -10) && $desc != $excerpt) {
            $excerpt .= ' [&hellip;]';
        }
        $excerpt = esc_html($excerpt);
        if ($show_summary) {
            $summary = "<div class='rssSummary'>{$excerpt}</div>";
        } else {
            $summary = '';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}' title='{$desc}'>{$title}</a>{$date}{$summary}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: .40

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), esc_html($rss->get_error_message())) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0);
    $args = wp_parse_args($args, $default_args);
    extract($args, EXTR_SKIP);
    $items = (int) $items;
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $show_summary;
    $show_author = (int) $show_author;
    $show_date = (int) $show_date;
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_attr(strip_tags($item->get_title()));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = str_replace(array("\n", "\r"), ' ', esc_attr(strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset')))));
        $excerpt = wp_html_excerpt($desc, 360);
        // Append ellipsis. Change existing [...] to [&hellip;].
        if ('[...]' == substr($excerpt, -5)) {
            $excerpt = substr($excerpt, 0, -5) . '[&hellip;]';
        } elseif ('[&hellip;]' != substr($excerpt, -10) && $desc != $excerpt) {
            $excerpt .= ' [&hellip;]';
        }
        $excerpt = esc_html($excerpt);
        if ($show_summary) {
            $summary = "<div class='rssSummary'>{$excerpt}</div>";
        } else {
            $summary = '';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}' title='{$desc}'>{$title}</a>{$date}{$summary}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}

WordPress Version: 3.7

/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function wp_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_wp_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0);
    $args = wp_parse_args($args, $default_args);
    extract($args, EXTR_SKIP);
    $items = (int) $items;
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $show_summary;
    $show_author = (int) $show_author;
    $show_date = (int) $show_date;
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred, which probably means the feed is down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_attr(strip_tags($item->get_title()));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = str_replace(array("\n", "\r"), ' ', esc_attr(strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset')))));
        $excerpt = wp_html_excerpt($desc, 360);
        // Append ellipsis. Change existing [...] to [&hellip;].
        if ('[...]' == substr($excerpt, -5)) {
            $excerpt = substr($excerpt, 0, -5) . '[&hellip;]';
        } elseif ('[&hellip;]' != substr($excerpt, -10) && $desc != $excerpt) {
            $excerpt .= ' [&hellip;]';
        }
        $excerpt = esc_html($excerpt);
        if ($show_summary) {
            $summary = "<div class='rssSummary'>{$excerpt}</div>";
        } else {
            $summary = '';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}' title='{$desc}'>{$title}</a>{$date}{$summary}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}