Ticket #12138: 12138.diff
File 12138.diff, 2.2 KB (added by , 15 years ago) |
---|
-
wp-admin/includes/ms.php
614 614 add_action( 'admin_notices', 'secret_salt_warning' ); 615 615 616 616 function admin_notice_feed() { 617 global $current_user ;618 if ( substr( $_SERVER[ 'PHP_SELF' ], -19 ) != '/wp-admin/index.php' )617 global $current_user, $current_screen; 618 if ( $current_screen->id != 'index' ) 619 619 return; 620 620 621 if ( isset( $_GET[ 'feed_dismiss' ] ) )621 if ( !empty( $_GET[ 'feed_dismiss' ] ) ) 622 622 update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET[ 'feed_dismiss' ], true ); 623 623 624 624 $url = get_site_option( 'admin_notice_feed' ); 625 if ( $url == '')625 if ( empty( $url ) ) 626 626 return; 627 627 628 $rss = @fetch_feed( $url ); 629 $item = $rss->get_item(); 630 if ( !is_null( $item ) ) { 628 $rss = fetch_feed( $url ); 629 if ( ! is_wp_error( $rss ) && $item = $rss->get_item() ) { 631 630 $title = $item->get_title(); 632 if ( md5( $title ) == get_user_option( 'admin_feed_dismiss' , $current_user->id) )631 if ( md5( $title ) == get_user_option( 'admin_feed_dismiss' ) ) 633 632 return; 634 633 $msg = "<h3>" . esc_html( $title ) . "</h3>\n"; 635 634 $content = $item->get_description(); 636 if ( is_null( $content ) ) 637 $content = __( 'something' ); 638 639 $content = wp_html_excerpt($content, 200) . ' ...'; 640 $link = clean_url( strip_tags( $item->get_link() ) ); 641 $msg .= "<p>" . $content . " <a href='$link'>" . __( 'Read More' ) . "</a> <a href='index.php?feed_dismiss=" . md5( $title ) . "'>" . __( "Dismiss" ) . "</a></p>"; 635 $content = $content ? wp_html_excerpt( $content, 200 ) . ' … ' : ''; 636 $link = esc_url( strip_tags( $item->get_link() ) ); 637 $msg .= "<p>" . $content . "<a href='$link'>" . __( 'Read More' ) . "</a> <a href='index.php?feed_dismiss=" . md5( $title ) . "'>" . __( 'Dismiss' ) . "</a></p>"; 642 638 echo "<div class='updated fade'>$msg</div>"; 643 639 } elseif ( is_super_admin() ) { 644 printf( "<div id='update-nag'>" . __("Your feed at %s is empty.") . "</div>", wp_specialchars( $url ));640 printf( '<div id="update-nag">' . __( 'Your feed at %s is empty.' ) . '</div>', esc_html( $url ) ); 645 641 } 646 642 } 647 643 add_action( 'admin_notices', 'admin_notice_feed' );