Ticket #8781: 8781.patch
File 8781.patch, 2.5 KB (added by , 16 years ago) |
---|
-
wp-admin/includes/dashboard.php
708 708 $new = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/new/' ); 709 709 $updated = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/updated/' ); 710 710 711 $all_plugins = get_plugins(); 712 711 713 foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) { 712 714 if ( !isset($$feed->items) || 0 == count($$feed->items) ) 713 715 continue; 714 716 715 717 $$feed->items = array_slice($$feed->items, 0, 5); 716 $item_key = array_rand($$feed->items);717 718 719 // Pick a random, non-installed plugin 720 $loop = true; 721 while ( true == $loop ) { 722 $item_key = array_rand($$feed->items); 723 $item = $$feed->items[$item_key]; 724 725 list($link, $frag) = explode( '#', $item['link'] ); 726 727 $link = clean_url($link); 728 if( preg_match('|/([^/]+?)/?$|', $link, $matches) ) 729 $slug = $matches[1]; 730 else 731 $slug = ''; 732 733 // Loop through all plugins on this WordPress install looking for the random plugin 734 foreach ( $all_plugins as $all_plugin_slug => $all_plugin ) { 735 if ( $slug == substr( $all_plugin_slug, 0, strlen( $slug ) ) ) { 736 // This random plugin is installed. Remove it and try again. 737 unset( $$feed->items[$item_key] ); 738 continue 2; 739 } 740 } 741 742 // We can stop looping as this random plugin isn't installed 743 $loop = false; 744 } 745 718 746 // Eliminate some common badly formed plugin descriptions 719 747 while ( ( null !== $item_key = array_rand($$feed->items) ) && false !== strpos( $$feed->items[$item_key]['description'], 'Plugin Name:' ) ) 720 748 unset($$feed->items[$item_key]); … … 722 750 if ( !isset($$feed->items[$item_key]) ) 723 751 continue; 724 752 725 $item = $$feed->items[$item_key];726 727 753 // current bbPress feed item titles are: user on "topic title" 728 754 if ( preg_match( '/"(.*)"/s', $item['title'], $matches ) ) 729 755 $title = $matches[1]; … … 733 759 734 760 $description = wp_specialchars( strip_tags(html_entity_decode($item['description'], ENT_QUOTES)) ); 735 761 736 list($link, $frag) = explode( '#', $item['link'] );737 738 $link = clean_url($link);739 if( preg_match('|/([^/]+?)/?$|', $link, $matches) )740 $slug = $matches[1];741 else742 $slug = '';743 744 762 $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . 745 763 '&TB_iframe=true&width=600&height=800'; 746 764