Changeset 10666 for trunk/wp-admin/includes/dashboard.php
- Timestamp:
- 02/27/2009 07:32:50 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/dashboard.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/dashboard.php
r10641 r10666 599 599 $widgets = get_option( 'dashboard_widget_options' ); 600 600 @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP ); 601 $rss = @fetch_rss( $url ); 602 if ( isset($rss->items) && 0 < count($rss->items) ) { 603 604 echo "<ul>\n"; 605 606 $rss->items = array_slice($rss->items, 0, $items); 607 foreach ( $rss->items as $item ) { 608 $publisher = ''; 609 $site_link = ''; 610 $link = ''; 611 $content = ''; 612 $date = ''; 613 $link = clean_url( strip_tags( $item['link'] ) ); 614 615 if ( isset( $item['author_uri'] ) ) 616 $site_link = clean_url( strip_tags( $item['author_uri'] ) ); 617 618 if ( !$publisher = wp_specialchars( strip_tags( isset($item['dc']['publisher']) ? $item['dc']['publisher'] : $item['author_name'] ) ) ) 619 $publisher = __( 'Somebody' ); 620 if ( $site_link ) 621 $publisher = "<a href='$site_link'>$publisher</a>"; 622 else 623 $publisher = "<strong>$publisher</strong>"; 624 625 if ( isset($item['description']) ) 626 $content = $item['description']; 627 elseif ( isset($item['summary']) ) 628 $content = $item['summary']; 629 elseif ( isset($item['atom_content']) ) 630 $content = $item['atom_content']; 631 else 632 $content = __( 'something' ); 633 $content = wp_html_excerpt($content, 50) . ' ...'; 634 if ( $link ) 635 $text = _c( '%1$s linked here <a href="%2$s">saying</a>, "%3$s"|feed_display' ); 636 else 637 $text = _c( '%1$s linked here saying, "%3$s"|feed_display' ); 638 639 if ( $show_date ) { 640 if ( $show_author || $show_summary ) 641 $text .= _c( ' on %4$s|feed_display' ); 642 $date = wp_specialchars( strip_tags( isset($item['pubdate']) ? $item['pubdate'] : $item['published'] ) ); 643 $date = strtotime( $date ); 644 $date = gmdate( get_option( 'date_format' ), $date ); 645 } 646 647 echo "\t<li>" . sprintf( _c( "$text|feed_display" ), $publisher, $link, $content, $date ) . "</li>\n"; 601 $rss = fetch_feed( $url ); 602 603 if ( !$rss->get_item_quantity() ) { 604 echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. It has found no incoming links… yet. It’s okay — there is no rush.') . "</p>\n"; 605 return; 606 } 607 608 echo "<ul>\n"; 609 610 $count = 0; 611 foreach ( $rss->get_items() as $item ) { 612 $publisher = ''; 613 $site_link = ''; 614 $link = ''; 615 $content = ''; 616 $date = ''; 617 $link = clean_url( strip_tags( $item->get_link() ) ); 618 619 $author = $item->get_author(); 620 $site_link = clean_url( strip_tags( $author->get_link() ) ); 621 622 if ( !$publisher = wp_specialchars( strip_tags( $author->get_name() ) ) ) 623 $publisher = __( 'Somebody' ); 624 if ( $site_link ) 625 $publisher = "<a href='$site_link'>$publisher</a>"; 626 else 627 $publisher = "<strong>$publisher</strong>"; 628 629 $content = $item->get_content(); 630 $content = wp_html_excerpt($content, 50) . ' ...'; 631 632 if ( $link ) 633 $text = _c( '%1$s linked here <a href="%2$s">saying</a>, "%3$s"|feed_display' ); 634 else 635 $text = _c( '%1$s linked here saying, "%3$s"|feed_display' ); 636 637 if ( $show_date ) { 638 if ( $show_author || $show_summary ) 639 $text .= _c( ' on %4$s|feed_display' ); 640 $date = wp_specialchars( strip_tags( $item->get_date() ) ); 641 $date = strtotime( $date ); 642 $date = gmdate( get_option( 'date_format' ), $date ); 648 643 } 649 644 650 echo " </ul>\n";651 652 } else { 653 echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. It has found no incoming links… yet. It’s okay — there is no rush.') . "</p>\n";654 } 645 echo "\t<li>" . sprintf( _c( "$text|feed_display" ), $publisher, $link, $content, $date ) . "</li>\n"; 646 } 647 648 echo "</ul>\n"; 649 655 650 } 656 651 … … 699 694 $widgets = get_option( 'dashboard_widget_options' ); 700 695 @extract( @$widgets['dashboard_secondary'], EXTR_SKIP ); 701 $rss = @fetch_ rss( $url );702 703 if ( ! isset($rss->items) || 0 == count($rss->items) )696 $rss = @fetch_feed( $url ); 697 698 if ( !$rss->get_item_quantity() ) 704 699 return false; 705 706 $rss->items = array_slice($rss->items, 0, $items);707 708 if ( 'http://planet.wordpress.org/' == $rss->channel['link'] ) {709 foreach ( array_keys($rss->items) as $i ) {710 list($site, $description) = explode( ':', wp_specialchars($rss->items[$i]['title']), 2 );711 $rss->items[$i]['dc']['creator'] = trim($site);712 $rss->items[$i]['title'] = trim($description);713 }714 }715 700 716 701 echo "<div class='rss-widget'>"; … … 733 718 */ 734 719 function wp_dashboard_plugins_output() { 735 $popular = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/popular/' );736 $new = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/new/' );737 $updated = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/updated/' );720 $popular = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/popular/' ); 721 $new = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/new/' ); 722 $updated = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/updated/' ); 738 723 739 724 foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) { 740 if ( ! isset($$feed->items) || 0 == count($$feed->items) )725 if ( !$$feed->get_item_quantity() ) 741 726 continue; 742 727 743 $ $feed->items = array_slice($$feed->items,0, 5);744 $item_key = array_rand($ $feed->items);728 $items = $$feed->get_items(0, 5); 729 $item_key = array_rand($items); 745 730 746 731 // Eliminate some common badly formed plugin descriptions 747 while ( ( null !== $item_key = array_rand($ $feed->items) ) && false !== strpos( $$feed->items[$item_key]['description'], 'Plugin Name:' ) )748 unset($ $feed->items[$item_key]);749 750 if ( !isset($ $feed->items[$item_key]) )732 while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) 733 unset($items[$item_key]); 734 735 if ( !isset($items[$item_key]) ) 751 736 continue; 752 737 753 $item = $ $feed->items[$item_key];738 $item = $items[$item_key]; 754 739 755 740 // current bbPress feed item titles are: user on "topic title" 756 if ( preg_match( '/ "(.*)"/s', $item['title'], $matches ) )741 if ( preg_match( '/"(.*)"/s', $item->get_title(), $matches ) ) 757 742 $title = $matches[1]; 758 743 else // but let's make it forward compatible if things change 759 $title = $item ['title'];744 $title = $item->get_title(); 760 745 $title = wp_specialchars( $title ); 761 746 762 $description = wp_specialchars( strip_tags(html_entity_decode($item ['description'], ENT_QUOTES)) );763 764 list($link, $frag) = explode( '#', $item ['link']);747 $description = wp_specialchars( strip_tags(html_entity_decode($item->get_description(), ENT_QUOTES)) ); 748 749 list($link, $frag) = explode( '#', $item->get_link() ); 765 750 766 751 $link = clean_url($link); … … 807 792 808 793 809 require_once( ABSPATH . WPINC . '/rss.php' ); 810 init(); // initialize rss constants 811 812 $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE ); 813 794 /* TODO Cache check here. 814 795 foreach ( $check_urls as $check_url ) { 815 $status = $cache->check_cache( $check_url ); 796 816 797 if ( 'HIT' !== $status ) { 817 798 echo $loading; … … 819 800 } 820 801 } 802 */ 803 804 // Always load async until above fixed. 805 echo $loading; 806 return false; 821 807 822 808 if ( $callback && is_callable( $callback ) ) { … … 873 859 // title is optional. If black, fill it if possible 874 860 if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) { 875 require_once(ABSPATH . WPINC . '/rss.php'); 876 $rss = fetch_rss($widget_options[$widget_id]['url']); 877 $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->channel['title'])); 861 $rss = fetch_feed($widget_options[$widget_id]['url']); 862 $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title())); 878 863 } 879 864 update_option( 'dashboard_widget_options', $widget_options );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)