Ticket #8781: 8781.8.patch
File 8781.8.patch, 4.9 KB (added by , 15 years ago) |
---|
-
wp-admin/includes/dashboard.php
734 734 $new = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/new/' ); 735 735 $updated = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/updated/' ); 736 736 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 737 743 foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) { 738 744 if ( !$$feed->get_item_quantity() ) 739 745 continue; 740 746 741 747 $items = $$feed->get_items(0, 5); 742 $item_key = array_rand($items);743 748 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 744 781 // Eliminate some common badly formed plugin descriptions 745 782 while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) 746 783 unset($items[$item_key]); … … 748 785 if ( !isset($items[$item_key]) ) 749 786 continue; 750 787 751 $item = $items[$item_key];752 753 788 // current bbPress feed item titles are: user on "topic title" 754 789 if ( preg_match( '/"(.*)"/s', $item->get_title(), $matches ) ) 755 790 $title = $matches[1]; … … 759 794 760 795 $description = wp_specialchars( strip_tags(html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'))) ); 761 796 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 else768 $slug = '';769 770 797 $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . 771 798 '&TB_iframe=true&width=600&height=800'; 772 799 -
wp-admin/includes/schema.php
303 303 add_option('update_core', array()); 304 304 add_option('dismissed_update_core', array()); 305 305 306 // 2.8 307 add_option('plugin_slugs', '', '', 'no'); 308 306 309 // Delete unused options 307 310 $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'); 308 311 foreach ($unusedoptions as $option) : -
wp-admin/plugins.php
212 212 $inactive_plugins = array(); 213 213 $recent_plugins = array(); 214 214 $recently_activated = (array) get_option('recently_activated'); 215 update_option( 'plugin_slugs', array_keys($all_plugins) ); 215 216 216 // Clean out any plugins which were deactivated over a week ago.217 // Clean out any plugins which were deactivated over a week ago. 217 218 foreach ( $recently_activated as $key => $time ) 218 219 if ( $time + (7*24*60*60) < time() ) //1 week 219 220 unset($recently_activated[ $key ]);