### Eclipse Workspace Patch 1.0
#P wordpress-trunk
|
|
|
|
| 770 | 770 | * @since unknown |
| 771 | 771 | */ |
| 772 | 772 | function wp_dashboard_plugins_output() { |
| 773 | | $popular = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/popular/' ); |
| 774 | | $new = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/new/' ); |
| 775 | | $updated = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/updated/' ); |
| 776 | 773 | |
| | 774 | /* feed configurations */ |
| | 775 | $feeds = array( |
| | 776 | 'popular' => array( |
| | 777 | 'url' => 'http://wordpress.org/extend/plugins/rss/browse/popular/', |
| | 778 | 'label' => __('Most Popular'), |
| | 779 | ), |
| | 780 | 'new' => array( |
| | 781 | 'url' => 'http://wordpress.org/extend/plugins/rss/browse/popular/', |
| | 782 | 'label' => __('Newest Plugins'), |
| | 783 | ), |
| | 784 | 'updated' => array( |
| | 785 | 'url' => 'http://wordpress.org/extend/plugins/rss/browse/popular/', |
| | 786 | 'label' => __('Recently Updated'), |
| | 787 | ), |
| | 788 | ); |
| | 789 | |
| 777 | 790 | if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { |
| 778 | 791 | $plugin_slugs = array_keys( get_plugins() ); |
| 779 | 792 | set_transient( 'plugin_slugs', $plugin_slugs, 86400 ); |
| 780 | 793 | } |
| 781 | 794 | |
| 782 | | foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) { |
| 783 | | if ( is_wp_error($$feed) || !$$feed->get_item_quantity() ) |
| | 795 | foreach ( $feeds as $feed_key => $feed_data ) { |
| | 796 | $label = $feed_data['label']; |
| | 797 | $feed = fetch_feed( $feed_data['url'] ); |
| | 798 | |
| | 799 | if ( is_wp_error($feed) || !$feed->get_item_quantity() ) |
| 784 | 800 | continue; |
| 785 | 801 | |
| 786 | | $items = $$feed->get_items(0, 5); |
| | 802 | $items = $feed->get_items(0, 5); |
| 787 | 803 | |
| 788 | 804 | // Pick a random, non-installed plugin |
| 789 | | while ( true ) { |
| | 805 | do { |
| 790 | 806 | // Abort this foreach loop iteration if there's no plugins left of this type |
| 791 | 807 | if ( 0 == count($items) ) |
| 792 | 808 | continue 2; |
| … |
… |
|
| 812 | 828 | continue 2; |
| 813 | 829 | } |
| 814 | 830 | } |
| | 831 | } while ( false ); |
| 815 | 832 | |
| 816 | | // If we get to this point, then the random plugin isn't installed and we can stop the while(). |
| 817 | | break; |
| 818 | | } |
| 819 | | |
| 820 | 833 | // Eliminate some common badly formed plugin descriptions |
| 821 | 834 | while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) |
| 822 | 835 | unset($items[$item_key]); |
| … |
… |
|
| 840 | 853 | echo "<h5><a href='$link'>$title</a></h5> <span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span>\n"; |
| 841 | 854 | echo "<p>$description</p>\n"; |
| 842 | 855 | |
| 843 | | $$feed->__destruct(); |
| 844 | | unset($$feed); |
| | 856 | $feed->__destruct(); |
| | 857 | unset($feed); |
| 845 | 858 | } |
| 846 | 859 | } |
| 847 | 860 | |