Make WordPress Core

Ticket #8781: 8781.8.patch

File 8781.8.patch, 4.9 KB (added by Viper007Bond, 15 years ago)

Refresh for 2.8 / SimplePie

  • wp-admin/includes/dashboard.php

     
    734734        $new     = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/new/' );
    735735        $updated = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/updated/' );
    736736
     737        $plugin_slugs = get_option( 'plugin_slugs' );
     738        if ( !is_array( $plugin_slugs ) ) {
     739                $plugin_slugs = array_keys( get_plugins() );
     740                update_option( 'plugin_slugs', $plugin_slugs );
     741        }
     742
    737743        foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) {
    738744                if ( !$$feed->get_item_quantity() )
    739745                        continue;
    740746
    741747                $items = $$feed->get_items(0, 5);
    742                 $item_key = array_rand($items);
    743748
     749                // Pick a random, non-installed plugin
     750                while ( true ) {
     751                        // Abort this foreach loop iteration if there's no plugins left of this type
     752                        if ( 0 == count($items) )
     753                                continue 2;
     754
     755                        $item_key = array_rand($items);
     756                        $item = $items[$item_key];
     757
     758                        list($link, $frag) = explode( '#', $item->get_link() );
     759
     760                        $link = clean_url($link);
     761                        if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
     762                                $slug = $matches[1];
     763                        else {
     764                                unset( $items[$item_key] );
     765                                continue;
     766                        }
     767
     768                        // Is this random plugin's slug already installed? If so, try again.
     769                        reset( $plugin_slugs );
     770                        foreach ( $plugin_slugs as $plugin_slug ) {
     771                                if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
     772                                        unset( $items[$item_key] );
     773                                        continue 2;
     774                                }
     775                        }
     776
     777                        // If we get to this point, then the random plugin isn't installed and we can stop the while().
     778                        break;
     779                }
     780
    744781                // Eliminate some common badly formed plugin descriptions
    745782                while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
    746783                        unset($items[$item_key]);
     
    748785                if ( !isset($items[$item_key]) )
    749786                        continue;
    750787
    751                 $item = $items[$item_key];
    752 
    753788                // current bbPress feed item titles are: user on "topic title"
    754789                if ( preg_match( '/"(.*)"/s', $item->get_title(), $matches ) )
    755790                        $title = $matches[1];
     
    759794
    760795                $description = wp_specialchars( strip_tags(html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'))) );
    761796
    762                 list($link, $frag) = explode( '#', $item->get_link() );
    763 
    764                 $link = clean_url($link);
    765                 if( preg_match('|/([^/]+?)/?$|', $link, $matches) )
    766                         $slug = $matches[1];
    767                 else
    768                         $slug = '';
    769 
    770797                $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) .
    771798                                                        '&TB_iframe=true&width=600&height=800';
    772799
  • wp-admin/includes/schema.php

     
    303303        add_option('update_core', array());
    304304        add_option('dismissed_update_core', array());
    305305
     306        // 2.8
     307        add_option('plugin_slugs', '', '', 'no');
     308
    306309        // Delete unused options
    307310        $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts');
    308311        foreach ($unusedoptions as $option) :
  • wp-admin/plugins.php

     
    212212$inactive_plugins = array();
    213213$recent_plugins = array();
    214214$recently_activated = (array) get_option('recently_activated');
     215update_option( 'plugin_slugs', array_keys($all_plugins) );
    215216
    216 //Clean out any plugins which were deactivated over a week ago.
     217// Clean out any plugins which were deactivated over a week ago.
    217218foreach ( $recently_activated as $key => $time )
    218219        if ( $time + (7*24*60*60) < time() ) //1 week
    219220                unset($recently_activated[ $key ]);