From 09aaaaaa2328a3b13cdb90438e88d5a2b93f508f Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 19 Jan 2010 19:33:21 +0000 Subject: [PATCH] Use SimplePie in admin_notice_feed(). Props garyc40. fixes #11765 git-svn-id: https://develop.svn.wordpress.org/trunk@12767 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/ms.php | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index d218c41920..1956b06f99 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -693,24 +693,21 @@ function admin_notice_feed() { $url = get_site_option( 'admin_notice_feed' ); if ( $url == '' ) return; - include_once( ABSPATH . 'wp-includes/rss.php' ); - $rss = @fetch_rss( $url ); - if ( isset($rss->items) && 1 <= count($rss->items) ) { - if ( md5( $rss->items[0][ 'title' ] ) == get_user_option( 'admin_feed_dismiss', $current_user->id ) ) + + $rss = @fetch_feed( $url ); + $item = $rss->get_item(); + if ( !is_null( $item ) ) { + $title = $item->get_title(); + if ( md5( $title ) == get_user_option( 'admin_feed_dismiss', $current_user->id ) ) return; - $item = $rss->items[0]; - $msg = "

" . wp_specialchars( $item[ 'title' ] ) . "

\n"; - if ( isset($item['description']) ) - $content = $item['description']; - elseif ( isset($item['summary']) ) - $content = $item['summary']; - elseif ( isset($item['atom_content']) ) - $content = $item['atom_content']; - else + $msg = "

" . esc_html( $title ) . "

\n"; + $content = $item->get_description(); + if ( is_null( $content ) ) $content = __( 'something' ); + $content = wp_html_excerpt($content, 200) . ' ...'; - $link = clean_url( strip_tags( $item['link'] ) ); - $msg .= "

" . $content . " " . __( 'Read More' ) . " " . __( "Dismiss" ) . "

"; + $link = clean_url( strip_tags( $item->get_link() ) ); + $msg .= "

" . $content . " " . __( 'Read More' ) . " " . __( "Dismiss" ) . "

"; echo "
$msg
"; } elseif ( is_super_admin() ) { printf("
" . __("Your feed at %s is empty.") . "
", wp_specialchars( $url ));