<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>wp-admin/admin-post.php</filename>
    </added>
    <added>
      <filename>wp-admin/css/global-rtl.css</filename>
    </added>
    <added>
      <filename>wp-admin/css/press-this-ie-rtl.css</filename>
    </added>
    <added>
      <filename>wp-admin/css/press-this-ie.css</filename>
    </added>
    <added>
      <filename>wp-admin/css/press-this-rtl.css</filename>
    </added>
    <added>
      <filename>wp-admin/css/press-this.css</filename>
    </added>
    <added>
      <filename>wp-admin/gears-manifest.php</filename>
    </added>
    <added>
      <filename>wp-admin/images/gear.png</filename>
    </added>
    <added>
      <filename>wp-admin/images/loading-publish.gif</filename>
    </added>
    <added>
      <filename>wp-admin/images/loading.gif</filename>
    </added>
    <added>
      <filename>wp-admin/images/logo.gif</filename>
    </added>
    <added>
      <filename>wp-admin/images/no.png</filename>
    </added>
    <added>
      <filename>wp-admin/images/required.gif</filename>
    </added>
    <added>
      <filename>wp-admin/images/tab.png</filename>
    </added>
    <added>
      <filename>wp-admin/images/yes.png</filename>
    </added>
    <added>
      <filename>wp-admin/includes/class-wp-filesystem-base.php</filename>
    </added>
    <added>
      <filename>wp-admin/js/gallery.js</filename>
    </added>
    <added>
      <filename>wp-admin/js/revisions-js.php</filename>
    </added>
    <added>
      <filename>wp-admin/js/theme-preview.js</filename>
    </added>
    <added>
      <filename>wp-admin/js/word-count.js</filename>
    </added>
    <added>
      <filename>wp-admin/js/wp-gears.js</filename>
    </added>
    <added>
      <filename>wp-admin/press-this.php</filename>
    </added>
    <added>
      <filename>wp-admin/revision.php</filename>
    </added>
    <added>
      <filename>wp-content/plugins/akismet/readme.txt</filename>
    </added>
    <added>
      <filename>wp-includes/Text/Diff.php</filename>
    </added>
    <added>
      <filename>wp-includes/Text/Diff/Engine/native.php</filename>
    </added>
    <added>
      <filename>wp-includes/Text/Diff/Engine/shell.php</filename>
    </added>
    <added>
      <filename>wp-includes/Text/Diff/Engine/string.php</filename>
    </added>
    <added>
      <filename>wp-includes/Text/Diff/Engine/xdiff.php</filename>
    </added>
    <added>
      <filename>wp-includes/Text/Diff/Renderer.php</filename>
    </added>
    <added>
      <filename>wp-includes/Text/Diff/Renderer/inline.php</filename>
    </added>
    <added>
      <filename>wp-includes/class.wp-dependencies.php</filename>
    </added>
    <added>
      <filename>wp-includes/class.wp-scripts.php</filename>
    </added>
    <added>
      <filename>wp-includes/class.wp-styles.php</filename>
    </added>
    <added>
      <filename>wp-includes/functions.wp-scripts.php</filename>
    </added>
    <added>
      <filename>wp-includes/functions.wp-styles.php</filename>
    </added>
    <added>
      <filename>wp-includes/images/blank.gif</filename>
    </added>
    <added>
      <filename>wp-includes/js/jquery/ui.core.js</filename>
    </added>
    <added>
      <filename>wp-includes/js/jquery/ui.sortable.js</filename>
    </added>
    <added>
      <filename>wp-includes/js/thickbox/macFFBgHack.png</filename>
    </added>
    <added>
      <filename>wp-includes/js/tinymce/plugins/wordpress/img/audio.gif</filename>
    </added>
    <added>
      <filename>wp-includes/js/tinymce/plugins/wordpress/img/image.gif</filename>
    </added>
    <added>
      <filename>wp-includes/js/tinymce/plugins/wordpress/img/media.gif</filename>
    </added>
    <added>
      <filename>wp-includes/js/tinymce/plugins/wordpress/img/video.gif</filename>
    </added>
    <added>
      <filename>wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css</filename>
    </added>
    <added>
      <filename>wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css</filename>
    </added>
    <added>
      <filename>wp-includes/js/tinymce/plugins/wpeditimage/editimage.html</filename>
    </added>
    <added>
      <filename>wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js</filename>
    </added>
    <added>
      <filename>wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png</filename>
    </added>
    <added>
      <filename>wp-includes/js/tinymce/plugins/wpeditimage/img/image.png</filename>
    </added>
    <added>
      <filename>wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js</filename>
    </added>
    <added>
      <filename>wp-includes/wp-diff.php</filename>
    </added>
    <added>
      <filename>wp-load.php</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,18 @@
 &lt;?php
-/* Short and sweet */
+/**
+ * Front to the WordPress application. This file doesn't do anything, but loads
+ * wp-blog-header.php which does and tells WordPress to load the theme.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Tells WordPress to load the WordPress theme and output it.
+ *
+ * @var bool
+ */
 define('WP_USE_THEMES', true);
+
+/** Loads the WordPress Environment and Template */
 require('./wp-blog-header.php');
 ?&gt;
\ No newline at end of file</diff>
      <filename>index.php</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@
 &lt;body&gt;
 &lt;h1 id=&quot;logo&quot; style=&quot;text-align: center&quot;&gt;
 	&lt;img alt=&quot;WordPress&quot; src=&quot;wp-admin/images/wordpress-logo.png&quot; /&gt;
-	&lt;br /&gt; Version 2.5
+	&lt;br /&gt; Version 2.6.1
 &lt;/h1&gt;
 &lt;p style=&quot;text-align: center&quot;&gt;Semantic Personal Publishing Platform&lt;/p&gt;
 
@@ -29,7 +29,7 @@
 
 &lt;h1&gt;Upgrading&lt;/h1&gt;
 &lt;p&gt;Before you upgrade anything, make sure you have backup copies of any files you may have modified such as &lt;code&gt;index.php&lt;/code&gt;.&lt;/p&gt;
-&lt;h2&gt;Upgrading from any previous WordPress to 2.5:&lt;/h2&gt;
+&lt;h2&gt;Upgrading from any previous WordPress to 2.6.1:&lt;/h2&gt;
 &lt;ol&gt;
 	&lt;li&gt;Delete your old WP files, saving ones you've modified.&lt;/li&gt;
 	&lt;li&gt;Upload the new files.&lt;/li&gt;</diff>
      <filename>readme.html</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 &lt;?php
 define('DOING_AJAX', true);
 
-require_once('../wp-config.php');
+require_once('../wp-load.php');
 require_once('includes/admin.php');
 
 if ( !is_user_logged_in() )
@@ -13,9 +13,14 @@ if ( isset($_GET['action']) &amp;&amp; 'ajax-tag-search' == $_GET['action'] ) {
 
 	$s = $_GET['q']; // is this slashed already?
 
-	if ( strstr( $s, ',' ) )
-		die; // it's a multiple tag insert, we won't find anything
-	$results = $wpdb-&gt;get_col( &quot;SELECT name FROM $wpdb-&gt;terms WHERE name LIKE ('%$s%')&quot; );
+	if ( strstr( $s, ',' ) ) { 
+		$s = explode( ',', $s ); 
+		$s = $s[count( $s ) - 1]; 
+	}
+	$s = trim( $s );
+	if ( strlen( $s ) &lt; 2 )
+	 die; // require 2 chars for matching
+	$results = $wpdb-&gt;get_col( &quot;SELECT name FROM $wpdb-&gt;terms WHERE name LIKE ('%&quot;. $s . &quot;%')&quot; );
 	echo join( $results, &quot;\n&quot; );
 	die;
 }
@@ -25,14 +30,17 @@ switch ( $action = $_POST['action'] ) :
 case 'delete-comment' :
 	check_ajax_referer( &quot;delete-comment_$id&quot; );
 	if ( !$comment = get_comment( $id ) )
-		die('0');
+		die('1');
 	if ( !current_user_can( 'edit_post', $comment-&gt;comment_post_ID ) )
 		die('-1');
 
-	if ( isset($_POST['spam']) &amp;&amp; 1 == $_POST['spam'] )
+	if ( isset($_POST['spam']) &amp;&amp; 1 == $_POST['spam'] ) {
+		if ( 'spam' == wp_get_comment_status( $comment-&gt;comment_ID ) )
+			die('1');
 		$r = wp_set_comment_status( $comment-&gt;comment_ID, 'spam' );
-	else
+	} else {
 		$r = wp_delete_comment( $comment-&gt;comment_ID );
+	}
 
 	die( $r ? '1' : '0' );
 	break;
@@ -41,24 +49,38 @@ case 'delete-cat' :
 	if ( !current_user_can( 'manage_categories' ) )
 		die('-1');
 
+	$cat = get_category( $id );
+	if ( !$cat || is_wp_error( $cat ) )
+		die('1');
+
 	if ( wp_delete_category( $id ) )
 		die('1');
-	else	die('0');
+	else
+		die('0');
 	break;
 case 'delete-tag' :
 	check_ajax_referer( &quot;delete-tag_$id&quot; );
 	if ( !current_user_can( 'manage_categories' ) )
 		die('-1');
 
+	$tag = get_term( $id, 'post_tag' );
+	if ( !$tag || is_wp_error( $tag ) )
+		die('1');
+
 	if ( wp_delete_term($id, 'post_tag'))
 		die('1');
-	else	die('0');
+	else
+		die('0');
 	break;
 case 'delete-link-cat' :
 	check_ajax_referer( &quot;delete-link-category_$id&quot; );
 	if ( !current_user_can( 'manage_categories' ) )
 		die('-1');
 
+	$cat = get_term( $id, 'link_category' );
+	if ( !$cat || is_wp_error( $cat ) )
+		die('1');
+
 	$cat_name = get_term_field('name', $id, 'link_category');
 
 	// Don't delete the default cats.
@@ -89,14 +111,20 @@ case 'delete-link' :
 	if ( !current_user_can( 'manage_links' ) )
 		die('-1');
 
+	$link = get_bookmark( $id );
+	if ( !$link || is_wp_error( $link ) )
+		die('1');
+
 	if ( wp_delete_link( $id ) )
 		die('1');
-	else	die('0');
+	else
+		die('0');
 	break;
 case 'delete-meta' :
 	check_ajax_referer( &quot;delete-meta_$id&quot; );
 	if ( !$meta = get_post_meta_by_id( $id ) )
-		die('0');
+		die('1');
+
 	if ( !current_user_can( 'edit_post', $meta-&gt;post_id ) )
 		die('-1');
 	if ( delete_meta( $meta-&gt;meta_id ) )
@@ -108,6 +136,9 @@ case 'delete-post' :
 	if ( !current_user_can( 'delete_post', $id ) )
 		die('-1');
 
+	if ( !get_post( $id ) )
+		die('1');
+
 	if ( wp_delete_post( $id ) )
 		die('1');
 	else
@@ -118,19 +149,28 @@ case 'delete-page' :
 	if ( !current_user_can( 'delete_page', $id ) )
 		die('-1');
 
+	if ( !get_page( $id ) )
+		die('1');
+
 	if ( wp_delete_post( $id ) )
 		die('1');
-	else	die('0');
+	else
+		die('0');
 	break;
 case 'dim-comment' :
 	if ( !$comment = get_comment( $id ) )
 		die('0');
+
 	if ( !current_user_can( 'edit_post', $comment-&gt;comment_post_ID ) )
 		die('-1');
 	if ( !current_user_can( 'moderate_comments' ) )
 		die('-1');
 
-	if ( 'unapproved' == wp_get_comment_status($comment-&gt;comment_ID) ) {
+	$current = wp_get_comment_status( $comment-&gt;comment_ID );
+	if ( $_POST['new'] == $current )
+		die('1');
+
+	if ( 'unapproved' == $current ) {
 		check_ajax_referer( &quot;approve-comment_$id&quot; );
 		if ( wp_set_comment_status( $comment-&gt;comment_ID, 'approve' ) )
 			die('1');
@@ -150,6 +190,9 @@ case 'add-category' : // On the Fly
 		$parent = 0;
 	$post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array();
 	$checked_categories = array_map( 'absint', (array) $post_category );
+	$popular_ids = isset( $_POST['popular_ids'] ) ?
+			array_map( 'absint', explode( ',', $_POST['popular_ids'] ) ) :
+			false;
 
 	$x = new WP_Ajax_Response();
 	foreach ( $names as $cat_name ) {
@@ -162,9 +205,8 @@ case 'add-category' : // On the Fly
 		if ( $parent ) // Do these all at once in a second
 			continue;
 		$category = get_category( $cat_id );
-		$checked_categories[] = $cat_id;
 		ob_start();
-			dropdown_categories( 0, $category );
+			wp_category_checklist( 0, $cat_id, $checked_categories, $popular_ids );
 		$data = ob_get_contents();
 		ob_end_clean();
 		$x-&gt;add( array(
@@ -350,13 +392,16 @@ case 'add-comment' :
 
 	list($comments, $total) = _wp_get_comment_list( $status, $search, $start, 1 );
 
+	if ( get_option('show_avatars') )
+		add_filter( 'comment_author', 'floated_admin_avatar' );
+
 	if ( !$comments )
 		die('1');
 	$x = new WP_Ajax_Response();
 	foreach ( (array) $comments as $comment ) {
 		get_comment( $comment );
 		ob_start();
-			_wp_comment_row( $comment-&gt;comment_ID, $mode, false );
+			_wp_comment_row( $comment-&gt;comment_ID, $mode, $status );
 			$comment_list_item = ob_get_contents();
 		ob_end_clean();
 		$x-&gt;add( array(
@@ -434,7 +479,7 @@ case 'add-meta' :
 	break;
 case 'add-user' :
 	check_ajax_referer( $action );
-	if ( !current_user_can('edit_users') )
+	if ( !current_user_can('create_users') )
 		die('-1');
 	require_once(ABSPATH . WPINC . '/registration.php');
 	if ( !$user_id = add_user() )
@@ -460,10 +505,11 @@ case 'add-user' :
 	$x-&gt;send();
 	break;
 case 'autosave' : // The name of this action is hardcoded in edit_post()
-	$nonce_age = check_ajax_referer( 'autosave', 'autosavenonce');
+	define( 'DOING_AUTOSAVE', true );
+
+	$nonce_age = check_ajax_referer( 'autosave', 'autosavenonce' );
 	global $current_user;
 
-	$_POST['post_status'] = 'draft';
 	$_POST['post_category'] = explode(&quot;,&quot;, $_POST['catslist']);
 	$_POST['tags_input'] = explode(&quot;,&quot;, $_POST['tags_input']);
 	if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
@@ -477,8 +523,9 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
 
 	$supplemental = array();
 
-	$id = 0;
+	$id = $revision_id = 0;
 	if($_POST['post_ID'] &lt; 0) {
+		$_POST['post_status'] = 'draft';
 		$_POST['temp_ID'] = $_POST['post_ID'];
 		if ( $do_autosave ) {
 			$id = wp_write_post();
@@ -509,8 +556,18 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
 			if ( !current_user_can('edit_post', $post_ID) )
 				die(__('You are not allowed to edit this post.'));
 		}
+
 		if ( $do_autosave ) {
-			$id = edit_post();
+			// Drafts are just overwritten by autosave
+			if ( 'draft' == $post-&gt;post_status ) {
+				$id = edit_post();
+			} else { // Non drafts are not overwritten.  The autosave is stored in a special post revision.
+				$revision_id = wp_create_post_autosave( $post-&gt;ID );
+				if ( is_wp_error($revision_id) )
+					$id = $revision_id;
+				else
+					$id = $post-&gt;ID;
+			}
 			$data = $message;
 		} else {
 			$id = $post-&gt;ID;</diff>
      <filename>wp-admin/admin-ajax.php</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,7 @@ if ( $editing ) {
 	if ( user_can_richedit() )
 		wp_enqueue_script( 'wp_tiny_mce' );
 }
+wp_enqueue_script( 'wp-gears' );
 
 $min_width_pages = array( 'post.php', 'post-new.php', 'page.php', 'page-new.php', 'widgets.php', 'comment.php', 'link.php' );
 $the_current_page = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
@@ -28,14 +29,13 @@ get_admin_page_title();
 &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;&lt;?php bloginfo('html_type'); ?&gt;; charset=&lt;?php echo get_option('blog_charset'); ?&gt;&quot; /&gt;
 &lt;title&gt;&lt;?php bloginfo('name') ?&gt; &amp;rsaquo; &lt;?php echo wp_specialchars( strip_tags( $title ) ); ?&gt; &amp;#8212; WordPress&lt;/title&gt;
 &lt;?php
+
 wp_admin_css( 'css/global' );
 wp_admin_css();
 wp_admin_css( 'css/colors' );
+wp_admin_css( 'css/ie' );
+
 ?&gt;
-&lt;!--[if gte IE 6]&gt;
-&lt;?php wp_admin_css( 'css/ie' );
-?&gt;
-&lt;![endif]--&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;
 //&lt;![CDATA[
 addLoadEvent = function(func) {if (typeof jQuery != &quot;undefined&quot;) jQuery(document).ready(func); else if (typeof wpOnload!='function'){wpOnload=func;} else {var oldonload=wpOnload; wpOnload=function(){oldonload();func();}}};
@@ -44,26 +44,83 @@ addLoadEvent = function(func) {if (typeof jQuery != &quot;undefined&quot;) jQuery(document
 &lt;?php if ( ($parent_file != 'link-manager.php') &amp;&amp; ($parent_file != 'options-general.php') &amp;&amp; $ie6_no_scrollbar ) : ?&gt;
 &lt;style type=&quot;text/css&quot;&gt;* html { overflow-x: hidden; }&lt;/style&gt;
 &lt;?php endif;
-if ( isset($page_hook) )
-	do_action('admin_print_scripts-' . $page_hook);
-else if ( isset($plugin_page) )
-	do_action('admin_print_scripts-' . $plugin_page);
-do_action('admin_print_scripts');
+
+$hook_suffixes = array();
 
 if ( isset($page_hook) )
-	do_action('admin_head-' . $page_hook);
+	$hook_suffixes[] = &quot;-$page_hook&quot;;
 else if ( isset($plugin_page) )
-	do_action('admin_head-' . $plugin_page);
-do_action('admin_head');
+	$hook_suffixes[] = &quot;-$plugin_page&quot;;
+else if ( isset($pagenow) )
+	$hook_suffixes[] = &quot;-$pagenow&quot;;
+
+$hook_suffixes[] = '';
+
+foreach ( $hook_suffixes as $hook_suffix )
+	do_action(&quot;admin_print_styles$hook_suffix&quot;); // do_action( 'admin_print_styles-XXX' ); do_action( 'admin_print_styles' );
+foreach ( $hook_suffixes as $hook_suffix )
+	do_action(&quot;admin_print_scripts$hook_suffix&quot;); // do_action( 'admin_print_scripts-XXX' ); do_action( 'admin_print_scripts' );
+foreach ( $hook_suffixes as $hook_suffix )
+	do_action(&quot;admin_head$hook_suffix&quot;); // do_action( 'admin_head-XXX' ); do_action( 'admin_head' );
+unset($hook_suffixes, $hook_suffix);
+
 ?&gt;
 &lt;/head&gt;
 &lt;body class=&quot;wp-admin &lt;?php echo apply_filters( 'admin_body_class', '' ); ?&gt;&quot;&gt;
 &lt;div id=&quot;wpwrap&quot;&gt;
 &lt;div id=&quot;wpcontent&quot;&gt;
 &lt;div id=&quot;wphead&quot;&gt;
-&lt;h1&gt;&lt;?php bloginfo('name'); ?&gt;&lt;span id=&quot;viewsite&quot;&gt;&lt;a href=&quot;&lt;?php echo trailingslashit( get_option('home') ); ?&gt;&quot;&gt;&lt;?php _e('Visit Site') ?&gt;&lt;/a&gt;&lt;/span&gt;&lt;/h1&gt;
+&lt;h1&gt;&lt;?php if ( '' == get_bloginfo('name', 'display') ) echo '&amp;nbsp;'; else echo get_bloginfo('name', 'display'); ?&gt;&lt;span id=&quot;viewsite&quot;&gt;&lt;a href=&quot;&lt;?php echo trailingslashit( get_option('home') ); ?&gt;&quot;&gt;&lt;?php _e('Visit Site') ?&gt;&lt;/a&gt;&lt;/span&gt;&lt;/h1&gt;
 &lt;/div&gt;
-&lt;div id=&quot;user_info&quot;&gt;&lt;p&gt;&lt;?php printf(__('Howdy, &lt;a href=&quot;%1$s&quot;&gt;%2$s&lt;/a&gt;!'), 'profile.php', $user_identity) ?&gt; | &lt;a href=&quot;&lt;?php echo get_option('siteurl'); ?&gt;/wp-login.php?action=logout&quot; title=&quot;&lt;?php _e('Log Out') ?&gt;&quot;&gt;&lt;?php _e('Log Out'); ?&gt;&lt;/a&gt; | &lt;?php _e('&lt;a href=&quot;http://codex.wordpress.org/&quot;&gt;Help&lt;/a&gt;') ?&gt; | &lt;?php _e('&lt;a href=&quot;http://wordpress.org/support/&quot;&gt;Forums&lt;/a&gt;') ?&gt;&lt;/p&gt;&lt;/div&gt;
+
+&lt;?php
+if ( ! $is_opera ) { 
+?&gt;
+	&lt;div id=&quot;gears-info-box&quot; class=&quot;info-box&quot; style=&quot;display:none;&quot;&gt;
+	&lt;img src=&quot;images/gear.png&quot; title=&quot;Gear&quot; alt=&quot;&quot; class=&quot;gears-img&quot; /&gt;
+	&lt;div id=&quot;gears-msg1&quot;&gt;
+	&lt;h3 class=&quot;info-box-title&quot;&gt;&lt;?php _e('Speed up WordPress'); ?&gt;&lt;/h3&gt;
+	&lt;p&gt;&lt;?php _e('WordPress now has support for Gears, which adds new features to your web browser.'); ?&gt;&lt;br /&gt;
+	&lt;a href=&quot;http://gears.google.com/&quot; target=&quot;_blank&quot; style=&quot;font-weight:normal;&quot;&gt;&lt;?php _e('More information...'); ?&gt;&lt;/a&gt;&lt;/p&gt;
+	&lt;p&gt;&lt;?php _e('After you install and enable Gears most of WordPress&amp;#8217; images, scripts, and CSS files will be stored locally on your computer. This speeds up page load time.'); ?&gt;&lt;/p&gt;
+	&lt;p&gt;&lt;strong&gt;&lt;?php _e('Don&amp;#8217;t install on a public or shared computer.'); ?&gt;&lt;/strong&gt;&lt;/p&gt;	&lt;div class=&quot;submit&quot;&gt;&lt;button onclick=&quot;window.location = 'http://gears.google.com/?action=install&amp;amp;return=&lt;?php echo urlencode( admin_url() ); ?&gt;';&quot; class=&quot;button&quot;&gt;&lt;?php _e('Install Now'); ?&gt;&lt;/button&gt;
+	&lt;button class=&quot;button&quot; style=&quot;margin-left:10px;&quot; onclick=&quot;document.getElementById('gears-info-box').style.display='none';&quot;&gt;&lt;?php _e('Cancel'); ?&gt;&lt;/button&gt;&lt;/div&gt;
+	&lt;/div&gt;
+
+	&lt;div id=&quot;gears-msg2&quot; style=&quot;display:none;&quot;&gt;
+	&lt;h3 class=&quot;info-box-title&quot;&gt;&lt;?php _e('Gears Status'); ?&gt;&lt;/h3&gt;
+	&lt;p&gt;&lt;?php _e('Gears is installed on this computer but is not enabled for use with WordPress.'); ?&gt;&lt;/p&gt; 
+	&lt;p&gt;&lt;?php 
+	
+	if ( $is_safari )
+		_e('To enable it, make sure this web site is not on the denied list in Gears Settings under the Safari menu, then click the button below.');
+	else
+		_e('To enable it, make sure this web site is not on the denied list in Gears Settings under your browser Tools menu, then click the button below.'); 
+	
+	?&gt;&lt;/p&gt;
+	&lt;p&gt;&lt;strong&gt;&lt;?php _e('However if this is a public or shared computer, Gears should not be enabled.'); ?&gt;&lt;/strong&gt;&lt;/p&gt;
+	&lt;div class=&quot;submit&quot;&gt;&lt;button class=&quot;button&quot; onclick=&quot;wpGears.getPermission();&quot;&gt;&lt;?php _e('Enable Gears'); ?&gt;&lt;/button&gt;
+	&lt;button class=&quot;button&quot; style=&quot;margin-left:10px;&quot; onclick=&quot;document.getElementById('gears-info-box').style.display='none';&quot;&gt;&lt;?php _e('Cancel'); ?&gt;&lt;/button&gt;&lt;/div&gt;
+	&lt;/div&gt;
+
+	&lt;div id=&quot;gears-msg3&quot; style=&quot;display:none;&quot;&gt;
+	&lt;h3 class=&quot;info-box-title&quot;&gt;&lt;?php _e('Gears Status'); ?&gt;&lt;/h3&gt;
+	&lt;p&gt;&lt;?php
+	
+	if ( $is_safari )
+		_e('Gears is installed and enabled on this computer. You can disable it from the Safari menu.');
+	else
+		_e('Gears is installed and enabled on this computer. You can disable it from your browser Tools menu.'); 
+	
+	?&gt;&lt;/p&gt;
+	&lt;p&gt;&lt;?php _e('If there are any errors, try disabling Gears, then reload the page and enable it again.'); ?&gt;&lt;/p&gt;
+	&lt;p&gt;&lt;?php _e('Local storage status:'); ?&gt; &lt;span id=&quot;gears-wait&quot;&gt;&lt;span style=&quot;color:#f00;&quot;&gt;&lt;?php _e('Please wait! Updating files:'); ?&gt;&lt;/span&gt; &lt;span id=&quot;gears-upd-number&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
+	&lt;div class=&quot;submit&quot;&gt;&lt;button class=&quot;button&quot; onclick=&quot;document.getElementById('gears-info-box').style.display='none';&quot;&gt;&lt;?php _e('Close'); ?&gt;&lt;/button&gt;&lt;/div&gt;
+	&lt;/div&gt;
+	&lt;/div&gt;
+&lt;?php } ?&gt;
+
+&lt;div id=&quot;user_info&quot;&gt;&lt;p&gt;&lt;?php printf(__('Howdy, &lt;a href=&quot;%1$s&quot;&gt;%2$s&lt;/a&gt;!'), 'profile.php', $user_identity) ?&gt; | &lt;a href=&quot;&lt;?php echo site_url('wp-login.php?action=logout', 'login') ?&gt;&quot; title=&quot;&lt;?php _e('Log Out') ?&gt;&quot;&gt;&lt;?php _e('Log Out'); ?&gt;&lt;/a&gt; | &lt;?php _e('&lt;a href=&quot;http://codex.wordpress.org/&quot;&gt;Help&lt;/a&gt;') ?&gt; | &lt;?php _e('&lt;a href=&quot;http://wordpress.org/support/&quot;&gt;Forums&lt;/a&gt;'); if ( ! $is_opera ) { ?&gt; | &lt;span id=&quot;gears-menu&quot;&gt;&lt;a href=&quot;#&quot; onclick=&quot;wpGears.message(1);return false;&quot;&gt;&lt;?php _e('Turbo') ?&gt;&lt;/a&gt;&lt;/span&gt;&lt;?php } ?&gt;&lt;/p&gt;&lt;/div&gt;
 
 &lt;?php
 require(ABSPATH . 'wp-admin/menu-header.php');</diff>
      <filename>wp-admin/admin-header.php</filename>
    </modified>
    <modified>
      <diff>@@ -2,12 +2,12 @@
 define('WP_ADMIN', TRUE);
 
 if ( defined('ABSPATH') )
-	require_once( ABSPATH . 'wp-config.php');
+	require_once(ABSPATH . 'wp-load.php');
 else
-    require_once('../wp-config.php');
+	require_once('../wp-load.php');
 
 if ( get_option('db_version') != $wp_db_version ) {
-	wp_redirect(get_option('siteurl') . '/wp-admin/upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])));
+	wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
 	exit;
 }
 
@@ -26,8 +26,8 @@ $time_format = get_option('time_format');
 
 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
 
-wp_admin_css_color('classic', __('Classic'), get_option( 'siteurl' ) . &quot;/wp-admin/css/colors-classic.css&quot;, array('#07273E', '#14568A', '#D54E21', '#2683AE'));
-wp_admin_css_color('fresh', __('Fresh'), get_option( 'siteurl' ) . &quot;/wp-admin/css/colors-fresh.css&quot;, array('#464646', '#CEE1EF', '#D54E21', '#2683AE'));
+wp_admin_css_color('classic', __('Classic'), admin_url(&quot;css/colors-classic.css&quot;), array('#07273E', '#14568A', '#D54E21', '#2683AE'));
+wp_admin_css_color('fresh', __('Fresh'), admin_url(&quot;css/colors-fresh.css&quot;), array('#464646', '#CEE1EF', '#D54E21', '#2683AE'));
 
 wp_enqueue_script( 'common' );
 wp_enqueue_script( 'jquery-color' );
@@ -58,7 +58,7 @@ if (isset($plugin_page)) {
 			wp_die(__('Invalid plugin page'));
 		}
 
-		if (! ( file_exists(ABSPATH . PLUGINDIR . &quot;/$plugin_page&quot;) &amp;&amp; is_file( ABSPATH . PLUGINDIR . &quot;/$plugin_page&quot;) ) )
+		if (! ( file_exists(WP_PLUGIN_DIR . &quot;/$plugin_page&quot;) &amp;&amp; is_file(WP_PLUGIN_DIR . &quot;/$plugin_page&quot;) ) )
 			wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
 
 		do_action('load-' . $plugin_page);
@@ -66,7 +66,7 @@ if (isset($plugin_page)) {
 		if (! isset($_GET['noheader']))
 			require_once(ABSPATH . 'wp-admin/admin-header.php');
 
-		include(ABSPATH . PLUGINDIR . &quot;/$plugin_page&quot;);
+		include(WP_PLUGIN_DIR . &quot;/$plugin_page&quot;);
 	}
 
 	include(ABSPATH . 'wp-admin/admin-footer.php');
@@ -113,4 +113,7 @@ if (isset($plugin_page)) {
 	do_action(&quot;load-$pagenow&quot;);
 }
 
+if ( !empty($_REQUEST['action']) )
+	do_action('admin_action_' . $_REQUEST['action']);
+
 ?&gt;</diff>
      <filename>wp-admin/admin.php</filename>
    </modified>
    <modified>
      <diff>@@ -5,28 +5,45 @@
 */
 
 if ( defined('ABSPATH') )
-	require_once( ABSPATH . 'wp-config.php');
+	require_once(ABSPATH . 'wp-load.php');
 else
-    require_once('../wp-config.php');
+	require_once('../wp-load.php');
 
 // Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
-if ( empty($_COOKIE[AUTH_COOKIE]) &amp;&amp; !empty($_REQUEST['auth_cookie']) )
+if ( is_ssl() &amp;&amp; empty($_COOKIE[SECURE_AUTH_COOKIE]) &amp;&amp; !empty($_REQUEST['auth_cookie']) )
+	$_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
+elseif ( empty($_COOKIE[AUTH_COOKIE]) &amp;&amp; !empty($_REQUEST['auth_cookie']) )
 	$_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
 unset($current_user);
 require_once('admin.php');
 
-header('Content-Type: text/plain');
+header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
 
 if ( !current_user_can('upload_files') )
 	wp_die(__('You do not have permission to upload files.'));
 
+// just fetch the detail form for that attachment	
+if ( ($id = intval($_REQUEST['attachment_id'])) &amp;&amp; $_REQUEST['fetch'] ) {
+	echo get_media_item($id);
+	exit;
+}
+
+check_admin_referer('media-form');
+
 $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
 if (is_wp_error($id)) {
 	echo '&lt;div id=&quot;media-upload-error&quot;&gt;'.wp_specialchars($id-&gt;get_error_message()).'&lt;/div&gt;';
 	exit;
 }
 
-$type = $_REQUEST['type'];
-echo apply_filters(&quot;async_upload_{$type}&quot;, $id);
+if ( $_REQUEST['short'] ) {
+	// short form response - attachment ID only
+	echo $id;
+}
+else {
+	// long form response - big chunk o html
+	$type = $_REQUEST['type'];
+	echo apply_filters(&quot;async_upload_{$type}&quot;, $id);
+}
 
 ?&gt;</diff>
      <filename>wp-admin/async-upload.php</filename>
    </modified>
    <modified>
      <diff>@@ -126,6 +126,7 @@ endif; ?&gt;
 &lt;?php endif; ?&gt;
 
 &lt;p id=&quot;post-search&quot;&gt;
+	&lt;label class=&quot;hidden&quot; for=&quot;post-search-input&quot;&gt;&lt;?php _e('Search Categories'); ?&gt;:&lt;/label&gt;
 	&lt;input type=&quot;text&quot; id=&quot;post-search-input&quot; name=&quot;s&quot; value=&quot;&lt;?php echo attribute_escape(stripslashes($_GET['s'])); ?&gt;&quot; /&gt;
 	&lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e( 'Search Categories' ); ?&gt;&quot; class=&quot;button&quot; /&gt;
 &lt;/p&gt;
@@ -134,6 +135,24 @@ endif; ?&gt;
 
 &lt;div class=&quot;tablenav&quot;&gt;
 
+&lt;?php
+$pagenum = absint( $_GET['pagenum'] );
+if ( empty($pagenum) )
+	$pagenum = 1;
+if( !$catsperpage || $catsperpage &lt; 0 )
+	$catsperpage = 20;
+
+$page_links = paginate_links( array(
+	'base' =&gt; add_query_arg( 'pagenum', '%#%' ),
+	'format' =&gt; '',
+	'total' =&gt; ceil(wp_count_terms('category') / $catsperpage),
+	'current' =&gt; $pagenum
+));
+
+if ( $page_links )
+	echo &quot;&lt;div class='tablenav-pages'&gt;$page_links&lt;/div&gt;&quot;;
+?&gt;
+
 &lt;div class=&quot;alignleft&quot;&gt;
 &lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e('Delete'); ?&gt;&quot; name=&quot;deleteit&quot; class=&quot;button-secondary delete&quot; /&gt;
 &lt;?php wp_nonce_field('bulk-categories'); ?&gt;
@@ -147,7 +166,7 @@ endif; ?&gt;
 &lt;table class=&quot;widefat&quot;&gt;
 	&lt;thead&gt;
 	&lt;tr&gt;
-		&lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; onclick=&quot;checkAll(document.getElementById('posts-filter'));&quot; /&gt;&lt;/th&gt;
+		&lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/th&gt;
         &lt;th scope=&quot;col&quot;&gt;&lt;?php _e('Name') ?&gt;&lt;/th&gt;
         &lt;th scope=&quot;col&quot;&gt;&lt;?php _e('Description') ?&gt;&lt;/th&gt;
         &lt;th scope=&quot;col&quot; class=&quot;num&quot;&gt;&lt;?php _e('Posts') ?&gt;&lt;/th&gt;
@@ -155,13 +174,18 @@ endif; ?&gt;
 	&lt;/thead&gt;
 	&lt;tbody id=&quot;the-list&quot; class=&quot;list:cat&quot;&gt;
 &lt;?php
-cat_rows();
+cat_rows(0, 0, 0, $pagenum, $catsperpage);
 ?&gt;
 	&lt;/tbody&gt;
 &lt;/table&gt;
 &lt;/form&gt;
 
 &lt;div class=&quot;tablenav&quot;&gt;
+
+&lt;?php
+if ( $page_links )
+	echo &quot;&lt;div class='tablenav-pages'&gt;$page_links&lt;/div&gt;&quot;;
+?&gt;
 &lt;br class=&quot;clear&quot; /&gt;
 &lt;/div&gt;
 &lt;br class=&quot;clear&quot; /&gt;</diff>
      <filename>wp-admin/categories.php</filename>
    </modified>
    <modified>
      <diff>@@ -21,7 +21,7 @@ case 'editcomment' :
 	$title = __('Edit Comment');
 
 	wp_enqueue_script('comment');
-	//wp_enqueue_script('thickbox');
+
 	require_once('admin-header.php');
 
 	$comment_id = absint( $_GET['c'] );
@@ -78,7 +78,7 @@ if ( 'spam' == $_GET['dt'] ) {
 
 &lt;table width=&quot;100%&quot;&gt;
 &lt;tr&gt;
-&lt;td&gt;&lt;input type='button' class=&quot;button&quot; value='&lt;?php _e('No'); ?&gt;' onclick=&quot;self.location='&lt;?php echo get_option('siteurl'); ?&gt;/wp-admin/edit-comments.php';&quot; /&gt;&lt;/td&gt;
+&lt;td&gt;&lt;input type='button' class=&quot;button&quot; value='&lt;?php _e('No'); ?&gt;' onclick=&quot;self.location='&lt;?php echo admin_url('edit-comments.php'); ?&gt;&quot; /&gt;&lt;/td&gt;
 &lt;td class=&quot;textright&quot;&gt;&lt;input type='submit' class=&quot;button&quot; value='&lt;?php echo $button; ?&gt;' /&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/table&gt;
@@ -141,10 +141,12 @@ case 'deletecomment' :
 	else
 		wp_delete_comment( $comment-&gt;comment_ID );
 
-	if ( '' != wp_get_referer() &amp;&amp; false == $noredir )
+	if ( '' != wp_get_referer() &amp;&amp; false == $noredir &amp;&amp; false === strpos(wp_get_referer(), 'comment.php' ) )
 		wp_redirect( wp_get_referer() );
+	else if ( '' != wp_get_original_referer() &amp;&amp; false == $noredir )
+		wp_redirect( wp_get_original_referer() );
 	else
-		wp_redirect( get_option('siteurl') . '/wp-admin/edit-comments.php' );
+		wp_redirect( admin_url('edit-comments.php') );
 
 	die;
 	break;
@@ -169,7 +171,7 @@ case 'unapprovecomment' :
 	if ( '' != wp_get_referer() &amp;&amp; false == $noredir )
 		wp_redirect( wp_get_referer() );
 	else
-		wp_redirect( get_option('siteurl') . '/wp-admin/edit.php?p=' . absint( $comment-&gt;comment_post_ID ) . '#comments' );
+		wp_redirect( admin_url('edit.php?p=' . absint( $comment-&gt;comment_post_ID ) . '#comments') );
 
 	exit();
 	break;
@@ -191,14 +193,10 @@ case 'approvecomment' :
 
 	wp_set_comment_status( $comment-&gt;comment_ID, 'approve' );
 
-	if ( true == get_option('comments_notify') )
-		wp_notify_postauthor( $comment-&gt;comment_ID );
-
-
 	if ( '' != wp_get_referer() &amp;&amp; false == $noredir )
 		wp_redirect( wp_get_referer() );
 	else
-		wp_redirect( get_option('siteurl') . '/wp-admin/edit.php?p=' . absint( $comment-&gt;comment_post_ID ) . '#comments' );
+		wp_redirect( admin_url('edit.php?p=' . absint( $comment-&gt;comment_post_ID ) . '#comments') );
 
 	exit();
 	break;
@@ -227,4 +225,4 @@ default:
 
 include('admin-footer.php');
 
-?&gt;
\ No newline at end of file
+?&gt;</diff>
      <filename>wp-admin/comment.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,24 @@
+.post-com-count {
+}
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
+	background-image: url(../images/comment-stalk-rtl.gif);
+	background-position:right bottom;
+}
+#footer {
+	background-position:99% 10px;
+}
 #poststuff .closed .togbox, #poststuff .togbox {
-background-image: url(../images/toggle-arrow-rtl.gif) !important;
-}
\ No newline at end of file
+	background-image: url(../images/toggle-arrow-rtl.gif) !important;
+}
+.bar {
+	border-right-color: transparent;
+	border-left-color: #99d;
+}
+.plugins .togl {
+	border-right-color: transparent;
+	border-left-color: #ccc;
+}
+#upload-menu li.current {
+	border-right-color: transparent;
+	border-left-color: #448abd;
+}</diff>
      <filename>wp-admin/css/colors-classic-rtl.css</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@ a.page-numbers:hover {
 	border-color: #999;
 }
 
-body	{
+body, .form-table .pre {
 	background-color: #fff;
 	color: #333;
 }
@@ -37,7 +37,7 @@ input.disabled, textarea.disabled {
 	color: #fff;
 }
 
-ul#category-tabs li.ui-tabs-selected, li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form {
+ul#category-tabs li.ui-tabs-selected, li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form, h3.info-box-title {
 	background-color: #cfebf7;
 }
 
@@ -63,7 +63,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
 	color: #000;
 }
 
-ul.widget-control-list .sorthelper {
+.sorthelper {
 	background-color: #ccf3fa;
 }
 
@@ -192,6 +192,10 @@ ul.widget-control-list .sorthelper {
 	border-color: #a3a3a3;
 }
 
+.button[disabled], .button:disabled {
+	background-color: #999;
+}
+
 .tablenav .button-secondary {
 	border-color: #5396c5;
 }
@@ -200,11 +204,11 @@ ul.widget-control-list .sorthelper {
 	border-color: #535353;
 }
 
-.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover {
+.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.del-link:hover {
 	color: #d54e21;
 }
 
-#adminmenu a:hover, #sidemenu a:hover {
+#adminmenu a:hover, #sidemenu a:hover, .ui-tabs-nav a:hover {
 	color: #97c4d8;
 }
 
@@ -235,7 +239,8 @@ ul.widget-control-list .sorthelper {
 	border-bottom-color: #999;
 }
 
-.submitbox .submitdelete:hover {
+.submitbox .submitdelete:hover,
+#media-upload a.delete:hover {
 	color: #fff;
 	background-color: #f00;
 	border-bottom-color: #f00;
@@ -287,11 +292,11 @@ ul.widget-control-list .sorthelper {
 	color: #5a5a5a;
 }
 
-#poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, a {
+#poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, #media-upload a.del-link, #media-upload a.delete, a {
 	color: #2e7ca0;
 }
 
-#adminmenu a {
+#adminmenu a, .ui-tabs-nav a {
 	color: #cfebf6;
 }
 
@@ -299,7 +304,7 @@ ul.widget-control-list .sorthelper {
 	color: #2782af
 }
 /* Because we don't want visited on these links */
-#adminmenu a.current, #sidemenu a.current {
+#adminmenu a.current, #sidemenu a.current, body.press-this .ui-tabs-selected a, body.press-this .ui-tabs-selected a:hover {
 	background-color: #fff;
 	border-color: #07273e;
 	border-bottom-color: #fff;
@@ -307,11 +312,11 @@ ul.widget-control-list .sorthelper {
 	font-weight: bold;
 }
 
-#adminmenu li a #awaiting-mod {
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
 	background-image: url(../images/comment-stalk-classic.gif);
 }
 
-#adminmenu li a #awaiting-mod span {
+#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
 	background-color: #d54e21;
 	color: #fff;
 }
@@ -322,7 +327,7 @@ ul.widget-control-list .sorthelper {
 }
 
 
-#adminmenu li a:hover #awaiting-mod span {
+#adminmenu li a:hover #awaiting-mod span, #sidemenu li a:hover #update-plugins span {
 	background-color: #07273E;
 }
 
@@ -410,11 +415,11 @@ input.readonly {
 	background-color: #fff;
 }
 
-#plugins .active {
+.plugins .active {
 	background-color: #BBEEBB;
 }
 
-#plugins .togl {
+.plugins .togl {
 	border-right-color: #ccc;
 }
 
@@ -422,7 +427,7 @@ input.readonly {
 	background-color: #ffffe0;
 }
 
-#plugins tr {
+.plugins tr {
 	background-color: #fff;
 }
 
@@ -546,11 +551,6 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
 	color: #f00;
 }
 
-#media-upload a.delete { 
-	color: #888; 
-}
-
-
 /* TinyMCE */
 .wp_themeSkin *,
 .wp_themeSkin a:hover, 
@@ -561,7 +561,7 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
 }
 
 /* Containers */
-.wp_themeSkin table {
+.wp_themeSkin table, #wp_editbtns {
 	background: #83B4D5;
 }
 
@@ -713,3 +713,18 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
 	background-color: #ddd;
 	color: #333;
 }
+
+/* Diff */
+
+table.diff .diff-deletedline {
+	background-color: #ffdddd;
+}
+table.diff .diff-deletedline del {
+	background-color: #ff9999;
+}
+table.diff .diff-addedline {
+	background-color: #ddffdd;
+}
+table.diff .diff-addedline ins {
+	background-color: #99ff99;
+}</diff>
      <filename>wp-admin/css/colors-classic.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,24 @@
+.bar {
+	border-right-color: transparent;
+	border-left-color: #99d;
+}
+.post-com-count {
+}
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
+	background-image: url(../images/comment-stalk-rtl.gif);
+	background-position:right bottom;
+}
+#footer {
+	background-position:99% 10px;
+}
+.plugins .togl {
+	border-right-color: transparent;
+	border-left-color: #ccc;
+}
 #poststuff .closed .togbox, #poststuff .togbox {
-background-image: url(../images/toggle-arrow-rtl.gif) !important;
-}
\ No newline at end of file
+	background-image: url(../images/toggle-arrow-rtl.gif);
+}
+#upload-menu li.current {
+	border-right-color:transparent;
+	border-left-color: #448abd;
+}</diff>
      <filename>wp-admin/css/colors-fresh-rtl.css</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@ a.page-numbers:hover {
 	border-color: #999;
 }
 
-body	{
+body, .form-table .pre {
 	background-color: #fff;
 	color: #333;
 }
@@ -41,7 +41,7 @@ input.disabled, textarea.disabled {
 	color: #fff;
 }
 
-li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form {
+li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form, h3.info-box-title {
 	background-color: #eaf3fa;
 }
 
@@ -63,7 +63,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
 	color: #000;
 }
 
-ul.widget-control-list .sorthelper {
+.sorthelper {
 	background-color: #ccf3fa;
 }
 
@@ -188,11 +188,15 @@ ul.widget-control-list .sorthelper {
 	border-color: #80b5d0;
 }
 
+.button[disabled], .button:disabled {
+	background-color: #999;
+}
+
 .submit input:hover, .button:hover, #edit-slug-buttons a.save:hover {
 	border-color: #535353;
 }
 
-.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #sidemenu a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.delete:hover {
+.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #sidemenu a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.delete:hover, #media-upload a.del-link:hover, .ui-tabs-nav a:hover {
 	color: #d54e21;
 }
 
@@ -222,7 +226,8 @@ ul.widget-control-list .sorthelper {
 	border-bottom-color: #999;
 }
 
-.submitbox .submitdelete:hover {
+.submitbox .submitdelete:hover,
+#media-upload a.delete:hover {
 	color: #fff;
 	background-color: #f00;
 	border-bottom-color: #f00;
@@ -274,28 +279,28 @@ ul.widget-control-list .sorthelper {
 	color: #666;
 }
 
-#adminmenu a, #submenu a, #poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, a {
+#adminmenu a, #submenu a, #poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, #media-upload a.del-link, #media-upload a.delete, .ui-tabs-nav a, a {
 	color: #2583ad;
 }
 
 /* Because we don't want visited on these links */
-#adminmenu a.current, #sidemenu a.current {
+#adminmenu a.current, #sidemenu a.current, body.press-this .ui-tabs-selected a, body.press-this .ui-tabs-selected a:hover {
 	background-color: #fff;
 	border-color: #c6d9e9;
 	border-bottom-color: #fff;
 	color: #d54e21;
 }
 
-#adminmenu li a #awaiting-mod {
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
 	background-image: url(../images/comment-stalk-fresh.gif);
 }
 
-#adminmenu li a #awaiting-mod span, #rightnow .reallynow {
+#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span, #rightnow .reallynow {
 	background-color: #d54e21;
 	color: #fff;
 }
 
-#adminmenu li a:hover #awaiting-mod span {
+#adminmenu li a:hover #awaiting-mod span, #sidemenu li a:hover #update-plugins span {
 	background-color: #264761;
 }
 
@@ -379,11 +384,11 @@ input.readonly {
 	background-color: #fff;
 }
 
-#plugins .active {
+.plugins .active {
 	background-color: #e7f7d3;
 }
 
-#plugins .togl {
+.plugins .togl {
 	border-right-color: #ccc;
 }
 
@@ -391,7 +396,7 @@ input.readonly {
 	background-color: #ffffe0;
 }
 
-#plugins tr {
+.plugins tr {
 	background-color: #fff;
 }
 
@@ -528,7 +533,7 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
 }
 
 /* Containers */
-.wp_themeSkin table {
+.wp_themeSkin table, #wp_editbtns {
 	background: #cee1ef;
 }
 
@@ -684,3 +689,18 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
 	background-color: #ddd;
 	color: #333;
 }
+
+/* Diff */
+
+table.diff .diff-deletedline {
+	background-color: #ffdddd;
+}
+table.diff .diff-deletedline del {
+	background-color: #ff9999;
+}
+table.diff .diff-addedline {
+	background-color: #ddffdd;
+}
+table.diff .diff-addedline ins {
+	background-color: #99ff99;
+}</diff>
      <filename>wp-admin/css/colors-fresh.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,62 +1,62 @@
+/* Right Now */
 #rightnow {
-	margin-left: 15px;
+	margin-right:0;
+	margin-left: 7px;
 }
-
 #rightnow .reallynow span {
 	text-align: right;
 	float: right;
 }
-
 #rightnow .reallynow a {
 	text-align: left;
 	float: left;
 	margin: 1px 0 0 6px;
 }
-
-h3.dashboard-widget-title span {
-	text-align: right;
-	float: right;
+/* Widgets */
+div#dashboard-widgets-wrap {
+	margin-right:0;
+	margin-left:-13px;
 }
-
-#dashboard-widgets .widget_rss ul li a {
+div.dashboard-widget-holder {
 	float:right;
-	font-weight:bold;
-	margin:0pt 0pt 0.2em 0.5em;
 }
-
-#dashboard-widgets .widget_rss ul li span.rss-date {
+div.dashboard-widget {
+	margin-right:0;
+	margin-left: 20px;
+}
+h3.dashboard-widget-title span {
+	text-align: right;
 	float: right;
 }
-
 h3.dashboard-widget-title small {
 	text-align: left;
-	float: left;
+	float:left;
 }
-div.dashboard-widget-content ul,
-div.dashboard-widget-content ol,
-div.dashboard-widget-content dl {
+div.dashboard-widget-submit input  {
+	font-family: Tahoma;
+}
+div.dashboard-widget-content ul, div.dashboard-widget-content ol, div.dashboard-widget-content dl {
 	padding-left:0;
 	padding-right:15px;
 }
-div#dashboard-widgets-wrap
-{
-	margin-right:0;
-	margin-left:-10px;
+#dashboard_secondary div.dashboard-widget-content ul li {
+	float:right;
 }
-
-div.dashboard-widget {
-	margin-right:0;
-	margin-left:20px;
+#dashboard_secondary div.dashboard-widget-content ul li .post {
+	font-family:arial;
+}
+#dashboard_secondary div.dashboard-widget-content ul li a {
+	border-right:0 none;
+	border-left: 1px solid #dadada;
+	height:110px;
+}
+#dashboard_secondary div.dashboard-widget-content ul li a cite {
+	font-family: Tahoma;
 }
-
 #dashboard-widgets .widget_rss ul li span.rss-date {
 	float:right;
 }
 #dashboard-widgets .widget_rss ul li a {
-	float:right;
-	margin:0 0 0.2em 0.5em;
+	float: right;
+	margin: 0 0 .2em .5em;
 }
-#dashboard_secondary div.dashboard-widget-content ul li a {
-	border-right:0 none;
-	border-left:1px solid #DADADA;
-}
\ No newline at end of file</diff>
      <filename>wp-admin/css/dashboard-rtl.css</filename>
    </modified>
    <modified>
      <diff>@@ -194,3 +194,7 @@ th.check-column + th, th.check-column + td {
 	padding-bottom: 7px;
 	padding-right: 280px;
 }
+
+.wrap h2.long-header {
+	padding-right: 0;
+}</diff>
      <filename>wp-admin/css/global.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,53 +1,73 @@
-/* footer */
-body, td {
-	font-family: Tahoma,Verdana,sans-serif;
+#poststuff .postbox h3 {
+	padding-left:0;
+	padding-right: 23px;
 }
-
-.wrap {
-	text-align: right;
+* html #poststuff .postarea, * html #poststuff #titlediv {
+	margin-left:0;
+	margin-right: 3%;
 }
-
-.wrap h2 {
-	margin: 5px 0 0 4px;
-}
-
-#footer {
-	padding-left:50px;
+* html #poststuff h2 {
+	margin-right: 0;
 }
-#footer p {
-	background:none;
-	height:auto;
-	padding: 5px 5px 0;
-}
-
 #bh {
+	padding-right:0;
 	padding-left: 15px;
-	padding-right: 0px;
 }
-/* write post */
+div#dashboard-widgets {
+	padding-right:0;
+	padding-left: 1px;
+}
+#tagchecklist span a {
+	margin: 4px -9px 0 0;
+}
 #poststuff .togbox {
-	margin-right:-16px;
+	margin-left:0;
+	margin-right: -19px;
 }
-#poststuff h3 {
-	padding-right:20px;
+.widefat th input {
+	margin: 0 5px 0 0;
 }
-
-p#widget-search, p#post-search {
-	padding-left: 15px;
+/* ---------- add by navid */
+#dashmenu { /* fix top right bottom in admin */
+	direction:ltr;
+}
+#sidemenu a { /* fix left admin buttom ex. plugins, options */
+	float:left;
 }
-
-.widefat th {
-	padding-bottom: 8px;
+.wrap h2 {
+	margin:5px 4px 0 0;
+}
+#editor-toolbar {/* fix hover in media uploader icon */
+	direction:ltr;
+}
+#TB_window { /* fix theme preview */
+	left:2%;
+}
+/* fix widget page */
+form#widgets-filter {
+	position:static;
 }
-
-/* template editor */
-#template textarea {
+#widget-search {
+	display:none;
+}
+/* fix manage comment page */
+ul.view-switch li {
 	float:left;
 }
-
-/* Editor */
-
-.mceToolbar {
-	direction: ltr;
-	text-align: left;
-}
\ No newline at end of file
+form#posts-filter {
+	position:static;
+}
+#post-search {
+	display:none;
+}
+#submenu {
+	margin-right: 20px;
+}
+/* Fixes for media-upload window */
+/* Center media-upload panel on screen */
+#TB_window { 
+	width: 670px; 
+	position: absolute; 
+	top: 50%; 
+	left: 50%; 
+	margin-right: 335px !important; }</diff>
      <filename>wp-admin/css/ie-rtl.css</filename>
    </modified>
    <modified>
      <diff>@@ -111,7 +111,10 @@ div#dashboard-widgets {
 .tablenav-pages {
 	display: block;
 	margin-top: -3px;
+}
 
+table.ie-fixed {
+	table-layout: fixed;
 }
 
 #post-search .button, #widget-search .button {</diff>
      <filename>wp-admin/css/ie.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,19 +1,27 @@
 body {
-	font-size: 11px;;
+	font-family: Tahoma;
+}
+/* Half the page disapears on IE6 */
+* html body {
+	width: 700px; 
+	position: absolute; 
+	left: 50%; 
+	margin-right: 350px;
 }
 ul, ol {
 	padding: 5px 22px 5px 5px;
 }
-.form-table th {
-	text-align: right;
+.step, th {
+	text-align:right;
 }
-input {
-	padding: 1px
+.submit input, .button, .button-secondary  {
+	font-family: Tahoma;
+	margin-right:0;
+}
+.form-table th {
+	text-align:right;
 }
-#logo {
-	text-align: left;
+h1 {
+	font-family:arial;
+	margin: 5px -4px 0 0;
 }
-#admin_email {
-	direction: ltr;
-	text-align: left;
-}
\ No newline at end of file</diff>
      <filename>wp-admin/css/install-rtl.css</filename>
    </modified>
    <modified>
      <diff>@@ -7,8 +7,10 @@ body {
 	margin: 2em auto 0 auto;
 	width: 700px;
 	padding: 1em 2em;
+	-moz-border-radius: 12px;
+	-khtml-border-radius: 12px;
 	-webkit-border-radius: 12px;
-	font-size: 62.5%;
+	border-radius: 12px;
 }
 
 a { color: #2583ad; text-decoration: none; }
@@ -25,34 +27,41 @@ h2 { font-size: 16px; }
 
 p, li {
 	padding-bottom: 2px;
-	font-size: 1.3em;
-	line-height: 1.8em;
+	font-size: 13px;
+	line-height: 18px;
 }
 
 code {
-	font-size: 1.3em;
+	font-size: 13px;
 }
 
 ul, ol { padding: 5px 5px 5px 22px; }
 
 #logo { margin: 6px 0 14px 0px; border-bottom: none;}
 
-.step a, .step input { font-size: 2em; }
+.step {
+	margin: 20px 0 15px;
+}
 
-td input { font-size: 1.5em; }
+.step input {
+	font-size: 18px;
+}
+
+a.button {
+	font-size: 18px;
+}
 
 .step, th { text-align: left; padding: 0; }
 
 .submit input, .button, .button-secondary {
 	font-family: &quot;Lucida Grande&quot;, &quot;Lucida Sans Unicode&quot;, Tahoma, Verdana, sans-serif;
-	padding: 6px;
-	border: none;
+	padding: 5px 7px 7px;
+	border: 1px solid #a3a3a3;
 	margin-left: 0;
-	font-size: 13px !important;
-	-moz-border-radius: 2px;
-	-khtml-border-radius: 2px;
-	-webkit-border-radius: 2px;
-	border-radius: 2px;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
 	color: #246;
 	background: #e5e5e5;
 }
@@ -63,6 +72,7 @@ td input { font-size: 1.5em; }
 
 .submit input:hover, .button:hover, .button-secondary:hover {
 	color: #d54e21;
+	border-color: #535353;
 }
 
 .form-table {
@@ -75,12 +85,13 @@ td input { font-size: 1.5em; }
 	margin-bottom: 9px;
 	padding: 10px;
 	border-bottom: 8px solid #fff;
+	font-size: 12px;
 }
 
 .form-table th {
-	font-size: 12px;
+	font-size: 13px;
 	text-align: left;
-	padding: 12px 10px 10px 10px;
+	padding: 16px 10px 10px 10px;
 	border-bottom: 8px solid #fff;
 	width: 110px;
 	vertical-align: top;
@@ -100,6 +111,12 @@ td input { font-size: 1.5em; }
 	font-size: 11px;
 }
 
+.form-table input {
+	line-height: 20px;
+	font-size: 15px;
+	padding: 2px;
+}
+
 h1 {
 	border-bottom: 1px solid #dadada;
 	clear: both;
@@ -116,9 +133,10 @@ h1 {
 
 #error-page p {
 	font-size: 14px;
-	line-height: 1.6em;
+	line-height: 16px;
+	margin: 25px 0 20px;
 }
 
 #error-page code {
-	font-size: 1em;
+	font-size: 15px;
 }
\ No newline at end of file</diff>
      <filename>wp-admin/css/install.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,32 +1,37 @@
 body {
-	font-family: &quot;Lucida Grande&quot;, &quot;Lucida Sans Unicode&quot;, Tahoma, Verdana, sans-serif;
-	direction: rtl;
+	font-family: Tahoma;
 }
 form {
 	margin-left:0;
-	margin-right:8px;
+	margin-right: 8px;
 }
 form .forgetmenot {
 	float:right;
 }
+#login form .submit input  {
+	font-family: Tahoma;
+}
 form .submit {
 	float:left;
 }
+#backtoblog a {
+	left:auto;
+	right:15px;
+}
 #login_error, .message {
-	margin:0 8px 16px 0;
+	margin: 0 8px 16px 0;
 }
 #nav {
-	margin: 0 8px 0 0;
+	margin:0 8px 0 0;
 }
 #user_pass, #user_login, #user_email {
 	margin-right:0;
 	margin-left: 6px;
-	direction:ltr;
 }
 h1 a {
 	text-decoration:none;
 }
-#backtoblog a {
-	left: auto;
-	right: 15px;
-}
\ No newline at end of file
+/* ltr input */
+#user_login, #user_pass {
+	direction:ltr;
+}</diff>
      <filename>wp-admin/css/login-rtl.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,21 +1,66 @@
-ul#sidemenu {
-	left: auto;
-	right: 0;
+body#media-upload ul#sidemenu {
+	left:auto;
+	right:0;
+	width: 620px;
+}
+#search-filter {
+	text-align:left;
 }
 .align .field label {
-	display: block;
+	padding: 0 28px 0 0;
+	margin: 0 0 0 1em;
+}
+.image-align-none-label, .image-align-left-label, .image-align-center-label, .image-align-right-label {
+	background-position:center right;
+}
+tr.image-size label {
+	margin: 0 0 0 1em;
+}
+.filename.original {
 	float: right;
-	padding: 0 25px 0 0;
-	margin: 5px 3px 5px 5px; 
 }
-.align .field input {
-	display: block;
+.crunching {
+	text-align: left;
+	margin-right:0;
+	margin-left: 5px;
+}
+button.dismiss {
+	right:auto;
+	left:5px;
+}
+.file-error {
+	margin: 0 50px 5px 0;
+}
+.progress {
+	left:auto;
+	right:0;
+}
+.bar {
+	border-right-width:0;
+	border-left-width: 3px;
+	border-left-style: solid;
+}
+.media-item .pinkynail {
+	float:right;
+}
+.describe-toggle-on, .describe-toggle-off {
+	float: left;
+	margin-right:0;
+	margin-left: 20px;
+}
+/* Specific to Uploader */
+
+#media-upload .media-upload-form p {
+	margin: 0 0 1em 1em;
+}
+.filename {
 	float: right;
-	margin: 5px 15px 5px 0;
-}
-.image-align-none-label,
-.image-align-left-label,
-.image-align-center-label,
-.image-align-right-label {
-	background-position: center right;
-}
\ No newline at end of file
+	margin-left:0;
+	margin-right: 10px;
+}
+#media-upload .describe th.label {
+	text-align:right;
+}
+.menu_order {
+	float:left;
+}</diff>
      <filename>wp-admin/css/media-rtl.css</filename>
    </modified>
    <modified>
      <diff>@@ -32,6 +32,7 @@ form {
 .media-upload-form label, .media-upload-form legend {
 	display:block;
 	font-weight: bold;
+	font-size: 13px;
 	margin-bottom: 0.5em;
 	margin: 0 0 0.5em 0;
 }
@@ -91,8 +92,14 @@ tr.image-size label {
 	max-height: 40px;
 }
 
-.filename {
-	display: none;
+.filename.original {
+	float: left;
+}
+.crunching {
+	display: block;
+	line-height: 32px;
+	text-align: right;
+	margin-right: 5px;
 }
 button.dismiss {
 	position: absolute;
@@ -118,27 +125,31 @@ button.dismiss {
 	border-right-width: 3px;
 	border-right-style: solid;
 }
+
+#library-form .progress, #gallery-form .progress {
+	display: none;
+}
+
 .media-item .thumbnail {
 	max-width: 128px;
 	max-height: 128px;
 }
 .media-item .pinkynail {
-	position: absolute;
-	top: 2px;
-	left: 2px;
+	float: left;
+	margin: 2px;
 	height: 32px;
 	max-width: 40px;
 }
 
-tbody.media-item-info tr {
+thead.media-item-info tr {
 	background-color: transparent;
 }
-tbody.media-item-info th, tbody.media-item-info td {
+thead.media-item-info th, thead.media-item-info td {
 	border: none;
 	margin: 0;
 }
 
-.form-table tbody.media-item-info {
+.form-table thead.media-item-info {
 	border: 8px solid #fff;
 }
 
@@ -164,23 +175,14 @@ abbr.required {
 .describe-toggle-on, .describe-toggle-off {
 	display: block;
 	line-height: 36px;
-	z-index: 2;
-	position: absolute;
-	top: 0px;
-	right: 20px;
+	float: right;
+	margin-right: 20px;
 }
 .describe-toggle-off {
 	display: none;
 }
+
 .clickmask {
-	background: transparent;
-	position: absolute;
-	top: 0px;
-	left: 0px;
-	cursor: pointer;
-	border: none;
-	z-index: 3;
-	height: 36px;
 }
 
 .hidden {
@@ -195,6 +197,11 @@ abbr.required {
 #media-upload .media-upload-form p {
 	margin: 0 1em 1em 0;
 }
+
+#media-upload .media-upload-form p.ml-submit {
+	padding: 1em 0;
+}
+
 #media-upload p.help {
 	font-style: italic;
 	font-weight: normal;
@@ -210,17 +217,23 @@ abbr.required {
 }
 
 #media-upload .media-item {
+	position: relative;
 	border-bottom-width: 1px;
 	border-bottom-style: solid;
-	width: 623px;
-	position: relative;
 	min-height: 36px;
+	width: 100%;
 }
-#media-upload .filename {
-	display: block;
+
+#media-upload .ui-sortable .media-item {
+	cursor: move;
+}
+
+.filename {
+	float: left;
 	line-height: 36px;
-	margin-left: 50px;
-	z-index: 2;
+	margin-left: 10px;
+	overflow: hidden;
+	max-width: 430px;
 }
 #media-upload .describe {
 	border-top-width: 1px;
@@ -228,6 +241,7 @@ abbr.required {
 	padding: 5px;
 	width: 100%;
 	clear: both;
+	cursor: default;
 }
 #media-upload .describe th.label {
 	padding-top: .5em;
@@ -239,4 +253,63 @@ abbr.required {
 #media-upload tr.image-size {
 	margin-bottom: 1em;
 	height: 3em;
-}
\ No newline at end of file
+}
+
+#media-upload #filter {
+	width: 623px;
+}
+
+#media-upload #filter .subsubsub {
+	margin: 8px 0;
+}
+
+#filter .tablenav select {
+	border-style:solid;
+	border-width:1px;
+	padding:2px;
+	vertical-align:top;
+}
+
+#media-upload a.delete,
+#media-upload a.del-link {
+	padding: 0 3px 1px;
+}
+
+#media-upload .del-attachment {
+	display: none;
+	margin: 5px 0;
+}
+
+.menu_order {
+	float: right;
+	font-size: 11px;
+	margin: 10px 10px 0;
+}
+
+.menu_order_input {
+	border: 1px solid #DDDDDD;
+	font-size: 10px;
+	padding: 1px;
+	width: 23px;
+}
+
+.ui-sortable-helper {
+	background-color: #fff;
+	border: 1px solid #aaa;
+	opacity: 0.6;
+	filter: alpha(opacity=60);
+}
+
+#media-upload th.order-head {
+	 width: 25%;
+	 text-align: center;
+}
+
+#media-upload .widefat {
+	width: 626px;
+	border-style: solid solid none;
+}
+
+.sorthelper {
+	z-index: -1;
+}</diff>
      <filename>wp-admin/css/media.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,15 @@
+#template textarea {
+	font-family:monospace;
+}
 #templateside {
 	float:left;
 }
 #themeselector {
 	padding-right:0;
-	padding-left:5px;
+	padding-left: 5px;
+	float: left;
 }
 div.tablenav {
-	margin-left:210px;
 	margin-right:0;
-}
\ No newline at end of file
+	margin-left: 210px;
+}</diff>
      <filename>wp-admin/css/theme-editor-rtl.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,50 +1,45 @@
+/* 2 column liquid layout */
 div.widget-liquid-left-holder {
-	clear:right;
-	float:right;
+	float: right;
+	clear: right;
 	margin-right:0;
-	margin-left:-310px;
+	margin-left: -310px;
 }
 div.widget-liquid-left {
 	margin-right:0;
-	margin-left:310px;
+	margin-left: 320px;
 }
 div.widget-liquid-right {
-	clear:left;
-	float:left;
+	float: left;
+	clear: left;
 }
 p#widget-search {
+	right:auto;
 	left:0;
-	right:auto
+}
+h4.widget-title span {
+	float: right;
+}
+h4.widget-title a {
+	float: left;
+	margin-left:0;
+	margin-right: 1em;
 }
 ul#widget-list li.widget-list-item h4.widget-title {
 	float:right;
-	text-align:right;
 }
 ul#widget-list li.widget-list-item div.widget-description {
-	margin:0 200px 0 0;
-	padding:0 4em 0 0;
+	margin: 0 200px 0 0;
+	padding: 0 4em 0 0;
 }
 .widget-control-save, .widget-control-remove {
-	float:right;
 	margin-right:0;
-	margin-left:8px;
+	margin-left: 8px;
+	float: right;
 }
-h4.widget-title a {
-	right:auto;
-	left:1em;
-}
-li.widget-list-control-item h4.widget-title a, #dragHelper li.widget-list-control-item h4.widget-title a, #draghelper li.widget-list-control-item h4.widget-title a:visited {
+li.widget-list-control-item h4.widget-title a,
+#dragHelper li.widget-list-control-item h4.widget-title a,
+#draghelper li.widget-list-control-item h4.widget-title a:visited {
 	right:auto;
-	left:2em;
-}
-
-li.widget-list-control-item div.widget-control {
-	padding:0 0 0 10px;
-}
-ul.widget-control-list div.widget-control-actions {
-	margin-right:0;
-	margin-left:-10px;
+	left: 1em;
 }
-ul.widget-control-list .widget-title {
-	text-align:right;
-}
\ No newline at end of file</diff>
      <filename>wp-admin/css/widgets-rtl.css</filename>
    </modified>
    <modified>
      <diff>@@ -45,10 +45,20 @@ ul#widget-list li.widget-list-item {
 	margin: 0;
 	border-bottom-width: 1px;
 	border-bottom-style: solid;
-	background-color: transparent;
 	line-height: 1;
 }
 
+h4.widget-title span {
+	float: left;
+}
+
+h4.widget-title a {
+	float: right;
+	text-decoration: underline;
+	border-bottom: none;
+	margin-left: 1em;
+}
+
 ul#widget-list li.widget-list-item h4.widget-title {
 	position: relative;
 	margin: 0;
@@ -59,7 +69,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
 	-moz-border-radius: 3px;
 	-khtml-border-radius: 3px;
 	-webkit-border-radius: 3px;
-	border-radius: 3px;;
+	border-radius: 3px;
 }
 
 #dragHelper h4.widget-title {
@@ -74,7 +84,6 @@ ul#widget-list li.widget-list-item div.widget-description {
 	font-size: 11px;
 }
 
-
 ul#widget-list li.widget-list-item ul.widget-control-info {
 	display: none;
 }
@@ -96,18 +105,21 @@ div#current-widgets p.submit {
 }
 
 li.widget-list-control-item {
-	margin: 0 0 1em;
+	margin: 1em 0;
 	-moz-border-radius: 3px;
 	-khtml-border-radius: 3px;
 	-webkit-border-radius: 3px;
 	border-radius: 3px;
 }
 
-li.widget-list-control-item h4, #dragHelper li.widget-list-control-item h4, li.widget-sortable h4 {
+li.widget-list-control-item h4, 
+#dragHelper li.widget-list-control-item h4, 
+li.widget-sortable h4 {
 	margin: 0;
-	padding: 0.4em 2.5em 0.4em 0.8em;
 	cursor: move;
 	font-size: 13px;
+	padding: 0.4em 0.8em;
+	position: relative;
 	-moz-border-radius: 3px;
 	-khtml-border-radius: 3px;
 	-webkit-border-radius: 3px;
@@ -125,30 +137,22 @@ li.widget-list-control-item h4, #dragHelper li.widget-list-control-item h4, li.w
 	text-decoration: none;
 }
 
-h4.widget-title a {
-	position: absolute;
-	right: 1em;
-	text-decoration: underline;
-	border-bottom: none;
-}
-
 li.widget-list-control-item h4.widget-title a,
 #dragHelper li.widget-list-control-item h4.widget-title a,
 #draghelper li.widget-list-control-item h4.widget-title a:visited {
-	right: 2em;
+	right: 1em;
 }
 
 li.widget-list-control-item h4.widget-title a:hover {
-
 	text-decoration: none;
 	border-bottom: none;
 }
 
 li.widget-list-control-item div.widget-control {
 	display: none;
-	margin: 1em;
-	padding: 0 10px 0 7px; /* Correction for padding, margin, border of inputs */
+	padding: 15px;
 	font-size: 11px;
+	position: relative;
 }
 
 li.widget-list-control-item div.widget-control p {
@@ -157,15 +161,9 @@ li.widget-list-control-item div.widget-control p {
 }
 
 ul.widget-control-list div.widget-control-actions {
-	margin-right: -10px; /* Correction for padding, margin, border of inputs */
-	margin-left: -6px;
 	border-top-width: 1px;
 	border-top-style: solid;
-	padding: 0.5em 0 0.8em;
-}
-
-ul.widget-control-list .widget-title {
-	
+	padding: 0.5em 0 0;
 }
 
 .widget-control-edit {</diff>
      <filename>wp-admin/css/widgets.css</filename>
    </modified>
    <modified>
      <diff>@@ -11,17 +11,27 @@ class Custom_Image_Header {
 		$page = add_theme_page(__('Custom Image Header'), __('Custom Image Header'), 'edit_themes', 'custom-header', array(&amp;$this, 'admin_page'));
 
 		add_action(&quot;admin_print_scripts-$page&quot;, array(&amp;$this, 'js_includes'));
+		add_action(&quot;admin_head-$page&quot;, array(&amp;$this, 'take_action'), 50);
 		add_action(&quot;admin_head-$page&quot;, array(&amp;$this, 'js'), 50);
 		add_action(&quot;admin_head-$page&quot;, $this-&gt;admin_header_callback, 51);
 	}
 
-	function js_includes() {
-		wp_enqueue_script('cropper');
-		wp_enqueue_script('colorpicker');
+	function step() {
+		$step = (int) @$_GET['step'];
+		if ( $step &lt; 1 || 3 &lt; $step )
+			$step = 1;
+		return $step;
 	}
 
-	function js() {
+	function js_includes() {
+		$step = $this-&gt;step();
+		if ( 1 == $step )
+			wp_enqueue_script('colorpicker');
+		elseif ( 2 == $step )	
+			wp_enqueue_script('cropper');
+	}
 
+	function take_action() {
 		if ( isset( $_POST['textcolor'] ) ) {
 			check_admin_referer('custom-header');
 			if ( 'blank' == $_POST['textcolor'] ) {
@@ -36,48 +46,18 @@ class Custom_Image_Header {
 			check_admin_referer('custom-header');
 			remove_theme_mods();
 		}
-	?&gt;
-&lt;script type=&quot;text/javascript&quot;&gt;
-
-	function onEndCrop( coords, dimensions ) {
-		$( 'x1' ).value = coords.x1;
-		$( 'y1' ).value = coords.y1;
-		$( 'x2' ).value = coords.x2;
-		$( 'y2' ).value = coords.y2;
-		$( 'width' ).value = dimensions.width;
-		$( 'height' ).value = dimensions.height;
 	}
 
-	// with a supplied ratio
-	Event.observe(
-		window,
-		'load',
-		function() {
-			var xinit = &lt;?php echo HEADER_IMAGE_WIDTH; ?&gt;;
-			var yinit = &lt;?php echo HEADER_IMAGE_HEIGHT; ?&gt;;
-			var ratio = xinit / yinit;
-			var ximg = $('upload').width;
-			var yimg = $('upload').height;
-			if ( yimg &lt; yinit || ximg &lt; xinit ) {
-				if ( ximg / yimg &gt; ratio ) {
-					yinit = yimg;
-					xinit = yinit * ratio;
-				} else {
-					xinit = ximg;
-					yinit = xinit / ratio;
-				}
-			}
-			new Cropper.Img(
-				'upload',
-				{
-					ratioDim: { x: xinit, y: yinit },
-					displayOnInit: true,
-					onEndCrop: onEndCrop
-				}
-			)
-		}
-	);
+	function js() {
+		$step = $this-&gt;step();
+		if ( 1 == $step )
+			$this-&gt;js_1();
+		elseif ( 2 == $step )
+			$this-&gt;js_2();
+	}
 
+	function js_1() { ?&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
 	var cp = new ColorPicker();
 
 	function pickColor(color) {
@@ -116,7 +96,7 @@ class Custom_Image_Header {
 		}
 	}
 	function colorDefault() {
-		pickColor('&lt;?php echo HEADER_TEXTCOLOR; ?&gt;');
+		pickColor('#&lt;?php echo HEADER_TEXTCOLOR; ?&gt;');
 	}
 
 	function hide_text() {
@@ -149,6 +129,50 @@ Event.observe( window, 'load', hide_text );
 &lt;?php
 	}
 
+	function js_2() { ?&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+	function onEndCrop( coords, dimensions ) {
+		$( 'x1' ).value = coords.x1;
+		$( 'y1' ).value = coords.y1;
+		$( 'x2' ).value = coords.x2;
+		$( 'y2' ).value = coords.y2;
+		$( 'width' ).value = dimensions.width;
+		$( 'height' ).value = dimensions.height;
+	}
+
+	// with a supplied ratio
+	Event.observe(
+		window,
+		'load',
+		function() {
+			var xinit = &lt;?php echo HEADER_IMAGE_WIDTH; ?&gt;;
+			var yinit = &lt;?php echo HEADER_IMAGE_HEIGHT; ?&gt;;
+			var ratio = xinit / yinit;
+			var ximg = $('upload').width;
+			var yimg = $('upload').height;
+			if ( yimg &lt; yinit || ximg &lt; xinit ) {
+				if ( ximg / yimg &gt; ratio ) {
+					yinit = yimg;
+					xinit = yinit * ratio;
+				} else {
+					xinit = ximg;
+					yinit = xinit / ratio;
+				}
+			}
+			new Cropper.Img(
+				'upload',
+				{
+					ratioDim: { x: xinit, y: yinit },
+					displayOnInit: true,
+					onEndCrop: onEndCrop
+				}
+			)
+		}
+	);
+&lt;/script&gt;
+&lt;?php
+	}
+
 	function step_1() {
 		if ( $_GET['updated'] ) { ?&gt;
 &lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;
@@ -165,7 +189,7 @@ Event.observe( window, 'load', hide_text );
 &lt;div id=&quot;desc&quot;&gt;&lt;?php bloginfo('description');?&gt;&lt;/div&gt;
 &lt;/div&gt;
 &lt;?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?&gt;
-&lt;form method=&quot;post&quot; action=&quot;&lt;?php echo get_option('siteurl') ?&gt;/wp-admin/themes.php?page=custom-header&amp;amp;updated=true&quot;&gt;
+&lt;form method=&quot;post&quot; action=&quot;&lt;?php echo admin_url('themes.php?page=custom-header&amp;amp;updated=true') ?&gt;&quot;&gt;
 &lt;input type=&quot;button&quot; value=&quot;&lt;?php _e('Hide Text'); ?&gt;&quot; onclick=&quot;hide_text()&quot; id=&quot;hidetext&quot; /&gt;
 &lt;input type=&quot;button&quot; value=&quot;&lt;?php _e('Select a Text Color'); ?&gt;&quot; onclick=&quot;colorSelect($('textcolor'), 'pickcolor')&quot; id=&quot;pickcolor&quot; /&gt;&lt;input type=&quot;button&quot; value=&quot;&lt;?php _e('Use Original Color'); ?&gt;&quot; onclick=&quot;colorDefault()&quot; id=&quot;defaultcolor&quot; /&gt;
 &lt;?php wp_nonce_field('custom-header') ?&gt;
@@ -252,7 +276,7 @@ Event.observe( window, 'load', hide_text );
 &lt;form method=&quot;POST&quot; action=&quot;&lt;?php echo attribute_escape(add_query_arg('step', 3)) ?&gt;&quot;&gt;
 
 &lt;p&gt;&lt;?php _e('Choose the part of the image you want to use as your header.'); ?&gt;&lt;/p&gt;
-&lt;div id=&quot;testWrap&quot;&gt;
+&lt;div id=&quot;testWrap&quot; style=&quot;position: relative&quot;&gt;
 &lt;img src=&quot;&lt;?php echo $url; ?&gt;&quot; id=&quot;upload&quot; width=&quot;&lt;?php echo $width; ?&gt;&quot; height=&quot;&lt;?php echo $height; ?&gt;&quot; /&gt;
 &lt;/div&gt;
 
@@ -327,19 +351,13 @@ Event.observe( window, 'load', hide_text );
 	}
 
 	function admin_page() {
-		if ( !isset( $_GET['step'] ) )
-			$step = 1;
-		else
-			$step = (int) $_GET['step'];
-
-		if ( 1 == $step ) {
+		$step = $this-&gt;step();
+		if ( 1 == $step )
 			$this-&gt;step_1();
-		} elseif ( 2 == $step ) {
+		elseif ( 2 == $step )
 			$this-&gt;step_2();
-		} elseif ( 3 == $step ) {
+		elseif ( 3 == $step )
 			$this-&gt;step_3();
-		}
-
 	}
 
 }</diff>
      <filename>wp-admin/custom-header.php</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,10 @@ while (have_posts()) : the_post();
 $class = 'alternate' == $class ? '' : 'alternate';
 global $current_user;
 $post_owner = ( $current_user-&gt;ID == $post-&gt;post_author ? 'self' : 'other' );
+$att_title = get_the_title();
+if ( empty($att_title) )
+	$att_title = __('(no title)');
+
 ?&gt;
 	&lt;tr id='post-&lt;?php echo $id; ?&gt;' class='&lt;?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post-&gt;post_status ); ?&gt;' valign=&quot;top&quot;&gt;
 
@@ -50,7 +54,7 @@ foreach($posts_columns as $column_name=&gt;$column_display_name) {
 
 	case 'media':
 		?&gt;
-		&lt;td&gt;&lt;strong&gt;&lt;a href=&quot;media.php?action=edit&amp;amp;attachment_id=&lt;?php the_ID(); ?&gt;&quot; title=&quot;&lt;?php echo attribute_escape(sprintf(__('Edit &quot;%s&quot;'), get_the_title())); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;
+		&lt;td&gt;&lt;strong&gt;&lt;a href=&quot;media.php?action=edit&amp;amp;attachment_id=&lt;?php the_ID(); ?&gt;&quot; title=&quot;&lt;?php echo attribute_escape(sprintf(__('Edit &quot;%s&quot;'), $att_title)); ?&gt;&quot;&gt;&lt;?php echo $att_title; ?&gt;&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;
 		&lt;?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post-&gt;ID))); ?&gt;
 		&lt;?php do_action('manage_media_media_column', $post-&gt;ID); ?&gt;
 		&lt;/td&gt;</diff>
      <filename>wp-admin/edit-attachment-rows.php</filename>
    </modified>
    <modified>
      <diff>@@ -26,18 +26,18 @@ if ( ! empty($cat_ID) ) {
 	&lt;table class=&quot;form-table&quot;&gt;
 		&lt;tr class=&quot;form-field form-required&quot;&gt;
 			&lt;th scope=&quot;row&quot; valign=&quot;top&quot;&gt;&lt;label for=&quot;cat_name&quot;&gt;&lt;?php _e('Category Name') ?&gt;&lt;/label&gt;&lt;/th&gt;
-			&lt;td&gt;&lt;input name=&quot;cat_name&quot; id=&quot;cat_name&quot; type=&quot;text&quot; value=&quot;&lt;?php echo attribute_escape($category-&gt;name); ?&gt;&quot; size=&quot;40&quot; /&gt;&lt;br /&gt;
+			&lt;td&gt;&lt;input name=&quot;cat_name&quot; id=&quot;cat_name&quot; type=&quot;text&quot; value=&quot;&lt;?php echo attribute_escape($category-&gt;name); ?&gt;&quot; size=&quot;40&quot; aria-required=&quot;true&quot; /&gt;&lt;br /&gt;
             &lt;?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr class=&quot;form-field&quot;&gt;
 			&lt;th scope=&quot;row&quot; valign=&quot;top&quot;&gt;&lt;label for=&quot;category_nicename&quot;&gt;&lt;?php _e('Category Slug') ?&gt;&lt;/label&gt;&lt;/th&gt;
-			&lt;td&gt;&lt;input name=&quot;category_nicename&quot; id=&quot;category_nicename&quot; type=&quot;text&quot; value=&quot;&lt;?php echo attribute_escape($category-&gt;slug); ?&gt;&quot; size=&quot;40&quot; /&gt;&lt;br /&gt;
+			&lt;td&gt;&lt;input name=&quot;category_nicename&quot; id=&quot;category_nicename&quot; type=&quot;text&quot; value=&quot;&lt;?php echo attribute_escape(apply_filters('editable_slug', $category-&gt;slug)); ?&gt;&quot; size=&quot;40&quot; /&gt;&lt;br /&gt;
             &lt;?php _e('The &amp;#8220;slug&amp;#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr class=&quot;form-field&quot;&gt;
 			&lt;th scope=&quot;row&quot; valign=&quot;top&quot;&gt;&lt;label for=&quot;category_parent&quot;&gt;&lt;?php _e('Category Parent') ?&gt;&lt;/label&gt;&lt;/th&gt;
 			&lt;td&gt;
-	  			&lt;?php wp_dropdown_categories('hide_empty=0&amp;name=category_parent&amp;orderby=name&amp;selected=' . $category-&gt;parent . '&amp;hierarchical=1&amp;show_option_none=' . __('None')); ?&gt;&lt;br /&gt;
+	  			&lt;?php wp_dropdown_categories(array('hide_empty' =&gt; 0, 'name' =&gt; 'category_parent', 'orderby' =&gt; 'name', 'selected' =&gt; $category-&gt;parent, 'hierarchical' =&gt; true, 'show_option_none' =&gt; __('None'))); ?&gt;&lt;br /&gt;
                 &lt;?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?&gt;
 	  		&lt;/td&gt;
 		&lt;/tr&gt;</diff>
      <filename>wp-admin/edit-category-form.php</filename>
    </modified>
    <modified>
      <diff>@@ -12,8 +12,7 @@ if ( !empty( $_REQUEST['delete_comments'] ) ) {
 	$comments_deleted = $comments_approved = $comments_unapproved = $comments_spammed = 0;
 	foreach ($_REQUEST['delete_comments'] as $comment) : // Check the permissions on each
 		$comment = (int) $comment;
-		$post_id = (int) $wpdb-&gt;get_var(&quot;SELECT comment_post_ID FROM $wpdb-&gt;comments WHERE comment_ID = $comment&quot;);
-		// $authordata = get_userdata( $wpdb-&gt;get_var(&quot;SELECT post_author FROM $wpdb-&gt;posts WHERE ID = $post_id&quot;) );
+		$post_id = (int) $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;SELECT comment_post_ID FROM $wpdb-&gt;comments WHERE comment_ID = %d&quot;, $comment) );
 		if ( !current_user_can('edit_post', $post_id) )
 			continue;
 		if ( !empty( $_REQUEST['spamit'] ) ) {
@@ -31,6 +30,8 @@ if ( !empty( $_REQUEST['delete_comments'] ) ) {
 		}
 	endforeach;
 	$redirect_to = basename( __FILE__ ) . '?deleted=' . $comments_deleted . '&amp;approved=' . $comments_approved . '&amp;spam=' . $comments_spammed . '&amp;unapproved=' . $comments_unapproved;
+	if ( isset($_REQUEST['apage']) )
+		$redirect_to = add_query_arg( 'apage', absint($_REQUEST['apage']), $redirect_to );
 	if ( !empty($_REQUEST['mode']) )
 		$redirect_to = add_query_arg('mode', $_REQUEST['mode'], $redirect_to);
 	if ( !empty($_REQUEST['comment_status']) )
@@ -97,7 +98,7 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp
 &lt;?php
 $status_links = array();
 $num_comments = wp_count_comments();
-$stati = array('moderated' =&gt; sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', $num_comments-&gt;moderated), &quot;&lt;span class='comment-count'&gt;$num_comments-&gt;moderated&lt;/span&gt;&quot;), 'approved' =&gt; _c('Approved|plural'));
+$stati = array('moderated' =&gt; sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', number_format_i18n($num_comments-&gt;moderated) ), &quot;&lt;span class='comment-count'&gt;&quot; . number_format_i18n($num_comments-&gt;moderated) . &quot;&lt;/span&gt;&quot;), 'approved' =&gt; _c('Approved|plural'));
 $class = ( '' === $comment_status ) ? ' class=&quot;current&quot;' : '';
 $status_links[] = &quot;&lt;li&gt;&lt;a href=\&quot;edit-comments.php\&quot;$class&gt;&quot;.__('Show All Comments').&quot;&lt;/a&gt;&quot;;
 foreach ( $stati as $status =&gt; $label ) {
@@ -117,6 +118,7 @@ unset($status_links);
 &lt;/ul&gt;
 
 &lt;p id=&quot;post-search&quot;&gt;
+	&lt;label class=&quot;hidden&quot; for=&quot;post-search-input&quot;&gt;&lt;?php _e( 'Search Comments' ); ?&gt;:&lt;/label&gt;
 	&lt;input type=&quot;text&quot; id=&quot;post-search-input&quot; name=&quot;s&quot; value=&quot;&lt;?php echo $search; ?&gt;&quot; /&gt;
 	&lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e( 'Search Comments' ); ?&gt;&quot; class=&quot;button&quot; /&gt;
 &lt;/p&gt;
@@ -132,22 +134,24 @@ unset($status_links);
 
 &lt;?php
 
+$comments_per_page = apply_filters('comments_per_page', 20, $comment_status);
+
 if ( isset( $_GET['apage'] ) )
 	$page = abs( (int) $_GET['apage'] );
 else
 	$page = 1;
 
-$start = $offset = ( $page - 1 ) * 20;
+$start = $offset = ( $page - 1 ) * $comments_per_page;
 
-list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, 25 ); // Grab a few extra
+list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5 ); // Grab a few extra
 
-$comments = array_slice($_comments, 0, 20);
-$extra_comments = array_slice($_comments, 20);
+$comments = array_slice($_comments, 0, $comments_per_page);
+$extra_comments = array_slice($_comments, $comments_per_page);
 
 $page_links = paginate_links( array(
 	'base' =&gt; add_query_arg( 'apage', '%#%' ),
 	'format' =&gt; '',
-	'total' =&gt; ceil($total / 20),
+	'total' =&gt; ceil($total / $comments_per_page),
 	'current' =&gt; $page
 ));
 
@@ -173,6 +177,9 @@ if ( $page_links )
 &lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e('Delete'); ?&gt;&quot; name=&quot;deleteit&quot; class=&quot;button-secondary delete&quot; /&gt;
 &lt;?php do_action('manage_comments_nav', $comment_status); ?&gt;
 &lt;?php wp_nonce_field('bulk-comments'); ?&gt;
+&lt;?php if ( isset($_GET['apage']) ) { ?&gt;
+	&lt;input type=&quot;hidden&quot; name=&quot;apage&quot; value=&quot;&lt;?php echo absint( $_GET['apage'] ); ?&gt;&quot; /&gt;
+&lt;?php } ?&gt;
 &lt;/div&gt;
 
 &lt;br class=&quot;clear&quot; /&gt;
@@ -186,7 +193,7 @@ if ($comments) {
 &lt;table class=&quot;widefat&quot;&gt;
 &lt;thead&gt;
   &lt;tr&gt;
-    &lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; onclick=&quot;checkAll(document.getElementById('comments-form'));&quot; /&gt;&lt;/th&gt;
+    &lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/th&gt;
     &lt;th scope=&quot;col&quot;&gt;&lt;?php _e('Comment') ?&gt;&lt;/th&gt;
     &lt;th scope=&quot;col&quot;&gt;&lt;?php _e('Date') ?&gt;&lt;/th&gt;
     &lt;th scope=&quot;col&quot; class=&quot;action-links&quot;&gt;&lt;?php _e('Actions') ?&gt;&lt;/th&gt;</diff>
      <filename>wp-admin/edit-comments.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,46 @@
 &lt;?php
-$action = isset($action)? $action : '';
+
+$action = isset($action) ? $action : '';
 if ( isset($_GET['message']) )
 	$_GET['message'] = absint( $_GET['message'] );
 $messages[1] = sprintf( __( 'Post updated. Continue editing below or &lt;a href=&quot;%s&quot;&gt;go back&lt;/a&gt;.' ), attribute_escape( stripslashes( $_GET['_wp_original_http_referer'] ) ) );
 $messages[2] = __('Custom field updated.');
 $messages[3] = __('Custom field deleted.');
 $messages[4] = __('Post updated.');
+
+if ( isset($_GET['revision']) )
+	$messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
+
+$notice = false;
+$notices[1] = __( 'There is an autosave of this post that is more recent than the version below.  &lt;a href=&quot;%s&quot;&gt;View the autosave&lt;/a&gt;.' );
+
+if ( !isset($post_ID) || 0 == $post_ID ) {
+	$form_action = 'post';
+	$temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
+	$form_extra = &quot;&lt;input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' /&gt;&quot;;
+	$autosave = false;
+} else {
+	$post_ID = (int) $post_ID;
+	$form_action = 'editpost';
+	$form_extra = &quot;&lt;input type='hidden' id='post_ID' name='post_ID' value='$post_ID' /&gt;&quot;;
+	$autosave = wp_get_post_autosave( $post_id );
+
+	// Detect if there exists an autosave newer than the post and if that autosave is different than the post
+	if ( $autosave &amp;&amp; mysql2date( 'U', $autosave-&gt;post_modified_gmt ) &gt; mysql2date( 'U', $post-&gt;post_modified_gmt ) ) {
+		foreach ( _wp_post_revision_fields() as $autosave_field =&gt; $_autosave_field ) {
+			if ( wp_text_diff( $autosave-&gt;$autosave_field, $post-&gt;$autosave_field ) ) {
+				$notice = sprintf( $notices[1], get_edit_post_link( $autosave-&gt;ID ) );
+				break;
+			}
+		}
+		unset($autosave_field, $_autosave_field);
+	}
+}
+
 ?&gt;
+&lt;?php if ( $notice ) : ?&gt;
+&lt;div id=&quot;notice&quot; class=&quot;error&quot;&gt;&lt;p&gt;&lt;?php echo $notice ?&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;?php endif; ?&gt;
 &lt;?php if (isset($_GET['message'])) : ?&gt;
 &lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php echo $messages[$_GET['message']]; ?&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;?php endif; ?&gt;
@@ -20,33 +54,15 @@ $messages[4] = __('Post updated.');
 &lt;h2&gt;&lt;?php _e('Write Post') ?&gt;&lt;/h2&gt;
 &lt;?php
 
-if (!isset($post_ID) || 0 == $post_ID) {
-	$form_action = 'post';
-	$temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
-	$form_extra = &quot;&lt;input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' /&gt;&quot;;
+if ( !isset($post_ID) || 0 == $post_ID)
 	wp_nonce_field('add-post');
-} else {
-	$post_ID = (int) $post_ID;
-	$form_action = 'editpost';
-	$form_extra = &quot;&lt;input type='hidden' id='post_ID' name='post_ID' value='$post_ID' /&gt;&quot;;
+else
 	wp_nonce_field('update-post_' .  $post_ID);
-}
 
 $form_pingback = '&lt;input type=&quot;hidden&quot; name=&quot;post_pingback&quot; value=&quot;' . (int) get_option('default_pingback_flag') . '&quot; id=&quot;post_pingback&quot; /&gt;';
 
 $form_prevstatus = '&lt;input type=&quot;hidden&quot; name=&quot;prev_status&quot; value=&quot;' . attribute_escape( $post-&gt;post_status ) . '&quot; /&gt;';
 
-$form_trackback = '&lt;input type=&quot;text&quot; name=&quot;trackback_url&quot; style=&quot;width: 415px&quot; id=&quot;trackback&quot; tabindex=&quot;7&quot; value=&quot;'. attribute_escape( str_replace(&quot;\n&quot;, ' ', $post-&gt;to_ping) ) .'&quot; /&gt;';
-
-if ('' != $post-&gt;pinged) {
-	$pings = '&lt;p&gt;'. __('Already pinged:') . '&lt;/p&gt;&lt;ul&gt;';
-	$already_pinged = explode(&quot;\n&quot;, trim($post-&gt;pinged));
-	foreach ($already_pinged as $pinged_url) {
-		$pings .= &quot;\n\t&lt;li&gt;&quot; . wp_specialchars($pinged_url) . &quot;&lt;/li&gt;&quot;;
-	}
-	$pings .= '&lt;/ul&gt;';
-}
-
 $saveasdraft = '&lt;input name=&quot;save&quot; type=&quot;submit&quot; id=&quot;save&quot; class=&quot;button&quot; tabindex=&quot;3&quot; value=&quot;' . attribute_escape( __('Save and Continue Editing') ) . '&quot; /&gt;';
 
 ?&gt;
@@ -54,17 +70,10 @@ $saveasdraft = '&lt;input name=&quot;save&quot; type=&quot;submit&quot; id=&quot;save&quot; class=&quot;button&quot; tabind
 &lt;input type=&quot;hidden&quot; id=&quot;user-id&quot; name=&quot;user_ID&quot; value=&quot;&lt;?php echo (int) $user_ID ?&gt;&quot; /&gt;
 &lt;input type=&quot;hidden&quot; id=&quot;hiddenaction&quot; name=&quot;action&quot; value=&quot;&lt;?php echo $form_action ?&gt;&quot; /&gt;
 &lt;input type=&quot;hidden&quot; id=&quot;originalaction&quot; name=&quot;originalaction&quot; value=&quot;&lt;?php echo $form_action ?&gt;&quot; /&gt;
-&lt;input type=&quot;hidden&quot; name=&quot;post_author&quot; value=&quot;&lt;?php echo attribute_escape( $post-&gt;post_author ); ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; id=&quot;post_author&quot; name=&quot;post_author&quot; value=&quot;&lt;?php echo attribute_escape( $post-&gt;post_author ); ?&gt;&quot; /&gt;
 &lt;input type=&quot;hidden&quot; id=&quot;post_type&quot; name=&quot;post_type&quot; value=&quot;&lt;?php echo $post-&gt;post_type ?&gt;&quot; /&gt;
 &lt;input type=&quot;hidden&quot; id=&quot;original_post_status&quot; name=&quot;original_post_status&quot; value=&quot;&lt;?php echo $post-&gt;post_status ?&gt;&quot; /&gt;
-&lt;input name=&quot;referredby&quot; type=&quot;hidden&quot; id=&quot;referredby&quot; value=&quot;&lt;?php
-if ( !empty($_REQUEST['popupurl']) )
-	echo clean_url(stripslashes($_REQUEST['popupurl']));
-else if ( url_to_postid(wp_get_referer()) == $post_ID &amp;&amp; strpos( wp_get_referer(), '/wp-admin/' ) === false )
-	echo 'redo';
-else
-	echo clean_url(stripslashes(wp_get_referer()));
-?&gt;&quot; /&gt;
+&lt;input name=&quot;referredby&quot; type=&quot;hidden&quot; id=&quot;referredby&quot; value=&quot;&lt;?php echo clean_url(stripslashes(wp_get_referer())); ?&gt;&quot; /&gt;
 &lt;?php if ( 'draft' != $post-&gt;post_status ) wp_original_referer_field(true, 'previous'); ?&gt;
 
 &lt;?php echo $form_extra ?&gt;
@@ -83,10 +92,13 @@ else
 
 &lt;div class=&quot;inside&quot;&gt;
 
-&lt;p&gt;&lt;strong&gt;&lt;?php _e('Publish Status') ?&gt;&lt;/strong&gt;&lt;/p&gt;
+&lt;p&gt;&lt;strong&gt;&lt;label for='post_status'&gt;&lt;?php _e('Publish Status') ?&gt;&lt;/label&gt;&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;
-&lt;select name='post_status' tabindex='4'&gt;
-&lt;?php if ( current_user_can('publish_posts') ) : // Contributors only get &quot;Unpublished&quot; and &quot;Pending Review&quot; ?&gt;
+&lt;select name='post_status' id='post_status' tabindex='4'&gt;
+&lt;?php 
+// only show the publish menu item if they are allowed to publish posts or they are allowed to edit this post (accounts for 'edit_published_posts' capability) 
+if ( current_user_can('publish_posts') OR ( $post-&gt;post_status == 'publish' AND current_user_can('edit_post', $post-&gt;ID) ) ) :
+?&gt;
 &lt;option&lt;?php selected( $post-&gt;post_status, 'publish' ); selected( $post-&gt;post_status, 'private' );?&gt; value='publish'&gt;&lt;?php _e('Published') ?&gt;&lt;/option&gt;
 &lt;?php if ( 'future' == $post-&gt;post_status ) : ?&gt;
 &lt;option&lt;?php selected( $post-&gt;post_status, 'future' ); ?&gt; value='future'&gt;&lt;?php _e('Scheduled') ?&gt;&lt;/option&gt;
@@ -98,7 +110,7 @@ else
 &lt;/p&gt;
 
 &lt;?php if ( current_user_can( 'publish_posts' ) ) : ?&gt;
-&lt;p&gt;&lt;label for=&quot;post_status_private&quot; class=&quot;selectit&quot;&gt;&lt;input id=&quot;post_status_private&quot; name=&quot;post_status&quot; type=&quot;checkbox&quot; value=&quot;private&quot; &lt;?php checked($post-&gt;post_status, 'private'); ?&gt; tabindex=&quot;4&quot; /&gt; &lt;?php _e('Keep this post private') ?&gt;&lt;/label&gt;&lt;/p&gt;
+&lt;p id=&quot;private-checkbox&quot;&gt;&lt;label for=&quot;post_status_private&quot; class=&quot;selectit&quot;&gt;&lt;input id=&quot;post_status_private&quot; name=&quot;post_status&quot; type=&quot;checkbox&quot; value=&quot;private&quot; &lt;?php checked($post-&gt;post_status, 'private'); ?&gt; tabindex=&quot;4&quot; /&gt; &lt;?php _e('Keep this post private') ?&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;?php endif; ?&gt;
 &lt;?php
 if ($post_ID) {
@@ -156,6 +168,7 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('delete_post', $post_ID) )
 &lt;br class=&quot;clear&quot; /&gt;
 &lt;?php endif; ?&gt;
 &lt;span id=&quot;autosave&quot;&gt;&lt;/span&gt;
+&lt;span id=&quot;wp-word-count&quot;&gt;&lt;/span&gt;
 &lt;/p&gt;
 
 &lt;div class=&quot;side-info&quot;&gt;
@@ -172,6 +185,9 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('delete_post', $post_ID) )
 &lt;li&gt;&lt;a href=&quot;edit.php?post_status=draft&quot;&gt;&lt;?php _e('View Drafts'); ?&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;?php do_action('post_relatedlinks_list'); ?&gt;
 &lt;/ul&gt;
+
+&lt;h5&gt;&lt;?php _e('Shortcuts') ?&gt;&lt;/h5&gt;
+&lt;p&gt;&lt;?php _e('Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut.') ?&gt;  &lt;a href=&quot;&lt;?php echo get_shortcut_link(); ?&gt;&quot; title=&quot;&lt;?php echo attribute_escape(__('Press This')) ?&gt;&quot;&gt;&lt;?php _e('Press This') ?&gt;&lt;/a&gt;&lt;/p&gt;
 &lt;/div&gt;
 
 &lt;?php do_action('submitpost_box'); ?&gt;
@@ -179,7 +195,7 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('delete_post', $post_ID) )
 
 &lt;div id=&quot;post-body&quot;&gt;
 &lt;div id=&quot;titlediv&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Title') ?&gt;&lt;/h3&gt;
+&lt;h3&gt;&lt;label for=&quot;title&quot;&gt;&lt;?php _e('Title') ?&gt;&lt;/label&gt;&lt;/h3&gt;
 &lt;div id=&quot;titlewrap&quot;&gt;
 	&lt;input type=&quot;text&quot; name=&quot;post_title&quot; size=&quot;30&quot; tabindex=&quot;1&quot; value=&quot;&lt;?php echo attribute_escape($post-&gt;post_title); ?&gt;&quot; id=&quot;title&quot; autocomplete=&quot;off&quot; /&gt;
 &lt;/div&gt;
@@ -194,7 +210,7 @@ endif; ?&gt;
 &lt;/div&gt;
 
 &lt;div id=&quot;&lt;?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?&gt;&quot; class=&quot;postarea&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Post') ?&gt;&lt;/h3&gt;
+&lt;h3&gt;&lt;label for=&quot;content&quot;&gt;&lt;?php _e('Post') ?&gt;&lt;/label&gt;&lt;/h3&gt;
 &lt;?php the_editor($post-&gt;post_content); ?&gt;
 &lt;?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?&gt;
 &lt;?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?&gt;
@@ -205,24 +221,23 @@ endif; ?&gt;
 &lt;?php echo $form_pingback ?&gt;
 &lt;?php echo $form_prevstatus ?&gt;
 
-&lt;div id=&quot;tagsdiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('tagsdiv', 'post'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Tags'); ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
-&lt;p id=&quot;jaxtag&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;tags_input&quot; class=&quot;tags-input&quot; id=&quot;tags-input&quot; size=&quot;40&quot; tabindex=&quot;3&quot; value=&quot;&lt;?php echo get_tags_to_edit( $post_ID ); ?&gt;&quot; /&gt;&lt;/p&gt;
+&lt;?php
+function post_tags_meta_box($post) {
+?&gt;
+&lt;p id=&quot;jaxtag&quot;&gt;&lt;label class=&quot;hidden&quot; for=&quot;newtag&quot;&gt;&lt;?php _e('Tags'); ?&gt;&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;tags_input&quot; class=&quot;tags-input&quot; id=&quot;tags-input&quot; size=&quot;40&quot; tabindex=&quot;3&quot; value=&quot;&lt;?php echo get_tags_to_edit( $post-&gt;ID ); ?&gt;&quot; /&gt;&lt;/p&gt;
 &lt;div id=&quot;tagchecklist&quot;&gt;&lt;/div&gt;
-&lt;/div&gt;
-&lt;/div&gt;
-
-&lt;div id=&quot;categorydiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('categorydiv', 'post'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Categories') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
+&lt;?php
+}
+add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'normal', 'core');
 
+function post_categories_meta_box($post) {
+?&gt;
 &lt;div id=&quot;category-adder&quot; class=&quot;wp-hidden-children&quot;&gt;
 	&lt;h4&gt;&lt;a id=&quot;category-add-toggle&quot; href=&quot;#category-add&quot; class=&quot;hide-if-no-js&quot; tabindex=&quot;3&quot;&gt;&lt;?php _e( '+ Add New Category' ); ?&gt;&lt;/a&gt;&lt;/h4&gt;
 	&lt;p id=&quot;category-add&quot; class=&quot;wp-hidden-child&quot;&gt;
-		&lt;input type=&quot;text&quot; name=&quot;newcat&quot; id=&quot;newcat&quot; class=&quot;form-required form-input-tip&quot; value=&quot;&lt;?php _e( 'New category name' ); ?&gt;&quot; tabindex=&quot;3&quot; /&gt;
-		&lt;?php wp_dropdown_categories( array( 'hide_empty' =&gt; 0, 'name' =&gt; 'newcat_parent', 'orderby' =&gt; 'name', 'hierarchical' =&gt; 1, 'show_option_none' =&gt; __('Parent category'), 'tab_index' =&gt; 3 ) ); ?&gt;
-		&lt;input type=&quot;button&quot; id=&quot;category-add-sumbit&quot; class=&quot;add:categorychecklist:categorydiv button&quot; value=&quot;&lt;?php _e( 'Add' ); ?&gt;&quot; tabindex=&quot;3&quot; /&gt;
+		&lt;label class=&quot;hidden&quot; for=&quot;newcat&quot;&gt;&lt;?php _e( 'Add New Category' ); ?&gt;&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;newcat&quot; id=&quot;newcat&quot; class=&quot;form-required form-input-tip&quot; value=&quot;&lt;?php _e( 'New category name' ); ?&gt;&quot; tabindex=&quot;3&quot; aria-required=&quot;true&quot;/&gt;
+		&lt;label class=&quot;hidden&quot; for=&quot;newcat_parent&quot;&gt;&lt;?php _e('Parent category'); ?&gt;:&lt;/label&gt;&lt;?php wp_dropdown_categories( array( 'hide_empty' =&gt; 0, 'name' =&gt; 'newcat_parent', 'orderby' =&gt; 'name', 'hierarchical' =&gt; 1, 'show_option_none' =&gt; __('Parent category'), 'tab_index' =&gt; 3 ) ); ?&gt;
+		&lt;input type=&quot;button&quot; id=&quot;category-add-sumbit&quot; class=&quot;add:categorychecklist:category-add button&quot; value=&quot;&lt;?php _e( 'Add' ); ?&gt;&quot; tabindex=&quot;3&quot; /&gt;
 		&lt;?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?&gt;
 		&lt;span id=&quot;category-ajax-response&quot;&gt;&lt;/span&gt;
 	&lt;/p&gt;
@@ -233,20 +248,21 @@ endif; ?&gt;
 	&lt;li class=&quot;wp-no-js-hidden&quot;&gt;&lt;a href=&quot;#categories-pop&quot; tabindex=&quot;3&quot;&gt;&lt;?php _e( 'Most Used' ); ?&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;/ul&gt;
 
-&lt;div id=&quot;categories-all&quot; class=&quot;ui-tabs-panel&quot;&gt;
-	&lt;ul id=&quot;categorychecklist&quot; class=&quot;list:category categorychecklist form-no-clear&quot;&gt;
-		&lt;?php dropdown_categories(); ?&gt;
-	&lt;/ul&gt;
-&lt;/div&gt;
-
 &lt;div id=&quot;categories-pop&quot; class=&quot;ui-tabs-panel&quot; style=&quot;display: none;&quot;&gt;
 	&lt;ul id=&quot;categorychecklist-pop&quot; class=&quot;categorychecklist form-no-clear&quot; &gt;
-		&lt;?php wp_popular_terms_checklist('category'); ?&gt;
+		&lt;?php $popular_ids = wp_popular_terms_checklist('category'); ?&gt;
 	&lt;/ul&gt;
 &lt;/div&gt;
 
+&lt;div id=&quot;categories-all&quot; class=&quot;ui-tabs-panel&quot;&gt;
+	&lt;ul id=&quot;categorychecklist&quot; class=&quot;list:category categorychecklist form-no-clear&quot;&gt;
+		&lt;?php wp_category_checklist($post-&gt;ID, false, false, $popular_ids) ?&gt;
+	&lt;/ul&gt;
 &lt;/div&gt;
-&lt;/div&gt;
+&lt;?php
+}
+add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'normal', 'core');
+?&gt;
 
 &lt;?php do_meta_boxes('post', 'normal', $post); ?&gt;
 
@@ -254,32 +270,41 @@ endif; ?&gt;
 
 &lt;h2&gt;&lt;?php _e('Advanced Options'); ?&gt;&lt;/h2&gt;
 
-&lt;div id=&quot;postexcerpt&quot; class=&quot;postbox &lt;?php echo postbox_classes('postexcerpt', 'post'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Excerpt') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;&lt;textarea rows=&quot;1&quot; cols=&quot;40&quot; name=&quot;excerpt&quot; tabindex=&quot;6&quot; id=&quot;excerpt&quot;&gt;&lt;?php echo $post-&gt;post_excerpt ?&gt;&lt;/textarea&gt;
+&lt;?php
+function post_excerpt_meta_box($post) {
+?&gt;
+&lt;label class=&quot;hidden&quot; for=&quot;excerpt&quot;&gt;&lt;?php _e('Excerpt') ?&gt;&lt;/label&gt;&lt;textarea rows=&quot;1&quot; cols=&quot;40&quot; name=&quot;excerpt&quot; tabindex=&quot;6&quot; id=&quot;excerpt&quot;&gt;&lt;?php echo $post-&gt;post_excerpt ?&gt;&lt;/textarea&gt;
 &lt;p&gt;&lt;?php _e('Excerpts are optional hand-crafted summaries of your content. You can &lt;a href=&quot;http://codex.wordpress.org/Template_Tags/the_excerpt&quot; target=&quot;_blank&quot;&gt;use them in your template&lt;/a&gt;'); ?&gt;&lt;/p&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+&lt;?php
+}
+add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'advanced', 'core');
+
+function post_trackback_meta_box($post) {
+	$form_trackback = '&lt;input type=&quot;text&quot; name=&quot;trackback_url&quot; style=&quot;width: 415px&quot; id=&quot;trackback&quot; tabindex=&quot;7&quot; value=&quot;'. attribute_escape( str_replace(&quot;\n&quot;, ' ', $post-&gt;to_ping) ) .'&quot; /&gt;';
+	if ('' != $post-&gt;pinged) {
+		$pings = '&lt;p&gt;'. __('Already pinged:') . '&lt;/p&gt;&lt;ul&gt;';
+		$already_pinged = explode(&quot;\n&quot;, trim($post-&gt;pinged));
+		foreach ($already_pinged as $pinged_url) {
+			$pings .= &quot;\n\t&lt;li&gt;&quot; . wp_specialchars($pinged_url) . &quot;&lt;/li&gt;&quot;;
+		}
+		$pings .= '&lt;/ul&gt;';
+	}
 
-&lt;div id=&quot;trackbacksdiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('trackbacksdiv', 'post'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Trackbacks') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
-&lt;p&gt;&lt;?php _e('Send trackbacks to:'); ?&gt; &lt;?php echo $form_trackback; ?&gt;&lt;br /&gt; (&lt;?php _e('Separate multiple URLs with spaces'); ?&gt;)&lt;/p&gt;
+?&gt;
+&lt;p&gt;&lt;label for=&quot;trackback&quot;&gt;&lt;?php _e('Send trackbacks to:'); ?&gt;&lt;/label&gt; &lt;?php echo $form_trackback; ?&gt;&lt;br /&gt; (&lt;?php _e('Separate multiple URLs with spaces'); ?&gt;)&lt;/p&gt;
 &lt;p&gt;&lt;?php _e('Trackbacks are a way to notify legacy blog systems that you&amp;#8217;ve linked to them. If you link other WordPress blogs they&amp;#8217;ll be notified automatically using &lt;a href=&quot;http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments&quot; target=&quot;_blank&quot;&gt;pingbacks&lt;/a&gt;, no other action necessary.'); ?&gt;&lt;/p&gt;
 &lt;?php
 if ( ! empty($pings) )
 	echo $pings;
-?&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+}
+add_meta_box('trackbacksdiv', __('Trackbacks'), 'post_trackback_meta_box', 'post', 'advanced', 'core');
 
-&lt;div id=&quot;postcustom&quot; class=&quot;postbox &lt;?php echo postbox_classes('postcustom', 'post'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Custom Fields') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
+function post_custom_meta_box($post) {
+?&gt;
 &lt;div id=&quot;postcustomstuff&quot;&gt;
 &lt;table cellpadding=&quot;3&quot;&gt;
 &lt;?php
-$metadata = has_meta($post_ID);
+$metadata = has_meta($post-&gt;ID);
 list_meta($metadata);
 ?&gt;
 
@@ -290,55 +315,66 @@ list_meta($metadata);
 &lt;div id=&quot;ajax-response&quot;&gt;&lt;/div&gt;
 &lt;/div&gt;
 &lt;p&gt;&lt;?php _e('Custom fields can be used to add extra metadata to a post that you can &lt;a href=&quot;http://codex.wordpress.org/Using_Custom_Fields&quot; target=&quot;_blank&quot;&gt;use in your theme&lt;/a&gt;.'); ?&gt;&lt;/p&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+&lt;?php
+}
+add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'advanced', 'core');
 
-&lt;?php do_action('dbx_post_advanced'); ?&gt;
+do_action('dbx_post_advanced');
 
-&lt;div id=&quot;commentstatusdiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('commentstatusdiv', 'post'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Comments &amp;amp; Pings') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
+function post_comment_status_meta_box($post) {
+?&gt;
 &lt;input name=&quot;advanced_view&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;
 &lt;p&gt;&lt;label for=&quot;comment_status&quot; class=&quot;selectit&quot;&gt;
 &lt;input name=&quot;comment_status&quot; type=&quot;checkbox&quot; id=&quot;comment_status&quot; value=&quot;open&quot; &lt;?php checked($post-&gt;comment_status, 'open'); ?&gt; /&gt;
 &lt;?php _e('Allow Comments') ?&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label for=&quot;ping_status&quot; class=&quot;selectit&quot;&gt;&lt;input name=&quot;ping_status&quot; type=&quot;checkbox&quot; id=&quot;ping_status&quot; value=&quot;open&quot; &lt;?php checked($post-&gt;ping_status, 'open'); ?&gt; /&gt; &lt;?php _e('Allow Pings') ?&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;?php _e('These settings apply to this post only. &amp;#8220;Pings&amp;#8221; are &lt;a href=&quot;http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments&quot; target=&quot;_blank&quot;&gt;trackbacks and pingbacks&lt;/a&gt;.'); ?&gt;&lt;/p&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+&lt;?php
+}
+add_meta_box('commentstatusdiv', __('Comments &amp;amp; Pings'), 'post_comment_status_meta_box', 'post', 'advanced', 'core');
 
-&lt;div id=&quot;passworddiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('passworddiv', 'post'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Password Protect This Post') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
-&lt;p&gt;&lt;input name=&quot;post_password&quot; type=&quot;text&quot; size=&quot;25&quot; id=&quot;post_password&quot; value=&quot;&lt;?php echo attribute_escape( $post-&gt;post_password ); ?&gt;&quot; /&gt;&lt;/p&gt;
+function post_password_meta_box($post) {
+?&gt;
+&lt;p&gt;&lt;label class=&quot;hidden&quot; for=&quot;post_password&quot;&gt;&lt;?php _e('Password Protect This Post') ?&gt;&lt;/label&gt;&lt;input name=&quot;post_password&quot; type=&quot;text&quot; size=&quot;25&quot; id=&quot;post_password&quot; value=&quot;&lt;?php echo attribute_escape( $post-&gt;post_password ); ?&gt;&quot; /&gt;&lt;/p&gt;
 &lt;p&gt;&lt;?php _e('Setting a password will require people who visit your blog to enter the above password to view this post and its comments.'); ?&gt;&lt;/p&gt;
-&lt;/div&gt;
-&lt;/div&gt;
-
-&lt;div id=&quot;slugdiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('slugdiv', 'post'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Post Slug') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
-&lt;input name=&quot;post_name&quot; type=&quot;text&quot; size=&quot;13&quot; id=&quot;post_name&quot; value=&quot;&lt;?php echo attribute_escape( $post-&gt;post_name ); ?&gt;&quot; /&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+&lt;?php
+}
+add_meta_box('passworddiv', __('Password Protect This Post'), 'post_password_meta_box', 'post', 'advanced', 'core');
 
+function post_slug_meta_box($post) {
+?&gt;
+&lt;label class=&quot;hidden&quot; for=&quot;post_name&quot;&gt;&lt;?php _e('Post Slug') ?&gt;&lt;/label&gt;&lt;input name=&quot;post_name&quot; type=&quot;text&quot; size=&quot;13&quot; id=&quot;post_name&quot; value=&quot;&lt;?php echo attribute_escape( $post-&gt;post_name ); ?&gt;&quot; /&gt;
 &lt;?php
+}
+add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'advanced', 'core');
+
 $authors = get_editable_user_ids( $current_user-&gt;id ); // TODO: ROLE SYSTEM
 if ( $post-&gt;post_author &amp;&amp; !in_array($post-&gt;post_author, $authors) )
 	$authors[] = $post-&gt;post_author;
 if ( $authors &amp;&amp; count( $authors ) &gt; 1 ) :
+function post_author_meta_box($post) {
+	global $current_user, $user_ID;
+	$authors = get_editable_user_ids( $current_user-&gt;id ); // TODO: ROLE SYSTEM
+	if ( $post-&gt;post_author &amp;&amp; !in_array($post-&gt;post_author, $authors) )
+		$authors[] = $post-&gt;post_author;
 ?&gt;
-&lt;div id=&quot;authordiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('authordiv', 'post'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Post Author'); ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
-&lt;?php wp_dropdown_users( array('include' =&gt; $authors, 'name' =&gt; 'post_author_override', 'selected' =&gt; empty($post_ID) ? $user_ID : $post-&gt;post_author) ); ?&gt;
-&lt;/div&gt;
-&lt;/div&gt;
-&lt;?php endif; ?&gt;
+&lt;label class=&quot;hidden&quot; for=&quot;post_author_override&quot;&gt;&lt;?php _e('Post Author'); ?&gt;&lt;/label&gt;&lt;?php wp_dropdown_users( array('include' =&gt; $authors, 'name' =&gt; 'post_author_override', 'selected' =&gt; empty($post-&gt;ID) ? $user_ID : $post-&gt;post_author) ); ?&gt;
+&lt;?php
+}
+add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'advanced', 'core');
+endif;
 
-&lt;?php do_meta_boxes('post', 'advanced', $post); ?&gt;
+if ( isset($post_ID) &amp;&amp; 0 &lt; $post_ID &amp;&amp; wp_get_post_revisions( $post_ID ) ) :
+function post_revisions_meta_box($post) {
+	wp_list_post_revisions();
+}
+add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'advanced', 'core');
+endif;
+
+do_meta_boxes('post', 'advanced', $post);
 
-&lt;?php do_action('dbx_post_sidebar'); ?&gt;
+do_action('dbx_post_sidebar');
+?&gt;
 &lt;/div&gt;
 &lt;/div&gt;
 </diff>
      <filename>wp-admin/edit-form-advanced.php</filename>
    </modified>
    <modified>
      <diff>@@ -22,9 +22,9 @@ $form_extra = &quot;' /&gt;\n&lt;input type='hidden' name='comment_ID' value='&quot; . $comment-
 
 &lt;div class=&quot;inside&quot;&gt;
 
-&lt;p&gt;&lt;strong&gt;&lt;?php _e('Approval Status') ?&gt;&lt;/strong&gt;&lt;/p&gt;
+&lt;p&gt;&lt;strong&gt;&lt;label for='comment_status'&gt;&lt;?php _e('Approval Status') ?&gt;&lt;/label&gt;&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;
-&lt;select name='comment_status'&gt;
+&lt;select name='comment_status' id='comment_status'&gt;
 &lt;option&lt;?php selected( $comment-&gt;comment_approved, '1' ); ?&gt; value='1'&gt;&lt;?php _e('Approved') ?&gt;&lt;/option&gt;
 &lt;option&lt;?php selected( $comment-&gt;comment_approved, '0' ); ?&gt; value='0'&gt;&lt;?php _e('Moderated') ?&gt;&lt;/option&gt;
 &lt;option&lt;?php selected( $comment-&gt;comment_approved, 'spam' ); ?&gt; value='spam'&gt;&lt;?php _e('Spam') ?&gt;&lt;/option&gt;
@@ -46,7 +46,7 @@ $time = mysql2date(get_option('time_format'), $comment-&gt;comment_date);
 &lt;p class=&quot;submit&quot;&gt;
 &lt;input type=&quot;submit&quot; name=&quot;save&quot; value=&quot;&lt;?php _e('Save'); ?&gt;&quot; tabindex=&quot;4&quot; class=&quot;button button-highlighted&quot; /&gt;
 &lt;?php
-echo &quot;&lt;a class='submitdelete' href='&quot; . wp_nonce_url(&quot;comment.php?action=deletecomment&amp;amp;c=$comment-&gt;comment_ID&quot;, 'delete-comment_' . $comment-&gt;comment_ID) . &quot;' onclick=\&quot;if ( confirm('&quot; . js_escape(__(&quot;You are about to delete this comment. \n  'Cancel' to stop, 'OK' to delete.&quot;)) . &quot;') ) { return true;}return false;\&quot;&gt;&quot; . __('Delete comment') . &quot;&lt;/a&gt;&quot;;
+echo &quot;&lt;a class='submitdelete' href='&quot; . wp_nonce_url(&quot;comment.php?action=deletecomment&amp;amp;c=$comment-&gt;comment_ID&amp;amp;_wp_original_http_referer=&quot; . wp_get_referer(), 'delete-comment_' . $comment-&gt;comment_ID) . &quot;' onclick=\&quot;if ( confirm('&quot; . js_escape(__(&quot;You are about to delete this comment. \n  'Cancel' to stop, 'OK' to delete.&quot;)) . &quot;') ) { return true;}return false;\&quot;&gt;&quot; . __('Delete comment') . &quot;&lt;/a&gt;&quot;;
 ?&gt;
 &lt;/p&gt;
 
@@ -64,28 +64,28 @@ echo &quot;&lt;a class='submitdelete' href='&quot; . wp_nonce_url(&quot;comment.php?action=deletec
 
 &lt;div id=&quot;post-body&quot;&gt;
 &lt;div id=&quot;namediv&quot; class=&quot;stuffbox&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Name') ?&gt;&lt;/h3&gt;
+&lt;h3&gt;&lt;label for=&quot;name&quot;&gt;&lt;?php _e('Name') ?&gt;&lt;/label&gt;&lt;/h3&gt;
 &lt;div class=&quot;inside&quot;&gt;
 &lt;input type=&quot;text&quot; name=&quot;newcomment_author&quot; size=&quot;30&quot; value=&quot;&lt;?php echo attribute_escape( $comment-&gt;comment_author ); ?&gt;&quot; tabindex=&quot;1&quot; id=&quot;name&quot; /&gt;
 &lt;/div&gt;
 &lt;/div&gt;
 
 &lt;div id=&quot;emaildiv&quot; class=&quot;stuffbox&quot;&gt;
-&lt;h3&gt;&lt;?php _e('E-mail') ?&gt;&lt;/h3&gt;
+&lt;h3&gt;&lt;label for=&quot;email&quot;&gt;&lt;?php _e('E-mail') ?&gt;&lt;/label&gt;&lt;/h3&gt;
 &lt;div class=&quot;inside&quot;&gt;
 &lt;input type=&quot;text&quot; name=&quot;newcomment_author_email&quot; size=&quot;30&quot; value=&quot;&lt;?php echo attribute_escape( $comment-&gt;comment_author_email ); ?&gt;&quot; tabindex=&quot;2&quot; id=&quot;email&quot; /&gt;
 &lt;/div&gt;
 &lt;/div&gt;
 
 &lt;div id=&quot;uridiv&quot; class=&quot;stuffbox&quot;&gt;
-&lt;h3&gt;&lt;?php _e('URL') ?&gt;&lt;/h3&gt;
+&lt;h3&gt;&lt;label for=&quot;newcomment_author_url&quot;&gt;&lt;?php _e('URL') ?&gt;&lt;/label&gt;&lt;/h3&gt;
 &lt;div class=&quot;inside&quot;&gt;
 &lt;input type=&quot;text&quot; id=&quot;newcomment_author_url&quot; name=&quot;newcomment_author_url&quot; size=&quot;30&quot; value=&quot;&lt;?php echo attribute_escape( $comment-&gt;comment_author_url ); ?&gt;&quot; tabindex=&quot;3&quot; /&gt;
 &lt;/div&gt;
 &lt;/div&gt;
 
 &lt;div id=&quot;postdiv&quot; class=&quot;postarea&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Comment') ?&gt;&lt;/h3&gt;
+&lt;h3&gt;&lt;label for=&quot;content&quot;&gt;&lt;?php _e('Comment') ?&gt;&lt;/label&gt;&lt;/h3&gt;
 &lt;?php the_editor($comment-&gt;comment_content, 'content', 'newcomment_author_url', false, 4); ?&gt;
 &lt;?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?&gt;
 &lt;/div&gt;
@@ -95,6 +95,7 @@ echo &quot;&lt;a class='submitdelete' href='&quot; . wp_nonce_url(&quot;comment.php?action=deletec
 &lt;input type=&quot;hidden&quot; name=&quot;c&quot; value=&quot;&lt;?php echo $comment-&gt;comment_ID ?&gt;&quot; /&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;p&quot; value=&quot;&lt;?php echo $comment-&gt;comment_post_ID ?&gt;&quot; /&gt;
 &lt;input name=&quot;referredby&quot; type=&quot;hidden&quot; id=&quot;referredby&quot; value=&quot;&lt;?php echo wp_get_referer(); ?&gt;&quot; /&gt;
+&lt;?php wp_original_referer_field(true, 'previous'); ?&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;noredir&quot; value=&quot;1&quot; /&gt;
 &lt;/div&gt;
 &lt;/div&gt;</diff>
      <filename>wp-admin/edit-form-comment.php</filename>
    </modified>
    <modified>
      <diff>@@ -10,12 +10,13 @@ if ( isset($_GET['deleteit']) &amp;&amp; isset($_GET['delete']) ) {
 
 	foreach( (array) $_GET['delete'] as $cat_ID ) {
 		$cat_name = get_term_field('name', $cat_ID, 'link_category');
-
+		$default_cat_id = get_option('default_link_category');
+		
 		// Don't delete the default cats.
-		if ( $cat_ID == get_option('default_link_category') )
+		if ( $cat_ID == $default_cat_id )
 			wp_die(sprintf(__(&quot;Can&amp;#8217;t delete the &lt;strong&gt;%s&lt;/strong&gt; category: this is the default one&quot;), $cat_name));
 
-		wp_delete_term($cat_ID, 'link_category');
+		wp_delete_term($cat_ID, 'link_category', array('default' =&gt; $default_cat_id));
 	}
 
 	$location = 'edit-link-categories.php';
@@ -62,6 +63,7 @@ endif; ?&gt;
 &lt;?php endif; ?&gt;
 
 &lt;p id=&quot;post-search&quot;&gt;
+	&lt;label class=&quot;hidden&quot; for=&quot;post-search-input&quot;&gt;&lt;?php _e( 'Search Categories' ); ?&gt;:&lt;/label&gt;
 	&lt;input type=&quot;text&quot; id=&quot;post-search-input&quot; name=&quot;s&quot; value=&quot;&lt;?php echo attribute_escape(stripslashes($_GET['s'])); ?&gt;&quot; /&gt;
 	&lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e( 'Search Categories' ); ?&gt;&quot; class=&quot;button&quot; /&gt;
 &lt;/p&gt;
@@ -101,7 +103,7 @@ if ( $page_links )
 &lt;table class=&quot;widefat&quot;&gt;
 	&lt;thead&gt;
 	&lt;tr&gt;
-        &lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; onclick=&quot;checkAll(document.getElementById('posts-filter'));&quot; /&gt;&lt;/th&gt;
+        &lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/th&gt;
         &lt;th scope=&quot;col&quot;&gt;&lt;?php _e('Name') ?&gt;&lt;/th&gt;
         &lt;th scope=&quot;col&quot;&gt;&lt;?php _e('Description') ?&gt;&lt;/th&gt;
         &lt;th scope=&quot;col&quot; class=&quot;num&quot; style=&quot;width: 90px;&quot;&gt;&lt;?php _e('Links') ?&gt;&lt;/th&gt;</diff>
      <filename>wp-admin/edit-link-categories.php</filename>
    </modified>
    <modified>
      <diff>@@ -26,11 +26,11 @@ if ( ! empty($cat_ID) ) {
 	&lt;table class=&quot;form-table&quot;&gt;
 		&lt;tr class=&quot;form-field form-required&quot;&gt;
 			&lt;th scope=&quot;row&quot; valign=&quot;top&quot;&gt;&lt;label for=&quot;name&quot;&gt;&lt;?php _e('Category name') ?&gt;&lt;/label&gt;&lt;/th&gt;
-			&lt;td&gt;&lt;input name=&quot;name&quot; id=&quot;name&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $category-&gt;name; ?&gt;&quot; size=&quot;40&quot; /&gt;&lt;/td&gt;
+			&lt;td&gt;&lt;input name=&quot;name&quot; id=&quot;name&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $category-&gt;name; ?&gt;&quot; size=&quot;40&quot; aria-required=&quot;true&quot; /&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr class=&quot;form-field&quot;&gt;
 			&lt;th scope=&quot;row&quot; valign=&quot;top&quot;&gt;&lt;label for=&quot;slug&quot;&gt;&lt;?php _e('Category slug') ?&gt;&lt;/label&gt;&lt;/th&gt;
-			&lt;td&gt;&lt;input name=&quot;slug&quot; id=&quot;slug&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $category-&gt;slug; ?&gt;&quot; size=&quot;40&quot; /&gt;
+			&lt;td&gt;&lt;input name=&quot;slug&quot; id=&quot;slug&quot; type=&quot;text&quot; value=&quot;&lt;?php echo attribute_escape(apply_filters('editable_slug', $category-&gt;slug)); ?&gt;&quot; size=&quot;40&quot; /&gt;
             &lt;?php _e('The &amp;#8220;slug&amp;#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr class=&quot;form-field&quot;&gt;</diff>
      <filename>wp-admin/edit-link-category-form.php</filename>
    </modified>
    <modified>
      <diff>@@ -74,7 +74,7 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('manage_links') )
 
 &lt;div id=&quot;post-body&quot;&gt;
 &lt;div id=&quot;namediv&quot; class=&quot;stuffbox&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Name') ?&gt;&lt;/h3&gt;
+&lt;h3&gt;&lt;label for=&quot;link_name&quot;&gt;&lt;?php _e('Name') ?&gt;&lt;/label&gt;&lt;/h3&gt;
 &lt;div class=&quot;inside&quot;&gt;
 	&lt;input type=&quot;text&quot; name=&quot;link_name&quot; size=&quot;30&quot; tabindex=&quot;1&quot; value=&quot;&lt;?php echo $link-&gt;link_name; ?&gt;&quot; id=&quot;link_name&quot; /&gt;&lt;br /&gt;
     &lt;?php _e('Example: Nifty blogging software'); ?&gt;
@@ -82,7 +82,7 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('manage_links') )
 &lt;/div&gt;
 
 &lt;div id=&quot;addressdiv&quot; class=&quot;stuffbox&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Web Address') ?&gt;&lt;/h3&gt;
+&lt;h3&gt;&lt;label for=&quot;link_url&quot;&gt;&lt;?php _e('Web Address') ?&gt;&lt;/label&gt;&lt;/h3&gt;
 &lt;div class=&quot;inside&quot;&gt;
 	&lt;input type=&quot;text&quot; name=&quot;link_url&quot; size=&quot;30&quot; tabindex=&quot;1&quot; value=&quot;&lt;?php echo $link-&gt;link_url; ?&gt;&quot; id=&quot;link_url&quot; /&gt;&lt;br /&gt;
     &lt;?php _e('Example: &lt;code&gt;http://wordpress.org/&lt;/code&gt; &amp;#8212; don&amp;#8217;t forget the &lt;code&gt;http://&lt;/code&gt;'); ?&gt;
@@ -90,21 +90,19 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('manage_links') )
 &lt;/div&gt;
 
 &lt;div id=&quot;descriptiondiv&quot; class=&quot;stuffbox&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Description') ?&gt;&lt;/h3&gt;
+&lt;h3&gt;&lt;label for=&quot;link_description&quot;&gt;&lt;?php _e('Description') ?&gt;&lt;/label&gt;&lt;/h3&gt;
 &lt;div class=&quot;inside&quot;&gt;
 	&lt;input type=&quot;text&quot; name=&quot;link_description&quot; size=&quot;30&quot; tabindex=&quot;1&quot; value=&quot;&lt;?php echo $link-&gt;link_description; ?&gt;&quot; id=&quot;link_description&quot; /&gt;&lt;br /&gt;
     &lt;?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?&gt;
 &lt;/div&gt;
 &lt;/div&gt;
 
-&lt;div id=&quot;linkcategorydiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('linkcategorydiv', 'link'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Categories') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
-
+&lt;?php function link_categories_meta_box($link) { ?&gt;
 &lt;div id=&quot;category-adder&quot; class=&quot;wp-hidden-children&quot;&gt;
 	&lt;h4&gt;&lt;a id=&quot;category-add-toggle&quot; href=&quot;#category-add&quot;&gt;&lt;?php _e( '+ Add New Category' ); ?&gt;&lt;/a&gt;&lt;/h4&gt;
 	&lt;p id=&quot;link-category-add&quot; class=&quot;wp-hidden-child&quot;&gt;
-		&lt;input type=&quot;text&quot; name=&quot;newcat&quot; id=&quot;newcat&quot; class=&quot;form-required form-input-tip&quot; value=&quot;&lt;?php _e( 'New category name' ); ?&gt;&quot; /&gt;
+		&lt;label class=&quot;hidden&quot; for=&quot;newcat&quot;&gt;&lt;?php _e( '+ Add New Category' ); ?&gt;&lt;/label&gt;
+		&lt;input type=&quot;text&quot; name=&quot;newcat&quot; id=&quot;newcat&quot; class=&quot;form-required form-input-tip&quot; value=&quot;&lt;?php _e( 'New category name' ); ?&gt;&quot; aria-required=&quot;true&quot; /&gt;
 		&lt;input type=&quot;button&quot; id=&quot;category-add-sumbit&quot; class=&quot;add:categorychecklist:linkcategorydiv button&quot; value=&quot;&lt;?php _e( 'Add' ); ?&gt;&quot; /&gt;
 		&lt;?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?&gt;
 		&lt;span id=&quot;category-ajax-response&quot;&gt;&lt;/span&gt;
@@ -118,7 +116,7 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('manage_links') )
 
 &lt;div id=&quot;categories-all&quot; class=&quot;ui-tabs-panel&quot;&gt;
 	&lt;ul id=&quot;categorychecklist&quot; class=&quot;list:category categorychecklist form-no-clear&quot;&gt;
-		&lt;?php dropdown_link_categories(); ?&gt;
+		&lt;?php wp_link_category_checklist($link-&gt;link_id); ?&gt;
 	&lt;/ul&gt;
 &lt;/div&gt;
 
@@ -127,17 +125,17 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('manage_links') )
 		&lt;?php wp_popular_terms_checklist('link_category'); ?&gt;
 	&lt;/ul&gt;
 &lt;/div&gt;
-
-&lt;/div&gt;
-&lt;/div&gt;
+&lt;?php
+}
+add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
+?&gt;
 
 &lt;?php do_meta_boxes('link', 'normal', $link); ?&gt;
 
 &lt;h2&gt;&lt;?php _e('Advanced Options'); ?&gt;&lt;/h2&gt;
 
-&lt;div id=&quot;linktargetdiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('linktargetdiv', 'link'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Target') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
+&lt;?php function link_target_meta_box($link) { ?&gt;
+&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Target') ?&gt;&lt;/legend&gt;
 &lt;label for=&quot;link_target_blank&quot; class=&quot;selectit&quot;&gt;
 &lt;input id=&quot;link_target_blank&quot; type=&quot;radio&quot; name=&quot;link_target&quot; value=&quot;_blank&quot; &lt;?php echo(($link-&gt;link_target == '_blank') ? 'checked=&quot;checked&quot;' : ''); ?&gt; /&gt;
 &lt;code&gt;_blank&lt;/code&gt;&lt;/label&gt;&lt;br /&gt;
@@ -147,16 +145,17 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('manage_links') )
 &lt;label for=&quot;link_target_none&quot; class=&quot;selectit&quot;&gt;
 &lt;input id=&quot;link_target_none&quot; type=&quot;radio&quot; name=&quot;link_target&quot; value=&quot;&quot; &lt;?php echo(($link-&gt;link_target == '') ? 'checked=&quot;checked&quot;' : ''); ?&gt; /&gt;
 &lt;?php _e('none') ?&gt;&lt;/label&gt;
+&lt;/fieldset&gt;
 &lt;p&gt;&lt;?php _e('Choose the frame your link targets. Essentially this means if you choose &lt;code&gt;_blank&lt;/code&gt; your link will open in a new window.'); ?&gt;&lt;/p&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+&lt;?php
+}
+add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'advanced', 'core');
 
-&lt;div id=&quot;linkxfndiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('linkxfndiv', 'link'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Link Relationship (XFN)') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
+function link_xfn_meta_box($link) {
+?&gt;
 &lt;table class=&quot;editform&quot; style=&quot;width: 100%;&quot; cellspacing=&quot;2&quot; cellpadding=&quot;5&quot;&gt;
 	&lt;tr&gt;
-		&lt;th style=&quot;width: 20%;&quot; scope=&quot;row&quot;&gt;&lt;?php _e('rel:') ?&gt;&lt;/th&gt;
+		&lt;th style=&quot;width: 20%;&quot; scope=&quot;row&quot;&gt;&lt;label for=&quot;link_rel&quot;&gt;&lt;?php _e('rel:') ?&gt;&lt;/label&gt;&lt;/th&gt;
 		&lt;td style=&quot;width: 80%;&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;link_rel&quot; id=&quot;link_rel&quot; size=&quot;50&quot; value=&quot;&lt;?php echo $link-&gt;link_rel; ?&gt;&quot; /&gt;&lt;/td&gt;
 	&lt;/tr&gt;
 	&lt;tr&gt;
@@ -164,15 +163,15 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('manage_links') )
 			&lt;table cellpadding=&quot;3&quot; cellspacing=&quot;5&quot; class=&quot;form-table&quot;&gt;
 				&lt;tr&gt;
 					&lt;th scope=&quot;row&quot;&gt; &lt;?php _e('identity') ?&gt; &lt;/th&gt;
-					&lt;td&gt;
+					&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt; &lt;?php _e('identity') ?&gt; &lt;/legend&gt;
 						&lt;label for=&quot;me&quot;&gt;
 						&lt;input type=&quot;checkbox&quot; name=&quot;identity&quot; value=&quot;me&quot; id=&quot;me&quot; &lt;?php xfn_check('identity', 'me'); ?&gt; /&gt;
 						&lt;?php _e('another web address of mine') ?&gt;&lt;/label&gt;
-					&lt;/td&gt;
+					&lt;/fieldset&gt;&lt;/td&gt;
 				&lt;/tr&gt;
 				&lt;tr&gt;
 					&lt;th scope=&quot;row&quot;&gt; &lt;?php _e('friendship') ?&gt; &lt;/th&gt;
-					&lt;td&gt;
+					&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt; &lt;?php _e('friendship') ?&gt; &lt;/legend&gt;
 						&lt;label for=&quot;contact&quot;&gt;
 						&lt;input class=&quot;valinp&quot; type=&quot;radio&quot; name=&quot;friendship&quot; value=&quot;contact&quot; id=&quot;contact&quot; &lt;?php xfn_check('friendship', 'contact', 'radio'); ?&gt; /&gt; &lt;?php _e('contact') ?&gt;&lt;/label&gt;
 						&lt;label for=&quot;acquaintance&quot;&gt;
@@ -181,30 +180,30 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('manage_links') )
 						&lt;input class=&quot;valinp&quot; type=&quot;radio&quot; name=&quot;friendship&quot; value=&quot;friend&quot; id=&quot;friend&quot; &lt;?php xfn_check('friendship', 'friend', 'radio'); ?&gt; /&gt; &lt;?php _e('friend') ?&gt;&lt;/label&gt;
 						&lt;label for=&quot;friendship&quot;&gt;
 						&lt;input name=&quot;friendship&quot; type=&quot;radio&quot; class=&quot;valinp&quot; value=&quot;&quot; id=&quot;friendship&quot; &lt;?php xfn_check('friendship', '', 'radio'); ?&gt; /&gt; &lt;?php _e('none') ?&gt;&lt;/label&gt;
-					&lt;/td&gt;
+					&lt;/fieldset&gt;&lt;/td&gt;
 				&lt;/tr&gt;
 				&lt;tr&gt;
 					&lt;th scope=&quot;row&quot;&gt; &lt;?php _e('physical') ?&gt; &lt;/th&gt;
-					&lt;td&gt;
+					&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt; &lt;?php _e('physical') ?&gt; &lt;/legend&gt;
 						&lt;label for=&quot;met&quot;&gt;
 						&lt;input class=&quot;valinp&quot; type=&quot;checkbox&quot; name=&quot;physical&quot; value=&quot;met&quot; id=&quot;met&quot; &lt;?php xfn_check('physical', 'met'); ?&gt; /&gt;
 						&lt;?php _e('met') ?&gt;&lt;/label&gt;
-					&lt;/td&gt;
+					&lt;/fieldset&gt;&lt;/td&gt;
 				&lt;/tr&gt;
 				&lt;tr&gt;
 					&lt;th scope=&quot;row&quot;&gt; &lt;?php _e('professional') ?&gt; &lt;/th&gt;
-					&lt;td&gt;
+					&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt; &lt;?php _e('professional') ?&gt; &lt;/legend&gt;
 						&lt;label for=&quot;co-worker&quot;&gt;
 						&lt;input class=&quot;valinp&quot; type=&quot;checkbox&quot; name=&quot;professional&quot; value=&quot;co-worker&quot; id=&quot;co-worker&quot; &lt;?php xfn_check('professional', 'co-worker'); ?&gt; /&gt;
 						&lt;?php _e('co-worker') ?&gt;&lt;/label&gt;
 						&lt;label for=&quot;colleague&quot;&gt;
 						&lt;input class=&quot;valinp&quot; type=&quot;checkbox&quot; name=&quot;professional&quot; value=&quot;colleague&quot; id=&quot;colleague&quot; &lt;?php xfn_check('professional', 'colleague'); ?&gt; /&gt;
 						&lt;?php _e('colleague') ?&gt;&lt;/label&gt;
-					&lt;/td&gt;
+					&lt;/fieldset&gt;&lt;/td&gt;
 				&lt;/tr&gt;
 				&lt;tr&gt;
 					&lt;th scope=&quot;row&quot;&gt; &lt;?php _e('geographical') ?&gt; &lt;/th&gt;
-					&lt;td&gt;
+					&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt; &lt;?php _e('geographical') ?&gt; &lt;/legend&gt;
 						&lt;label for=&quot;co-resident&quot;&gt;
 						&lt;input class=&quot;valinp&quot; type=&quot;radio&quot; name=&quot;geographical&quot; value=&quot;co-resident&quot; id=&quot;co-resident&quot; &lt;?php xfn_check('geographical', 'co-resident', 'radio'); ?&gt; /&gt;
 						&lt;?php _e('co-resident') ?&gt;&lt;/label&gt;
@@ -214,11 +213,11 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('manage_links') )
 						&lt;label for=&quot;geographical&quot;&gt;
 						&lt;input class=&quot;valinp&quot; type=&quot;radio&quot; name=&quot;geographical&quot; value=&quot;&quot; id=&quot;geographical&quot; &lt;?php xfn_check('geographical', '', 'radio'); ?&gt; /&gt;
 						&lt;?php _e('none') ?&gt;&lt;/label&gt;
-					&lt;/td&gt;
+					&lt;/fieldset&gt;&lt;/td&gt;
 				&lt;/tr&gt;
 				&lt;tr&gt;
 					&lt;th scope=&quot;row&quot;&gt; &lt;?php _e('family') ?&gt; &lt;/th&gt;
-					&lt;td&gt;
+					&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt; &lt;?php _e('family') ?&gt; &lt;/legend&gt;
 						&lt;label for=&quot;child&quot;&gt;
 						&lt;input class=&quot;valinp&quot; type=&quot;radio&quot; name=&quot;family&quot; value=&quot;child&quot; id=&quot;child&quot; &lt;?php xfn_check('family', 'child', 'radio'); ?&gt;  /&gt;
 						&lt;?php _e('child') ?&gt;&lt;/label&gt;
@@ -237,11 +236,11 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('manage_links') )
 						&lt;label for=&quot;family&quot;&gt;
 						&lt;input class=&quot;valinp&quot; type=&quot;radio&quot; name=&quot;family&quot; value=&quot;&quot; id=&quot;family&quot; &lt;?php xfn_check('family', '', 'radio'); ?&gt; /&gt;
 						&lt;?php _e('none') ?&gt;&lt;/label&gt;
-					&lt;/td&gt;
+					&lt;/fieldset&gt;&lt;/td&gt;
 				&lt;/tr&gt;
 				&lt;tr&gt;
 					&lt;th scope=&quot;row&quot;&gt; &lt;?php _e('romantic') ?&gt; &lt;/th&gt;
-					&lt;td&gt;
+					&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt; &lt;?php _e('romantic') ?&gt; &lt;/legend&gt;
 						&lt;label for=&quot;muse&quot;&gt;
 						&lt;input class=&quot;valinp&quot; type=&quot;checkbox&quot; name=&quot;romantic&quot; value=&quot;muse&quot; id=&quot;muse&quot; &lt;?php xfn_check('romantic', 'muse'); ?&gt; /&gt;
 						&lt;?php _e('muse') ?&gt;&lt;/label&gt;
@@ -254,19 +253,19 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('manage_links') )
 						&lt;label for=&quot;romantic&quot;&gt;
 						&lt;input class=&quot;valinp&quot; type=&quot;checkbox&quot; name=&quot;romantic&quot; value=&quot;sweetheart&quot; id=&quot;romantic&quot; &lt;?php xfn_check('romantic', 'sweetheart'); ?&gt; /&gt;
 						&lt;?php _e('sweetheart') ?&gt;&lt;/label&gt;
-					&lt;/td&gt;
+					&lt;/fieldset&gt;&lt;/td&gt;
 				&lt;/tr&gt;
 			&lt;/table&gt;
 		&lt;/td&gt;
 	&lt;/tr&gt;
 &lt;/table&gt;
 &lt;p&gt;&lt;?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out &lt;a href=&quot;http://gmpg.org/xfn/&quot;&gt;XFN&lt;/a&gt;.'); ?&gt;&lt;/p&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+&lt;?php
+}
+add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'advanced', 'core');
 
-&lt;div id=&quot;linkadvanceddiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('linkadvanceddiv', 'link'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Advanced') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
+function link_advanced_meta_box($link) {
+?&gt;
 &lt;table class=&quot;form-table&quot; style=&quot;width: 100%;&quot; cellspacing=&quot;2&quot; cellpadding=&quot;5&quot;&gt;
 	&lt;tr class=&quot;form-field&quot;&gt;
 		&lt;th valign=&quot;top&quot;  scope=&quot;row&quot;&gt;&lt;label for=&quot;link_image&quot;&gt;&lt;?php _e('Image Address') ?&gt;&lt;/label&gt;&lt;/th&gt;
@@ -294,12 +293,13 @@ if ( ( 'edit' == $action) &amp;&amp; current_user_can('manage_links') )
 		&lt;/td&gt;
 	&lt;/tr&gt;
 &lt;/table&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+&lt;?php
+}
+add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'advanced', 'core');
 
-&lt;?php do_meta_boxes('link', 'advanced', $link); ?&gt;
+do_meta_boxes('link', 'advanced', $link);
 
-&lt;?php if ( $link_id ) : ?&gt;
+if ( $link_id ) : ?&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;save&quot; /&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;link_id&quot; value=&quot;&lt;?php echo (int) $link_id; ?&gt;&quot; /&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;order_by&quot; value=&quot;&lt;?php echo attribute_escape($order_by); ?&gt;&quot; /&gt;</diff>
      <filename>wp-admin/edit-link-form.php</filename>
    </modified>
    <modified>
      <diff>@@ -5,10 +5,12 @@ $messages[1] = sprintf( __( 'Page updated. Continue editing below or &lt;a href=&quot;%s
 $messages[2] = __('Custom field updated.');
 $messages[3] = __('Custom field deleted.');
 $messages[4] = __('Page updated.');
-?&gt;
-&lt;?php if (isset($_GET['message'])) : ?&gt;
-&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php echo $messages[$_GET['message']]; ?&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;?php endif;
+
+if ( isset($_GET['revision']) )
+	$messages[5] = sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
+
+$notice = false;
+$notices[1] = __( 'There is an autosave of this page that is more recent than the version below.  &lt;a href=&quot;%s&quot;&gt;View the autosave&lt;/a&gt;.' );
 
 if (!isset($post_ID) || 0 == $post_ID) {
 	$form_action = 'post';
@@ -20,17 +22,23 @@ if (!isset($post_ID) || 0 == $post_ID) {
 	$form_action = 'editpost';
 	$nonce_action = 'update-page_' . $post_ID;
 	$form_extra = &quot;&lt;input type='hidden' id='post_ID' name='post_ID' value='$post_ID' /&gt;&quot;;
+	$autosave = wp_get_post_autosave( $post_id );
+	if ( $autosave &amp;&amp; mysql2date( 'U', $autosave-&gt;post_modified_gmt ) &gt; mysql2date( 'U', $post-&gt;post_modified_gmt ) )
+		$notice = sprintf( $notices[1], get_edit_post_link( $autosave-&gt;ID ) );
 }
 
 $temp_ID = (int) $temp_ID;
 $user_ID = (int) $user_ID;
 
-$sendto = clean_url(stripslashes(wp_get_referer()));
-
-if ( 0 != $post_ID &amp;&amp; $sendto == get_permalink($post_ID) )
-	$sendto = 'redo';
 ?&gt;
 
+&lt;?php if ( $notice ) : ?&gt;
+&lt;div id=&quot;notice&quot; class=&quot;error&quot;&gt;&lt;p&gt;&lt;?php echo $notice ?&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;?php endif; ?&gt;
+&lt;?php if (isset($_GET['message'])) : ?&gt;
+&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php echo $messages[$_GET['message']]; ?&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;?php endif; ?&gt;
+
 &lt;form name=&quot;post&quot; action=&quot;page.php&quot; method=&quot;post&quot; id=&quot;post&quot;&gt;
 &lt;div class=&quot;wrap&quot;&gt;
 &lt;h2&gt;&lt;?php _e('Write Page') ?&gt;&lt;/h2&gt;
@@ -44,15 +52,11 @@ if (isset($mode) &amp;&amp; 'bookmarklet' == $mode)
 &lt;input type=&quot;hidden&quot; id=&quot;user-id&quot; name=&quot;user_ID&quot; value=&quot;&lt;?php echo $user_ID ?&gt;&quot; /&gt;
 &lt;input type=&quot;hidden&quot; id=&quot;hiddenaction&quot; name=&quot;action&quot; value='&lt;?php echo $form_action ?&gt;' /&gt;
 &lt;input type=&quot;hidden&quot; id=&quot;originalaction&quot; name=&quot;originalaction&quot; value=&quot;&lt;?php echo $form_action ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; id=&quot;post_author&quot; name=&quot;post_author&quot; value=&quot;&lt;?php echo attribute_escape( $post-&gt;post_author ); ?&gt;&quot; /&gt;
 &lt;?php echo $form_extra ?&gt;
 &lt;input type=&quot;hidden&quot; id=&quot;post_type&quot; name=&quot;post_type&quot; value=&quot;&lt;?php echo $post-&gt;post_type ?&gt;&quot; /&gt;
 &lt;input type=&quot;hidden&quot; id=&quot;original_post_status&quot; name=&quot;original_post_status&quot; value=&quot;&lt;?php echo $post-&gt;post_status ?&gt;&quot; /&gt;
-&lt;input name=&quot;referredby&quot; type=&quot;hidden&quot; id=&quot;referredby&quot; value=&quot;&lt;?php
-if ( url_to_postid(wp_get_referer()) == $post_ID &amp;&amp; strpos( wp_get_referer(), '/wp-admin/' ) === false )
-	echo 'redo';
-else
-	echo clean_url(stripslashes(wp_get_referer()));
-?&gt;&quot; /&gt;
+&lt;input name=&quot;referredby&quot; type=&quot;hidden&quot; id=&quot;referredby&quot; value=&quot;&lt;?php echo clean_url(stripslashes(wp_get_referer())); ?&gt;&quot; /&gt;
 &lt;?php if ( 'draft' != $post-&gt;post_status ) wp_original_referer_field(true, 'previous'); ?&gt;
 
 &lt;div id=&quot;poststuff&quot;&gt;
@@ -68,14 +72,14 @@ else
 &lt;/div&gt;
 
 &lt;div class=&quot;inside&quot;&gt;
-
-&lt;p&gt;&lt;strong&gt;&lt;?php _e('Publish Status') ?&gt;&lt;/strong&gt;&lt;/p&gt;
+&lt;p&gt;&lt;strong&gt;&lt;label for='post_status'&gt;&lt;?php _e('Publish Status') ?&gt;&lt;/label&gt;&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;
-&lt;select name='post_status' tabindex='4'&gt;
-&lt;?php if ( current_user_can('publish_posts') ) : ?&gt;
+&lt;select name='post_status' tabindex='4' id='post_status'&gt;
+&lt;?php // Show publish in dropdown if user can publish or if they can re-publish this page ('edit_published_pages')
+// 'publish' option will be selected for published AND private posts (checkbox overrides dropdown)
+if ( current_user_can('publish_pages') OR ( $post-&gt;post_status == 'publish' AND current_user_can('edit_page', $post-&gt;ID) ) ) : 
+?&gt;
 &lt;option&lt;?php selected( $post-&gt;post_status, 'publish' ); selected( $post-&gt;post_status, 'private' );?&gt; value='publish'&gt;&lt;?php _e('Published') ?&gt;&lt;/option&gt;
-&lt;?php else: ?&gt;
-&lt;option&lt;?php selected( $post-&gt;post_status, 'private' ); ?&gt; value='private'&gt;&lt;?php _e('Published') ?&gt;&lt;/option&gt;
 &lt;?php endif; ?&gt;
 &lt;?php if ( 'future' == $post-&gt;post_status ) : ?&gt;
 &lt;option&lt;?php selected( $post-&gt;post_status, 'future' ); ?&gt; value='future'&gt;&lt;?php _e('Pending') ?&gt;&lt;/option&gt;
@@ -84,8 +88,10 @@ else
 &lt;option&lt;?php selected( $post-&gt;post_status, 'draft' ); ?&gt; value='draft'&gt;&lt;?php _e('Unpublished') ?&gt;&lt;/option&gt;
 &lt;/select&gt;
 &lt;/p&gt;
+&lt;?php if ( current_user_can( 'publish_posts' ) ) : ?&gt; 
+&lt;p id=&quot;private-checkbox&quot;&gt;&lt;label for=&quot;post_status_private&quot; class=&quot;selectit&quot;&gt;&lt;input id=&quot;post_status_private&quot; name=&quot;post_status&quot; type=&quot;checkbox&quot; value=&quot;private&quot; &lt;?php checked($post-&gt;post_status, 'private'); ?&gt; tabindex='4' /&gt; &lt;?php _e('Keep this page private') ?&gt;&lt;/label&gt;&lt;/p&gt;
+&lt;?php endif; ?&gt;
 
-&lt;p&gt;&lt;label for=&quot;post_status_private&quot; class=&quot;selectit&quot;&gt;&lt;input id=&quot;post_status_private&quot; name=&quot;post_status&quot; type=&quot;checkbox&quot; value=&quot;private&quot; &lt;?php checked($post-&gt;post_status, 'private'); ?&gt; tabindex='4' /&gt; &lt;?php _e('Keep this page private') ?&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;?php
 if ($post_ID) {
 	if ( 'future' == $post-&gt;post_status ) { // scheduled for publishing at a future date
@@ -140,6 +146,7 @@ if ( ('edit' == $action) &amp;&amp; current_user_can('delete_page', $post_ID) )
 &lt;br class=&quot;clear&quot; /&gt;
 &lt;?php endif; ?&gt;
 &lt;span id=&quot;autosave&quot;&gt;&lt;/span&gt;
+&lt;span id=&quot;wp-word-count&quot;&gt;&lt;/span&gt;
 &lt;/p&gt;
 
 &lt;div class=&quot;side-info&quot;&gt;
@@ -159,7 +166,7 @@ if ( ('edit' == $action) &amp;&amp; current_user_can('delete_page', $post_ID) )
 
 &lt;div id=&quot;post-body&quot;&gt;
 &lt;div id=&quot;titlediv&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Title') ?&gt;&lt;/h3&gt;
+&lt;h3&gt;&lt;label for=&quot;title&quot;&gt;&lt;?php _e('Title') ?&gt;&lt;/label&gt;&lt;/h3&gt;
 &lt;div id=&quot;titlewrap&quot;&gt;
   &lt;input type=&quot;text&quot; name=&quot;post_title&quot; size=&quot;30&quot; tabindex=&quot;1&quot; value=&quot;&lt;?php echo attribute_escape( $post-&gt;post_title ); ?&gt;&quot; id=&quot;title&quot; autocomplete=&quot;off&quot; /&gt;
 &lt;/div&gt;
@@ -174,7 +181,7 @@ endif; ?&gt;
 &lt;/div&gt;
 
 &lt;div id=&quot;&lt;?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?&gt;&quot; class=&quot;postarea&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Page') ?&gt;&lt;/h3&gt;
+&lt;h3&gt;&lt;label for=&quot;content&quot;&gt;&lt;?php _e('Page') ?&gt;&lt;/label&gt;&lt;/h3&gt;
 &lt;?php the_editor($post-&gt;post_content); ?&gt;
 &lt;?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?&gt;
 &lt;?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?&gt;
@@ -188,13 +195,14 @@ endif; ?&gt;
 
 &lt;h2&gt;&lt;?php _e('Advanced Options'); ?&gt;&lt;/h2&gt;
 
-&lt;div id=&quot;pagepostcustom&quot; class=&quot;postbox &lt;?php echo postbox_classes('pagepostcustom', 'page'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Custom Fields') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
+
+&lt;?php 
+function page_custom_meta_box($post){
+?&gt;
 &lt;div id=&quot;postcustomstuff&quot;&gt;
 &lt;table cellpadding=&quot;3&quot;&gt;
 &lt;?php
-$metadata = has_meta($post_ID);
+$metadata = has_meta($post-&gt;ID);
 list_meta($metadata);
 ?&gt;
 
@@ -205,83 +213,97 @@ list_meta($metadata);
 &lt;div id=&quot;ajax-response&quot;&gt;&lt;/div&gt;
 &lt;/div&gt;
 &lt;p&gt;&lt;?php _e('Custom fields can be used to add extra metadata to a post that you can &lt;a href=&quot;http://codex.wordpress.org/Using_Custom_Fields&quot; target=&quot;_blank&quot;&gt;use in your theme&lt;/a&gt;.'); ?&gt;&lt;/p&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+&lt;?php
+}
+add_meta_box('pagecustomdiv', __('Custom Fields'), 'page_custom_meta_box', 'page', 'advanced', 'core');
 
-&lt;div id=&quot;pagecommentstatusdiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('pagecommentstatusdiv', 'page'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Comments &amp;amp; Pings') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
+function page_comments_status_meta_box($post){
+?&gt;
 &lt;input name=&quot;advanced_view&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;
 &lt;p&gt;&lt;label for=&quot;comment_status&quot; class=&quot;selectit&quot;&gt;
 &lt;input name=&quot;comment_status&quot; type=&quot;checkbox&quot; id=&quot;comment_status&quot; value=&quot;open&quot; &lt;?php checked($post-&gt;comment_status, 'open'); ?&gt; /&gt;
 &lt;?php _e('Allow Comments') ?&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;label for=&quot;ping_status&quot; class=&quot;selectit&quot;&gt;&lt;input name=&quot;ping_status&quot; type=&quot;checkbox&quot; id=&quot;ping_status&quot; value=&quot;open&quot; &lt;?php checked($post-&gt;ping_status, 'open'); ?&gt; /&gt; &lt;?php _e('Allow Pings') ?&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;?php _e('These settings apply to this page only. &amp;#8220;Pings&amp;#8221; are &lt;a href=&quot;http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments&quot; target=&quot;_blank&quot;&gt;trackbacks and pingbacks&lt;/a&gt;.'); ?&gt;&lt;/p&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+&lt;?php 
+}
+add_meta_box('pagecommentstatusdiv', __('Comments &amp;amp; Pings'), 'page_comments_status_meta_box', 'page', 'advanced', 'core');
 
-&lt;div id=&quot;pagepassworddiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('pagepassworddiv', 'page'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Password Protect This Page') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
-&lt;p&gt;&lt;input name=&quot;post_password&quot; type=&quot;text&quot; size=&quot;25&quot; id=&quot;post_password&quot; value=&quot;&lt;?php echo attribute_escape( $post-&gt;post_password ); ?&gt;&quot; /&gt;&lt;/p&gt;
+function page_password_meta_box($post){
+?&gt;
+&lt;p&gt;&lt;label class=&quot;hidden&quot; for=&quot;post_password&quot;&gt;&lt;?php _e('Password Protect This Page') ?&gt;&lt;/label&gt;&lt;input name=&quot;post_password&quot; type=&quot;text&quot; size=&quot;25&quot; id=&quot;post_password&quot; value=&quot;&lt;?php echo attribute_escape( $post-&gt;post_password ); ?&gt;&quot; /&gt;&lt;/p&gt;
 &lt;p&gt;&lt;?php _e('Setting a password will require people who visit your blog to enter the above password to view this page and its comments.'); ?&gt;&lt;/p&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+&lt;?php
+}
+add_meta_box('pagepassworddiv', __('Password Protect This Page'), 'page_password_meta_box', 'page', 'advanced', 'core');
 
-&lt;div id=&quot;pageslugdiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('pageslugdiv', 'page'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Page Slug') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
-&lt;input name=&quot;post_name&quot; type=&quot;text&quot; size=&quot;13&quot; id=&quot;post_name&quot; value=&quot;&lt;?php echo attribute_escape( $post-&gt;post_name ); ?&gt;&quot; /&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+function page_slug_meta_box($post){
+?&gt;
+&lt;label class=&quot;hidden&quot; for=&quot;post_name&quot;&gt;&lt;?php _e('Page Slug') ?&gt;&lt;/label&gt;&lt;input name=&quot;post_name&quot; type=&quot;text&quot; size=&quot;13&quot; id=&quot;post_name&quot; value=&quot;&lt;?php echo attribute_escape( $post-&gt;post_name ); ?&gt;&quot; /&gt;
+&lt;?php
+}
+add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'advanced', 'core');
 
-&lt;div id=&quot;pageparentdiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('pageparentdiv', 'page'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Page Parent') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
-&lt;select name=&quot;parent_id&quot;&gt;
+function page_parent_meta_box($post){
+?&gt;
+&lt;label class=&quot;hidden&quot; for=&quot;parent_id&quot;&gt;&lt;?php _e('Page Parent') ?&gt;&lt;/label&gt;
+&lt;select name=&quot;parent_id&quot; id=&quot;parent_id&quot;&gt;
 &lt;option value='0'&gt;&lt;?php _e('Main Page (no parent)'); ?&gt;&lt;/option&gt;
 &lt;?php parent_dropdown($post-&gt;post_parent); ?&gt;
 &lt;/select&gt;
 &lt;p&gt;&lt;?php _e('You can arrange your pages in hierarchies, for example you could have an &amp;#8220;About&amp;#8221; page that has &amp;#8220;Life Story&amp;#8221; and &amp;#8220;My Dog&amp;#8221; pages under it. There are no limits to how deeply nested you can make pages.'); ?&gt;&lt;/p&gt;
-&lt;/div&gt;
-&lt;/div&gt;
+&lt;?php
+}
+add_meta_box('pageparentdiv', __('Page Parent'), 'page_parent_meta_box', 'page', 'advanced', 'core');
 
-&lt;?php if ( 0 != count( get_page_templates() ) ) { ?&gt;
-&lt;div id=&quot;pagetemplatediv&quot; class=&quot;postbox &lt;?php echo postbox_classes('pagetemplatediv', 'page'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Page Template') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
-&lt;select name=&quot;page_template&quot;&gt;
+if ( 0 != count( get_page_templates() ) ) {
+	function page_template_meta_box($post){
+?&gt;
+&lt;label class=&quot;hidden&quot; for=&quot;page_template&quot;&gt;&lt;?php _e('Page Template') ?&gt;&lt;/label&gt;&lt;select name=&quot;page_template&quot; id=&quot;page_template&quot;&gt;
 &lt;option value='default'&gt;&lt;?php _e('Default Template'); ?&gt;&lt;/option&gt;
 &lt;?php page_template_dropdown($post-&gt;page_template); ?&gt;
 &lt;/select&gt;
 &lt;p&gt;&lt;?php _e('Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&amp;#8217;ll see them above.'); ?&gt;&lt;/p&gt;
-&lt;/div&gt;
-&lt;/div&gt;
-&lt;?php } ?&gt;
+&lt;?php
+	}
+	add_meta_box('pagetemplatediv', __('Page Template'), 'page_template_meta_box', 'page', 'advanced', 'core');
+}
 
-&lt;div id=&quot;pageorderdiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('pageorderdiv', 'page'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Page Order') ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
-&lt;p&gt;&lt;input name=&quot;menu_order&quot; type=&quot;text&quot; size=&quot;4&quot; id=&quot;menu_order&quot; value=&quot;&lt;?php echo $post-&gt;menu_order ?&gt;&quot; /&gt;&lt;/p&gt;
+function page_order_meta_box($post){
+?&gt;
+&lt;p&gt;&lt;label class=&quot;hidden&quot; for=&quot;menu_order&quot;&gt;&lt;?php _e('Page Order') ?&gt;&lt;/label&gt;&lt;input name=&quot;menu_order&quot; type=&quot;text&quot; size=&quot;4&quot; id=&quot;menu_order&quot; value=&quot;&lt;?php echo $post-&gt;menu_order ?&gt;&quot; /&gt;&lt;/p&gt;
 &lt;p&gt;&lt;?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it&amp;#8217;ll be better in future releases.)'); ?&gt;&lt;/p&gt;
-&lt;/div&gt;
-&lt;/div&gt;
-
 &lt;?php
+}
+add_meta_box('pageorderdiv', __('Page Order'), 'page_order_meta_box', 'page', 'advanced', 'core');
+
+
 $authors = get_editable_user_ids( $current_user-&gt;id ); // TODO: ROLE SYSTEM
 if ( $post-&gt;post_author &amp;&amp; !in_array($post-&gt;post_author, $authors) )
 	$authors[] = $post-&gt;post_author;
-if ( $authors &amp;&amp; count( $authors ) &gt; 1 ) :
+if ( $authors &amp;&amp; count( $authors ) &gt; 1 ) {
+	function page_author_meta_box($post){
+		global $current_user, $user_ID;
+		$authors = get_editable_user_ids( $current_user-&gt;id ); // TODO: ROLE SYSTEM
+		if ( $post-&gt;post_author &amp;&amp; !in_array($post-&gt;post_author, $authors) )
+			$authors[] = $post-&gt;post_author;
 ?&gt;
-&lt;div id=&quot;pageauthordiv&quot; class=&quot;postbox &lt;?php echo postbox_classes('pageauthordiv', 'page'); ?&gt;&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Page Author'); ?&gt;&lt;/h3&gt;
-&lt;div class=&quot;inside&quot;&gt;
-&lt;?php wp_dropdown_users( array('include' =&gt; $authors, 'name' =&gt; 'post_author_override', 'selected' =&gt; empty($post_ID) ? $user_ID : $post-&gt;post_author) ); ?&gt;
-&lt;/div&gt;
-&lt;/div&gt;
-&lt;?php endif; ?&gt;
+&lt;label class=&quot;hidden&quot; for=&quot;post_author_override&quot;&gt;&lt;?php _e('Page Author'); ?&gt;&lt;/label&gt;&lt;?php wp_dropdown_users( array('include' =&gt; $authors, 'name' =&gt; 'post_author_override', 'selected' =&gt; empty($post-&gt;ID) ? $user_ID : $post-&gt;post_author) ); ?&gt;
+&lt;?php
+	}
+	add_meta_box('pageauthordiv', __('Page Author'), 'page_author_meta_box', 'page', 'advanced', 'core');
+}
 
-&lt;?php do_meta_boxes('page', 'advanced', $post); ?&gt;
+
+if ( isset($post_ID) &amp;&amp; 0 &lt; $post_ID &amp;&amp; wp_get_post_revisions( $post_ID ) ) :
+function page_revisions_meta_box($post) {
+	wp_list_post_revisions();
+}
+add_meta_box('revisionsdiv', __('Page Revisions'), 'page_revisions_meta_box', 'page', 'advanced', 'core');
+endif;
+
+do_meta_boxes('page', 'advanced', $post);
+?&gt;
 
 &lt;/div&gt;
 &lt;/div&gt;</diff>
      <filename>wp-admin/edit-page-form.php</filename>
    </modified>
    <modified>
      <diff>@@ -20,8 +20,8 @@ if ( isset($_GET['deleteit']) &amp;&amp; isset($_GET['delete']) ) {
 	}
 
 	$sendback = wp_get_referer();
-	if (strpos($sendback, 'page.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/page-new.php';
-	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+	if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
+	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
 	$sendback = preg_replace('|[^a-z0-9-~+_.?#=&amp;;,/:]|i', '', $sendback);
 
 	wp_redirect($sendback);
@@ -111,12 +111,32 @@ endif;
 ?&gt;
 
 &lt;p id=&quot;post-search&quot;&gt;
+	&lt;label class=&quot;hidden&quot; for=&quot;post-search-input&quot;&gt;&lt;?php _e( 'Search Pages' ); ?&gt;:&lt;/label&gt;
 	&lt;input type=&quot;text&quot; id=&quot;post-search-input&quot; name=&quot;s&quot; value=&quot;&lt;?php echo attribute_escape(stripslashes($_GET['s'])); ?&gt;&quot; /&gt;
 	&lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e( 'Search Pages' ); ?&gt;&quot; class=&quot;button&quot; /&gt;
 &lt;/p&gt;
 
 &lt;div class=&quot;tablenav&quot;&gt;
 
+&lt;?php
+$pagenum = absint( $_GET['pagenum'] );
+if ( empty($pagenum) )
+	$pagenum = 1;
+if( !$per_page || $per_page &lt; 0 )
+	$per_page = 20;
+
+$num_pages = ceil(count($posts) / $per_page);
+$page_links = paginate_links( array(
+	'base' =&gt; add_query_arg( 'pagenum', '%#%' ),
+	'format' =&gt; '',
+	'total' =&gt; $num_pages,
+	'current' =&gt; $pagenum
+));
+
+if ( $page_links )
+	echo &quot;&lt;div class='tablenav-pages'&gt;$page_links&lt;/div&gt;&quot;;
+?&gt;
+
 &lt;div class=&quot;alignleft&quot;&gt;
 &lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e('Delete'); ?&gt;&quot; name=&quot;deleteit&quot; class=&quot;button-secondary delete&quot; /&gt;
 &lt;?php wp_nonce_field('bulk-pages'); ?&gt;
@@ -150,7 +170,7 @@ if ($posts) {
   &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tbody&gt;
-  &lt;?php page_rows($posts); ?&gt;
+  &lt;?php page_rows($posts, $pagenum, $per_page); ?&gt;
   &lt;/tbody&gt;
 &lt;/table&gt;
 
@@ -168,6 +188,10 @@ if ($posts) {
 ?&gt;
 
 &lt;div class=&quot;tablenav&quot;&gt;
+&lt;?php
+if ( $page_links )
+	echo &quot;&lt;div class='tablenav-pages'&gt;$page_links&lt;/div&gt;&quot;;
+?&gt;
 &lt;br class=&quot;clear&quot; /&gt;
 &lt;/div&gt;
 
@@ -175,7 +199,7 @@ if ($posts) {
 
 if ( 1 == count($posts) &amp;&amp; is_singular() ) :
 
-	$comments = $wpdb-&gt;get_results(&quot;SELECT * FROM $wpdb-&gt;comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date&quot;);
+	$comments = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date&quot;, $id) );
 	if ( $comments ) :
 		// Make sure comments, post, and post_author are cached
 		update_comment_cache($comments);</diff>
      <filename>wp-admin/edit-pages.php</filename>
    </modified>
    <modified>
      <diff>@@ -22,6 +22,14 @@
 if ( have_posts() ) {
 $bgcolor = '';
 add_filter('the_title','wp_specialchars');
+
+// Create array of post IDs.
+$post_ids = array();
+foreach ( $wp_query-&gt;posts as $a_post )
+	$post_ids[] = $a_post-&gt;ID;
+
+$comment_pending_count = get_pending_comments_num($post_ids);
+
 while (have_posts()) : the_post();
 $class = 'alternate' == $class ? '' : 'alternate';
 global $current_user;
@@ -67,7 +75,7 @@ foreach($posts_columns as $column_name=&gt;$column_display_name) {
 			}
 		}
 		?&gt;
-		&lt;td&gt;&lt;abbr title=&quot;&lt;?php echo $t_time ?&gt;&quot;&gt;&lt;?php echo $h_time ?&gt;&lt;/abbr&gt;&lt;/td&gt;
+		&lt;td&gt;&lt;abbr title=&quot;&lt;?php echo $t_time ?&gt;&quot;&gt;&lt;?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name) ?&gt;&lt;/abbr&gt;&lt;/td&gt;
 		&lt;?php
 		break;
 	case 'title':
@@ -113,7 +121,7 @@ foreach($posts_columns as $column_name=&gt;$column_display_name) {
 		?&gt;
 		&lt;td class=&quot;num&quot;&gt;&lt;div class=&quot;post-com-count-wrapper&quot;&gt;
 		&lt;?php
-		$left = get_pending_comments_num( $post-&gt;ID );
+		$left = isset($comment_pending_count) ? $comment_pending_count[$post-&gt;ID] : 0;
 		$pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
 		if ( $left )
 			echo '&lt;strong&gt;';</diff>
      <filename>wp-admin/edit-post-rows.php</filename>
    </modified>
    <modified>
      <diff>@@ -26,12 +26,12 @@ if ( ! empty($tag_ID) ) {
 	&lt;table class=&quot;form-table&quot;&gt;
 		&lt;tr class=&quot;form-field form-required&quot;&gt;
 			&lt;th scope=&quot;row&quot; valign=&quot;top&quot;&gt;&lt;label for=&quot;name&quot;&gt;&lt;?php _e('Tag name') ?&gt;&lt;/label&gt;&lt;/th&gt;
-			&lt;td&gt;&lt;input name=&quot;name&quot; id=&quot;name&quot; type=&quot;text&quot; value=&quot;&lt;?php echo attribute_escape($tag-&gt;name); ?&gt;&quot; size=&quot;40&quot; /&gt;
+			&lt;td&gt;&lt;input name=&quot;name&quot; id=&quot;name&quot; type=&quot;text&quot; value=&quot;&lt;?php echo attribute_escape($tag-&gt;name); ?&gt;&quot; size=&quot;40&quot; aria-required=&quot;true&quot; /&gt;
             &lt;p&gt;&lt;?php _e('The name is how the tag appears on your site.'); ?&gt;&lt;/p&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr class=&quot;form-field&quot;&gt;
 			&lt;th scope=&quot;row&quot; valign=&quot;top&quot;&gt;&lt;label for=&quot;slug&quot;&gt;&lt;?php _e('Tag slug') ?&gt;&lt;/label&gt;&lt;/th&gt;
-			&lt;td&gt;&lt;input name=&quot;slug&quot; id=&quot;slug&quot; type=&quot;text&quot; value=&quot;&lt;?php echo attribute_escape($tag-&gt;slug); ?&gt;&quot; size=&quot;40&quot; /&gt;
+			&lt;td&gt;&lt;input name=&quot;slug&quot; id=&quot;slug&quot; type=&quot;text&quot; value=&quot;&lt;?php echo attribute_escape(apply_filters('editable_slug', $tag-&gt;slug)); ?&gt;&quot; size=&quot;40&quot; /&gt;
             &lt;p&gt;&lt;?php _e('The &amp;#8220;slug&amp;#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?&gt;&lt;/p&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 	&lt;/table&gt;</diff>
      <filename>wp-admin/edit-tag-form.php</filename>
    </modified>
    <modified>
      <diff>@@ -133,6 +133,7 @@ endif; ?&gt;
 &lt;?php endif; ?&gt;
 
 &lt;p id=&quot;post-search&quot;&gt;
+	&lt;label class=&quot;hidden&quot; for=&quot;post-search-input&quot;&gt;&lt;?php _e( 'Search Tags' ); ?&gt;:&lt;/label&gt;
 	&lt;input type=&quot;text&quot; id=&quot;post-search-input&quot; name=&quot;s&quot; value=&quot;&lt;?php echo attribute_escape(stripslashes($_GET['s'])); ?&gt;&quot; /&gt;
 	&lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e( 'Search Tags' ); ?&gt;&quot; class=&quot;button&quot; /&gt;
 &lt;/p&gt;
@@ -172,7 +173,7 @@ if ( $page_links )
 &lt;table class=&quot;widefat&quot;&gt;
 	&lt;thead&gt;
 	&lt;tr&gt;
-	&lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; onclick=&quot;checkAll(document.getElementById('posts-filter'));&quot; /&gt;&lt;/th&gt;
+	&lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/th&gt;
         &lt;th scope=&quot;col&quot;&gt;&lt;?php _e('Name') ?&gt;&lt;/th&gt;
         &lt;th scope=&quot;col&quot; class=&quot;num&quot; style=&quot;width: 90px&quot;&gt;&lt;?php _e('Posts') ?&gt;&lt;/th&gt;
 	&lt;/tr&gt;</diff>
      <filename>wp-admin/edit-tags.php</filename>
    </modified>
    <modified>
      <diff>@@ -20,8 +20,8 @@ if ( isset($_GET['deleteit']) &amp;&amp; isset($_GET['delete']) ) {
 	}
 
 	$sendback = wp_get_referer();
-	if (strpos($sendback, 'post.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/post-new.php';
-	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+	if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
+	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
 	$sendback = preg_replace('|[^a-z0-9-~+_.?#=&amp;;,/:]|i', '', $sendback);
 
 	wp_redirect($sendback);
@@ -116,6 +116,7 @@ endif;
 ?&gt;
 
 &lt;p id=&quot;post-search&quot;&gt;
+	&lt;label class=&quot;hidden&quot; for=&quot;post-search-input&quot;&gt;&lt;?php _e( 'Search Posts' ); ?&gt;:&lt;/label&gt;
 	&lt;input type=&quot;text&quot; id=&quot;post-search-input&quot; name=&quot;s&quot; value=&quot;&lt;?php the_search_query(); ?&gt;&quot; /&gt;
 	&lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e( 'Search Posts' ); ?&gt;&quot; class=&quot;button&quot; /&gt;
 &lt;/p&gt;
@@ -167,8 +168,12 @@ foreach ($arc_result as $arc_row) {
 &lt;/select&gt;
 &lt;?php } ?&gt;
 
-&lt;?php wp_dropdown_categories('show_option_all='.__('View all categories').'&amp;hide_empty=1&amp;hierarchical=1&amp;show_count=1&amp;selected='.$cat);?&gt;
-&lt;?php do_action('restrict_manage_posts'); ?&gt;
+&lt;?php
+$dropdown_options = array('show_option_all' =&gt; __('View all categories'), 'hide_empty' =&gt; 0, 'hierarchical' =&gt; 1,
+	'show_count' =&gt; 0, 'orderby' =&gt; 'name', 'selected' =&gt; $cat);
+wp_dropdown_categories($dropdown_options);
+do_action('restrict_manage_posts');
+?&gt;
 &lt;input type=&quot;submit&quot; id=&quot;post-query-submit&quot; value=&quot;&lt;?php _e('Filter'); ?&gt;&quot; class=&quot;button-secondary&quot; /&gt;
 
 &lt;?php } ?&gt;
@@ -201,7 +206,7 @@ if ( $page_links )
 
 if ( 1 == count($posts) &amp;&amp; is_singular() ) :
 
-	$comments = $wpdb-&gt;get_results(&quot;SELECT * FROM $wpdb-&gt;comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date&quot;);
+	$comments = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date&quot;, $id) );
 	if ( $comments ) :
 		// Make sure comments, post, and post_author are cached
 		update_comment_cache($comments);</diff>
      <filename>wp-admin/edit.php</filename>
    </modified>
    <modified>
      <diff>@@ -22,9 +22,9 @@ require_once ('admin-header.php');
 
 &lt;table class=&quot;form-table&quot;&gt;
 &lt;tr&gt;
-&lt;th&gt;&lt;?php _e('Restrict Author'); ?&gt;&lt;/th&gt;
+&lt;th&gt;&lt;label for=&quot;author&quot;&gt;&lt;?php _e('Restrict Author'); ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;
-&lt;select name=&quot;author&quot;&gt;
+&lt;select name=&quot;author&quot; id=&quot;author&quot;&gt;
 &lt;option value=&quot;all&quot; selected=&quot;selected&quot;&gt;&lt;?php _e('All Authors'); ?&gt;&lt;/option&gt;
 &lt;?php
 $authors = $wpdb-&gt;get_col( &quot;SELECT post_author FROM $wpdb-&gt;posts GROUP BY post_author&quot; );</diff>
      <filename>wp-admin/export.php</filename>
    </modified>
    <modified>
      <diff>@@ -641,7 +641,7 @@ class Blogger_Import {
 		$host = $this-&gt;blogs[$importing_blog]['host'];
 
 		// Get an array of posts =&gt; authors
-		$post_ids = (array) $wpdb-&gt;get_col(&quot;SELECT post_id FROM $wpdb-&gt;postmeta WHERE meta_key = 'blogger_blog' AND meta_value = '$host'&quot;);
+		$post_ids = (array) $wpdb-&gt;get_col( $wpdb-&gt;prepare(&quot;SELECT post_id FROM $wpdb-&gt;postmeta WHERE meta_key = 'blogger_blog' AND meta_value = %s&quot;, $host) );
 		$post_ids = join( ',', $post_ids );
 		$results = (array) $wpdb-&gt;get_results(&quot;SELECT post_id, meta_value FROM $wpdb-&gt;postmeta WHERE meta_key = 'blogger_author' AND post_id IN ($post_ids)&quot;);
 		foreach ( $results as $row )
@@ -658,7 +658,7 @@ class Blogger_Import {
 			$post_ids = (array) array_keys( $authors_posts, $this-&gt;blogs[$importing_blog]['authors'][$author][0] );
 			$post_ids = join( ',', $post_ids);
 
-			$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;posts SET post_author = $user_id WHERE id IN ($post_ids)&quot;);
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET post_author = %d WHERE id IN ($post_ids)&quot;, $user_id) );
 			$this-&gt;blogs[$importing_blog]['authors'][$author][1] = $user_id;
 		}
 		$this-&gt;save_vars();
@@ -770,7 +770,7 @@ class Blogger_Import {
 				$this-&gt;$key = $value;
 
 		if ( isset( $_REQUEST['blog'] ) ) {
-			$blog = is_array($_REQUEST['blog']) ? array_shift( array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog'];
+			$blog = is_array($_REQUEST['blog']) ? array_shift( $keys = array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog'];
 			$blog = (int) $blog;
 			$result = $this-&gt;import_blog( $blog );
 			if ( is_wp_error( $result ) )</diff>
      <filename>wp-admin/import/blogger.php</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,7 @@ if(!function_exists('get_comment_count'))
 	function get_comment_count($post_ID)
 	{
 		global $wpdb;
-		return $wpdb-&gt;get_var('SELECT count(*) FROM '.$wpdb-&gt;comments.' WHERE comment_post_ID = '.$post_ID);
+		return $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT count(*) FROM $wpdb-&gt;comments WHERE comment_post_ID = %d&quot;, $post_ID) );
 	}
 }
 
@@ -22,7 +22,7 @@ if(!function_exists('link_exists'))
 	function link_exists($linkname)
 	{
 		global $wpdb;
-		return $wpdb-&gt;get_var('SELECT link_id FROM '.$wpdb-&gt;links.' WHERE link_name = &quot;'.$linkname.'&quot;');
+		return $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT link_id FROM $wpdb-&gt;links WHERE link_name = %s&quot;, $linkname) );
 	}
 }
 </diff>
      <filename>wp-admin/import/dotclear.php</filename>
    </modified>
    <modified>
      <diff>@@ -38,16 +38,16 @@ class GM_Import {
 &lt;h3&gt;&lt;?php _e('Second step: GreyMatter details:') ?&gt;&lt;/h3&gt;
 &lt;table class=&quot;form-table&quot;&gt;
 &lt;tr&gt;
-&lt;td&gt;&lt;?php _e('Path to GM files:') ?&gt;&lt;/td&gt;
-&lt;td&gt;&lt;input type=&quot;text&quot; style=&quot;width:300px&quot; name=&quot;gmpath&quot; value=&quot;/home/my/site/cgi-bin/greymatter/&quot; /&gt;&lt;/td&gt;
+&lt;td&gt;&lt;label for=&quot;gmpath&quot;&gt;&lt;?php _e('Path to GM files:') ?&gt;&lt;/label&gt;&lt;/td&gt;
+&lt;td&gt;&lt;input type=&quot;text&quot; style=&quot;width:300px&quot; name=&quot;gmpath&quot; id=&quot;gmpath&quot; value=&quot;/home/my/site/cgi-bin/greymatter/&quot; /&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
-&lt;td&gt;&lt;?php _e('Path to GM entries:') ?&gt;&lt;/td&gt;
-&lt;td&gt;&lt;input type=&quot;text&quot; style=&quot;width:300px&quot; name=&quot;archivespath&quot; value=&quot;/home/my/site/cgi-bin/greymatter/archives/&quot; /&gt;&lt;/td&gt;
+&lt;td&gt;&lt;label for=&quot;archivespath&quot;&gt;&lt;?php _e('Path to GM entries:') ?&gt;&lt;/label&gt;&lt;/td&gt;
+&lt;td&gt;&lt;input type=&quot;text&quot; style=&quot;width:300px&quot; name=&quot;archivespath&quot; id=&quot;archivespath&quot; value=&quot;/home/my/site/cgi-bin/greymatter/archives/&quot; /&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
-&lt;td&gt;&lt;?php _e(&quot;Last entry's number:&quot;) ?&gt;&lt;/td&gt;
-&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;lastentry&quot; value=&quot;00000001&quot; /&gt;&lt;br /&gt;
+&lt;td&gt;&lt;label for=&quot;lastentry&quot;&gt;&lt;?php _e(&quot;Last entry's number:&quot;) ?&gt;&lt;/label&gt;&lt;/td&gt;
+&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;lastentry&quot; id=&quot;lastentry&quot; value=&quot;00000001&quot; /&gt;&lt;br /&gt;
 	&lt;?php _e(&quot;This importer will search for files 00000001.cgi to 000-whatever.cgi,&lt;br /&gt;so you need to enter the number of the last GM post here.&lt;br /&gt;(if you don't know that number, just log into your FTP and look it out&lt;br /&gt;in the entries' folder)&quot;) ?&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/table&gt;</diff>
      <filename>wp-admin/import/greymatter.php</filename>
    </modified>
    <modified>
      <diff>@@ -166,9 +166,9 @@ class MT_Import {
 		$j = -1;
 		foreach ($authors as $author) {
 			++ $j;
-			echo '&lt;li&gt;'.__('Current author:').' &lt;strong&gt;'.$author.'&lt;/strong&gt;&lt;br /&gt;'.sprintf(__('Create user %1$s or map to existing'), ' &lt;input type=&quot;text&quot; value=&quot;'.$author.'&quot; name=&quot;'.'user[]'.'&quot; maxlength=&quot;30&quot;&gt; &lt;br /&gt;');
+			echo '&lt;li&gt;&lt;label&gt;'.__('Current author:').' &lt;strong&gt;'.$author.'&lt;/strong&gt;&lt;br /&gt;'.sprintf(__('Create user %1$s or map to existing'), ' &lt;input type=&quot;text&quot; value=&quot;'.$author.'&quot; name=&quot;'.'user[]'.'&quot; maxlength=&quot;30&quot;&gt; &lt;br /&gt;');
 			$this-&gt;users_form($j);
-			echo '&lt;/li&gt;';
+			echo '&lt;/label&gt;&lt;/li&gt;';
 		}
 
 		echo '&lt;input type=&quot;submit&quot; value=&quot;'.__('Submit').'&quot;&gt;'.'&lt;br /&gt;';
@@ -179,7 +179,7 @@ class MT_Import {
 
 	function select_authors() {
 		if ( $_POST['upload_type'] === 'ftp' ) {
-			$file['file'] = ABSPATH . 'wp-content/mt-export.txt';
+			$file['file'] = WP_CONTENT_DIR . '/mt-export.txt';
 			if ( !file_exists($file['file']) )
 				$file['error'] = __('&lt;code&gt;mt-export.txt&lt;/code&gt; does not exist');
 		} else {
@@ -335,7 +335,7 @@ class MT_Import {
 				else if ( 'ping' == $context )
 					$ping-&gt;title = $title;
 			} else if ( 0 === strpos($line, &quot;STATUS:&quot;) ) {
-				$status = trim( substr($line, strlen(&quot;STATUS:&quot;)) );
+				$status = trim( strtolower( substr($line, strlen(&quot;STATUS:&quot;)) ) );
 				if ( empty($status) )
 					$status = 'publish';
 				$post-&gt;post_status = $status;
@@ -426,7 +426,7 @@ class MT_Import {
 	function import() {
 		$this-&gt;id = (int) $_GET['id'];
 		if ( $this-&gt;id == 0 )
-			$this-&gt;file = ABSPATH . 'wp-content/mt-export.txt';
+			$this-&gt;file = WP_CONTENT_DIR . '/mt-export.txt';
 		else
 			$this-&gt;file = get_attached_file($this-&gt;id);
 		$this-&gt;get_authors_from_post();</diff>
      <filename>wp-admin/import/mt.php</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@ if(!function_exists('get_comment_count'))
 	function get_comment_count($post_ID)
 	{
 		global $wpdb;
-		return $wpdb-&gt;get_var('SELECT count(*) FROM '.$wpdb-&gt;comments.' WHERE comment_post_ID = '.$post_ID);
+		return $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT count(*) FROM $wpdb-&gt;comments WHERE comment_post_ID = %d&quot;, $post_ID) );
 	}
 }
 
@@ -17,7 +17,7 @@ if(!function_exists('link_exists'))
 	function link_exists($linkname)
 	{
 		global $wpdb;
-		return $wpdb-&gt;get_var('SELECT link_id FROM '.$wpdb-&gt;links.' WHERE link_name = &quot;'.$wpdb-&gt;escape($linkname).'&quot;');
+		return $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT link_id FROM $wpdb-&gt;links WHERE link_name = %s&quot;, $linkname) );
 	}
 }
 </diff>
      <filename>wp-admin/import/textpattern.php</filename>
    </modified>
    <modified>
      <diff>@@ -218,7 +218,7 @@ class WP_Import {
 	function users_form($n, $author) {
 
 		if ( $this-&gt;allow_create_users() ) {
-			printf(__('Create user %1$s or map to existing'), ' &lt;input type=&quot;text&quot; value=&quot;'.$author.'&quot; name=&quot;'.'user_create['.intval($n).']'.'&quot; maxlength=&quot;30&quot;&gt; &lt;br /&gt;');
+			printf('&lt;label&gt;'.__('Create user %1$s or map to existing'), ' &lt;input type=&quot;text&quot; value=&quot;'.$author.'&quot; name=&quot;'.'user_create['.intval($n).']'.'&quot; maxlength=&quot;30&quot;&gt;&lt;/label&gt; &lt;br /&gt;');
 		}
 		else {
 			echo __('Map to existing').'&lt;br /&gt;';
@@ -357,6 +357,11 @@ class WP_Import {
 		$guid           = $this-&gt;get_tag( $post, 'guid' );
 		$post_author    = $this-&gt;get_tag( $post, 'dc:creator' );
 
+		$post_excerpt = $this-&gt;get_tag( $post, 'excerpt:encoded' );
+		$post_excerpt = preg_replace('|&lt;(/?[A-Z]+)|e', &quot;'&lt;' . strtolower('$1')&quot;, $post_excerpt);
+		$post_excerpt = str_replace('&lt;br&gt;', '&lt;br /&gt;', $post_excerpt);
+		$post_excerpt = str_replace('&lt;hr&gt;', '&lt;hr /&gt;', $post_excerpt);
+
 		$post_content = $this-&gt;get_tag( $post, 'content:encoded' );
 		$post_content = preg_replace('|&lt;(/?[A-Z]+)|e', &quot;'&lt;' . strtolower('$1')&quot;, $post_content);
 		$post_content = str_replace('&lt;br&gt;', '&lt;br /&gt;', $post_content);
@@ -404,7 +409,7 @@ class WP_Import {
 
 			$post_author = $this-&gt;checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
 
-			$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent', 'menu_order', 'post_type', 'post_password');
+			$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_excerpt', 'post_title', 'post_status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent', 'menu_order', 'post_type', 'post_password');
 			if ($post_type == 'attachment') {
 				$remote_url = $this-&gt;get_tag( $post, 'wp:attachment_url' );
 				if ( !$remote_url )</diff>
      <filename>wp-admin/import/wordpress.php</filename>
    </modified>
    <modified>
      <diff>@@ -3,50 +3,71 @@
 class WP_Categories_to_Tags {
 	var $categories_to_convert = array();
 	var $all_categories = array();
+	var $tags_to_convert = array();
+	var $all_tags = array();
+	var $hybrids_ids = array();
 
 	function header() {
 		echo '&lt;div class=&quot;wrap&quot;&gt;';
-		echo '&lt;h2&gt;' . __('Convert Categories to Tags') . '&lt;/h2&gt;';
+		if ( ! current_user_can('manage_categories') ) {
+			echo '&lt;div class=&quot;narrow&quot;&gt;';
+			echo '&lt;p&gt;' . __('Cheatin&amp;#8217; uh?') . '&lt;/p&gt;';
+			echo '&lt;/div&gt;';
+		} else { ?&gt;
+			&lt;div class=&quot;tablenav&quot;&gt;&lt;p style=&quot;margin:4px&quot;&gt;&lt;a style=&quot;display:inline;&quot; class=&quot;button-secondary&quot; href=&quot;admin.php?import=wp-cat2tag&quot;&gt;&lt;?php _e( &quot;Categories to Tags&quot; ); ?&gt;&lt;/a&gt;
+			&lt;a style=&quot;display:inline;&quot; class=&quot;button-secondary&quot; href=&quot;admin.php?import=wp-cat2tag&amp;amp;step=3&quot;&gt;&lt;?php _e( &quot;Tags to Categories&quot; ); ?&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;?php	}
 	}
 
 	function footer() {
 		echo '&lt;/div&gt;';
 	}
 
-	function populate_all_categories() {
-		global $wpdb;
+	function populate_cats() {
 
 		$categories = get_categories('get=all');
 		foreach ( $categories as $category ) {
-			if ( !tag_exists($wpdb-&gt;escape($category-&gt;name)) )
-				$this-&gt;all_categories[] = $category;
+			$this-&gt;all_categories[] = $category;
+			if ( is_term( $category-&gt;slug, 'post_tag' ) )
+				$this-&gt;hybrids_ids[] = $category-&gt;term_id;
+		}
+	}
+
+	function populate_tags() {
+
+		$tags = get_terms( array('post_tag'), 'get=all' );
+		foreach ( $tags as $tag ) {
+			$this-&gt;all_tags[] = $tag;
+			if ( is_term( $tag-&gt;slug, 'category' ) )
+				$this-&gt;hybrids_ids[] = $tag-&gt;term_id;
 		}
 	}
 
-	function welcome() {
-		$this-&gt;populate_all_categories();
+	function categories_tab() {
+		$this-&gt;populate_cats();
+		$cat_num = count($this-&gt;all_categories);
 
-		echo '&lt;div class=&quot;narrow&quot;&gt;';
+		echo '&lt;br class=&quot;clear&quot; /&gt;';
 
-		if (count($this-&gt;all_categories) &gt; 0) {
-			echo '&lt;p&gt;' . __('Hey there. Here you can selectively converts existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '&lt;/p&gt;';
-			echo '&lt;p&gt;' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '&lt;/p&gt;';
+		if ( $cat_num &gt; 0 ) {
+			echo '&lt;h2&gt;' . sprintf( __ngettext( 'Convert Category to Tag.', 'Convert Categories (%d) to Tags.', $cat_num ), $cat_num ) . '&lt;/h2&gt;';
+			echo '&lt;div class=&quot;narrow&quot;&gt;';
+			echo '&lt;p&gt;' . __('Hey there. Here you can selectively convert existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '&lt;/p&gt;';
+			echo '&lt;p&gt;' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '&lt;/p&gt;&lt;/div&gt;';
 
 			$this-&gt;categories_form();
 		} else {
 			echo '&lt;p&gt;'.__('You have no categories to convert!').'&lt;/p&gt;';
 		}
-
-		echo '&lt;/div&gt;';
 	}
 
-	function categories_form() {
-?&gt;
+	function categories_form() { ?&gt;
+
 &lt;script type=&quot;text/javascript&quot;&gt;
-&lt;!--
+/* &lt;![CDATA[ */
 var checkflag = &quot;false&quot;;
 function check_all_rows() {
-	field = document.formlist;
+	field = document.catlist;
 	if ( 'false' == checkflag ) {
 		for ( i = 0; i &lt; field.length; i++ ) {
 			if ( 'cats_to_convert[]' == field[i].name )
@@ -63,54 +84,117 @@ function check_all_rows() {
 		return '&lt;?php _e('Check All') ?&gt;';
 	}
 }
-
-//  --&gt;
+/* ]]&gt; */
 &lt;/script&gt;
-&lt;?php
-		echo '&lt;form name=&quot;formlist&quot; id=&quot;formlist&quot; action=&quot;admin.php?import=wp-cat2tag&amp;amp;step=2&quot; method=&quot;post&quot;&gt;
-		&lt;p&gt;&lt;input type=&quot;button&quot; class=&quot;button-secondary&quot; value=&quot;' . __('Check All') . '&quot;' . ' onClick=&quot;this.value=check_all_rows()&quot;&gt;&lt;/p&gt;';
-		wp_nonce_field('import-cat2tag');
-		echo '&lt;ul style=&quot;list-style:none&quot;&gt;';
 
-		$hier = _get_term_hierarchy('category');
+&lt;form name=&quot;catlist&quot; id=&quot;catlist&quot; action=&quot;admin.php?import=wp-cat2tag&amp;amp;step=2&quot; method=&quot;post&quot;&gt;
+&lt;p&gt;&lt;input type=&quot;button&quot; class=&quot;button-secondary&quot; value=&quot;&lt;?php _e('Check All'); ?&gt;&quot; onclick=&quot;this.value=check_all_rows()&quot; /&gt;
+&lt;?php wp_nonce_field('import-cat2tag'); ?&gt;&lt;/p&gt;
+&lt;ul style=&quot;list-style:none&quot;&gt;
+
+&lt;?php	$hier = _get_term_hierarchy('category');
 
 		foreach ($this-&gt;all_categories as $category) {
 			$category = sanitize_term( $category, 'category', 'display' );
 
-			if ((int) $category-&gt;parent == 0) {
-				echo '&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;cats_to_convert[]&quot; value=&quot;' . intval($category-&gt;term_id) . '&quot; /&gt; ' . $category-&gt;name . ' (' . $category-&gt;count . ')&lt;/label&gt;';
+			if ( (int) $category-&gt;parent == 0 ) { ?&gt;
 
-				if (isset($hier[$category-&gt;term_id])) {
-					$this-&gt;_category_children($category, $hier);
-				}
+	&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;cats_to_convert[]&quot; value=&quot;&lt;?php echo intval($category-&gt;term_id); ?&gt;&quot; /&gt; &lt;?php echo $category-&gt;name . ' (' . $category-&gt;count . ')'; ?&gt;&lt;/label&gt;&lt;?php
 
-				echo '&lt;/li&gt;';
-			}
-		}
+				 if ( in_array( intval($category-&gt;term_id),  $this-&gt;hybrids_ids ) )
+				 	echo ' &lt;a href=&quot;#note&quot;&gt; * &lt;/a&gt;';
+				
+				if ( isset($hier[$category-&gt;term_id]) )
+					$this-&gt;_category_children($category, $hier); ?&gt;&lt;/li&gt;
+&lt;?php		}
+		} ?&gt;
+&lt;/ul&gt;
 
-		echo '&lt;/ul&gt;';
+&lt;?php	if ( ! empty($this-&gt;hybrids_ids) )
+			echo '&lt;p&gt;&lt;a name=&quot;note&quot;&gt;&lt;/a&gt;' . __('* This category is also a tag. Converting it will add that tag to all posts that are currently in the category.') . '&lt;/p&gt;'; ?&gt;
 
-		echo '&lt;p class=&quot;submit&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;submit&quot; class=&quot;button&quot; value=&quot;' . __('Convert Tags') . '&quot; /&gt;&lt;/p&gt;';
+&lt;p class=&quot;submit&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;submit&quot; class=&quot;button&quot; value=&quot;&lt;?php _e('Convert Categories to Tags'); ?&gt;&quot; /&gt;&lt;/p&gt;
+&lt;/form&gt;
 
-		echo '&lt;/form&gt;';
-	}
+&lt;?php }
 
-	function _category_children($parent, $hier) {
-		echo '&lt;ul style=&quot;list-style:none&quot;&gt;';
+	function tags_tab() {
+		$this-&gt;populate_tags();
+		$tags_num = count($this-&gt;all_tags);
 
-		foreach ($hier[$parent-&gt;term_id] as $child_id) {
-			$child =&amp; get_category($child_id);
+		echo '&lt;br class=&quot;clear&quot; /&gt;';
 
-			echo '&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;cats_to_convert[]&quot; value=&quot;' . intval($child-&gt;term_id) . '&quot; /&gt; ' . $child-&gt;name . ' (' . $child-&gt;count . ')&lt;/label&gt;';
+		if ( $tags_num &gt; 0 ) {
+			echo '&lt;h2&gt;' . sprintf( __ngettext( 'Convert Tag to Category.', 'Convert Tags (%d) to Categories.', $tags_num ), $tags_num ) . '&lt;/h2&gt;';
+			echo '&lt;div class=&quot;narrow&quot;&gt;';
+			echo '&lt;p&gt;' . __('Here you can selectively converts existing tags to categories. To get started, check the tags you wish to be converted, then click the Convert button.') . '&lt;/p&gt;';
+			echo '&lt;p&gt;' . __('The newly created categories will still be associated with the same posts.') . '&lt;/p&gt;&lt;/div&gt;';
 
-			if (isset($hier[$child-&gt;term_id])) {
-				$this-&gt;_category_children($child, $hier);
-			}
+			$this-&gt;tags_form();
+		} else {
+			echo '&lt;p&gt;'.__('You have no tags to convert!').'&lt;/p&gt;';
+		}
+	}
+
+	function tags_form() { ?&gt;
 
-			echo '&lt;/li&gt;';
+&lt;script type=&quot;text/javascript&quot;&gt;
+/* &lt;![CDATA[ */
+var checktags = &quot;false&quot;;
+function check_all_tagrows() {
+	field = document.taglist;
+	if ( 'false' == checktags ) {
+		for ( i = 0; i &lt; field.length; i++ ) {
+			if ( 'tags_to_convert[]' == field[i].name )
+				field[i].checked = true;
 		}
+		checktags = 'true';
+		return '&lt;?php _e('Uncheck All') ?&gt;';
+	} else {
+		for ( i = 0; i &lt; field.length; i++ ) {
+			if ( 'tags_to_convert[]' == field[i].name )
+				field[i].checked = false;
+		}
+		checktags = 'false';
+		return '&lt;?php _e('Check All') ?&gt;';
+	}
+}
+/* ]]&gt; */
+&lt;/script&gt;
 
-		echo '&lt;/ul&gt;';
+&lt;form name=&quot;taglist&quot; id=&quot;taglist&quot; action=&quot;admin.php?import=wp-cat2tag&amp;amp;step=4&quot; method=&quot;post&quot;&gt;
+&lt;p&gt;&lt;input type=&quot;button&quot; class=&quot;button-secondary&quot; value=&quot;&lt;?php _e('Check All'); ?&gt;&quot; onclick=&quot;this.value=check_all_tagrows()&quot; /&gt;
+&lt;?php wp_nonce_field('import-cat2tag'); ?&gt;&lt;/p&gt;
+&lt;ul style=&quot;list-style:none&quot;&gt;
+
+&lt;?php	foreach ( $this-&gt;all_tags as $tag ) { ?&gt;
+	&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;tags_to_convert[]&quot; value=&quot;&lt;?php echo intval($tag-&gt;term_id); ?&gt;&quot; /&gt; &lt;?php echo attribute_escape($tag-&gt;name) . ' (' . $tag-&gt;count . ')'; ?&gt;&lt;/label&gt;&lt;?php if ( in_array( intval($tag-&gt;term_id),  $this-&gt;hybrids_ids ) ) echo ' &lt;a href=&quot;#note&quot;&gt; * &lt;/a&gt;'; ?&gt;&lt;/li&gt;
+
+&lt;?php	} ?&gt;
+&lt;/ul&gt;
+
+&lt;?php	if ( ! empty($this-&gt;hybrids_ids) )
+			echo '&lt;p&gt;&lt;a name=&quot;note&quot;&gt;&lt;/a&gt;' . __('* This tag is also a category. When converted, all posts associated with the tag will also be in the category.') . '&lt;/p&gt;'; ?&gt;
+
+&lt;p class=&quot;submit&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;submit_tags&quot; class=&quot;button&quot; value=&quot;&lt;?php _e('Convert Tags to Categories'); ?&gt;&quot; /&gt;&lt;/p&gt;
+&lt;/form&gt;
+
+&lt;?php }
+
+	function _category_children($parent, $hier) { ?&gt;
+
+		&lt;ul style=&quot;list-style:none&quot;&gt;
+&lt;?php	foreach ($hier[$parent-&gt;term_id] as $child_id) {
+			$child =&amp; get_category($child_id); ?&gt;
+		&lt;li&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;cats_to_convert[]&quot; value=&quot;&lt;?php echo intval($child-&gt;term_id); ?&gt;&quot; /&gt; &lt;?php echo $child-&gt;name . ' (' . $child-&gt;count . ')'; ?&gt;&lt;/label&gt;&lt;?php
+
+			if ( in_array( intval($child-&gt;term_id), $this-&gt;hybrids_ids ) )
+				echo ' &lt;a href=&quot;#note&quot;&gt; * &lt;/a&gt;';
+
+			if ( isset($hier[$child-&gt;term_id]) )
+				$this-&gt;_category_children($child, $hier); ?&gt;&lt;/li&gt;
+&lt;?php	} ?&gt;
+		&lt;/ul&gt;&lt;?php
 	}
 
 	function _category_exists($cat_id) {
@@ -125,101 +209,238 @@ function check_all_rows() {
 		}
 	}
 
-	function convert_them() {
+	function convert_categories() {
 		global $wpdb;
 
-		if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) &amp;&amp; empty($this-&gt;categories_to_convert)) {
-			echo '&lt;div class=&quot;narrow&quot;&gt;';
-			echo '&lt;p&gt;' . sprintf(__('Uh, oh. Something didn&amp;#8217;t work. Please &lt;a href=&quot;%s&quot;&gt;try again&lt;/a&gt;.'), 'admin.php?import=wp-cat2tag') . '&lt;/p&gt;';
-			echo '&lt;/div&gt;';
-			return;
+		if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) &amp;&amp; empty($this-&gt;categories_to_convert)) { ?&gt;
+			&lt;div class=&quot;narrow&quot;&gt;
+			&lt;p&gt;&lt;?php printf(__('Uh, oh. Something didn&amp;#8217;t work. Please &lt;a href=&quot;%s&quot;&gt;try again&lt;/a&gt;.'), 'admin.php?import=wp-cat2tag'); ?&gt;&lt;/p&gt;
+			&lt;/div&gt;
+&lt;?php		return;
 		}
 
-
 		if ( empty($this-&gt;categories_to_convert) )
 			$this-&gt;categories_to_convert = $_POST['cats_to_convert'];
+
 		$hier = _get_term_hierarchy('category');
+		$hybrid_cats = $clear_parents = $parents = false;
+		$clean_term_cache = $clean_cat_cache = array();
+		$default_cat = get_option('default_category');
 
 		echo '&lt;ul&gt;';
 
 		foreach ( (array) $this-&gt;categories_to_convert as $cat_id) {
 			$cat_id = (int) $cat_id;
 
-			echo '&lt;li&gt;' . sprintf(__('Converting category #%s ... '),  $cat_id);
-
-			if (!$this-&gt;_category_exists($cat_id)) {
-				_e('Category doesn\'t exist!');
+			if ( ! $this-&gt;_category_exists($cat_id) ) {
+				echo '&lt;li&gt;' . sprintf( __('Category %s doesn\'t exist!'),  $cat_id ) . &quot;&lt;/li&gt;\n&quot;;
 			} else {
 				$category =&amp; get_category($cat_id);
-
-				if ( tag_exists($wpdb-&gt;escape($category-&gt;name)) ) {
-					_e('Category is already a tag.');
-					echo '&lt;/li&gt;';
-					continue;
-				}
+				echo '&lt;li&gt;' . sprintf(__('Converting category &lt;strong&gt;%s&lt;/strong&gt; ... '),  $category-&gt;name);
 
 				// If the category is the default, leave category in place and create tag.
-				if ( get_option('default_category') == $category-&gt;term_id ) {
-					$id = wp_insert_term($category-&gt;name, 'post_tag', array('slug' =&gt; $category-&gt;slug));
+				if ( $default_cat == $category-&gt;term_id ) {
+
+					if ( ! ($id = is_term( $category-&gt;slug, 'post_tag' ) ) )
+						$id = wp_insert_term($category-&gt;name, 'post_tag', array('slug' =&gt; $category-&gt;slug));
+					
 					$id = $id['term_taxonomy_id'];
 					$posts = get_objects_in_term($category-&gt;term_id, 'category');
+					$term_order = 0;
+
 					foreach ( $posts as $post ) {
-						if ( !$wpdb-&gt;get_var(&quot;SELECT object_id FROM $wpdb-&gt;term_relationships WHERE object_id = '$post' AND term_taxonomy_id = '$id'&quot;) )
-							$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_relationships (object_id, term_taxonomy_id) VALUES ('$post', '$id')&quot;);
+						$values[] = $wpdb-&gt;prepare( &quot;(%d, %d, %d)&quot;, $post, $id, $term_order);
 						clean_post_cache($post);
 					}
-				} else {
-					$tt_ids = $wpdb-&gt;get_col(&quot;SELECT term_taxonomy_id FROM $wpdb-&gt;term_taxonomy WHERE term_id = '{$category-&gt;term_id}' AND taxonomy = 'category'&quot;);
-					if ( $tt_ids ) {
-						$posts = $wpdb-&gt;get_col(&quot;SELECT object_id FROM $wpdb-&gt;term_relationships WHERE term_taxonomy_id IN (&quot; . join(',', $tt_ids) . &quot;) GROUP BY object_id&quot;);
-						foreach ( (array) $posts as $post )
-							clean_post_cache($post);
+					
+					if ( $values ) {
+						$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_relationships (object_id, term_taxonomy_id, term_order) VALUES &quot; . join(',', $values) . &quot; ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)&quot;);
+
+						$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'&quot;, $category-&gt;count, $category-&gt;term_id) );
+					}
+
+					echo __('Converted successfully.') . &quot;&lt;/li&gt;\n&quot;;
+					continue;
+				}
+				
+				// if tag already exists, add it to all posts in the category
+				if ( $tag_ttid = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT term_taxonomy_id FROM $wpdb-&gt;term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'&quot;, $category-&gt;term_id) ) ) {
+					$objects_ids = get_objects_in_term($category-&gt;term_id, 'category');
+					$tag_ttid = (int) $tag_ttid;
+					$term_order = 0;
+
+					foreach ( $objects_ids as $object_id )
+						$values[] = $wpdb-&gt;prepare( &quot;(%d, %d, %d)&quot;, $object_id, $tag_ttid, $term_order);
+
+					if ( $values ) {
+						$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_relationships (object_id, term_taxonomy_id, term_order) VALUES &quot; . join(',', $values) . &quot; ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)&quot;);
+
+						$count = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT COUNT(*) FROM $wpdb-&gt;term_relationships WHERE term_taxonomy_id = %d&quot;, $tag_ttid) );
+						$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'&quot;, $count, $category-&gt;term_id) );
 					}
+					echo __('Tag added to all posts in this category.') . &quot; *&lt;/li&gt;\n&quot;;
 
-					// Change the category to a tag.
-					$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = '{$category-&gt;term_id}' AND taxonomy = 'category'&quot;);
+					$hybrid_cats = true;
+					$clean_term_cache[] = $category-&gt;term_id;
+					$clean_cat_cache[] = $category-&gt;term_id;
 
-					$terms = $wpdb-&gt;get_col(&quot;SELECT term_id FROM $wpdb-&gt;term_taxonomy WHERE parent = '{$category-&gt;term_id}' AND taxonomy = 'category'&quot;);
-					foreach ( (array) $terms as $term )
-						clean_category_cache($term);
+					continue;
+				}
 
-					// Set all parents to 0 (root-level) if their parent was the converted tag
-					$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;term_taxonomy SET parent = 0 WHERE parent = '{$category-&gt;term_id}' AND taxonomy = 'category'&quot;);
+				$tt_ids = $wpdb-&gt;get_col( $wpdb-&gt;prepare(&quot;SELECT term_taxonomy_id FROM $wpdb-&gt;term_taxonomy WHERE term_id = %d AND taxonomy = 'category'&quot;, $category-&gt;term_id) );
+				if ( $tt_ids ) {
+					$posts = $wpdb-&gt;get_col(&quot;SELECT object_id FROM $wpdb-&gt;term_relationships WHERE term_taxonomy_id IN (&quot; . join(',', $tt_ids) . &quot;) GROUP BY object_id&quot;);
+					foreach ( (array) $posts as $post )
+						clean_post_cache($post);
 				}
-				// Clean the cache
-				clean_category_cache($category-&gt;term_id);
 
-				_e('Converted successfully.');
+				// Change the category to a tag.
+				$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = %d AND taxonomy = 'category'&quot;, $category-&gt;term_id) );
+
+				// Set all parents to 0 (root-level) if their parent was the converted tag
+				$parents = $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;term_taxonomy SET parent = 0 WHERE parent = %d AND taxonomy = 'category'&quot;, $category-&gt;term_id) );
+
+				if ( $parents ) $clear_parents = true;
+				$clean_cat_cache[] = $category-&gt;term_id;
+				echo __('Converted successfully.') . &quot;&lt;/li&gt;\n&quot;;
 			}
+		}
+		echo '&lt;/ul&gt;';
 
-			echo '&lt;/li&gt;';
+		if ( ! empty($clean_term_cache) ) {
+			$clean_term_cache = array_unique(array_values($clean_term_cache));
+			foreach ( $clean_term_cache as $id )
+				wp_cache_delete($id, 'post_tag');
 		}
 
-		echo '&lt;/ul&gt;';
+		if ( ! empty($clean_cat_cache) ) {
+			$clean_cat_cache = array_unique(array_values($clean_cat_cache));
+			foreach ( $clean_cat_cache as $id )
+				wp_cache_delete($id, 'category');
+		}
+
+		if ( $clear_parents ) delete_option('category_children');
+
+		if ( $hybrid_cats )
+			echo '&lt;p&gt;' . sprintf( __('* This category is also a tag. The converter has added that tag to all posts currently in the category. If you want to remove it, please confirm that all tags were added successfully, then delete it from the &lt;a href=&quot;%s&quot;&gt;Manage Categories&lt;/a&gt; page.'), 'categories.php') . '&lt;/p&gt;';
 		echo '&lt;p&gt;' . sprintf( __('We&amp;#8217;re all done here, but you can always &lt;a href=&quot;%s&quot;&gt;convert more&lt;/a&gt;.'), 'admin.php?import=wp-cat2tag' ) . '&lt;/p&gt;';
 	}
 
+	function convert_tags() {
+		global $wpdb;
+
+		if ( (!isset($_POST['tags_to_convert']) || !is_array($_POST['tags_to_convert'])) &amp;&amp; empty($this-&gt;tags_to_convert)) {
+			echo '&lt;div class=&quot;narrow&quot;&gt;';
+			echo '&lt;p&gt;' . sprintf(__('Uh, oh. Something didn&amp;#8217;t work. Please &lt;a href=&quot;%s&quot;&gt;try again&lt;/a&gt;.'), 'admin.php?import=wp-cat2tag&amp;amp;step=3') . '&lt;/p&gt;';
+			echo '&lt;/div&gt;';
+			return;
+		}
+
+		if ( empty($this-&gt;tags_to_convert) )
+			$this-&gt;tags_to_convert = $_POST['tags_to_convert'];
+
+		$hybrid_tags = $clear_parents = false;
+		$clean_cat_cache = $clean_term_cache = array();
+		$default_cat = get_option('default_category');
+		echo '&lt;ul&gt;';
+
+		foreach ( (array) $this-&gt;tags_to_convert as $tag_id) {
+			$tag_id = (int) $tag_id;
+
+			if ( $tag = get_term( $tag_id, 'post_tag' ) ) {
+				printf('&lt;li&gt;' . __('Converting tag &lt;strong&gt;%s&lt;/strong&gt; ... '),  $tag-&gt;name);
+
+				if ( $cat_ttid = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT term_taxonomy_id FROM $wpdb-&gt;term_taxonomy WHERE term_id = %d AND taxonomy = 'category'&quot;, $tag-&gt;term_id) ) ) {
+					$objects_ids = get_objects_in_term($tag-&gt;term_id, 'post_tag');
+					$cat_ttid = (int) $cat_ttid;
+					$term_order = 0;
+
+					foreach ( $objects_ids as $object_id ) {
+						$values[] = $wpdb-&gt;prepare( &quot;(%d, %d, %d)&quot;, $object_id, $cat_ttid, $term_order);
+						clean_post_cache($object_id);
+					}
+
+					if ( $values ) {
+						$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_relationships (object_id, term_taxonomy_id, term_order) VALUES &quot; . join(',', $values) . &quot; ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)&quot;);
+
+						if ( $default_cat != $tag-&gt;term_id ) {
+							$count = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT COUNT(*) FROM $wpdb-&gt;term_relationships WHERE term_taxonomy_id = %d&quot;, $tag-&gt;term_id) );
+							$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'category'&quot;, $count, $tag-&gt;term_id) );
+						}
+					}
+
+					$hybrid_tags = true;
+					$clean_term_cache[] = $tag-&gt;term_id;
+					$clean_cat_cache[] = $tag-&gt;term_id;
+					echo __('All posts were added to the category with the same name.') . &quot; *&lt;/li&gt;\n&quot;;
+
+					continue;
+				}
+
+				// Change the tag to a category.
+				$parent = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT parent FROM $wpdb-&gt;term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'&quot;, $tag-&gt;term_id) );
+				if ( 0 == $parent || (0 &lt; (int) $parent &amp;&amp; $this-&gt;_category_exists($parent)) ) {
+					$reset_parent = '';
+					$clear_parents = true;
+				} else
+					$reset_parent = &quot;, parent = '0'&quot;;
+
+				$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;term_taxonomy SET taxonomy = 'category' $reset_parent WHERE term_id = %d AND taxonomy = 'post_tag'&quot;, $tag-&gt;term_id) );
+
+				$clean_term_cache[] = $tag-&gt;term_id;
+				$clean_cat_cache[] = $cat['term_id'];
+				echo __('Converted successfully.') . &quot;&lt;/li&gt;\n&quot;;
+
+			} else {
+				printf( '&lt;li&gt;' . __('Tag #%s doesn\'t exist!') . &quot;&lt;/li&gt;\n&quot;,  $tag_id );
+			}
+		}
+
+		if ( ! empty($clean_term_cache) ) {
+			$clean_term_cache = array_unique(array_values($clean_term_cache));
+			foreach ( $clean_term_cache as $id )
+				wp_cache_delete($id, 'post_tag');
+		}
+
+		if ( ! empty($clean_cat_cache) ) {
+			$clean_cat_cache = array_unique(array_values($clean_cat_cache));
+			foreach ( $clean_cat_cache as $id )
+				wp_cache_delete($id, 'category');
+		}
+
+		if ( $clear_parents ) delete_option('category_children');
+
+		echo '&lt;/ul&gt;';
+		if ( $hybrid_tags )
+			echo '&lt;p&gt;' . sprintf( __('* This tag is also a category. The converter has added all posts from it to the category. If you want to remove it, please confirm that all posts were added successfully, then delete it from the &lt;a href=&quot;%s&quot;&gt;Manage Tags&lt;/a&gt; page.'), 'edit-tags.php') . '&lt;/p&gt;';
+		echo '&lt;p&gt;' . sprintf( __('We&amp;#8217;re all done here, but you can always &lt;a href=&quot;%s&quot;&gt;convert more&lt;/a&gt;.'), 'admin.php?import=wp-cat2tag&amp;amp;step=3' ) . '&lt;/p&gt;';
+	}
+
 	function init() {
 
 		$step = (isset($_GET['step'])) ? (int) $_GET['step'] : 1;
 
 		$this-&gt;header();
 
-		if (!current_user_can('manage_categories')) {
-			echo '&lt;div class=&quot;narrow&quot;&gt;';
-			echo '&lt;p&gt;' . __('Cheatin&amp;#8217; uh?') . '&lt;/p&gt;';
-			echo '&lt;/div&gt;';
-		} else {
-			if ( $step &gt; 1 )
-				check_admin_referer('import-cat2tag');
+		if ( current_user_can('manage_categories') ) {
 
 			switch ($step) {
 				case 1 :
-					$this-&gt;welcome();
+					$this-&gt;categories_tab();
 				break;
 
 				case 2 :
-					$this-&gt;convert_them();
+					check_admin_referer('import-cat2tag');
+					$this-&gt;convert_categories();
+				break;
+
+				case 3 :
+					$this-&gt;tags_tab();
+				break;
+
+				case 4 :
+					check_admin_referer('import-cat2tag');
+					$this-&gt;convert_tags();
 				break;
 			}
 		}
@@ -234,6 +455,6 @@ function check_all_rows() {
 
 $wp_cat2tag_importer = new WP_Categories_to_Tags();
 
-register_importer('wp-cat2tag', __('Categories to Tags Converter'), __('Convert existing categories to tags, selectively.'), array(&amp;$wp_cat2tag_importer, 'init'));
+register_importer('wp-cat2tag', __('Categories and Tags Converter'), __('Convert existing categories to tags or tags to categories, selectively.'), array(&amp;$wp_cat2tag_importer, 'init'));
 
-?&gt;
\ No newline at end of file
+?&gt;</diff>
      <filename>wp-admin/import/wp-cat2tag.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,5 @@
 &lt;?php
 
-if ( !defined( 'AUTOSAVE_INTERVAL' ) )
-	define( 'AUTOSAVE_INTERVAL', 60 );
-
 require_once(ABSPATH . 'wp-admin/includes/bookmark.php');
 require_once(ABSPATH . 'wp-admin/includes/comment.php');
 require_once(ABSPATH . 'wp-admin/includes/file.php');</diff>
      <filename>wp-admin/includes/admin.php</filename>
    </modified>
    <modified>
      <diff>@@ -47,7 +47,7 @@ function wp_delete_link($link_id) {
 
 	wp_delete_object_term_relationships($link_id, 'link_category');
 
-	$wpdb-&gt;query(&quot;DELETE FROM $wpdb-&gt;links WHERE link_id = '$link_id'&quot;);
+	$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;links WHERE link_id = %d&quot;, $link_id) );
 
 	do_action('deleted_link', $link_id);
 
@@ -73,7 +73,7 @@ function wp_insert_link($linkdata) {
 	$linkdata = wp_parse_args($linkdata, $defaults);
 	$linkdata = sanitize_bookmark($linkdata, 'db');
 
-	extract($linkdata, EXTR_SKIP);
+	extract(stripslashes_deep($linkdata), EXTR_SKIP);
 
 	$update = false;
 
@@ -119,15 +119,14 @@ function wp_insert_link($linkdata) {
 	}
 
 	if ( $update ) {
-		$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;links SET link_url='$link_url',
-			link_name='$link_name', link_image='$link_image',
-			link_target='$link_target',
-			link_visible='$link_visible', link_description='$link_description',
-			link_rating='$link_rating', link_rel='$link_rel',
-			link_notes='$link_notes', link_rss = '$link_rss'
-			WHERE link_id='$link_id'&quot;);
+		$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;links SET link_url = %s,
+			link_name = %s, link_image = %s, link_target = %s, 
+			link_visible = %s, link_description = %s, link_rating = %s, 
+			link_rel = %s, link_notes = %s, link_rss = %s
+			WHERE link_id = %s&quot;, $link_url, $link_name, $link_image, $link_target, $link_visible, $link_description, $link_rating, $link_rel, $link_notes, $link_rss, $link_id) );
 	} else {
-		$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')&quot;);
+		$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)&quot;, 
+		$link_url,$link_name, $link_image, $link_target, $link_description, $link_visible, $link_owner, $link_rating, $link_rel, $link_notes, $link_rss) );
 		$link_id = (int) $wpdb-&gt;insert_id;
 	}
 </diff>
      <filename>wp-admin/includes/bookmark.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,57 +1,55 @@
 &lt;?php
 
-class WP_Filesystem_Direct{
+class WP_Filesystem_Direct  extends WP_Filesystem_Base {
 	var $permission = null;
 	var $errors = array();
-	function WP_Filesystem_Direct($arg){
+	function WP_Filesystem_Direct($arg) {
+		$this-&gt;method = 'direct';
 		$this-&gt;errors = new WP_Error();
 		$this-&gt;permission = umask();
 	}
-	function connect(){
+	function connect() {
 		return true;
 	}
-	function setDefaultPermissions($perm){
+	function setDefaultPermissions($perm) {
 		$this-&gt;permission = $perm;
 	}
-	function find_base_dir($base = '.', $echo = false){
-		return str_replace('\\','/',ABSPATH);
-	}
-	function get_base_dir($base = '.', $echo = false){
-		return $this-&gt;find_base_dir($base, $echo);
-	}
-	function get_contents($file){
+	function get_contents($file) {
 		return @file_get_contents($file);
 	}
-	function get_contents_array($file){
+	function get_contents_array($file) {
 		return @file($file);
 	}
-	function put_contents($file,$contents,$mode=false,$type=''){
-		$fp=@fopen($file,'w'.$type);
-		if (!$fp)
+	function put_contents($file, $contents, $mode = false, $type = '') {
+		if ( ! ($fp = @fopen($file, 'w' . $type)) )
 			return false;
-		@fwrite($fp,$contents);
+		@fwrite($fp, $contents);
 		@fclose($fp);
 		$this-&gt;chmod($file,$mode);
 		return true;
 	}
-	function cwd(){
+	function cwd() {
 		return @getcwd();
 	}
-	function chgrp($file,$group,$recursive=false){
+	function chdir($dir) {
+		return @chdir($dir);
+	}
+	function chgrp($file, $group, $recursive = false) {
 		if( ! $this-&gt;exists($file) )
 			return false;
 		if( ! $recursive )
-			return @chgrp($file,$group);
+			return @chgrp($file, $group);
 		if( ! $this-&gt;is_dir($file) )
-			return @chgrp($file,$group);
+			return @chgrp($file, $group);
 		//Is a directory, and we want recursive
+		$file = trailingslashit($file);
 		$filelist = $this-&gt;dirlist($file);
-		foreach($filelist as $filename){
-			$this-&gt;chgrp($file.'/'.$filename,$group,$recursive);
-		}
+		foreach($filelist as $filename)
+			$this-&gt;chgrp($file . $filename, $group, $recursive);
+
 		return true;
 	}
-	function chmod($file,$mode=false,$recursive=false){
+	function chmod($file, $mode = false, $recursive = false) {
 		if( ! $mode )
 			$mode = $this-&gt;permission;
 		if( ! $this-&gt;exists($file) )
@@ -59,128 +57,60 @@ class WP_Filesystem_Direct{
 		if( ! $recursive )
 			return @chmod($file,$mode);
 		if( ! $this-&gt;is_dir($file) )
-			return @chmod($file,$mode);
+			return @chmod($file, $mode);
 		//Is a directory, and we want recursive
+		$file = trailingslashit($file);
 		$filelist = $this-&gt;dirlist($file);
-		foreach($filelist as $filename){
-			$this-&gt;chmod($file.'/'.$filename,$mode,$recursive);
-		}
+		foreach($filelist as $filename)
+			$this-&gt;chmod($file . $filename, $mode, $recursive);
+
 		return true;
 	}
-	function chown($file,$owner,$recursive=false){
+	function chown($file, $owner, $recursive = false) {
 		if( ! $this-&gt;exists($file) )
 			return false;
 		if( ! $recursive )
-			return @chown($file,$owner);
+			return @chown($file, $owner);
 		if( ! $this-&gt;is_dir($file) )
-			return @chown($file,$owner);
+			return @chown($file, $owner);
 		//Is a directory, and we want recursive
 		$filelist = $this-&gt;dirlist($file);
 		foreach($filelist as $filename){
-			$this-&gt;chown($file.'/'.$filename,$owner,$recursive);
+			$this-&gt;chown($file . '/' . $filename, $owner, $recursive);
 		}
 		return true;
 	}
-	function owner($file){
-		$owneruid=@fileowner($file);
+	function owner($file) {
+		$owneruid = @fileowner($file);
 		if( ! $owneruid )
 			return false;
-		if( !function_exists('posix_getpwuid') )
+		if( ! function_exists('posix_getpwuid') )
 			return $owneruid;
-		$ownerarray=posix_getpwuid($owneruid);
+		$ownerarray = posix_getpwuid($owneruid);
 		return $ownerarray['name'];
 	}
-	function getchmod($file){
+	function getchmod($file) {
 		return @fileperms($file);
 	}
-	function gethchmod($file){
-		//From the PHP.net page for ...?
-		$perms = $this-&gt;getchmod($file);
-		if (($perms &amp; 0xC000) == 0xC000) {
-			// Socket
-			$info = 's';
-		} elseif (($perms &amp; 0xA000) == 0xA000) {
-			// Symbolic Link
-			$info = 'l';
-		} elseif (($perms &amp; 0x8000) == 0x8000) {
-			// Regular
-			$info = '-';
-		} elseif (($perms &amp; 0x6000) == 0x6000) {
-			// Block special
-			$info = 'b';
-		} elseif (($perms &amp; 0x4000) == 0x4000) {
-			// Directory
-			$info = 'd';
-		} elseif (($perms &amp; 0x2000) == 0x2000) {
-			// Character special
-			$info = 'c';
-		} elseif (($perms &amp; 0x1000) == 0x1000) {
-			// FIFO pipe
-			$info = 'p';
-		} else {
-			// Unknown
-			$info = 'u';
-		}
-
-		// Owner
-		$info .= (($perms &amp; 0x0100) ? 'r' : '-');
-		$info .= (($perms &amp; 0x0080) ? 'w' : '-');
-		$info .= (($perms &amp; 0x0040) ?
-					(($perms &amp; 0x0800) ? 's' : 'x' ) :
-					(($perms &amp; 0x0800) ? 'S' : '-'));
-
-		// Group
-		$info .= (($perms &amp; 0x0020) ? 'r' : '-');
-		$info .= (($perms &amp; 0x0010) ? 'w' : '-');
-		$info .= (($perms &amp; 0x0008) ?
-					(($perms &amp; 0x0400) ? 's' : 'x' ) :
-					(($perms &amp; 0x0400) ? 'S' : '-'));
-
-		// World
-		$info .= (($perms &amp; 0x0004) ? 'r' : '-');
-		$info .= (($perms &amp; 0x0002) ? 'w' : '-');
-		$info .= (($perms &amp; 0x0001) ?
-					(($perms &amp; 0x0200) ? 't' : 'x' ) :
-					(($perms &amp; 0x0200) ? 'T' : '-'));
-		return $info;
-	}
-	function getnumchmodfromh($mode) {
-		$realmode = &quot;&quot;;
-		$legal =  array(&quot;&quot;,&quot;w&quot;,&quot;r&quot;,&quot;x&quot;,&quot;-&quot;);
-		$attarray = preg_split(&quot;//&quot;,$mode);
-		for($i=0;$i&lt;count($attarray);$i++){
-		   if($key = array_search($attarray[$i],$legal)){
-			   $realmode .= $legal[$key];
-		   }
-		}
-		$mode = str_pad($realmode,9,'-');
-		$trans = array('-'=&gt;'0','r'=&gt;'4','w'=&gt;'2','x'=&gt;'1');
-		$mode = strtr($mode,$trans);
-		$newmode = '';
-		$newmode .= $mode[0]+$mode[1]+$mode[2];
-		$newmode .= $mode[3]+$mode[4]+$mode[5];
-		$newmode .= $mode[6]+$mode[7]+$mode[8];
-		return $newmode;
-	}
-	function group($file){
-		$gid=@filegroup($file);
+	function group($file) {
+		$gid = @filegroup($file);
 		if( ! $gid )
 			return false;
-		if( !function_exists('posix_getgrgid') )
+		if( ! function_exists('posix_getgrgid') )
 			return $gid;
-		$grouparray=posix_getgrgid($gid);
+		$grouparray = posix_getgrgid($gid);
 		return $grouparray['name'];
 	}
 
-	function copy($source,$destination,$overwrite=false){
-		if( $overwrite &amp;&amp; $this-&gt;exists($destination) )
+	function copy($source, $destination, $overwrite = false) {
+		if( ! $overwrite &amp;&amp; $this-&gt;exists($destination) )
 			return false;
-		return copy($source,$destination);
+		return copy($source, $destination);
 	}
 
-	function move($source,$destination,$overwrite=false){
-		//Possible to use rename()
-		if( $this-&gt;copy($source,$destination,$overwrite) &amp;&amp; $this-&gt;exists($destination) ){
+	function move($source, $destination, $overwrite = false) {
+		//Possible to use rename()?
+		if( $this-&gt;copy($source, $destination, $overwrite) &amp;&amp; $this-&gt;exists($destination) ){
 			$this-&gt;delete($source);
 			return true;
 		} else {
@@ -188,96 +118,97 @@ class WP_Filesystem_Direct{
 		}
 	}
 
-	function delete($file,$recursive=false){
-		$file = str_replace('\\','/',$file); //for win32, occasional problems deleteing files otherwise
+	function delete($file, $recursive = false) {
+		$file = str_replace('\\', '/', $file); //for win32, occasional problems deleteing files otherwise
 
 		if( $this-&gt;is_file($file) )
 			return @unlink($file);
-
-		if( !$recursive &amp;&amp; $this-&gt;is_dir($file) )
+		if( ! $recursive &amp;&amp; $this-&gt;is_dir($file) )
 			return @rmdir($file);
 
-		$filelist = $this-&gt;dirlist($file);
-		if( ! $filelist )
-			return true; //No files exist, Say we've deleted them
+		//At this point its a folder, and we're in recursive mode
+		$file = trailingslashit($file);
+		$filelist = $this-&gt;dirlist($file, true);
 
 		$retval = true;
-		foreach($filelist as $filename=&gt;$fileinfo){
-			if( ! $this-&gt;delete($file.'/'.$filename,$recursive) )
-				$retval = false;
-		}
+		if( is_array($filelist) ) //false if no files, So check first.
+			foreach($filelist as $filename =&gt; $fileinfo)
+				if( ! $this-&gt;delete($file . $filename, $recursive) )
+					$retval = false;
+
 		if( ! @rmdir($file) )
 			return false;
 		return $retval;
 	}
 
-	function exists($file){
+	function exists($file) {
 		return @file_exists($file);
 	}
 
-	function is_file($file){
+	function is_file($file) {
 		return @is_file($file);
 	}
 
-	function is_dir($path){
+	function is_dir($path) {
 		return @is_dir($path);
 	}
 
-	function is_readable($file){
-			return @is_readable($file);
+	function is_readable($file) {
+		return @is_readable($file);
 	}
 
-	function is_writable($file){
+	function is_writable($file) {
 		return @is_writable($file);
 	}
 
-	function atime($file){
+	function atime($file) {
 		return @fileatime($file);
 	}
 
-	function mtime($file){
+	function mtime($file) {
 		return @filemtime($file);
 	}
-	function size($file){
+	function size($file) {
 		return @filesize($file);
 	}
 
-	function touch($file,$time=0,$atime=0){
-		if($time==0)
+	function touch($file, $time = 0, $atime = 0){
+		if($time == 0)
 			$time = time();
-		if($atime==0)
+		if($atime == 0)
 			$atime = time();
-		return @touch($file,$time,$atime);
+		return @touch($file, $time, $atime);
 	}
 
-	function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
+	function mkdir($path, $chmod = false, $chown = false, $chgrp = false){
 		if( ! $chmod)
 			$chmod = $this-&gt;permission;
 
-		if( !@mkdir($path,$chmod) )
+		if( ! @mkdir($path, $chmod) )
 			return false;
 		if( $chown )
-			$this-&gt;chown($path,$chown);
+			$this-&gt;chown($path, $chown);
 		if( $chgrp )
-			$this-&gt;chgrp($path,$chgrp);
+			$this-&gt;chgrp($path, $chgrp);
 		return true;
 	}
 
-	function rmdir($path,$recursive=false){
+	function rmdir($path, $recursive = false) {
+		//Currently unused and untested, Use delete() instead.
 		if( ! $recursive )
 			return @rmdir($path);
 		//recursive:
 		$filelist = $this-&gt;dirlist($path);
-		foreach($filelist as $filename=&gt;$det){
-			if ( '/' == substr($filename,-1,1) )
-				$this-&gt;rmdir($path.'/'.$filename,$recursive);
+		foreach($filelist as $filename =&gt; $det) {
+			if ( '/' == substr($filename, -1, 1) )
+				$this-&gt;rmdir($path . '/' . $filename, $recursive);
 			@rmdir($filename);
 		}
 		return @rmdir($path);
 	}
 
-	function dirlist($path,$incdot=false,$recursive=false){
-		if( $this-&gt;is_file($path) ){
+	function dirlist($path, $incdot = false, $recursive = false) {
+		if( $this-&gt;is_file($path) ) {
 			$limitFile = basename($path);
 			$path = dirname($path);
 		} else {
@@ -288,10 +219,12 @@ class WP_Filesystem_Direct{
 
 		$ret = array();
 		$dir = dir($path);
-		while (false !== ($entry = $dir-&gt;read())) {
+		while (false !== ($entry = $dir-&gt;read()) ) {
 			$struc = array();
-			$struc['name'] 		= $entry;
+			$struc['name'] = $entry;
 
+			if( '.' == $struc['name'] || '..' == $struc['name'] )
+				continue; //Do not care about these folders.
 			if( '.' == $struc['name'][0] &amp;&amp; !$incdot)
 				continue;
 			if( $limitFile &amp;&amp; $struc['name'] != $limitFile)
@@ -307,30 +240,19 @@ class WP_Filesystem_Direct{
 			$struc['lastmod']   = date('M j',$struc['lastmodunix']);
 			$struc['time']    	= date('h:i:s',$struc['lastmodunix']);
 			$struc['type']		= $this-&gt;is_dir($path.'/'.$entry) ? 'd' : 'f';
-			if ('d' == $struc['type'] ){
-				$struc['files'] = array();
 
-				if( $incdot ){
-					//We're including the doted starts
-					if( '.' != $struc['name'] &amp;&amp; '..' != $struc['name'] ){ //Ok, It isnt a special folder
-						if ($recursive)
-							$struc['files'] = $this-&gt;dirlist($path.'/'.$struc['name'],$incdot,$recursive);
-					}
-				} else { //No dots
-					if ($recursive)
-						$struc['files'] = $this-&gt;dirlist($path.'/'.$struc['name'],$incdot,$recursive);
-				}
+			if ( 'd' == $struc['type'] ) {
+				if( $recursive )
+					$struc['files'] = $this-&gt;dirlist($path . '/' . $struc['name'], $incdot, $recursive);
+				else
+					$struc['files'] = array();
 			}
-			//File
-			$ret[$struc['name']] = $struc;
+
+			$ret[ $struc['name'] ] = $struc;
 		}
 		$dir-&gt;close();
 		unset($dir);
 		return $ret;
 	}
-
-	function __destruct(){
-		return;
-	}
 }
 ?&gt;</diff>
      <filename>wp-admin/includes/class-wp-filesystem-direct.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,10 @@
 &lt;?php
-class WP_Filesystem_FTPext{
+class WP_Filesystem_FTPext extends WP_Filesystem_Base{
 	var $link;
 	var $timeout = 5;
 	var $errors = array();
 	var $options = array();
 
-	var $wp_base = '';
 	var $permission = null;
 
 	var $filetypes = array(
@@ -24,6 +23,7 @@ class WP_Filesystem_FTPext{
 							);
 
 	function WP_Filesystem_FTPext($opt='') {
+		$this-&gt;method = 'ftpext';
 		$this-&gt;errors = new WP_Error();
 
 		//Check if possible to use ftp functions.
@@ -60,12 +60,11 @@ class WP_Filesystem_FTPext{
 		$this-&gt;options['ssl'] = ( !empty($opt['ssl']) );
 	}
 
-	function connect(){
-		if ( $this-&gt;options['ssl'] &amp;&amp; function_exists('ftp_ssl_connect') ) {
+	function connect() {
+		if ( $this-&gt;options['ssl'] &amp;&amp; function_exists('ftp_ssl_connect') )
 			$this-&gt;link = @ftp_ssl_connect($this-&gt;options['hostname'], $this-&gt;options['port'],$this-&gt;timeout);
-		} else {
+		else
 			$this-&gt;link = @ftp_connect($this-&gt;options['hostname'], $this-&gt;options['port'],$this-&gt;timeout);
-		}
 
 		if ( ! $this-&gt;link ) {
 			$this-&gt;errors-&gt;add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this-&gt;options['hostname'], $this-&gt;options['port']));
@@ -80,76 +79,11 @@ class WP_Filesystem_FTPext{
 		return true;
 	}
 
-	function setDefaultPermissions($perm){
+	function setDefaultPermissions($perm) {
 		$this-&gt;permission = $perm;
 	}
-
-	function find_base_dir($base = '.',$echo = false, $loop = false) {
-		//Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output.
-		$abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
-		if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
-			if( preg_match(&quot;|.{1}\:(.+)|i&quot;, $abspath, $mat) )
-				$abspath = $mat[1];
-		}
 	
-		//Set up the base directory (Which unless specified, is the current one)
-		if( empty( $base ) || '.' == $base ) $base = $this-&gt;cwd();
-		$base = trailingslashit($base);
-
-		//Can we see the Current directory as part of the ABSPATH?
-		$location = strpos($abspath, $base);
-		if( false !== $location ) {
-			$newbase = path_join($base, substr($abspath, $location + strlen($base)));
-
-			if( false !== $this-&gt;chdir($newbase) ){ //chdir sometimes returns null under certain circumstances, even when its changed correctly, FALSE will be returned if it doesnt change correctly.
-				if($echo) printf( __('Changing to %s') . '&lt;br/&gt;', $newbase );
-				//Check to see if it exists in that folder.
-				if( $this-&gt;exists($newbase . 'wp-settings.php') ){
-					if($echo) printf( __('Found %s'),  $newbase . 'wp-settings.php&lt;br/&gt;' );
-					return $newbase;
-				}	
-			}
-		}
-	
-		//Ok, Couldnt do a magic location from that particular folder level
-		
-		//Get a list of the files in the current directory, See if we can locate where we are in the folder stucture.
-		$files = $this-&gt;dirlist($base);
-		
-		$arrPath = explode('/', $abspath);
-		foreach($arrPath as $key){
-			//Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder, 
-			// If its found, change into it and follow through looking for it. 
-			// If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
-			// If it reaches the end, and still cant find it, it'll return false for the entire function.
-			if( isset($files[ $key ]) ){
-				//Lets try that folder:
-				$folder = path_join($base, $key);
-				if($echo) printf( __('Changing to %s') . '&lt;br/&gt;', $folder );
-				$ret = $this-&gt;find_base_dir( $folder, $echo, $loop);
-				if( $ret )
-					return $ret;
-			}
-		}
-		//Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
-		if(isset( $files[ 'wp-settings.php' ]) ){
-			if($echo) printf( __('Found %s'),  $base . 'wp-settings.php&lt;br/&gt;' );
-			return $base;
-		}
-		if( $loop )
-			return false;//Prevent tihs function looping again.
-		//As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
-		return $this-&gt;find_base_dir('/', $echo, true); 
-	}
-
-	function get_base_dir($base = '.', $echo = false){
-		if( defined('FTP_BASE') )
-			$this-&gt;wp_base = FTP_BASE;
-		if( empty($this-&gt;wp_base) )
-			$this-&gt;wp_base = $this-&gt;find_base_dir($base,$echo);
-		return $this-&gt;wp_base;
-	}
-	function get_contents($file,$type='',$resumepos=0){
+	function get_contents($file, $type = '', $resumepos = 0 ){
 		if( empty($type) ){
 			$extension = substr(strrchr($file, &quot;.&quot;), 1);
 			$type = isset($this-&gt;filetypes[ $extension ]) ? $this-&gt;filetypes[ $extension ] : FTP_ASCII;
@@ -157,7 +91,7 @@ class WP_Filesystem_FTPext{
 		$temp = tmpfile();
 		if ( ! $temp )
 			return false;
-		if( ! @ftp_fget($this-&gt;link,$temp,$file,$type,$resumepos) )
+		if( ! @ftp_fget($this-&gt;link, $temp, $file, $type, $resumepos) )
 			return false;
 		fseek($temp, 0); //Skip back to the start of the file being written to
 		$contents = '';
@@ -167,202 +101,132 @@ class WP_Filesystem_FTPext{
 		fclose($temp);
 		return $contents;
 	}
-	function get_contents_array($file){
-		return explode(&quot;\n&quot;,$this-&gt;get_contents($file));
+	function get_contents_array($file) {
+		return explode(&quot;\n&quot;, $this-&gt;get_contents($file));
 	}
-	function put_contents($file,$contents,$type=''){
-		if( empty($type) ){
+	function put_contents($file, $contents, $type = '' ) {
+		if( empty($type) ) {
 			$extension = substr(strrchr($file, &quot;.&quot;), 1);
 			$type = isset($this-&gt;filetypes[ $extension ]) ? $this-&gt;filetypes[ $extension ] : FTP_ASCII;
 		}
 		$temp = tmpfile();
 		if ( ! $temp )
 			return false;
-		fwrite($temp,$contents);
+		fwrite($temp, $contents);
 		fseek($temp, 0); //Skip back to the start of the file being written to
-		$ret = @ftp_fput($this-&gt;link,$file,$temp,$type);
+		$ret = @ftp_fput($this-&gt;link, $file, $temp, $type);
 		fclose($temp);
 		return $ret;
 	}
-	function cwd(){
+	function cwd() {
 		$cwd = ftp_pwd($this-&gt;link);
 		if( $cwd )
 			$cwd = trailingslashit($cwd);
 		return $cwd;
 	}
-	function chdir($dir){
+	function chdir($dir) {
 		return @ftp_chdir($dir);
 	}
-	function chgrp($file,$group,$recursive=false){
+	function chgrp($file, $group, $recursive = false ) {
 		return false;
 	}
-	function chmod($file,$mode=false,$recursive=false){
+	function chmod($file, $mode = false, $recursive = false) {
 		if( ! $mode )
 			$mode = $this-&gt;permission;
 		if( ! $mode )
 			return false;
 		if ( ! $this-&gt;exists($file) )
 			return false;
-		if ( ! $recursive || ! $this-&gt;is_dir($file) ){
-			if (!function_exists('ftp_chmod'))
+		if ( ! $recursive || ! $this-&gt;is_dir($file) ) {
+			if ( ! function_exists('ftp_chmod') )
 				return @ftp_site($this-&gt;link, sprintf('CHMOD %o %s', $mode, $file));
-			return @ftp_chmod($this-&gt;link,$mode,$file);
+			return @ftp_chmod($this-&gt;link, $mode, $file);
 		}
 		//Is a directory, and we want recursive
 		$filelist = $this-&gt;dirlist($file);
 		foreach($filelist as $filename){
-			$this-&gt;chmod($file.'/'.$filename,$mode,$recursive);
+			$this-&gt;chmod($file . '/' . $filename, $mode, $recursive);
 		}
 		return true;
 	}
-	function chown($file,$owner,$recursive=false){
+	function chown($file, $owner, $recursive = false ) {
 		return false;
 	}
-	function owner($file){
+	function owner($file) {
 		$dir = $this-&gt;dirlist($file);
 		return $dir[$file]['owner'];
 	}
-	function getchmod($file){
+	function getchmod($file) {
 		$dir = $this-&gt;dirlist($file);
 		return $dir[$file]['permsn'];
 	}
-	function gethchmod($file){
-		//From the PHP.net page for ...?
-		$perms = $this-&gt;getchmod($file);
-		if (($perms &amp; 0xC000) == 0xC000) {
-			// Socket
-			$info = 's';
-		} elseif (($perms &amp; 0xA000) == 0xA000) {
-			// Symbolic Link
-			$info = 'l';
-		} elseif (($perms &amp; 0x8000) == 0x8000) {
-			// Regular
-			$info = '-';
-		} elseif (($perms &amp; 0x6000) == 0x6000) {
-			// Block special
-			$info = 'b';
-		} elseif (($perms &amp; 0x4000) == 0x4000) {
-			// Directory
-			$info = 'd';
-		} elseif (($perms &amp; 0x2000) == 0x2000) {
-			// Character special
-			$info = 'c';
-		} elseif (($perms &amp; 0x1000) == 0x1000) {
-			// FIFO pipe
-			$info = 'p';
-		} else {
-			// Unknown
-			$info = 'u';
-		}
-
-		// Owner
-		$info .= (($perms &amp; 0x0100) ? 'r' : '-');
-		$info .= (($perms &amp; 0x0080) ? 'w' : '-');
-		$info .= (($perms &amp; 0x0040) ?
-					(($perms &amp; 0x0800) ? 's' : 'x' ) :
-					(($perms &amp; 0x0800) ? 'S' : '-'));
-
-		// Group
-		$info .= (($perms &amp; 0x0020) ? 'r' : '-');
-		$info .= (($perms &amp; 0x0010) ? 'w' : '-');
-		$info .= (($perms &amp; 0x0008) ?
-					(($perms &amp; 0x0400) ? 's' : 'x' ) :
-					(($perms &amp; 0x0400) ? 'S' : '-'));
-
-		// World
-		$info .= (($perms &amp; 0x0004) ? 'r' : '-');
-		$info .= (($perms &amp; 0x0002) ? 'w' : '-');
-		$info .= (($perms &amp; 0x0001) ?
-					(($perms &amp; 0x0200) ? 't' : 'x' ) :
-					(($perms &amp; 0x0200) ? 'T' : '-'));
-		return $info;
-	}
-	function getnumchmodfromh($mode) {
-		$realmode = &quot;&quot;;
-		$legal =  array(&quot;&quot;,&quot;w&quot;,&quot;r&quot;,&quot;x&quot;,&quot;-&quot;);
-		$attarray = preg_split(&quot;//&quot;,$mode);
-		for($i=0;$i&lt;count($attarray);$i++){
-		   if($key = array_search($attarray[$i],$legal)){
-			   $realmode .= $legal[$key];
-		   }
-		}
-		$mode = str_pad($realmode,9,'-');
-		$trans = array('-'=&gt;'0','r'=&gt;'4','w'=&gt;'2','x'=&gt;'1');
-		$mode = strtr($mode,$trans);
-		$newmode = '';
-		$newmode .= $mode[0]+$mode[1]+$mode[2];
-		$newmode .= $mode[3]+$mode[4]+$mode[5];
-		$newmode .= $mode[6]+$mode[7]+$mode[8];
-		return $newmode;
-	}
-	function group($file){
+	function group($file) {
 		$dir = $this-&gt;dirlist($file);
 		return $dir[$file]['group'];
 	}
-	function copy($source,$destination,$overwrite=false){
+	function copy($source, $destination, $overwrite = false ) {
 		if( ! $overwrite &amp;&amp; $this-&gt;exists($destination) )
 			return false;
 		$content = $this-&gt;get_contents($source);
 		if( false === $content)
 			return false;
-		return $this-&gt;put_contents($destination,$content);
+		return $this-&gt;put_contents($destination, $content);
 	}
-	function move($source,$destination,$overwrite=false){
-		return ftp_rename($this-&gt;link,$source,$destination);
+	function move($source, $destination, $overwrite = false) {
+		return ftp_rename($this-&gt;link, $source, $destination);
 	}
 
 	function delete($file,$recursive=false) {
 		if ( $this-&gt;is_file($file) )
-			return @ftp_delete($this-&gt;link,$file);
+			return @ftp_delete($this-&gt;link, $file);
 		if ( !$recursive )
-			return @ftp_rmdir($this-&gt;link,$file);
+			return @ftp_rmdir($this-&gt;link, $file);
 		$filelist = $this-&gt;dirlist($file);
 		foreach ((array) $filelist as $filename =&gt; $fileinfo) {
-			$this-&gt;delete($file.'/'.$filename,$recursive);
+			$this-&gt;delete($file . '/' . $filename, $recursive);
 		}
-		return @ftp_rmdir($this-&gt;link,$file);
+		return @ftp_rmdir($this-&gt;link, $file);
 	}
 
-	function exists($file){
-		$list = ftp_rawlist($this-&gt;link,$file,false);
+	function exists($file) {
+		$list = ftp_rawlist($this-&gt;link, $file, false);
 		if( ! $list )
 			return false;
 		return count($list) == 1 ? true : false;
 	}
-	function is_file($file){
+	function is_file($file) {
 		return $this-&gt;is_dir($file) ? false : true;
 	}
-	function is_dir($path){
+	function is_dir($path) {
 		$cwd = $this-&gt;cwd();
 		$result = @ftp_chdir($this-&gt;link, $path);
-		if( $result &amp;&amp; $path == $this-&gt;cwd() ||
-			$this-&gt;cwd() != $cwd ) {
+		if( $result &amp;&amp; $path == $this-&gt;cwd() || $this-&gt;cwd() != $cwd ) {
 			@ftp_chdir($this-&gt;link, $cwd);
 			return true;
 		}
 		return false;
 	}
-	function is_readable($file){
+	function is_readable($file) {
 		//Get dir list, Check if the file is writable by the current user??
 		return true;
 	}
-	function is_writable($file){
+	function is_writable($file) {
 		//Get dir list, Check if the file is writable by the current user??
 		return true;
 	}
-	function atime($file){
+	function atime($file) {
 		return false;
 	}
-	function mtime($file){
+	function mtime($file) {
 		return ftp_mdtm($this-&gt;link, $file);
 	}
-	function size($file){
+	function size($file) {
 		return ftp_size($this-&gt;link, $file);
 	}
-	function touch($file,$time=0,$atime=0){
+	function touch($file, $time = 0, $atime = 0) {
 		return false;
 	}
-	function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
+	function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
 		if( !@ftp_mkdir($this-&gt;link, $path) )
 			return false;
 		if( $chmod )
@@ -373,7 +237,7 @@ class WP_Filesystem_FTPext{
 			$this-&gt;chgrp($path, $chgrp);
 		return true;
 	}
-	function rmdir($path,$recursive=false){
+	function rmdir($path, $recursive = false) {
 		if( ! $recursive )
 			return @ftp_rmdir($this-&gt;link, $path);
 
@@ -385,9 +249,9 @@ class WP_Filesystem_FTPext{
 
 	function parselisting($line) {
 		$is_windows = ($this-&gt;OS_remote == FTP_OS_Windows);
-		if ($is_windows &amp;&amp; preg_match(&quot;/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|&lt;DIR&gt;) +(.+)/&quot;,$line,$lucifer)) {
+		if ($is_windows &amp;&amp; preg_match(&quot;/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|&lt;DIR&gt;) +(.+)/&quot;, $line, $lucifer)) {
 			$b = array();
-			if ($lucifer[3]&lt;70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
+			if ($lucifer[3]&lt;70) { $lucifer[3] +=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
 			$b['isdir'] = ($lucifer[7]==&quot;&lt;DIR&gt;&quot;);
 			if ( $b['isdir'] )
 				$b['type'] = 'd';
@@ -445,15 +309,15 @@ class WP_Filesystem_FTPext{
 		return $b;
 	}
 
-	function dirlist($path='.',$incdot=false,$recursive=false){
-		if( $this-&gt;is_file($path) ){
+	function dirlist($path = '.', $incdot = false, $recursive = false) {
+		if( $this-&gt;is_file($path) ) {
 			$limitFile = basename($path);
 			$path = dirname($path) . '/';
 		} else {
 			$limitFile = false;
 		}
 
-		$list = @ftp_rawlist($this-&gt;link , '-a ' . $path, false);
+		$list = @ftp_rawlist($this-&gt;link, '-a ' . $path, false);
 
 		if ( $list === false )
 			return false;
@@ -464,10 +328,10 @@ class WP_Filesystem_FTPext{
 			if ( empty($entry) )
 				continue;
 
-			if ( $entry[&quot;name&quot;]==&quot;.&quot; or $entry[&quot;name&quot;]==&quot;..&quot; )
+			if ( '.' == $entry[&quot;name&quot;] || '..' == $entry[&quot;name&quot;] )
 				continue;
 
-			$dirlist[$entry['name']] = $entry;
+			$dirlist[ $entry['name'] ] = $entry;
 		}
 
 		if ( ! $dirlist )
@@ -485,11 +349,11 @@ class WP_Filesystem_FTPext{
 					//We're including the doted starts
 					if( '.' != $struc['name'] &amp;&amp; '..' != $struc['name'] ){ //Ok, It isnt a special folder
 						if ($recursive)
-							$struc['files'] = $this-&gt;dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+							$struc['files'] = $this-&gt;dirlist($path . '/' . $struc['name'], $incdot, $recursive);
 					}
 				} else { //No dots
 					if ($recursive)
-						$struc['files'] = $this-&gt;dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+						$struc['files'] = $this-&gt;dirlist($path . '/' . $struc['name'], $incdot, $recursive);
 				}
 			}
 			//File</diff>
      <filename>wp-admin/includes/class-wp-filesystem-ftpext.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,29 +1,29 @@
 &lt;?php
-class WP_Filesystem_ftpsockets{
+class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
 	var $ftp = false;
 	var $timeout = 5;
 	var $errors;
 	var $options = array();
 
-	var $wp_base = '';
 	var $permission = null;
 
 	var $filetypes = array(
-							'php'=&gt;FTP_ASCII,
-							'css'=&gt;FTP_ASCII,
-							'txt'=&gt;FTP_ASCII,
-							'js'=&gt;FTP_ASCII,
-							'html'=&gt;FTP_ASCII,
-							'htm'=&gt;FTP_ASCII,
-							'xml'=&gt;FTP_ASCII,
-
-							'jpg'=&gt;FTP_BINARY,
-							'png'=&gt;FTP_BINARY,
-							'gif'=&gt;FTP_BINARY,
-							'bmp'=&gt;FTP_BINARY
+							'php' =&gt; FTP_ASCII,
+							'css' =&gt; FTP_ASCII,
+							'txt' =&gt; FTP_ASCII,
+							'js'  =&gt; FTP_ASCII,
+							'html'=&gt; FTP_ASCII,
+							'htm' =&gt; FTP_ASCII,
+							'xml' =&gt; FTP_ASCII,
+
+							'jpg' =&gt; FTP_BINARY,
+							'png' =&gt; FTP_BINARY,
+							'gif' =&gt; FTP_BINARY,
+							'bmp' =&gt; FTP_BINARY
 							);
 
 	function WP_Filesystem_ftpsockets($opt='') {
+		$this-&gt;method = 'ftpsockets';
 		$this-&gt;errors = new WP_Error();
 
 		//Check if possible to use ftp functions.
@@ -86,241 +86,109 @@ class WP_Filesystem_ftpsockets{
 		$this-&gt;permission = $perm;
 	}
 
-	function find_base_dir($base = '.',$echo = false, $loop = false) {
-		//Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output.
-		$abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
-		if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
-			if( preg_match(&quot;|.{1}\:(.+)|i&quot;, $abspath, $mat) )
-				$abspath = $mat[1];
-		}
-	
-		//Set up the base directory (Which unless specified, is the current one)
-		if( empty( $base ) || '.' == $base ) $base = $this-&gt;cwd();
-		$base = trailingslashit($base);
-
-		//Can we see the Current directory as part of the ABSPATH?
-		$location = strpos($abspath, $base);
-		if( false !== $location ) {
-			$newbase = path_join($base, substr($abspath, $location + strlen($base)));
-
-			if( false !== $this-&gt;chdir($newbase) ){ //chdir sometimes returns null under certain circumstances, even when its changed correctly, FALSE will be returned if it doesnt change correctly.
-				if($echo) printf( __('Changing to %s') . '&lt;br/&gt;', $newbase );
-				//Check to see if it exists in that folder.
-				if( $this-&gt;exists($newbase . 'wp-settings.php') ){
-					if($echo) printf( __('Found %s'),  $newbase . 'wp-settings.php&lt;br/&gt;' );
-					return $newbase;
-				}	
-			}
-		}
-	
-		//Ok, Couldnt do a magic location from that particular folder level
-		
-		//Get a list of the files in the current directory, See if we can locate where we are in the folder stucture.
-		$files = $this-&gt;dirlist($base);
-		
-		$arrPath = explode('/', $abspath);
-		foreach($arrPath as $key){
-			//Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder, 
-			// If its found, change into it and follow through looking for it. 
-			// If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
-			// If it reaches the end, and still cant find it, it'll return false for the entire function.
-			if( isset($files[ $key ]) ){
-				//Lets try that folder:
-				$folder = path_join($base, $key);
-				if($echo) printf( __('Changing to %s') . '&lt;br/&gt;', $folder );
-				$ret = $this-&gt;find_base_dir( $folder, $echo, $loop);
-				if( $ret )
-					return $ret;
-			}
-		}
-		//Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
-		if(isset( $files[ 'wp-settings.php' ]) ){
-			if($echo) printf( __('Found %s'),  $base . 'wp-settings.php&lt;br/&gt;' );
-			return $base;
-		}
-		if( $loop )
-			return false;//Prevent tihs function looping again.
-		//As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
-		return $this-&gt;find_base_dir('/', $echo, true); 
-	}
-
-	function get_base_dir($base = '.', $echo = false){
-		if( defined('FTP_BASE') )
-			$this-&gt;wp_base = FTP_BASE;
-		if( empty($this-&gt;wp_base) )
-			$this-&gt;wp_base = $this-&gt;find_base_dir($base, $echo);
-		return $this-&gt;wp_base;
-	}
-
-	function get_contents($file,$type='',$resumepos=0){
+	function get_contents($file, $type = '', $resumepos = 0){
 		if( ! $this-&gt;exists($file) )
 			return false;
 
 		if( empty($type) ){
-			$extension = substr(strrchr($file, &quot;.&quot;), 1);
+			$extension = substr(strrchr($file, '.'), 1);
 			$type = isset($this-&gt;filetypes[ $extension ]) ? $this-&gt;filetypes[ $extension ] : FTP_AUTOASCII;
 		}
 		$this-&gt;ftp-&gt;SetType($type);
-		$temp = tmpfile();
-		if ( ! $temp )
+		$temp = wp_tempnam( $file );
+		if ( ! $temphandle = fopen($temp, 'w+') )
 			return false;
-		if ( ! $this-&gt;ftp-&gt;fget($temp, $file) ) {
-			fclose($temp);
+		if ( ! $this-&gt;ftp-&gt;fget($temphandle, $file) ) {
+			fclose($temphandle);
+			unlink($temp);
 			return ''; //Blank document, File does exist, Its just blank.
 		}
-		fseek($temp, 0); //Skip back to the start of the file being written to
+		fseek($temphandle, 0); //Skip back to the start of the file being written to
 		$contents = '';
-		while ( !feof($temp) )
-			$contents .= fread($temp, 8192);
-		fclose($temp);
+		while ( ! feof($temphandle) )
+			$contents .= fread($temphandle, 8192);
+		fclose($temphandle);
+		unlink($temp);
 		return $contents;
 	}
 
 	function get_contents_array($file){
-		return explode(&quot;\n&quot;,$this-&gt;get_contents($file));
+		return explode(&quot;\n&quot;, $this-&gt;get_contents($file) );
 	}
 
-	function put_contents($file,$contents,$type=''){
+	function put_contents($file, $contents, $type = '' ) {
 		if( empty($type) ){
-			$extension = substr(strrchr($file, &quot;.&quot;), 1);
-			$type = isset($this-&gt;filetypes[ $extension ]) ? $this-&gt;filetypes[ $extension ] : FTP_ASCII;
+			$extension = substr(strrchr($file, '.'), 1);
+			$type = isset($this-&gt;filetypes[ $extension ]) ? $this-&gt;filetypes[ $extension ] : FTP_AUTOASCII;
 		}
 		$this-&gt;ftp-&gt;SetType($type);
 
-		$temp = tmpfile();
-		if ( ! $temp )
+		$temp = wp_tempnam( $file );
+		if ( ! $temphandle = fopen($temp, 'w+') ){
+			unlink($temp);		
 			return false;
-		fwrite($temp,$contents);
-		fseek($temp, 0); //Skip back to the start of the file being written to
-		$ret = $this-&gt;ftp-&gt;fput($file, $temp);
-		fclose($temp);
+		}
+		fwrite($temphandle, $contents);
+		fseek($temphandle, 0); //Skip back to the start of the file being written to
+		$ret = $this-&gt;ftp-&gt;fput($file, $temphandle);
+		fclose($temphandle);
+		unlink($temp);
 		return $ret;
 	}
 
-	function cwd(){
+	function cwd() {
 		$cwd = $this-&gt;ftp-&gt;pwd();
 		if( $cwd )
 			$cwd = trailingslashit($cwd);
 		return $cwd;
 	}
 
-	function chdir($file){
+	function chdir($file) {
 		return $this-&gt;ftp-&gt;chdir($file);
 	}
 	
-	function chgrp($file,$group,$recursive=false){
+	function chgrp($file, $group, $recursive = false ) {
 		return false;
 	}
 
-	function chmod($file,$mode=false,$recursive=false){
+	function chmod($file, $mode = false, $recursive = false ){
 		if( ! $mode )
 			$mode = $this-&gt;permission;
 		if( ! $mode )
 			return false;
 		//if( ! $this-&gt;exists($file) )
 		//	return false;
-		if( ! $recursive || ! $this-&gt;is_dir($file) ){
+		if( ! $recursive || ! $this-&gt;is_dir($file) ) {
 			return $this-&gt;ftp-&gt;chmod($file,$mode);
 		}
 		//Is a directory, and we want recursive
 		$filelist = $this-&gt;dirlist($file);
 		foreach($filelist as $filename){
-			$this-&gt;chmod($file.'/'.$filename,$mode,$recursive);
+			$this-&gt;chmod($file . '/' . $filename, $mode, $recursive);
 		}
 		return true;
 	}
 
-	function chown($file,$owner,$recursive=false){
+	function chown($file, $owner, $recursive = false ) {
 		return false;
 	}
 
-	function owner($file){
+	function owner($file) {
 		$dir = $this-&gt;dirlist($file);
 		return $dir[$file]['owner'];
 	}
 
-	function getchmod($file){
+	function getchmod($file) {
 		$dir = $this-&gt;dirlist($file);
 		return $dir[$file]['permsn'];
 	}
 
-	function gethchmod($file){
-		//From the PHP.net page for ...?
-		$perms = $this-&gt;getchmod($file);
-		if (($perms &amp; 0xC000) == 0xC000) {
-			// Socket
-			$info = 's';
-		} elseif (($perms &amp; 0xA000) == 0xA000) {
-			// Symbolic Link
-			$info = 'l';
-		} elseif (($perms &amp; 0x8000) == 0x8000) {
-			// Regular
-			$info = '-';
-		} elseif (($perms &amp; 0x6000) == 0x6000) {
-			// Block special
-			$info = 'b';
-		} elseif (($perms &amp; 0x4000) == 0x4000) {
-			// Directory
-			$info = 'd';
-		} elseif (($perms &amp; 0x2000) == 0x2000) {
-			// Character special
-			$info = 'c';
-		} elseif (($perms &amp; 0x1000) == 0x1000) {
-			// FIFO pipe
-			$info = 'p';
-		} else {
-			// Unknown
-			$info = 'u';
-		}
-
-		// Owner
-		$info .= (($perms &amp; 0x0100) ? 'r' : '-');
-		$info .= (($perms &amp; 0x0080) ? 'w' : '-');
-		$info .= (($perms &amp; 0x0040) ?
-					(($perms &amp; 0x0800) ? 's' : 'x' ) :
-					(($perms &amp; 0x0800) ? 'S' : '-'));
-
-		// Group
-		$info .= (($perms &amp; 0x0020) ? 'r' : '-');
-		$info .= (($perms &amp; 0x0010) ? 'w' : '-');
-		$info .= (($perms &amp; 0x0008) ?
-					(($perms &amp; 0x0400) ? 's' : 'x' ) :
-					(($perms &amp; 0x0400) ? 'S' : '-'));
-
-		// World
-		$info .= (($perms &amp; 0x0004) ? 'r' : '-');
-		$info .= (($perms &amp; 0x0002) ? 'w' : '-');
-		$info .= (($perms &amp; 0x0001) ?
-					(($perms &amp; 0x0200) ? 't' : 'x' ) :
-					(($perms &amp; 0x0200) ? 'T' : '-'));
-		return $info;
-	}
-
-	function getnumchmodfromh($mode) {
-		$realmode = &quot;&quot;;
-		$legal =  array(&quot;&quot;,&quot;w&quot;,&quot;r&quot;,&quot;x&quot;,&quot;-&quot;);
-		$attarray = preg_split(&quot;//&quot;,$mode);
-		for($i=0;$i&lt;count($attarray);$i++){
-		   if($key = array_search($attarray[$i],$legal)){
-			   $realmode .= $legal[$key];
-		   }
-		}
-		$mode = str_pad($realmode,9,'-');
-		$trans = array('-'=&gt;'0','r'=&gt;'4','w'=&gt;'2','x'=&gt;'1');
-		$mode = strtr($mode,$trans);
-		$newmode = '';
-		$newmode .= $mode[0]+$mode[1]+$mode[2];
-		$newmode .= $mode[3]+$mode[4]+$mode[5];
-		$newmode .= $mode[6]+$mode[7]+$mode[8];
-		return $newmode;
-	}
-
-	function group($file){
+	function group($file) {
 		$dir = $this-&gt;dirlist($file);
 		return $dir[$file]['group'];
 	}
 
-	function copy($source,$destination,$overwrite=false){
+	function copy($source, $destination, $overwrite = false ) {
 		if( ! $overwrite &amp;&amp; $this-&gt;exists($destination) )
 			return false;
 
@@ -328,14 +196,14 @@ class WP_Filesystem_ftpsockets{
 		if ( false === $content )
 			return false;
 
-		return $this-&gt;put_contents($destination,$content);
+		return $this-&gt;put_contents($destination, $content);
 	}
 
-	function move($source,$destination,$overwrite=false){
-		return $this-&gt;ftp-&gt;rename($source,$destination);
+	function move($source, $destination, $overwrite = false ) {
+		return $this-&gt;ftp-&gt;rename($source, $destination);
 	}
 
-	function delete($file,$recursive=false) {
+	function delete($file, $recursive = false ) {
 		if ( $this-&gt;is_file($file) )
 			return $this-&gt;ftp-&gt;delete($file);
 		if ( !$recursive )
@@ -344,15 +212,15 @@ class WP_Filesystem_ftpsockets{
 		return $this-&gt;ftp-&gt;mdel($file);
 	}
 
-	function exists($file){
+	function exists($file) {
 		return $this-&gt;ftp-&gt;is_exists($file);
 	}
 
-	function is_file($file){
+	function is_file($file) {
 		return $this-&gt;is_dir($file) ? false : true;
 	}
 
-	function is_dir($path){
+	function is_dir($path) {
 		$cwd = $this-&gt;cwd();
 		if ( $this-&gt;chdir($path) ) {
 			$this-&gt;chdir($cwd);
@@ -361,33 +229,33 @@ class WP_Filesystem_ftpsockets{
 		return false;
 	}
 
-	function is_readable($file){
+	function is_readable($file) {
 		//Get dir list, Check if the file is writable by the current user??
 		return true;
 	}
 
-	function is_writable($file){
+	function is_writable($file) {
 		//Get dir list, Check if the file is writable by the current user??
 		return true;
 	}
 
-	function atime($file){
+	function atime($file) {
 		return false;
 	}
 
-	function mtime($file){
+	function mtime($file) {
 		return $this-&gt;ftp-&gt;mdtm($file);
 	}
 
-	function size($file){
+	function size($file) {
 		return $this-&gt;ftp-&gt;filesize($file);
 	}
 
-	function touch($file,$time=0,$atime=0){
+	function touch($file, $time = 0, $atime = 0 ){
 		return false;
 	}
 
-	function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
+	function mkdir($path, $chmod = false, $chown = false, $chgrp = false ) {
 		if( ! $this-&gt;ftp-&gt;mkdir($path) )
 			return false;
 		if( $chmod )
@@ -399,15 +267,15 @@ class WP_Filesystem_ftpsockets{
 		return true;
 	}
 
-	function rmdir($path,$recursive=false){
+	function rmdir($path, $recursive = false ) {
 		if( ! $recursive )
 			return $this-&gt;ftp-&gt;rmdir($path);
 
 		return $this-&gt;ftp-&gt;mdel($path);
 	}
 
-	function dirlist($path='.',$incdot=false,$recursive=false){
-		if( $this-&gt;is_file($path) ){
+	function dirlist($path = '.', $incdot = false, $recursive = false ) {
+		if( $this-&gt;is_file($path) ) {
 			$limitFile = basename($path);
 			$path = dirname($path) . '/';
 		} else {
@@ -430,11 +298,11 @@ class WP_Filesystem_ftpsockets{
 					//We're including the doted starts
 					if( '.' != $struc['name'] &amp;&amp; '..' != $struc['name'] ){ //Ok, It isnt a special folder
 						if ($recursive)
-							$struc['files'] = $this-&gt;dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+							$struc['files'] = $this-&gt;dirlist($path . '/' . $struc['name'], $incdot, $recursive);
 					}
 				} else { //No dots
 					if ($recursive)
-						$struc['files'] = $this-&gt;dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+						$struc['files'] = $this-&gt;dirlist($path . '/' . $struc['name'], $incdot, $recursive);
 				}
 			}
 			//File</diff>
      <filename>wp-admin/includes/class-wp-filesystem-ftpsockets.php</filename>
    </modified>
    <modified>
      <diff>@@ -3,8 +3,8 @@
 function comment_exists($comment_author, $comment_date) {
 	global $wpdb;
 
-	return $wpdb-&gt;get_var(&quot;SELECT comment_post_ID FROM $wpdb-&gt;comments
-			WHERE comment_author = '$comment_author' AND comment_date = '$comment_date'&quot;);
+	return $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT comment_post_ID FROM $wpdb-&gt;comments
+			WHERE comment_author = %s AND comment_date = %s&quot;, $comment_author, $comment_date) );
 }
 
 function edit_comment() {
@@ -21,7 +21,7 @@ function edit_comment() {
 	$_POST['comment_content'] = $_POST['content'];
 	$_POST['comment_ID'] = (int) $_POST['comment_ID'];
 
-	foreach ( array ('aa', 'mm', 'jj', 'hh', 'mm') as $timeunit ) {
+	foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
 		if ( !empty( $_POST['hidden_' . $timeunit] ) &amp;&amp; $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
 			$_POST['edit_date'] = '1';
 			break;
@@ -66,9 +66,28 @@ function get_comment_to_edit( $id ) {
 
 function get_pending_comments_num( $post_id ) {
 	global $wpdb;
-	$post_id = (int) $post_id;
-	$pending = $wpdb-&gt;get_var( &quot;SELECT COUNT(*) FROM $wpdb-&gt;comments WHERE comment_post_ID = $post_id AND comment_approved = '0'&quot; );
-	return $pending;
+
+	$single = false;
+	if ( !is_array($post_id) ) {
+		$post_id = (array) $post_id;
+		$single = true;
+	}
+	$post_id = array_map('intval', $post_id);
+	$post_id = &quot;'&quot; . implode(&quot;', '&quot;, $post_id) . &quot;'&quot;;
+
+	$pending = $wpdb-&gt;get_results( &quot;SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb-&gt;comments WHERE comment_post_ID IN ( $post_id ) AND comment_approved = '0' GROUP BY comment_post_ID&quot;, ARRAY_N );
+
+	if ( empty($pending) )
+		return 0;
+
+	if ( $single )
+		return $pending[0][1];
+
+	$pending_keyed = array();
+	foreach ( $pending as $pend )
+		$pending_keyed[$pend[0]] = $pend[1];
+
+	return $pending_keyed;
 }
 
 // Add avatars to relevant places in admin, or try to
@@ -93,4 +112,4 @@ if ( is_admin() &amp;&amp; ('edit-comments.php' == $pagenow || 'edit.php' == $pagenow) )
 		add_filter( 'comment_author', 'floated_admin_avatar' );
 }
 
-?&gt;
\ No newline at end of file
+?&gt;</diff>
      <filename>wp-admin/includes/comment.php</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,8 @@
 function wp_dashboard_setup() {
 	global $wpdb, $wp_dashboard_sidebars;
 	$update = false;
-	if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
+	$widget_options = get_option( 'dashboard_widget_options' );
+	if ( !$widget_options || !is_array($widget_options) )
 		$widget_options = array();
 
 
@@ -22,7 +23,9 @@ function wp_dashboard_setup() {
 	/* Register Widgets and Controls */
 
 	// Recent Comments Widget
-	if ( current_user_can( 'moderate_comments' ) &amp;&amp; $mod_comments = $wpdb-&gt;get_var(&quot;SELECT COUNT(*) FROM $wpdb-&gt;comments WHERE comment_approved = '0'&quot;) ) {
+	$mod_comments = wp_count_comments();
+	$mod_comments = $mod_comments-&gt;moderated;
+	if ( current_user_can( 'moderate_comments' ) &amp;&amp; $mod_comments ) {
 		$notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments );
 		$notice = &quot;&lt;a href='edit-comments.php?comment_status=moderated'&gt;$notice&lt;/a&gt;&quot;;
 	} else {
@@ -33,9 +36,10 @@ function wp_dashboard_setup() {
 	);
 
 	// Incoming Links Widget
-	if ( !isset( $widget_options['dashboard_incoming_links'] ) ) {
+	if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
 		$update = true;
 		$widget_options['dashboard_incoming_links'] = array(
+			'home' =&gt; get_option('home'),
 			'link' =&gt; apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&amp;scoring=d&amp;partner=wordpress&amp;q=link:' . trailingslashit( get_option('home') ) ),
 			'url' =&gt; apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&amp;scoring=d&amp;ie=utf-8&amp;num=10&amp;output=rss&amp;partner=wordpress&amp;q=link:' . trailingslashit( get_option('home') ) ),
 			'items' =&gt; 5,
@@ -213,16 +217,16 @@ function wp_dashboard_dynamic_sidebar_params( $params ) {
 			$wp_registered_widgets[$widget_id]['callback'] = 'wp_dashboard_empty';
 			$sidebar_widget_name = $wp_registered_widget_controls[$widget_id]['name'];
 			$params[1] = 'wp_dashboard_trigger_widget_control';
-			$sidebar_before_widget .= '&lt;form action=&quot;' . remove_query_arg( 'edit' )  . '&quot; method=&quot;post&quot;&gt;';
+			$sidebar_before_widget .= '&lt;form action=&quot;' . clean_url(remove_query_arg( 'edit' ))  . '&quot; method=&quot;post&quot;&gt;';
 			$sidebar_after_widget   = &quot;&lt;div class='dashboard-widget-submit'&gt;&lt;input type='hidden' name='sidebar' value='wp_dashboard' /&gt;&lt;input type='hidden' name='widget_id' value='$widget_id' /&gt;&lt;input type='submit' value='&quot; . __( 'Save' ) . &quot;' /&gt;&lt;/div&gt;&lt;/form&gt;$sidebar_after_widget&quot;;
-			$links[] = '&lt;a href=&quot;' . remove_query_arg( 'edit' ) . '&quot;&gt;' . __( 'Cancel' ) . '&lt;/a&gt;';
+			$links[] = '&lt;a href=&quot;' . clean_url(remove_query_arg( 'edit' )) . '&quot;&gt;' . __( 'Cancel' ) . '&lt;/a&gt;';
 		} else {
-			$links[] = '&lt;a href=&quot;' . add_query_arg( 'edit', $widget_id ) . &quot;#$widget_id&quot; . '&quot;&gt;' . __( 'Edit' ) . '&lt;/a&gt;';
+			$links[] = '&lt;a href=&quot;' . clean_url(add_query_arg( 'edit', $widget_id )) . &quot;#$widget_id&quot; . '&quot;&gt;' . __( 'Edit' ) . '&lt;/a&gt;';
 		}
 	}
 
 	if ( $widget_feed_link )
-		$links[] = '&lt;img class=&quot;rss-icon&quot; src=&quot;' . get_option( 'siteurl' ) . '/' . WPINC . '/images/rss.png&quot; alt=&quot;' . __( 'rss icon' ) . '&quot; /&gt; &lt;a href=&quot;' . clean_url( $widget_feed_link ) . '&quot;&gt;' . __( 'RSS' ) . '&lt;/a&gt;';
+		$links[] = '&lt;img class=&quot;rss-icon&quot; src=&quot;' . includes_url('images/rss.png') . '&quot; alt=&quot;' . __( 'rss icon' ) . '&quot; /&gt; &lt;a href=&quot;' . clean_url( $widget_feed_link ) . '&quot;&gt;' . __( 'RSS' ) . '&lt;/a&gt;';
 
 	$links = apply_filters( &quot;wp_dashboard_widget_links_$widget_id&quot;, $links );
 
@@ -266,7 +270,7 @@ function wp_dashboard_recent_comments( $sidebar_args ) {
 
 	$lambda = create_function( '', 'return 5;' );
 	add_filter( 'option_posts_per_rss', $lambda ); // hack - comments query doesn't accept per_page parameter
-	$comments_query = new WP_Query('feed=rss2&amp;withcomments=1');
+	$comments_query = new WP_Query(array('feed' =&gt; 'rss2', 'withcomments' =&gt; 1));
 	remove_filter( 'option_posts_per_rss', $lambda );
 
 	$is_first = true;
@@ -312,7 +316,7 @@ function wp_dashboard_incoming_links_output() {
 	$widgets = get_option( 'dashboard_widget_options' );
 	@extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
 	$rss = @fetch_rss( $url );
-	if ( isset($rss-&gt;items) &amp;&amp; 1 &lt; count($rss-&gt;items) )  {// Technorati returns a 1-item feed when it has no results
+	if ( isset($rss-&gt;items) &amp;&amp; 0 &lt; count($rss-&gt;items) )  {
 
 		echo &quot;&lt;ul&gt;\n&quot;;
 
@@ -386,8 +390,7 @@ function wp_dashboard_secondary_output() {
 	$rss-&gt;items = array_slice($rss-&gt;items, 0, $items);
 	foreach ($rss-&gt;items as $item ) {
 		$title = wp_specialchars($item['title']);
-		$author = preg_replace( '|(.+?):.+|s', '$1', $item['title'] );
-		$post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
+		list($author,$post) = explode( ':', $title, 2 );
 		$link = clean_url($item['link']);
 
 		echo &quot;\t&lt;li&gt;&lt;a href='$link'&gt;&lt;span class='post'&gt;$post&lt;/span&gt;&lt;span class='hidden'&gt; - &lt;/span&gt;&lt;cite&gt;$author&lt;/cite&gt;&lt;/a&gt;&lt;/li&gt;\n&quot;;</diff>
      <filename>wp-admin/includes/dashboard.php</filename>
    </modified>
    <modified>
      <diff>@@ -17,7 +17,7 @@ header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
 $where = '';
 if ( $author and $author != 'all' ) {
 	$author_id = (int) $author;
-	$where = &quot; WHERE post_author = '$author_id' &quot;;
+	$where = $wpdb-&gt;prepare(&quot; WHERE post_author = %d &quot;, $author_id);
 }
 
 // grab a snapshot of post IDs, just in case it changes during the export
@@ -201,6 +201,7 @@ echo '&lt;?xml version=&quot;1.0&quot; encoding=&quot;' . get_bloginfo('charset') . '&quot;?' . &quot;&gt;\n&quot;;
 &lt;guid isPermaLink=&quot;false&quot;&gt;&lt;?php the_guid(); ?&gt;&lt;/guid&gt;
 &lt;description&gt;&lt;/description&gt;
 &lt;content:encoded&gt;&lt;?php echo wxr_cdata( apply_filters('the_content_export', $post-&gt;post_content) ); ?&gt;&lt;/content:encoded&gt;
+&lt;excerpt:encoded&gt;&lt;?php echo wxr_cdata( apply_filters('the_excerpt_export', $post-&gt;post_excerpt) ); ?&gt;&lt;/excerpt:encoded&gt;
 &lt;wp:post_id&gt;&lt;?php echo $post-&gt;ID; ?&gt;&lt;/wp:post_id&gt;
 &lt;wp:post_date&gt;&lt;?php echo $post-&gt;post_date; ?&gt;&lt;/wp:post_date&gt;
 &lt;wp:post_date_gmt&gt;&lt;?php echo $post-&gt;post_date_gmt; ?&gt;&lt;/wp:post_date_gmt&gt;
@@ -217,7 +218,7 @@ if ($post-&gt;post_type == 'attachment') { ?&gt;
 &lt;wp:attachment_url&gt;&lt;?php echo wp_get_attachment_url($post-&gt;ID); ?&gt;&lt;/wp:attachment_url&gt;
 &lt;?php } ?&gt;
 &lt;?php
-$postmeta = $wpdb-&gt;get_results(&quot;SELECT * FROM $wpdb-&gt;postmeta WHERE post_id = $post-&gt;ID&quot;);
+$postmeta = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;postmeta WHERE post_id = %d&quot;, $post-&gt;ID) );
 if ( $postmeta ) {
 ?&gt;
 &lt;?php foreach( $postmeta as $meta ) { ?&gt;
@@ -228,7 +229,7 @@ if ( $postmeta ) {
 &lt;?php } ?&gt;
 &lt;?php } ?&gt;
 &lt;?php
-$comments = $wpdb-&gt;get_results(&quot;SELECT * FROM $wpdb-&gt;comments WHERE comment_post_ID = $post-&gt;ID&quot;);
+$comments = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;comments WHERE comment_post_ID = %d&quot;, $post-&gt;ID) );
 if ( $comments ) { foreach ( $comments as $c ) { ?&gt;
 &lt;wp:comment&gt;
 &lt;wp:comment_id&gt;&lt;?php echo $c-&gt;comment_ID; ?&gt;&lt;/wp:comment_id&gt;
@@ -252,4 +253,4 @@ if ( $comments ) { foreach ( $comments as $c ) { ?&gt;
 &lt;?php
 }
 
-?&gt;
\ No newline at end of file
+?&gt;</diff>
      <filename>wp-admin/includes/export.php</filename>
    </modified>
    <modified>
      <diff>@@ -34,19 +34,47 @@ function get_home_path() {
 
 function get_real_file_to_edit( $file ) {
 	if ('index.php' == $file || '.htaccess' == $file ) {
-		$real_file = get_home_path().$file;
+		$real_file = get_home_path() . $file;
 	} else {
-		$real_file = ABSPATH.$file;
+		$real_file = WP_CONTENT_DIR . $file;
 	}
 
 	return $real_file;
 }
+//$folder = Full path to folder
+//$levels = Levels of folders to follow, Default: 100 (PHP Loop limit)
+function list_files( $folder = '', $levels = 100 ) {
+	if( empty($folder) )
+		return false;
+
+	if( ! $levels )
+		return false;
+
+	$files = array();
+	if ( $dir = @opendir( $folder ) ) {
+		while (($file = readdir( $dir ) ) !== false ) {
+			if ( in_array($file, array('.', '..') ) )
+				continue;
+			if ( is_dir( $folder . '/' . $file ) ) {
+				$files2 = list_files( $folder . '/' . $file, $levels - 1);
+				if( $files2 )
+					$files = array_merge($files, $files2 );
+				else
+					$files[] = $folder . '/' . $file . '/';
+			} else {
+				$files[] = $folder . '/' . $file;
+			}
+		}
+	}
+	@closedir( $dir );
+	return $files;
+}
 
 function get_temp_dir() {
 	if ( defined('WP_TEMP_DIR') )
 		return trailingslashit(WP_TEMP_DIR);
 
-	$temp = ABSPATH . 'wp-content/';
+	$temp = WP_CONTENT_DIR . '/';
 	if ( is_dir($temp) &amp;&amp; is_writable($temp) )
 		return $temp;
 
@@ -56,20 +84,16 @@ function get_temp_dir() {
 	return '/tmp/';
 }
 
-function validate_file( $file, $allowed_files = '' ) {
-	if ( false !== strpos( $file, '..' ))
-		return 1;
+function wp_tempnam($filename = '', $dir = ''){
+	if ( empty($dir) )
+		$dir = get_temp_dir();
+	$filename = basename($filename);
+	if ( empty($filename) )
+		$filename = time();
 
-	if ( false !== strpos( $file, './' ))
-		return 1;
-
-	if (':' == substr( $file, 1, 1 ))
-		return 2;
-
-	if (!empty ( $allowed_files ) &amp;&amp; (!in_array( $file, $allowed_files ) ) )
-		return 3;
-
-	return 0;
+	$filename = $dir . wp_unique_filename($dir, $filename);
+	touch($filename);
+	return $filename;
 }
 
 function validate_file_to_edit( $file, $allowed_files = '' ) {
@@ -172,8 +196,105 @@ function wp_handle_upload( &amp;$file, $overrides = false ) {
 
 	// Move the file to the uploads dir
 	$new_file = $uploads['path'] . &quot;/$filename&quot;;
-	if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) )
-		wp_die( printf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ));
+	if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) {
+		return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
+	}
+
+	// Set correct file permissions
+	$stat = stat( dirname( $new_file ));
+	$perms = $stat['mode'] &amp; 0000666;
+	@ chmod( $new_file, $perms );
+
+	// Compute the URL
+	$url = $uploads['url'] . &quot;/$filename&quot;;
+
+	$return = apply_filters( 'wp_handle_upload', array( 'file' =&gt; $new_file, 'url' =&gt; $url, 'type' =&gt; $type ) );
+
+	return $return;
+}
+// Pass this function an array similar to that of a $_FILES POST array.
+function wp_handle_sideload( &amp;$file, $overrides = false ) {
+	// The default error handler.
+	if (! function_exists( 'wp_handle_upload_error' ) ) {
+		function wp_handle_upload_error( &amp;$file, $message ) {
+			return array( 'error'=&gt;$message );
+		}
+	}
+
+	// You may define your own function and pass the name in $overrides['upload_error_handler']
+	$upload_error_handler = 'wp_handle_upload_error';
+
+	// $_POST['action'] must be set and its value must equal $overrides['action'] or this:
+	$action = 'wp_handle_sideload';
+
+	// Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
+	$upload_error_strings = array( false,
+		__( &quot;The file exceeds the &lt;code&gt;upload_max_filesize&lt;/code&gt; directive in &lt;code&gt;php.ini&lt;/code&gt;.&quot; ),
+		__( &quot;The file exceeds the &lt;em&gt;MAX_FILE_SIZE&lt;/em&gt; directive that was specified in the HTML form.&quot; ),
+		__( &quot;The file was only partially uploaded.&quot; ),
+		__( &quot;No file was sent.&quot; ),
+		__( &quot;Missing a temporary folder.&quot; ),
+		__( &quot;Failed to write file to disk.&quot; ));
+
+	// All tests are on by default. Most can be turned off by $override[{test_name}] = false;
+	$test_form = true;
+	$test_size = true;
+
+	// If you override this, you must provide $ext and $type!!!!
+	$test_type = true;
+	$mimes = false;
+
+	// Install user overrides. Did we mention that this voids your warranty?
+	if ( is_array( $overrides ) )
+		extract( $overrides, EXTR_OVERWRITE );
+
+	// A correct form post will pass this test.
+	if ( $test_form &amp;&amp; (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) )
+		return $upload_error_handler( $file, __( 'Invalid form submission.' ));
+
+	// A successful upload will pass this test. It makes no sense to override this one.
+	if ( $file['error'] &gt; 0 )
+		return $upload_error_handler( $file, $upload_error_strings[$file['error']] );
+
+	// A non-empty file will pass this test.
+	if ( $test_size &amp;&amp; !(filesize($file['tmp_name']) &gt; 0 ) )
+		return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' ));
+
+	// A properly uploaded file will pass this test. There should be no reason to override this one.
+	if (! @ is_file( $file['tmp_name'] ) )
+		return $upload_error_handler( $file, __( 'Specified file does not exist.' ));
+
+	// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
+	if ( $test_type ) {
+		$wp_filetype = wp_check_filetype( $file['name'], $mimes );
+
+		extract( $wp_filetype );
+
+		if ( ( !$type || !$ext ) &amp;&amp; !current_user_can( 'unfiltered_upload' ) )
+			return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
+
+		if ( !$ext )
+			$ext = ltrim(strrchr($file['name'], '.'), '.');
+
+		if ( !$type )
+			$type = $file['type'];
+	}
+
+	// A writable uploads dir will pass this test. Again, there's no point overriding this one.
+	if ( ! ( ( $uploads = wp_upload_dir() ) &amp;&amp; false === $uploads['error'] ) )
+		return $upload_error_handler( $file, $uploads['error'] );
+
+	$filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
+	
+	// Strip the query strings.
+	$filename = str_replace('?','-', $filename);
+	$filename = str_replace('&amp;','-', $filename);
+	
+	// Move the file to the uploads dir
+	$new_file = $uploads['path'] . &quot;/$filename&quot;;
+	if ( false === @ rename( $file['tmp_name'], $new_file ) ) {
+		return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
+	}
 
 	// Set correct file permissions
 	$stat = stat( dirname( $new_file ));
@@ -199,7 +320,7 @@ function download_url( $url ) {
 	if( ! $url )
 		return new WP_Error('http_no_url', __('Invalid URL Provided'));
 
-	$tmpfname = tempnam(get_temp_dir(), 'wpupdate');
+	$tmpfname = wp_tempnam($url);
 	if( ! $tmpfname )
 		return new WP_Error('http_no_file', __('Could not create Temporary file'));
 
@@ -259,13 +380,13 @@ function unzip_file($file, $to) {
 			$tmppath .= $path[$j] . '/';
 			if ( ! $fs-&gt;is_dir($to . $tmppath) )
 				if ( !$fs-&gt;mkdir($to . $tmppath, 0755) )
-					return new WP_Error('mkdir_failed', __('Could not create directory'));
+					return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $tmppath);
 		}
 
 		// We've made sure the folders are there, so let's extract the file now:
 		if ( ! $file['folder'] )
 			if ( !$fs-&gt;put_contents( $to . $file['filename'], $file['content']) )
-				return new WP_Error('copy_failed', __('Could not copy file'));
+				return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']);
 			$fs-&gt;chmod($to . $file['filename'], 0644);
 	}
 
@@ -283,27 +404,33 @@ function copy_dir($from, $to) {
 	foreach ( (array) $dirlist as $filename =&gt; $fileinfo ) {
 		if ( 'f' == $fileinfo['type'] ) {
 			if ( ! $wp_filesystem-&gt;copy($from . $filename, $to . $filename, true) )
-				return false;
+				return new WP_Error('copy_failed', __('Could not copy file'), $to . $filename);
 			$wp_filesystem-&gt;chmod($to . $filename, 0644);
 		} elseif ( 'd' == $fileinfo['type'] ) {
 			if ( !$wp_filesystem-&gt;mkdir($to . $filename, 0755) )
-				return false;
-			if ( !copy_dir($from . $filename, $to . $filename) )
-				return false;
+				return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $filename);
+			$result = copy_dir($from . $filename, $to . $filename);
+			if ( is_wp_error($result) )
+				return $result;
 		}
 	}
-
-	return true;
 }
 
-function WP_Filesystem( $args = false, $preference = false ) {
+function WP_Filesystem( $args = false ) {
 	global $wp_filesystem;
 
-	$method = get_filesystem_method($preference);
+	require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
+
+	$method = get_filesystem_method();
+
 	if ( ! $method )
 		return false;
 
-	require_once('class-wp-filesystem-'.$method.'.php');
+	$abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method);
+	if( ! file_exists($abstraction_file) )
+		return;
+
+	require_once($abstraction_file);
 	$method = &quot;WP_Filesystem_$method&quot;;
 
 	$wp_filesystem = new $method($args);
@@ -318,18 +445,17 @@ function WP_Filesystem( $args = false, $preference = false ) {
 }
 
 function get_filesystem_method() {
-	$tempFile = tempnam(get_temp_dir(), 'WPU');
-
-	if ( getmyuid() == fileowner($tempFile) ) {
-		unlink($tempFile);
-		return 'direct';
-	} else {
-		unlink($tempFile);
+	$method = false;
+	if( function_exists('getmyuid') &amp;&amp; function_exists('fileowner') ){
+		$temp_file = wp_tempnam();
+		if ( getmyuid() == fileowner($temp_file) )
+			$method = 'direct';
+		unlink($temp_file);
 	}
 
-	if ( extension_loaded('ftp') ) return 'ftpext';
-	if ( extension_loaded('sockets') || function_exists('fsockopen') ) return 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
-	return false;
+	if ( ! $method &amp;&amp; extension_loaded('ftp') ) $method = 'ftpext';
+	if ( ! $method &amp;&amp; ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
+	return apply_filters('filesystem_method', $method);
 }
 
-?&gt;
+?&gt;
\ No newline at end of file</diff>
      <filename>wp-admin/includes/file.php</filename>
    </modified>
    <modified>
      <diff>@@ -235,7 +235,7 @@ function wp_read_image_metadata( $file ) {
 
 	// fetch additional info from exif if available
 	if ( is_callable('exif_read_data') &amp;&amp; in_array($sourceImageType, apply_filters('wp_read_image_metadata_types', array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM)) ) ) {
-		$exif = exif_read_data( $file );
+		$exif = @exif_read_data( $file );
 		if (!empty($exif['FNumber']))
 			$meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
 		if (!empty($exif['Model']))</diff>
      <filename>wp-admin/includes/image.php</filename>
    </modified>
    <modified>
      <diff>@@ -26,11 +26,14 @@ function update_gallery_tab($tabs) {
 add_filter('media_upload_tabs', 'update_gallery_tab');
 
 function the_media_upload_tabs() {
+	global $redir_tab;
 	$tabs = media_upload_tabs();
 
 	if ( !empty($tabs) ) {
 		echo &quot;&lt;ul id='sidemenu'&gt;\n&quot;;
-		if ( isset($_GET['tab']) &amp;&amp; array_key_exists($_GET['tab'], $tabs) )
+		if ( isset($redir_tab) &amp;&amp; array_key_exists($redir_tab, $tabs) )
+			$current = $redir_tab;
+		elseif ( isset($_GET['tab']) &amp;&amp; array_key_exists($_GET['tab'], $tabs) )
 			$current = $_GET['tab'];
 		else {
 			$keys = array_keys($tabs);
@@ -41,8 +44,8 @@ function the_media_upload_tabs() {
 			if ( $current == $callback )
 				$class = &quot; class='current'&quot;;
 			$href = add_query_arg(array('tab'=&gt;$callback, 's'=&gt;false, 'paged'=&gt;false, 'post_mime_type'=&gt;false, 'm'=&gt;false));
-			$link = &quot;&lt;a href='$href'$class&gt;$text&lt;/a&gt;&quot;;
-			echo &quot;\t&lt;li id='tab-$callback'&gt;$link&lt;/li&gt;\n&quot;;
+			$link = &quot;&lt;a href='&quot; . clean_url($href) . &quot;'$class&gt;$text&lt;/a&gt;&quot;;
+			echo &quot;\t&lt;li id='&quot; . attribute_escape(&quot;tab-$callback&quot;) . &quot;'&gt;$link&lt;/li&gt;\n&quot;;
 		}
 		echo &quot;&lt;/ul&gt;\n&quot;;
 	}
@@ -55,20 +58,39 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal
 	$rel = $rel ? ' rel=&quot;attachment wp-att-'.attribute_escape($id).'&quot;' : '';
 
 	if ( $url )
-		$html = &quot;&lt;a href='&quot;.attribute_escape($url).&quot;'$rel&gt;$html&lt;/a&gt;&quot;;
+		$html = '&lt;a href=&quot;' . clean_url($url) . &quot;\&quot;$rel&gt;$html&lt;/a&gt;&quot;;
 
-	$html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url );
+	$html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size );
 
 	return $html;
 }
 
+function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
+
+	if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html;
+	$id = ( 0 &lt; (int) $id ) ? 'attachment_' . $id : '';
+
+	preg_match( '/width=&quot;([0-9]+)/', $html, $matches );
+	if ( ! isset($matches[1]) ) return $html;
+	$width = $matches[1];
+
+	$html = preg_replace( '/align[^\s\'&quot;]+\s?/', '', $html );
+	if ( empty($align) ) $align = 'none';
+
+	$shcode = '[caption id=&quot;' . $id . '&quot; align=&quot;align' . $align
+	. '&quot; width=&quot;' . $width . '&quot; caption=&quot;' . $alt . '&quot;]' . $html . '[/caption]';
+
+	return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
+}
+add_filter( 'image_send_to_editor', 'image_add_caption', 20, 7 );
+
 function media_send_to_editor($html) {
 	?&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;
-&lt;!--
-top.send_to_editor('&lt;?php echo addslashes($html); ?&gt;');
-top.tb_remove();
---&gt;
+/* &lt;![CDATA[ */
+var win = window.dialogArguments || opener || parent || top;
+win.send_to_editor('&lt;?php echo addslashes($html); ?&gt;');
+/* ]]&gt; */
 &lt;/script&gt;
 	&lt;?php
 	exit;
@@ -80,7 +102,7 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
 	$file = wp_handle_upload($_FILES[$file_id], $overrides);
 
 	if ( isset($file['error']) )
-		return new wp_error( 'upload_error', $file['error'] );
+		return new WP_Error( 'upload_error', $file['error'] );
 
 	$url = $file['url'];
 	$type = $file['type'];
@@ -115,6 +137,47 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
 
 }
 
+function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
+	$overrides = array('test_form'=&gt;false);
+	$file = wp_handle_sideload($file_array, $overrides);
+
+	if ( isset($file['error']) )
+		return new WP_Error( 'upload_error', $file['error'] );
+
+	$url = $file['url'];
+	$type = $file['type'];
+	$file = $file['file'];
+	$title = preg_replace('/\.[^.]+$/', '', basename($file));
+	$content = '';
+
+	// use image exif/iptc data for title and caption defaults if possible
+	if ( $image_meta = @wp_read_image_metadata($file) ) {
+		if ( trim($image_meta['title']) )
+			$title = $image_meta['title'];
+		if ( trim($image_meta['caption']) )
+			$content = $image_meta['caption'];
+	}
+
+	$title = @$desc;
+
+	// Construct the attachment array
+	$attachment = array_merge( array(
+		'post_mime_type' =&gt; $type,
+		'guid' =&gt; $url,
+		'post_parent' =&gt; $post_id,
+		'post_title' =&gt; $title,
+		'post_content' =&gt; $content,
+	), $post_data );
+
+	// Save the data
+	$id = wp_insert_attachment($attachment, $file, $post_parent);
+	if ( !is_wp_error($id) ) {
+		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
+		return $url;
+	}
+	return $id;
+}
+
 
 // wrap iframe content (produced by $content_func) in a doctype, html head/body etc
 // any additional function args will be passed to content_func
@@ -126,9 +189,12 @@ function wp_iframe($content_func /* ... */) {
 &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;&lt;?php bloginfo('html_type'); ?&gt;; charset=&lt;?php echo get_option('blog_charset'); ?&gt;&quot; /&gt;
 &lt;title&gt;&lt;?php bloginfo('name') ?&gt; &amp;rsaquo; &lt;?php _e('Uploads'); ?&gt; &amp;#8212; &lt;?php _e('WordPress'); ?&gt;&lt;/title&gt;
 &lt;?php
-wp_admin_css( 'css/global' );
-wp_admin_css();
-wp_admin_css( 'css/colors' );
+wp_enqueue_style( 'global' );
+wp_enqueue_style( 'wp-admin' );
+wp_enqueue_style( 'colors' );
+if ( 0 === strpos( $content_func, 'media' ) )
+	wp_enqueue_style( 'media' );
+
 ?&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;
 //&lt;![CDATA[
@@ -136,6 +202,7 @@ function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}el
 //]]&gt;
 &lt;/script&gt;
 &lt;?php
+do_action('admin_print_styles');
 do_action('admin_print_scripts');
 do_action('admin_head');
 if ( is_string($content_func) )
@@ -167,53 +234,20 @@ function media_buttons() {
 	$audio_title = __('Add Audio');
 	$out = &lt;&lt;&lt;EOF
 
-	&lt;a href=&quot;{$image_upload_iframe_src}&amp;amp;TB_iframe=true&amp;amp;height=500&amp;amp;width=640&quot; class=&quot;thickbox&quot; title='$image_title'&gt;&lt;img src='images/media-button-image.gif' alt='$image_title' /&gt;&lt;/a&gt;
-	&lt;a href=&quot;{$video_upload_iframe_src}&amp;amp;TB_iframe=true&amp;amp;height=500&amp;amp;width=640&quot; class=&quot;thickbox&quot; title='$video_title'&gt;&lt;img src='images/media-button-video.gif' alt='$video_title' /&gt;&lt;/a&gt;
-	&lt;a href=&quot;{$audio_upload_iframe_src}&amp;amp;TB_iframe=true&amp;amp;height=500&amp;amp;width=640&quot; class=&quot;thickbox&quot; title='$audio_title'&gt;&lt;img src='images/media-button-music.gif' alt='$audio_title' /&gt;&lt;/a&gt;
-	&lt;a href=&quot;{$media_upload_iframe_src}&amp;amp;TB_iframe=true&amp;amp;height=500&amp;amp;width=640&quot; class=&quot;thickbox&quot; title='$media_title'&gt;&lt;img src='images/media-button-other.gif' alt='$media_title' /&gt;&lt;/a&gt;
+	&lt;a href=&quot;{$image_upload_iframe_src}&amp;amp;TB_iframe=true&quot; id=&quot;add_image&quot; class=&quot;thickbox&quot; title='$image_title'&gt;&lt;img src='images/media-button-image.gif' alt='$image_title' /&gt;&lt;/a&gt;
+	&lt;a href=&quot;{$video_upload_iframe_src}&amp;amp;TB_iframe=true&quot; id=&quot;add_video&quot; class=&quot;thickbox&quot; title='$video_title'&gt;&lt;img src='images/media-button-video.gif' alt='$video_title' /&gt;&lt;/a&gt;
+	&lt;a href=&quot;{$audio_upload_iframe_src}&amp;amp;TB_iframe=true&quot; id=&quot;add_audio&quot; class=&quot;thickbox&quot; title='$audio_title'&gt;&lt;img src='images/media-button-music.gif' alt='$audio_title' /&gt;&lt;/a&gt;
+	&lt;a href=&quot;{$media_upload_iframe_src}&amp;amp;TB_iframe=true&quot; id=&quot;add_media&quot; class=&quot;thickbox&quot; title='$media_title'&gt;&lt;img src='images/media-button-other.gif' alt='$media_title' /&gt;&lt;/a&gt;
 
 EOF;
 	printf($context, $out);
 }
 add_action( 'media_buttons', 'media_buttons' );
-
-function media_buttons_head() {
-$siteurl = get_option('siteurl');
-echo &quot;&lt;style type='text/css' media='all'&gt;
-	@import '{$siteurl}/wp-includes/js/thickbox/thickbox.css?1';
-	div#TB_title {
-		background-color: #222222;
-		color: #cfcfcf;
-	}
-	div#TB_title a, div#TB_title a:visited {
-		color: #cfcfcf;
-	}
-&lt;/style&gt;\n&quot;;
-}
-
-add_action( 'admin_print_scripts', 'media_buttons_head' );
-
-function media_admin_css() {
-	wp_admin_css('css/media');
-}
-
 add_action('media_upload_media', 'media_upload_handler');
 
 function media_upload_form_handler() {
 	check_admin_referer('media-form');
 
-	// Insert media button was clicked
-	if ( isset($_POST['html-upload']) &amp;&amp; !empty($_FILES) ) {
-		// Upload File button was clicked
-
-		$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
-
-		if ( is_wp_error($id) ) {
-			$errors['upload_error'] = $id;
-			$id = false;
-		}
-	}
-
 	if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id =&gt; $attachment ) {
 		$post = $_post = get_post($attachment_id, ARRAY_A);
 		if ( isset($attachment['post_content']) )
@@ -222,6 +256,8 @@ function media_upload_form_handler() {
 			$post['post_title'] = $attachment['post_title'];
 		if ( isset($attachment['post_excerpt']) )
 			$post['post_excerpt'] = $attachment['post_excerpt'];
+		if ( isset($attachment['menu_order']) )
+			$post['menu_order'] = $attachment['menu_order'];
 
 		$post = apply_filters('attachment_fields_to_save', $post, $attachment);
 
@@ -244,7 +280,7 @@ function media_upload_form_handler() {
 	if ( isset($_POST['send']) ) {
 		$keys = array_keys($_POST['send']);
 		$send_id = (int) array_shift($keys);
-		$attachment = $_POST['attachments'][$send_id];
+		$attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
 		$html = $attachment['post_title'];
 		if ( !empty($attachment['url']) ) {
 			if ( strpos($attachment['url'], 'attachment_id') || false !== strpos($attachment['url'], get_permalink($_POST['post_id'])) )
@@ -292,12 +328,36 @@ function media_upload_image() {
 			$errors = $return;
 	}
 
-	if ( isset($_POST['save']) )
+	if ( isset($_POST['save']) ) {
 		$errors['upload_notice'] = __('Saved.');
+		return media_upload_gallery();
+	}
 
 	return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
 }
 
+function media_sideload_image($file, $post_id, $desc = null) {
+	if (!empty($file) ) {
+		$file_array['name'] = basename($file);
+		$file_array['tmp_name'] = download_url($file);
+		$desc = @$desc;
+
+		$id = media_handle_sideload($file_array, $post_id, $desc);
+		$src = $id;
+
+		if ( is_wp_error($id) ) {
+			@unlink($file_array['tmp_name']);
+			return $id;
+		}
+	}
+
+	if ( !empty($src) ) {
+		$alt = @$desc;
+		$html = &quot;&lt;img src='$src' alt='$alt' /&gt;&quot;;
+		return $html;
+	}
+}
+
 function media_upload_audio() {
 	if ( isset($_POST['html-upload']) &amp;&amp; !empty($_FILES) ) {
 		// Upload File button was clicked
@@ -330,8 +390,10 @@ function media_upload_audio() {
 			$errors = $return;
 	}
 
-	if ( isset($_POST['save']) )
+	if ( isset($_POST['save']) ) {
 		$errors['upload_notice'] = __('Saved.');
+		return media_upload_gallery();
+	}
 
 	return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
 }
@@ -368,8 +430,10 @@ function media_upload_video() {
 			$errors = $return;
 	}
 
-	if ( isset($_POST['save']) )
+	if ( isset($_POST['save']) ) {
 		$errors['upload_notice'] = __('Saved.');
+		return media_upload_gallery();
+	}
 
 	return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
 }
@@ -406,8 +470,10 @@ function media_upload_file() {
 			$errors = $return;
 	}
 
-	if ( isset($_POST['save']) )
+	if ( isset($_POST['save']) ) {
 		$errors['upload_notice'] = __('Saved.');
+		return media_upload_gallery();
+	}
 
 	return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
 }
@@ -422,6 +488,7 @@ function media_upload_gallery() {
 			$errors = $return;
 	}
 
+	wp_enqueue_script('admin-gallery');
 	return wp_iframe( 'media_upload_gallery_form', $errors );
 }
 
@@ -441,8 +508,9 @@ function media_upload_library() {
 function image_attachment_fields_to_edit($form_fields, $post) {
 	if ( substr($post-&gt;post_mime_type, 0, 5) == 'image' ) {
 		$form_fields['post_title']['required'] = true;
+
 		$form_fields['post_excerpt']['label'] = __('Caption');
-		$form_fields['post_excerpt']['helps'][] = __('Alternate text, e.g. &quot;The Mona Lisa&quot;');
+		$form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
 
 		$form_fields['post_content']['label'] = __('Description');
 
@@ -558,6 +626,10 @@ function get_attachment_fields_to_edit($post, $errors = null) {
 				&lt;/script&gt;\n&quot;,
 			'helps'      =&gt; __('Enter a link URL or click above for presets.'),
 		),
+    	'menu_order'   =&gt; array(
+			'label'      =&gt; __('Order'),
+			'value'      =&gt; $edit_post-&gt;menu_order
+		),
 	);
 
 	foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
@@ -590,11 +662,12 @@ function get_attachment_fields_to_edit($post, $errors = null) {
 }
 
 function get_media_items( $post_id, $errors ) {
-	if ( $post_id &amp;&amp; $post = get_post($post_id) ) {
-		if ( $post-&gt;post_type == 'attachment' )
+	if ( $post_id ) {
+		$post = get_post($post_id);
+		if ( $post &amp;&amp; $post-&gt;post_type == 'attachment' )
 			$attachments = array($post-&gt;ID =&gt; $post);
 		else
-			$attachments = get_children(&quot;post_parent=$post_id&amp;post_type=attachment&amp;orderby=menu_order ASC, ID&amp;order=DESC&quot;);
+			$attachments = get_children( array( 'post_parent' =&gt; $post_id, 'post_type' =&gt; 'attachment', 'orderby' =&gt; 'menu_order ASC, ID', 'order' =&gt; 'DESC') );
 	} else {
 		if ( is_array($GLOBALS['wp_the_query']-&gt;posts) )
 			foreach ( $GLOBALS['wp_the_query']-&gt;posts as $attachment )
@@ -606,12 +679,14 @@ function get_media_items( $post_id, $errors ) {
 
 	foreach ( $attachments as $id =&gt; $attachment )
 		if ( $item = get_media_item( $id, array( 'errors' =&gt; isset($errors[$id]) ? $errors[$id] : null) ) )
-			$output .= &quot;\n&lt;div id='media-item-$id' class='media-item child-of-$attachment-&gt;post_parent preloaded'&gt;&lt;div id='media-upload-error-$id'&gt;&lt;/div&gt;&lt;div class='filename'&gt;&lt;/div&gt;&lt;div class='progress'&gt;&lt;div class='bar'&gt;&lt;/div&gt;&lt;/div&gt;$item&lt;div class='progress clickmask'&gt;&lt;/div&gt;\n&lt;/div&gt;&quot;;
+			$output .= &quot;\n&lt;div id='media-item-$id' class='media-item child-of-$attachment-&gt;post_parent preloaded'&gt;&lt;div class='progress'&gt;&lt;div class='bar'&gt;&lt;/div&gt;&lt;/div&gt;&lt;div id='media-upload-error-$id'&gt;&lt;/div&gt;&lt;div class='filename'&gt;&lt;/div&gt;$item\n&lt;/div&gt;&quot;;
 
 	return $output;
 }
 
 function get_media_item( $attachment_id, $args = null ) {
+	global $redir_tab;
+
 	$default_args = array( 'errors' =&gt; null, 'send' =&gt; true, 'delete' =&gt; true, 'toggle' =&gt; true );
 	$args = wp_parse_args( $args, $default_args );
 	extract( $args, EXTR_SKIP );
@@ -643,7 +718,7 @@ function get_media_item( $attachment_id, $args = null ) {
 	if ( isset($post_mime_types) ) {
 		$keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post-&gt;post_mime_type));
 		$type = array_shift($keys);
-		$type = &quot;&lt;input type='hidden' id='type-of-$attachment_id' value='$type' /&gt;&quot;;
+		$type = &quot;&lt;input type='hidden' id='type-of-$attachment_id' value='&quot; . attribute_escape( $type ) . &quot;' /&gt;&quot;;
 	}
 
 	$form_fields = get_attachment_fields_to_edit($post, $errors);
@@ -659,21 +734,38 @@ function get_media_item( $attachment_id, $args = null ) {
 	}
 
 	$display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
+	$display_title = wp_html_excerpt($display_title, 60);
+
+	$gallery = ( (isset($_REQUEST['tab']) &amp;&amp; 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) &amp;&amp; 'gallery' == $redir_tab) ) ? true : false;
+	$order = '';
+
+	foreach ( $form_fields as $key =&gt; $val ) {
+		if ( 'menu_order' == $key ) {
+			if ( $gallery )
+				$order = '&lt;div class=&quot;menu_order&quot;&gt; &lt;input class=&quot;menu_order_input&quot; type=&quot;text&quot; id=&quot;attachments['.$attachment_id.'][menu_order]&quot; name=&quot;attachments['.$attachment_id.'][menu_order]&quot; value=&quot;'.$val['value'].'&quot; /&gt;&lt;/div&gt;';
+			else
+				$order = '&lt;input type=&quot;hidden&quot; name=&quot;attachments['.$attachment_id.'][menu_order]&quot; value=&quot;'.$val['value'].'&quot; /&gt;';
+
+			unset($form_fields['menu_order']);
+			break;
+		}
+	}
 
 	$item = &quot;
 	$type
 	$toggle_links
+	$order
 	&lt;div class='filename new'&gt;$display_title&lt;/div&gt;
 	&lt;table class='slidetoggle describe $class'&gt;
-		&lt;tbody class='media-item-info'&gt;
+		&lt;thead class='media-item-info'&gt;
 		&lt;tr&gt;
 			&lt;td class='A1B1' rowspan='4'&gt;&lt;img class='thumbnail' src='$thumb_url' alt='' /&gt;&lt;/td&gt;
 			&lt;td&gt;$filename&lt;/td&gt;
 		&lt;/tr&gt;
-		&lt;td&gt;$post-&gt;post_mime_type&lt;/td&gt;&lt;/tr&gt;
+		&lt;tr&gt;&lt;td&gt;$post-&gt;post_mime_type&lt;/td&gt;&lt;/tr&gt;
 		&lt;tr&gt;&lt;td&gt;&quot; . mysql2date($post-&gt;post_date, get_option('time_format')) . &quot;&lt;/td&gt;&lt;/tr&gt;
-		&lt;tr&gt;&lt;td&gt;&quot; . apply_filters('media_meta', '', $post) . &quot;&lt;/tr&gt;&lt;/td&gt;
-		&lt;/tbody&gt;
+		&lt;tr&gt;&lt;td&gt;&quot; . apply_filters('media_meta', '', $post) . &quot;&lt;/td&gt;&lt;/tr&gt;
+		&lt;/thead&gt;
 		&lt;tbody&gt;\n&quot;;
 
 	$defaults = array(
@@ -685,11 +777,13 @@ function get_media_item( $attachment_id, $args = null ) {
 
 	$delete_href = wp_nonce_url(&quot;post.php?action=delete-post&amp;amp;post=$attachment_id&quot;, 'delete-post_' . $attachment_id);
 	if ( $send )
-		$send = &quot;&lt;button type='submit' class='button' value='1' name='send[$attachment_id]'&gt;&quot; . __('Insert into Post') . '&lt;/button&gt;';
+		$send = &quot;&lt;input type='submit' class='button' name='send[$attachment_id]' value='&quot; . attribute_escape( __( 'Insert into Post' ) ) . &quot;' /&gt;&quot;;
 	if ( $delete )
-		$delete = &quot;&lt;a href='$delete_href' id='del[$attachment_id]' disabled='disabled' class='delete'&gt;&quot; . __('Delete') . &quot;&lt;/button&gt;&quot;;
+		$delete = &quot;&lt;a href=\&quot;#\&quot; class=\&quot;del-link\&quot; onclick=\&quot;document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\&quot;&gt;&quot; . __('Delete') . &quot;&lt;/a&gt;&quot;;
 	if ( ( $send || $delete ) &amp;&amp; !isset($form_fields['buttons']) )
-		$form_fields['buttons'] = array('tr' =&gt; &quot;\t\t&lt;tr class='submit'&gt;&lt;td&gt;&lt;/td&gt;&lt;td class='savesend'&gt;$send $delete&lt;/td&gt;&lt;/tr&gt;\n&quot;);
+		$form_fields['buttons'] = array('tr' =&gt; &quot;\t\t&lt;tr class='submit'&gt;&lt;td&gt;&lt;/td&gt;&lt;td class='savesend'&gt;$send $delete
+		&lt;div id=\&quot;del_attachment_$attachment_id\&quot; class=\&quot;del-attachment\&quot; style=\&quot;display:none;\&quot;&gt;&quot; . sprintf(__(&quot;You are about to delete &lt;strong&gt;%s&lt;/strong&gt;.&quot;), $filename) . &quot; &lt;a href=\&quot;$delete_href\&quot; id=\&quot;del[$attachment_id]\&quot; class=\&quot;delete\&quot;&gt;&quot; . __('Continue') . &quot;&lt;/a&gt;
+		&lt;a href=\&quot;#\&quot; class=\&quot;del-link\&quot; onclick=\&quot;this.parentNode.style.display='none';return false;\&quot;&gt;&quot; . __('Cancel') . &quot;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;\n&quot;);
 
 	$hidden_fields = array();
 
@@ -711,6 +805,7 @@ function get_media_item( $attachment_id, $args = null ) {
 		}
 
 		$required = $field['required'] ? '&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;' : '';
+		$aria_required = $field['required'] ? &quot; aria-required='true' &quot; : '';
 		$class  = $id;
 		$class .= $field['required'] ? ' form-required' : '';
 
@@ -718,9 +813,9 @@ function get_media_item( $attachment_id, $args = null ) {
 		if ( !empty($field[$field['input']]) )
 			$item .= $field[$field['input']];
 		elseif ( $field['input'] == 'textarea' ) {
-			$item .= &quot;&lt;textarea type='text' id='$name' name='$name'&gt;&quot; . wp_specialchars($field['value'], 1) . &quot;&lt;/textarea&gt;&quot;;
+			$item .= &quot;&lt;textarea type='text' id='$name' name='$name'&gt;&quot; . attribute_escape( $field['value'] ) . $aria_required . &quot;&lt;/textarea&gt;&quot;;
 		} else {
-			$item .= &quot;&lt;input type='text' id='$name' name='$name' value='&quot; . wp_specialchars($field['value'], 1) . &quot;' /&gt;&quot;;
+			$item .= &quot;&lt;input type='text' id='$name' name='$name' value='&quot; . attribute_escape( $field['value'] ) . &quot;'&quot; . $aria_required . &quot;/&gt;&quot;;
 		}
 		if ( !empty($field['helps']) )
 			$item .= &quot;&lt;p class='help'&gt;&quot; . join( &quot;&lt;/p&gt;\n&lt;p class='help'&gt;&quot;, array_unique((array) $field['helps']) ) . '&lt;/p&gt;';
@@ -744,10 +839,11 @@ function get_media_item( $attachment_id, $args = null ) {
 
 	if ( !empty($form_fields['_final']) )
 		$item .= &quot;\t\t&lt;tr class='final'&gt;&lt;td colspan='2'&gt;{$form_fields['_final']}&lt;/td&gt;&lt;/tr&gt;\n&quot;;
+	$item .= &quot;\t&lt;/tbody&gt;\n&quot;;
 	$item .= &quot;\t&lt;/table&gt;\n&quot;;
 
 	foreach ( $hidden_fields as $name =&gt; $value )
-		$item .= &quot;\t&lt;input type='hidden' name='$name' id='$name' value='&quot; . wp_specialchars($value, 1) . &quot;' /&gt;\n&quot;;
+		$item .= &quot;\t&lt;input type='hidden' name='$name' id='$name' value='&quot; . attribute_escape( $value ) . &quot;' /&gt;\n&quot;;
 
 	return $item;
 }
@@ -764,7 +860,7 @@ function media_upload_header() {
 function media_upload_form( $errors = null ) {
 	global $type, $tab;
 
-	$flash_action_url = get_option('siteurl') . &quot;/wp-admin/async-upload.php&quot;;
+	$flash_action_url = admin_url('async-upload.php');
 
 	// If Mac and mod_security, no Flash. :(
 	$flash = true;
@@ -775,7 +871,6 @@ function media_upload_form( $errors = null ) {
 	$post_id = intval($_REQUEST['post_id']);
 
 ?&gt;
-&lt;input type='hidden' name='post_id' value='&lt;?php echo $post_id; ?&gt;' /&gt;
 &lt;div id=&quot;media-upload-notice&quot;&gt;
 &lt;?php if (isset($errors['upload_notice']) ) { ?&gt;
 	&lt;?php echo $errors['upload_notice']; ?&gt;
@@ -786,20 +881,25 @@ function media_upload_form( $errors = null ) {
 	&lt;?php echo $errors['upload_error']-&gt;get_error_message(); ?&gt;
 &lt;?php } ?&gt;
 &lt;/div&gt;
+
+&lt;?php do_action('pre-upload-ui'); ?&gt;
+
 &lt;?php if ( $flash ) : ?&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;
 &lt;!--
 jQuery(function($){
 	swfu = new SWFUpload({
 			upload_url : &quot;&lt;?php echo attribute_escape( $flash_action_url ); ?&gt;&quot;,
-			flash_url : &quot;&lt;?php echo get_option('siteurl').'/wp-includes/js/swfupload/swfupload_f9.swf'; ?&gt;&quot;,
+			flash_url : &quot;&lt;?php echo includes_url('js/swfupload/swfupload_f9.swf'); ?&gt;&quot;,
 			file_post_name: &quot;async-upload&quot;,
-			file_types: &quot;*.*&quot;,
+			file_types: &quot;&lt;?php echo apply_filters('upload_file_glob', '*.*'); ?&gt;&quot;,
 			post_params : {
 				&quot;post_id&quot; : &quot;&lt;?php echo $post_id; ?&gt;&quot;,
-				&quot;auth_cookie&quot; : &quot;&lt;?php echo $_COOKIE[AUTH_COOKIE]; ?&gt;&quot;,
+				&quot;auth_cookie&quot; : &quot;&lt;?php if ( is_ssl() ) echo $_COOKIE[SECURE_AUTH_COOKIE]; else echo $_COOKIE[AUTH_COOKIE]; ?&gt;&quot;,
+				&quot;_wpnonce&quot; : &quot;&lt;?php echo wp_create_nonce('media-form'); ?&gt;&quot;,
 				&quot;type&quot; : &quot;&lt;?php echo $type; ?&gt;&quot;,
-				&quot;tab&quot; : &quot;&lt;?php echo $tab; ?&gt;&quot;
+				&quot;tab&quot; : &quot;&lt;?php echo $tab; ?&gt;&quot;,
+				&quot;short&quot; : &quot;1&quot;
 			},
 			file_size_limit : &quot;&lt;?php echo wp_max_upload_size(); ?&gt;b&quot;,
 			swfupload_element_id : &quot;flash-upload-ui&quot;, // id of the element displayed when swfupload is available
@@ -814,31 +914,34 @@ jQuery(function($){
 			file_queue_error_handler : fileQueueError,
 			file_dialog_complete_handler : fileDialogComplete,
 
-			debug: false,
+			debug: false
 		});
 	$(&quot;#flash-browse-button&quot;).bind( &quot;click&quot;, function(){swfu.selectFiles();});
 });
 //--&gt;
 &lt;/script&gt;
 
-
 &lt;div id=&quot;flash-upload-ui&quot;&gt;
-	&lt;p&gt;&lt;input id=&quot;flash-browse-button&quot; type=&quot;button&quot; value=&quot;&lt;?php _e('Choose files to upload'); ?&gt;&quot; class=&quot;button&quot; /&gt;&lt;/p&gt;
-	&lt;p&gt;&lt;?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?&gt;&lt;/p&gt;
+&lt;?php do_action('pre-flash-upload-ui'); ?&gt;
+	&lt;p&gt;&lt;input id=&quot;flash-browse-button&quot; type=&quot;button&quot; value=&quot;&lt;?php echo attribute_escape( __( 'Choose files to upload' ) ); ?&gt;&quot; class=&quot;button&quot; /&gt;&lt;/p&gt;
+&lt;?php do_action('post-flash-upload-ui'); ?&gt;
+	&lt;p class=&quot;howto&quot;&gt;&lt;?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?&gt;&lt;/p&gt;
 &lt;/div&gt;
 
 &lt;?php endif; // $flash ?&gt;
 
 &lt;div id=&quot;html-upload-ui&quot;&gt;
+&lt;?php do_action('pre-html-upload-ui'); ?&gt;
 	&lt;p&gt;
-	&lt;input type=&quot;file&quot; name=&quot;async-upload&quot; id=&quot;async-upload&quot; /&gt; &lt;input type=&quot;submit&quot; class=&quot;button&quot; name=&quot;html-upload&quot; value=&quot;&lt;?php echo attribute_escape(__('Upload')); ?&gt;&quot; /&gt; &lt;a href=&quot;#&quot; onClick=&quot;return top.tb_remove();&quot;&gt;&lt;?php _e('Cancel'); ?&gt;&lt;/a&gt;
+	&lt;input type=&quot;file&quot; name=&quot;async-upload&quot; id=&quot;async-upload&quot; /&gt; &lt;input type=&quot;submit&quot; class=&quot;button&quot; name=&quot;html-upload&quot; value=&quot;&lt;?php echo attribute_escape(__('Upload')); ?&gt;&quot; /&gt; &lt;a href=&quot;#&quot; onclick=&quot;return top.tb_remove();&quot;&gt;&lt;?php _e('Cancel'); ?&gt;&lt;/a&gt;
 	&lt;/p&gt;
-	&lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; id=&quot;post_id&quot; value=&quot;&lt;?php echo $post_id; ?&gt;&quot; /&gt;
 	&lt;br class=&quot;clear&quot; /&gt;
 	&lt;?php if ( is_lighttpd_before_150() ): ?&gt;
 	&lt;p&gt;&lt;?php _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.'); ?&gt;&lt;/p&gt;
 	&lt;?php endif;?&gt;
+&lt;?php do_action('post-html-upload-ui'); ?&gt;
 &lt;/div&gt;
+&lt;?php do_action('post-upload-ui'); ?&gt;
 &lt;?php
 }
 
@@ -847,13 +950,14 @@ function media_upload_type_form($type = 'file', $errors = null, $id = null) {
 
 	$post_id = intval($_REQUEST['post_id']);
 
-	$form_action_url = get_option('siteurl') . &quot;/wp-admin/media-upload.php?type=$type&amp;tab=type&amp;post_id=$post_id&quot;;
+	$form_action_url = admin_url(&quot;media-upload.php?type=$type&amp;tab=type&amp;post_id=$post_id&quot;);
+	$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
 
 	$callback = &quot;type_form_$type&quot;;
 ?&gt;
 
 &lt;form enctype=&quot;multipart/form-data&quot; method=&quot;post&quot; action=&quot;&lt;?php echo attribute_escape($form_action_url); ?&gt;&quot; class=&quot;media-upload-form type-form validate&quot; id=&quot;&lt;?php echo $type; ?&gt;-form&quot;&gt;
-&lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; id=&quot;post_id&quot; value=&quot;&lt;?php echo $post_id; ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; id=&quot;post_id&quot; value=&quot;&lt;?php echo (int) $post_id; ?&gt;&quot; /&gt;
 &lt;?php wp_nonce_field('media-form'); ?&gt;
 &lt;h3&gt;&lt;?php _e('From Computer'); ?&gt;&lt;/h3&gt;
 &lt;?php media_upload_form( $errors ); ?&gt;
@@ -873,7 +977,7 @@ jQuery(function($){
 &lt;div id=&quot;media-items&quot;&gt;
 &lt;?php echo get_media_items( $id, $errors ); ?&gt;
 &lt;/div&gt;
-&lt;input type=&quot;submit&quot; class=&quot;button savebutton&quot; name=&quot;save&quot; value=&quot;&lt;?php _e('Save all changes'); ?&gt;&quot; /&gt;
+&lt;input type=&quot;submit&quot; class=&quot;button savebutton&quot; name=&quot;save&quot; value=&quot;&lt;?php echo attribute_escape( __( 'Save all changes' ) ); ?&gt;&quot; /&gt;
 
 &lt;?php elseif ( is_callable($callback) ) : ?&gt;
 
@@ -882,23 +986,100 @@ jQuery(function($){
 &lt;h3&gt;&lt;?php _e('From URL'); ?&gt;&lt;/h3&gt;
 &lt;/div&gt;
 
+&lt;script type=&quot;text/javascript&quot;&gt;
+//&lt;![CDATA[
+var addExtImage = {
+
+	width : '',
+	height : '',
+	align : 'alignnone',
+
+	insert : function() {
+		var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = null;
+
+		if ( '' == f.src.value || '' == t.width ) return false;
+
+		if ( f.title.value ) {
+			title = f.title.value.replace(/['&quot;&lt;&gt;]+/g, '');
+			title = ' title=&quot;'+title+'&quot;';
+		}
+
+		if ( f.alt.value ) {
+			alt = f.alt.value.replace(/['&quot;&lt;&gt;]+/g, '');
+&lt;?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?&gt;
+			caption = f.alt.value.replace(/'/g, '&amp;#39;').replace(/&quot;/g, '&amp;quot;').replace(/&lt;/g, '&amp;lt;').replace(/&gt;/g, '&amp;gt;');
+&lt;?php } ?&gt;
+		}
+
+		cls = caption ? '' : ' class=&quot;'+t.align+'&quot;';
+
+		html = '&lt;img alt=&quot;'+alt+'&quot; src=&quot;'+f.src.value+'&quot;'+title+cls+' width=&quot;'+t.width+'&quot; height=&quot;'+t.height+'&quot; /&gt;';
+
+		if ( f.url.value )
+			html = '&lt;a href=&quot;'+f.url.value+'&quot;&gt;'+html+'&lt;/a&gt;';
+
+		if ( caption )
+			html = '[caption id=&quot;&quot; align=&quot;'+t.align+'&quot; width=&quot;'+t.width+'&quot; caption=&quot;'+caption+'&quot;]'+html+'[/caption]';
+
+		var win = window.dialogArguments || opener || parent || top;
+		win.send_to_editor(html);
+	},
+
+	resetImageData : function() {
+		var t = addExtImage;
+
+		t.width = t.height = '';
+		document.getElementById('go_button').style.color = '#bbb';
+		if ( ! document.forms[0].src.value )
+			document.getElementById('status_img').src = 'images/required.gif';
+		else document.getElementById('status_img').src = 'images/no.png';
+	},
+
+	updateImageData : function() {
+		var t = addExtImage;
+
+		t.width = t.preloadImg.width;
+		t.height = t.preloadImg.height;
+		document.getElementById('go_button').style.color = '#333';
+		document.getElementById('status_img').src = 'images/yes.png';
+	},
+
+	getImageData : function() {
+		var t = addExtImage, src = document.forms[0].src.value;
+
+		if ( ! src ) {
+			t.resetImageData();
+			return false;
+		}
+		document.getElementById('status_img').src = 'images/loading.gif';
+		t.preloadImg = new Image();
+		t.preloadImg.onload = t.updateImageData;
+		t.preloadImg.onerror = t.resetImageData;
+		t.preloadImg.src = src;
+	}
+}
+//]]&gt;
+&lt;/script&gt;
+
 &lt;div id=&quot;media-items&quot;&gt;
 &lt;div class=&quot;media-item media-blank&quot;&gt;
 &lt;?php echo call_user_func($callback); ?&gt;
 &lt;/div&gt;
 &lt;/div&gt;
-&lt;input type=&quot;submit&quot; class=&quot;button savebutton&quot; name=&quot;save&quot; value=&quot;&lt;?php _e('Save all changes'); ?&gt;&quot; /&gt;
+&lt;input type=&quot;submit&quot; class=&quot;button savebutton&quot; name=&quot;save&quot; value=&quot;&lt;?php echo attribute_escape( __( 'Save all changes' ) ); ?&gt;&quot; /&gt;
+&lt;/form&gt;
 &lt;?php
 	endif;
 }
 
 function media_upload_gallery_form($errors) {
+	global $redir_tab;
+
+	$redir_tab = 'gallery';
 	media_upload_header();
 
 	$post_id = intval($_REQUEST['post_id']);
-
-	$form_action_url = get_option('siteurl') . &quot;/wp-admin/media-upload.php?type={$GLOBALS['type']}&amp;tab=gallery&amp;post_id=$post_id&quot;;
-
+	$form_action_url = admin_url(&quot;media-upload.php?type={$GLOBALS['type']}&amp;tab=gallery&amp;post_id=$post_id&quot;);
 ?&gt;
 
 &lt;script type=&quot;text/javascript&quot;&gt;
@@ -916,15 +1097,22 @@ jQuery(function($){
 &lt;form enctype=&quot;multipart/form-data&quot; method=&quot;post&quot; action=&quot;&lt;?php echo attribute_escape($form_action_url); ?&gt;&quot; class=&quot;media-upload-form validate&quot; id=&quot;gallery-form&quot;&gt;
 &lt;?php wp_nonce_field('media-form'); ?&gt;
 &lt;?php //media_upload_form( $errors ); ?&gt;
-
+&lt;table class=&quot;widefat&quot;&gt;
+&lt;thead&gt;&lt;tr&gt;
+&lt;th&gt;&lt;?php _e('Media'); ?&gt;&lt;/th&gt;
+&lt;th class=&quot;order-head&quot;&gt;&lt;?php _e('Order'); ?&gt;&lt;/th&gt;
+&lt;/tr&gt;&lt;/thead&gt;
+&lt;/table&gt;
 &lt;div id=&quot;media-items&quot;&gt;
 &lt;?php echo get_media_items($post_id, $errors); ?&gt;
 &lt;/div&gt;
-&lt;input type=&quot;submit&quot; class=&quot;button savebutton&quot; name=&quot;save&quot; value=&quot;&lt;?php _e('Save all changes'); ?&gt;&quot; /&gt;
-&lt;input type=&quot;submit&quot; class=&quot;button insert-gallery&quot; name=&quot;insert-gallery&quot; value=&quot;&lt;?php _e('Insert gallery into post'); ?&gt;&quot; /&gt;
-&lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; id=&quot;post_id&quot; value=&quot;&lt;?php echo $post_id; ?&gt;&quot; /&gt;
-&lt;input type=&quot;hidden&quot; name=&quot;type&quot; value=&quot;&lt;?php echo $GLOBALS['type']; ?&gt;&quot; /&gt;
-&lt;input type=&quot;hidden&quot; name=&quot;tab&quot; value=&quot;&lt;?php echo $GLOBALS['tab']; ?&gt;&quot; /&gt;
+&lt;p class=&quot;ml-submit&quot;&gt;
+&lt;input type=&quot;submit&quot; class=&quot;button savebutton&quot; name=&quot;save&quot; value=&quot;&lt;?php echo attribute_escape( __( 'Save all changes' ) ); ?&gt;&quot; /&gt;
+&lt;input type=&quot;submit&quot; class=&quot;button insert-gallery&quot; name=&quot;insert-gallery&quot; value=&quot;&lt;?php echo attribute_escape( __( 'Insert gallery into post' ) ); ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; id=&quot;post_id&quot; value=&quot;&lt;?php echo (int) $post_id; ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;type&quot; value=&quot;&lt;?php echo attribute_escape( $GLOBALS['type'] ); ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;tab&quot; value=&quot;&lt;?php echo attribute_escape( $GLOBALS['tab'] ); ?&gt;&quot; /&gt;
+&lt;/p&gt;
 &lt;/form&gt;
 &lt;?php
 }
@@ -936,7 +1124,7 @@ function media_upload_library_form($errors) {
 
 	$post_id = intval($_REQUEST['post_id']);
 
-	$form_action_url = get_option('siteurl') . &quot;/wp-admin/media-upload.php?type={$GLOBALS['type']}&amp;tab=library&amp;post_id=$post_id&quot;;
+	$form_action_url = admin_url(&quot;media-upload.php?type={$GLOBALS['type']}&amp;tab=library&amp;post_id=$post_id&quot;);
 
 	$_GET['paged'] = intval($_GET['paged']);
 	if ( $_GET['paged'] &lt; 1 )
@@ -951,17 +1139,17 @@ function media_upload_library_form($errors) {
 ?&gt;
 
 &lt;form id=&quot;filter&quot; action=&quot;&quot; method=&quot;get&quot;&gt;
-&lt;input type=&quot;hidden&quot; name=&quot;type&quot; value=&quot;&lt;?php echo $type; ?&gt;&quot; /&gt;
-&lt;input type=&quot;hidden&quot; name=&quot;tab&quot; value=&quot;&lt;?php echo $tab; ?&gt;&quot; /&gt;
-&lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; value=&quot;&lt;?php echo $post_id; ?&gt;&quot; /&gt;
-&lt;input type=&quot;hidden&quot; name=&quot;post_mime_type&quot; value=&quot;&lt;?php echo wp_specialchars($_GET['post_mime_type'], true); ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;type&quot; value=&quot;&lt;?php echo attribute_escape( $type ); ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;tab&quot; value=&quot;&lt;?php echo attribute_escape( $tab ); ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; value=&quot;&lt;?php echo (int) $post_id; ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;post_mime_type&quot; value=&quot;&lt;?php echo attribute_escape( $_GET['post_mime_type'] ); ?&gt;&quot; /&gt;
 
 &lt;div id=&quot;search-filter&quot;&gt;
+	&lt;label class=&quot;hidden&quot; for=&quot;post-search-input&quot;&gt;&lt;?php _e('Search Media');?&gt;:&lt;/label&gt;
 	&lt;input type=&quot;text&quot; id=&quot;post-search-input&quot; name=&quot;s&quot; value=&quot;&lt;?php the_search_query(); ?&gt;&quot; /&gt;
-	&lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e( 'Search Media' ); ?&gt;&quot; class=&quot;button&quot; /&gt;
+	&lt;input type=&quot;submit&quot; value=&quot;&lt;?php echo attribute_escape( __( 'Search Media' ) ); ?&gt;&quot; class=&quot;button&quot; /&gt;
 &lt;/div&gt;
 
-&lt;p&gt;
 &lt;ul class=&quot;subsubsub&quot;&gt;
 &lt;?php
 $type_links = array();
@@ -977,7 +1165,7 @@ if ( empty($_GET['post_mime_type']) &amp;&amp; !empty($num_posts[$type]) ) {
 }
 if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' )
 	$class = ' class=&quot;current&quot;';
-$type_links[] = &quot;&lt;li&gt;&lt;a href='&quot; . add_query_arg(array('post_mime_type'=&gt;'all', 'paged'=&gt;false, 'm'=&gt;false)) . &quot;'$class&gt;&quot;.__('All Types').&quot;&lt;/a&gt;&quot;;
+$type_links[] = &quot;&lt;li&gt;&lt;a href='&quot; . clean_url(add_query_arg(array('post_mime_type'=&gt;'all', 'paged'=&gt;false, 'm'=&gt;false))) . &quot;'$class&gt;&quot;.__('All Types').&quot;&lt;/a&gt;&quot;;
 foreach ( $post_mime_types as $mime_type =&gt; $label ) {
 	$class = '';
 
@@ -987,13 +1175,12 @@ foreach ( $post_mime_types as $mime_type =&gt; $label ) {
 	if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
 		$class = ' class=&quot;current&quot;';
 
-	$type_links[] = &quot;&lt;li&gt;&lt;a href='&quot; . add_query_arg(array('post_mime_type'=&gt;$mime_type, 'paged'=&gt;false)) . &quot;'$class&gt;&quot; . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), &quot;&lt;span id='$mime_type-counter'&gt;&quot; . number_format_i18n( $num_posts[$mime_type] ) . '&lt;/span&gt;') . '&lt;/a&gt;';
+	$type_links[] = &quot;&lt;li&gt;&lt;a href='&quot; . clean_url(add_query_arg(array('post_mime_type'=&gt;$mime_type, 'paged'=&gt;false))) . &quot;'$class&gt;&quot; . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), &quot;&lt;span id='$mime_type-counter'&gt;&quot; . number_format_i18n( $num_posts[$mime_type] ) . '&lt;/span&gt;') . '&lt;/a&gt;';
 }
 echo implode(' | &lt;/li&gt;', $type_links) . '&lt;/li&gt;';
 unset($type_links);
 ?&gt;
 &lt;/ul&gt;
-&lt;/p&gt;
 
 &lt;div class=&quot;tablenav&quot;&gt;
 
@@ -1032,15 +1219,15 @@ foreach ($arc_result as $arc_row) {
 	else
 		$default = '';
 
-	echo &quot;&lt;option$default value='$arc_row-&gt;yyear$arc_row-&gt;mmonth'&gt;&quot;;
-	echo $wp_locale-&gt;get_month($arc_row-&gt;mmonth) . &quot; $arc_row-&gt;yyear&quot;;
+	echo &quot;&lt;option$default value='&quot; . attribute_escape( $arc_row-&gt;yyear . $arc_row-&gt;mmonth ) . &quot;'&gt;&quot;;
+	echo wp_specialchars( $wp_locale-&gt;get_month($arc_row-&gt;mmonth) . &quot; $arc_row-&gt;yyear&quot; );
 	echo &quot;&lt;/option&gt;\n&quot;;
 }
 ?&gt;
 &lt;/select&gt;
 &lt;?php } ?&gt;
 
-&lt;input type=&quot;submit&quot; id=&quot;post-query-submit&quot; value=&quot;&lt;?php _e('Filter &amp;#187;'); ?&gt;&quot; class=&quot;button-secondary&quot; /&gt;
+&lt;input type=&quot;submit&quot; id=&quot;post-query-submit&quot; value=&quot;&lt;?php echo attribute_escape( __( 'Filter &amp;#187;' ) ); ?&gt;&quot; class=&quot;button-secondary&quot; /&gt;
 
 &lt;/div&gt;
 
@@ -1068,51 +1255,84 @@ jQuery(function($){
 &lt;div id=&quot;media-items&quot;&gt;
 &lt;?php echo get_media_items(null, $errors); ?&gt;
 &lt;/div&gt;
-&lt;input type=&quot;submit&quot; class=&quot;button savebutton&quot; name=&quot;save&quot; value=&quot;&lt;?php _e('Save all changes'); ?&gt;&quot; /&gt;
-&lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; id=&quot;post_id&quot; value=&quot;&lt;?php echo $post_id; ?&gt;&quot; /&gt;
+&lt;p class=&quot;ml-submit&quot;&gt;
+&lt;input type=&quot;submit&quot; class=&quot;button savebutton&quot; name=&quot;save&quot; value=&quot;&lt;?php echo attribute_escape( __( 'Save all changes' ) ); ?&gt;&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; id=&quot;post_id&quot; value=&quot;&lt;?php echo (int) $post_id; ?&gt;&quot; /&gt;
+&lt;/p&gt;
 &lt;/form&gt;
 &lt;?php
 }
 
 function type_form_image() {
+
+	if ( apply_filters( 'disable_captions', '' ) ) {
+		$alt = __('Alternate Text');
+		$alt_help = __('Alt text for the image, e.g. &quot;The Mona Lisa&quot;');
+	} else {
+		$alt = __('Image Caption');
+		$alt_help = __('Also used as alternate text for the image');
+	}
+
 	return '
 	&lt;table class=&quot;describe&quot;&gt;&lt;tbody&gt;
 		&lt;tr&gt;
+			&lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot; style=&quot;width:120px;&quot;&gt;
+				&lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;src&quot;&gt;' . __('Source') . '&lt;/label&gt;&lt;/span&gt;
+				&lt;span class=&quot;alignright&quot;&gt;&lt;img id=&quot;status_img&quot; src=&quot;images/required.gif&quot; title=&quot;required&quot; alt=&quot;required&quot; /&gt;&lt;/span&gt;
+			&lt;/th&gt;
+			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;src&quot; name=&quot;src&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot; onblur=&quot;addExtImage.getImageData()&quot; /&gt;&lt;/td&gt;
+		&lt;/tr&gt;
+
+		&lt;tr&gt;
 			&lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
-				&lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[src]&quot;&gt;' . __('Image URL') . '&lt;/label&gt;&lt;/span&gt;
+				&lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;title&quot;&gt;' . __('Image Title') . '&lt;/label&gt;&lt;/span&gt;
 				&lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
 			&lt;/th&gt;
-			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[src]&quot; name=&quot;insertonly[src]&quot; value=&quot;&quot; type=&quot;text&quot;&gt;&lt;/td&gt;
+			&lt;td class=&quot;field&quot;&gt;&lt;p&gt;&lt;input id=&quot;title&quot; name=&quot;title&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot; /&gt;&lt;/p&gt;&lt;/td&gt;
 		&lt;/tr&gt;
+
 		&lt;tr&gt;
 			&lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
-				&lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[alt]&quot;&gt;' . __('Description') . '&lt;/label&gt;&lt;/span&gt;
-				&lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
+				&lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;alt&quot;&gt;' . $alt . '&lt;/label&gt;&lt;/span&gt;
 			&lt;/th&gt;
-			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[alt]&quot; name=&quot;insertonly[alt]&quot; value=&quot;&quot; type=&quot;text&quot;&gt;&lt;/td&gt;
+			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;alt&quot; name=&quot;alt&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot; /&gt;
+			&lt;p class=&quot;help&quot;&gt;' . $alt_help . '&lt;/p&gt;&lt;/td&gt;
 		&lt;/tr&gt;
-		&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td class=&quot;help&quot;&gt;' . __('Alternate text, e.g. &quot;The Mona Lisa&quot;') . '&lt;/td&gt;&lt;/tr&gt;
+
 		&lt;tr class=&quot;align&quot;&gt;
-			&lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;&lt;label for=&quot;insertonly[align]&quot;&gt;' . __('Alignment') . '&lt;/label&gt;&lt;/th&gt;
+			&lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;&lt;p&gt;&lt;label for=&quot;align&quot;&gt;' . __('Alignment') . '&lt;/label&gt;&lt;/p&gt;&lt;/th&gt;
 			&lt;td class=&quot;field&quot;&gt;
-				&lt;input name=&quot;insertonly[align]&quot; id=&quot;image-align-none-0&quot; value=&quot;none&quot; type=&quot;radio&quot; checked=&quot;checked&quot; /&gt;
-				&lt;label for=&quot;image-align-none-0&quot; class=&quot;align image-align-none-label&quot;&gt;' . __('None') . '&lt;/label&gt;
-				&lt;input name=&quot;insertonly[align]&quot; id=&quot;image-align-left-0&quot; value=&quot;left&quot; type=&quot;radio&quot; /&gt;
-				&lt;label for=&quot;image-align-left-0&quot; class=&quot;align image-align-left-label&quot;&gt;' . __('Left') . '&lt;/label&gt;
-				&lt;input name=&quot;insertonly[align]&quot; id=&quot;image-align-center-0&quot; value=&quot;center&quot; type=&quot;radio&quot; /&gt;
-				&lt;label for=&quot;image-align-center-0&quot; class=&quot;align image-align-center-label&quot;&gt;' . __('Center') . '&lt;/label&gt;
-				&lt;input name=&quot;insertonly[align]&quot; id=&quot;image-align-right-0&quot; value=&quot;right&quot; type=&quot;radio&quot; /&gt;
-				&lt;label for=&quot;image-align-right-0&quot; class=&quot;align image-align-right-label&quot;&gt;' . __('Right') . '&lt;/label&gt;
+				&lt;input name=&quot;align&quot; id=&quot;align-none&quot; value=&quot;alignnone&quot; onclick=&quot;addExtImage.align=this.value&quot; type=&quot;radio&quot; checked=&quot;checked&quot; /&gt;
+				&lt;label for=&quot;align-none&quot; class=&quot;align image-align-none-label&quot;&gt;' . __('None') . '&lt;/label&gt;
+				&lt;input name=&quot;align&quot; id=&quot;align-left&quot; value=&quot;alignleft&quot; onclick=&quot;addExtImage.align=this.value&quot; type=&quot;radio&quot; /&gt;
+				&lt;label for=&quot;align-left&quot; class=&quot;align image-align-left-label&quot;&gt;' . __('Left') . '&lt;/label&gt;
+				&lt;input name=&quot;align&quot; id=&quot;align-center&quot; value=&quot;aligncenter&quot; onclick=&quot;addExtImage.align=this.value&quot; type=&quot;radio&quot; /&gt;
+				&lt;label for=&quot;align-center&quot; class=&quot;align image-align-center-label&quot;&gt;' . __('Center') . '&lt;/label&gt;
+				&lt;input name=&quot;align&quot; id=&quot;align-right&quot; value=&quot;alignright&quot; onclick=&quot;addExtImage.align=this.value&quot; type=&quot;radio&quot; /&gt;
+				&lt;label for=&quot;align-right&quot; class=&quot;align image-align-right-label&quot;&gt;' . __('Right') . '&lt;/label&gt;
 			&lt;/td&gt;
 		&lt;/tr&gt;
+
+		&lt;tr&gt;
+			&lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
+				&lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;url&quot;&gt;' . __('Link URL') . '&lt;/label&gt;&lt;/span&gt;
+			&lt;/th&gt;
+			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;url&quot; name=&quot;url&quot; value=&quot;&quot; type=&quot;text&quot; /&gt;&lt;br /&gt;
+
+			&lt;button type=&quot;button&quot; class=&quot;button&quot; value=&quot;&quot; onclick=&quot;document.forms[0].url.value=null&quot;&gt;' . __('None') . '&lt;/button&gt;
+			&lt;button type=&quot;button&quot; class=&quot;button&quot; value=&quot;&quot; onclick=&quot;document.forms[0].url.value=document.forms[0].src.value&quot;&gt;' . __('Link to image') . '&lt;/button&gt;
+			&lt;p class=&quot;help&quot;&gt;' . __('Enter a link URL or click above for presets.') . '&lt;/p&gt;&lt;/td&gt;
+		&lt;/tr&gt;
+
 		&lt;tr&gt;
 			&lt;td&gt;&lt;/td&gt;
 			&lt;td&gt;
-				&lt;input type=&quot;submit&quot; class=&quot;button&quot; name=&quot;insertonlybutton&quot; value=&quot;' . attribute_escape(__('Insert into Post')) . '&quot; /&gt;
+				&lt;input type=&quot;button&quot; class=&quot;button&quot; id=&quot;go_button&quot; style=&quot;color:#bbb;&quot; onclick=&quot;addExtImage.insert()&quot; value=&quot;' . attribute_escape(__('Insert into Post')) . '&quot; /&gt;
 			&lt;/td&gt;
 		&lt;/tr&gt;
 	&lt;/tbody&gt;&lt;/table&gt;
 ';
+
 }
 
 function type_form_audio() {
@@ -1123,14 +1343,14 @@ function type_form_audio() {
 				&lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[href]&quot;&gt;' . __('Audio File URL') . '&lt;/label&gt;&lt;/span&gt;
 				&lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
 			&lt;/th&gt;
-			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[href]&quot; name=&quot;insertonly[href]&quot; value=&quot;&quot; type=&quot;text&quot;&gt;&lt;/td&gt;
+			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[href]&quot; name=&quot;insertonly[href]&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot;&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr&gt;
 			&lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
 				&lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[title]&quot;&gt;' . __('Title') . '&lt;/label&gt;&lt;/span&gt;
 				&lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
 			&lt;/th&gt;
-			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[title]&quot; name=&quot;insertonly[title]&quot; value=&quot;&quot; type=&quot;text&quot;&gt;&lt;/td&gt;
+			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[title]&quot; name=&quot;insertonly[title]&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot;&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td class=&quot;help&quot;&gt;' . __('Link text, e.g. &quot;Still Alive by Jonathan Coulton&quot;') . '&lt;/td&gt;&lt;/tr&gt;
 		&lt;tr&gt;
@@ -1151,14 +1371,14 @@ function type_form_video() {
 				&lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[href]&quot;&gt;' . __('Video URL') . '&lt;/label&gt;&lt;/span&gt;
 				&lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
 			&lt;/th&gt;
-			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[href]&quot; name=&quot;insertonly[href]&quot; value=&quot;&quot; type=&quot;text&quot;&gt;&lt;/td&gt;
+			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[href]&quot; name=&quot;insertonly[href]&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot;&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr&gt;
 			&lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
 				&lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[title]&quot;&gt;' . __('Title') . '&lt;/label&gt;&lt;/span&gt;
 				&lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
 			&lt;/th&gt;
-			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[title]&quot; name=&quot;insertonly[title]&quot; value=&quot;&quot; type=&quot;text&quot;&gt;&lt;/td&gt;
+			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[title]&quot; name=&quot;insertonly[title]&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot;&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td class=&quot;help&quot;&gt;' . __('Link text, e.g. &quot;Lucy on YouTube&quot;') . '&lt;/td&gt;&lt;/tr&gt;
 		&lt;tr&gt;
@@ -1179,14 +1399,14 @@ function type_form_file() {
 				&lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[href]&quot;&gt;' . __('URL') . '&lt;/label&gt;&lt;/span&gt;
 				&lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
 			&lt;/th&gt;
-			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[href]&quot; name=&quot;insertonly[href]&quot; value=&quot;&quot; type=&quot;text&quot;&gt;&lt;/td&gt;
+			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[href]&quot; name=&quot;insertonly[href]&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot;&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr&gt;
 			&lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
 				&lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[title]&quot;&gt;' . __('Title') . '&lt;/label&gt;&lt;/span&gt;
 				&lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
 			&lt;/th&gt;
-			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[title]&quot; name=&quot;insertonly[title]&quot; value=&quot;&quot; type=&quot;text&quot;&gt;&lt;/td&gt;
+			&lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[title]&quot; name=&quot;insertonly[title]&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot;&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td class=&quot;help&quot;&gt;' . __('Link text, e.g. &quot;Ransom Demands (PDF)&quot;') . '&lt;/td&gt;&lt;/tr&gt;
 		&lt;tr&gt;
@@ -1199,6 +1419,49 @@ function type_form_file() {
 ';
 }
 
+// support a GET parameter for disabling the flash uploader
+function media_upload_use_flash($flash) {
+        if ( array_key_exists('flash', $_REQUEST) )
+                $flash = !empty($_REQUEST['flash']);
+        return $flash;
+}
+
+add_filter('flash_uploader', 'media_upload_use_flash');
+
+function media_upload_flash_bypass() {
+        echo '&lt;p class=&quot;upload-flash-bypass&quot;&gt;';
+        printf( __('You are using the Flash uploader.  Problems?  Try the &lt;a href=&quot;%s&quot;&gt;Browser uploader&lt;/a&gt; instead.'), clean_url(add_query_arg('flash', 0)) );
+        echo '&lt;/p&gt;';
+}
+
+add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
+
+function media_upload_html_bypass() {
+        echo '&lt;p class=&quot;upload-html-bypass&quot;&gt;';
+        if ( array_key_exists('flash', $_REQUEST) )
+                // the user manually selected the browser uploader, so let them switch back to Flash
+                printf( __('You are using the Browser uploader.  Try the &lt;a href=&quot;%s&quot;&gt;Flash uploader&lt;/a&gt; instead.'), clean_url(add_query_arg('flash', 1)) );
+        else
+                // the user probably doesn't have Flash
+                printf( __('You are using the Browser uploader.') );
+
+        echo '&lt;/p&gt;';
+}
+
+add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
+add_action('post-html-upload-ui', 'media_upload_html_bypass');
+
+// make sure the GET parameter sticks when we submit a form
+function media_upload_bypass_url($url) {
+        if ( array_key_exists('flash', $_REQUEST) )
+                $url = add_query_arg('flash', intval($_REQUEST['flash']));
+        return $url;
+}
+
+add_filter('media_upload_form_url', 'media_upload_bypass_url');
+
+
+
 add_filter('async_upload_image', 'get_media_item', 10, 2);
 add_filter('async_upload_audio', 'get_media_item', 10, 2);
 add_filter('async_upload_video', 'get_media_item', 10, 2);
@@ -1208,12 +1471,9 @@ add_action('media_upload_image', 'media_upload_image');
 add_action('media_upload_audio', 'media_upload_audio');
 add_action('media_upload_video', 'media_upload_video');
 add_action('media_upload_file', 'media_upload_file');
-add_action('admin_head_media_upload_type_form', 'media_admin_css');
 
 add_filter('media_upload_gallery', 'media_upload_gallery');
-add_action('admin_head_media_upload_gallery_form', 'media_admin_css');
 
 add_filter('media_upload_library', 'media_upload_library');
-add_action('admin_head_media_upload_library_form', 'media_admin_css');
 
 ?&gt;</diff>
      <filename>wp-admin/includes/media.php</filename>
    </modified>
    <modified>
      <diff>@@ -67,7 +67,7 @@ function insert_with_markers( $filename, $marker, $insertion ) {
 			}
 		}
 		if (!$foundit) {
-			fwrite( $f, &quot;# BEGIN {$marker}\n&quot; );
+			fwrite( $f, &quot;\n# BEGIN {$marker}\n&quot; );
 			foreach ( $insertion as $insertline )
 				fwrite( $f, &quot;{$insertline}\n&quot; );
 			fwrite( $f, &quot;# END {$marker}\n&quot; );</diff>
      <filename>wp-admin/includes/misc.php</filename>
    </modified>
    <modified>
      <diff>@@ -32,14 +32,15 @@ function get_plugin_data( $plugin_file ) {
 }
 
 function get_plugins($plugin_folder = '') {
-	global $wp_plugins;
-
-	if ( isset( $wp_plugins ) ) {
-		return $wp_plugins;
-	}
-
+	
+	if ( ! $cache_plugins = wp_cache_get('plugins', 'plugins') )
+		$cache_plugins = array();
+	
+	if ( isset($cache_plugins[ $plugin_folder ]) )
+		return $cache_plugins[ $plugin_folder ];
+	
 	$wp_plugins = array ();
-	$plugin_root = ABSPATH . PLUGINDIR;
+	$plugin_root = WP_PLUGIN_DIR;
 	if( !empty($plugin_folder) )
 		$plugin_root .= $plugin_folder;
 
@@ -85,6 +86,9 @@ function get_plugins($plugin_folder = '') {
 
 	uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a[&quot;Name&quot;], $b[&quot;Name&quot;] );' ));
 
+	$cache_plugins[ $plugin_folder ] = $wp_plugins; 
+	wp_cache_set('plugins', $cache_plugins, 'plugins'); 
+
 	return $wp_plugins;
 }
 
@@ -104,7 +108,7 @@ function activate_plugin($plugin, $redirect = '') {
 			if ( !empty($redirect) )
 				wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
 			ob_start();
-			@include(ABSPATH . PLUGINDIR . '/' . $plugin);
+			@include(WP_PLUGIN_DIR . '/' . $plugin);
 			$current[] = $plugin;
 			sort($current);
 			update_option('active_plugins', $current);
@@ -132,37 +136,96 @@ function deactivate_plugins($plugins, $silent= false) {
 	update_option('active_plugins', $current);
 }
 
-function deactivate_all_plugins() {
-	$current = get_option('active_plugins');
-	if ( empty($current) )
-		return;
+function activate_plugins($plugins, $redirect = '') {
+	if ( !is_array($plugins) )
+		$plugins = array($plugins);
+
+	$errors = array();
+	foreach ( (array) $plugins as $plugin ) {
+		if ( !empty($redirect) )
+			$redirect = add_query_arg('plugin', $plugin, $redirect);
+		$result = activate_plugin($plugin, $redirect);
+		if ( is_wp_error($result) )
+			$errors[$plugin] = $result;
+	}
 
-	deactivate_plugins($current);
+	if ( !empty($errors) )
+		return new WP_Error('plugins_invalid', __('One of the plugins is invalid.'), $errors);
 
-	update_option('deactivated_plugins', $current);
+	return true;
 }
 
-function reactivate_all_plugins($redirect = '') {
-	$plugins = get_option('deactivated_plugins');
+function delete_plugins($plugins, $redirect = '' ) {
+	global $wp_filesystem;
+
+	if( empty($plugins) )
+		return false;
 
-	if ( empty($plugins) )
+	$checked = array();
+	foreach( $plugins as $plugin )
+		$checked[] = 'checked[]=' . $plugin;
+
+	ob_start();
+	$url = wp_nonce_url('plugins.php?action=delete-selected&amp;verify-delete=1&amp;' . implode('&amp;', $checked), 'bulk-manage-plugins');
+	if ( false === ($credentials = request_filesystem_credentials($url)) ) {
+		$data = ob_get_contents();
+		ob_end_clean();
+		if( ! empty($data) ){
+			include_once( ABSPATH . 'wp-admin/admin-header.php');
+			echo $data;
+			include( ABSPATH . 'wp-admin/admin-footer.php');
+			exit;
+		}
 		return;
+	}
 
-	if ( !empty($redirect) )
-		wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
+	if ( ! WP_Filesystem($credentials) ) {
+		request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
+		$data = ob_get_contents();
+		ob_end_clean();
+		if( ! empty($data) ){
+			include_once( ABSPATH . 'wp-admin/admin-header.php');
+			echo $data;
+			include( ABSPATH . 'wp-admin/admin-footer.php');
+			exit;
+		}
+		return;
+	}
 
-	$errors = array();
-	foreach ( (array) $plugins as $plugin ) {
-		$result = activate_plugin($plugin);
-		if ( is_wp_error($result) )
-			$errors[$plugin] = $result;
+	if ( $wp_filesystem-&gt;errors-&gt;get_error_code() ) {
+		return $wp_filesystem-&gt;errors;
 	}
 
-	delete_option('deactivated_plugins');
+	if ( ! is_object($wp_filesystem) )
+		return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
 
-	if ( !empty($errors) )
-		return new WP_Error('plugins_invalid', __('One of the plugins is invalid.'), $errors);
+	if ( $wp_filesystem-&gt;errors-&gt;get_error_code() )
+		return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem-&gt;errors);
+
+	//Get the base plugin folder
+	$plugins_dir = $wp_filesystem-&gt;wp_plugins_dir();
+	if ( empty($plugins_dir) )
+		return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));
+	
+	$plugins_dir = trailingslashit( $plugins_dir );
 
+	$errors = array();
+
+	foreach( $plugins as $plugin_file ) {
+		$this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin_file) );
+		// If plugin is in its own directory, recursively delete the directory.
+		if ( strpos($plugin_file, '/') &amp;&amp; $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
+			$deleted = $wp_filesystem-&gt;delete($this_plugin_dir, true);
+		else
+			$deleted = $wp_filesystem-&gt;delete($plugins_dir . $plugin_file);
+	
+		if ( ! $deleted )
+			$errors[] = $plugin_file;
+	}
+	
+	if( ! empty($errors) )
+		return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s'), implode(', ', $errors)) );
+	
 	return true;
 }
 
@@ -176,24 +239,25 @@ function validate_active_plugins() {
 		return;
 	}
 
+	//Invalid is any plugin that is deactivated due to error.
+	$invalid = array(); 
+
 	// If a plugin file does not exist, remove it from the list of active
 	// plugins.
 	foreach ( $check_plugins as $check_plugin ) {
-		if ( !file_exists(ABSPATH . PLUGINDIR . '/' . $check_plugin) ) {
-			$current = get_option('active_plugins');
-			$key = array_search($check_plugin, $current);
-			if ( false !== $key &amp;&amp; NULL !== $key ) {
-				unset($current[$key]);
-				update_option('active_plugins', $current);
-			}
+		$result = validate_plugin($check_plugin);
+		if ( is_wp_error( $result ) ) {
+			$invalid[$check_plugin] = $result;
+			deactivate_plugins( $check_plugin, true);
 		}
 	}
+	return $invalid;
 }
 
 function validate_plugin($plugin) {
 	if ( validate_file($plugin) )
 		return new WP_Error('plugin_invalid', __('Invalid plugin.'));
-	if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
+	if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
 		return new WP_Error('plugin_not_found', __('Plugin file does not exist.'));
 
 	return 0;
@@ -411,18 +475,16 @@ function get_plugin_page_hookname( $plugin_page, $parent_page ) {
 
 	$parent = get_admin_page_parent();
 
+	$page_type = 'admin';
 	if ( empty ( $parent_page ) || 'admin.php' == $parent_page ) {
 		if ( isset( $admin_page_hooks[$plugin_page] ))
 			$page_type = 'toplevel';
 		else
 			if ( isset( $admin_page_hooks[$parent] ))
 				$page_type = $admin_page_hooks[$parent];
-	} else
-		if ( isset( $admin_page_hooks[$parent_page] ) ) {
-			$page_type = $admin_page_hooks[$parent_page];
-		} else {
-			$page_type = 'admin';
-		}
+	} else if ( isset( $admin_page_hooks[$parent_page] ) ) {
+		$page_type = $admin_page_hooks[$parent_page];
+	}
 
 	$plugin_name = preg_replace( '!\.php!', '', $plugin_page );
 </diff>
      <filename>wp-admin/includes/plugin.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,30 +1,19 @@
 &lt;?php
 
-// Update an existing post with values provided in $_POST.
-function edit_post() {
-
-	$post_ID = (int) $_POST['post_ID'];
-
-	if ( 'page' == $_POST['post_type'] ) {
-		if ( !current_user_can( 'edit_page', $post_ID ) )
-			wp_die( __('You are not allowed to edit this page.' ));
-	} else {
-		if ( !current_user_can( 'edit_post', $post_ID ) )
-			wp_die( __('You are not allowed to edit this post.' ));
-	}
-
-	// Autosave shouldn't save too soon after a real save
-	if ( 'autosave' == $_POST['action'] ) {
-		$post =&amp; get_post( $post_ID );
-		$now = time();
-		$then = strtotime($post-&gt;post_date_gmt . ' +0000');
-		$delta = AUTOSAVE_INTERVAL / 2;
-		if ( ($now - $then) &lt; $delta )
-			return $post_ID;
-	}
-
-	// Rename.
-	$_POST['ID'] = (int) $_POST['post_ID'];
+/**
+ * _wp_translate_postdata() - Rename $_POST data from form names to DB post columns.
+ *
+ * Manipulates $_POST directly.
+ *
+ * @package WordPress
+ * @since 2.6
+ *
+ * @param bool $update Are we updating a pre-existing post?
+ * @return object|bool WP_Error on failure, true on success.
+ */
+function _wp_translate_postdata( $update = false ) {
+	if ( $update )
+		$_POST['ID'] = (int) $_POST['post_ID'];
 	$_POST['post_content'] = $_POST['content'];
 	$_POST['post_excerpt'] = $_POST['excerpt'];
 	$_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
@@ -32,21 +21,29 @@ function edit_post() {
 
 	if (!empty ( $_POST['post_author_override'] ) ) {
 		$_POST['post_author'] = (int) $_POST['post_author_override'];
-	} else
+	} else {
 		if (!empty ( $_POST['post_author'] ) ) {
 			$_POST['post_author'] = (int) $_POST['post_author'];
 		} else {
 			$_POST['post_author'] = (int) $_POST['user_ID'];
 		}
+	}
 
 	if ( $_POST['post_author'] != $_POST['user_ID'] ) {
 		if ( 'page' == $_POST['post_type'] ) {
-			if ( !current_user_can( 'edit_others_pages' ) )
-				wp_die( __('You are not allowed to edit pages as this user.' ));
+			if ( !current_user_can( 'edit_others_pages' ) ) {
+				return new WP_Error( 'edit_others_pages', $update ?
+					__( 'You are not allowed to edit pages as this user.' ) :
+					__( 'You are not allowed to create pages as this user.' )
+				);
+			}
 		} else {
-			if ( !current_user_can( 'edit_others_posts' ) )
-				wp_die( __('You are not allowed to edit posts as this user.' ));
-
+			if ( !current_user_can( 'edit_others_posts' ) ) {
+				return new WP_Error( 'edit_others_posts', $update ?
+					__( 'You are not allowed to edit posts as this user.' ) :
+					__( 'You are not allowed to post as this user.' )
+				);
+			}
 		}
 	}
 
@@ -60,12 +57,20 @@ function edit_post() {
 	if ( isset($_POST['advanced']) &amp;&amp; '' != $_POST['advanced'] )
 		$_POST['post_status'] = 'draft';
 
+	$previous_status = get_post_field('post_status',  $_POST['ID']);
+
+	// Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published. 
+	// Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
 	if ( 'page' == $_POST['post_type'] ) {
-		if ('publish' == $_POST['post_status'] &amp;&amp; !current_user_can( 'publish_pages' ))
-			$_POST['post_status'] = 'pending';
+		if ( 'publish' == $_POST['post_status'] &amp;&amp; !current_user_can( 'publish_pages' ) )
+			if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') )
+				$_POST['post_status'] = 'pending';
 	} else {
-		if ('publish' == $_POST['post_status'] &amp;&amp; !current_user_can( 'publish_posts' ))
-			$_POST['post_status'] = 'pending';
+		if ( 'publish' == $_POST['post_status'] &amp;&amp; !current_user_can( 'publish_posts' ) ) :
+			// Stop attempts to publish new posts, but allow already published posts to be saved if appropriate.
+			if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_posts') )
+				$_POST['post_status'] = 'pending';
+		endif;
 	}
 
 	if (!isset( $_POST['comment_status'] ))
@@ -74,28 +79,62 @@ function edit_post() {
 	if (!isset( $_POST['ping_status'] ))
 		$_POST['ping_status'] = 'closed';
 
-	foreach ( array ('aa', 'mm', 'jj', 'hh', 'mm') as $timeunit ) {
+	foreach ( array('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
 		if ( !empty( $_POST['hidden_' . $timeunit] ) &amp;&amp; $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
 			$_POST['edit_date'] = '1';
 			break;
 		}
 	}
 
-	if (!empty ( $_POST['edit_date'] ) ) {
+	if ( !empty( $_POST['edit_date'] ) ) {
 		$aa = $_POST['aa'];
 		$mm = $_POST['mm'];
 		$jj = $_POST['jj'];
 		$hh = $_POST['hh'];
 		$mn = $_POST['mn'];
 		$ss = $_POST['ss'];
+		$aa = ($aa &lt;= 0 ) ? date('Y') : $aa;
+		$mm = ($mm &lt;= 0 ) ? date('n') : $mm;
 		$jj = ($jj &gt; 31 ) ? 31 : $jj;
+		$jj = ($jj &lt;= 0 ) ? date('j') : $jj;
 		$hh = ($hh &gt; 23 ) ? $hh -24 : $hh;
 		$mn = ($mn &gt; 59 ) ? $mn -60 : $mn;
 		$ss = ($ss &gt; 59 ) ? $ss -60 : $ss;
-		$_POST['post_date'] = &quot;$aa-$mm-$jj $hh:$mn:$ss&quot;;
-		$_POST['post_date_gmt'] = get_gmt_from_date( &quot;$aa-$mm-$jj $hh:$mn:$ss&quot; );
+		$_POST['post_date'] = sprintf( &quot;%04d-%02d-%02d %02d:%02d:%02d&quot;, $aa, $mm, $jj, $hh, $mn, $ss );
+		$_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
 	}
 
+	return true;
+}
+
+
+// Update an existing post with values provided in $_POST.
+function edit_post() {
+
+	$post_ID = (int) $_POST['post_ID'];
+
+	if ( 'page' == $_POST['post_type'] ) {
+		if ( !current_user_can( 'edit_page', $post_ID ) )
+			wp_die( __('You are not allowed to edit this page.' ));
+	} else {
+		if ( !current_user_can( 'edit_post', $post_ID ) )
+			wp_die( __('You are not allowed to edit this post.' ));
+	}
+
+	// Autosave shouldn't save too soon after a real save
+	if ( 'autosave' == $_POST['action'] ) {
+		$post =&amp; get_post( $post_ID );
+		$now = time();
+		$then = strtotime($post-&gt;post_date_gmt . ' +0000');
+		$delta = AUTOSAVE_INTERVAL / 2;
+		if ( ($now - $then) &lt; $delta )
+			return $post_ID;
+	}
+
+	$translated = _wp_translate_postdata( true );
+	if ( is_wp_error($translated) )
+		wp_die( $translated-&gt;get_error_message() );
+
 	// Meta Stuff
 	if ( isset($_POST['meta']) &amp;&amp; $_POST['meta'] ) {
 		foreach ( $_POST['meta'] as $key =&gt; $value )
@@ -194,13 +233,13 @@ function post_exists($title, $content = '', $post_date = '') {
 	global $wpdb;
 
 	if (!empty ($post_date))
-		$post_date = &quot;AND post_date = '$post_date'&quot;;
+		$post_date = $wpdb-&gt;prepare(&quot;AND post_date = %s&quot;, $post_date);
 
 	if (!empty ($title))
-		return $wpdb-&gt;get_var(&quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_title = '$title' $post_date&quot;);
+		return $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_title = %s $post_date&quot;, $title) );
 	else
 		if (!empty ($content))
-			return $wpdb-&gt;get_var(&quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_content = '$content' $post_date&quot;);
+			return $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_content = %s $post_date&quot;, $content) );
 
 	return 0;
 }
@@ -236,79 +275,9 @@ function wp_write_post() {
 		}
 	}
 
-	// Rename.
-	$_POST['post_content'] = $_POST['content'];
-	$_POST['post_excerpt'] = $_POST['excerpt'];
-	$_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
-	$_POST['to_ping'] = $_POST['trackback_url'];
-
-	if (!empty ( $_POST['post_author_override'] ) ) {
-		$_POST['post_author'] = (int) $_POST['post_author_override'];
-	} else {
-		if (!empty ( $_POST['post_author'] ) ) {
-			$_POST['post_author'] = (int) $_POST['post_author'];
-		} else {
-			$_POST['post_author'] = (int) $_POST['user_ID'];
-		}
-
-	}
-
-	if ( $_POST['post_author'] != $_POST['user_ID'] ) {
-		if ( 'page' == $_POST['post_type'] ) {
-			if ( !current_user_can( 'edit_others_pages' ) )
-				return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) );
-		} else {
-			if ( !current_user_can( 'edit_others_posts' ) )
-				return new WP_Error( 'edit_others_posts', __( 'You are not allowed to post as this user.' ) );
-
-		}
-	}
-
-	// What to do based on which button they pressed
-	if ( isset($_POST['saveasdraft']) &amp;&amp; '' != $_POST['saveasdraft'] )
-		$_POST['post_status'] = 'draft';
-	if ( isset($_POST['saveasprivate']) &amp;&amp; '' != $_POST['saveasprivate'] )
-		$_POST['post_status'] = 'private';
-	if ( isset($_POST['publish']) &amp;&amp; ( '' != $_POST['publish'] ) &amp;&amp; ( $_POST['post_status'] != 'private' ) )
-		$_POST['post_status'] = 'publish';
-	if ( isset($_POST['advanced']) &amp;&amp; '' != $_POST['advanced'] )
-		$_POST['post_status'] = 'draft';
-
-	if ( 'page' == $_POST['post_type'] ) {
-		if ('publish' == $_POST['post_status'] &amp;&amp; !current_user_can( 'publish_pages' ) )
-			$_POST['post_status'] = 'pending';
-	} else {
-		if ('publish' == $_POST['post_status'] &amp;&amp; !current_user_can( 'publish_posts' ) )
-			$_POST['post_status'] = 'pending';
-	}
-
-	if (!isset( $_POST['comment_status'] ))
-		$_POST['comment_status'] = 'closed';
-
-	if (!isset( $_POST['ping_status'] ))
-		$_POST['ping_status'] = 'closed';
-
-	foreach ( array ('aa', 'mm', 'jj', 'hh', 'mm') as $timeunit ) {
-		if ( !empty( $_POST['hidden_' . $timeunit] ) &amp;&amp; $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
-			$_POST['edit_date'] = '1';
-			break;
-		}
-	}
-
-	if (!empty ( $_POST['edit_date'] ) ) {
-		$aa = $_POST['aa'];
-		$mm = $_POST['mm'];
-		$jj = $_POST['jj'];
-		$hh = $_POST['hh'];
-		$mn = $_POST['mn'];
-		$ss = $_POST['ss'];
-		$jj = ($jj &gt; 31 ) ? 31 : $jj;
-		$hh = ($hh &gt; 23 ) ? $hh -24 : $hh;
-		$mn = ($mn &gt; 59 ) ? $mn -60 : $mn;
-		$ss = ($ss &gt; 59 ) ? $ss -60 : $ss;
-		$_POST['post_date'] = sprintf( &quot;%04d-%02d-%02d %02d:%02d:%02d&quot;, $aa, $mm, $jj, $hh, $mn, $ss );
-		$_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
-	}
+	$translated = _wp_translate_postdata( false );
+	if ( is_wp_error($translated) )
+		return $translated;
 
 	// Create the post.
 	$post_ID = wp_insert_post( $_POST );
@@ -380,11 +349,9 @@ function add_meta( $post_ID ) {
 
 		wp_cache_delete($post_ID, 'post_meta');
 
-		$wpdb-&gt;query( &quot;
-				INSERT INTO $wpdb-&gt;postmeta
-				(post_id,meta_key,meta_value )
-				VALUES ('$post_ID','$metakey','$metavalue' )
-			&quot; );
+		$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;postmeta 
+			(post_id,meta_key,meta_value ) VALUES (%s, %s, %s)&quot;,
+			$post_ID, $metakey, $metavalue) );
 		return $wpdb-&gt;insert_id;
 	}
 	return false;
@@ -394,10 +361,10 @@ function delete_meta( $mid ) {
 	global $wpdb;
 	$mid = (int) $mid;
 
-	$post_id = $wpdb-&gt;get_var(&quot;SELECT post_id FROM $wpdb-&gt;postmeta WHERE meta_id = '$mid'&quot;);
+	$post_id = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT post_id FROM $wpdb-&gt;postmeta WHERE meta_id = %d&quot;, $mid) );
 	wp_cache_delete($post_id, 'post_meta');
 
-	return $wpdb-&gt;query( &quot;DELETE FROM $wpdb-&gt;postmeta WHERE meta_id = '$mid'&quot; );
+	return $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;postmeta WHERE meta_id = %d&quot;, $mid) );
 }
 
 // Get a list of previously defined keys
@@ -417,7 +384,7 @@ function get_post_meta_by_id( $mid ) {
 	global $wpdb;
 	$mid = (int) $mid;
 
-	$meta = $wpdb-&gt;get_row( &quot;SELECT * FROM $wpdb-&gt;postmeta WHERE meta_id = '$mid'&quot; );
+	$meta = $wpdb-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;postmeta WHERE meta_id = %d&quot;, $mid) );
 	if ( is_serialized_string( $meta-&gt;meta_value ) )
 		$meta-&gt;meta_value = maybe_unserialize( $meta-&gt;meta_value );
 	return $meta;
@@ -427,29 +394,30 @@ function get_post_meta_by_id( $mid ) {
 function has_meta( $postid ) {
 	global $wpdb;
 
-	return $wpdb-&gt;get_results( &quot;
-			SELECT meta_key, meta_value, meta_id, post_id
-			FROM $wpdb-&gt;postmeta
-			WHERE post_id = '$postid'
-			ORDER BY meta_key,meta_id&quot;, ARRAY_A );
+	return $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT meta_key, meta_value, meta_id, post_id
+			FROM $wpdb-&gt;postmeta WHERE post_id = %d
+			ORDER BY meta_key,meta_id&quot;, $postid), ARRAY_A );
 
 }
 
-function update_meta( $mid, $mkey, $mvalue ) {
+function update_meta( $meta_id, $meta_key, $meta_value ) {
 	global $wpdb;
 
 	$protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
 
-	if ( in_array($mkey, $protected) )
+	if ( in_array($meta_key, $protected) )
 		return false;
 
-	$post_id = $wpdb-&gt;get_var(&quot;SELECT post_id FROM $wpdb-&gt;postmeta WHERE meta_id = '$mid'&quot;);
+	$post_id = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT post_id FROM $wpdb-&gt;postmeta WHERE meta_id = %d&quot;, $meta_id) );
 	wp_cache_delete($post_id, 'post_meta');
 
-	$mvalue = maybe_serialize( stripslashes( $mvalue ));
-	$mvalue = $wpdb-&gt;escape( $mvalue );
-	$mid = (int) $mid;
-	return $wpdb-&gt;query( &quot;UPDATE $wpdb-&gt;postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'&quot; );
+	$meta_value = maybe_serialize( stripslashes( $meta_value ));
+	$meta_id = (int) $meta_id;
+	
+	$data  = compact( 'meta_key', 'meta_value' );
+	$where = compact( 'meta_id' );
+
+	return $wpdb-&gt;update( $wpdb-&gt;postmeta, $data, $where );
 }
 
 //
@@ -502,14 +470,13 @@ function _relocate_children( $old_ID, $new_ID ) {
 	global $wpdb;
 	$old_ID = (int) $old_ID;
 	$new_ID = (int) $new_ID;
-	return $wpdb-&gt;query( &quot;UPDATE $wpdb-&gt;posts SET post_parent = $new_ID WHERE post_parent = $old_ID&quot; );
+	return $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET post_parent = %d WHERE post_parent = %d&quot;, $new_ID, $old_ID) );
 }
 
 function get_available_post_statuses($type = 'post') {
-	global $wpdb;
+	$stati = wp_count_posts($type);
 
-	$stati = $wpdb-&gt;get_col($wpdb-&gt;prepare(&quot;SELECT DISTINCT post_status FROM $wpdb-&gt;posts WHERE post_type = %s&quot;, $type));
-	return $stati;
+	return array_keys(get_object_vars($stati));
 }
 
 function wp_edit_posts_query( $q = false ) {
@@ -632,11 +599,10 @@ function get_sample_permalink($id, $title=null, $name = null) {
 		$permalink = str_replace('%pagename%', &quot;${uri}%pagename%&quot;, $permalink);
 	}
 
-	$permalink = array($permalink, $post-&gt;post_name);
+	$permalink = array($permalink, apply_filters('editable_slug', $post-&gt;post_name));
 	$post-&gt;post_status = $original_status;
 	$post-&gt;post_date = $original_date;
 	$post-&gt;post_name = $original_name;
-	$post-&gt;post_title = $original_title;
 	return $permalink;
 }
 
@@ -692,4 +658,28 @@ function wp_set_post_lock( $post_id ) {
 		update_post_meta( $post-&gt;ID, '_edit_last', $current_user-&gt;ID );
 }
 
-?&gt;
+/**
+ * wp_create_post_autosave() - creates autosave data for the specified post from $_POST data
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @uses _wp_translate_postdata()
+ * @uses _wp_post_revision_fields()
+ */
+function wp_create_post_autosave( $post_id ) {
+	$translated = _wp_translate_postdata( true );
+	if ( is_wp_error( $translated ) )
+		return $translated;
+
+	// Only store one autosave.  If there is already an autosave, overwrite it.
+	if ( $old_autosave = wp_get_post_autosave( $post_id ) ) {
+		$new_autosave = _wp_post_revision_fields( $_POST, true );
+		$new_autosave['ID'] = $old_autosave-&gt;ID;
+		return wp_update_post( $new_autosave );
+	}
+
+	// Otherwise create the new autosave as a special post revision
+	return _wp_put_post_revision( $_POST, true );
+}</diff>
      <filename>wp-admin/includes/post.php</filename>
    </modified>
    <modified>
      <diff>@@ -15,11 +15,12 @@ if ( $wpdb-&gt;supports_collation() ) {
 
 $wp_queries=&quot;CREATE TABLE $wpdb-&gt;terms (
  term_id bigint(20) NOT NULL auto_increment,
- name varchar(55) NOT NULL default '',
+ name varchar(200) NOT NULL default '',
  slug varchar(200) NOT NULL default '',
  term_group bigint(10) NOT NULL default 0,
  PRIMARY KEY  (term_id),
- UNIQUE KEY slug (slug)
+ UNIQUE KEY slug (slug),
+ KEY name (name)
 ) $charset_collate;
 CREATE TABLE $wpdb-&gt;term_taxonomy (
  term_taxonomy_id bigint(20) NOT NULL auto_increment,
@@ -153,9 +154,11 @@ CREATE TABLE $wpdb-&gt;usermeta (
 
 function populate_options() {
 	global $wpdb, $wp_db_version;
-
-	$schema = ( isset($_SERVER['HTTPS']) &amp;&amp; strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
-	$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+	
+	$guessurl = wp_guess_url();
+	
+	do_action('populate_options');
+	
 	add_option('siteurl', $guessurl);
 	add_option('blogname', __('My Blog'));
 	add_option('blogdescription', __('Just another WordPress weblog'));
@@ -223,14 +226,14 @@ function populate_options() {
 	if ( ini_get('safe_mode') ) {
 		// Safe mode screws up mkdir(), so we must use a flat structure.
 		add_option('uploads_use_yearmonth_folders', 0);
-		add_option('upload_path', 'wp-content');
+		add_option('upload_path', WP_CONTENT_DIR);
 	} else {
 		add_option('uploads_use_yearmonth_folders', 1);
-		add_option('upload_path', 'wp-content/uploads');
+		add_option('upload_path', WP_CONTENT_DIR . '/uploads');
 	}
 
 	// 2.0.3
-	add_option('secret', wp_generate_password());
+	add_option('secret', wp_generate_password(64));
 
 	// 2.1
 	add_option('blog_public', '1');
@@ -250,8 +253,13 @@ function populate_options() {
 	add_option('medium_size_w', 300);
 	add_option('medium_size_h', 300);
 
+	// 2.6
+	add_option('avatar_default', 'mystery');
+	add_option('enable_app', 0);
+	add_option('enable_xmlrpc', 0);
+	
 	// Delete unused options
-	$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');
+	$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');
 	foreach ($unusedoptions as $option) :
 		delete_option($option);
 	endforeach;
@@ -268,6 +276,7 @@ function populate_roles() {
 	populate_roles_210();
 	populate_roles_230();
 	populate_roles_250();
+	populate_roles_260();
 }
 
 function populate_roles_160() {
@@ -423,4 +432,13 @@ function populate_roles_250() {
 	}
 }
 
+function populate_roles_260() {
+	$role = get_role( 'administrator' );
+
+	if ( !empty( $role ) ) {
+		$role-&gt;add_cap( 'update_plugins' );
+		$role-&gt;add_cap( 'delete_plugins' );
+	}
+}
+
 ?&gt;</diff>
      <filename>wp-admin/includes/schema.php</filename>
    </modified>
    <modified>
      <diff>@@ -47,7 +47,7 @@ function wp_delete_category($cat_ID) {
 	if ( $cat_ID == $default )
 		return 0;
 
-	return wp_delete_term($cat_ID, 'category', &quot;default=$default&quot;);
+	return wp_delete_term($cat_ID, 'category', array('default' =&gt; $default));
 }
 
 function wp_insert_category($catarr, $wp_error = false) {
@@ -133,7 +133,7 @@ function get_tags_to_edit( $post_id ) {
 
 	foreach ( $tags as $tag )
 		$tag_names[] = $tag-&gt;name;
-	$tags_to_edit = join( ', ', $tag_names );
+	$tags_to_edit = join( ',', $tag_names );
 	$tags_to_edit = attribute_escape( $tags_to_edit );
 	$tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit );
 	return $tags_to_edit;</diff>
      <filename>wp-admin/includes/taxonomy.php</filename>
    </modified>
    <modified>
      <diff>@@ -4,35 +4,73 @@
 // Big Mess
 //
 
-// Dandy new recursive multiple category stuff.
-function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
-	if ( !$categories ) {
+// Ugly recursive category stuff.
+function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
+	$count = 0;
+	_cat_rows($categories, $count, $parent, $level, $page, $per_page);
+}
+
+function _cat_rows( $categories, &amp;$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) {
+	if ( empty($categories) ) {
 		$args = array('hide_empty' =&gt; 0);
 		if ( !empty($_GET['s']) )
 			$args['search'] = $_GET['s'];
 		$categories = get_categories( $args );
 	}
 
+	if ( !$categories )
+		return false;
+
 	$children = _get_term_hierarchy('category');
 
-	if ( $categories ) {
-		ob_start();
-		foreach ( $categories as $category ) {
-			if ( $category-&gt;parent == $parent) {
-				echo &quot;\t&quot; . _cat_row( $category, $level );
-				if ( isset($children[$category-&gt;term_id]) )
-					cat_rows( $category-&gt;term_id, $level +1, $categories );
+	$start = ($page - 1) * $per_page;
+	$end = $start + $per_page;
+	$i = -1;
+	ob_start();
+	foreach ( $categories as $category ) {
+		if ( $count &gt;= $end )
+			break;
+
+		$i++;
+
+		if ( $category-&gt;parent != $parent )
+			continue;
+
+		// If the page starts in a subtree, print the parents.
+		if ( $count == $start &amp;&amp; $category-&gt;parent &gt; 0 ) {
+			$my_parents = array();
+			$my_parent = $category-&gt;parent;
+			while ( $my_parent) {
+				$my_parent = get_category($my_parent);
+				$my_parents[] = $my_parent;
+				if ( !$my_parent-&gt;parent )
+					break;
+				$my_parent = $my_parent-&gt;parent;
+			}
+			$num_parents = count($my_parents);
+			while( $my_parent = array_pop($my_parents) ) {
+				echo &quot;\t&quot; . _cat_row( $my_parent, $level - $num_parents );
+				$num_parents--;
 			}
 		}
-		$output = ob_get_contents();
-		ob_end_clean();
 
-		$output = apply_filters('cat_rows', $output);
+		if ( $count &gt;= $start )
+			echo &quot;\t&quot; . _cat_row( $category, $level );
+
+		unset($categories[$i]); // Prune the working set		
+		$count++;
+
+		if ( isset($children[$category-&gt;term_id]) )
+			_cat_rows( $categories, $count, $category-&gt;term_id, $level + 1, $page, $per_page );
 
-		echo $output;
-	} else {
-		return false;
 	}
+
+	$output = ob_get_contents();
+	ob_end_clean();
+
+	$output = apply_filters('cat_rows', $output);
+
+	echo $output;
 }
 
 function _cat_row( $category, $level, $name_override = false ) {
@@ -55,11 +93,12 @@ function _cat_row( $category, $level, $name_override = false ) {
 	$output = &quot;&lt;tr id='cat-$category-&gt;term_id'$class&gt;
 			   &lt;th scope='row' class='check-column'&gt;&quot;;
 	if ( absint(get_option( 'default_category' ) ) != $category-&gt;term_id ) {
-		$output .= &quot;&lt;input type='checkbox' name='delete[]' value='$category-&gt;term_id' /&gt;&lt;/th&gt;&quot;;
+		$output .= &quot;&lt;input type='checkbox' name='delete[]' value='$category-&gt;term_id' /&gt;&quot;;
 	} else {
 		$output .= &quot;&amp;nbsp;&quot;;
 	}
-	$output .= &quot;&lt;td&gt;$edit&lt;/td&gt;
+	$output .= &quot;&lt;/th&gt;
+				&lt;td&gt;$edit&lt;/td&gt;
 				&lt;td&gt;$category-&gt;description&lt;/td&gt;
 				&lt;td class='num'&gt;$posts_count&lt;/td&gt;\n\t&lt;/tr&gt;\n&quot;;
 
@@ -86,11 +125,17 @@ function link_cat_row( $category ) {
 
 	$category-&gt;count = number_format_i18n( $category-&gt;count );
 	$count = ( $category-&gt;count &gt; 0 ) ? &quot;&lt;a href='link-manager.php?cat_id=$category-&gt;term_id'&gt;$category-&gt;count&lt;/a&gt;&quot; : $category-&gt;count;
-	$output = &quot;&lt;tr id='link-cat-$category-&gt;term_id'$class&gt;&quot; .
-		'&lt;th scope=&quot;row&quot; class=&quot;check-column&quot;&gt; &lt;input type=&quot;checkbox&quot; name=&quot;delete[]&quot; value=&quot;' . $category-&gt;term_id . '&quot; /&gt;&lt;/th&gt;' .
-		&quot;&lt;td&gt;$edit&lt;/td&gt;
-		&lt;td&gt;$category-&gt;description&lt;/td&gt;
-		&lt;td class='num'&gt;$count&lt;/td&gt;&lt;/tr&gt;&quot;;
+	$output = &quot;&lt;tr id='link-cat-$category-&gt;term_id'$class&gt;
+			   &lt;th scope='row' class='check-column'&gt;&quot;;
+	if ( absint( get_option( 'default_link_category' ) ) != $category-&gt;term_id ) {
+		$output .= &quot;&lt;input type='checkbox' name='delete[]' value='$category-&gt;term_id' /&gt;&quot;;
+	} else {
+		$output .= &quot;&amp;nbsp;&quot;;
+	}
+	$output .= &quot;&lt;/th&gt;
+				&lt;td&gt;$edit&lt;/td&gt;
+				&lt;td&gt;$category-&gt;description&lt;/td&gt;
+				&lt;td class='num'&gt;$count&lt;/td&gt;&lt;/tr&gt;&quot;;
 
 	return apply_filters( 'link_cat_row', $output );
 }
@@ -106,93 +151,99 @@ function selected( $selected, $current) {
 }
 
 //
-// Nasty Category Stuff
+// Category Checklists
 //
 
-function sort_cats( $cat1, $cat2 ) {
-	if ( $cat1['checked'] || $cat2['checked'] )
-		return ( $cat1['checked'] &amp;&amp; !$cat2['checked'] ) ? -1 : 1;
-	else
-		return strcasecmp( $cat1['cat_name'], $cat2['cat_name'] );
+// Deprecated. Use wp_link_category_checklist
+function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
+	global $post_ID;
+	wp_category_checklist($post_ID);
 }
 
-function wp_set_checked_post_categories( $default = 0 ) {
-	global $post_ID, $checked_categories;
+class Walker_Category_Checklist extends Walker {
+	var $tree_type = 'category';
+	var $db_fields = array ('parent' =&gt; 'parent', 'id' =&gt; 'term_id'); //TODO: decouple this
 
-	if ( empty($checked_categories) ) {
-		if ( $post_ID ) {
-			$checked_categories = wp_get_post_categories($post_ID);
+	function start_lvl(&amp;$output, $depth, $args) {
+		$indent = str_repeat(&quot;\t&quot;, $depth);
+		$output .= &quot;$indent&lt;ul class='children'&gt;\n&quot;;
+	}
 
-			if ( count( $checked_categories ) == 0 ) {
-				// No selected categories, strange
-			$checked_categories[] = $default;
-			}
-		} else {
-			$checked_categories[] = $default;
-		}
+	function end_lvl(&amp;$output, $depth, $args) {
+		$indent = str_repeat(&quot;\t&quot;, $depth);
+		$output .= &quot;$indent&lt;/ul&gt;\n&quot;;
 	}
 
-}
-function get_nested_categories( $default = 0, $parent = 0 ) {
-	global $checked_categories;
-
-	wp_set_checked_post_categories( $default = 0 );
-
-	if ( is_object($parent) ) { // Hack: if passed a category object, will return nested cats with parent as root
-		$root = array(
-			'children' =&gt; get_nested_categories( $default, $parent-&gt;term_id ),
-			'cat_ID' =&gt; $parent-&gt;term_id,
-			'checked' =&gt; in_array( $parent-&gt;term_id, $checked_categories ),
-			'cat_name' =&gt; get_the_category_by_ID( $parent-&gt;term_id )
-		);
-		$result = array( $parent-&gt;term_id =&gt; $root );
-	} else {
-		$parent = (int) $parent;
+	function start_el(&amp;$output, $category, $depth, $args) {
+		extract($args);
 
-		$cats = get_categories(&quot;parent=$parent&amp;hide_empty=0&amp;fields=ids&quot;);
+		$class = in_array( $category-&gt;term_id, $popular_cats ) ? ' class=&quot;popular-category&quot;' : '';
+		$output .= &quot;\n&lt;li id='category-$category-&gt;term_id'$class&gt;&quot; . '&lt;label for=&quot;in-category-' . $category-&gt;term_id . '&quot; class=&quot;selectit&quot;&gt;&lt;input value=&quot;' . $category-&gt;term_id . '&quot; type=&quot;checkbox&quot; name=&quot;post_category[]&quot; id=&quot;in-category-' . $category-&gt;term_id . '&quot;' . (in_array( $category-&gt;term_id, $selected_cats ) ? ' checked=&quot;checked&quot;' : &quot;&quot; ) . '/&gt; ' . wp_specialchars( apply_filters('the_category', $category-&gt;name )) . '&lt;/label&gt;';
+	}
 
-		$result = array();
-		if ( is_array( $cats ) ) {
-			foreach ( $cats as $cat ) {
-				$result[$cat]['children'] = get_nested_categories( $default, $cat );
-				$result[$cat]['cat_ID'] = $cat;
-				$result[$cat]['checked'] = in_array( $cat, $checked_categories );
-				$result[$cat]['cat_name'] = get_the_category_by_ID( $cat );
-			}
-		}
+	function end_el(&amp;$output, $category, $depth, $args) {
+		$output .= &quot;&lt;/li&gt;\n&quot;;
 	}
+}
 
-	$result = apply_filters('get_nested_categories', $result);
-	usort( $result, 'sort_cats' );
+function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false ) {
+	$walker = new Walker_Category_Checklist;
+	$descendants_and_self = (int) $descendants_and_self;
 
-	return $result;
-}
+	$args = array();
+	
+	if ( is_array( $selected_cats ) )
+		$args['selected_cats'] = $selected_cats;
+	elseif ( $post_id )
+		$args['selected_cats'] = wp_get_post_categories($post_id);
+	else
+		$args['selected_cats'] = array();
 
-function write_nested_categories( $categories ) {
-	foreach ( $categories as $category ) {
-		echo &quot;\n&quot;, '&lt;li id=&quot;category-', $category['cat_ID'], '&quot;&gt;&lt;label for=&quot;in-category-', $category['cat_ID'], '&quot; class=&quot;selectit&quot;&gt;&lt;input value=&quot;', $category['cat_ID'], '&quot; type=&quot;checkbox&quot; name=&quot;post_category[]&quot; id=&quot;in-category-', $category['cat_ID'], '&quot;', ($category['checked'] ? ' checked=&quot;checked&quot;' : &quot;&quot; ), '/&gt; ', wp_specialchars( apply_filters('the_category', $category['cat_name'] )), '&lt;/label&gt;';
+	if ( is_array( $popular_cats ) )
+		$args['popular_cats'] = $popular_cats;
+	else
+		$args['popular_cats'] = get_terms( 'category', array( 'fields' =&gt; 'ids', 'orderby' =&gt; 'count', 'order' =&gt; 'DESC', 'number' =&gt; 10, 'hierarchical' =&gt; false ) );
 
-		if ( $category['children'] ) {
-			echo &quot;\n&lt;ul&gt;&quot;;
-			write_nested_categories( $category['children'] );
-			echo &quot;\n&lt;/ul&gt;&quot;;
+	if ( $descendants_and_self ) {
+		$categories = get_categories( &quot;child_of=$descendants_and_self&amp;hierarchical=0&amp;hide_empty=0&quot; );
+		$self = get_category( $descendants_and_self );
+		array_unshift( $categories, $self );
+	} else {
+		$categories = get_categories('get=all');
+	}
+
+	// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
+	$checked_categories = array();
+	for ( $i = 0; isset($categories[$i]); $i++ ) {
+		if ( in_array($categories[$i]-&gt;term_id, $args['selected_cats']) ) {
+			$checked_categories[] = $categories[$i];
+			unset($categories[$i]);
 		}
-		echo '&lt;/li&gt;';
 	}
-}
 
-function dropdown_categories( $default = 0, $parent = 0 ) {
-	write_nested_categories( get_nested_categories( $default, $parent ) );
+	// Put checked cats on top
+	echo call_user_func_array(array(&amp;$walker, 'walk'), array($checked_categories, 0, $args));
+	// Then the rest of them
+	echo call_user_func_array(array(&amp;$walker, 'walk'), array($categories, 0, $args));
 }
 
-function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10 ) {
-	$categories = get_terms( $taxonomy, array( 'orderby' =&gt; 'count', 'order' =&gt; 'DESC', 'number' =&gt; $number ) );
+function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
+	global $post_ID;
+	if ( $post_ID )
+		$checked_categories = wp_get_post_categories($post_ID);
+	else
+		$checked_categories = array();
+	$categories = get_terms( $taxonomy, array( 'orderby' =&gt; 'count', 'order' =&gt; 'DESC', 'number' =&gt; $number, 'hierarchical' =&gt; false ) );
 
+	$popular_ids = array();
 	foreach ( (array) $categories as $category ) {
+		$popular_ids[] = $category-&gt;term_id;
+		if ( !$echo ) // hack for AJAX use
+			continue;
 		$id = &quot;popular-category-$category-&gt;term_id&quot;;
 		?&gt;
 
-		&lt;li id=&quot;&lt;?php echo $id; ?&gt;&quot; &gt;
+		&lt;li id=&quot;&lt;?php echo $id; ?&gt;&quot; class=&quot;popular-category&quot;&gt;
 			&lt;label class=&quot;selectit&quot; for=&quot;in-&lt;?php echo $id; ?&gt;&quot;&gt;
 			&lt;input id=&quot;in-&lt;?php echo $id; ?&gt;&quot; type=&quot;checkbox&quot; value=&quot;&lt;?php echo (int) $category-&gt;term_id; ?&gt;&quot; /&gt;
 				&lt;?php echo wp_specialchars( apply_filters( 'the_category', $category-&gt;name ) ); ?&gt;
@@ -201,11 +252,17 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10 ) {
 
 		&lt;?php
 	}
+	return $popular_ids;
 }
 
+// Deprecated. Use wp_link_category_checklist
 function dropdown_link_categories( $default = 0 ) {
 	global $link_id;
 
+	wp_link_category_checklist($link_id);
+}
+
+function wp_link_category_checklist( $link_id = 0 ) {
 	if ( $link_id ) {
 		$checked_categories = wp_get_link_cats($link_id);
 
@@ -283,7 +340,7 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
 // define the columns to display, the syntax is 'internal name' =&gt; 'display name'
 function wp_manage_posts_columns() {
 	$posts_columns = array();
-	$posts_columns['cb'] = '&lt;input type=&quot;checkbox&quot; onclick=&quot;checkAll(document.getElementById(\'posts-filter\'));&quot; /&gt;';
+	$posts_columns['cb'] = '&lt;input type=&quot;checkbox&quot; /&gt;';
 	if ( 'draft' === $_GET['post_status'] )
 		$posts_columns['modified'] = __('Modified');
 	elseif ( 'pending' === $_GET['post_status'] )
@@ -305,7 +362,7 @@ function wp_manage_posts_columns() {
 // define the columns to display, the syntax is 'internal name' =&gt; 'display name'
 function wp_manage_media_columns() {
 	$posts_columns = array();
-	$posts_columns['cb'] = '&lt;input type=&quot;checkbox&quot; onclick=&quot;checkAll(document.getElementById(\'posts-filter\'));&quot; /&gt;';
+	$posts_columns['cb'] = '&lt;input type=&quot;checkbox&quot; /&gt;';
 	$posts_columns['icon'] = '';
 	$posts_columns['media'] = _c('Media|media column header');
 	$posts_columns['desc'] = _c('Description|media column header');
@@ -320,7 +377,7 @@ function wp_manage_media_columns() {
 
 function wp_manage_pages_columns() {
 	$posts_columns = array();
-	$posts_columns['cb'] = '&lt;input type=&quot;checkbox&quot; onclick=&quot;checkAll(document.getElementById(\'posts-filter\'));&quot; /&gt;';
+	$posts_columns['cb'] = '&lt;input type=&quot;checkbox&quot; /&gt;';
 	if ( 'draft' === $_GET['post_status'] )
 		$posts_columns['modified'] = __('Modified');
 	elseif ( 'pending' === $_GET['post_status'] )
@@ -341,7 +398,7 @@ function wp_manage_pages_columns() {
  * display one row if the page doesn't have any children
  * otherwise, display the row and its children in subsequent rows
  */
-function display_page_row( $page, &amp;$children_pages, $level = 0 ) {
+function display_page_row( $page, $level = 0 ) {
 	global $post;
 	static $class;
 
@@ -465,66 +522,126 @@ foreach ($posts_columns as $column_name=&gt;$column_display_name) {
    &lt;/tr&gt;
 
 &lt;?php
-
-	if ( ! $children_pages )
-		return true;
-
-	for ( $i = 0; $i &lt; count($children_pages); $i++ ) {
-
-		$child = $children_pages[$i];
-
-		if ( $child-&gt;post_parent == $id ) {
-			array_splice($children_pages, $i, 1);
-			display_page_row($child, $children_pages, $level+1);
-			$i = -1; //as numeric keys in $children_pages are not preserved after splice
-		}
-	}
 }
 
 /*
- * displays pages in hierarchical order
+ * displays pages in hierarchical order with paging support
  */
-function page_rows( $pages ) {
-	if ( ! $pages )
-		$pages = get_pages( 'sort_column=menu_order' );
+function page_rows($pages, $pagenum = 1, $per_page = 20) {
+	$level = 0;
 
-	if ( ! $pages )
-		return false;
+	if ( ! $pages ) {
+		$pages = get_pages( array('sort_column' =&gt; 'menu_order') );
+
+		if ( ! $pages )
+			return false;
+	}
 
-	// splice pages into two parts: those without parent and those with parent
+	/* 
+	 * arrange pages into two parts: top level pages and children_pages
+	 * children_pages is two dimensional array, eg. 
+	 * children_pages[10][] contains all sub-pages whose parent is 10. 
+	 * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
+	 * If searching, ignore hierarchy and treat everything as top level
+	 */
+	if ( empty($_GET['s']) )  {
+		
+		$top_level_pages = array();
+		$children_pages  = array();
+		
+		foreach ( $pages as $page ) {
+			
+			// catch and repair bad pages
+			if ( $page-&gt;post_parent == $page-&gt;ID ) {
+				$page-&gt;post_parent = 0;
+				$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET post_parent = '0' WHERE ID = %d&quot;, $page-&gt;ID) );
+				clean_page_cache( $page-&gt;ID );
+			}
+	
+			if ( 0 == $page-&gt;post_parent )
+				$top_level_pages[] = $page;
+			else
+				$children_pages[ $page-&gt;post_parent ][] = $page;
+		}
 
-	$top_level_pages = array();
-	$children_pages  = array();
+		$pages = &amp;$top_level_pages;
+	}
 
+	$count = 0;
+	$start = ($pagenum - 1) * $per_page;
+	$end = $start + $per_page;
+	
 	foreach ( $pages as $page ) {
+		if ( $count &gt;= $end )
+			break;
 
-		// catch and repair bad pages
-		if ( $page-&gt;post_parent == $page-&gt;ID ) {
-			$page-&gt;post_parent = 0;
-			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET post_parent = '0' WHERE ID = %d&quot;, $page-&gt;ID) );
-			clean_page_cache( $page-&gt;ID );
-		}
+		if ( $count &gt;= $start )
+			echo &quot;\t&quot; . display_page_row( $page, $level );
 
-		if ( 0 == $page-&gt;post_parent )
-			$top_level_pages[] = $page;
-		else
-			$children_pages[] = $page;
-	}
+		$count++;
 
-	foreach ( $top_level_pages as $page )
-		display_page_row($page, $children_pages, 0);
+		if ( isset($children_pages) )
+			_page_rows( $children_pages, $count, $page-&gt;ID, $level + 1, $pagenum, $per_page );
+	}
+	
+	// if it is the last pagenum and there are orphaned pages, display them with paging as well
+	if ( isset($children_pages) &amp;&amp; $count &lt; $end ){
+		foreach( $children_pages as $orphans ){
+			foreach ( $orphans as $op ) {
+				if ( $count &gt;= $end )
+					break;
+				if ( $count &gt;= $start )
+					echo &quot;\t&quot; . display_page_row( $op, 0 );
+				$count++;
+			}
+		}
+	}
+}
 
-	/*
-	 * display the remaining children_pages which are orphans
-	 * having orphan requires parental attention
-	 */
-	 if ( count($children_pages) &gt; 0 ) {
-	 	$empty_array = array();
-	 	foreach ( $children_pages as $orphan_page ) {
-			clean_page_cache( $orphan_page-&gt;ID);
-			display_page_row( $orphan_page, $empty_array, 0 );
+/*
+ * Given a top level page ID, display the nested hierarchy of sub-pages
+ * together with paging support
+ */
+function _page_rows( &amp;$children_pages, &amp;$count, $parent, $level, $pagenum, $per_page ) {
+	
+	if ( ! isset( $children_pages[$parent] ) )
+		return; 
+		
+	$start = ($pagenum - 1) * $per_page;
+	$end = $start + $per_page;
+	
+	foreach ( $children_pages[$parent] as $page ) {
+		
+		if ( $count &gt;= $end )
+			break;
+			
+		// If the page starts in a subtree, print the parents.
+		if ( $count == $start &amp;&amp; $page-&gt;post_parent &gt; 0 ) {
+			$my_parents = array();
+			$my_parent = $page-&gt;post_parent;
+			while ( $my_parent) {
+				$my_parent = get_post($my_parent);
+				$my_parents[] = $my_parent;
+				if ( !$my_parent-&gt;post_parent )
+					break;
+				$my_parent = $my_parent-&gt;post_parent;
+			}
+			$num_parents = count($my_parents);
+			while( $my_parent = array_pop($my_parents) ) {
+				echo &quot;\t&quot; . display_page_row( $my_parent, $level - $num_parents );
+				$num_parents--;
+			}
 		}
-	 }
+
+		if ( $count &gt;= $start )
+			echo &quot;\t&quot; . display_page_row( $page, $level );
+			
+		$count++;
+
+		_page_rows( $children_pages, $count, $page-&gt;ID, $level + 1, $pagenum, $per_page );
+	}
+	
+	unset( $children_pages[$parent] ); //required in order to keep track of orphans
 }
 
 function user_row( $user_object, $style = '', $role = '' ) {
@@ -553,7 +670,7 @@ function user_row( $user_object, $style = '', $role = '' ) {
 	} else {
 		$edit = $user_object-&gt;user_login;
 	}
-	$role_name = translate_with_context($wp_roles-&gt;role_names[$role]);
+	$role_name = $wp_roles-&gt;role_names[$role] ? translate_with_context($wp_roles-&gt;role_names[$role]) : __('None');
 	$r = &quot;&lt;tr id='user-$user_object-&gt;ID'$style&gt;
 		&lt;th scope='row' class='check-column'&gt;&lt;input type='checkbox' name='users[]' id='user_{$user_object-&gt;ID}' class='$role' value='{$user_object-&gt;ID}' /&gt;&lt;/th&gt;
 		&lt;td&gt;&lt;strong&gt;$edit&lt;/strong&gt;&lt;/td&gt;
@@ -585,7 +702,7 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
 	elseif ( 'spam' == $status )
 		$approved = &quot;comment_approved = 'spam'&quot;;
 	else
-		$approved = &quot;comment_approved != 'spam'&quot;;
+		$approved = &quot;( comment_approved = '0' OR comment_approved = '1' )&quot;;
 
 	if ( $s ) {
 		$s = $wpdb-&gt;escape($s);
@@ -672,21 +789,22 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
 
 	$actions = array();
 
-		$actions['approve']   = &quot;&lt;a href='$approve_url' class='dim:the-comment-list:comment-$comment-&gt;comment_ID:unapproved:e7e7d3:e7e7d3' title='&quot; . __( 'Approve this comment' ) . &quot;'&gt;&quot; . __( 'Approve' ) . '&lt;/a&gt; | ';
-		$actions['unapprove'] = &quot;&lt;a href='$unapprove_url' class='dim:the-comment-list:comment-$comment-&gt;comment_ID:unapproved:e7e7d3:e7e7d3' title='&quot; . __( 'Unapprove this comment' ) . &quot;'&gt;&quot; . __( 'Unapprove' ) . '&lt;/a&gt; | ';
+	if ( current_user_can('edit_post', $comment-&gt;comment_post_ID) ) {
+		$actions['approve']   = &quot;&lt;a href='$approve_url' class='dim:the-comment-list:comment-$comment-&gt;comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' title='&quot; . __( 'Approve this comment' ) . &quot;'&gt;&quot; . __( 'Approve' ) . '&lt;/a&gt; | ';
+		$actions['unapprove'] = &quot;&lt;a href='$unapprove_url' class='dim:the-comment-list:comment-$comment-&gt;comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' title='&quot; . __( 'Unapprove this comment' ) . &quot;'&gt;&quot; . __( 'Unapprove' ) . '&lt;/a&gt; | ';
 
 		// we're looking at list of only approved or only unapproved comments
 		if ( 'moderated' == $comment_status ) {
-			$actions['approve'] = &quot;&lt;a href='$approve_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID:e7e7d3:action=dim-comment' title='&quot; . __( 'Approve this comment' ) . &quot;'&gt;&quot; . __( 'Approve' ) . '&lt;/a&gt; | ';
+			$actions['approve'] = &quot;&lt;a href='$approve_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID:e7e7d3:action=dim-comment&amp;new=approved' title='&quot; . __( 'Approve this comment' ) . &quot;'&gt;&quot; . __( 'Approve' ) . '&lt;/a&gt; | ';
 			unset($actions['unapprove']);
 		} elseif ( 'approved' == $comment_status ) {
-			$actions['unapprove'] = &quot;&lt;a href='$unapprove_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID:e7e7d3:action=dim-comment' title='&quot; . __( 'Unapprove this comment' ) . &quot;'&gt;&quot; . __( 'Unapprove' ) . '&lt;/a&gt; | ';
+			$actions['unapprove'] = &quot;&lt;a href='$unapprove_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved' title='&quot; . __( 'Unapprove this comment' ) . &quot;'&gt;&quot; . __( 'Unapprove' ) . '&lt;/a&gt; | ';
 			unset($actions['approve']);
 		}
 
-	if ( current_user_can('edit_post', $comment-&gt;comment_post_ID) ) {
 		$actions['spam']      = &quot;&lt;a href='$spam_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID::spam=1' title='&quot; . __( 'Mark this comment as spam' ) . &quot;'&gt;&quot; . __( 'Spam' ) . '&lt;/a&gt; | ';
 		$actions['delete']    = &quot;&lt;a href='$delete_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID delete'&gt;&quot; . __('Delete') . '&lt;/a&gt;';
+		$actions = apply_filters( 'comment_row_actions', $actions, $comment );
 		foreach ( $actions as $action =&gt; $link )
 			echo &quot;&lt;span class='$action'&gt;$link&lt;/span&gt;&quot;;
 	}
@@ -698,7 +816,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
 
 function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
 	if (!$categories )
-		$categories = get_categories( 'hide_empty=0' );
+		$categories = get_categories( array('hide_empty' =&gt; 0) );
 
 	if ( $categories ) {
 		foreach ( $categories as $category ) {
@@ -771,8 +889,8 @@ function _list_meta_row( $entry, &amp;$count ) {
 	$delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
 
 	$r .= &quot;\n\t&lt;tr id='meta-{$entry['meta_id']}' class='$style'&gt;&quot;;
-	$r .= &quot;\n\t\t&lt;td valign='top'&gt;&lt;input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /&gt;&lt;/td&gt;&quot;;
-	$r .= &quot;\n\t\t&lt;td&gt;&lt;textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'&gt;{$entry['meta_value']}&lt;/textarea&gt;&lt;/td&gt;&quot;;
+	$r .= &quot;\n\t\t&lt;td valign='top'&gt;&lt;label class='hidden' for='meta[{$entry['meta_id']}][key]'&gt;&quot; . __( 'Key' ) . &quot;&lt;/label&gt;&lt;input name='meta[{$entry['meta_id']}][key]' id='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /&gt;&lt;/td&gt;&quot;;
+	$r .= &quot;\n\t\t&lt;td&gt;&lt;label class='hidden' for='meta[{$entry['meta_id']}][value]'&gt;&quot; . __( 'Value' ) . &quot;&lt;/label&gt;&lt;textarea name='meta[{$entry['meta_id']}][value]' id='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'&gt;{$entry['meta_value']}&lt;/textarea&gt;&lt;/td&gt;&quot;;
 	$r .= &quot;\n\t\t&lt;td style='text-align: center;'&gt;&lt;input name='updatemeta' type='submit' tabindex='6' value='&quot;.attribute_escape(__( 'Update' )).&quot;' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$update_nonce updatemeta' /&gt;&lt;br /&gt;&quot;;
 	$r .= &quot;\n\t\t&lt;input name='deletemeta[{$entry['meta_id']}]' type='submit' &quot;;
 	$r .= &quot;class='delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce deletemeta' tabindex='6' value='&quot;.attribute_escape(__( 'Delete' )).&quot;' /&gt;&quot;;
@@ -797,8 +915,8 @@ function meta_form() {
 &lt;p&gt;&lt;strong&gt;&lt;?php _e( 'Add a new custom field:' ) ?&gt;&lt;/strong&gt;&lt;/p&gt;
 &lt;table id=&quot;newmeta&quot; cellspacing=&quot;3&quot; cellpadding=&quot;3&quot;&gt;
 	&lt;tr&gt;
-&lt;th colspan=&quot;2&quot;&gt;&lt;?php _e( 'Key' ) ?&gt;&lt;/th&gt;
-&lt;th&gt;&lt;?php _e( 'Value' ) ?&gt;&lt;/th&gt;
+&lt;th colspan=&quot;2&quot;&gt;&lt;label &lt;?php if ( $keys ) : ?&gt; for=&quot;metakeyselect&quot; &lt;?php else : ?&gt; for=&quot;metakeyinput&quot; &lt;?php endif; ?&gt;&gt;&lt;?php _e( 'Key' ) ?&gt;&lt;/label&gt;&lt;/th&gt;
+&lt;th&gt;&lt;label for=&quot;metavalue&quot;&gt;&lt;?php _e( 'Value' ) ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;/tr&gt;
 	&lt;tr valign=&quot;top&quot;&gt;
 		&lt;td style=&quot;width: 18%;&quot; class=&quot;textright&quot;&gt;
@@ -812,7 +930,7 @@ function meta_form() {
 		echo &quot;\n\t&lt;option value='$key'&gt;$key&lt;/option&gt;&quot;;
 	}
 ?&gt;
-&lt;/select&gt; &lt;?php _e( 'or' ); ?&gt;
+&lt;/select&gt; &lt;label for=&quot;metakeyinput&quot;&gt;&lt;?php _e( 'or' ); ?&gt;&lt;/label&gt;
 &lt;?php endif; ?&gt;
 &lt;/td&gt;
 &lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;metakeyinput&quot; name=&quot;metakeyinput&quot; tabindex=&quot;7&quot; /&gt;&lt;/td&gt;
@@ -820,7 +938,7 @@ function meta_form() {
 	&lt;/tr&gt;
 &lt;tr class=&quot;submit&quot;&gt;&lt;td colspan=&quot;3&quot;&gt;
 	&lt;?php wp_nonce_field( 'add-meta', '_ajax_nonce', false ); ?&gt;
-	&lt;input type=&quot;submit&quot; id=&quot;addmetasub&quot; name=&quot;addmeta&quot; class=&quot;add:the-list:newmeta::post_id=&lt;?php echo $GLOBALS['post_ID'] ? $GLOBALS['post_ID'] : $GLOBALS['temp_ID']; ?&gt;&quot; tabindex=&quot;9&quot; value=&quot;&lt;?php _e( 'Add Custom Field' ) ?&gt;&quot; /&gt;
+	&lt;input type=&quot;submit&quot; id=&quot;addmetasub&quot; name=&quot;addmeta&quot; class=&quot;add:the-list:newmeta&quot; tabindex=&quot;9&quot; value=&quot;&lt;?php _e( 'Add Custom Field' ) ?&gt;&quot; /&gt;
 &lt;/td&gt;&lt;/tr&gt;
 &lt;/table&gt;
 &lt;?php
@@ -885,7 +1003,7 @@ function page_template_dropdown( $default = '' ) {
 
 function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
 	global $wpdb, $post_ID;
-	$items = $wpdb-&gt;get_results( &quot;SELECT ID, post_parent, post_title FROM $wpdb-&gt;posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order&quot; );
+	$items = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT ID, post_parent, post_title FROM $wpdb-&gt;posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order&quot;, $parent) );
 
 	if ( $items ) {
 		foreach ( $items as $item ) {
@@ -1038,10 +1156,12 @@ function wp_remember_old_slug() {
  * @param string $callback Function that fills the box with the desired content.  The function should echo its output.
  * @param string $page The type of edit page on which to show the box (post, page, link)
  * @param string $context The context within the page where the boxes should show ('normal', 'advanced')
+ * @param string $priority The priority within the context where the boxes should show ('high', 'low')
  */
-function add_meta_box($id, $title, $callback, $page, $context = 'advanced') {
+function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
 	global $wp_meta_boxes;
 
+	
 	if  ( !isset($wp_meta_boxes) )
 		$wp_meta_boxes = array();
 	if ( !isset($wp_meta_boxes[$page]) )
@@ -1049,23 +1169,81 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced') {
 	if ( !isset($wp_meta_boxes[$page][$context]) )
 		$wp_meta_boxes[$page][$context] = array();
 
-	$wp_meta_boxes[$page][$context][] = array('id' =&gt; $id, 'title' =&gt; $title, 'callback' =&gt; $callback);
+	foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
+		if ( !isset($wp_meta_boxes[$page][$context][$a_priority][$id]) )
+			continue;
+		// If a core box was previously added or removed by a plugin, don't add.
+		if ( 'core' == $priority ) {
+			// If core box previously deleted, don't add
+			if ( false === $wp_meta_boxes[$page][$context][$a_priority][$id] )
+				return;
+			// If box was added with default priority, give it core priority to maintain sort order
+			if ( 'default' == $a_priority ) {
+				$wp_meta_boxes[$page][$context]['core'][$id] = $wp_meta_boxes[$page][$context]['default'][$id];
+				unset($wp_meta_boxes[$page][$context]['default'][$id]);
+			}
+			return;
+		}
+		// If no priority given and id already present, use existing priority
+		if ( empty($priority) )
+			$priority = $a_priority;
+		// An id can be in only one priority
+		if ( $priority != $a_priority )
+			unset($wp_meta_boxes[$page][$context][$a_priority][$id]);
+	}
+
+	if ( empty($priority) )
+		$priority = low;
+
+	if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
+		$wp_meta_boxes[$page][$context][$priority] = array();
+
+	$wp_meta_boxes[$page][$context][$priority][$id] = array('id' =&gt; $id, 'title' =&gt; $title, 'callback' =&gt; $callback);
 }
 
 function do_meta_boxes($page, $context, $object) {
 	global $wp_meta_boxes;
 
+	do_action('do_meta_boxes', $page, $context, $object);
+
 	if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
 		return;
 
-	foreach ( (array) $wp_meta_boxes[$page][$context] as $box ) {
-		echo '&lt;div id=&quot;' . $box['id'] . '&quot; class=&quot;postbox ' . postbox_classes($box['id'], $page) . '&quot;&gt;' . &quot;\n&quot;;
-		echo &quot;&lt;h3&gt;{$box['title']}&lt;/h3&gt;\n&quot;;
-		echo '&lt;div class=&quot;inside&quot;&gt;' . &quot;\n&quot;;
-		call_user_func($box['callback'], $object, $box);
-		echo &quot;&lt;/div&gt;\n&quot;;
-		echo &quot;&lt;/div&gt;\n&quot;;
+	foreach ( array('high', 'core', 'default', 'low') as $priority ) {
+		foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
+			if ( false === $box )
+				continue;
+			echo '&lt;div id=&quot;' . $box['id'] . '&quot; class=&quot;postbox ' . postbox_classes($box['id'], $page) . '&quot;&gt;' . &quot;\n&quot;;
+			echo &quot;&lt;h3&gt;{$box['title']}&lt;/h3&gt;\n&quot;;
+			echo '&lt;div class=&quot;inside&quot;&gt;' . &quot;\n&quot;;
+			call_user_func($box['callback'], $object, $box);
+			echo &quot;&lt;/div&gt;\n&quot;;
+			echo &quot;&lt;/div&gt;\n&quot;;
+		}
 	}
 }
 
+/**
+ * remove_meta_box() - Remove a meta box from an edit form
+ *
+ * @since 2.6
+ *
+ * @param string $id String for use in the 'id' attribute of tags.
+ * @param string $page The type of edit page on which to show the box (post, page, link)
+ * @param string $context The context within the page where the boxes should show ('normal', 'advanced')
+ */
+function remove_meta_box($id, $page, $context) {
+	global $wp_meta_boxes;
+
+	if  ( !isset($wp_meta_boxes) )
+		$wp_meta_boxes = array();
+	if ( !isset($wp_meta_boxes[$page]) )
+		$wp_meta_boxes[$page] = array();
+	if ( !isset($wp_meta_boxes[$page][$context]) )
+		$wp_meta_boxes[$page][$context] = array();
+
+	foreach ( array('high', 'core', 'default', 'low') as $priority )
+		$wp_meta_boxes[$page][$context][$priority][$id] = false;
+}
+
 ?&gt;</diff>
      <filename>wp-admin/includes/template.php</filename>
    </modified>
    <modified>
      <diff>@@ -33,7 +33,7 @@ function get_page_templates() {
 
 	if ( is_array( $templates ) ) {
 		foreach ( $templates as $template ) {
-			$template_data = implode( '', file( ABSPATH.$template ));
+			$template_data = implode( '', file( WP_CONTENT_DIR.$template ));
 
 			preg_match( '|Template Name:(.*)$|mi', $template_data, $name );
 			preg_match( '|Description:(.*)$|mi', $template_data, $description );</diff>
      <filename>wp-admin/includes/theme.php</filename>
    </modified>
    <modified>
      <diff>@@ -53,90 +53,24 @@ function update_right_now_message() {
 	echo &quot;&lt;span id='wp-version-message'&gt;$msg&lt;/span&gt;&quot;;
 }
 
-function wp_update_plugins() {
-	global $wp_version;
-
-	if ( !function_exists('fsockopen') )
-		return false;
-
-	$plugins = get_plugins();
-	$active  = get_option( 'active_plugins' );
-	$current = get_option( 'update_plugins' );
-
-	$new_option = '';
-	$new_option-&gt;last_checked = time();
-
-	$plugin_changed = false;
-	foreach ( $plugins as $file =&gt; $p ) {
-		$new_option-&gt;checked[ $file ] = $p['Version'];
-
-		if ( !isset( $current-&gt;checked[ $file ] ) ) {
-			$plugin_changed = true;
-			continue;
-		}
-
-		if ( strval($current-&gt;checked[ $file ]) !== strval($p['Version']) )
-			$plugin_changed = true;
-	}
-
-	if (
-		isset( $current-&gt;last_checked ) &amp;&amp;
-		43200 &gt; ( time() - $current-&gt;last_checked ) &amp;&amp;
-		!$plugin_changed
-	)
-		return false;
-
-	$to_send-&gt;plugins = $plugins;
-	$to_send-&gt;active = $active;
-	$send = serialize( $to_send );
-
-	$request = 'plugins=' . urlencode( $send );
-	$http_request  = &quot;POST /plugins/update-check/1.0/ HTTP/1.0\r\n&quot;;
-	$http_request .= &quot;Host: api.wordpress.org\r\n&quot;;
-	$http_request .= &quot;Content-Type: application/x-www-form-urlencoded; charset=&quot; . get_option('blog_charset') . &quot;\r\n&quot;;
-	$http_request .= &quot;Content-Length: &quot; . strlen($request) . &quot;\r\n&quot;;
-	$http_request .= 'User-Agent: WordPress/' . $wp_version . '; ' . get_bloginfo('url') . &quot;\r\n&quot;;
-	$http_request .= &quot;\r\n&quot;;
-	$http_request .= $request;
-
-	$response = '';
-	if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) &amp;&amp; is_resource($fs) ) {
-		fwrite($fs, $http_request);
-
-		while ( !feof($fs) )
-			$response .= fgets($fs, 1160); // One TCP-IP packet
-		fclose($fs);
-		$response = explode(&quot;\r\n\r\n&quot;, $response, 2);
-	}
-
-	$response = unserialize( $response[1] );
-
-	if ( $response )
-		$new_option-&gt;response = $response;
-
-	update_option( 'update_plugins', $new_option );
-}
-add_action( 'load-plugins.php', 'wp_update_plugins' );
-
-function wp_plugin_update_row( $file ) {
-	global $plugin_data;
+function wp_plugin_update_row( $file, $plugin_data ) {
 	$current = get_option( 'update_plugins' );
 	if ( !isset( $current-&gt;response[ $file ] ) )
 		return false;
 
 	$r = $current-&gt;response[ $file ];
 
-	echo &quot;&lt;tr&gt;&lt;td colspan='5' class='plugin-update'&gt;&quot;;
-	if ( !current_user_can('edit_plugins') )
+	echo '&lt;tr&gt;&lt;td colspan=&quot;5&quot; class=&quot;plugin-update&quot;&gt;';
+	if ( ! current_user_can('update_plugins') )
 		printf( __('There is a new version of %1$s available. &lt;a href=&quot;%2$s&quot;&gt;Download version %3$s here&lt;/a&gt;.'), $plugin_data['Name'], $r-&gt;url, $r-&gt;new_version);
 	else if ( empty($r-&gt;package) )
 		printf( __('There is a new version of %1$s available. &lt;a href=&quot;%2$s&quot;&gt;Download version %3$s here&lt;/a&gt; &lt;em&gt;automatic upgrade unavailable for this plugin&lt;/em&gt;.'), $plugin_data['Name'], $r-&gt;url, $r-&gt;new_version);
 	else
-		printf( __('There is a new version of %1$s available. &lt;a href=&quot;%2$s&quot;&gt;Download version %3$s here&lt;/a&gt; or &lt;a href=&quot;%4$s&quot;&gt;upgrade automatically&lt;/a&gt;.'), $plugin_data['Name'], $r-&gt;url, $r-&gt;new_version, wp_nonce_url(&quot;update.php?action=upgrade-plugin&amp;amp;plugin=$file&quot;, 'upgrade-plugin_' . $file) );
+		printf( __('There is a new version of %1$s available. &lt;a href=&quot;%2$s&quot;&gt;Download version %3$s here&lt;/a&gt; or &lt;a href=&quot;%4$s&quot;&gt;upgrade automatically&lt;/a&gt;.'), $plugin_data['Name'], $r-&gt;url, $r-&gt;new_version, wp_nonce_url('update.php?action=upgrade-plugin&amp;amp;plugin=' . $file, 'upgrade-plugin_' . $file) );
 	
-	echo &quot;&lt;/td&gt;&lt;/tr&gt;&quot;;
+	echo '&lt;/td&gt;&lt;/tr&gt;';
 }
-add_action( 'after_plugin_row', 'wp_plugin_update_row' );
+add_action( 'after_plugin_row', 'wp_plugin_update_row', 10, 2 );
 
 function wp_update_plugin($plugin, $feedback = '') {
 	global $wp_filesystem;
@@ -150,7 +84,7 @@ function wp_update_plugin($plugin, $feedback = '') {
 		return new WP_Error('up_to_date', __('The plugin is at the latest version.'));
 
 	// Is a filesystem accessor setup?
-	if ( ! $wp_filesystem || !is_object($wp_filesystem) )
+	if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
 		WP_Filesystem();
 
 	if ( ! is_object($wp_filesystem) )
@@ -159,11 +93,18 @@ function wp_update_plugin($plugin, $feedback = '') {
 	if ( $wp_filesystem-&gt;errors-&gt;get_error_code() )
 		return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem-&gt;errors);
 
-	//Get the Base folder
-	$base = $wp_filesystem-&gt;get_base_dir();
+	//Get the base plugin folder
+	$plugins_dir = $wp_filesystem-&gt;wp_plugins_dir();
+	if ( empty($plugins_dir) )
+		return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));
+
+	//And the same for the Content directory.
+	$content_dir = $wp_filesystem-&gt;wp_content_dir();
+	if( empty($content_dir) )
+		return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));
 	
-	if ( empty($base) )
-		return new WP_Error('fs_nowordpress', __('Unable to locate WordPress directory.'));
+	$plugins_dir = trailingslashit( $plugins_dir );
+	$content_dir = trailingslashit( $content_dir );
 
 	// Get the URL to the zip file
 	$r = $current-&gt;response[ $plugin ];
@@ -174,12 +115,12 @@ function wp_update_plugin($plugin, $feedback = '') {
 	// Download the package
 	$package = $r-&gt;package;
 	apply_filters('update_feedback', sprintf(__('Downloading update from %s'), $package));
-	$file = download_url($package);
+	$download_file = download_url($package);
 
-	if ( is_wp_error($file) )
-		return new WP_Error('download_failed', __('Download failed.'), $file-&gt;get_error_message());
+	if ( is_wp_error($download_file) )
+		return new WP_Error('download_failed', __('Download failed.'), $download_file-&gt;get_error_message());
 
-	$working_dir = $base . 'wp-content/upgrade/' . basename($plugin, '.php');
+	$working_dir = $content_dir . 'upgrade/' . basename($plugin, '.php');
 
 	// Clean up working directory
 	if ( $wp_filesystem-&gt;is_dir($working_dir) )
@@ -187,16 +128,16 @@ function wp_update_plugin($plugin, $feedback = '') {
 
 	apply_filters('update_feedback', __('Unpacking the update'));
 	// Unzip package to working directory
-	$result = unzip_file($file, $working_dir);
+	$result = unzip_file($download_file, $working_dir);
+	
+	// Once extracted, delete the package
+	unlink($download_file);
+	
 	if ( is_wp_error($result) ) {
-		unlink($file);
 		$wp_filesystem-&gt;delete($working_dir, true);
 		return $result;
 	}
 
-	// Once extracted, delete the package
-	unlink($file);
-
 	if ( is_plugin_active($plugin) ) {
 		//Deactivate the plugin silently, Prevent deactivation hooks from running.
 		apply_filters('update_feedback', __('Deactivating the plugin'));
@@ -205,25 +146,25 @@ function wp_update_plugin($plugin, $feedback = '') {
 
 	// Remove the existing plugin.
 	apply_filters('update_feedback', __('Removing the old version of the plugin'));
-	$plugin_dir = dirname($base . PLUGINDIR . &quot;/$plugin&quot;);
-	$plugin_dir = trailingslashit($plugin_dir);
+	$this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin) );
 	
 	// If plugin is in its own directory, recursively delete the directory.
-	if ( strpos($plugin, '/') &amp;&amp; $plugin_dir != $base . PLUGINDIR . '/' ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
-		$deleted = $wp_filesystem-&gt;delete($plugin_dir, true);
+	if ( strpos($plugin, '/') &amp;&amp; $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
+		$deleted = $wp_filesystem-&gt;delete($this_plugin_dir, true);
 	else
-		$deleted = $wp_filesystem-&gt;delete($base . PLUGINDIR . &quot;/$plugin&quot;);
+		$deleted = $wp_filesystem-&gt;delete($plugins_dir . $plugin);
 
-	if ( !$deleted ) {
+	if ( ! $deleted ) {
 		$wp_filesystem-&gt;delete($working_dir, true);
 		return new WP_Error('delete_failed', __('Could not remove the old plugin'));
 	}
 
 	apply_filters('update_feedback', __('Installing the latest version'));
 	// Copy new version of plugin into place.
-	if ( !copy_dir($working_dir, $base . PLUGINDIR) ) {
+	$result = copy_dir($working_dir, $plugins_dir);
+	if ( is_wp_error($result) ) {
 		//$wp_filesystem-&gt;delete($working_dir, true); //TODO: Uncomment? This DOES mean that the new files are available in the upgrade folder if it fails.
-		return new WP_Error('install_failed', __('Installation failed'));
+		return $result;
 	}
 
 	//Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
@@ -236,13 +177,13 @@ function wp_update_plugin($plugin, $feedback = '') {
 	delete_option('update_plugins');
 	
 	if( empty($filelist) )
-		return false; //We couldnt find any files in the working dir
+		return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.
 	
 	$folder = $filelist[0];
-	$plugin = get_plugins('/' . $folder); //Pass it with a leading slash, search out the plugins in the folder, 
+	$plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash
 	$pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list
 
-	return  $folder . '/' . $pluginfiles[0]; //Pass it without a leading slash as WP requires
+	return  $folder . '/' . $pluginfiles[0];
 }
 
 ?&gt;</diff>
      <filename>wp-admin/includes/update.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 &lt;?php
 
-if ( file_exists(ABSPATH . 'wp-content/install.php') )
-	require (ABSPATH . 'wp-content/install.php');
+if ( file_exists(WP_CONTENT_DIR . '/install.php') )
+	require (WP_CONTENT_DIR . '/install.php');
 require_once(ABSPATH . 'wp-admin/includes/admin.php');
 require_once(ABSPATH . 'wp-admin/includes/schema.php');
 
@@ -18,12 +18,8 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='
 	update_option('blogname', $blog_title);
 	update_option('admin_email', $user_email);
 	update_option('blog_public', $public);
-	$schema = ( isset($_SERVER['HTTPS']) &amp;&amp; strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
 
-	if ( defined('WP_SITEURL') &amp;&amp; '' != WP_SITEURL )
-		$guessurl = WP_SITEURL;
-	else
-		$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+	$guessurl = wp_guess_url();
 
 	update_option('siteurl', $guessurl);
 
@@ -62,13 +58,13 @@ function wp_install_defaults($user_id) {
 
 	// Default category
 	$cat_name = $wpdb-&gt;escape(__('Uncategorized'));
-	$cat_slug = sanitize_title(__('Uncategorized'));
+	$cat_slug = sanitize_title(_c('Uncategorized|Default category slug'));
 	$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')&quot;);
 	$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('1', 'category', '', '0', '1')&quot;);
 
 	// Default link category
 	$cat_name = $wpdb-&gt;escape(__('Blogroll'));
-	$cat_slug = sanitize_title(__('Blogroll'));
+	$cat_slug = sanitize_title(_c('Blogroll|Default link category slug'));
 	$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')&quot;);
 	$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('2', 'link_category', '', '0', '7')&quot;);
 
@@ -98,7 +94,7 @@ function wp_install_defaults($user_id) {
 	$now = date('Y-m-d H:i:s');
 	$now_gmt = gmdate('Y-m-d H:i:s');
 	$first_post_guid = get_option('home') . '/?p=1';
-	$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, comment_count, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '&quot;.$wpdb-&gt;escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!')).&quot;', '', '&quot;.$wpdb-&gt;escape(__('Hello world!')).&quot;', '0', '&quot;.$wpdb-&gt;escape(__('hello-world')).&quot;', '$now', '$now_gmt', '$first_post_guid', '1', '', '', '')&quot;);
+	$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, comment_count, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '&quot;.$wpdb-&gt;escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!')).&quot;', '', '&quot;.$wpdb-&gt;escape(__('Hello world!')).&quot;', '0', '&quot;.$wpdb-&gt;escape(_c('hello-world|Default post slug')).&quot;', '$now', '$now_gmt', '$first_post_guid', '1', '', '', '')&quot;);
 	$wpdb-&gt;query( &quot;INSERT INTO $wpdb-&gt;term_relationships (`object_id`, `term_taxonomy_id`) VALUES (1, 1)&quot; );
 
 	// Default comment
@@ -106,7 +102,7 @@ function wp_install_defaults($user_id) {
 
 	// First Page
 	$first_post_guid = get_option('home') . '/?page_id=2';
-	$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '&quot;.$wpdb-&gt;escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.')).&quot;', '', '&quot;.$wpdb-&gt;escape(__('About')).&quot;', '0', '&quot;.$wpdb-&gt;escape(__('about')).&quot;', '$now', '$now_gmt','$first_post_guid', 'publish', 'page', '', '', '')&quot;);
+	$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '&quot;.$wpdb-&gt;escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.')).&quot;', '', '&quot;.$wpdb-&gt;escape(__('About')).&quot;', '0', '&quot;.$wpdb-&gt;escape(_c('about|Default page slug')).&quot;', '$now', '$now_gmt','$first_post_guid', 'publish', 'page', '', '', '')&quot;);
 }
 endif;
 
@@ -202,6 +198,15 @@ function upgrade_all() {
 	if ( $wp_current_db_version &lt; 7499 )
 		upgrade_250();
 
+	if ( $wp_current_db_version &lt; 7796 )
+		upgrade_251();
+
+	if ( $wp_current_db_version &lt; 7935 )
+		upgrade_252();
+
+	if ( $wp_current_db_version &lt; 8201 )
+		upgrade_260();
+
 	maybe_disable_automattic_widgets();
 
 	$wp_rewrite-&gt;flush_rules();
@@ -218,7 +223,7 @@ function upgrade_100() {
 		foreach($posts as $post) {
 			if ('' == $post-&gt;post_name) {
 				$newtitle = sanitize_title($post-&gt;post_title);
-				$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;posts SET post_name = '$newtitle' WHERE ID = '$post-&gt;ID'&quot;);
+				$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET post_name = %s WHERE ID = %d&quot;, $newtitle, $post-&gt;ID) );
 			}
 		}
 	}
@@ -227,7 +232,7 @@ function upgrade_100() {
 	foreach ($categories as $category) {
 		if ('' == $category-&gt;category_nicename) {
 			$newtitle = sanitize_title($category-&gt;cat_name);
-			$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category-&gt;cat_ID'&quot;);
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;categories SET category_nicename = %s WHERE cat_ID = %d&quot;, $newtitle, $category-&gt;cat_ID) );
 		}
 	}
 
@@ -250,14 +255,12 @@ function upgrade_100() {
 	if ($allposts) :
 		foreach ($allposts as $post) {
 			// Check to see if it's already been imported
-			$cat = $wpdb-&gt;get_row(&quot;SELECT * FROM $wpdb-&gt;post2cat WHERE post_id = $post-&gt;ID AND category_id = $post-&gt;post_category&quot;);
+			$cat = $wpdb-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;post2cat WHERE post_id = %d AND category_id = %d&quot;, $post-&gt;ID, $post-&gt;post_category) );
 			if (!$cat &amp;&amp; 0 != $post-&gt;post_category) { // If there's no result
-				$wpdb-&gt;query(&quot;
-					INSERT INTO $wpdb-&gt;post2cat
+				$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;post2cat
 					(post_id, category_id)
-					VALUES
-					('$post-&gt;ID', '$post-&gt;post_category')
-					&quot;);
+					VALUES (%s, %s)
+					&quot;, $post-&gt;ID, $post-&gt;post_category) );
 			}
 		}
 	endif;
@@ -285,7 +288,7 @@ function upgrade_110() {
 	foreach ($users as $user) {
 		if ('' == $user-&gt;user_nicename) {
 			$newname = sanitize_title($user-&gt;user_nickname);
-			$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;users SET user_nicename = '$newname' WHERE ID = '$user-&gt;ID'&quot;);
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;users SET user_nicename = %s WHERE ID = %d&quot;, $newname, $user-&gt;ID) );
 		}
 	}
 
@@ -401,7 +404,7 @@ function upgrade_130() {
 	foreach ( $options as $option ) {
 		if ( 1 != $option-&gt;dupes ) { // Could this be done in the query?
 			$limit = $option-&gt;dupes - 1;
-			$dupe_ids = $wpdb-&gt;get_col(&quot;SELECT option_id FROM $wpdb-&gt;options WHERE option_name = '$option-&gt;option_name' LIMIT $limit&quot;);
+			$dupe_ids = $wpdb-&gt;get_col( $wpdb-&gt;prepare(&quot;SELECT option_id FROM $wpdb-&gt;options WHERE option_name = %s LIMIT %d&quot;, $option-&gt;option_name, $limit) );
 			$dupe_ids = join($dupe_ids, ',');
 			$wpdb-&gt;query(&quot;DELETE FROM $wpdb-&gt;options WHERE option_id IN ($dupe_ids)&quot;);
 		}
@@ -445,8 +448,7 @@ function upgrade_160() {
 			if ($idmode == 'namefl') $id = $user-&gt;user_firstname.' '.$user-&gt;user_lastname;
 			if ($idmode == 'namelf') $id = $user-&gt;user_lastname.' '.$user-&gt;user_firstname;
 			if (!$idmode) $id = $user-&gt;user_nickname;
-			$id = $wpdb-&gt;escape( $id );
-			$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;users SET display_name = '$id' WHERE ID = '$user-&gt;ID'&quot;);
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;users SET display_name = %s WHERE ID = %d&quot;, $id, $user-&gt;ID) );
 		endif;
 
 		// FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
@@ -468,7 +470,7 @@ function upgrade_160() {
 	$comments = $wpdb-&gt;get_results( &quot;SELECT comment_post_ID, COUNT(*) as c FROM $wpdb-&gt;comments WHERE comment_approved = '1' GROUP BY comment_post_ID&quot; );
 	if( is_array( $comments ) ) {
 		foreach ($comments as $comment) {
-			$wpdb-&gt;query( &quot;UPDATE $wpdb-&gt;posts SET comment_count = $comment-&gt;c WHERE ID = '$comment-&gt;comment_post_ID'&quot; );
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET comment_count = %d WHERE ID = %d&quot;, $comment-&gt;c, $comment-&gt;comment_post_ID) );
 		}
 	}
 
@@ -477,10 +479,10 @@ function upgrade_160() {
 	if ( $wp_current_db_version &gt; 2541 &amp;&amp; $wp_current_db_version &lt;= 3091 ) {
 		$objects = $wpdb-&gt;get_results(&quot;SELECT ID, post_type FROM $wpdb-&gt;posts WHERE post_status = 'object'&quot;);
 		foreach ($objects as $object) {
-			$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;posts SET post_status = 'attachment',
-			post_mime_type = '$object-&gt;post_type',
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET post_status = 'attachment',
+			post_mime_type = %s,
 			post_type = ''
-			WHERE ID = $object-&gt;ID&quot;);
+			WHERE ID = %d&quot;, $object-&gt;post_type, $object-&gt;ID) );
 
 			$meta = get_post_meta($object-&gt;ID, 'imagedata', true);
 			if ( ! empty($meta['file']) )
@@ -508,7 +510,7 @@ function upgrade_210() {
 				$type = 'attachment';
 			}
 
-			$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post-&gt;ID'&quot;);
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET post_status = %s, post_type = %s WHERE ID = %d&quot;, $status, $type, $post-&gt;ID) );
 		}
 	}
 
@@ -541,45 +543,46 @@ function upgrade_230() {
 	$categories = $wpdb-&gt;get_results(&quot;SELECT * FROM $wpdb-&gt;categories ORDER BY cat_ID&quot;);
 	foreach ($categories as $category) {
 		$term_id = (int) $category-&gt;cat_ID;
-		$name = $wpdb-&gt;escape($category-&gt;cat_name);
-		$description = $wpdb-&gt;escape($category-&gt;category_description);
-		$slug = $wpdb-&gt;escape($category-&gt;category_nicename);
-		$parent = $wpdb-&gt;escape($category-&gt;category_parent);
+		$name = $category-&gt;cat_name;
+		$description = $category-&gt;category_description;
+		$slug = $category-&gt;category_nicename;
+		$parent = $category-&gt;category_parent;
 		$term_group = 0;
 
 		// Associate terms with the same slug in a term group and make slugs unique.
-		if ( $exists = $wpdb-&gt;get_results(&quot;SELECT term_id, term_group FROM $wpdb-&gt;terms WHERE slug = '$slug'&quot;) ) {
+		if ( $exists = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT term_id, term_group FROM $wpdb-&gt;terms WHERE slug = %s&quot;, $slug) ) ) {
 			$term_group = $exists[0]-&gt;term_group;
 			$id = $exists[0]-&gt;term_id;
 			$num = 2;
 			do {
 				$alt_slug = $slug . &quot;-$num&quot;;
 				$num++;
-				$slug_check = $wpdb-&gt;get_var(&quot;SELECT slug FROM $wpdb-&gt;terms WHERE slug = '$alt_slug'&quot;);
+				$slug_check = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT slug FROM $wpdb-&gt;terms WHERE slug = %s&quot;, $alt_slug) );
 			} while ( $slug_check );
 
 			$slug = $alt_slug;
 
 			if ( empty( $term_group ) ) {
 				$term_group = $wpdb-&gt;get_var(&quot;SELECT MAX(term_group) FROM $wpdb-&gt;terms GROUP BY term_group&quot;) + 1;
-				$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;terms SET term_group = '$term_group' WHERE term_id = '$id'&quot;);
+				$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;terms SET term_group = %d WHERE term_id = %d&quot;, $term_group, $id) );
 			}
 		}
 
-		$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;terms (term_id, name, slug, term_group) VALUES ('$term_id', '$name', '$slug', '$term_group')&quot;);
+		$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;terms (term_id, name, slug, term_group) VALUES 
+		(%d, %s, %s, %d)&quot;, $term_id, $name, $slug, $term_group) );
 
 		$count = 0;
 		if ( !empty($category-&gt;category_count) ) {
 			$count = (int) $category-&gt;category_count;
 			$taxonomy = 'category';
-			$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')&quot;);
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)&quot;, $term_id, $taxonomy, $description, $parent, $count) );
 			$tt_ids[$term_id][$taxonomy] = (int) $wpdb-&gt;insert_id;
 		}
 
 		if ( !empty($category-&gt;link_count) ) {
 			$count = (int) $category-&gt;link_count;
 			$taxonomy = 'link_category';
-			$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')&quot;);
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)&quot;, $term_id, $taxonomy, $description, $parent, $count) );
 			$tt_ids[$term_id][$taxonomy] = (int) $wpdb-&gt;insert_id;
 		}
 
@@ -587,14 +590,14 @@ function upgrade_230() {
 			$have_tags = true;
 			$count = (int) $category-&gt;tag_count;
 			$taxonomy = 'post_tag';
-			$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')&quot;);
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)&quot;, $term_id, $taxonomy, $description, $parent, $count) );
 			$tt_ids[$term_id][$taxonomy] = (int) $wpdb-&gt;insert_id;
 		}
 
 		if ( empty($count) ) {
 			$count = 0;
 			$taxonomy = 'category';
-			$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')&quot;);
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)&quot;, $term_id, $taxonomy, $description, $parent, $count) );
 			$tt_ids[$term_id][$taxonomy] = (int) $wpdb-&gt;insert_id;
 		}
 	}
@@ -614,7 +617,7 @@ function upgrade_230() {
 		if ( empty($tt_id) )
 			continue;
 
-		$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_relationships (object_id, term_taxonomy_id) VALUES ('$post_id', '$tt_id')&quot;);
+		$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)&quot;, $post_id, $tt_id) );
 	}
 
 	// &lt; 3570 we used linkcategories.  &gt;= 3570 we used categories and link2cat.
@@ -633,20 +636,20 @@ function upgrade_230() {
 			$term_group = 0;
 
 			// Associate terms with the same slug in a term group and make slugs unique.
-			if ( $exists = $wpdb-&gt;get_results(&quot;SELECT term_id, term_group FROM $wpdb-&gt;terms WHERE slug = '$slug'&quot;) ) {
+			if ( $exists = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT term_id, term_group FROM $wpdb-&gt;terms WHERE slug = %s&quot;, $slug) ) ) {
 				$term_group = $exists[0]-&gt;term_group;
 				$term_id = $exists[0]-&gt;term_id;
 			}
 
 			if ( empty($term_id) ) {
-				$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;terms (name, slug, term_group) VALUES ('$name', '$slug', '$term_group')&quot;);
+				$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;terms (name, slug, term_group) VALUES (%s, %s, %d)&quot;, $name, $slug, $term_group) );
 				$term_id = (int) $wpdb-&gt;insert_id;
 			}
 
 			$link_cat_id_map[$cat_id] = $term_id;
 			$default_link_cat = $term_id;
 
-			$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', 'link_category', '', '0', '0')&quot;);
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;term_taxonomy (term_id, taxonomy, description, parent, count) VALUES (%d, 'link_category', '', '0', '0')&quot;, $term_id) );
 			$tt_ids[$term_id] = (int) $wpdb-&gt;insert_id;
 		}
 
@@ -662,7 +665,7 @@ function upgrade_230() {
 			if ( empty($tt_id) )
 				continue;
 
-			$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_relationships (object_id, term_taxonomy_id) VALUES ('$link-&gt;link_id', '$tt_id')&quot;);
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)&quot;, $link-&gt;link_id, $tt_id) );
 		}
 
 		// Set default to the last category we grabbed during the upgrade loop.
@@ -677,7 +680,7 @@ function upgrade_230() {
 			if ( empty($tt_id) )
 				continue;
 
-			$wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;term_relationships (object_id, term_taxonomy_id) VALUES ('$link_id', '$tt_id')&quot;);
+			$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)&quot;, $link_id, $tt_id) );
 		}
 	}
 
@@ -690,10 +693,10 @@ function upgrade_230() {
 	$terms = $wpdb-&gt;get_results(&quot;SELECT term_taxonomy_id, taxonomy FROM $wpdb-&gt;term_taxonomy&quot;);
 	foreach ( (array) $terms as $term ) {
 		if ( ('post_tag' == $term-&gt;taxonomy) || ('category' == $term-&gt;taxonomy) )
-			$count = $wpdb-&gt;get_var(&quot;SELECT COUNT(*) FROM $wpdb-&gt;term_relationships, $wpdb-&gt;posts WHERE $wpdb-&gt;posts.ID = $wpdb-&gt;term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = '$term-&gt;term_taxonomy_id'&quot;);
+			$count = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT COUNT(*) FROM $wpdb-&gt;term_relationships, $wpdb-&gt;posts WHERE $wpdb-&gt;posts.ID = $wpdb-&gt;term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d&quot;, $term-&gt;term_taxonomy_id) );
 		else
-			$count = $wpdb-&gt;get_var(&quot;SELECT COUNT(*) FROM $wpdb-&gt;term_relationships WHERE term_taxonomy_id = '$term-&gt;term_taxonomy_id'&quot;);
-		$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;term_taxonomy SET count = '$count' WHERE term_taxonomy_id = '$term-&gt;term_taxonomy_id'&quot;);
+			$count = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT COUNT(*) FROM $wpdb-&gt;term_relationships WHERE term_taxonomy_id = %d&quot;, $term-&gt;term_taxonomy_id) );
+		$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;term_taxonomy SET count = %d WHERE term_taxonomy_id = %d&quot;, $count, $term-&gt;term_taxonomy_id) );
 	}
 }
 
@@ -729,6 +732,29 @@ function upgrade_250() {
 	
 }
 
+function upgrade_251() {
+	global $wp_current_db_version;
+
+	// Make the secret longer
+	update_option('secret', wp_generate_password(64));
+}
+
+function upgrade_252() {
+	global $wpdb;
+
+	$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;users SET user_activation_key = ''&quot;);
+}
+
+function upgrade_260() {
+	if ( $wp_current_db_version &lt; 8000 )
+		populate_roles_260();
+
+	if ( $wp_current_db_version &lt; 8201 ) {
+		update_option('enable_app', 1);
+		update_option('enable_xmlrpc', 1);
+	}
+}
+
 // The functions we use to actually do stuff
 
 // General
@@ -823,7 +849,7 @@ function __get_option($setting) {
 		return preg_replace( '|/+$|', '', constant( 'WP_SITEURL' ) );
 	}
 
-	$option = $wpdb-&gt;get_var(&quot;SELECT option_value FROM $wpdb-&gt;options WHERE option_name = '$setting'&quot;);
+	$option = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT option_value FROM $wpdb-&gt;options WHERE option_name = %s&quot;, $setting) );
 
 	if ( 'home' == $setting &amp;&amp; '' == $option )
 		return __get_option('siteurl');
@@ -858,7 +884,7 @@ function deslash($content) {
 function dbDelta($queries, $execute = true) {
 	global $wpdb;
 
-	// Seperate individual queries into an array
+	// Separate individual queries into an array
 	if( !is_array($queries) ) {
 		$queries = explode( ';', $queries );
 		if('' == $queries[count($queries) - 1]) array_pop($queries);
@@ -1073,7 +1099,7 @@ function make_db_current_silent() {
 
 function make_site_theme_from_oldschool($theme_name, $template) {
 	$home_path = get_home_path();
-	$site_dir = ABSPATH . &quot;wp-content/themes/$template&quot;;
+	$site_dir = WP_CONTENT_DIR . &quot;/themes/$template&quot;;
 
 	if (! file_exists(&quot;$home_path/index.php&quot;))
 		return false;
@@ -1092,7 +1118,7 @@ function make_site_theme_from_oldschool($theme_name, $template) {
 		if ($oldfile == 'index.php') { // Check to make sure it's not a new index
 			$index = implode('', file(&quot;$oldpath/$oldfile&quot;));
 			if (strpos($index, 'WP_USE_THEMES') !== false) {
-				if (! @copy(ABSPATH . 'wp-content/themes/default/index.php', &quot;$site_dir/$newfile&quot;))
+				if (! @copy(WP_CONTENT_DIR . '/themes/default/index.php', &quot;$site_dir/$newfile&quot;))
 					return false;
 				continue; // Don't copy anything
 				}
@@ -1140,8 +1166,8 @@ function make_site_theme_from_oldschool($theme_name, $template) {
 }
 
 function make_site_theme_from_default($theme_name, $template) {
-	$site_dir = ABSPATH . &quot;wp-content/themes/$template&quot;;
-	$default_dir = ABSPATH . 'wp-content/themes/default';
+	$site_dir = WP_CONTENT_DIR . &quot;/themes/$template&quot;;
+	$default_dir = WP_CONTENT_DIR . '/themes/default';
 
 	// Copy files from the default theme to the site theme.
 	//$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');
@@ -1198,7 +1224,7 @@ function make_site_theme() {
 	// Name the theme after the blog.
 	$theme_name = __get_option('blogname');
 	$template = sanitize_title($theme_name);
-	$site_dir = ABSPATH . &quot;wp-content/themes/$template&quot;;
+	$site_dir = WP_CONTENT_DIR . &quot;/themes/$template&quot;;
 
 	// If the theme already exists, nothing to do.
 	if ( is_dir($site_dir)) {
@@ -1206,7 +1232,7 @@ function make_site_theme() {
 	}
 
 	// We must be able to write to the themes dir.
-	if (! is_writable(ABSPATH . &quot;wp-content/themes&quot;)) {
+	if (! is_writable(WP_CONTENT_DIR . &quot;/themes&quot;)) {
 		return false;
 	}
 </diff>
      <filename>wp-admin/includes/upgrade.php</filename>
    </modified>
    <modified>
      <diff>@@ -141,10 +141,7 @@ function edit_user( $user_id = 0 ) {
 function get_author_user_ids() {
 	global $wpdb;
 	$level_key = $wpdb-&gt;prefix . 'user_level';
-
-	$query = &quot;SELECT user_id FROM $wpdb-&gt;usermeta WHERE meta_key = '$level_key' AND meta_value != '0'&quot;;
-
-	return $wpdb-&gt;get_col( $query );
+	return $wpdb-&gt;get_col( $wpdb-&gt;prepare(&quot;SELECT user_id FROM $wpdb-&gt;usermeta WHERE meta_key = %s AND meta_value != '0'&quot;, $level_key) );
 }
 
 function get_editable_authors( $user_id ) {
@@ -176,7 +173,7 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
 
 	$level_key = $wpdb-&gt;prefix . 'user_level';
 
-	$query = &quot;SELECT user_id FROM $wpdb-&gt;usermeta WHERE meta_key = '$level_key'&quot;;
+	$query = $wpdb-&gt;prepare(&quot;SELECT user_id FROM $wpdb-&gt;usermeta WHERE meta_key = %s&quot;, $level_key);
 	if ( $exclude_zeros )
 		$query .= &quot; AND meta_value != '0'&quot;;
 
@@ -187,9 +184,7 @@ function get_nonauthor_user_ids() {
 	global $wpdb;
 	$level_key = $wpdb-&gt;prefix . 'user_level';
 
-	$query = &quot;SELECT user_id FROM $wpdb-&gt;usermeta WHERE meta_key = '$level_key' AND meta_value = '0'&quot;;
-
-	return $wpdb-&gt;get_col( $query );
+	return $wpdb-&gt;get_col( $wpdb-&gt;prepare(&quot;SELECT user_id FROM $wpdb-&gt;usermeta WHERE meta_key = %s AND meta_value = '0'&quot;, $level_key) );
 }
 
 function get_others_unpublished_posts($user_id, $type='any') {
@@ -208,7 +203,7 @@ function get_others_unpublished_posts($user_id, $type='any') {
 		$other_unpubs = '';
 	} else {
 		$editable = join(',', $editable);
-		$other_unpubs = $wpdb-&gt;get_results(&quot;SELECT ID, post_title, post_author FROM $wpdb-&gt;posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != '$user_id' ORDER BY post_modified $dir&quot;);
+		$other_unpubs = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT ID, post_title, post_author FROM $wpdb-&gt;posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir&quot;, $user_id) );
 	}
 
 	return apply_filters('get_others_drafts', $other_unpubs);
@@ -241,8 +236,7 @@ function get_user_to_edit( $user_id ) {
 
 function get_users_drafts( $user_id ) {
 	global $wpdb;
-	$user_id = (int) $user_id;
-	$query = &quot;SELECT ID, post_title FROM $wpdb-&gt;posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = $user_id ORDER BY post_modified DESC&quot;;
+	$query = $wpdb-&gt;prepare(&quot;SELECT ID, post_title FROM $wpdb-&gt;posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC&quot;, $user_id);
 	$query = apply_filters('get_users_drafts', $query);
 	return $wpdb-&gt;get_results( $query );
 }
@@ -253,7 +247,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
 	$id = (int) $id;
 
 	if ($reassign == 'novalue') {
-		$post_ids = $wpdb-&gt;get_col(&quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_author = $id&quot;);
+		$post_ids = $wpdb-&gt;get_col( $wpdb-&gt;prepare(&quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_author = %d&quot;, $id) );
 
 		if ($post_ids) {
 			foreach ($post_ids as $post_id)
@@ -261,18 +255,18 @@ function wp_delete_user($id, $reassign = 'novalue') {
 		}
 
 		// Clean links
-		$wpdb-&gt;query(&quot;DELETE FROM $wpdb-&gt;links WHERE link_owner = $id&quot;);
+		$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;links WHERE link_owner = %d&quot;, $id) );
 	} else {
 		$reassign = (int) $reassign;
-		$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;posts SET post_author = {$reassign} WHERE post_author = {$id}&quot;);
-		$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;links SET link_owner = {$reassign} WHERE link_owner = {$id}&quot;);
+		$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET post_author = %d WHERE post_author = %d&quot;, $reassign, $id) );
+		$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;links SET link_owner = %d WHERE link_owner = %d&quot;, $reassign, $id) );
 	}
 
 	// FINALLY, delete user
 	do_action('delete_user', $id);
 
-	$wpdb-&gt;query(&quot;DELETE FROM $wpdb-&gt;users WHERE ID = $id&quot;);
-	$wpdb-&gt;query(&quot;DELETE FROM $wpdb-&gt;usermeta WHERE user_id = '$id'&quot;);
+	$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;users WHERE ID = %d&quot;, $id) );
+	$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;usermeta WHERE user_id = %d&quot;, $id) );
 
 	wp_cache_delete($id, 'users');
 	wp_cache_delete($user-&gt;user_login, 'userlogins');
@@ -323,7 +317,7 @@ class WP_User_Search {
 	function prepare_query() {
 		global $wpdb;
 		$this-&gt;first_user = ($this-&gt;page - 1) * $this-&gt;users_per_page;
-		$this-&gt;query_limit = ' LIMIT ' . $this-&gt;first_user . ',' . $this-&gt;users_per_page;
+		$this-&gt;query_limit = $wpdb-&gt;prepare(&quot; LIMIT %d, %d&quot;, $this-&gt;first_user, $this-&gt;users_per_page);
 		$this-&gt;query_sort = ' ORDER BY user_login';
 		$search_sql = '';
 		if ( $this-&gt;search_term ) {
@@ -337,7 +331,7 @@ class WP_User_Search {
 
 		$this-&gt;query_from_where = &quot;FROM $wpdb-&gt;users&quot;;
 		if ( $this-&gt;role )
-			$this-&gt;query_from_where .= &quot; INNER JOIN $wpdb-&gt;usermeta ON $wpdb-&gt;users.ID = $wpdb-&gt;usermeta.user_id WHERE $wpdb-&gt;usermeta.meta_key = '{$wpdb-&gt;prefix}capabilities' AND $wpdb-&gt;usermeta.meta_value LIKE '%$this-&gt;role%'&quot;;
+			$this-&gt;query_from_where .= $wpdb-&gt;prepare(&quot; INNER JOIN $wpdb-&gt;usermeta ON $wpdb-&gt;users.ID = $wpdb-&gt;usermeta.user_id WHERE $wpdb-&gt;usermeta.meta_key = '{$wpdb-&gt;prefix}capabilities' AND $wpdb-&gt;usermeta.meta_value LIKE %s&quot;, '%' . $this-&gt;role . '%');
 		else
 			$this-&gt;query_from_where .= &quot; WHERE 1=1&quot;;
 		$this-&gt;query_from_where .= &quot; $search_sql&quot;;
@@ -360,12 +354,18 @@ class WP_User_Search {
 
 	function do_paging() {
 		if ( $this-&gt;total_users_for_query &gt; $this-&gt;users_per_page ) { // have to page the results
+			$args = array();
+			if( ! empty($this-&gt;search_term) )
+				$args['usersearch'] = urlencode($this-&gt;search_term);
+			if( ! empty($this-&gt;role) )
+				$args['role'] = urlencode($this-&gt;role);
+
 			$this-&gt;paging_text = paginate_links( array(
 				'total' =&gt; ceil($this-&gt;total_users_for_query / $this-&gt;users_per_page),
 				'current' =&gt; $this-&gt;page,
 				'base' =&gt; 'users.php?%_%',
 				'format' =&gt; 'userspage=%#%',
-				'add_args' =&gt; array( 'usersearch' =&gt; urlencode($this-&gt;search_term) )
+				'add_args' =&gt; $args
 			) );
 		}
 	}
@@ -392,4 +392,4 @@ class WP_User_Search {
 }
 endif;
 
-?&gt;
\ No newline at end of file
+?&gt;</diff>
      <filename>wp-admin/includes/user.php</filename>
    </modified>
    <modified>
      <diff>@@ -21,7 +21,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
 		$no_widgets_shown = true;
 		$already_shown = array();
 		foreach ( $wp_registered_widgets as $name =&gt; $widget ) :
-			if ( in_array( $widget['callback'], $already_shown ) ) // We already showed this multi-widget
+			if ( 'all' == $show &amp;&amp; in_array( $widget['callback'], $already_shown ) ) // We already showed this multi-widget
 				continue;
 
 			if ( $search_terms ) {
@@ -47,7 +47,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
 				continue;
 
 			ob_start();
-				$args = wp_list_widget_controls_dynamic_sidebar( array( 0 =&gt; array( 'widget_id' =&gt; $widget['id'], 'widget_name' =&gt; $widget['name'], '_display' =&gt; 'template' ) ) );
+				$args = wp_list_widget_controls_dynamic_sidebar( array( 0 =&gt; array( 'widget_id' =&gt; $widget['id'], 'widget_name' =&gt; $widget['name'], '_display' =&gt; 'template', '_show' =&gt; $show ), 1 =&gt; $widget['params'][0] ) );
 				$sidebar_args = call_user_func_array( 'wp_widget_control', $args );
 			$widget_control_template = ob_get_contents();
 			ob_end_clean();
@@ -61,10 +61,10 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
 					'key' =&gt; false,
 					'edit' =&gt; false
 				);
-				if ( $is_multi ) {
+				if ( 'all' == $show &amp;&amp; $is_multi ) {
 					// it's a multi-widget.  We only need to show it in the list once.
 					$already_shown[] = $widget['callback'];
-					$num = (int) array_pop( explode( '-', $widget['id'] ) );
+					$num = (int) array_pop( $ids = explode( '-', $widget['id'] ) );
 					$id_base = $wp_registered_widget_controls[$widget['id']]['id_base'];
 					// so that we always add a new one when clicking &quot;add&quot;
 					while ( isset($wp_registered_widgets[&quot;$id_base-$num&quot;]) )
@@ -76,7 +76,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
 				}
 				$add_query['add'] = $widget['id'];
 				$action = 'add';
-				$add_url = wp_nonce_url( add_query_arg( $add_query ), &quot;add-widget_$widget[id]&quot; );
+				$add_url = clean_url( wp_nonce_url( add_query_arg( $add_query ), &quot;add-widget_$widget[id]&quot; ) );
 			} else {
 				$action = 'edit';
 				$edit_url = clean_url( add_query_arg( array(
@@ -92,12 +92,17 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
 
 			$no_widgets_shown = false;
 
+
+			if ( 'all' != $show &amp;&amp; $sidebar_args['_widget_title'] )
+				$widget_title = $sidebar_args['_widget_title'];
+			else
+				$widget_title = $widget['name'];
 		?&gt;
 
 		&lt;li id=&quot;widget-list-item-&lt;?php echo attribute_escape( $widget['id'] ); ?&gt;&quot; class=&quot;widget-list-item&quot;&gt;
 			&lt;h4 class=&quot;widget-title widget-draggable&quot;&gt;
 
-				&lt;?php echo wp_specialchars( $widget['name'] ); ?&gt;
+				&lt;span&gt;&lt;?php echo $widget_title; ?&gt;&lt;/span&gt;
 
 				&lt;?php if ( 'add' == $action ) : ?&gt;
 
@@ -111,6 +116,8 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
 
 				&lt;?php endif; ?&gt;
 
+				&lt;br class=&quot;clear&quot; /&gt;
+
 			&lt;/h4&gt;
 
 
@@ -192,7 +199,7 @@ function wp_widget_control( $sidebar_args ) {
 
 	$id_format = $widget['id'];
 	// We aren't showing a widget control, we're outputing a template for a mult-widget control
-	if ( 'template' == $sidebar_args['_display'] &amp;&amp; isset($control['params'][0]['number']) ) {
+	if ( 'all' == $sidebar_args['_show'] &amp;&amp; 'template' == $sidebar_args['_display'] &amp;&amp; isset($control['params'][0]['number']) ) {
 		// number == -1 implies a template where id numbers are replaced by a generic '%i%'
 		$control['params'][0]['number'] = -1;
 		// if given, id_base means widget id's should be constructed like {$id_base}-{$id_number}
@@ -202,7 +209,7 @@ function wp_widget_control( $sidebar_args ) {
 
 	$widget_title = '';
 	// We grab the normal widget output to find the widget's title
-	if ( is_callable( $widget['_callback'] ) ) {
+	if ( ( 'all' != $sidebar_args['_show'] || 'template' != $sidebar_args['_display'] ) &amp;&amp; is_callable( $widget['_callback'] ) ) {
 		ob_start();
 		$args = func_get_args();
 		call_user_func_array( $widget['_callback'], $args );
@@ -212,19 +219,22 @@ function wp_widget_control( $sidebar_args ) {
 	$wp_registered_widgets[$widget_id]['callback'] = $wp_registered_widgets[$widget_id]['_callback'];
 	unset($wp_registered_widgets[$widget_id]['_callback']);
 
-	if ( $widget_title &amp;&amp; $widget_title != $control['name'] )
+	if ( $widget_title &amp;&amp; $widget_title != $sidebar_args['widget_name'] )
 		$widget_title = sprintf( _c('%1$s: %2$s|1: widget name, 2: widget title' ), $sidebar_args['widget_name'], $widget_title );
 	else
 		$widget_title = wp_specialchars( strip_tags( $sidebar_args['widget_name'] ) );
 
+	$sidebar_args['_widget_title'] = $widget_title;
+
 	if ( empty($sidebar_args['_display']) || 'template' != $sidebar_args['_display'] )
 		echo $sidebar_args['before_widget'];
 ?&gt;
-		&lt;h4 class=&quot;widget-title&quot;&gt;&lt;?php echo $widget_title ?&gt;
+		&lt;div class=&quot;widget-top&quot;&gt;
+		&lt;h4 class=&quot;widget-title&quot;&gt;&lt;span&gt;&lt;?php echo $widget_title ?&gt;&lt;/span&gt;
 
 			&lt;?php if ( $edit ) : ?&gt;
 
-			&lt;a class=&quot;widget-action widget-control-edit&quot; href=&quot;&lt;?php echo remove_query_arg( array( 'edit', 'key' ) ); ?&gt;&quot;&gt;&lt;?php _e('Cancel'); ?&gt;&lt;/a&gt;
+			&lt;a class=&quot;widget-action widget-control-edit&quot; href=&quot;&lt;?php echo clean_url( remove_query_arg( array( 'edit', 'key' ) ) ); ?&gt;&quot;&gt;&lt;?php _e('Cancel'); ?&gt;&lt;/a&gt;
 
 			&lt;?php else : ?&gt;
 
@@ -232,7 +242,9 @@ function wp_widget_control( $sidebar_args ) {
 
 			&lt;?php endif; ?&gt;
 
-		&lt;/h4&gt;
+			&lt;br class=&quot;clear&quot; /&gt;
+
+		&lt;/h4&gt;&lt;/div&gt;
 
 		&lt;div class=&quot;widget-control&quot;&lt;?php if ( $edit ) echo ' style=&quot;display: block;&quot;'; ?&gt;&gt;
 
@@ -270,13 +282,8 @@ function wp_widget_control_ob_filter( $string ) {
 	if ( false === $end = strpos( $string, '%END_OF_TITLE%' ) )
 		return '';
 	$string = substr( $string, $beg + 14 , $end - $beg - 14);
-	return wp_specialchars( strip_tags( $string ) );
+	$string = str_replace( '&amp;nbsp;', ' ', $string );
+	return trim( wp_specialchars( strip_tags( $string ) ) );
 }
 
-function widget_css() {
-	wp_admin_css( 'css/widgets' );
-}
-
-add_action( 'admin_head', 'widget_css' );
-
 ?&gt;</diff>
      <filename>wp-admin/includes/widgets.php</filename>
    </modified>
    <modified>
      <diff>@@ -9,23 +9,25 @@ wp_dashboard_setup();
 function index_js() {
 ?&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;
-	jQuery(function() {
-		jQuery('#dashboard_incoming_links div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=incominglinks');
-		jQuery('#dashboard_primary div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=devnews');
-		jQuery('#dashboard_secondary div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=planetnews');
-		jQuery('#dashboard_plugins div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=plugins');
-	});
+jQuery(function($) {
+	var ajaxWidgets = {
+		dashboard_incoming_links: 'incominglinks',
+		dashboard_primary: 'devnews',
+		dashboard_secondary: 'planetnews',
+		dashboard_plugins: 'plugins'
+	};
+	$.each( ajaxWidgets, function(i,a) {
+		var e = jQuery('#' + i + ' div.dashboard-widget-content').not('.dashboard-widget-control').find('.widget-loading');
+		if ( e.size() ) { e.parent().load('index-extra.php?jax=' + a); }
+	} );
+});
 &lt;/script&gt;
 &lt;?php
 }
 add_action( 'admin_head', 'index_js' );
 
-function index_css() {
-	wp_admin_css( 'css/dashboard' );
-}
-add_action( 'admin_head', 'index_css' );
-
 wp_enqueue_script( 'jquery' );
+wp_admin_css( 'dashboard' );
 
 $title = __('Dashboard');
 $parent_file = 'index.php';
@@ -58,6 +60,8 @@ $num_cats  = wp_count_terms('category');
 
 $num_tags = wp_count_terms('post_tag');
 
+$num_comm = get_comment_count( );
+
 $post_type_texts = array();
 
 if ( !empty($num_posts-&gt;publish) ) { // with feeds, anyone can tell how many posts there are.  Just unlink if !current_user_can
@@ -87,30 +91,42 @@ if ( current_user_can( 'manage_categories' ) ) {
 	$tags_text = &quot;&lt;a href='edit-tags.php'&gt;$tags_text&lt;/a&gt;&quot;;
 }
 
+$total_comments = sprintf( __ngettext( '%1$s total', '%1$s total', $num_comm['total_comments'] ), number_format_i18n($num_comm['total_comments']) );
+$approved_comments = sprintf( __ngettext( '%1$s approved', '%1$s approved', $num_comm['approved'] ), number_format_i18n($num_comm['approved']) );
+$spam_comments = sprintf( __ngettext( '%1$s spam', '%1$s spam', $num_comm['spam'] ), number_format_i18n($num_comm['spam']) );
+$moderated_comments = sprintf( __ngettext( '%1$s awaiting moderation', '%1$s awaiting moderation', $num_comm['awaiting_moderation'] ), number_format_i18n($num_comm['awaiting_moderation']) );
+
+if( current_user_can( 'moderate_comments' ) ) {
+	$total_comments = &quot;&lt;a href='edit-comments.php'&gt;{$total_comments}&lt;/a&gt;&quot;;
+	$approved_comments = &quot;&lt;a href='edit-comments.php?comment_status=approved'&gt;{$approved_comments}&lt;/a&gt;&quot;;
+	$moderated_comments = &quot;&lt;a href='edit-comments.php?comment_status=moderated'&gt;{$moderated_comments}&lt;/a&gt;&quot;;
+}
+
+$comm_text = sprintf( __ngettext( 'You have %1$s comment, %2$s, %3$s and %4$s.', 'You have %1$s comments, %2$s, %3$s and %4$s.', $num_comm['total_comments'] ), $total_comments, $approved_comments, $spam_comments, $moderated_comments );
+
 $post_type_text = implode(', ', $post_type_texts);
 
 // There is always a category
-$sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s' ), $post_type_text, $cats_text, $tags_text, $pending_text );
-$sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text );
+$sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s %5$s' ), $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text );
+$sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text );
 
 ?&gt;
 &lt;p class=&quot;youhave&quot;&gt;&lt;?php echo $sentence; ?&gt;&lt;/p&gt;
 &lt;?php
 $ct = current_theme_info();
 $sidebars_widgets = wp_get_sidebars_widgets();
-$num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ) );
+$num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ), 0 );
 $widgets_text = sprintf( __ngettext( '%d widget', '%d widgets', $num_widgets ), $num_widgets );
 if ( $can_switch_themes = current_user_can( 'switch_themes' ) )
 	$widgets_text = &quot;&lt;a href='widgets.php'&gt;$widgets_text&lt;/a&gt;&quot;;
 ?&gt;
 &lt;p class=&quot;youare&quot;&gt;
-	&lt;?php printf( __( 'You are using %1$s theme with %2$s.' ), $ct-&gt;title, $widgets_text ); ?&gt;
+	&lt;?php printf( __( 'You are using the %1$s theme with %2$s.' ), $ct-&gt;title, $widgets_text ); ?&gt;
 	&lt;?php if ( $can_switch_themes ) : ?&gt;
 		&lt;a href=&quot;themes.php&quot; class=&quot;rbutton&quot;&gt;&lt;?php _e('Change Theme'); ?&gt;&lt;/a&gt;
 	&lt;?php endif; ?&gt;
 	&lt;?php update_right_now_message(); ?&gt;
 &lt;/p&gt;
-
 &lt;?php do_action( 'rightnow_end' ); ?&gt;
 &lt;?php do_action( 'activity_box_end' ); ?&gt;
 &lt;/div&gt;&lt;!-- rightnow --&gt;</diff>
      <filename>wp-admin/index.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 &lt;?php
-require_once(dirname(dirname(__FILE__)).'/wp-config.php');
+$wp_only_load_config = true;
+require_once(dirname(dirname(__FILE__)).'/wp-load.php');
 $debug = 0;
 
 /**
@@ -8,6 +9,7 @@ $debug = 0;
  ** Returns:  true if already exists or on successful completion
  **           false on error
  */
+if ( ! function_exists('maybe_create_table') ) :
 function maybe_create_table($table_name, $create_ddl) {
 	global $wpdb;
 	foreach ($wpdb-&gt;get_col(&quot;SHOW TABLES&quot;,0) as $table ) {
@@ -25,6 +27,7 @@ function maybe_create_table($table_name, $create_ddl) {
 	}
 	return false;
 }
+endif;
 
 /**
  ** maybe_add_column()
@@ -32,6 +35,7 @@ function maybe_create_table($table_name, $create_ddl) {
  ** Returns:  true if already exists or on successful completion
  **           false on error
  */
+if ( ! function_exists('maybe_add_column') ) :
 function maybe_add_column($table_name, $column_name, $create_ddl) {
 	global $wpdb, $debug;
 	foreach ($wpdb-&gt;get_col(&quot;DESC $table_name&quot;,0) as $column ) {
@@ -50,7 +54,7 @@ function maybe_add_column($table_name, $column_name, $create_ddl) {
 	}
 	return false;
 }
-
+endif;
 
 /**
  ** maybe_drop_column()</diff>
      <filename>wp-admin/install-helper.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,7 @@
 &lt;?php
 define('WP_INSTALLING', true);
-if (!file_exists('../wp-config.php')) {
-  require_once('../wp-includes/compat.php');
-  require_once('../wp-includes/functions.php');
-  wp_die(&quot;There doesn't seem to be a &lt;code&gt;wp-config.php&lt;/code&gt; file. I need this before we can get started. Need more help? &lt;a href='http://codex.wordpress.org/Editing_wp-config.php'&gt;We got it&lt;/a&gt;. You can create a &lt;code&gt;wp-config.php&lt;/code&gt; file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.&lt;/p&gt;&lt;p&gt;&lt;a href='setup-config.php' class='button'&gt;Create a Configuration File&lt;/a&gt;&quot;, &quot;WordPress &amp;rsaquo; Error&quot;);
-}
 
-require_once('../wp-config.php');
+require_once('../wp-load.php');
 require_once('./includes/upgrade.php');
 
 if (isset($_GET['step']))
@@ -21,7 +16,7 @@ header( 'Content-Type: text/html; charset=utf-8' );
 &lt;head&gt;
 	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
 	&lt;title&gt;&lt;?php _e('WordPress &amp;rsaquo; Installation'); ?&gt;&lt;/title&gt;
-	&lt;?php wp_admin_css( 'css/install' ); ?&gt;
+	&lt;?php wp_admin_css( 'install', true ); ?&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;h1 id=&quot;logo&quot;&gt;&lt;img alt=&quot;WordPress&quot; src=&quot;images/wordpress-logo.png&quot; /&gt;&lt;/h1&gt;
@@ -59,7 +54,7 @@ switch($step) {
 			&lt;td colspan=&quot;2&quot;&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;blog_public&quot; value=&quot;1&quot; checked=&quot;checked&quot; /&gt; &lt;?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?&gt;&lt;/label&gt;&lt;/td&gt;
 		&lt;/tr&gt;
 	&lt;/table&gt;
-	&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;&lt;?php _e('Install WordPress'); ?&gt;&quot; class=&quot;button&quot; /&gt;
+	&lt;p class=&quot;step&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;&lt;?php _e('Install WordPress'); ?&gt;&quot; class=&quot;button&quot; /&gt;&lt;/p&gt;
 &lt;/form&gt;
 
 &lt;?php
@@ -103,7 +98,7 @@ switch($step) {
 	&lt;/tr&gt;
 &lt;/table&gt;
 
-&lt;p&gt;&lt;a href=&quot;../wp-login.php&quot; class=&quot;button&quot;&gt;&lt;?php _e('Log In'); ?&gt;&lt;/a&gt;
+&lt;p class=&quot;step&quot;&gt;&lt;a href=&quot;../wp-login.php&quot; class=&quot;button&quot;&gt;&lt;?php _e('Log In'); ?&gt;&lt;/a&gt;&lt;/p&gt;
 
 &lt;?php
 		break;</diff>
      <filename>wp-admin/install.php</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,7 @@ wpEditorInit = function() {
 switchEditors = {
 
     saveCallback : function(el, content, body) {
-    
+
         document.getElementById(el).style.color = '#fff';
         if ( tinyMCE.activeEditor.isHidden() ) 
             content = document.getElementById(el).value;
@@ -26,8 +26,14 @@ switchEditors = {
     pre_wpautop : function(content) {
         // We have a TON of cleanup to do. Line breaks are already stripped.
 
+        // Protect pre|script tags
+        content = content.replace(/&lt;(pre|script)[^&gt;]*&gt;[\s\S]+?&lt;\/\1&gt;/g, function(a) {
+            a = a.replace(/&lt;br ?\/?&gt;[\r\n]*/g, '&lt;wp_temp&gt;');
+            return a.replace(/&lt;\/?p( [^&gt;]*)?&gt;[\r\n]*/g, '&lt;wp_temp&gt;');
+        });
+
         // Pretty it up for the source editor
-        var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|pre|p';
+        var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p';
         content = content.replace(new RegExp('\\s*&lt;/('+blocklist1+')&gt;\\s*', 'mg'), '&lt;/$1&gt;\n');
         content = content.replace(new RegExp('\\s*&lt;(('+blocklist1+')[^&gt;]*)&gt;', 'mg'), '\n&lt;$1&gt;');
 
@@ -46,7 +52,9 @@ switchEditors = {
         // Fix some block element newline issues
         content = content.replace(new RegExp('\\s*&lt;div', 'mg'), '\n&lt;div');
         content = content.replace(new RegExp('&lt;/div&gt;\\s*', 'mg'), '&lt;/div&gt;\n');
-        
+		content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n');
+		content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption');
+
         var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
         content = content.replace(new RegExp('\\s*&lt;(('+blocklist2+') ?[^&gt;]*)\\s*&gt;', 'mg'), '\n&lt;$1&gt;');
         content = content.replace(new RegExp('\\s*&lt;/('+blocklist2+')&gt;\\s*', 'mg'), '&lt;/$1&gt;\n');
@@ -63,7 +71,10 @@ switchEditors = {
 
         // Trim whitespace
         content = content.replace(new RegExp('^\\s*', ''), '');
-        content = content.replace(new RegExp('\\s*$', ''), '');
+        content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), '');
+
+        // put back the line breaks in pre|script
+        content = content.replace(/&lt;wp_temp&gt;/g, '\n');
 
         // Hope.
         return content;
@@ -109,7 +120,7 @@ switchEditors = {
 				ec.style.padding = '6px';
             }
 
-			ta.style.color = '';
+            ta.style.color = '';
             this.wpSetDefaultEditor('html');
         }
     },
@@ -148,15 +159,22 @@ switchEditors = {
         pee = pee.replace(new RegExp('&lt;p&gt;\\s*?&lt;/p&gt;', 'gi'), '');
         pee = pee.replace(new RegExp('&lt;p&gt;\\s*(&lt;/?(?:'+blocklist+')[^&gt;]*&gt;)\\s*&lt;/p&gt;', 'gi'), &quot;$1&quot;);
         pee = pee.replace(new RegExp(&quot;&lt;p&gt;(&lt;li.+?)&lt;/p&gt;&quot;, 'gi'), &quot;$1&quot;);
-        pee = pee.replace(new RegExp('&lt;p&gt;&lt;blockquote([^&gt;]*)&gt;', 'gi'), &quot;&lt;blockquote$1&gt;&lt;p&gt;&quot;);
-        pee = pee.replace(new RegExp('&lt;/blockquote&gt;&lt;/p&gt;', 'gi'), '&lt;/p&gt;&lt;/blockquote&gt;');
+        pee = pee.replace(new RegExp('&lt;p&gt;\\s*&lt;blockquote([^&gt;]*)&gt;', 'gi'), &quot;&lt;blockquote$1&gt;&lt;p&gt;&quot;);
+        pee = pee.replace(new RegExp('&lt;/blockquote&gt;\\s*&lt;/p&gt;', 'gi'), '&lt;/p&gt;&lt;/blockquote&gt;');
         pee = pee.replace(new RegExp('&lt;p&gt;\\s*(&lt;/?(?:'+blocklist+')[^&gt;]*&gt;)', 'gi'), &quot;$1&quot;);
         pee = pee.replace(new RegExp('(&lt;/?(?:'+blocklist+')[^&gt;]*&gt;)\\s*&lt;/p&gt;', 'gi'), &quot;$1&quot;);
         pee = pee.replace(new RegExp('\\s*\\n', 'gi'), &quot;&lt;br /&gt;\n&quot;);
         pee = pee.replace(new RegExp('(&lt;/?(?:'+blocklist+')[^&gt;]*&gt;)\\s*&lt;br /&gt;', 'gi'), &quot;$1&quot;);
         pee = pee.replace(new RegExp('&lt;br /&gt;(\\s*&lt;/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)&gt;)', 'gi'), '$1');
-        pee = pee.replace(new RegExp('^((?:&amp;nbsp;)*)\\s', 'mg'), '$1&amp;nbsp;');
-        //pee = pee.replace(new RegExp('(&lt;pre.*?&gt;)(.*?)&lt;/pre&gt;!ise', &quot; stripslashes('$1') .  stripslashes(clean_pre('$2'))  . '&lt;/pre&gt;' &quot;); // Hmm...
-        return pee;
+        pee = pee.replace(new RegExp('(?:&lt;p&gt;|&lt;br ?/?&gt;)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:&lt;/p&gt;|&lt;br ?/?&gt;)*', 'gi'), '[caption$1[/caption]');
+        // pee = pee.replace(new RegExp('^((?:&amp;nbsp;)*)\\s', 'mg'), '$1&amp;nbsp;');
+
+        // Fix the pre|script tags	   
+        pee = pee.replace(/&lt;(pre|script)[^&gt;]*&gt;[\s\S]+?&lt;\/\1&gt;/g, function(a) {
+			a = a.replace(/&lt;br ?\/?&gt;[\r\n]*/g, '\n');
+			return a.replace(/&lt;\/?p( [^&gt;]*)?&gt;[\r\n]*/g, '\n');
+        });
+
+	    return pee;
     }
 }</diff>
      <filename>wp-admin/js/editor.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,31 +1,26 @@
-function checkAll(form) {
-	for (i = 0, n = form.elements.length; i &lt; n; i++) {
-		if(form.elements[i].type == &quot;checkbox&quot; &amp;&amp; !(form.elements[i].getAttribute('onclick',2))) {
-			if(form.elements[i].checked == true)
-				form.elements[i].checked = false;
-			else
-				form.elements[i].checked = true;
-		}
-	}
+function checkAll(jQ) { // use attr( checked, fn )
+	jQuery(jQ).find( 'tbody:visible :checkbox' ).attr( 'checked', function() {
+		return jQuery(this).attr( 'checked' ) ? '' : 'checked';
+	} );
 }
 
-function getNumChecked(form) {
-	var num = 0;
-	for (i = 0, n = form.elements.length; i &lt; n; i++) {
-		if (form.elements[i].type == &quot;checkbox&quot;) {
-			if (form.elements[i].checked == true)
-				num++;
+jQuery( function($) {
+	var lastClicked = false;
+	$( 'tbody :checkbox' ).click( function(e) {
+		if ( 'undefined' == e.shiftKey ) { return true; }
+		if ( e.shiftKey ) {
+			if ( !lastClicked ) { return true; }
+			var checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
+			var first = checks.index( lastClicked );
+			var last = checks.index( this );
+			if ( 0 &lt; first &amp;&amp; 0 &lt; last &amp;&amp; first != last ) {
+				checks.slice( first, last ).attr( 'checked', $( this ).is( ':checked' ) ? 'checked' : '' );
+			}
 		}
-	}
-	return num;
-}
-
-function checkAllUsers(role) {
- var checkboxs = document.getElementsByTagName('input');
- for(var i = 0, inp; inp = checkboxs[i]; i++)
- 	if(inp.type.toLowerCase() == 'checkbox' &amp;&amp; inp.className == role)
-		if(inp.checked == false)
-			inp.checked = true;
-		else
-			inp.checked = false;
-}
\ No newline at end of file
+		lastClicked = this;
+		return true;
+	} );
+	$( 'thead :checkbox' ).click( function() {
+		checkAll( $(this).parents( 'form:first' ) );
+	} );
+} );
\ No newline at end of file</diff>
      <filename>wp-admin/js/forms.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,7 @@
 jQuery(document).ready( function() {
+	// close postboxes that should be closed
+	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
+
 	jQuery('#link_name').focus();
 	// postboxes
 	add_postbox_toggles('link');</diff>
      <filename>wp-admin/js/link.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,53 @@
 // send html to the post editor
 function send_to_editor(h) {
-	var win = window.opener ? window.opener : window.dialogArguments;
-	if ( !win )
-		win = top;
-	tinyMCE = win.tinyMCE;
-	if ( typeof tinyMCE != 'undefined' &amp;&amp; ( ed = tinyMCE.getInstanceById('content') ) &amp;&amp; !ed.isHidden() ) {
-		tinyMCE.selectedInstance.getWin().focus();
-		tinyMCE.execCommand('mceInsertContent', false, h);
+	if ( typeof tinyMCE != 'undefined' &amp;&amp; ( ed = tinyMCE.activeEditor ) &amp;&amp; !ed.isHidden() ) {
+		ed.focus();
+		if (tinymce.isIE)
+			ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
+
+		if ( h.indexOf('[caption') != -1 )
+			h = ed.plugins.wpeditimage._do_shcode(h);
+		
+		ed.execCommand('mceInsertContent', false, h);
 	} else
-		win.edInsertContent(win.edCanvas, h);
-}
\ No newline at end of file
+		edInsertContent(edCanvas, h);
+
+	tb_remove();
+}
+
+// thickbox settings
+jQuery(function($) {
+	tb_position = function() {
+		var tbWindow = $('#TB_window');
+		var width = $(window).width();
+		var H = $(window).height();
+		var W = ( 720 &lt; width ) ? 720 : width;
+
+		if ( tbWindow.size() ) {
+			tbWindow.width( W - 50 ).height( H - 45 );
+			$('#TB_iframeContent').width( W - 50 ).height( H - 75 );
+			tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
+			if ( typeof document.body.style.maxWidth != 'undefined' )
+				tbWindow.css({'top':'20px','margin-top':'0'});
+			$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
+		};
+
+		return $('a.thickbox').each( function() {
+			var href = $(this).attr('href');
+			if ( ! href ) return;
+			href = href.replace(/&amp;width=[0-9]+/g, '');
+			href = href.replace(/&amp;height=[0-9]+/g, '');
+			$(this).attr( 'href', href + '&amp;width=' + ( W - 80 ) + '&amp;height=' + ( H - 85 ) );
+		});
+	};
+	
+	jQuery('a.thickbox').click(function(){
+		if ( typeof tinyMCE != 'undefined' &amp;&amp;  tinyMCE.activeEditor ) {
+			tinyMCE.get('content').focus();
+			tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple');
+		}
+	});
+
+	$(window).resize( function() { tb_position() } );
+});
+</diff>
      <filename>wp-admin/js/media-upload.js</filename>
    </modified>
    <modified>
      <diff>@@ -18,6 +18,8 @@ function new_tag_remove_tag() {
 }
 
 function tag_update_quickclicks() {
+	if ( jQuery( '#tags-input' ).length == 0 )
+		return;
 	var current_tags = jQuery( '#tags-input' ).val().split(',');
 	jQuery( '#tagchecklist' ).empty();
 	shown = false;
@@ -96,7 +98,7 @@ jQuery(document).ready( function() {
 	jQuery('#title').blur( function() { if ( (jQuery(&quot;#post_ID&quot;).val() &gt; 0) || (jQuery(&quot;#title&quot;).val().length == 0) ) return; autosave(); } );
 
 	// auto-suggest stuff
-	jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2 } );
+	jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: &quot;, &quot; } );
 	jQuery('#newtag').keypress( tag_press_key );
 
 	// category tabs
@@ -118,6 +120,11 @@ jQuery(document).ready( function() {
 		jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
 		noSyncChecks = false;
 	};
+	var popularCats = jQuery('#categorychecklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(',');
+	var catAddBefore = function( s ) {
+		s.data += '&amp;popular_ids=' + popularCats + '&amp;' + jQuery( '#categorychecklist :checked' ).serialize();
+		return s;
+	};
 	var catAddAfter = function( r, s ) {
 		if ( !newCatParent ) newCatParent = jQuery('#newcat_parent');
 		if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' );
@@ -127,7 +134,7 @@ jQuery(document).ready( function() {
 				var th = jQuery(this);
 				var val = th.find('input').val();
 				var id = th.find('input')[0].id
-				jQuery('#' + id).change( syncChecks );
+				jQuery('#' + id).change( syncChecks ).change();
 				if ( newCatParent.find( 'option[value=' + val + ']' ).size() )
 					return;
 				var name = jQuery.trim( th.text() );
@@ -140,15 +147,17 @@ jQuery(document).ready( function() {
 	jQuery('#categorychecklist').wpList( {
 		alt: '',
 		response: 'category-ajax-response',
+		addBefore: catAddBefore,
 		addAfter: catAddAfter
 	} );
 	jQuery('#category-add-toggle').click( function() {
 		jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' );
-		categoryTabs.tabsClick( 1 );
+		// categoryTabs.tabs( 'select', '#categories-all' ); // this is broken (in the UI beta?)
+		categoryTabs.find( 'a[href=&quot;#categories-all&quot;]' ).click();
 		jQuery('#newcat').focus();
 		return false;
 	} );
-	jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
+	jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change();
 
 	jQuery('.edit-timestamp').click(function () {
 		if (jQuery('#timestampdiv').is(&quot;:hidden&quot;)) {
@@ -172,5 +181,9 @@ jQuery(document).ready( function() {
 		if ( jQuery.isFunction( autosave_update_post_ID ) ) {
 			autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
 		}
-	} });
+	}, addBefore: function( s ) {
+		s.data += '&amp;post_id=' + jQuery('#post_ID').val();
+		return s;
+	}
+	});
 });</diff>
      <filename>wp-admin/js/post.js</filename>
    </modified>
    <modified>
      <diff>@@ -11,29 +11,29 @@ jQuery(function($) {
 		var widgetAnim = $.browser.msie ? function() {
 			var t = $(this);
 			if ( t.is(':visible') ) {
-				if ( disableFields ) { t.find( ':enabled' ).not( '[name=&quot;widget-id[]&quot;], [name*=&quot;[submit]&quot;]' ).attr( 'disabled', 'disabled' ); }
+				if ( disableFields ) { t.find( ':input:enabled' ).not( '[name=&quot;widget-id[]&quot;], [name*=&quot;[submit]&quot;]' ).attr( 'disabled', 'disabled' ); }
 				li.css( 'marginLeft', 0 );
-				t.siblings('h4').children('a').text( widgetsL10n.edit );
+				t.siblings('div').children('h4').children('a').text( widgetsL10n.edit );
 			} else {
 				t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open
 				if ( width &gt; 250 )
 					li.css( 'marginLeft', ( width - 250 ) * -1 );
-				t.siblings('h4').children('a').text( widgetsL10n.cancel );
+				t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel );
 			}
 			t.toggle();
 		} : function() {
 			var t = $(this);
 
 			if ( t.is(':visible') ) {
-				if ( disableFields ) { t.find( ':enabled' ).not( '[name=&quot;widget-id[]&quot;], [name*=&quot;[submit]&quot;]' ).attr( 'disabled', 'disabled' ); }
+				if ( disableFields ) { t.find( ':input:enabled' ).not( '[name=&quot;widget-id[]&quot;], [name*=&quot;[submit]&quot;]' ).attr( 'disabled', 'disabled' ); }
 				if ( width &gt; 250 )
 					li.animate( { marginLeft: 0 } );
-				t.siblings('h4').children('a').text( widgetsL10n.edit );
+				t.siblings('div').children('h4').children('a').text( widgetsL10n.edit );
 			} else {
 				t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open
 				if ( width &gt; 250 )
 					li.animate( { marginLeft: ( width - 250 ) * -1 } );
-				t.siblings('h4').children('a').text( widgetsL10n.cancel );
+				t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel );
 			}
 			t.animate( { height: 'toggle' } );
 		};</diff>
      <filename>wp-admin/js/widgets.js</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,6 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
 
 wp_enqueue_script('link');
 wp_enqueue_script('xfn');
-wp_enqueue_script('thickbox');
 
 require('admin-header.php');
 ?&gt;</diff>
      <filename>wp-admin/link-add.php</filename>
    </modified>
    <modified>
      <diff>@@ -28,12 +28,13 @@ case 'delete':
 		wp_die(__('Cheatin&amp;#8217; uh?'));
 
 	$cat_name = get_term_field('name', $cat_ID, 'link_category');
+	$default_cat_id = get_option('default_link_category');
 
 	// Don't delete the default cats.
-    if ( $cat_ID == get_option('default_link_category') )
+    if ( $cat_ID == $default_cat_id )
 		wp_die(sprintf(__(&quot;Can&amp;#8217;t delete the &lt;strong&gt;%s&lt;/strong&gt; category: this is the default one&quot;), $cat_name));
 
-	wp_delete_term($cat_ID, 'link_category');
+	wp_delete_term($cat_ID, 'link_category', array('default' =&gt; $default_cat_id));
 
 	$location = 'edit-link-categories.php';
 	if ( $referer = wp_get_original_referer() ) {
@@ -73,7 +74,9 @@ case 'editedcat':
 			$location = $referer;
 	}
 
-	if ( wp_update_term($cat_ID, 'link_category', $_POST) )
+	$update =  wp_update_term($cat_ID, 'link_category', $_POST);
+
+	if ( $update &amp;&amp; !is_wp_error($update) )
 		$location = add_query_arg('message', 3, $location);
 	else
 		$location = add_query_arg('message', 5, $location);</diff>
      <filename>wp-admin/link-category.php</filename>
    </modified>
    <modified>
      <diff>@@ -30,19 +30,19 @@ switch ($step) {
 &lt;input type=&quot;hidden&quot; name=&quot;step&quot; value=&quot;1&quot; /&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;MAX_FILE_SIZE&quot; value=&quot;30000&quot; /&gt;
 &lt;div style=&quot;width: 48%;&quot; class=&quot;alignleft&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Specify an OPML URL:'); ?&gt;&lt;/h3&gt;
-&lt;input type=&quot;text&quot; name=&quot;opml_url&quot; size=&quot;50&quot; style=&quot;width: 90%;&quot; value=&quot;http://&quot; /&gt;
+&lt;h3&gt;&lt;label for=&quot;opml_url&quot;&gt;&lt;?php _e('Specify an OPML URL:'); ?&gt;&lt;/label&gt;&lt;/h3&gt;
+&lt;input type=&quot;text&quot; name=&quot;opml_url&quot; id=&quot;opml_url&quot; size=&quot;50&quot; style=&quot;width: 90%;&quot; value=&quot;http://&quot; /&gt;
 &lt;/div&gt;
 
 &lt;div style=&quot;width: 48%;&quot; class=&quot;alignleft&quot;&gt;
-&lt;h3&gt;&lt;?php _e('Or choose from your local disk:'); ?&gt;&lt;/h3&gt;
+&lt;h3&gt;&lt;label for=&quot;userfile&quot;&gt;&lt;?php _e('Or choose from your local disk:'); ?&gt;&lt;/label&gt;&lt;/h3&gt;
 &lt;input id=&quot;userfile&quot; name=&quot;userfile&quot; type=&quot;file&quot; size=&quot;30&quot; /&gt;
 &lt;/div&gt;
 
 &lt;/div&gt;
 
-&lt;p style=&quot;clear: both; margin-top: 1em;&quot;&gt;&lt;?php _e('Now select a category you want to put these links in.') ?&gt;&lt;br /&gt;
-&lt;?php _e('Category:') ?&gt; &lt;select name=&quot;cat_id&quot;&gt;
+&lt;p style=&quot;clear: both; margin-top: 1em;&quot;&gt;&lt;label for=&quot;cat_id&quot;&gt;&lt;?php _e('Now select a category you want to put these links in.') ?&gt;&lt;/label&gt;&lt;br /&gt;
+&lt;?php _e('Category:') ?&gt; &lt;select name=&quot;cat_id&quot; id=&quot;cat_id&quot;&gt;
 &lt;?php
 $categories = get_terms('link_category', 'get=all');
 foreach ($categories as $category) {</diff>
      <filename>wp-admin/link-import.php</filename>
    </modified>
    <modified>
      <diff>@@ -78,6 +78,7 @@ if ( isset($_GET['deleted']) ) {
 &lt;h2&gt;&lt;?php printf( __( 'Manage Links (&lt;a href=&quot;%s&quot;&gt;add new&lt;/a&gt;)' ), 'link-add.php' ); ?&gt;&lt;/h2&gt;
 
 &lt;p id=&quot;post-search&quot;&gt;
+	&lt;label class=&quot;hidden&quot; for=&quot;post-search-input&quot;&gt;&lt;?php _e( 'Search Links' ); ?&gt;:&lt;/label&gt;
 	&lt;input type=&quot;text&quot; id=&quot;post-search-input&quot; name=&quot;s&quot; value=&quot;&lt;?php echo attribute_escape(stripslashes($_GET['s'])); ?&gt;&quot; /&gt;
 	&lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e( 'Search Links' ); ?&gt;&quot; class=&quot;button&quot; /&gt;
 &lt;/p&gt;
@@ -141,7 +142,7 @@ if ( $links ) {
 &lt;table class=&quot;widefat&quot;&gt;
 	&lt;thead&gt;
 	&lt;tr&gt;
-	&lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; onclick=&quot;checkAll(document.getElementById('posts-filter'));&quot; /&gt;&lt;/th&gt;
+	&lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/th&gt;
 &lt;?php foreach($link_columns as $column_display_name) {
 	echo $column_display_name;
 } ?&gt;</diff>
      <filename>wp-admin/link-manager.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 &lt;?php
-require_once('../wp-config.php');
+require_once('../wp-load.php');
 
 // columns we wish to find are:  link_url, link_name, link_target, link_description
 // we need to map XML attribute names to our columns</diff>
      <filename>wp-admin/link-parse-opml.php</filename>
    </modified>
    <modified>
      <diff>@@ -85,7 +85,6 @@ switch ($action) {
 	case 'edit' :
 		wp_enqueue_script('link');
 		wp_enqueue_script('xfn');
-		wp_enqueue_script('thickbox');
 
 		$parent_file = 'edit.php';
 		$submenu_file = 'link-manager.php';</diff>
      <filename>wp-admin/link.php</filename>
    </modified>
    <modified>
      <diff>@@ -9,8 +9,20 @@ wp_reset_vars(array('action'));
 
 switch( $action ) :
 case 'editattachment' :
-	$errors = media_upload_form_handler();
 	$attachment_id = (int) $_POST['attachment_id'];
+	check_admin_referer('media-form');
+
+	if ( !current_user_can('edit_post', $attachment_id) )
+		wp_die ( __('You are not allowed to edit this attachment.') );
+
+	$errors = media_upload_form_handler();
+
+
+	check_admin_referer('media-form');
+
+	if ( !current_user_can('edit_post', $attachment_id) )
+		wp_die ( __('You are not allowed to edit this attachment.') );
+
 	if ( empty($errors) ) {
 		$location = 'media.php';
 		if ( $referer = wp_get_original_referer() ) {
@@ -39,12 +51,17 @@ case 'edit' :
 		exit();
 	}
 	$att_id = (int) $_GET['attachment_id'];
+
+	if ( !current_user_can('edit_post', $att_id) )
+		wp_die ( __('You are not allowed to edit this attachment.') );
+
 	$att = get_post($att_id);
 
 	add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
 
 	wp_enqueue_script( 'wp-ajax-response' );
-	add_action('admin_head', 'media_admin_css');
+	wp_admin_css( 'media' );
+
 
 	require( 'admin-header.php' );
 
@@ -82,7 +99,7 @@ case 'edit' :
 &lt;?php wp_original_referer_field(true, 'previous'); ?&gt;
 &lt;?php wp_nonce_field('media-form'); ?&gt;
 &lt;/p&gt;
-
+&lt;/form&gt;
 
 &lt;/div&gt;
 </diff>
      <filename>wp-admin/media.php</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,8 @@
 $self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
 $self = preg_replace('|^.*/plugins/|i', '', $self);
 
+global $menu, $submenu, $parent_file; //For when admin-header is included from within a function.
+
 get_admin_page_parent();
 
 // We're going to do this loop three times
@@ -19,13 +21,13 @@ foreach ( $menu as $key =&gt; $item ) {
 	if ( !empty($submenu[$item[2]]) ) {
 		$submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
 		$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
-		if ( file_exists(ABSPATH . PLUGINDIR . &quot;/{$submenu[$item[2]][0][2]}&quot;) || !empty($menu_hook))
+		if ( file_exists(WP_PLUGIN_DIR . &quot;/{$submenu[$item[2]][0][2]}&quot;) || !empty($menu_hook))
 			echo &quot;\n\t&lt;li&gt;&lt;a href='admin.php?page={$submenu[$item[2]][0][2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
 		else
 			echo &quot;\n\t&lt;li&gt;&lt;a href='{$submenu[$item[2]][0][2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
 	} else if ( current_user_can($item[1]) ) {
 		$menu_hook = get_plugin_page_hook($item[2], 'admin.php');
-		if ( file_exists(ABSPATH . PLUGINDIR . &quot;/{$item[2]}&quot;) || !empty($menu_hook) )
+		if ( file_exists(WP_PLUGIN_DIR . &quot;/{$item[2]}&quot;) || !empty($menu_hook) )
 			echo &quot;\n\t&lt;li&gt;&lt;a href='admin.php?page={$item[2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
 		else
 			echo &quot;\n\t&lt;li&gt;&lt;a href='{$item[2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
@@ -49,13 +51,13 @@ foreach ( $menu as $key =&gt; $item ) {
 	if ( !empty($submenu[$item[2]]) ) {
 		$submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
 		$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
-		if ( file_exists(ABSPATH . PLUGINDIR . &quot;/{$submenu[$item[2]][0][2]}&quot;) || !empty($menu_hook))
+		if ( file_exists(WP_PLUGIN_DIR . &quot;/{$submenu[$item[2]][0][2]}&quot;) || !empty($menu_hook))
 			echo &quot;\n\t&lt;li&gt;&lt;a href='admin.php?page={$submenu[$item[2]][0][2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
 		else
 			echo &quot;\n\t&lt;li&gt;&lt;a href='{$submenu[$item[2]][0][2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
 	} else if ( current_user_can($item[1]) ) {
 		$menu_hook = get_plugin_page_hook($item[2], 'admin.php');
-		if ( file_exists(ABSPATH . PLUGINDIR . &quot;/{$item[2]}&quot;) || !empty($menu_hook) )
+		if ( file_exists(WP_PLUGIN_DIR . &quot;/{$item[2]}&quot;) || !empty($menu_hook) )
 			echo &quot;\n\t&lt;li&gt;&lt;a href='admin.php?page={$item[2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
 		else
 			echo &quot;\n\t&lt;li&gt;&lt;a href='{$item[2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
@@ -74,13 +76,13 @@ foreach ( $menu as $key =&gt; $item ) {
 	if ( !empty($submenu[$item[2]]) ) {
 		$submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
 		$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
-		if ( file_exists(ABSPATH . PLUGINDIR . &quot;/{$submenu[$item[2]][0][2]}&quot;) || !empty($menu_hook))
+		if ( file_exists(WP_PLUGIN_DIR . &quot;/{$submenu[$item[2]][0][2]}&quot;) || !empty($menu_hook))
 			echo &quot;\n\t&lt;li&gt;&lt;a href='admin.php?page={$submenu[$item[2]][0][2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
 		else
 			echo &quot;\n\t&lt;li&gt;&lt;a href='{$submenu[$item[2]][0][2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
 	} else if ( current_user_can($item[1]) ) {
 		$menu_hook = get_plugin_page_hook($item[2], 'admin.php');
-		if ( file_exists(ABSPATH . PLUGINDIR . &quot;/{$item[2]}&quot;) || !empty($menu_hook) )
+		if ( file_exists(WP_PLUGIN_DIR . &quot;/{$item[2]}&quot;) || !empty($menu_hook) )
 			echo &quot;\n\t&lt;li&gt;&lt;a href='admin.php?page={$item[2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
 		else
 			echo &quot;\n\t&lt;li&gt;&lt;a href='{$item[2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
@@ -106,13 +108,13 @@ foreach ( $menu as $key =&gt; $item ) {
 	if ( !empty($submenu[$item[2]]) ) {
 		$submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
 		$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
-		if ( file_exists(ABSPATH . PLUGINDIR . &quot;/{$submenu[$item[2]][0][2]}&quot;) || !empty($menu_hook))
+		if ( file_exists(WP_PLUGIN_DIR . &quot;/{$submenu[$item[2]][0][2]}&quot;) || !empty($menu_hook))
 			$side_items[] = &quot;\n\t&lt;li&gt;&lt;a href='admin.php?page={$submenu[$item[2]][0][2]}'$class&gt;{$item[0]}&lt;/a&gt;&quot;;
 		else
 			$side_items[] = &quot;\n\t&lt;li&gt;&lt;a href='{$submenu[$item[2]][0][2]}'$class&gt;{$item[0]}&lt;/a&gt;&quot;;
 	} else if ( current_user_can($item[1]) ) {
 		$menu_hook = get_plugin_page_hook($item[2], 'admin.php');
-		if ( file_exists(ABSPATH . PLUGINDIR . &quot;/{$item[2]}&quot;) || !empty($menu_hook) )
+		if ( file_exists(WP_PLUGIN_DIR . &quot;/{$item[2]}&quot;) || !empty($menu_hook) )
 			$side_items[] = &quot;\n\t&lt;li&gt;&lt;a href='admin.php?page={$item[2]}'$class&gt;{$item[0]}&lt;/a&gt;&quot;;
 		else
 			$side_items[] = &quot;\n\t&lt;li&gt;&lt;a href='{$item[2]}'$class&gt;{$item[0]}&lt;/a&gt;&quot;;
@@ -143,7 +145,7 @@ else $class = '';
 
 $menu_hook = get_plugin_page_hook($item[2], $parent_file);
 
-if (file_exists(ABSPATH . PLUGINDIR . &quot;/{$item[2]}&quot;) || ! empty($menu_hook)) {
+if (file_exists(WP_PLUGIN_DIR . &quot;/{$item[2]}&quot;) || ! empty($menu_hook)) {
  	if ( 'admin.php' == $pagenow )
 		echo &quot;\n\t&lt;li&gt;&lt;a href='admin.php?page={$item[2]}'$class&gt;{$item[0]}&lt;/a&gt;&lt;/li&gt;&quot;;
 	else</diff>
      <filename>wp-admin/menu-header.php</filename>
    </modified>
    <modified>
      <diff>@@ -20,11 +20,15 @@ elseif (strpos($_SERVER['REQUEST_URI'], 'link-add.php') !== false)
 else
 	$menu[10] = array(__('Manage'), 'edit_posts', 'edit.php');
 
-$awaiting_mod = $wpdb-&gt;get_var(&quot;SELECT COUNT(*) FROM $wpdb-&gt;comments WHERE comment_approved = '0'&quot;);
+$awaiting_mod = wp_count_comments();
+$awaiting_mod = $awaiting_mod-&gt;moderated;
 $menu[15] = array(__('Design'), 'switch_themes', 'themes.php');
-$menu[20] = array( sprintf( __('Comments %s'), &quot;&lt;span id='awaiting-mod' class='count-$awaiting_mod'&gt;&lt;span class='comment-count'&gt;$awaiting_mod&lt;/span&gt;&lt;/span&gt;&quot; ), 'edit_posts', 'edit-comments.php');
+$menu[20] = array( sprintf( __('Comments %s'), &quot;&lt;span id='awaiting-mod' class='count-$awaiting_mod'&gt;&lt;span class='comment-count'&gt;&quot; . number_format_i18n($awaiting_mod) . &quot;&lt;/span&gt;&lt;/span&gt;&quot; ), 'edit_posts', 'edit-comments.php');
 $menu[30] = array(__('Settings'), 'manage_options', 'options-general.php');
-$menu[35] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
+
+$update_plugins = get_option( 'update_plugins' );
+$update_count = count( $update_plugins-&gt;response );
+$menu[35] = array( sprintf( __('Plugins %s'), &quot;&lt;span id='update-plugins' class='count-$update_count'&gt;&lt;span class='plugin-count'&gt;&quot; . number_format_i18n($update_count) . &quot;&lt;/span&gt;&lt;/span&gt;&quot; ), 'activate_plugins', 'plugins.php');
 if ( current_user_can('edit_users') )
 	$menu[40] = array(__('Users'), 'edit_users', 'users.php');
 else
@@ -52,6 +56,7 @@ if ( current_user_can('edit_users') ) {
 	$submenu['users.php'][5] = array(__('Authors &amp;amp; Users'), 'edit_users', 'users.php');
 	$submenu['users.php'][10] = array(__('Your Profile'), 'read', 'profile.php');
 } else {
+	$_wp_real_parent_file['users.php'] = 'profile.php';
 	$submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
 }
 </diff>
      <filename>wp-admin/menu.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
 &lt;?php
-require_once('../wp-config.php');
+require_once('../wp-load.php');
 wp_redirect('edit-comments.php?comment_status=moderated');
 ?&gt;</diff>
      <filename>wp-admin/moderation.php</filename>
    </modified>
    <modified>
      <diff>@@ -14,7 +14,7 @@ include('admin-header.php');
 &lt;table class=&quot;form-table&quot;&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Default article settings') ?&gt;&lt;/th&gt;
-&lt;td&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Default article settings') ?&gt;&lt;/legend&gt;
 &lt;label for=&quot;default_pingback_flag&quot;&gt;
 &lt;input name=&quot;default_pingback_flag&quot; type=&quot;checkbox&quot; id=&quot;default_pingback_flag&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('default_pingback_flag')); ?&gt; /&gt;
 &lt;?php _e('Attempt to notify any blogs linked to from the article (slows down posting.)') ?&gt;&lt;/label&gt;
@@ -28,11 +28,11 @@ include('admin-header.php');
 &lt;?php _e('Allow people to post comments on the article') ?&gt;&lt;/label&gt;
 &lt;br /&gt;
 &lt;small&gt;&lt;em&gt;&lt;?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?&gt;&lt;/em&gt;&lt;/small&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('E-mail me whenever') ?&gt;&lt;/th&gt;
-&lt;td&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('E-mail me whenever') ?&gt;&lt;/legend&gt;
 &lt;label for=&quot;comments_notify&quot;&gt;
 &lt;input name=&quot;comments_notify&quot; type=&quot;checkbox&quot; id=&quot;comments_notify&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('comments_notify')); ?&gt; /&gt;
 &lt;?php _e('Anyone posts a comment') ?&gt; &lt;/label&gt;
@@ -40,11 +40,11 @@ include('admin-header.php');
 &lt;label for=&quot;moderation_notify&quot;&gt;
 &lt;input name=&quot;moderation_notify&quot; type=&quot;checkbox&quot; id=&quot;moderation_notify&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('moderation_notify')); ?&gt; /&gt;
 &lt;?php _e('A comment is held for moderation') ?&gt; &lt;/label&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Before a comment appears') ?&gt;&lt;/th&gt;
-&lt;td&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Before a comment appears') ?&gt;&lt;/legend&gt;
 &lt;label for=&quot;comment_moderation&quot;&gt;
 &lt;input name=&quot;comment_moderation&quot; type=&quot;checkbox&quot; id=&quot;comment_moderation&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('comment_moderation')); ?&gt; /&gt;
 &lt;?php _e('An administrator must always approve the comment') ?&gt; &lt;/label&gt;
@@ -52,62 +52,98 @@ include('admin-header.php');
 &lt;label for=&quot;require_name_email&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;require_name_email&quot; id=&quot;require_name_email&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('require_name_email')); ?&gt; /&gt; &lt;?php _e('Comment author must fill out name and e-mail') ?&gt;&lt;/label&gt;
 &lt;br /&gt;
 &lt;label for=&quot;comment_whitelist&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;comment_whitelist&quot; id=&quot;comment_whitelist&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('comment_whitelist')); ?&gt; /&gt; &lt;?php _e('Comment author must have a previously approved comment') ?&gt;&lt;/label&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Comment Moderation') ?&gt;&lt;/th&gt;
-&lt;td&gt;
-&lt;p&gt;&lt;?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '&lt;input name=&quot;comment_max_links&quot; type=&quot;text&quot; id=&quot;comment_max_links&quot; size=&quot;3&quot; value=&quot;' . get_option('comment_max_links'). '&quot; /&gt;' ) ?&gt;&lt;/p&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Comment Moderation') ?&gt;&lt;/legend&gt;
+&lt;p&gt;&lt;label for=&quot;comment_max_links&quot;&gt;&lt;?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '&lt;input name=&quot;comment_max_links&quot; type=&quot;text&quot; id=&quot;comment_max_links&quot; size=&quot;3&quot; value=&quot;' . get_option('comment_max_links'). '&quot; /&gt;' ) ?&gt;&lt;/label&gt;&lt;/p&gt;
 
-&lt;p&gt;&lt;?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the &lt;a href=&quot;edit-comments.php?comment_status=moderated&quot;&gt;moderation queue&lt;/a&gt;. One word or IP per line. It will match inside words, so &quot;press&quot; will match &quot;WordPress&quot;.') ?&gt;&lt;/p&gt;
+&lt;p&gt;&lt;label for=&quot;moderation_keys&quot;&gt;&lt;?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the &lt;a href=&quot;edit-comments.php?comment_status=moderated&quot;&gt;moderation queue&lt;/a&gt;. One word or IP per line. It will match inside words, so &quot;press&quot; will match &quot;WordPress&quot;.') ?&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;
 &lt;textarea name=&quot;moderation_keys&quot; cols=&quot;60&quot; rows=&quot;10&quot; id=&quot;moderation_keys&quot; style=&quot;width: 98%; font-size: 12px;&quot; class=&quot;code&quot;&gt;&lt;?php form_option('moderation_keys'); ?&gt;&lt;/textarea&gt;
 &lt;/p&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Comment Blacklist') ?&gt;&lt;/th&gt;
-&lt;td&gt;
-&lt;p&gt;&lt;?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so &quot;press&quot; will match &quot;WordPress&quot;.') ?&gt;&lt;/p&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Comment Blacklist') ?&gt;&lt;/legend&gt;
+&lt;p&gt;&lt;label for=&quot;blacklist_keys&quot;&gt;&lt;?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so &quot;press&quot; will match &quot;WordPress&quot;.') ?&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;
 &lt;textarea name=&quot;blacklist_keys&quot; cols=&quot;60&quot; rows=&quot;10&quot; id=&quot;blacklist_keys&quot; style=&quot;width: 98%; font-size: 12px;&quot; class=&quot;code&quot;&gt;&lt;?php form_option('blacklist_keys'); ?&gt;&lt;/textarea&gt;
 &lt;/p&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/table&gt;
 
 &lt;h3&gt;&lt;?php _e('Avatars') ?&gt;&lt;/h3&gt;
 
-&lt;p&gt;&lt;?php _e('By default WordPress uses &lt;a href=&quot;http://gravatar.com/&quot;&gt;Gravatars&lt;/a&gt; &amp;#8212; short for Globally Recognized Avatars &amp;#8212; for the pictures that show up next to comments. Plugins may override this.'); ?&gt;&lt;/p&gt;
+&lt;p&gt;&lt;?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites.  Here you can enable the display of avatars for people who comment on your blog.'); ?&gt;&lt;/p&gt;
 
 &lt;?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?&gt;
 
 &lt;table class=&quot;form-table&quot;&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Avatar display') ?&gt;&lt;/th&gt;
-&lt;td&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Avatar Display') ?&gt;&lt;/th&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Avatar display') ?&gt;&lt;/legend&gt;
 &lt;?php
 	$yesorno = array(0 =&gt; __(&quot;Don&amp;#8217;t show Avatars&quot;), 1 =&gt; __('Show Avatars'));
 	foreach ( $yesorno as $key =&gt; $value) {
 		$selected = (get_option('show_avatars') == $key) ? 'checked=&quot;checked&quot;' : '';
-		echo &quot;\n\t&lt;label&gt;&lt;input type='radio' name='show_avatars' value='$key' $selected&gt; $value&lt;/label&gt;&lt;br /&gt;&quot;;
+		echo &quot;\n\t&lt;label&gt;&lt;input type='radio' name='show_avatars' value='$key' $selected/&gt; $value&lt;/label&gt;&lt;br /&gt;&quot;;
 	}
 ?&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Maximum Rating') ?&gt;&lt;/th&gt;
-&lt;td&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Maximum Rating') ?&gt;&lt;/legend&gt;
 
 &lt;?php
 $ratings = array( 'G' =&gt; __('G &amp;#8212; Suitable for all audiences'), 'PG' =&gt; __('PG &amp;#8212; Possibly offensive, usually for audiences 13 and above'), 'R' =&gt; __('R &amp;#8212; Intended for adult audiences above 17'), 'X' =&gt; __('X &amp;#8212; Even more mature than above'));
 foreach ($ratings as $key =&gt; $rating) :
 	$selected = (get_option('avatar_rating') == $key) ? 'checked=&quot;checked&quot;' : '';
-	echo &quot;\n\t&lt;label&gt;&lt;input type='radio' name='avatar_rating' value='$key' $selected&gt; $rating&lt;/label&gt;&lt;br /&gt;&quot;;
+	echo &quot;\n\t&lt;label&gt;&lt;input type='radio' name='avatar_rating' value='$key' $selected/&gt; $rating&lt;/label&gt;&lt;br /&gt;&quot;;
 endforeach;
 ?&gt;
 
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
+&lt;/tr&gt;
+&lt;tr valign=&quot;top&quot;&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Default Avatar') ?&gt;&lt;/th&gt;
+&lt;td class=&quot;defaultavatarpicker&quot;&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Default Avatar') ?&gt;&lt;/legend&gt;
+
+&lt;?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?&gt;&lt;br /&gt;
+
+&lt;?php
+$avatar_defaults = array(
+	'mystery' =&gt; __('Mystery Man'),
+	'blank' =&gt; __('Blank'),
+	'gravatar_default' =&gt; __('Gravatar Logo'),
+	'identicon' =&gt; __('Identicon (Generated)'),
+	'wavatar' =&gt; __('Wavatar (Generated)'),
+	'monsterid' =&gt; __('MonsterID (Generated)')
+);
+$avatar_defaults = apply_filters('avatar_defaults', $avatar_defaults);
+$default = get_option('avatar_default');
+if ( empty($default) )
+	$default = 'mystery';
+$size = 32;
+$avatar_list = '';
+foreach ( $avatar_defaults as $default_key =&gt; $default_name ) {
+	$selected = ($default == $default_key) ? 'checked=&quot;checked&quot; ' : '';
+	$avatar_list .= &quot;\n\t&lt;label&gt;&lt;input type='radio' name='avatar_default' id='avatar_{$default_key}' value='{$default_key}' {$selected}/&gt; &quot;;
+
+	$avatar = get_avatar( $user_email, $size, $default_key );
+	$avatar_list .= preg_replace(&quot;/src='(.+?)'/&quot;, &quot;src='\$1&amp;amp;forcedefault=1'&quot;, $avatar);
+
+	$avatar_list .= ' ' . $default_name . '&lt;/label&gt;';
+	$avatar_list .= '&lt;br /&gt;';
+}
+echo apply_filters('default_avatar_select', $avatar_list);
+?&gt;
+
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 
 &lt;/table&gt;
@@ -115,7 +151,7 @@ endforeach;
 
 &lt;p class=&quot;submit&quot;&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;update&quot; /&gt;
-&lt;input type=&quot;hidden&quot; name=&quot;page_options&quot; value=&quot;default_pingback_flag,default_ping_status,default_comment_status,comments_notify,moderation_notify,comment_moderation,require_name_email,comment_whitelist,comment_max_links,moderation_keys,blacklist_keys,show_avatars,avatar_rating&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;page_options&quot; value=&quot;default_pingback_flag,default_ping_status,default_comment_status,comments_notify,moderation_notify,comment_moderation,require_name_email,comment_whitelist,comment_max_links,moderation_keys,blacklist_keys,show_avatars,avatar_rating,avatar_default&quot; /&gt;
 &lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;&lt;?php _e('Save Changes') ?&gt;&quot; /&gt;
 &lt;/p&gt;
 &lt;/form&gt;</diff>
      <filename>wp-admin/options-discussion.php</filename>
    </modified>
    <modified>
      <diff>@@ -13,50 +13,50 @@ include('./admin-header.php');
 &lt;?php wp_nonce_field('update-options') ?&gt;
 &lt;table class=&quot;form-table&quot;&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Blog Title') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;blogname&quot;&gt;&lt;?php _e('Blog Title') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;blogname&quot; type=&quot;text&quot; id=&quot;blogname&quot; value=&quot;&lt;?php form_option('blogname'); ?&gt;&quot; size=&quot;40&quot; /&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Tagline') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;blogdescription&quot;&gt;&lt;?php _e('Tagline') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;blogdescription&quot; type=&quot;text&quot; id=&quot;blogdescription&quot; style=&quot;width: 95%&quot; value=&quot;&lt;?php form_option('blogdescription'); ?&gt;&quot; size=&quot;45&quot; /&gt;
 &lt;br /&gt;
 &lt;?php _e('In a few words, explain what this blog is about.') ?&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('WordPress address (URL)') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;siteurl&quot;&gt;&lt;?php _e('WordPress address (URL)') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;siteurl&quot; type=&quot;text&quot; id=&quot;siteurl&quot; value=&quot;&lt;?php form_option('siteurl'); ?&gt;&quot; size=&quot;40&quot; class=&quot;code&lt;?php if ( defined( 'WP_SITEURL' ) ) : ?&gt; disabled&quot; disabled=&quot;disabled&quot;&lt;?php else: ?&gt;&quot;&lt;?php endif; ?&gt; /&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Blog address (URL)') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;home&quot;&gt;&lt;?php _e('Blog address (URL)') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;home&quot; type=&quot;text&quot; id=&quot;home&quot; value=&quot;&lt;?php form_option('home'); ?&gt;&quot; size=&quot;40&quot; class=&quot;code&lt;?php if ( defined( 'WP_HOME' ) ) : ?&gt; disabled&quot; disabled=&quot;disabled&quot;&lt;?php else: ?&gt;&quot;&lt;?php endif; ?&gt; /&gt;&lt;br /&gt;&lt;?php _e('Enter the address here if you want your blog homepage &lt;a href=&quot;http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory&quot;&gt;to be different from the directory&lt;/a&gt; you installed WordPress.'); ?&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('E-mail address') ?&gt; &lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;admin_email&quot;&gt;&lt;?php _e('E-mail address') ?&gt; &lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;admin_email&quot; type=&quot;text&quot; id=&quot;admin_email&quot; value=&quot;&lt;?php form_option('admin_email'); ?&gt;&quot; size=&quot;40&quot; class=&quot;code&quot; /&gt;
 &lt;br /&gt;
 &lt;?php _e('This address is used for admin purposes, like new user notification.') ?&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Membership') ?&gt;&lt;/th&gt;
-&lt;td&gt; &lt;label for=&quot;users_can_register&quot;&gt;
+&lt;td&gt; &lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Membership') ?&gt;&lt;/legend&gt;&lt;label for=&quot;users_can_register&quot;&gt;
 &lt;input name=&quot;users_can_register&quot; type=&quot;checkbox&quot; id=&quot;users_can_register&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('users_can_register')); ?&gt; /&gt;
 &lt;?php _e('Anyone can register') ?&gt;&lt;/label&gt;&lt;br /&gt;
 &lt;label for=&quot;comment_registration&quot;&gt;
 &lt;input name=&quot;comment_registration&quot; type=&quot;checkbox&quot; id=&quot;comment_registration&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('comment_registration')); ?&gt; /&gt;
 &lt;?php _e('Users must be registered and logged in to comment') ?&gt;
 &lt;/label&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('New User Default Role') ?&gt;&lt;/th&gt;
-&lt;td&gt;&lt;label for=&quot;default_role&quot;&gt;
-&lt;select name=&quot;default_role&quot; id=&quot;default_role&quot;&gt;&lt;?php wp_dropdown_roles( get_option('default_role') ); ?&gt;&lt;/select&gt;&lt;/label&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;default_role&quot;&gt;&lt;?php _e('New User Default Role') ?&gt;&lt;/label&gt;&lt;/th&gt;
+&lt;td&gt;
+&lt;select name=&quot;default_role&quot; id=&quot;default_role&quot;&gt;&lt;?php wp_dropdown_roles( get_option('default_role') ); ?&gt;&lt;/select&gt;
 &lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Timezone') ?&gt; &lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;gmt_offset&quot;&gt;&lt;?php _e('Timezone') ?&gt; &lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;
-&lt;select name=&quot;gmt_offset&quot;&gt;
+&lt;select name=&quot;gmt_offset&quot; id=&quot;gmt_offset&quot;&gt;
 &lt;?php
 $current_offset = get_option('gmt_offset');
 $offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
@@ -87,18 +87,18 @@ foreach ( $offset_range as $offset ) {
 &lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Date Format') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;date_format&quot;&gt;&lt;?php _e('Date Format') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;date_format&quot; type=&quot;text&quot; id=&quot;date_format&quot; size=&quot;30&quot; value=&quot;&lt;?php form_option('date_format'); ?&gt;&quot; /&gt;&lt;br /&gt;
 &lt;?php _e('Output:') ?&gt; &lt;strong&gt;&lt;?php echo mysql2date(get_option('date_format'), current_time('mysql')); ?&gt;&lt;/strong&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Time Format') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;time_format&quot;&gt;&lt;?php _e('Time Format') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;time_format&quot; type=&quot;text&quot; id=&quot;time_format&quot; size=&quot;30&quot; value=&quot;&lt;?php form_option('time_format'); ?&gt;&quot; /&gt;&lt;br /&gt;
 &lt;?php _e('Output:') ?&gt; &lt;strong&gt;&lt;?php echo gmdate(get_option('time_format'), current_time('timestamp')); ?&gt;&lt;/strong&gt;&lt;br /&gt;
 &lt;?php _e('&lt;a href=&quot;http://codex.wordpress.org/Formatting_Date_and_Time&quot;&gt;Documentation on date formatting&lt;/a&gt;. Click &quot;Save Changes&quot; to update sample output.') ?&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Week Starts On') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;start_of_week&quot;&gt;&lt;?php _e('Week Starts On') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;select name=&quot;start_of_week&quot; id=&quot;start_of_week&quot;&gt;
 &lt;?php
 for ($day_index = 0; $day_index &lt;= 6; $day_index++) :</diff>
      <filename>wp-admin/options-general.php</filename>
    </modified>
    <modified>
      <diff>@@ -15,7 +15,7 @@ include('admin-header.php');
 &lt;h3&gt;&lt;?php _e('Uploading'); ?&gt;&lt;/h3&gt;
 &lt;table class=&quot;form-table&quot;&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Store uploads in this folder'); ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;upload_path&quot;&gt;&lt;?php _e('Store uploads in this folder'); ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;upload_path&quot; type=&quot;text&quot; id=&quot;upload_path&quot; class=&quot;code&quot; value=&quot;&lt;?php echo attribute_escape(str_replace(ABSPATH, '', get_option('upload_path'))); ?&gt;&quot; size=&quot;40&quot; /&gt;
 &lt;br /&gt;
 &lt;?php _e('Default is &lt;code&gt;wp-content/uploads&lt;/code&gt;'); ?&gt;
@@ -23,7 +23,7 @@ include('admin-header.php');
 &lt;/tr&gt;
 
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Full URL path to files (optional)'); ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;upload_url_path&quot;&gt;&lt;?php _e('Full URL path to files (optional)'); ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;upload_url_path&quot; type=&quot;text&quot; id=&quot;upload_url_path&quot; class=&quot;code&quot; value=&quot;&lt;?php echo attribute_escape( get_option('upload_url_path')); ?&gt;&quot; size=&quot;40&quot; /&gt;
 &lt;/td&gt;
 &lt;/tr&gt;
@@ -44,23 +44,23 @@ include('admin-header.php');
 &lt;table class=&quot;form-table&quot;&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Thumbnail size') ?&gt;&lt;/th&gt;
-&lt;td&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Thumbnail size') ?&gt;&lt;/legend&gt;
 &lt;label for=&quot;thumbnail_size_w&quot;&gt;&lt;?php _e('Width'); ?&gt;&lt;/label&gt;
 &lt;input name=&quot;thumbnail_size_w&quot; type=&quot;text&quot; id=&quot;thumbnail_size_w&quot; value=&quot;&lt;?php form_option('thumbnail_size_w'); ?&gt;&quot; size=&quot;6&quot; /&gt;
 &lt;label for=&quot;thumbnail_size_h&quot;&gt;&lt;?php _e('Height'); ?&gt;&lt;/label&gt;
 &lt;input name=&quot;thumbnail_size_h&quot; type=&quot;text&quot; id=&quot;thumbnail_size_h&quot; value=&quot;&lt;?php form_option('thumbnail_size_h'); ?&gt;&quot; size=&quot;6&quot; /&gt;&lt;br /&gt;
 &lt;input name=&quot;thumbnail_crop&quot; type=&quot;checkbox&quot; id=&quot;thumbnail_crop&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('thumbnail_crop')); ?&gt;/&gt;
 &lt;label for=&quot;thumbnail_crop&quot;&gt;&lt;?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?&gt;&lt;/label&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Medium size') ?&gt;&lt;/th&gt;
-&lt;td&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Medium size') ?&gt;&lt;/legend&gt;
 &lt;label for=&quot;medium_size_w&quot;&gt;&lt;?php _e('Max Width'); ?&gt;&lt;/label&gt;
 &lt;input name=&quot;medium_size_w&quot; type=&quot;text&quot; id=&quot;medium_size_w&quot; value=&quot;&lt;?php form_option('medium_size_w'); ?&gt;&quot; size=&quot;6&quot; /&gt;
 &lt;label for=&quot;medium_size_h&quot;&gt;&lt;?php _e('Max Height'); ?&gt;&lt;/label&gt;
 &lt;input name=&quot;medium_size_h&quot; type=&quot;text&quot; id=&quot;medium_size_h&quot; value=&quot;&lt;?php form_option('medium_size_h'); ?&gt;&quot; size=&quot;6&quot; /&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/table&gt;
 </diff>
      <filename>wp-admin/options-misc.php</filename>
    </modified>
    <modified>
      <diff>@@ -163,18 +163,18 @@ $structures = array(
 
 &lt;h3&gt;&lt;?php _e('Optional'); ?&gt;&lt;/h3&gt;
 &lt;?php if ($is_apache) : ?&gt;
-	&lt;p&gt;&lt;?php _e('If you like, you may enter custom structures for your category and tag &lt;abbr title=&quot;Universal Resource Locator&quot;&gt;URL&lt;/abbr&gt;s here. For example, using &lt;code&gt;/topics/&lt;/code&gt; as your category base would make your category links like &lt;code&gt;http://example.org/topics/uncategorized/&lt;/code&gt;. If you leave these blank the defaults will be used.') ?&gt;&lt;/p&gt;
+	&lt;p&gt;&lt;?php _e('If you like, you may enter custom structures for your category and tag &lt;abbr title=&quot;Universal Resource Locator&quot;&gt;URL&lt;/abbr&gt;s here. For example, using &lt;code&gt;topics&lt;/code&gt; as your category base would make your category links like &lt;code&gt;http://example.org/topics/uncategorized/&lt;/code&gt;. If you leave these blank the defaults will be used.') ?&gt;&lt;/p&gt;
 &lt;?php else : ?&gt;
-	&lt;p&gt;&lt;?php _e('If you like, you may enter custom structures for your category and tag &lt;abbr title=&quot;Universal Resource Locator&quot;&gt;URL&lt;/abbr&gt;s here. For example, using &lt;code&gt;/topics/&lt;/code&gt; as your category base would make your category links like &lt;code&gt;http://example.org/index.php/topics/uncategorized/&lt;/code&gt;. If you leave these blank the defaults will be used.') ?&gt;&lt;/p&gt;
+	&lt;p&gt;&lt;?php _e('If you like, you may enter custom structures for your category and tag &lt;abbr title=&quot;Universal Resource Locator&quot;&gt;URL&lt;/abbr&gt;s here. For example, using &lt;code&gt;topics&lt;/code&gt; as your category base would make your category links like &lt;code&gt;http://example.org/index.php/topics/uncategorized/&lt;/code&gt;. If you leave these blank the defaults will be used.') ?&gt;&lt;/p&gt;
 &lt;?php endif; ?&gt;
 
 &lt;table class=&quot;form-table&quot;&gt;
 	&lt;tr&gt;
-		&lt;th&gt;&lt;?php _e('Category base'); ?&gt;&lt;/th&gt;
+		&lt;th&gt;&lt;label for=&quot;category_base&quot;&gt;&lt;?php _e('Category base'); ?&gt;&lt;/label&gt;&lt;/th&gt;
 		&lt;td&gt;&lt;input name=&quot;category_base&quot; id=&quot;category_base&quot; type=&quot;text&quot; class=&quot;code&quot;  value=&quot;&lt;?php echo attribute_escape($category_base); ?&gt;&quot; size=&quot;30&quot; /&gt;&lt;/td&gt;
 	&lt;/tr&gt;
 	&lt;tr&gt;
-		&lt;th&gt;&lt;?php _e('Tag base'); ?&gt;&lt;/th&gt;
+		&lt;th&gt;&lt;label for=&quot;tag_base&quot;&gt;&lt;?php _e('Tag base'); ?&gt;&lt;/label&gt;&lt;/th&gt;
 		&lt;td&gt;&lt;input name=&quot;tag_base&quot; id=&quot;tag_base&quot; type=&quot;text&quot; class=&quot;code&quot;  value=&quot;&lt;?php echo attribute_escape($tag_base); ?&gt;&quot; size=&quot;30&quot; /&gt;&lt;/td&gt;
 	&lt;/tr&gt;
 &lt;/table&gt;</diff>
      <filename>wp-admin/options-permalink.php</filename>
    </modified>
    <modified>
      <diff>@@ -14,13 +14,13 @@ include('./admin-header.php');
 &lt;table class=&quot;form-table&quot;&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Blog Visibility') ?&gt; &lt;/th&gt;
-&lt;td&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Blog Visibility') ?&gt; &lt;/legend&gt;
 &lt;p&gt;&lt;input id=&quot;blog-public&quot; type=&quot;radio&quot; name=&quot;blog_public&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('blog_public')); ?&gt; /&gt;
 &lt;label for=&quot;blog-public&quot;&gt;&lt;?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers');?&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;p&gt;&lt;input id=&quot;blog-norobots&quot; type=&quot;radio&quot; name=&quot;blog_public&quot; value=&quot;0&quot; &lt;?php checked('0', get_option('blog_public')); ?&gt; /&gt;
 &lt;label for=&quot;blog-norobots&quot;&gt;&lt;?php _e('I would like to block search engines, but allow normal visitors'); ?&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;?php do_action('blog_privacy_selector'); ?&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/table&gt;
 </diff>
      <filename>wp-admin/options-privacy.php</filename>
    </modified>
    <modified>
      <diff>@@ -15,7 +15,7 @@ include('admin-header.php');
 &lt;?php if ( get_pages() ): ?&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Front page displays')?&gt;&lt;/th&gt;
-&lt;td&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Front page displays')?&gt;&lt;/legend&gt;
 	&lt;p&gt;&lt;label&gt;
 		&lt;input name=&quot;show_on_front&quot; type=&quot;radio&quot; value=&quot;posts&quot; class=&quot;tog&quot; &lt;?php checked('posts', get_option('show_on_front')); ?&gt; /&gt;
 		&lt;?php _e('Your latest posts'); ?&gt;
@@ -27,8 +27,8 @@ include('admin-header.php');
 	&lt;/label&gt;
 	&lt;/p&gt;
 &lt;ul&gt;
-	&lt;li&gt;&lt;?php printf(__('Front page: %s'), wp_dropdown_pages(&quot;name=page_on_front&amp;echo=0&amp;show_option_none=&quot;.__('- Select -').&quot;&amp;selected=&quot; . get_option('page_on_front'))); ?&gt;&lt;/li&gt;
-	&lt;li&gt;&lt;?php printf(__('Posts page: %s'), wp_dropdown_pages(&quot;name=page_for_posts&amp;echo=0&amp;show_option_none=&quot;.__('- Select -').&quot;&amp;selected=&quot; . get_option('page_for_posts'))); ?&gt;&lt;/li&gt;
+	&lt;li&gt;&lt;?php printf(&quot;&lt;label for='page_on_front'&gt;&quot;.__('Front page: %s').&quot;&lt;/label&gt;&quot;, wp_dropdown_pages(&quot;name=page_on_front&amp;echo=0&amp;show_option_none=&quot;.__('- Select -').&quot;&amp;selected=&quot; . get_option('page_on_front'))); ?&gt;&lt;/li&gt;
+	&lt;li&gt;&lt;?php printf(&quot;&lt;label for='page_for_posts'&gt;&quot;.__('Posts page: %s').&quot;&lt;/label&gt;&quot;, wp_dropdown_pages(&quot;name=page_for_posts&amp;echo=0&amp;show_option_none=&quot;.__('- Select -').&quot;&amp;selected=&quot; . get_option('page_for_posts'))); ?&gt;&lt;/li&gt;
 &lt;/ul&gt;
 &lt;?php if ( 'page' == get_option('show_on_front') &amp;&amp; get_option('page_for_posts') == get_option('page_on_front') ) : ?&gt;
 &lt;div id=&quot;front-page-warning&quot; class=&quot;updated fade-ff0000&quot;&gt;
@@ -37,29 +37,29 @@ include('admin-header.php');
 	&lt;/p&gt;
 &lt;/div&gt;
 &lt;?php endif; ?&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;?php endif; ?&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Blog pages show at most') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;posts_per_page&quot;&gt;&lt;?php _e('Blog pages show at most') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;
 &lt;input name=&quot;posts_per_page&quot; type=&quot;text&quot; id=&quot;posts_per_page&quot; value=&quot;&lt;?php form_option('posts_per_page'); ?&gt;&quot; size=&quot;3&quot; /&gt; &lt;?php _e('posts') ?&gt;
 &lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Syndication feeds show the most recent') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;posts_per_rss&quot;&gt;&lt;?php _e('Syndication feeds show the most recent') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;posts_per_rss&quot; type=&quot;text&quot; id=&quot;posts_per_rss&quot; value=&quot;&lt;?php form_option('posts_per_rss'); ?&gt;&quot; size=&quot;3&quot; /&gt; &lt;?php _e('posts') ?&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('For each article in a feed, show') ?&gt; &lt;/th&gt;
-&lt;td&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('For each article in a feed, show') ?&gt; &lt;/legend&gt;
 &lt;p&gt;&lt;label&gt;&lt;input name=&quot;rss_use_excerpt&quot;  type=&quot;radio&quot; value=&quot;0&quot; &lt;?php checked(0, get_option('rss_use_excerpt')); ?&gt;	/&gt; &lt;?php _e('Full text') ?&gt;&lt;/label&gt;&lt;br /&gt;
 &lt;label&gt;&lt;input name=&quot;rss_use_excerpt&quot; type=&quot;radio&quot; value=&quot;1&quot; &lt;?php checked(1, get_option('rss_use_excerpt')); ?&gt; /&gt; &lt;?php _e('Summary') ?&gt;&lt;/label&gt;&lt;/p&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Encoding for pages and feeds') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;blog_charset&quot;&gt;&lt;?php _e('Encoding for pages and feeds') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;blog_charset&quot; type=&quot;text&quot; id=&quot;blog_charset&quot; value=&quot;&lt;?php form_option('blog_charset'); ?&gt;&quot; size=&quot;20&quot; class=&quot;code&quot; /&gt;&lt;br /&gt;
 &lt;?php _e('The character encoding you write your blog in (UTF-8 is &lt;a href=&quot;http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html&quot;&gt;recommended&lt;/a&gt;)') ?&gt;&lt;/td&gt;
 &lt;/tr&gt;</diff>
      <filename>wp-admin/options-reading.php</filename>
    </modified>
    <modified>
      <diff>@@ -14,21 +14,21 @@ include('admin-header.php');
 
 &lt;table class=&quot;form-table&quot;&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt; &lt;?php _e('Size of the post box') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;default_post_edit_rows&quot;&gt; &lt;?php _e('Size of the post box') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;default_post_edit_rows&quot; type=&quot;text&quot; id=&quot;default_post_edit_rows&quot; value=&quot;&lt;?php form_option('default_post_edit_rows'); ?&gt;&quot; size=&quot;2&quot; style=&quot;width: 1.5em;&quot; /&gt;
 &lt;?php _e('lines') ?&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Formatting') ?&gt;&lt;/th&gt;
-&lt;td&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Formatting') ?&gt;&lt;/legend&gt;
 &lt;label for=&quot;use_smilies&quot;&gt;
 &lt;input name=&quot;use_smilies&quot; type=&quot;checkbox&quot; id=&quot;use_smilies&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('use_smilies')); ?&gt; /&gt;
 &lt;?php _e('Convert emoticons like &lt;code&gt;:-)&lt;/code&gt; and &lt;code&gt;:-P&lt;/code&gt; to graphics on display') ?&gt;&lt;/label&gt;&lt;br /&gt;
 &lt;label for=&quot;use_balanceTags&quot;&gt;&lt;input name=&quot;use_balanceTags&quot; type=&quot;checkbox&quot; id=&quot;use_balanceTags&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('use_balanceTags')); ?&gt; /&gt; &lt;?php _e('WordPress should correct invalidly nested XHTML automatically') ?&gt;&lt;/label&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Default Post Category') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;default_category&quot;&gt;&lt;?php _e('Default Post Category') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;select name=&quot;default_category&quot; id=&quot;default_category&quot;&gt;
 &lt;?php
 $categories = get_categories('get=all');
@@ -42,7 +42,7 @@ endforeach;
 &lt;/select&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Default Link Category') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;default_link_category&quot;&gt;&lt;?php _e('Default Link Category') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;select name=&quot;default_link_category&quot; id=&quot;default_link_category&quot;&gt;
 &lt;?php
 $link_categories = get_terms('link_category', 'get=all');
@@ -57,29 +57,49 @@ endforeach;
 &lt;/tr&gt;
 &lt;/table&gt;
 
+&lt;h3&gt;&lt;?php _e('Remote Publishing') ?&gt;&lt;/h3&gt;
+&lt;p&gt;&lt;?php printf(__('To post to WordPress from a desktop blogging client or remote website that uses the Atom Publishing Protocol or one of the XML-RPC publishing interfaces you must enable them below.')) ?&gt;&lt;/p&gt;
+&lt;table class=&quot;form-table&quot;&gt;
+&lt;tr valign=&quot;top&quot;&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Atom Publishing Protocol') ?&gt;&lt;/th&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Atom Publishing Protocol') ?&gt;&lt;/legend&gt;
+&lt;label for=&quot;enable_app&quot;&gt;
+&lt;input name=&quot;enable_app&quot; type=&quot;checkbox&quot; id=&quot;enable_app&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('enable_app')); ?&gt; /&gt;
+&lt;?php _e('Enable the Atom Publishing Protocol.') ?&gt;&lt;/label&gt;&lt;br /&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
+&lt;/tr&gt;
+&lt;tr valign=&quot;top&quot;&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('XML-RPC') ?&gt;&lt;/th&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('XML-RPC') ?&gt;&lt;/legend&gt;
+&lt;label for=&quot;enable_xmlrpc&quot;&gt;
+&lt;input name=&quot;enable_xmlrpc&quot; type=&quot;checkbox&quot; id=&quot;enable_xmlrpc&quot; value=&quot;1&quot; &lt;?php checked('1', get_option('enable_xmlrpc')); ?&gt; /&gt;
+&lt;?php _e('Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.') ?&gt;&lt;/label&gt;&lt;br /&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
+&lt;/tr&gt;&lt;/table&gt;
+
 &lt;h3&gt;&lt;?php _e('Post via e-mail') ?&gt;&lt;/h3&gt;
-&lt;p&gt;&lt;?php printf(__('To post to WordPress by e-mail you must set up a secret e-mail account with POP3 access. Any mail received at this address will be posted, so it&amp;#8217;s a good idea to keep this address very secret. Here are three random strings you could use: &lt;code&gt;%s&lt;/code&gt;, &lt;code&gt;%s&lt;/code&gt;, &lt;code&gt;%s&lt;/code&gt;.'), wp_generate_password(), wp_generate_password(), wp_generate_password()) ?&gt;&lt;/p&gt;
+&lt;p&gt;&lt;?php printf(__('To post to WordPress by e-mail you must set up a secret e-mail account with POP3 access. Any mail received at this address will be posted, so it&amp;#8217;s a good idea to keep this address very secret. Here are three random strings you could use: &lt;code&gt;%s&lt;/code&gt;, &lt;code&gt;%s&lt;/code&gt;, &lt;code&gt;%s&lt;/code&gt;.'), wp_generate_password(8, false), wp_generate_password(8, false), wp_generate_password(8, false)) ?&gt;&lt;/p&gt;
 
 &lt;table class=&quot;form-table&quot;&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Mail Server') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;mailserver_url&quot;&gt;&lt;?php _e('Mail Server') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;mailserver_url&quot; type=&quot;text&quot; id=&quot;mailserver_url&quot; value=&quot;&lt;?php form_option('mailserver_url'); ?&gt;&quot; size=&quot;40&quot; /&gt;
 &lt;label for=&quot;mailserver_port&quot;&gt;&lt;?php _e('Port') ?&gt;&lt;/label&gt;
 &lt;input name=&quot;mailserver_port&quot; type=&quot;text&quot; id=&quot;mailserver_port&quot; value=&quot;&lt;?php form_option('mailserver_port'); ?&gt;&quot; size=&quot;6&quot; /&gt;
 &lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Login Name') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;mailserver_login&quot;&gt;&lt;?php _e('Login Name') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;mailserver_login&quot; type=&quot;text&quot; id=&quot;mailserver_login&quot; value=&quot;&lt;?php form_option('mailserver_login'); ?&gt;&quot; size=&quot;40&quot; /&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Password') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;mailserver_pass&quot;&gt;&lt;?php _e('Password') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;
 &lt;input name=&quot;mailserver_pass&quot; type=&quot;text&quot; id=&quot;mailserver_pass&quot; value=&quot;&lt;?php form_option('mailserver_pass'); ?&gt;&quot; size=&quot;40&quot; /&gt;
 &lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Default Mail Category') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;default_email_category&quot;&gt;&lt;?php _e('Default Mail Category') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;select name=&quot;default_email_category&quot; id=&quot;default_email_category&quot;&gt;
 &lt;?php
 //Alreay have $categories from default_category
@@ -98,7 +118,7 @@ endforeach;
 
 &lt;?php if ( get_option('blog_public') ) : ?&gt;
 
-&lt;p&gt;&lt;?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see &lt;a href=&quot;http://codex.wordpress.org/Update_Services&quot;&gt;Update Services&lt;/a&gt; on the Codex. Separate multiple service &lt;abbr title=&quot;Universal Resource Locator&quot;&gt;URL&lt;/abbr&gt;s with line breaks.') ?&gt;&lt;/p&gt;
+&lt;p&gt;&lt;label for=&quot;ping_sites&quot;&gt;&lt;?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see &lt;a href=&quot;http://codex.wordpress.org/Update_Services&quot;&gt;Update Services&lt;/a&gt; on the Codex. Separate multiple service &lt;abbr title=&quot;Universal Resource Locator&quot;&gt;URL&lt;/abbr&gt;s with line breaks.') ?&gt;&lt;/label&gt;&lt;/p&gt;
 
 &lt;textarea name=&quot;ping_sites&quot; id=&quot;ping_sites&quot; style=&quot;width: 98%;&quot; rows=&quot;3&quot; cols=&quot;50&quot;&gt;&lt;?php form_option('ping_sites'); ?&gt;&lt;/textarea&gt;
 
@@ -110,7 +130,7 @@ endforeach;
 
 &lt;p class=&quot;submit&quot;&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;update&quot; /&gt;
-&lt;input type=&quot;hidden&quot; name=&quot;page_options&quot; value=&quot;default_post_edit_rows,use_smilies,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category&quot; /&gt;
+&lt;input type=&quot;hidden&quot; name=&quot;page_options&quot; value=&quot;default_post_edit_rows,use_smilies,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category,enable_app,enable_xmlrpc&quot; /&gt;
 &lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;&lt;?php _e('Save Changes') ?&gt;&quot; /&gt;
 &lt;/p&gt;
 &lt;/form&gt;</diff>
      <filename>wp-admin/options-writing.php</filename>
    </modified>
    <modified>
      <diff>@@ -73,7 +73,7 @@ foreach ( (array) $options as $option) :
 	}
 	echo &quot;
 &lt;tr&gt;
-	&lt;th scope='row'&gt;$option-&gt;option_name&lt;/th&gt;
+	&lt;th scope='row'&gt;&lt;label for='$option-&gt;option_name'&gt;$option-&gt;option_name&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&quot;;
 
 	if (strpos($value, &quot;\n&quot;) !== false) echo &quot;&lt;textarea class='$class' name='$option-&gt;option_name' id='$option-&gt;option_name' cols='30' rows='5'&gt;&quot; . wp_specialchars($value) . &quot;&lt;/textarea&gt;&quot;;</diff>
      <filename>wp-admin/options.php</filename>
    </modified>
    <modified>
      <diff>@@ -7,8 +7,9 @@ wp_enqueue_script('autosave');
 wp_enqueue_script('page');
 if ( user_can_richedit() )
 	wp_enqueue_script('editor');
-wp_enqueue_script('thickbox');
+add_thickbox();
 wp_enqueue_script('media-upload');
+wp_enqueue_script('word-count');
 
 require_once('admin-header.php');
 ?&gt;</diff>
      <filename>wp-admin/page-new.php</filename>
    </modified>
    <modified>
      <diff>@@ -8,8 +8,10 @@ wp_reset_vars(array('action'));
 
 function redirect_page($page_ID) {
 	$referredby = '';
-	if ( !empty($_POST['referredby']) )
+	if ( !empty($_POST['referredby']) ) {
 		$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
+		$referredby = remove_query_arg('_wp_original_http_referer', $referredby);
+	}
 	$referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
 
 	if ( 'post' == $_POST['originalaction'] &amp;&amp; !empty($_POST['mode']) &amp;&amp; 'bookmarklet' == $_POST['mode'] ) {
@@ -31,9 +33,8 @@ function redirect_page($page_ID) {
 		$location = $location[0] . '#postcustom';
 	} elseif (!empty($referredby) &amp;&amp; $referredby != $referer) {
 		$location = $_POST['referredby'];
-		if ( $_POST['referredby'] == 'redo' )
-			$location = get_permalink( $page_ID );
-		elseif ( false !== strpos($location, 'edit-pages.php') )
+		$location = remove_query_arg('_wp_original_http_referer', $location);
+		if ( false !== strpos($location, 'edit-pages.php') )
 			$location = add_query_arg('posted', $page_ID, $location);
 		elseif ( false !== strpos($location, 'wp-admin') )
 			$location = &quot;page-new.php?posted=$page_ID&quot;;
@@ -70,25 +71,29 @@ case 'edit':
 
 	if ( empty($post-&gt;ID) ) wp_die( __(&quot;You attempted to edit a page that doesn't exist. Perhaps it was deleted?&quot;) );
 
-	if ( 'post' == $post-&gt;post_type ) {
-		wp_redirect(&quot;post.php?action=edit&amp;post=$post_ID&quot;);
+	if ( 'page' != $post-&gt;post_type ) {
+		wp_redirect( get_edit_post_link( $post_ID, 'url' ) );
 		exit();
 	}
 
 	wp_enqueue_script('page');
 	if ( user_can_richedit() )
 		wp_enqueue_script('editor');
-	wp_enqueue_script('thickbox');
+	add_thickbox();
 	wp_enqueue_script('media-upload');
-	if ( $last = wp_check_post_lock( $post-&gt;ID ) ) {
-		$last_user = get_userdata( $last );
-		$last_user_name = $last_user ? $last_user-&gt;display_name : __('Somebody');
-		$message = sprintf( __( 'Warning: %s is currently editing this page' ), wp_specialchars( $last_user_name ) );
-		$message = str_replace( &quot;'&quot;, &quot;\'&quot;, &quot;&lt;div class='error'&gt;&lt;p&gt;$message&lt;/p&gt;&lt;/div&gt;&quot; );
-		add_action('admin_notices', create_function( '', &quot;echo '$message';&quot; ) );
-	} else {
-		wp_set_post_lock( $post-&gt;ID );
-		wp_enqueue_script('autosave');
+	wp_enqueue_script('word-count');
+
+	if ( current_user_can('edit_page', $page_ID) ) {
+		if ( $last = wp_check_post_lock( $post-&gt;ID ) ) {
+			$last_user = get_userdata( $last );
+			$last_user_name = $last_user ? $last_user-&gt;display_name : __('Somebody');
+			$message = sprintf( __( 'Warning: %s is currently editing this page' ), wp_specialchars( $last_user_name ) );
+			$message = str_replace( &quot;'&quot;, &quot;\'&quot;, &quot;&lt;div class='error'&gt;&lt;p&gt;$message&lt;/p&gt;&lt;/div&gt;&quot; );
+			add_action('admin_notices', create_function( '', &quot;echo '$message';&quot; ) );
+		} else {
+			wp_set_post_lock( $post-&gt;ID );
+			wp_enqueue_script('autosave');
+		}
 	}
 
 	require_once('admin-header.php');
@@ -142,8 +147,8 @@ case 'delete':
 	}
 
 	$sendback = wp_get_referer();
-	if (strpos($sendback, 'page.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/page.php';
-	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+	if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page.php');
+	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
 	$sendback = preg_replace('|[^a-z0-9-~+_.?#=&amp;;,/:]|i', '', $sendback);
 	wp_redirect($sendback);
 	exit();</diff>
      <filename>wp-admin/page.php</filename>
    </modified>
    <modified>
      <diff>@@ -6,10 +6,7 @@ $parent_file = 'plugins.php';
 
 wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
 
-add_action( 'admin_head', 'theme_editor_css' );
-function theme_editor_css(){
-	wp_admin_css( 'css/theme-editor' );
-}
+wp_admin_css( 'theme-editor' );
 
 $plugins = get_plugins();
 $plugin_files = array_keys($plugins);
@@ -18,7 +15,7 @@ if (empty($file))
 	$file = $plugin_files[0];
 
 $file = validate_file_to_edit($file, $plugin_files);
-$real_file = get_real_file_to_edit( PLUGINDIR . &quot;/$file&quot;);
+$real_file = WP_PLUGIN_DIR . '/' . $file;
 
 switch($action) {
 
@@ -71,7 +68,7 @@ default:
 
 	require_once('admin-header.php');
 
-	update_recently_edited(PLUGINDIR . &quot;/$file&quot;);
+	update_recently_edited(WP_PLUGIN_DIR . '/' . $file);
 
 	if ( ! is_file($real_file) )
 		$error = 1;</diff>
      <filename>wp-admin/plugin-editor.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,68 +1,199 @@
 &lt;?php
 require_once('admin.php');
 
-if ( isset($_GET['action']) ) {
-	if ( isset($_GET['plugin']) )
-		$plugin = trim($_GET['plugin']);
-
-	if ( 'activate' == $_GET['action'] ) {
-		check_admin_referer('activate-plugin_' . $_GET['plugin']);
-		$result = activate_plugin($_GET['plugin'], 'plugins.php?error=true&amp;plugin=' . $plugin);
-		if ( is_wp_error( $result ) )
-			wp_die( $result-&gt;get_error_message() );
-		wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
-	} elseif ( 'error_scrape' == $_GET['action'] ) {
-		check_admin_referer('plugin-activation-error_' . $plugin);
-		$valid = validate_plugin($plugin);
-		if ( is_wp_error($valid) )
-			wp_die($valid);
-		error_reporting( E_ALL ^ E_NOTICE );
-		@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
-		include(ABSPATH . PLUGINDIR . '/' . $plugin);
-	} elseif ( 'deactivate' == $_GET['action'] ) {
-		check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
-		deactivate_plugins($_GET['plugin']);
-		wp_redirect('plugins.php?deactivate=true');
-	} elseif ( 'deactivate-all' == $_GET['action'] ) {
-		check_admin_referer('deactivate-all');
-		deactivate_all_plugins();
-		wp_redirect('plugins.php?deactivate-all=true');
-	} elseif ('reactivate-all' == $_GET['action']) {
-		check_admin_referer('reactivate-all');
-		reactivate_all_plugins('plugins.php?errors=true');
-		wp_redirect('plugins.php?reactivate-all=true'); // overrides the ?error=true one above
+$action = '';
+foreach( array('activate-selected', 'deactivate-selected', 'delete-selected', 'clear-recent-list') as $action_key ) {
+	if( isset($_POST[$action_key]) ) {
+		$action = $action_key;
+		break;
 	}
+}
+
+if( isset($_GET['action']) )
+	$action = $_GET['action'];
+
+$plugin = $_REQUEST['plugin'];
+
+if( !empty($action) ) {
+	switch( $action ) {
+		case 'activate':
+			check_admin_referer('activate-plugin_' . $plugin);
+			$result = activate_plugin($plugin, 'plugins.php?error=true&amp;plugin=' . $plugin);
+			if ( is_wp_error( $result ) )
+				wp_die( $result-&gt;get_error_message() );
+			$recent = (array)get_option('recently_activated');
+			if( isset($recent[ $plugin ]) ){
+				unset($recent[ $plugin ]);
+				update_option('recently_activated', $recent);
+			}
+			wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
+			exit;
+			break;
+		case 'activate-selected':
+			check_admin_referer('bulk-manage-plugins');
+			activate_plugins($_POST['checked'], 'plugins.php?error=true');
+
+			$recent = (array)get_option('recently_activated');
+			foreach( (array)$_POST['checked'] as $plugin =&gt; $time) {
+				if( isset($recent[ $plugin ]) )
+					unset($recent[ $plugin ]);
+			}
+			if( $recent != get_option('recently_activated') ) //If array changed, update it.
+				update_option('recently_activated', $recent);
 
-	exit;
+			wp_redirect('plugins.php?activate-multi=true');
+			exit;
+			break;
+		case 'error_scrape':
+			check_admin_referer('plugin-activation-error_' . $plugin);
+			$valid = validate_plugin($plugin);
+			if ( is_wp_error($valid) )
+				wp_die($valid);
+			error_reporting( E_ALL ^ E_NOTICE );
+			@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
+			include(WP_PLUGIN_DIR . '/' . $plugin);
+			exit;
+			break;
+		case 'deactivate':
+			check_admin_referer('deactivate-plugin_' . $plugin);
+			deactivate_plugins($plugin);
+			update_option('recently_activated', array($plugin =&gt; time()) + (array)get_option('recently_activated'));
+			wp_redirect('plugins.php?deactivate=true');
+			exit;
+			break;
+		case 'deactivate-selected':
+			check_admin_referer('bulk-manage-plugins');
+			deactivate_plugins($_POST['checked']);
+			$deactivated = array();
+			foreach( (array)$_POST['checked'] as $plugin )
+				$deactivated[ $plugin ] = time();
+			update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
+			wp_redirect('plugins.php?deactivate-multi=true');
+			exit;
+			break;
+		case 'delete-selected':
+			if( ! current_user_can('delete_plugins') )
+				wp_die(__('You do not have sufficient permissions to delete plugins for this blog.'));
+			
+			check_admin_referer('bulk-manage-plugins');
+			
+			$plugins = $_REQUEST['checked']; //$_POST = from the plugin form; $_GET = from the FTP details screen.
+			include(ABSPATH . 'wp-admin/update.php');
+
+			$title = __('Delete Plugin');
+			$parent_file = 'plugins.php';
+			
+			if( ! isset($_REQUEST['verify-delete']) ) {
+				wp_enqueue_script('jquery');
+				require_once('admin-header.php');
+				?&gt;
+			&lt;div class=&quot;wrap&quot;&gt;
+				&lt;h2&gt;&lt;?php _e('Delete Plugin(s)'); ?&gt;&lt;/h2&gt;		
+				&lt;?php
+					$files_to_delete = $plugin_info = array();
+					foreach( (array) $plugins as $plugin ) {
+						if( '.' == dirname($plugin) ) {
+							$files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
+							if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) )
+								$plugin_info[ $plugin ] = $data;
+						} else {
+							//Locate all the files in that folder:
+							$files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) );
+							if( $files ) {
+								$files_to_delete = array_merge($files_to_delete, $files);
+							}
+							//Get plugins list from that folder
+							if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) )
+								$plugin_info = array_merge($plugin_info, $folder_plugins);
+						}
+					}
+				?&gt;
+				&lt;p&gt;&lt;?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?&gt;&lt;/p&gt;
+				&lt;p&gt;
+					&lt;ul&gt;
+						&lt;?php 
+						foreach( $plugin_info as $plugin )
+							echo '&lt;li&gt;', $plugin['Title'], ' ', __('By'), ' ', $plugin['Author'], '&lt;/li&gt;';
+						?&gt;
+					&lt;/ul&gt;
+				&lt;/p&gt;
+				&lt;p&gt;&lt;?php _e('Are you sure you wish to delete these files?') ?&gt;&lt;/p&gt;
+				&lt;form method=&quot;post&quot; action=&quot;&lt;?php echo clean_url($_SERVER['REQUEST_URI']); ?&gt;&quot; style=&quot;display:inline;&quot;&gt;
+					&lt;input type=&quot;hidden&quot; name=&quot;verify-delete&quot; value=&quot;1&quot; /&gt;
+					&lt;input type=&quot;hidden&quot; name=&quot;delete-selected&quot; value=&quot;1&quot; /&gt;
+					&lt;?php
+						foreach( (array)$plugins as $plugin ) {
+							$plugin = attribute_escape($plugin);
+							echo &quot;&lt;input type='hidden' name='checked[]' value='$plugin' /&gt;&quot;;
+						}
+					?&gt;
+					&lt;?php wp_nonce_field('bulk-manage-plugins') ?&gt;
+					&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;&lt;?php _e('Yes, Delete these files') ?&gt;&quot; class=&quot;button&quot; /&gt;
+				&lt;/form&gt;
+				&lt;form method=&quot;post&quot; action=&quot;&lt;?php echo clean_url(wp_get_referer()); ?&gt;&quot; style=&quot;display:inline;&quot;&gt;
+					&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;&lt;?php _e('No, Return me to the plugin list') ?&gt;&quot; class=&quot;button&quot; /&gt;
+				&lt;/form&gt;
+
+				&lt;p&gt;&lt;a href=&quot;#&quot; onclick=&quot;jQuery('#files-list').toggle(); return false;&quot;&gt;&lt;?php _e('Click to view entire list of files which will be deleted'); ?&gt;&lt;/a&gt;&lt;/p&gt;
+				&lt;div id=&quot;files-list&quot; style=&quot;display:none;&quot;&gt;
+					&lt;ul&gt;
+					&lt;?php
+						foreach( (array)$files_to_delete as $file ) {
+							$file = str_replace(ABSPATH, '', $file);
+							echo &quot;&lt;li&gt;$file&lt;/li&gt;&quot;;
+						}
+					?&gt;
+					&lt;/ul&gt;
+				&lt;/div&gt;				
+			&lt;/div&gt;
+				&lt;?php
+				require_once('admin-footer.php');
+				exit;
+			} //Endif verify-delete
+			$delete_result = delete_plugins($plugins);
+
+			wp_cache_delete('plugins', 'plugins');
+			break;
+		case 'clear-recent-list':
+			update_option('recently_activated', array());
+			break;
+	}
 }
 
+wp_enqueue_script('admin-forms');
+
 $title = __('Manage Plugins');
 require_once('admin-header.php');
 
-validate_active_plugins();
-
+$invalid = validate_active_plugins();
+if( !empty($invalid) )
+	foreach($invalid as $plugin_file =&gt; $error)
+		echo '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . sprintf(__('The plugin &lt;code&gt;%s&lt;/code&gt; has been &lt;strong&gt;deactivated&lt;/strong&gt; due to an error: %s'), wp_specialchars($plugin_file), $error-&gt;get_error_message()) . '&lt;/p&gt;&lt;/div&gt;';
 ?&gt;
 
 &lt;?php if ( isset($_GET['error']) ) : ?&gt;
 	&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php _e('Plugin could not be activated because it triggered a &lt;strong&gt;fatal error&lt;/strong&gt;.') ?&gt;&lt;/p&gt;
 	&lt;?php
-		$plugin = trim($_GET['plugin']);
 		if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?&gt;
-	&lt;iframe style=&quot;border:0&quot; width=&quot;100%&quot; height=&quot;70px&quot; src=&quot;&lt;?php bloginfo('wpurl'); ?&gt;/wp-admin/plugins.php?action=error_scrape&amp;amp;plugin=&lt;?php echo attribute_escape($plugin); ?&gt;&amp;amp;_wpnonce=&lt;?php echo attribute_escape($_GET['_error_nonce']); ?&gt;&quot;&gt;&lt;/iframe&gt;
+	&lt;iframe style=&quot;border:0&quot; width=&quot;100%&quot; height=&quot;70px&quot; src=&quot;&lt;?php echo admin_url('plugins.php?action=error_scrape&amp;amp;plugin=' . attribute_escape($plugin) . '&amp;amp;_wpnonce=' . attribute_escape($_GET['_error_nonce'])); ?&gt;&quot;&gt;&lt;/iframe&gt;
 	&lt;?php
 		}
 	?&gt;
 	&lt;/div&gt;
-&lt;?php elseif ( isset($_GET['errors']) ) : ?&gt;
-	&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php _e('Some plugins could not be reactivated because they triggered a &lt;strong&gt;fatal error&lt;/strong&gt;.') ?&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;?php elseif ( 'delete-selected' == $action ) :
+		if ( is_wp_error($delete_result) ) : ?&gt;
+		&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result-&gt;get_error_message() ); ?&gt;&lt;/p&gt;&lt;/div&gt;
+		&lt;?php else : ?&gt;
+		&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php _e('The selected plugins have been &lt;strong&gt;deleted&lt;/strong&gt;.'); ?&gt;&lt;/p&gt;&lt;/div&gt;
+		&lt;?php endif; ?&gt;
 &lt;?php elseif ( isset($_GET['activate']) ) : ?&gt;
 	&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php _e('Plugin &lt;strong&gt;activated&lt;/strong&gt;.') ?&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;?php elseif (isset($_GET['activate-multi'])) : ?&gt;
+	&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php _e('Selected plugins &lt;strong&gt;activated&lt;/strong&gt;.'); ?&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;?php elseif ( isset($_GET['deactivate']) ) : ?&gt;
 	&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php _e('Plugin &lt;strong&gt;deactivated&lt;/strong&gt;.') ?&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;?php elseif (isset($_GET['deactivate-all'])) : ?&gt;
-	&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php _e('All plugins &lt;strong&gt;deactivated&lt;/strong&gt;.'); ?&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;?php elseif (isset($_GET['reactivate-all'])) : ?&gt;
-	&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php _e('Plugins &lt;strong&gt;reactivated&lt;/strong&gt;.'); ?&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;?php elseif (isset($_GET['deactivate-multi'])) : ?&gt;
+	&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;?php _e('Selected plugins &lt;strong&gt;deactivated&lt;/strong&gt;.'); ?&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;?php endif; ?&gt;
 
 &lt;div class=&quot;wrap&quot;&gt;
@@ -70,107 +201,160 @@ validate_active_plugins();
 &lt;p&gt;&lt;?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?&gt;&lt;/p&gt;
 &lt;?php
 
-$plugins = get_plugins();
+$all_plugins = get_plugins();
+$active_plugins = array();
+$inactive_plugins = array();
+$recent_plugins = array();
+$recently_activated = (array)get_option('recently_activated');
 
-if (empty($plugins)) {
-	echo '&lt;p&gt;';
-	_e(&quot;Couldn&amp;#8217;t open plugins directory or there are no plugins available.&quot;); // TODO: make more helpful
-	echo '&lt;/p&gt;';
-} else {
-?&gt;
+//Clean out any plugins which were deactivated over a week ago.
+foreach( $recently_activated as $key =&gt; $time )
+	if( $time + (7*24*60*60) &lt; time() ) //1 week
+		unset($recently_activated[ $key ]);
+if( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
+	update_option('recently_activated', $recently_activated);
 
-&lt;div class=&quot;tablenav&quot;&gt;
-	&lt;div class=&quot;alignleft&quot;&gt;
-	&lt;?php
-	$active = get_option('active_plugins');
-	$inactive = get_option('deactivated_plugins');
-	if ( !empty($active) ) {
-	?&gt;
-	&lt;a class=&quot;button-secondary&quot; href=&quot;&lt;?php echo wp_nonce_url('plugins.php?action=deactivate-all', 'deactivate-all'); ?&gt;&quot; class=&quot;delete&quot;&gt;&lt;?php _e('Deactivate All Plugins'); ?&gt;&lt;/a&gt;
-	&lt;?php
-	} elseif ( empty($active) &amp;&amp; !empty($inactive) ) {
-	?&gt;
-	&lt;a class=&quot;button-secondary&quot; href=&quot;&lt;?php echo wp_nonce_url('plugins.php?action=reactivate-all', 'reactivate-all'); ?&gt;&quot; class=&quot;delete&quot;&gt;&lt;?php _e('Reactivate Plugins'); ?&gt;&lt;/a&gt;
-	&lt;?php
-	} // endif active/inactive plugin check
-	?&gt;
-	&lt;/div&gt;
-	&lt;br class=&quot;clear&quot; /&gt;
-&lt;/div&gt;
+$plugins_allowedtags = array('a' =&gt; array('href' =&gt; array(),'title' =&gt; array()),'abbr' =&gt; array('title' =&gt; array()),'acronym' =&gt; array('title' =&gt; array()),'code' =&gt; array(),'em' =&gt; array(),'strong' =&gt; array());
 
-&lt;br class=&quot;clear&quot; /&gt;
+foreach( (array)$all_plugins as $plugin_file =&gt; $plugin_data) {
+
+	// Sanitize all displayed data
+	$plugin_data['Title']       = wp_kses($plugin_data['Title'], $plugins_allowedtags);
+	$plugin_data['Version']     = wp_kses($plugin_data['Version'], $plugins_allowedtags);
+	$plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
+	$plugin_data['Author']      = wp_kses($plugin_data['Author'], $plugins_allowedtags);
+	if( ! empty($plugin_data['Author']) )
+		$plugin_data['Description'] .= ' &lt;cite&gt;' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.&lt;/cite&gt;';
 
-&lt;table class=&quot;widefat&quot;&gt;
+	//Filter into individual sections
+	if ( is_plugin_active($plugin_file) ) {
+		$active_plugins[ $plugin_file ] = $plugin_data;
+	} else {
+		if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated?
+			$recent_plugins[ $plugin_file ] = $plugin_data;
+		else
+			$inactive_plugins[ $plugin_file ] = $plugin_data;
+	}
+}
+
+?&gt;
+
+&lt;?php
+function print_plugins_table($plugins, $context = '') {
+?&gt;
+&lt;table class=&quot;widefat&quot; id=&quot;&lt;?php echo $context ?&gt;-plugins-table&quot;&gt;
 	&lt;thead&gt;
 	&lt;tr&gt;
-		&lt;th&gt;&lt;?php _e('Plugin'); ?&gt;&lt;/th&gt;
-		&lt;th class=&quot;num&quot;&gt;&lt;?php _e('Version'); ?&gt;&lt;/th&gt;
-		&lt;th&gt;&lt;?php _e('Description'); ?&gt;&lt;/th&gt;
-		&lt;th class=&quot;status&quot;&gt;&lt;?php _e('Status') ?&gt;&lt;/th&gt;
-		&lt;th class=&quot;action-links&quot;&gt;&lt;?php _e('Action'); ?&gt;&lt;/th&gt;
+		&lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/th&gt;
+		&lt;th scope=&quot;col&quot;&gt;&lt;?php _e('Plugin'); ?&gt;&lt;/th&gt;
+		&lt;th scope=&quot;col&quot; class=&quot;num&quot;&gt;&lt;?php _e('Version'); ?&gt;&lt;/th&gt;
+		&lt;th scope=&quot;col&quot;&gt;&lt;?php _e('Description'); ?&gt;&lt;/th&gt;
+		&lt;th scope=&quot;col&quot; class=&quot;action-links&quot;&gt;&lt;?php _e('Action'); ?&gt;&lt;/th&gt;
 	&lt;/tr&gt;
 	&lt;/thead&gt;
-	&lt;tbody id=&quot;plugins&quot;&gt;
+	&lt;tbody class=&quot;plugins&quot;&gt;
 &lt;?php
-	foreach($plugins as $plugin_file =&gt; $plugin_data) {
-		$action_links = array();
-		
-		$style = '';
-
-		if ( is_plugin_active($plugin_file) ) {
-			$action_links[] = &quot;&lt;a href='&quot; . wp_nonce_url(&quot;plugins.php?action=deactivate&amp;amp;plugin=$plugin_file&quot;, 'deactivate-plugin_' . $plugin_file) . &quot;' title='&quot;.__('Deactivate this plugin').&quot;' class='delete'&gt;&quot;.__('Deactivate').&quot;&lt;/a&gt;&quot;;
-			$style = 'active';
-		} else {
-			$action_links[] = &quot;&lt;a href='&quot; . wp_nonce_url(&quot;plugins.php?action=activate&amp;amp;plugin=$plugin_file&quot;, 'activate-plugin_' . $plugin_file) . &quot;' title='&quot;.__('Activate this plugin').&quot;' class='edit'&gt;&quot;.__('Activate').&quot;&lt;/a&gt;&quot;;
-		}
-		if ( current_user_can('edit_plugins') &amp;&amp; is_writable(ABSPATH . PLUGINDIR . '/' . $plugin_file) )
-			$action_links[] = &quot;&lt;a href='plugin-editor.php?file=$plugin_file' title='&quot;.__('Open this file in the Plugin Editor').&quot;' class='edit'&gt;&quot;.__('Edit').&quot;&lt;/a&gt;&quot;;
 
-		$plugins_allowedtags = array('a' =&gt; array('href' =&gt; array(),'title' =&gt; array()),'abbr' =&gt; array('title' =&gt; array()),'acronym' =&gt; array('title' =&gt; array()),'code' =&gt; array(),'em' =&gt; array(),'strong' =&gt; array());
+	if( empty($plugins) ) {
+		echo '&lt;tr&gt;
+			&lt;td colspan=&quot;6&quot;&gt;' . __('No plugins to show') . '&lt;/td&gt;
+		&lt;/tr&gt;';
+	}
+	foreach( (array)$plugins as $plugin_file =&gt; $plugin_data) {
+		$action_links = array();
 
-		// Sanitize all displayed data
-		$plugin_data['Title']       = wp_kses($plugin_data['Title'], $plugins_allowedtags);
-		$plugin_data['Version']     = wp_kses($plugin_data['Version'], $plugins_allowedtags);
-		$plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
-		$plugin_data['Author']      = wp_kses($plugin_data['Author'], $plugins_allowedtags);
-		$author = ( empty($plugin_data['Author']) ) ? '' :  ' &lt;cite&gt;' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.&lt;/cite&gt;';
+		if( 'active' == $context )
+			$action_links[] = '&lt;a href=&quot;' . wp_nonce_url('plugins.php?action=deactivate&amp;amp;plugin=' . $plugin_file, 'deactivate-plugin_' . $plugin_file) . '&quot; title=&quot;' . __('Deactivate this plugin') . '&quot; class=&quot;delete&quot;&gt;' . __('Deactivate') . '&lt;/a&gt;';
+		else //Available or Recently deactivated
+			$action_links[] = '&lt;a href=&quot;' . wp_nonce_url('plugins.php?action=activate&amp;amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '&quot; title=&quot;' . __('Activate this plugin') . '&quot; class=&quot;edit&quot;&gt;' . __('Activate') . '&lt;/a&gt;';
 
-		if ( $style != '' )
-			$style = ' class=&quot;' . $style . '&quot;';
+		if ( current_user_can('edit_plugins') &amp;&amp; is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
+			$action_links[] = '&lt;a href=&quot;plugin-editor.php?file=' . $plugin_file . '&quot; title=&quot;' . __('Open this file in the Plugin Editor') . '&quot; class=&quot;edit&quot;&gt;' . __('Edit') . '&lt;/a&gt;';
 
-		$action_links = apply_filters('plugin_action_links', $action_links, $plugin_file, $plugin_info);
+		$action_links = apply_filters('plugin_action_links', $action_links, $plugin_file, $plugin_data, $context);
 
 		echo &quot;
-	&lt;tr$style&gt;
+	&lt;tr class='$context'&gt;
+		&lt;th scope='row' class='check-column'&gt;&lt;input type='checkbox' name='checked[]' value='&quot; . attribute_escape($plugin_file) . &quot;' /&gt;&lt;/th&gt;
 		&lt;td class='name'&gt;{$plugin_data['Title']}&lt;/td&gt;
 		&lt;td class='vers'&gt;{$plugin_data['Version']}&lt;/td&gt;
-		&lt;td class='desc'&gt;&lt;p&gt;{$plugin_data['Description']}$author&lt;/p&gt;&lt;/td&gt;
-		&lt;td class='status'&gt;&quot;;
-		if ( is_plugin_active($plugin_file) )
-			echo  __('&lt;span class=&quot;active&quot;&gt;Active&lt;/span&gt;');
-		else
-			_e('&lt;span class=&quot;inactive&quot;&gt;Inactive&lt;/span&gt;');
-		echo &quot;&lt;/td&gt;
-		&lt;td class='togl action-links'&gt;$toggle&quot;;  
+		&lt;td class='desc'&gt;&lt;p&gt;{$plugin_data['Description']}&lt;/p&gt;&lt;/td&gt;
+		&lt;td class='togl action-links'&gt;&quot;;  
 		if ( !empty($action_links) )
 			echo implode(' | ', $action_links);
-		echo &quot;&lt;/td&gt; 
-	&lt;/tr&gt;&quot;;
-	do_action( 'after_plugin_row', $plugin_file );
+		echo '&lt;/td&gt; 
+	&lt;/tr&gt;';
+		do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
 	}
 ?&gt;
 	&lt;/tbody&gt;
 &lt;/table&gt;
-
-&lt;?php
-}
+&lt;?php 
+} //End print_plugins_table()
 ?&gt;
 
-&lt;p&gt;&lt;?php printf(__('If something goes wrong with a plugin and you can&amp;#8217;t use WordPress, delete or rename that file in the &lt;code&gt;%s&lt;/code&gt; directory and it will be automatically deactivated.'), PLUGINDIR); ?&gt;&lt;/p&gt;
+&lt;?php if ( ! empty($active_plugins) ) : ?&gt;
+&lt;h3 id=&quot;currently-active&quot;&gt;&lt;?php _e('Currently Active Plugins') ?&gt;&lt;/h3&gt;
+&lt;form method=&quot;post&quot; action=&quot;&lt;?php echo admin_url('plugins.php') ?&gt;&quot;&gt;
+&lt;?php wp_nonce_field('bulk-manage-plugins') ?&gt;
+
+&lt;div class=&quot;tablenav&quot;&gt;
+	&lt;div class=&quot;alignleft&quot;&gt;
+		&lt;input type=&quot;submit&quot; name=&quot;deactivate-selected&quot; value=&quot;&lt;?php _e('Deactivate') ?&gt;&quot; class=&quot;button-secondary&quot; /&gt;
+	&lt;/div&gt;
+&lt;/div&gt;
+&lt;br class=&quot;clear&quot; /&gt;
+&lt;?php print_plugins_table($active_plugins, 'active') ?&gt;
+&lt;/form&gt;
+
+&lt;p&gt;&lt;?php printf(__('If something goes wrong with a plugin and you can&amp;#8217;t use WordPress, delete or rename that file in the &lt;code&gt;%s&lt;/code&gt; directory and it will be automatically deactivated.'), WP_PLUGIN_DIR); ?&gt;&lt;/p&gt;
+&lt;?php endif; ?&gt;
+
+&lt;?php if ( ! empty($recent_plugins) ) : ?&gt;
+&lt;h3 id=&quot;recent-plugins&quot;&gt;&lt;?php _e('Recently Active Plugins') ?&gt;&lt;/h3&gt;
+&lt;p&gt;&lt;?php _e('The following plugins were recently active. When a plugin has been inactive for more than 7 days it will be moved to the Inactive plugin list.') ?&gt;&lt;/p&gt;
+&lt;form method=&quot;post&quot; action=&quot;&lt;?php echo admin_url('plugins.php') ?&gt;&quot;&gt;
+&lt;?php wp_nonce_field('bulk-manage-plugins') ?&gt;
+
+&lt;div class=&quot;tablenav&quot;&gt;
+	&lt;div class=&quot;alignleft&quot;&gt;
+		&lt;input type=&quot;submit&quot; name=&quot;activate-selected&quot; value=&quot;&lt;?php _e('Activate') ?&gt;&quot; class=&quot;button-secondary&quot; /&gt;
+&lt;?php if( current_user_can('delete_plugins') ) : ?&gt;
+		&lt;input type=&quot;submit&quot; name=&quot;delete-selected&quot; value=&quot;&lt;?php _e('Delete') ?&gt;&quot; class=&quot;button-secondary&quot; /&gt;
+&lt;?php endif; ?&gt;
+		&lt;input type=&quot;submit&quot; name=&quot;clear-recent-list&quot; value=&quot;&lt;?php _e('Clear List') ?&gt;&quot; class=&quot;button-secondary&quot; /&gt;
+	&lt;/div&gt;
+&lt;/div&gt;
+&lt;br class=&quot;clear&quot; /&gt;
+&lt;?php print_plugins_table($recent_plugins, 'recent') ?&gt;
+&lt;/form&gt;
+&lt;?php endif; ?&gt;
+
+&lt;?php if ( ! empty($inactive_plugins) ) : ?&gt;
+&lt;h3 id=&quot;inactive-plugins&quot;&gt;&lt;?php _e('Inactive Plugins') ?&gt;&lt;/h3&gt;
+&lt;form method=&quot;post&quot; action=&quot;&lt;?php echo admin_url('plugins.php') ?&gt;&quot;&gt;
+&lt;?php wp_nonce_field('bulk-manage-plugins') ?&gt;
+
+&lt;div class=&quot;tablenav&quot;&gt;
+	&lt;div class=&quot;alignleft&quot;&gt;
+		&lt;input type=&quot;submit&quot; name=&quot;activate-selected&quot; value=&quot;&lt;?php _e('Activate') ?&gt;&quot; class=&quot;button-secondary&quot; /&gt;
+&lt;?php if( current_user_can('delete_plugins') ) : ?&gt;
+		&lt;input type=&quot;submit&quot; name=&quot;delete-selected&quot; value=&quot;&lt;?php _e('Delete') ?&gt;&quot; class=&quot;button-secondary&quot; /&gt;
+&lt;?php endif; ?&gt;
+	&lt;/div&gt;
+&lt;/div&gt;
+&lt;br class=&quot;clear&quot; /&gt;
+&lt;?php print_plugins_table($inactive_plugins, 'inactive') ?&gt;
+&lt;/form&gt;
+&lt;?php endif; ?&gt;
+
+&lt;?php if ( empty($all_plugins) ) : ?&gt;
+&lt;p&gt;&lt;?php _e('You do not appear to have any plugins available at this time.') ?&gt;&lt;/p&gt;
+&lt;?php endif; ?&gt;
 
 &lt;h2&gt;&lt;?php _e('Get More Plugins'); ?&gt;&lt;/h2&gt;
 &lt;p&gt;&lt;?php _e('You can find additional plugins for your site in the &lt;a href=&quot;http://wordpress.org/extend/plugins/&quot;&gt;WordPress plugin directory&lt;/a&gt;.'); ?&gt;&lt;/p&gt;
-&lt;p&gt;&lt;?php printf(__('To install a plugin you generally just need to upload the plugin file into your &lt;code&gt;%s&lt;/code&gt; directory. Once a plugin is uploaded, you may activate it here.'), PLUGINDIR); ?&gt;&lt;/p&gt;
+&lt;p&gt;&lt;?php printf(__('To install a plugin you generally just need to upload the plugin file into your &lt;code&gt;%s&lt;/code&gt; directory. Once a plugin is uploaded, you may activate it here.'), WP_PLUGIN_DIR); ?&gt;&lt;/p&gt;
 
 &lt;/div&gt;
 </diff>
      <filename>wp-admin/plugins.php</filename>
    </modified>
    <modified>
      <diff>@@ -7,8 +7,9 @@ wp_enqueue_script('autosave');
 wp_enqueue_script('post');
 if ( user_can_richedit() )
 	wp_enqueue_script('editor');
-wp_enqueue_script('thickbox');
+add_thickbox();
 wp_enqueue_script('media-upload');
+wp_enqueue_script('word-count');
 
 require_once ('./admin-header.php');
 </diff>
      <filename>wp-admin/post-new.php</filename>
    </modified>
    <modified>
      <diff>@@ -10,8 +10,10 @@ function redirect_post($post_ID = '') {
 	global $action;
 
 	$referredby = '';
-	if ( !empty($_POST['referredby']) )
+	if ( !empty($_POST['referredby']) ) {
 		$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
+		$referredby = remove_query_arg('_wp_original_http_referer', $referredby);
+	}
 	$referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
 
 	if ( !empty($_POST['mode']) &amp;&amp; 'bookmarklet' == $_POST['mode'] ) {
@@ -33,9 +35,8 @@ function redirect_post($post_ID = '') {
 		$location = $location[0] . '#postcustom';
 	} elseif (!empty($referredby) &amp;&amp; $referredby != $referer) {
 		$location = $_POST['referredby'];
-		if ( $_POST['referredby'] == 'redo' )
-			$location = get_permalink( $post_ID );
-		elseif ( false !== strpos($location, 'edit.php') )
+		$location = remove_query_arg('_wp_original_http_referer', $location);
+		if ( false !== strpos($location, 'edit.php') )
 			$location = add_query_arg('posted', $post_ID, $location);		
 		elseif ( false !== strpos($location, 'wp-admin') )
 			$location = &quot;post-new.php?posted=$post_ID&quot;;
@@ -77,25 +78,29 @@ case 'edit':
 
 	if ( empty($post-&gt;ID) ) wp_die( __(&quot;You attempted to edit a post that doesn't exist. Perhaps it was deleted?&quot;) );
 
-	if ( 'page' == $post-&gt;post_type ) {
-		wp_redirect(&quot;page.php?action=edit&amp;post=$post_ID&quot;);
+	if ( 'post' != $post-&gt;post_type ) {
+		wp_redirect( get_edit_post_link( $post-&gt;ID, 'url' ) );
 		exit();
 	}
 
 	wp_enqueue_script('post');
 	if ( user_can_richedit() )
 		wp_enqueue_script('editor');
-	wp_enqueue_script('thickbox');
+	add_thickbox();
 	wp_enqueue_script('media-upload');
-	if ( $last = wp_check_post_lock( $post-&gt;ID ) ) {
-		$last_user = get_userdata( $last );
-		$last_user_name = $last_user ? $last_user-&gt;display_name : __('Somebody');
-		$message = sprintf( __( 'Warning: %s is currently editing this post' ), wp_specialchars( $last_user_name ) );
-		$message = str_replace( &quot;'&quot;, &quot;\'&quot;, &quot;&lt;div class='error'&gt;&lt;p&gt;$message&lt;/p&gt;&lt;/div&gt;&quot; );
-		add_action('admin_notices', create_function( '', &quot;echo '$message';&quot; ) );
-	} else {
-		wp_set_post_lock( $post-&gt;ID );
-		wp_enqueue_script('autosave');
+	wp_enqueue_script('word-count');
+
+	if ( current_user_can('edit_post', $post_ID) ) {
+		if ( $last = wp_check_post_lock( $post-&gt;ID ) ) {
+			$last_user = get_userdata( $last );
+			$last_user_name = $last_user ? $last_user-&gt;display_name : __('Somebody');
+			$message = sprintf( __( 'Warning: %s is currently editing this post' ), wp_specialchars( $last_user_name ) );
+			$message = str_replace( &quot;'&quot;, &quot;\'&quot;, &quot;&lt;div class='error'&gt;&lt;p&gt;$message&lt;/p&gt;&lt;/div&gt;&quot; );
+			add_action('admin_notices', create_function( '', &quot;echo '$message';&quot; ) );
+		} else {
+			wp_set_post_lock( $post-&gt;ID );
+			wp_enqueue_script('autosave');
+		}
 	}
 
 	require_once('admin-header.php');
@@ -153,8 +158,8 @@ case 'delete':
 	}
 
 	$sendback = wp_get_referer();
-	if (strpos($sendback, 'post.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/post-new.php';
-	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+	if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
+	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
 	$sendback = preg_replace('|[^a-z0-9-~+_.?#=&amp;;,/:]|i', '', $sendback);
 	wp_redirect($sendback);
 	exit();</diff>
      <filename>wp-admin/post.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,314 +1,363 @@
-html,#edit-slug-box,#trackback,#category_nicename,#slug,#dbuser,#dbpass,#dbname,#dbhost,#dbprefix,#dccharset,input[name=gmpath],input[name=archivespath],input[name=lastentry],input[name=email],input[name=url],input[name=aim],input[name=yim],input[name=jabber],#newcontent,#email,#newcomment_author_url,#pass1,#pass2,#siteurl,#home,#admin_email,#date_format,#time_format,#mailserver_url,#mailserver_login,#mailserver_pass,#ping_sites,#blog_charset,#moderation_keys,#blacklist_keys,#permalink_structure,#category_base,#tag_base,#upload_path,#upload_url_path,#insertonly[src],#insertonly[href],#mailserver_port,#thumbnail_size_w,#thumbnail_size_h,#medium_size_w,#medium_size_h,#posts_per_page,#posts_per_rss,#comment_max_links,#insertonly[src],#link_url,#link_image,#rss_uri,#user_login,#key
-{
-	direction:ltr;
-	text-align:left
+a:link, a:visited {
+	text-decoration:none;
 }
-
-body, td {
-	font-family: Tahoma,Verdana,sans-serif;
+a:hover {
+	text-decoration:underline;
 }
-
-#wpwrap,#footer,#TB_title,.media-upload-form,#media-upload-header
-{
-	direction:rtl!important;
-	text-align:right!important
+.plugins .togl {
+	border-right-width: 0;
+	border-left-width: 1px;
+	border-left-style: solid;
 }
-
-#user_info
-{
-	left:15px;
-	right:auto
+form#upload th {
+	text-align:left;
+}
+td.available-theme {
+	text-align:right;
+}
+#current-theme img {
+	float: right;
+	margin-right:0;
+	margin-left: 1em;
+}
+.quicktags, .search {
+	font-family: Tahoma;
+}
+/* 201 - 403
+=================================== */
+.side-info ul {
+	padding-left:0;
+	padding-right:18px;
+}
+.submit input, .button, .button-secondary, .button-highlighted {
+	font-family: Tahoma;
+}
+#wpcontent select  {
+	font-family: Tahoma;
+}
+/* #postdiv, #titlediv, #guiddiv, #poststuff .stuffbox {
+	margin:0 0 0 8px;
+} */
+#quicktags #ed_code {
+	font-family: Tahoma;
+}
+#searchform fieldset {
+	float:right;
+	margin: 0 0 1em 1.5ex;
+}
+#searchform fieldset legend {
+	padding: 0 1px .2em 0;
 }
-
-#wphead h1
-{
-	margin:0 0 0 15%;
-	padding:11px 15px 16px 170px
+#searchform #post-query-submit {
+	float:right;
+}
+/* 404 - 804
+=================================== */
+#template div {
+	margin-right:0;
+	margin-left: 190px;
+}
+* html #template div {
+	margin-left: 0;
 }
-
-#wphead #viewsite
-{
+#your-profile legend {
+	font-family:arial;
+}
+#ajax-response.alignleft {
 	margin-left:0;
-	margin-right:10px
+	margin-right: 2em;
+}
+.page-numbers {
+	margin-right:0;
+	margin-left:3px;
 }
-
-#sidemenu
-{
+.comment-column {
+	margin-left:0;
+	margin-right: 5px;
+}
+.tablenav a.button-secondary {
+	margin: 1px 0 0 8px;
+}
+#update-nag, .plugin-update {
+	clear:both;
+}
+/* .tablenav .tablenav-pages {
 	float:left;
-	margin:-30px 315px 0 15px;
-	padding-left:0;
-	padding-right:10px
+} */
+#user_info {
+	right:auto;
+	left:15px;
+}
+#wphead #viewsite {
+	margin-left:0;
+	margin-right:10px;
 }
-
-#dashmenu
-{
-	font-size:11px;
+#wphead #viewsite a {
+	font-family: Tahoma;
+}
+#wphead h1 {
+	font-family:arial;
+	margin-right:0;
+	margin-left:15%;
+	padding: 11px 12px 16px 170px;
+}
+#dashmenu {
+	right:0;
 	left:auto;
 	padding-left:0;
-	padding-right:9px;
-	right:0
+	padding-right: 9px;
 }
-
-#dashmenu a
-{
+#dashmenu a {
+	margin-right:0;
 	margin-left:8px;
-	margin-right:8px;
 }
-
-#adminmenu
-{
-	height:32px;
-	padding:5px 8px 0 0
+#adminmenu {
+	padding-left:0;
+	padding-right:11px;
 }
-
-#adminmenu li a
-{
-	display:block;
-	float:right;
-	font:700 16px/100% &quot;Times New Roman&quot;, Times, serif;
-	margin:0 0 0 10px;
-	padding:5px 7px 9px
-}
-
-#adminmenu li a.current
-{
-	font-weight:700
-}
-
-#adminmenu li a #awaiting-mod
-{
-	background:url(images/comment-stalk-rtl.gif) -309px bottom !important;
-	font-family: Tahoma, Verdana, sans-serif;
-	margin-left:-45px;
-	margin-right:.2em;
-	margin-top:-5px
-}
-
-#adminmenu li a:hover #awaiting-mod
-{
-	background-position: -229px bottom !important;
-}
-
-#adminmenu li a #awaiting-mod span
-{
-	left:0;
-	right:auto
+#adminmenu a {
+	font-family:arial;
+	font-weight:bold;
+	padding:6px 7px;
+}
+#adminmenu a.current, #sidemenu a.current {
+	font-weight:bold;
 }
-
-#submenu li a
-{
-	display:block;
+#sidemenu {
+	margin: -30px 0 0 15px;
+	float: left;
+	padding-left:0;
+	padding-right: 10px;
+	height: 1%; /* Peek-a-boo in IE6 */
+}
+#sidemenu a {
 	float:right;
-	margin:0 10px 10px 0;
-	padding:2px 4px
 }
-
-p#post-search
-{
+#submenu li {
+	padding: 0 17px 8px 0;
+	font-size:13px;
+}
+#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
+	right:auto;
 	left:0;
-	right:auto
 }
-
-.tablenav div
-{
-	float:right!important
+#adminmenu li a:hover #awaiting-mod, #sidemenu li a:hover #update-plugins {
+	background-position: -160px top;
 }
-
-ul.view-switch
-{
-	float:left;
-	margin:-28px 0 -2px 5px
+/* 804 - 1004
+=================================== */
+#footer {
+	padding: 10px 60px 0 0;
 }
-
-#currenttheme img
-{
-	float:right;
-	margin-left:1em;
-	margin-right:0
+.form-table th {
+	text-align:right;
+}
+.form-table input.tog {
+	margin-right:0;
+	margin-left: 2px;
+	float: right;
 }
-
-form#themeselector
-{
-	float:left
+.form-table table.color-palette {
+	float:right;
 }
-
-.form-table input.tog
-{
+#pass-strength-result {
 	float:right;
 	margin-right:0;
-	margin-left:2px;
+	margin-left: 5px;
 }
-
-.curtime
-{
-	background-position:right 2px;
-	padding-left:0;
-	padding-right:18px;
+#profile-page .form-table #rich_editing {
+	margin-right:0;
+	margin-left: 5px;
 }
-
-#poststuff #edButtonPreview,#poststuff #edButtonHTML
-{
-	float:left;
-	margin-left:8px;
-	margin-right:0
+#tagsdiv #newtag {
+	margin-right:0;
+	margin-left: 5px;
 }
-
-#poststuff #media-buttons
-{
-	direction: ltr;
-	float:left;
-	margin-left:20px;
-	margin-right:0
+#tagchecklist {
+	margin-left:0;
+	margin-right: 10px;
 }
-
-#poststuff #media-buttons a
-{
-	margin-left:8px;
+#tagchecklist strong {
+	margin-left:0;
+	margin-right: -8px;
+}
+#tagchecklist span {
 	margin-right:0;
-	padding: 0 5px 2px 2px;
+	margin-left: 25px;
+	float: right;
 }
-
-#poststuff .togbox
-{
-	margin-left:0;
-	margin-right:-19px
+#tagchecklist span a {
+	margin: 6px -9px 0 0;
+	float: right;
 }
-
-#categorydiv ul#category-tabs,#linkcategorydiv ul#category-tabs
-{
-	float:right;
-	margin:0 0 0 -120px;
-	text-align:left
+/* 1005 - 1304
+=================================== */
+.ac_results li {
+	text-align:right;
+}
+#poststuff h2 {
+	clear:right;
+}
+#poststuff .postbox, #poststuff .stuffbox, #titlediv, #poststuff .postarea {
+	margin-left: 8px;
+	margin-right: 20px;
+}
+#edit-slug-buttons a.save {
+	margin-right:0;
+	margin-left:4px;
+}
+#poststuff #edButtonPreview, #poststuff #edButtonHTML {
+	margin: 5px 0 0 8px;
+	float: left;
 }
-
-ul#category-tabs li.ui-tabs-selected,#poststuff .togbox
-{
+#poststuff #media-buttons {
+	float: left;
+	margin-right:0;
+	margin-left: 20px;
+}
+#poststuff #media-buttons a {
+	padding: 0 2px 2px 5px;
+}
+#poststuff .togbox {
+	margin-left:0;
+	margin-right: -21px;
+	-moz-border-radius-topleft:0;
+	-khtml-border-top-left-radius:0;
+	-webkit-border-top-left-radius:0;
+	border-top-left-radius:0;
+	-moz-border-radius-topright: 3px;
+	-khtml-border-top-right-radius: 3px;
+	-webkit-border-top-right-radius: 3px;
+	border-top-right-radius: 3px;
+	-moz-border-radius-bottomleft: 0;
 	-khtml-border-bottom-left-radius:0;
-	-khtml-border-bottom-right-radius:3px;
+	-webkit-border-bottom-left-radius:0;
+	border-bottom-left-radius:0;
+	-moz-border-radius-bottomright: 3px;
+	-khtml-border-bottom-right-radius: 3px;
+	-webkit-border-bottom-right-radius: 3px;
+	border-bottom-right-radius: 3px;
+}
+.submitbox .submitdelete {
+	margin-left:0;
+	margin-right:8px;
+}
+.submitbox .submit {
+	text-align:right;
+}
+.submitbox .submit input {
+	margin-right:0;
+	margin-left:3px;
+}
+#categorydiv #category-adder {
+	margin-left:0;
+	margin-right: 120px;
+}
+#categorydiv ul#category-tabs {
+	float: right;
+	text-align: left;
+	margin: 0 0 0 -120px;
+}
+ul#category-tabs li.ui-tabs-selected {
+	-moz-border-radius-topleft:0;
 	-khtml-border-top-left-radius:0;
-	-khtml-border-top-right-radius:3px;
+	-webkit-border-top-left-radius:0;
+	border-top-left-radius:0;
 	-moz-border-radius-bottomleft:0;
-	-moz-border-radius-bottomright:3px;
-	-moz-border-radius-topleft:0;
-	-moz-border-radius-topright:3px;
+	-khtml-border-bottom-left-radius:0;
 	-webkit-border-bottom-left-radius:0;
-	-webkit-border-bottom-right-radius:3px;
-	-webkit-border-top-left-radius:0;
-	-webkit-border-top-right-radius:3px;
 	border-bottom-left-radius:0;
-	border-bottom-right-radius:3px;
-	border-top-left-radius:0;
-	border-top-right-radius:3px
+	-moz-border-radius-topright: 3px;
+	-khtml-border-top-right-radius: 3px;
+	-webkit-border-top-right-radius: 3px;
+	border-top-right-radius: 3px;
+	-moz-border-radius-bottomright: 3px;
+	-khtml-border-bottom-right-radius: 3px;
+	-webkit-border-bottom-right-radius: 3px;
+	border-bottom-right-radius: 3px;
+}
+div.ui-tabs-panel {
+	margin: 0 120px 0 5px;
+}
+/* 1305 - elakh! :-)
+=================================== */
+#categorydiv ul.categorychecklist ul {
+	margin-left:0;
+	margin-right: 18px;
 }
-
-div.ui-tabs-panel
-{
-	margin:0 120px 0 0
+#linkcategorydiv #category-adder {
+	margin-left:0;
+	margin-right: 120px;
 }
-
-#tagchecklist span
-{
-	float:right;
-	margin-left:25px;
-	margin-right:0
+#linkcategorydiv ul#category-tabs {
+	float: right;
+	text-align: left;
+	margin: 0 0 0 -120px;
 }
-
-#tagchecklist span a {
-	margin: 6px -9px 0 0;
+#linkcategorydiv ul.categorychecklist ul {
+	margin-left:0;
+	margin-right: 18px;
+}
+p#tag-search, p#post-search {
+	right:auto;
+	left:0;
+}
+#posts-filter fieldset {
 	float: right;
+	margin: 0 0 1em 1.5ex;
 }
-
-
-.tablenav .tablenav-pages
-{
-	float:left !important;
-	width:200px
-}
-
-.tablenav-pages .page-numbers
-{
-	display:block;
-	float:right
-}
-
-.side-info ul
-{
-	padding-left:0;
-	padding-right:18px
+#posts-filter fieldset legend {
+	padding: 0 1px .2em 0;
 }
-
-.form-table table.color-palette {
-	float:right;
+ul.view-switch {
+	float: left;
+	margin: -23px 0 -2px 5px;
 }
-
-#pass-strength-result
-{
-	float:right;
-	margin-right:0;
-	margin-left:5px;
-}
-
-td.comment p.comment-author img.avatar
-{
-	float:right !important;
-	margin-right:0 !important;
-	margin-left:8px !important;
-}
-
-#footer
-{
-	padding:10px 0 0
-}
-
-#footer p
-{
-	height:35px;
-	margin-right:20px;
-	padding:12px 40px 0 0;
-}
-
-#submenu,#wpbody
-{
-	clear:both;
+ul.view-switch li {
+	float: right;
 }
-
-#submenu li,ul.subsubsub li a
-{
-	padding:0;
+#the-comment-list td.comment p.comment-author {
+	margin-right: 0 ;
 }
-
-table.widefat th,.form-table th
-{
-	text-align:right
+#the-comment-list p.comment-author img {
+	float: right;
+	margin-right:0;
+	margin-left: 8px;
 }
-
-.widefat th input {
-	margin: 0 8px 0 0;
-	padding: 0;
+#the-comment-list td.comment p {
+	margin-left:0;
+	margin-right: 8px;
 }
-
-.available-theme,#tagchecklist span a
-{
-	float:right
+.curtime {
+	background-position: right 2px;
+	padding-left:0;
+	padding-right: 18px;
 }
-#template div {
+.tablenav .delete {
 	margin-right:0;
-	margin-left:190px;
+	margin-left: 20px;
 }
-.submitbox .submit {
-	text-align:right;
+#tTips {
+}
+td.action-links, th.action-links {
+	text-align:left;
 }
-
-#editorcontainer {
-	border:1px solid;
+.info-box {
+	left:auto;
+	right: 50%;
+	margin-left: 0;
+	margin-right: -225px;
+}
+.info-box .gears-img {
+	float: left;
+}
+/* LTR
+=================================== */
+#edit-slug-box, #trackback, #metakeyinput, #post_password, #link_url, #link_image, #rss_uri, #category_nicename, #slug, #dbuser, #dbpass, #dbname, #dbprefix, #dccharset, #gmpath, #archivespath, #lastentry, #dbhost, #pages-exclude, #newcontent, #email, #newcomment_author_url, #siteurl, #home, #admin_email, #date_format, #time_format, #gmt_offset, #mailserver_url, #mailserver_port, #mailserver_login, #mailserver_pass, #ping_sites, #posts_per_page, #posts_per_rss, #blog_charset, #moderation_keys, #blacklist_keys, #comment_max_links, #permalink_structure, #category_base, #tag_base, #upload_path, #upload_url_path, #thumbnail_size_w, #thumbnail_size_h, #medium_size_w, #medium_size_h, #user_login, #url, #pass1, #pass2, #aim, #yim, #jabber, #key, #src, #hostname, #username, #password, #rules {
+	direction:ltr;
 }
-
-.wrap h2 {
-	margin: 5px -4px 0 0;
-	padding-right: 0px;
-	padding-left: 280px;
+/* TinyMCE
+=================================== */
+.clearlooks2 .mceTop .mceLeft {
+	width:100% !important;
 }
-
-div#message {
-	clear: both;
-}
\ No newline at end of file</diff>
      <filename>wp-admin/rtl.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,9 @@
 &lt;?php
 define('WP_INSTALLING', true);
-//These two defines are required to allow us to use require_wp_db() to load the database class while being wp-content/wp-db.php aware
+//These three defines are required to allow us to use require_wp_db() to load the database class while being wp-content/wp-db.php aware
 define('ABSPATH', dirname(dirname(__FILE__)).'/');
 define('WPINC', 'wp-includes');
+define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
 
 require_once('../wp-includes/compat.php');
 require_once('../wp-includes/functions.php');
@@ -20,6 +21,10 @@ if ( !is_writable('../'))
 if (file_exists('../wp-config.php'))
 	wp_die(&quot;&lt;p&gt;The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try &lt;a href='install.php'&gt;installing now&lt;/a&gt;.&lt;/p&gt;&quot;);
 
+// Check if wp-config.php exists above the root directory
+if (file_exists('../../wp-config.php'))
+	wp_die(&quot;&lt;p&gt;The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try &lt;a href='install.php'&gt;installing now&lt;/a&gt;.&lt;/p&gt;&quot;);
+
 if (isset($_GET['step']))
 	$step = $_GET['step'];
 else
@@ -57,7 +62,7 @@ switch($step) {
 &lt;p&gt;&lt;strong&gt;If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open &lt;code&gt;wp-config-sample.php&lt;/code&gt; in a text editor, fill in your information, and save it as &lt;code&gt;wp-config.php&lt;/code&gt;. &lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you&amp;#8217;re all ready&amp;hellip;&lt;/p&gt;
 
-&lt;p&gt;&lt;a href=&quot;setup-config.php?step=1&quot; class=&quot;button&quot;&gt;Let&amp;#8217;s go!&lt;/a&gt;&lt;/p&gt;
+&lt;p class=&quot;step&quot;&gt;&lt;a href=&quot;setup-config.php?step=1&quot; class=&quot;button&quot;&gt;Let&amp;#8217;s go!&lt;/a&gt;&lt;/p&gt;
 &lt;?php
 	break;
 
@@ -68,34 +73,32 @@ switch($step) {
 	&lt;p&gt;Below you should enter your database connection details. If you're not sure about these, contact your host. &lt;/p&gt;
 	&lt;table class=&quot;form-table&quot;&gt;
 		&lt;tr&gt;
-			&lt;th scope=&quot;row&quot;&gt;Database Name&lt;/th&gt;
-			&lt;td&gt;&lt;input name=&quot;dbname&quot; type=&quot;text&quot; size=&quot;25&quot; value=&quot;wordpress&quot; /&gt;&lt;/td&gt;
+			&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;dbname&quot;&gt;Database Name&lt;/label&gt;&lt;/th&gt;
+			&lt;td&gt;&lt;input name=&quot;dbname&quot; id=&quot;dbname&quot; type=&quot;text&quot; size=&quot;25&quot; value=&quot;wordpress&quot; /&gt;&lt;/td&gt;
 			&lt;td&gt;The name of the database you want to run WP in. &lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr&gt;
-			&lt;th scope=&quot;row&quot;&gt;User Name&lt;/th&gt;
-			&lt;td&gt;&lt;input name=&quot;uname&quot; type=&quot;text&quot; size=&quot;25&quot; value=&quot;username&quot; /&gt;&lt;/td&gt;
+			&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;uname&quot;&gt;User Name&lt;/label&gt;&lt;/th&gt;
+			&lt;td&gt;&lt;input name=&quot;uname&quot; id=&quot;uname&quot; type=&quot;text&quot; size=&quot;25&quot; value=&quot;username&quot; /&gt;&lt;/td&gt;
 			&lt;td&gt;Your MySQL username&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr&gt;
-			&lt;th scope=&quot;row&quot;&gt;Password&lt;/th&gt;
-			&lt;td&gt;&lt;input name=&quot;pwd&quot; type=&quot;text&quot; size=&quot;25&quot; value=&quot;password&quot; /&gt;&lt;/td&gt;
+			&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;pwd&quot;&gt;Password&lt;/label&gt;&lt;/th&gt;
+			&lt;td&gt;&lt;input name=&quot;pwd&quot; id=&quot;pwd&quot; type=&quot;text&quot; size=&quot;25&quot; value=&quot;password&quot; /&gt;&lt;/td&gt;
 			&lt;td&gt;...and MySQL password.&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr&gt;
-			&lt;th scope=&quot;row&quot;&gt;Database Host&lt;/th&gt;
-			&lt;td&gt;&lt;input name=&quot;dbhost&quot; type=&quot;text&quot; size=&quot;25&quot; value=&quot;localhost&quot; /&gt;&lt;/td&gt;
+			&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;dbhost&quot;&gt;Database Host&lt;/label&gt;&lt;/th&gt;
+			&lt;td&gt;&lt;input name=&quot;dbhost&quot; id=&quot;dbhost&quot; type=&quot;text&quot; size=&quot;25&quot; value=&quot;localhost&quot; /&gt;&lt;/td&gt;
 			&lt;td&gt;99% chance you won't need to change this value.&lt;/td&gt;
 		&lt;/tr&gt;
 		&lt;tr&gt;
-			&lt;th scope=&quot;row&quot;&gt;Table Prefix&lt;/th&gt;
-			&lt;td&gt;&lt;input name=&quot;prefix&quot; type=&quot;text&quot; id=&quot;prefix&quot; value=&quot;wp_&quot; size=&quot;25&quot; /&gt;&lt;/td&gt;
+			&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;prefix&quot;&gt;Table Prefix&lt;/label&gt;&lt;/th&gt;
+			&lt;td&gt;&lt;input name=&quot;prefix&quot; id=&quot;prefix&quot; type=&quot;text&quot; id=&quot;prefix&quot; value=&quot;wp_&quot; size=&quot;25&quot; /&gt;&lt;/td&gt;
 			&lt;td&gt;If you want to run multiple WordPress installations in a single database, change this.&lt;/td&gt;
 		&lt;/tr&gt;
 	&lt;/table&gt;
-	&lt;h2 class=&quot;step&quot;&gt;
-	&lt;input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;Submit&quot; class=&quot;button&quot; /&gt;
-	&lt;/h2&gt;
+	&lt;p class=&quot;step&quot;&gt;&lt;input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;Submit&quot; class=&quot;button&quot; /&gt;&lt;/p&gt;
 &lt;/form&gt;
 &lt;?php
 	break;
@@ -149,7 +152,7 @@ switch($step) {
 ?&gt;
 &lt;p&gt;All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&amp;hellip;&lt;/p&gt;
 
-&lt;p&gt;&lt;a href=&quot;install.php&quot; class=&quot;button&quot;&gt;Run the install&lt;/a&gt;&lt;/p&gt;
+&lt;p class=&quot;step&quot;&gt;&lt;a href=&quot;install.php&quot; class=&quot;button&quot;&gt;Run the install&lt;/a&gt;&lt;/p&gt;
 &lt;?php
 	break;
 }</diff>
      <filename>wp-admin/setup-config.php</filename>
    </modified>
    <modified>
      <diff>@@ -14,8 +14,9 @@ if ('b' == $_GET['a']) {
 &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;&lt;?php bloginfo('html_type'); ?&gt;; charset=UTF-8&quot; /&gt;
 &lt;title&gt;&lt;?php _e('WordPress &amp;#8250; Posted'); ?&gt;&lt;/title&gt;
 &lt;?php
-wp_admin_css( 'css/global' );
-wp_admin_css();
+wp_admin_css( 'global', true );
+wp_admin_css( 'wp-admin', true );
+wp_admin_css( 'colors', true );
 ?&gt;
 &lt;/head&gt;
 &lt;body&gt;
@@ -32,8 +33,9 @@ wp_admin_css();
 &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;&lt;?php bloginfo('html_type'); ?&gt;; charset=&lt;?php bloginfo('blog_charset'); ?&gt;&quot; /&gt;
 &lt;title&gt;&lt;?php _e('WordPress &amp;#8250; Sidebar'); ?&gt;&lt;/title&gt;
 &lt;?php
-wp_admin_css( 'css/global' );
-wp_admin_css();
+wp_admin_css( 'global', true );
+wp_admin_css( 'wp-admin', true );
+wp_admin_css( 'colors', true );
 ?&gt;
 &lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
 form {
@@ -60,8 +62,8 @@ form {
 &lt;input type=&quot;hidden&quot; name=&quot;user_ID&quot; value=&quot;&lt;?php echo $user_ID ?&gt;&quot; /&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;mode&quot; value=&quot;sidebar&quot; /&gt;
 &lt;?php wp_nonce_field('add-post'); ?&gt;
-&lt;p&gt;&lt;?php _e('Title:'); ?&gt;
-&lt;input type=&quot;text&quot; name=&quot;post_title&quot; size=&quot;20&quot; tabindex=&quot;1&quot; style=&quot;width: 100%;&quot; /&gt;
+&lt;p&gt;&lt;label for=&quot;post_title&quot;&gt;&lt;?php _e('Title:'); ?&gt;&lt;/label&gt;
+&lt;input type=&quot;text&quot; name=&quot;post_title&quot; id=&quot;post_title&quot; size=&quot;20&quot; tabindex=&quot;1&quot; style=&quot;width: 100%;&quot; /&gt;
 &lt;/p&gt;
 &lt;p&gt;&lt;?php _e('Categories:'); ?&gt;
 &lt;span class=&quot;sidebar-categories&quot;&gt;
@@ -69,8 +71,8 @@ form {
 &lt;/span&gt;
 &lt;/p&gt;
 &lt;p&gt;
-Post:
-&lt;textarea rows=&quot;8&quot; cols=&quot;12&quot; style=&quot;width: 100%&quot; name=&quot;content&quot; tabindex=&quot;2&quot;&gt;&lt;/textarea&gt;
+&lt;label for=&quot;content&quot;&gt;Post:&lt;/label&gt;
+&lt;textarea rows=&quot;8&quot; cols=&quot;12&quot; style=&quot;width: 100%&quot; name=&quot;content&quot; id=&quot;content&quot; tabindex=&quot;2&quot;&gt;&lt;/textarea&gt;
 &lt;/p&gt;
 &lt;p&gt;
 	&lt;input name=&quot;saveasdraft&quot; type=&quot;submit&quot; id=&quot;saveasdraft&quot; tabindex=&quot;9&quot; value=&quot;&lt;?php _e('Save as Draft'); ?&gt;&quot; /&gt;</diff>
      <filename>wp-admin/sidebar.php</filename>
    </modified>
    <modified>
      <diff>@@ -6,10 +6,7 @@ $parent_file = 'themes.php';
 
 wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme'));
 
-add_action( 'admin_head', 'theme_editor_css' );
-function theme_editor_css(){
-	wp_admin_css( 'css/theme-editor' );
-}
+wp_admin_css( 'theme-editor' );
 
 $themes = get_themes();
 
@@ -46,10 +43,15 @@ case 'update':
 	$newcontent = stripslashes($_POST['newcontent']);
 	$theme = urlencode($theme);
 	if (is_writeable($real_file)) {
+		//is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
 		$f = fopen($real_file, 'w+');
-		fwrite($f, $newcontent);
-		fclose($f);
-		$location = &quot;theme-editor.php?file=$file&amp;theme=$theme&amp;a=te&quot;;
+		if ($f !== FALSE) {
+			fwrite($f, $newcontent);
+			fclose($f);
+			$location = &quot;theme-editor.php?file=$file&amp;theme=$theme&amp;a=te&quot;;
+		} else {
+			$location = &quot;theme-editor.php?file=$file&amp;theme=$theme&quot;;
+		}
 	} else {
 		$location = &quot;theme-editor.php?file=$file&amp;theme=$theme&quot;;
 	}
@@ -92,7 +94,7 @@ $desc_header = ( $description != $file_show ) ? &quot;$description&lt;/strong&gt; (%s)&quot; : &quot;
 &lt;div class=&quot;bordertitle&quot;&gt;
 	&lt;h2&gt;&lt;?php _e('Theme Editor'); ?&gt;&lt;/h2&gt;
 	&lt;form id=&quot;themeselector&quot; name=&quot;theme&quot; action=&quot;theme-editor.php&quot; method=&quot;post&quot;&gt;
-		&lt;strong&gt;&lt;?php _e('Select theme to edit:'); ?&gt; &lt;/strong&gt;
+		&lt;strong&gt;&lt;label for=&quot;theme&quot;&gt;&lt;?php _e('Select theme to edit:'); ?&gt; &lt;/label&gt;&lt;/strong&gt;
 		&lt;select name=&quot;theme&quot; id=&quot;theme&quot;&gt;
 &lt;?php
 	foreach ($themes as $a_theme) {</diff>
      <filename>wp-admin/theme-editor.php</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,10 @@ if ( isset($_GET['action']) ) {
 
 $title = __('Manage Themes');
 $parent_file = 'themes.php';
+
+add_thickbox();
+wp_enqueue_script( 'theme-preview' );
+
 require_once('admin-header.php');
 ?&gt;
 
@@ -25,16 +29,38 @@ require_once('admin-header.php');
 &lt;?php
 $themes = get_themes();
 $ct = current_theme_info();
+
+ksort( $themes );
+$theme_total = count( $themes );
+$per_page = 15;
+
+if ( isset( $_GET['pagenum'] ) )
+	$page = absint( $_GET['pagenum'] );
+
+if ( empty($page) )
+	$page = 1;
+
+$start = $offset = ( $page - 1 ) * $per_page;
+
+$page_links = paginate_links( array(
+	'base' =&gt; add_query_arg( 'pagenum', '%#%' ) . '#themenav',
+	'format' =&gt; '',
+	'total' =&gt; ceil($theme_total / $per_page),
+	'current' =&gt; $page
+));
+
+$themes = array_slice( $themes, $start, $per_page );
+
 ?&gt;
 
 &lt;div class=&quot;wrap&quot;&gt;
 &lt;h2&gt;&lt;?php _e('Current Theme'); ?&gt;&lt;/h2&gt;
-&lt;div id=&quot;currenttheme&quot;&gt;
+&lt;div id=&quot;current-theme&quot;&gt;
 &lt;?php if ( $ct-&gt;screenshot ) : ?&gt;
-&lt;img src=&quot;&lt;?php echo get_option('siteurl') . '/' . $ct-&gt;stylesheet_dir . '/' . $ct-&gt;screenshot; ?&gt;&quot; alt=&quot;&lt;?php _e('Current theme preview'); ?&gt;&quot; /&gt;
+&lt;img src=&quot;&lt;?php echo WP_CONTENT_URL . $ct-&gt;stylesheet_dir . '/' . $ct-&gt;screenshot; ?&gt;&quot; alt=&quot;&lt;?php _e('Current theme preview'); ?&gt;&quot; /&gt;
 &lt;?php endif; ?&gt;
 &lt;h3&gt;&lt;?php printf(_c('%1$s %2$s by %3$s|1: theme title, 2: theme version, 3: theme author'), $ct-&gt;title, $ct-&gt;version, $ct-&gt;author) ; ?&gt;&lt;/h3&gt;
-&lt;p&gt;&lt;?php echo $ct-&gt;description; ?&gt;&lt;/p&gt;
+&lt;p class=&quot;description&quot;&gt;&lt;?php echo $ct-&gt;description; ?&gt;&lt;/p&gt;
 &lt;?php if ($ct-&gt;parent_theme) { ?&gt;
 	&lt;p&gt;&lt;?php printf(__('The template files are located in &lt;code&gt;%2$s&lt;/code&gt;.  The stylesheet files are located in &lt;code&gt;%3$s&lt;/code&gt;.  &lt;strong&gt;%4$s&lt;/strong&gt; uses templates from &lt;strong&gt;%5$s&lt;/strong&gt;.  Changes made to the templates will affect both themes.'), $ct-&gt;title, $ct-&gt;template_dir, $ct-&gt;stylesheet_dir, $ct-&gt;title, $ct-&gt;parent_theme); ?&gt;&lt;/p&gt;
 &lt;?php } else { ?&gt;
@@ -46,17 +72,42 @@ $ct = current_theme_info();
 &lt;/div&gt;
 
 &lt;h2&gt;&lt;?php _e('Available Themes'); ?&gt;&lt;/h2&gt;
-&lt;?php if ( 1 &lt; count($themes) ) { ?&gt;
+&lt;br class=&quot;clear&quot; /&gt;
+
+&lt;?php if ( $page_links ) : ?&gt;
+&lt;div class=&quot;tablenav&quot;&gt;
+&lt;?php echo &quot;&lt;div class='tablenav-pages'&gt;$page_links&lt;/div&gt;&quot;; ?&gt;
+&lt;br class=&quot;clear&quot; /&gt;
+&lt;/div&gt;
+&lt;br class=&quot;clear&quot; /&gt;
+&lt;?php endif; ?&gt;
 
+&lt;?php if ( 1 &lt; $theme_total ) { ?&gt;
+&lt;table id=&quot;availablethemes&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
 &lt;?php
 $style = '';
 
 $theme_names = array_keys($themes);
 natcasesort($theme_names);
 
-foreach ($theme_names as $theme_name) {
-	if ( $theme_name == $ct-&gt;name )
-		continue;
+$rows = ceil(count($theme_names) / 3);
+for ( $row = 1; $row &lt;= $rows; $row++ )
+	for ( $col = 1; $col &lt;= 3; $col++ )
+		$table[$row][$col] = array_shift($theme_names);
+
+foreach ( $table as $row =&gt; $cols ) {
+?&gt;
+&lt;tr&gt;
+&lt;?php
+foreach ( $cols as $col =&gt; $theme_name ) {
+	$class = array('available-theme');
+	if ( $row == 1 ) $class[] = 'top';
+	if ( $col == 1 ) $class[] = 'left';
+	if ( $row == $rows ) $class[] = 'bottom';
+	if ( $col == 3 ) $class[] = 'right';
+?&gt;
+	&lt;td class=&quot;&lt;?php echo join(' ', $class); ?&gt;&quot;&gt;
+&lt;?php if ( !empty($theme_name) ) :
 	$template = $themes[$theme_name]['Template'];
 	$stylesheet = $themes[$theme_name]['Stylesheet'];
 	$title = $themes[$theme_name]['Title'];
@@ -65,26 +116,44 @@ foreach ($theme_names as $theme_name) {
 	$author = $themes[$theme_name]['Author'];
 	$screenshot = $themes[$theme_name]['Screenshot'];
 	$stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
+	$preview_link = clean_url( get_option('home') . '/');
+	$preview_link = add_query_arg( array('preview' =&gt; 1, 'template' =&gt; $template, 'stylesheet' =&gt; $stylesheet, 'TB_iframe' =&gt; 'true', 'width' =&gt; 600, 'height' =&gt; 400 ), $preview_link );
+	$preview_text = attribute_escape( sprintf( __('Preview of &quot;%s&quot;'), $title ) );
 	$tags = $themes[$theme_name]['Tags'];
+	$thickbox_class = 'thickbox';
 	$activate_link = wp_nonce_url(&quot;themes.php?action=activate&amp;amp;template=&quot;.urlencode($template).&quot;&amp;amp;stylesheet=&quot;.urlencode($stylesheet), 'switch-theme_' . $template);
+	$activate_text = attribute_escape( sprintf( __('Activate &quot;%s&quot;'), $title ) );
 ?&gt;
-&lt;div class=&quot;available-theme&quot;&gt;
-&lt;h3&gt;&lt;a href=&quot;&lt;?php echo $activate_link; ?&gt;&quot;&gt;&lt;?php echo $title; ?&gt;&lt;/a&gt;&lt;/h3&gt;
-
-&lt;a href=&quot;&lt;?php echo $activate_link; ?&gt;&quot; class=&quot;screenshot&quot;&gt;
+		&lt;a href=&quot;&lt;?php echo $activate_link; ?&gt;&quot; class=&quot;&lt;?php echo $thickbox_class; ?&gt; screenshot&quot;&gt;
 &lt;?php if ( $screenshot ) : ?&gt;
-&lt;img src=&quot;&lt;?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?&gt;&quot; alt=&quot;&quot; /&gt;
+			&lt;img src=&quot;&lt;?php echo WP_CONTENT_URL . $stylesheet_dir . '/' . $screenshot; ?&gt;&quot; alt=&quot;&quot; /&gt;
 &lt;?php endif; ?&gt;
-&lt;/a&gt;
-
-&lt;p&gt;&lt;?php echo $description; ?&gt;&lt;/p&gt;
+		&lt;/a&gt;
+		&lt;h3&gt;&lt;a class=&quot;&lt;?php echo $thickbox_class; ?&gt;&quot; href=&quot;&lt;?php echo $activate_link; ?&gt;&quot;&gt;&lt;?php echo $title; ?&gt;&lt;/a&gt;&lt;/h3&gt;
+		&lt;p&gt;&lt;?php echo $description; ?&gt;&lt;/p&gt;
 &lt;?php if ( $tags ) : ?&gt;
-&lt;p&gt;&lt;?php _e('Tags:'); ?&gt; &lt;?php echo join(', ', $tags); ?&gt;&lt;/p&gt;
+		&lt;p&gt;&lt;?php _e('Tags:'); ?&gt; &lt;?php echo join(', ', $tags); ?&gt;&lt;/p&gt;
+		&lt;noscript&gt;&lt;p class=&quot;themeactions&quot;&gt;&lt;a href=&quot;&lt;?php echo $preview_link; ?&gt;&quot; title=&quot;&lt;?php echo $preview_text; ?&gt;&quot;&gt;&lt;?php _e('Preview'); ?&gt;&lt;/a&gt; &lt;a href=&quot;&lt;?php echo $activate_link; ?&gt;&quot; title=&quot;&lt;?php echo $activate_text; ?&gt;&quot;&gt;&lt;?php _e('Activate'); ?&gt;&lt;/a&gt;&lt;/p&gt;&lt;/noscript&gt;
 &lt;?php endif; ?&gt;
+		&lt;div style=&quot;display:none;&quot;&gt;&lt;a class=&quot;previewlink&quot; href=&quot;&lt;?php echo $preview_link; ?&gt;&quot;&gt;&lt;?php echo $preview_text; ?&gt;&lt;/a&gt; &lt;a class=&quot;activatelink&quot; href=&quot;&lt;?php echo $activate_link; ?&gt;&quot;&gt;&lt;?php echo $activate_text; ?&gt;&lt;/a&gt;&lt;/div&gt;
+&lt;?php endif; // end if not empty theme_name ?&gt;
+	&lt;/td&gt;
+&lt;?php } // end foreach $cols ?&gt;
+&lt;/tr&gt;
+&lt;?php } // end foreach $table ?&gt;
+&lt;/table&gt;
+&lt;?php } ?&gt;
+
+&lt;br class=&quot;clear&quot; /&gt;
+
+&lt;?php if ( $page_links ) : ?&gt;
+&lt;div class=&quot;tablenav&quot;&gt;
+&lt;?php echo &quot;&lt;div class='tablenav-pages'&gt;$page_links&lt;/div&gt;&quot;; ?&gt;
+&lt;br class=&quot;clear&quot; /&gt;
 &lt;/div&gt;
-&lt;?php } // end foreach theme_names ?&gt;
+&lt;?php endif; ?&gt;
 
-&lt;?php } ?&gt;
+&lt;br class=&quot;clear&quot; /&gt;
 
 &lt;?php
 // List broken themes, if any.</diff>
      <filename>wp-admin/themes.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 &lt;?php
-require_once('../wp-config.php');
+require_once('../wp-load.php');
 require_once( ABSPATH . 'wp-includes/class-snoopy.php');
 
 if ( !get_option('use_linksupdate') )
@@ -36,9 +36,9 @@ if ( false !== ( $fs = @fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5)
 	$returns = explode(&quot;\n&quot;, $body);
 
 	foreach ($returns as $return) :
-		$time = $wpdb-&gt;escape( substr($return, 0, 19) );
-		$uri = $wpdb-&gt;escape( preg_replace('/(.*?) | (.*?)/', '$2', $return) );
-		$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;links SET link_updated = '$time' WHERE link_url = '$uri'&quot;);
+		$time = substr($return, 0, 19);
+		$uri = preg_replace('/(.*?) | (.*?)/', '$2', $return);
+		$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;links SET link_updated = %s WHERE link_url = %s&quot;, $time, $uri) );
 	endforeach;
 }
 ?&gt;</diff>
      <filename>wp-admin/update-links.php</filename>
    </modified>
    <modified>
      <diff>@@ -2,8 +2,8 @@
 
 require_once('admin.php');
 
-if ( !current_user_can('edit_plugins') )
-                wp_die('&lt;p&gt;'.__('You do not have sufficient permissions to update plugins for this blog.').'&lt;/p&gt;');
+if ( ! current_user_can('update_plugins') )
+	wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
 
 function request_filesystem_credentials($form_post, $type = '', $error = false) {
 	$req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error);
@@ -22,7 +22,7 @@ function request_filesystem_credentials($form_post, $type = '', $error = false)
 	$credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']);
 	$credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']);
 	$credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']);
-	$credentials['ssl']      = defined('FTP_SSL')  ? FTP_SSL  : (!empty($_POST['ssl'])      ? $_POST['ssl']      : $credentials['ssl']);
+	$credentials['ssl']      = defined('FTP_SSL')  ? FTP_SSL  : ( isset($_POST['ssl'])      ? $_POST['ssl']      : $credentials['ssl']);
 
 	if ( ! $error &amp;&amp; !empty($credentials['password']) &amp;&amp; !empty($credentials['username']) &amp;&amp; !empty($credentials['hostname']) ) {
 		$stored_credentials = $credentials;
@@ -45,19 +45,19 @@ function request_filesystem_credentials($form_post, $type = '', $error = false)
 &lt;p&gt;&lt;?php _e('To perform the requested update, FTP connection information is required.') ?&gt;&lt;/p&gt;
 &lt;table class=&quot;form-table&quot;&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Hostname:') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;hostname&quot;&gt;&lt;?php _e('Hostname:') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;hostname&quot; type=&quot;text&quot; id=&quot;hostname&quot; value=&quot;&lt;?php echo attribute_escape($hostname) ?&gt;&quot;&lt;?php if( defined('FTP_HOST') ) echo ' disabled=&quot;disabled&quot;' ?&gt; size=&quot;40&quot; /&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Username:') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;username&quot;&gt;&lt;?php _e('Username:') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;username&quot; type=&quot;text&quot; id=&quot;username&quot; value=&quot;&lt;?php echo attribute_escape($username) ?&gt;&quot;&lt;?php if( defined('FTP_USER') ) echo ' disabled=&quot;disabled&quot;' ?&gt; size=&quot;40&quot; /&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Password:') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;password&quot;&gt;&lt;?php _e('Password:') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;&lt;input name=&quot;password&quot; type=&quot;password&quot; id=&quot;password&quot; value=&quot;&quot;&lt;?php if( defined('FTP_PASS') ) echo ' disabled=&quot;disabled&quot;' ?&gt; size=&quot;40&quot; /&gt;&lt;?php if( defined('FTP_PASS') &amp;&amp; !empty($password) ) echo '&lt;em&gt;'.__('(Password not shown)').'&lt;/em&gt;'; ?&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Use SSL:') ?&gt;&lt;/th&gt;
+&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;ssl&quot;&gt;&lt;?php _e('Use SSL:') ?&gt;&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;
 &lt;select name=&quot;ssl&quot; id=&quot;ssl&quot;&lt;?php if( defined('FTP_SSL') ) echo ' disabled=&quot;disabled&quot;' ?&gt;&gt;
 &lt;?php
@@ -110,15 +110,16 @@ function do_plugin_upgrade($plugin) {
 		return;
 	}
 
-	$was_activated = is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is,
+	$was_activated = is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is
 
 	$result = wp_update_plugin($plugin, 'show_message');
 
 	if ( is_wp_error($result) ) {
 		show_message($result);
+		show_message( __('Installation Failed') );
 	} else {
-		//Result is the new plugin file relative to PLUGINDIR
-		show_message(__('Plugin upgraded successfully'));	
+		//Result is the new plugin file relative to WP_PLUGIN_DIR
+		show_message( __('Plugin upgraded successfully') );	
 		if( $result &amp;&amp; $was_activated ){
 			show_message(__('Attempting reactivation of the plugin'));
 			echo '&lt;iframe style=&quot;border:0&quot; width=&quot;100%&quot; height=&quot;170px&quot; src=&quot;' . wp_nonce_url('update.php?action=activate-plugin&amp;plugin=' . $result, 'activate-plugin_' . $result) .'&quot;&gt;&lt;/iframe&gt;';
@@ -151,8 +152,8 @@ if ( isset($_GET['action']) ) {
 &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;&lt;?php bloginfo('html_type'); ?&gt;; charset=&lt;?php echo get_option('blog_charset'); ?&gt;&quot; /&gt;
 &lt;title&gt;&lt;?php bloginfo('name') ?&gt; &amp;rsaquo; &lt;?php _e('Plugin Reactivation'); ?&gt; &amp;#8212; &lt;?php _e('WordPress'); ?&gt;&lt;/title&gt;
 &lt;?php
-wp_admin_css( 'css/global' );
-wp_admin_css( 'css/colors' );
+wp_admin_css( 'global', true );
+wp_admin_css( 'colors', true );
 ?&gt;
 &lt;/head&gt;
 &lt;body&gt;
@@ -164,7 +165,7 @@ wp_admin_css( 'css/colors' );
 			echo '&lt;p&gt;' . __('Plugin failed to reactivate due to a fatal error.') . '&lt;/p&gt;';
 			error_reporting( E_ALL ^ E_NOTICE );
 			@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
-			include(ABSPATH . PLUGINDIR . '/' . $plugin);
+			include(WP_PLUGIN_DIR . '/' . $plugin);
 		}
 		echo &quot;&lt;/body&gt;&lt;/html&gt;&quot;;
 	}</diff>
      <filename>wp-admin/update.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,7 @@
 &lt;?php
 define('WP_INSTALLING', true);
-if (!file_exists('../wp-config.php'))
-	die(&quot;There doesn't seem to be a &lt;code&gt;wp-config.php&lt;/code&gt; file. I need this before we can get started. Need more help? &lt;a href='http://codex.wordpress.org/Installing_WordPress#Step_3:_Set_up_wp-config.php'&gt;We got it&lt;/a&gt;. You can create a &lt;code&gt;wp-config.php&lt;/code&gt; file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.&lt;/p&gt;&lt;p&gt;&lt;a href='setup-config.php' class='button'&gt;Create a Configuration File&lt;/a&gt;&quot;);
 
-require('../wp-config.php');
+require('../wp-load.php');
 timer_start();
 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
 
@@ -18,7 +16,7 @@ else
 &lt;head&gt;
 	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;&lt;?php bloginfo('html_type'); ?&gt;; charset=&lt;?php echo get_option('blog_charset'); ?&gt;&quot; /&gt;
 	&lt;title&gt;&lt;?php _e('WordPress &amp;rsaquo; Upgrade'); ?&gt;&lt;/title&gt;
-	&lt;?php wp_admin_css( 'css/install' ); ?&gt;
+	&lt;?php wp_admin_css( 'install', true ); ?&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;h1 id=&quot;logo&quot;&gt;&lt;img alt=&quot;WordPress&quot; src=&quot;images/wordpress-logo.png&quot; /&gt;&lt;/h1&gt;
@@ -27,7 +25,7 @@ else
 
 &lt;h2&gt;&lt;?php _e('No Upgrade Required'); ?&gt;&lt;/h2&gt;
 &lt;p&gt;&lt;?php _e('Your WordPress database is already up-to-date!'); ?&gt;&lt;/p&gt;
-&lt;h2 class=&quot;step&quot;&gt;&lt;a href=&quot;&lt;?php echo get_option('home'); ?&gt;/&quot;&gt;&lt;?php _e('Continue'); ?&gt;&lt;/a&gt;&lt;/h2&gt;
+&lt;p class=&quot;step&quot;&gt;&lt;a class=&quot;button&quot; href=&quot;&lt;?php echo get_option('home'); ?&gt;/&quot;&gt;&lt;?php _e('Continue'); ?&gt;&lt;/a&gt;&lt;/p&gt;
 
 &lt;?php else :
 switch($step) :
@@ -39,7 +37,7 @@ switch($step) :
 &lt;h2&gt;&lt;?php _e('Database Upgrade Required'); ?&gt;&lt;/h2&gt;
 &lt;p&gt;&lt;?php _e('Your WordPress database is out-of-date, and must be upgraded before you can continue.'); ?&gt;&lt;/p&gt;
 &lt;p&gt;&lt;?php _e('The upgrade process may take a while, so please be patient.'); ?&gt;&lt;/p&gt;
-&lt;h2 class=&quot;step&quot;&gt;&lt;a href=&quot;upgrade.php?step=1&amp;amp;backto=&lt;?php echo $goback; ?&gt;&quot;&gt;&lt;?php _e('Upgrade WordPress'); ?&gt;&lt;/a&gt;&lt;/h2&gt;
+&lt;p class=&quot;step&quot;&gt;&lt;a class=&quot;button&quot; href=&quot;upgrade.php?step=1&amp;amp;backto=&lt;?php echo $goback; ?&gt;&quot;&gt;&lt;?php _e('Upgrade WordPress'); ?&gt;&lt;/a&gt;&lt;/p&gt;
 &lt;?php
 		break;
 	case 1:
@@ -54,7 +52,7 @@ switch($step) :
 ?&gt;
 &lt;h2&gt;&lt;?php _e('Upgrade Complete'); ?&gt;&lt;/h2&gt;
 	&lt;p&gt;&lt;?php _e('Your WordPress database has been successfully upgraded!'); ?&gt;&lt;/p&gt;
-	&lt;h2 class=&quot;step&quot;&gt;&lt;a href=&quot;&lt;?php echo $backto; ?&gt;&quot;&gt;&lt;?php _e('Continue'); ?&gt;&lt;/a&gt;&lt;/h2&gt;
+	&lt;p class=&quot;step&quot;&gt;&lt;a class=&quot;button&quot; href=&quot;&lt;?php echo $backto; ?&gt;&quot;&gt;&lt;?php _e('Continue'); ?&gt;&lt;/a&gt;&lt;/p&gt;
 
 &lt;!--
 &lt;pre&gt;</diff>
      <filename>wp-admin/upgrade.php</filename>
    </modified>
    <modified>
      <diff>@@ -125,6 +125,7 @@ endif;
 ?&gt;
 
 &lt;p id=&quot;post-search&quot;&gt;
+	&lt;label class=&quot;hidden&quot; for=&quot;post-search-input&quot;&gt;&lt;?php _e( 'Search Media' ); ?&gt;:&lt;/label&gt;
 	&lt;input type=&quot;text&quot; id=&quot;post-search-input&quot; name=&quot;s&quot; value=&quot;&lt;?php the_search_query(); ?&gt;&quot; /&gt;
 	&lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e( 'Search Media' ); ?&gt;&quot; class=&quot;button&quot; /&gt;
 &lt;/p&gt;
@@ -211,7 +212,7 @@ if ( $page_links )
  
 if ( 1 == count($posts) &amp;&amp; is_singular() ) :
 	
-	$comments = $wpdb-&gt;get_results(&quot;SELECT * FROM $wpdb-&gt;comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date&quot;);
+	$comments = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date&quot;, $id) );
 	if ( $comments ) :
 		// Make sure comments, post, and post_author are cached
 		update_comment_cache($comments);</diff>
      <filename>wp-admin/upload.php</filename>
    </modified>
    <modified>
      <diff>@@ -41,6 +41,18 @@ function profile_js ( ) {
 		}
 
 	}
+	
+	function update_nickname ( ) {
+		
+		var nickname = jQuery('#nickname').val();
+		var display_nickname = jQuery('#display_nickname').val();
+		
+		if ( nickname == '' ) {
+			jQuery('#display_nickname').remove();
+		}
+		jQuery('#display_nickname').val(nickname).html(nickname);
+		
+	}
 
 	jQuery(function($) { 
 		$('#pass1').keyup( check_pass_strength ) 
@@ -49,6 +61,7 @@ function profile_js ( ) {
 	
 	jQuery(document).ready( function() {
 		jQuery('#pass1,#pass2').attr('autocomplete','off');
+		jQuery('#nickname').blur(update_nickname);
     });
 &lt;/script&gt;
 &lt;?php
@@ -162,9 +175,9 @@ include ('admin-header.php');
 &lt;?php endif; ?&gt;
 &lt;tr&gt;
 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Admin Color Scheme')?&gt;&lt;/th&gt;
-&lt;td&gt;
+&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;hidden&quot;&gt;&lt;?php _e('Admin Color Scheme')?&gt;&lt;/legend&gt;
 &lt;?php
-$current_color = get_user_option('admin_color');
+$current_color = get_user_option('admin_color', $user_id);
 if ( empty($current_color) )
 	$current_color = 'fresh';
 foreach ( $_wp_admin_css_colors as $color =&gt; $color_info ): ?&gt;
@@ -181,7 +194,7 @@ foreach ( $_wp_admin_css_colors as $color =&gt; $color_info ): ?&gt;
 	&lt;label for=&quot;admin_color_&lt;?php echo $color; ?&gt;&quot;&gt;&lt;?php echo $color_info-&gt;name ?&gt;&lt;/label&gt;
 &lt;/div&gt;
 &lt;?php endforeach; ?&gt;
-&lt;/td&gt;
+&lt;/fieldset&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/table&gt;
 
@@ -245,16 +258,16 @@ echo $role_list . '&lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;';
 		&lt;select name=&quot;display_name&quot; id=&quot;display_name&quot;&gt;
 		&lt;?php
 			$public_display = array();
-			$public_display[] = $profileuser-&gt;display_name;
-			$public_display[] = $profileuser-&gt;nickname;
-			$public_display[] = $profileuser-&gt;user_login;
-			$public_display[] = $profileuser-&gt;first_name;
-			$public_display[] = $profileuser-&gt;first_name.' '.$profileuser-&gt;last_name;
-			$public_display[] = $profileuser-&gt;last_name.' '.$profileuser-&gt;first_name;
+			$public_display['display_displayname'] = $profileuser-&gt;display_name;
+			$public_display['display_nickname'] = $profileuser-&gt;nickname;
+			$public_display['display_username'] = $profileuser-&gt;user_login;
+			$public_display['display_firstname'] = $profileuser-&gt;first_name;
+			$public_display['display_firstlast'] = $profileuser-&gt;first_name.' '.$profileuser-&gt;last_name;
+			$public_display['display_lastfirst'] = $profileuser-&gt;last_name.' '.$profileuser-&gt;first_name;
 			$public_display = array_unique(array_filter(array_map('trim', $public_display)));
-			foreach($public_display as $item) {
+			foreach($public_display as $id =&gt; $item) {
 		?&gt;
-			&lt;option value=&quot;&lt;?php echo $item; ?&gt;&quot;&gt;&lt;?php echo $item; ?&gt;&lt;/option&gt;
+			&lt;option id=&quot;&lt;?php echo $id; ?&gt;&quot; value=&quot;&lt;?php echo $item; ?&gt;&quot;&gt;&lt;?php echo $item; ?&gt;&lt;/option&gt;
 		&lt;?php
 			}
 		?&gt;
@@ -305,11 +318,11 @@ $show_password_fields = apply_filters('show_password_fields', true);
 if ( $show_password_fields ) :
 ?&gt;
 &lt;tr&gt;
-	&lt;th&gt;&lt;label for=&quot;pass1&quot;&gt;&lt;?php _e('New Password:'); ?&gt;&lt;/label&gt;&lt;/th&gt;
+	&lt;th&gt;&lt;label for=&quot;pass1&quot;&gt;&lt;?php _e('New Password'); ?&gt;&lt;/label&gt;&lt;/th&gt;
 	&lt;td&gt;&lt;input type=&quot;password&quot; name=&quot;pass1&quot; id=&quot;pass1&quot; size=&quot;16&quot; value=&quot;&quot; /&gt; &lt;?php _e(&quot;If you would like to change the password type a new one. Otherwise leave this blank.&quot;); ?&gt;&lt;br /&gt;
 		&lt;input type=&quot;password&quot; name=&quot;pass2&quot; id=&quot;pass2&quot; size=&quot;16&quot; value=&quot;&quot; /&gt; &lt;?php _e(&quot;Type your new password again.&quot;); ?&gt;&lt;br /&gt;
 		&lt;?php if ( $is_profile_page ): ?&gt;
-		&lt;p&gt;&lt;strong&gt;&lt;?php _e('Password Strength:'); ?&gt;&lt;/strong&gt;&lt;/p&gt;
+		&lt;p&gt;&lt;strong&gt;&lt;?php _e('Password Strength'); ?&gt;&lt;/strong&gt;&lt;/p&gt;
 		&lt;div id=&quot;pass-strength-result&quot;&gt;&lt;?php _e('Too short'); ?&gt;&lt;/div&gt; &lt;?php _e('Hint: Use upper and lower case characters, numbers and symbols like !&quot;?$%^&amp;amp;( in your password.'); ?&gt;
 		&lt;?php endif; ?&gt;
 	&lt;/td&gt;
@@ -329,7 +342,7 @@ if ( $show_password_fields ) :
 &lt;br class=&quot;clear&quot; /&gt;
 	&lt;table width=&quot;99%&quot; style=&quot;border: none;&quot; cellspacing=&quot;2&quot; cellpadding=&quot;3&quot; class=&quot;editform&quot;&gt;
 		&lt;tr&gt;
-			&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Additional Capabilities:') ?&gt;&lt;/th&gt;
+			&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Additional Capabilities') ?&gt;&lt;/th&gt;
 			&lt;td&gt;&lt;?php
 			$output = '';
 			foreach($profileuser-&gt;caps as $cap =&gt; $value) {</diff>
      <filename>wp-admin/user-edit.php</filename>
    </modified>
    <modified>
      <diff>@@ -145,13 +145,13 @@ case 'delete':
 	?&gt;
 	&lt;/ul&gt;
 &lt;?php if ( $go_delete ) : ?&gt;
-	&lt;p&gt;&lt;?php _e('What should be done with posts and links owned by this user?'); ?&gt;&lt;/p&gt;
+	&lt;fieldset&gt;&lt;p&gt;&lt;legend&gt;&lt;?php _e('What should be done with posts and links owned by this user?'); ?&gt;&lt;/legend&gt;&lt;/p&gt;
 	&lt;ul style=&quot;list-style:none;&quot;&gt;
 		&lt;li&gt;&lt;label&gt;&lt;input type=&quot;radio&quot; id=&quot;delete_option0&quot; name=&quot;delete_option&quot; value=&quot;delete&quot; checked=&quot;checked&quot; /&gt;
 		&lt;?php _e('Delete all posts and links.'); ?&gt;&lt;/label&gt;&lt;/li&gt;
 		&lt;li&gt;&lt;input type=&quot;radio&quot; id=&quot;delete_option1&quot; name=&quot;delete_option&quot; value=&quot;reassign&quot; /&gt;
 		&lt;?php echo '&lt;label for=&quot;delete_option1&quot;&gt;'.__('Attribute all posts and links to:').&quot;&lt;/label&gt; $user_dropdown&quot;; ?&gt;&lt;/li&gt;
-	&lt;/ul&gt;
+	&lt;/ul&gt;&lt;/fieldset&gt;
 	&lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;dodelete&quot; /&gt;
 	&lt;p class=&quot;submit&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;&lt;?php _e('Confirm Deletion'); ?&gt;&quot; class=&quot;button-secondary&quot; /&gt;&lt;/p&gt;
 &lt;?php else : ?&gt;
@@ -287,6 +287,7 @@ unset($role_links);
 ?&gt;
 &lt;/ul&gt;
 	&lt;p id=&quot;post-search&quot;&gt;
+	&lt;label class=&quot;hidden&quot; for=&quot;post-search-input&quot;&gt;&lt;?php _e( 'Search Users' ); ?&gt;:&lt;/label&gt;
 	&lt;input type=&quot;text&quot; id=&quot;post-search-input&quot; name=&quot;usersearch&quot; value=&quot;&lt;?php echo attribute_escape($wp_user_search-&gt;search_term); ?&gt;&quot; /&gt;
 	&lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e( 'Search Users' ); ?&gt;&quot; class=&quot;button&quot; /&gt;
 	&lt;/p&gt;
@@ -299,7 +300,7 @@ unset($role_links);
 
 &lt;div class=&quot;alignleft&quot;&gt;
 &lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e('Delete'); ?&gt;&quot; name=&quot;deleteit&quot; class=&quot;button-secondary delete&quot; /&gt;
-&lt;select name=&quot;new_role&quot;&gt;&lt;option value=''&gt;&lt;?php _e('Change role to&amp;hellip;') ?&gt;&lt;/option&gt;&quot;&lt;?php wp_dropdown_roles(); ?&gt;&lt;/select&gt;
+&lt;label class=&quot;hidden&quot; for=&quot;new_role&quot;&gt;&lt;?php _e('Change role to&amp;hellip;') ?&gt;&lt;/label&gt;&lt;select name=&quot;new_role&quot; id=&quot;new_role&quot;&gt;&lt;option value=''&gt;&lt;?php _e('Change role to&amp;hellip;') ?&gt;&lt;/option&gt;&quot;&lt;?php wp_dropdown_roles(); ?&gt;&lt;/select&gt;
 &lt;input type=&quot;submit&quot; value=&quot;&lt;?php _e('Change'); ?&gt;&quot; name=&quot;changeit&quot; class=&quot;button-secondary&quot; /&gt;
 &lt;?php wp_nonce_field('bulk-users'); ?&gt;
 &lt;/div&gt;
@@ -330,7 +331,7 @@ unset($role_links);
 &lt;table class=&quot;widefat&quot;&gt;
 &lt;thead&gt;
 &lt;tr class=&quot;thead&quot;&gt;
-	&lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; onclick=&quot;checkAll(document.getElementById('posts-filter'));&quot; /&gt; &lt;/th&gt;
+	&lt;th scope=&quot;col&quot; class=&quot;check-column&quot;&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/th&gt;
 	&lt;th&gt;&lt;?php _e('Username') ?&gt;&lt;/th&gt;
 	&lt;th&gt;&lt;?php _e('Name') ?&gt;&lt;/th&gt;
 	&lt;th&gt;&lt;?php _e('E-mail') ?&gt;&lt;/th&gt;
@@ -362,9 +363,9 @@ foreach ( $wp_user_search-&gt;get_results() as $userid ) {
 &lt;br class=&quot;clear&quot; /&gt;
 &lt;/div&gt;
 
-&lt;/form&gt;
 &lt;?php endif; ?&gt;
 
+&lt;/form&gt;
 &lt;/div&gt;
 
 &lt;?php
@@ -378,6 +379,7 @@ foreach ( $wp_user_search-&gt;get_results() as $userid ) {
 ?&gt;
 
 &lt;br class=&quot;clear&quot; /&gt;
+&lt;?php if ( current_user_can('create_users') ) { ?&gt;
 
 &lt;div class=&quot;wrap&quot;&gt;
 &lt;h2 id=&quot;add-new-user&quot;&gt;&lt;?php _e('Add New User') ?&gt;&lt;/h2&gt;
@@ -394,37 +396,37 @@ foreach ( $wp_user_search-&gt;get_results() as $userid ) {
 
 &lt;?php
 	if ( get_option('users_can_register') )
-		echo '&lt;p&gt;' . sprintf(__('Users can &lt;a href=&quot;%1$s&quot;&gt;register themselves&lt;/a&gt; or you can manually create users here.'), get_option('siteurl').'/wp-register.php') . '&lt;/p&gt;';
+		echo '&lt;p&gt;' . sprintf(__('Users can &lt;a href=&quot;%1$s&quot;&gt;register themselves&lt;/a&gt; or you can manually create users here.'), site_url('wp-register.php')) . '&lt;/p&gt;';
 	else
-	        echo '&lt;p&gt;' . sprintf(__('Users cannot currently &lt;a href=&quot;%1$s&quot;&gt;register themselves&lt;/a&gt;, but you can manually create users here.'), get_option('siteurl').'/wp-admin/options-general.php#users_can_register') . '&lt;/p&gt;';
+		echo '&lt;p&gt;' . sprintf(__('Users cannot currently &lt;a href=&quot;%1$s&quot;&gt;register themselves&lt;/a&gt;, but you can manually create users here.'), admin_url('options-general.php#users_can_register')) . '&lt;/p&gt;';
 ?&gt;
 &lt;form action=&quot;#add-new-user&quot; method=&quot;post&quot; name=&quot;adduser&quot; id=&quot;adduser&quot; class=&quot;add:users: validate&quot;&gt;
 &lt;?php wp_nonce_field('add-user') ?&gt;
 &lt;table class=&quot;form-table&quot;&gt;
 	&lt;tr class=&quot;form-field form-required&quot;&gt;
-		&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Username (required)') ?&gt;&lt;input name=&quot;action&quot; type=&quot;hidden&quot; id=&quot;action&quot; value=&quot;adduser&quot; /&gt;&lt;/th&gt;
-		&lt;td &gt;&lt;input name=&quot;user_login&quot; type=&quot;text&quot; id=&quot;user_login&quot; value=&quot;&lt;?php echo $new_user_login; ?&gt;&quot; /&gt;&lt;/td&gt;
+		&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;user_login&quot;&gt;&lt;?php _e('Username (required)') ?&gt;&lt;/label&gt;&lt;input name=&quot;action&quot; type=&quot;hidden&quot; id=&quot;action&quot; value=&quot;adduser&quot; /&gt;&lt;/th&gt;
+		&lt;td &gt;&lt;input name=&quot;user_login&quot; type=&quot;text&quot; id=&quot;user_login&quot; value=&quot;&lt;?php echo $new_user_login; ?&gt;&quot; aria-required=&quot;true&quot; /&gt;&lt;/td&gt;
 	&lt;/tr&gt;
 	&lt;tr class=&quot;form-field&quot;&gt;
-		&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('First Name') ?&gt; &lt;/th&gt;
+		&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;first_name&quot;&gt;&lt;?php _e('First Name') ?&gt; &lt;/label&gt;&lt;/th&gt;
 		&lt;td&gt;&lt;input name=&quot;first_name&quot; type=&quot;text&quot; id=&quot;first_name&quot; value=&quot;&lt;?php echo $new_user_firstname; ?&gt;&quot; /&gt;&lt;/td&gt;
 	&lt;/tr&gt;
 	&lt;tr class=&quot;form-field&quot;&gt;
-		&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Last Name') ?&gt; &lt;/th&gt;
+		&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;last_name&quot;&gt;&lt;?php _e('Last Name') ?&gt; &lt;/label&gt;&lt;/th&gt;
 		&lt;td&gt;&lt;input name=&quot;last_name&quot; type=&quot;text&quot; id=&quot;last_name&quot; value=&quot;&lt;?php echo $new_user_lastname; ?&gt;&quot; /&gt;&lt;/td&gt;
 	&lt;/tr&gt;
 	&lt;tr class=&quot;form-field form-required&quot;&gt;
-		&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('E-mail (required)') ?&gt;&lt;/th&gt;
+		&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;email&quot;&gt;&lt;?php _e('E-mail (required)') ?&gt;&lt;/label&gt;&lt;/th&gt;
 		&lt;td&gt;&lt;input name=&quot;email&quot; type=&quot;text&quot; id=&quot;email&quot; value=&quot;&lt;?php echo $new_user_email; ?&gt;&quot; /&gt;&lt;/td&gt;
 	&lt;/tr&gt;
 	&lt;tr class=&quot;form-field&quot;&gt;
-		&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Website') ?&gt;&lt;/th&gt;
+		&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;url&quot;&gt;&lt;?php _e('Website') ?&gt;&lt;/label&gt;&lt;/th&gt;
 		&lt;td&gt;&lt;input name=&quot;url&quot; type=&quot;text&quot; id=&quot;url&quot; value=&quot;&lt;?php echo $new_user_uri; ?&gt;&quot; /&gt;&lt;/td&gt;
 	&lt;/tr&gt;
 
 &lt;?php if ( apply_filters('show_password_fields', true) ) : ?&gt;
 	&lt;tr class=&quot;form-field form-required&quot;&gt;
-		&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Password (twice)') ?&gt; &lt;/th&gt;
+		&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;pass1&quot;&gt;&lt;?php _e('Password (twice)') ?&gt; &lt;/label&gt;&lt;/th&gt;
 		&lt;td&gt;&lt;input name=&quot;pass1&quot; type=&quot;password&quot; id=&quot;pass1&quot; /&gt;
 		&lt;br /&gt;
 		&lt;input name=&quot;pass2&quot; type=&quot;password&quot; id=&quot;pass2&quot; /&gt;&lt;/td&gt;
@@ -432,7 +434,7 @@ foreach ( $wp_user_search-&gt;get_results() as $userid ) {
 &lt;?php endif; ?&gt;
 
 	&lt;tr class=&quot;form-field&quot;&gt;
-		&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Role'); ?&gt;&lt;/th&gt;
+		&lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;role&quot;&gt;&lt;?php _e('Role'); ?&gt;&lt;/label&gt;&lt;/th&gt;
 		&lt;td&gt;&lt;select name=&quot;role&quot; id=&quot;role&quot;&gt;
 			&lt;?php
 			if ( !$new_user_role )
@@ -452,6 +454,7 @@ foreach ( $wp_user_search-&gt;get_results() as $userid ) {
 &lt;/div&gt;
 
 &lt;?php
+}
 break;
 
 } // end of the $action switch</diff>
      <filename>wp-admin/users.php</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,7 @@ if ( ! current_user_can('switch_themes') )
 	wp_die( __( 'Cheatin&amp;#8217; uh?' ));
 
 wp_enqueue_script( array( 'wp-lists', 'admin-widgets' ) );
+wp_admin_css( 'widgets' );
 
 do_action( 'sidebar_admin_setup' );
 
@@ -18,7 +19,7 @@ if ( isset($_GET['sidebar']) &amp;&amp; isset($wp_registered_sidebars[$_GET['sidebar']])
 	$sidebar = attribute_escape( $_GET['sidebar'] );
 } elseif ( is_array($wp_registered_sidebars) &amp;&amp; !empty($wp_registered_sidebars) ) {
 	// By default we look at the first defined sidebar
-	$sidebar = array_shift( array_keys($wp_registered_sidebars) );
+	$sidebar = array_shift( $keys = array_keys($wp_registered_sidebars) );
 } else {
 	// If no sidebars, die.
 	require_once( 'admin-header.php' );
@@ -134,7 +135,9 @@ if ( isset($_GET['add']) &amp;&amp; $_GET['add'] ) {
 		
 			&lt;ul class=&quot;widget-control-list&quot;&gt;
 				&lt;li class=&quot;widget-list-control-item&quot;&gt;
+					&lt;div class=&quot;widget-top&quot;&gt;
 					&lt;h4 class=&quot;widget-title&quot;&gt;&lt;?php echo $control['name']; ?&gt;&lt;/h4&gt;
+					&lt;/div&gt;
 					&lt;div class=&quot;widget-control&quot; style=&quot;display: block;&quot;&gt;
 	&lt;?php
 						call_user_func_array( $control_callback, $control['params'] );
@@ -232,15 +235,16 @@ if ( isset($_GET['message']) &amp;&amp; isset($messages[$_GET['message']]) ) : ?&gt;
 
 	&lt;h2&gt;&lt;?php _e( 'Widgets' ); ?&gt;&lt;/h2&gt;
 	&lt;p id=&quot;widget-search&quot;&gt;
+		&lt;label class=&quot;hidden&quot; for=&quot;widget-search-input&quot;&gt;&lt;?php _e( 'Search Widgets' ); ?&gt;:&lt;/label&gt;
 		&lt;input type=&quot;text&quot; id=&quot;widget-search-input&quot; name=&quot;s&quot; value=&quot;&lt;?php echo attribute_escape( $widget_search ); ?&gt;&quot; /&gt;
 		&lt;input type=&quot;submit&quot; class=&quot;button&quot; value=&quot;&lt;?php _e( 'Search Widgets' ); ?&gt;&quot; /&gt;
 	&lt;/p&gt;
 
 	&lt;div class=&quot;widget-liquid-left-holder&quot;&gt;
 	&lt;div id=&quot;available-widgets-filter&quot; class=&quot;widget-liquid-left&quot;&gt;
-		&lt;h3&gt;&lt;?php _e('Available Widgets'); ?&gt;&lt;/h3&gt;
+		&lt;h3&gt;&lt;label for=&quot;show&quot;&gt;&lt;?php _e('Available Widgets'); ?&gt;&lt;/label&gt;&lt;/h3&gt;
 		&lt;div class=&quot;nav&quot;&gt;
-			&lt;select name=&quot;show&quot;&gt;
+			&lt;select name=&quot;show&quot; id=&quot;show&quot;&gt;
 &lt;?php foreach ( $show_values as $show_value =&gt; $show_text ) : $show_value = attribute_escape( $show_value ); ?&gt;
 				&lt;option value='&lt;?php echo $show_value; ?&gt;'&lt;?php selected( $show_value, $show ); ?&gt;&gt;&lt;?php echo wp_specialchars( $show_text ); ?&gt;&lt;/option&gt;
 &lt;?php endforeach; ?&gt;
@@ -254,7 +258,7 @@ if ( isset($_GET['message']) &amp;&amp; isset($messages[$_GET['message']]) ) : ?&gt;
 	&lt;/div&gt;
 
 	&lt;div id=&quot;available-sidebars&quot; class=&quot;widget-liquid-right&quot;&gt;
-		&lt;h3&gt;&lt;?php _e('Current Widgets'); ?&gt;&lt;/h3&gt;
+		&lt;h3&gt;&lt;label for=&quot;sidebar-selector&quot;&gt;&lt;?php _e('Current Widgets'); ?&gt;&lt;/label&gt;&lt;/h3&gt;
 
 		&lt;div class=&quot;nav&quot;&gt;
 			&lt;select id=&quot;sidebar-selector&quot; name=&quot;sidebar&quot;&gt;
@@ -317,5 +321,7 @@ if ( isset($_GET['message']) &amp;&amp; isset($messages[$_GET['message']]) ) : ?&gt;
 
 &lt;?php do_action( 'sidebar_admin_page' ); ?&gt;
 
+&lt;br class=&quot;clear&quot; /&gt;
+
 &lt;?php require_once( 'admin-footer.php' ); ?&gt;
 </diff>
      <filename>wp-admin/widgets.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,13 +1,13 @@
-#plugins .name {
+.plugins .name {
 	font-weight: bold;
 }
 
-#plugins p {
+.plugins p {
 	margin: 0 4px;
 	padding: 0;
 }
 
-#plugins .togl {
+.plugins .togl {
 	width: 150px;
 	border-right-width: 1px;
 	border-right-style: solid;
@@ -34,8 +34,8 @@ form#upload #post_content, form#upload #post_title {
 }
 
 .form-invalid input {
-	border-width: 1px; !important
-	border-style: solid; !important
+	border-width: 1px !important;
+	border-style: solid !important;
 }
 
 
@@ -52,28 +52,90 @@ form#upload #post_content {
 	margin: 10px 20px 10px 20px;
 }
 
-.available-theme {
-	width: 30%;
-	margin: 0 1em;
-	float: left;
-	text-align: center;
-	height: 28em;
-	overflow: hidden;
+table#availablethemes {
+	border-spacing: 0px;
+	border: none;
+	border-top: 1px solid #ccc;
+	border-bottom: 1px solid #ccc;
+	margin: 10px auto;
+}
+td.available-theme {
+	vertical-align: top;
+	width: 240px;
+	margin: 0;
+	padding: 20px;
+	text-align: left;
+}
+table#availablethemes td {
+	border: 1px solid #eee;
+	border-top: none;
+}
+table#availablethemes td.top {
+	border-top: none;
+}
+table#availablethemes td.right {
+	border-right: none;
+	border-left: none;
+}
+table#availablethemes td.bottom {
+	border-bottom: none;
+}
+table#availablethemes td.left {
+	border-right: none;
+	border-left: none;
 }
 
 .available-theme a.screenshot {
-	width: 250px;
-	height: 200px;
+	width: 240px;
+	height: 180px;
 	display: block;
-	margin: auto;
+	border: 1px solid #efefef;
 	margin-bottom: 10px;
 	overflow: hidden;
-	border-width: 1px;
-	border-style: solid;
 }
-
 .available-theme img {
-	width: 100%;
+	width: 240px;
+}
+.available-theme h3 {
+	margin: 15px 0 5px;
+}
+
+#current-theme {
+	margin-top: 1em;
+}
+
+#current-theme a {
+	border-bottom: none;
+}
+
+#current-theme h3 {
+	font-size: 17px;
+	font-weight: normal;
+	margin: 0;
+}
+
+#current-theme .description {
+	margin-top: 5px;
+}
+
+#current-theme img {
+	float: left;
+	border: 1px solid #666;
+	margin-right: 1em;
+	margin-bottom: 1.5em;
+	width: 150px;
+}
+
+#TB_window #TB_title a.tb-theme-preview-link,
+#TB_window #TB_title a.tb-theme-preview-link:visited {
+	font-weight: bold;
+	color: #999;
+	text-decoration: none;
+}
+
+#TB_window #TB_title a.tb-theme-preview-link:hover,
+#TB_window #TB_title a.tb-theme-preview-link:focus {
+	color: #ccc;
 }
 
 .checkbox {
@@ -249,15 +311,6 @@ textarea.all-options, input.all-options {
 	border-collapse: separate;
 }
 
-#currenttheme img {
-	float: left;
-	margin-right: 1em;
-	margin-bottom: 1.5em;
-	width: 300px;
-	border-width: 1px;
-	border-style: solid;
-}
-
 #quicktags {
 	padding: 0;
 	border: 0 none;
@@ -394,26 +447,6 @@ set display:none; */
 	height: 22px;
 }
 
-#your-profile fieldset {
-	border-width: 1px;
-	border-style: solid;
-	float: left;
-	width: 40%;
-	padding: .5em 2em 1em;
-	margin: 1em 1em 1em 0;
-}
-
-#your-profile fieldset input {
-	width: 100%;
-	font-size: 20px;
-	padding: 2px;
-}
-
-#your-profile fieldset textarea {
-	width: 100%;
-	padding: 2px;
-}
-
 #your-profile legend {
 	font-family: Georgia, &quot;Times New Roman&quot;, Times, serif;
 	font-size: 22px;
@@ -567,7 +600,7 @@ a.view-comment-post-link {
 	border-top-style: solid;
 }
 
-#wphead a, #dashmenu a, #adminmenu a, #submenu a, #sidemenu a {
+#wphead a, #dashmenu a, #adminmenu a, #submenu a, #sidemenu a, #taglist a, #catlist a {
 	text-decoration: none;
 }
 
@@ -694,7 +727,7 @@ a.view-comment-post-link {
 	padding: 0 0 8px 17px;
 }
 
-#adminmenu li a #awaiting-mod {
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
 	position: absolute;
 	margin-left: -0.4em;
 	margin-top: 0.2em;
@@ -705,7 +738,7 @@ a.view-comment-post-link {
 	width: 1em;
 }
 
-#adminmenu li a .count-0 {
+#adminmenu li a .count-0, #sidemenu li a .count-0 {
 	display: none;
 }
 
@@ -745,11 +778,11 @@ strong .post-com-count {
 	background-position: center -3px;
 }
 
-#adminmenu li a:hover #awaiting-mod {
+#adminmenu li a:hover #awaiting-mod, #sidemenu li a:hover #update-plugins {
 	background-position: -80px bottom;
 }
 
-#adminmenu li a #awaiting-mod span {
+#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
 	top: -0.8em;
 	right: 0;
 	position: absolute;
@@ -879,6 +912,10 @@ html, body {
 	margin-bottom: 6px;
 }
 
+#profile-page .form-table input[type=text] { 
+	width: 300px;
+}
+
 #pass-strength-result {
 	width: 197px;
 	float: left;
@@ -890,6 +927,24 @@ html, body {
 	margin-right: 5px
 }
 
+.form-table .pre {
+	padding: 8px;
+	margin: 0;
+}
+
+.pre {
+	/* http://www.longren.org/2006/09/27/wrapping-text-inside-pre-tags/ */
+	white-space: pre-wrap; /* css-3 */
+	white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
+	white-space: -pre-wrap; /* Opera 4-6 */
+	white-space: -o-pre-wrap; /* Opera 7 */
+	word-wrap: break-word; /* Internet Explorer 5.5+ */
+}
+
+table.form-table td .updated {
+	font-size: 13px;
+}
+
 /* Post Screen */
 
 #tagsdiv #newtag {
@@ -966,6 +1021,7 @@ html, body {
 	font-size: 1.5em;
 	margin-bottom: 15px;
 	padding: 0 0 3px;
+	clear: left;
 }
 
 #poststuff h3 {
@@ -1337,6 +1393,11 @@ p#post-search {
 	vertical-align:text-top;
 }
 
+.defaultavatarpicker .avatar {
+	margin: 2px 0;
+	vertical-align: middle;
+}
+
 body.minwidth {
 	min-width: 808px;
 }
@@ -1436,7 +1497,7 @@ ul.view-switch li.current {
 	background-image: url(images/tail.gif);
 	background-repeat: no-repeat;
 	background-position: 15px bottom;
-	background-color: thansparent;
+	background-color: transparent;
 }
 
 #tTips p#tTips_inside {
@@ -1460,3 +1521,92 @@ td.action-links, th.action-links {
 .hide-if-no-js {
 	display: none;
 }
+
+/* Diff */
+
+table.diff {
+	width: 100%;
+}
+
+table.diff col.content {
+	width: 50%;
+}
+
+table.diff tr {
+	background-color: transparent;
+}
+
+table.diff td, table.diff th {
+	padding: .5em;
+	font-family: monospace;
+	border: none;
+}
+
+table.diff .diff-deletedline del, table.diff .diff-addedline ins {
+	text-decoration: none;
+}
+
+#wp-word-count {
+	display: block;
+}
+
+fieldset {
+	border: 0;
+	padding: 0;
+	margin: 0;
+}
+
+.info-box {
+	top: 100px;
+	left: 50%;
+	margin-left: -225px;
+	height: 300px;
+	width: 450px;
+	border: 5px solid #ddd;
+	background: #f8f8f8;
+	position: absolute;
+	padding: 15px 15px 10px;
+	z-index: 1000;
+	display: none;
+}
+
+.info-box .submit {
+	position: absolute;
+	bottom: 15px;
+	width: 450px;
+	padding: 15px 0 0;
+}
+
+.info-box .gears-img {
+	float: right;
+	margin: 10px;
+}
+
+.info-box-title {
+	line-height: 2;
+	margin: 0;
+	padding: 0 7px;
+}
+
+#wp_editbtns {
+	padding: 2px;
+	position: absolute;
+	display: none;
+	z-index: 999998;
+}
+
+#wp_editimgbtn, #wp_delimgbtn {
+	margin: 2px;
+	padding: 2px;
+	border: 1px solid #999;
+	background-color: #eee;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+#wp_editimgbtn:hover, #wp_delimgbtn:hover {
+	border-color: #555;
+	background-color: #ccc;
+}</diff>
      <filename>wp-admin/wp-admin.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,26 +1,60 @@
 &lt;?php
-/*
- * wp-app.php - Atom Publishing Protocol support for WordPress
- * Original code by: Elias Torres, http://torrez.us/archives/2006/08/31/491/
- * Modified by: Dougal Campbell, http://dougal.gunters.org/
+/**
+ * Atom Publishing Protocol support for WordPress
  *
- * Version: 1.0.5-dc
+ * @author Original by Elias Torres &lt;http://torrez.us/archives/2006/08/31/491/&gt;
+ * @author Modified by Dougal Campbell &lt;http://dougal.gunters.org/&gt;
+ * @version 1.0.5-dc
  */
 
+/**
+ * WordPress is handling an Atom Publishing Protocol request.
+ *
+ * @var bool
+ */
 define('APP_REQUEST', true);
 
-require_once('./wp-config.php');
+/** Set up WordPress environment */
+require_once('./wp-load.php');
+
+/** Post Template API */
 require_once(ABSPATH . WPINC . '/post-template.php');
+
+/** Atom Publishing Protocol Class */
 require_once(ABSPATH . WPINC . '/atomlib.php');
+
+/** Feed Handling API */
 require_once(ABSPATH . WPINC . '/feed.php');
 
 $_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );
 
+/**
+ * Whether to enable Atom Publishing Protocol Logging.
+ *
+ * @name app_logging
+ * @var int|bool
+ */
 $app_logging = 0;
 
-// TODO: Should be an option somewhere
+/**
+ * Whether to always authenticate user. Permanently set to true.
+ *
+ * @name always_authenticate
+ * @var int|bool
+ * @todo Should be an option somewhere
+ */
 $always_authenticate = 1;
 
+/**
+ * log_app() - Writes logging info to a file.
+ *
+ * @uses $app_logging
+ * @package WordPress
+ * @subpackage Logging
+ *
+ * @param string $label Type of logging
+ * @param string $msg Information describing logging reason.
+ */
 function log_app($label,$msg) {
 	global $app_logging;
 	if ($app_logging) {
@@ -32,6 +66,18 @@ function log_app($label,$msg) {
 }
 
 if ( !function_exists('wp_set_current_user') ) :
+/**
+ * wp_set_current_user() - Sets the current WordPress User
+ *
+ * Pluggable function which is also found in pluggable.php.
+ *
+ * @see wp-includes/pluggable.php Documentation for this function.
+ * @uses $current_user Global of current user to test whether $id is the same.
+ *
+ * @param int $id The user's ID
+ * @param string $name Optional. The username of the user.
+ * @return WP_User Current user's User object
+ */
 function wp_set_current_user($id, $name = '') {
 	global $current_user;
 
@@ -44,13 +90,26 @@ function wp_set_current_user($id, $name = '') {
 }
 endif;
 
+/**
+ * wa_posts_where_include_drafts_filter() - Filter to add more post statuses
+ *
+ * @param string $where SQL statement to filter
+ * @return string Filtered SQL statement with added post_status for where clause
+ */
 function wa_posts_where_include_drafts_filter($where) {
-        $where = str_replace(&quot;post_status = 'publish'&quot;,&quot;post_status = 'publish' OR post_status = 'future' OR post_status = 'draft' OR post_status = 'inherit'&quot;, $where);
-        return $where;
+	$where = str_replace(&quot;post_status = 'publish'&quot;,&quot;post_status = 'publish' OR post_status = 'future' OR post_status = 'draft' OR post_status = 'inherit'&quot;, $where);
+	return $where;
 
 }
 add_filter('posts_where', 'wa_posts_where_include_drafts_filter');
 
+/**
+ * @internal
+ * Left undocumented to work on later. If you want to finish, then please do so.
+ *
+ * @package WordPress
+ * @subpackage Publishing
+ */
 class AtomServer {
 
 	var $ATOM_CONTENT_TYPE = 'application/atom+xml';
@@ -113,7 +172,11 @@ class AtomServer {
 	function handle_request() {
 		global $always_authenticate;
 
-		$path = $_SERVER['PATH_INFO'];
+		if( !empty( $_SERVER['ORIG_PATH_INFO'] ) )
+			$path = $_SERVER['ORIG_PATH_INFO'];
+		else
+			$path = $_SERVER['PATH_INFO']; 
+
 		$method = $_SERVER['REQUEST_METHOD'];
 
 		log_app('REQUEST',&quot;$method $path\n================&quot;);
@@ -132,6 +195,10 @@ class AtomServer {
 			$this-&gt;redirect($this-&gt;get_service_url());
 		}
 
+		// check to see if AtomPub is enabled
+		if( !get_option( 'enable_app' ) )
+			$this-&gt;forbidden( sprintf( __( 'AtomPub services are disabled on this blog.  An admin user can enable them at %s' ), admin_url('options-writing.php') ) );
+
 		// dispatch
 		foreach($this-&gt;selectors as $regex =&gt; $funcs) {
 			if(preg_match($regex, $path, $matches)) {
@@ -139,9 +206,7 @@ class AtomServer {
 
 				// authenticate regardless of the operation and set the current
 				// user. each handler will decide if auth is required or not.
-				$this-&gt;authenticate();
-				$u = wp_get_current_user();
-				if(!isset($u) || $u-&gt;ID == 0) {
+				if(!$this-&gt;authenticate()) {
 					if ($always_authenticate) {
 						$this-&gt;auth_required('Credentials required.');
 					}
@@ -170,9 +235,9 @@ class AtomServer {
 		$entries_url = attribute_escape($this-&gt;get_entries_url());
 		$categories_url = attribute_escape($this-&gt;get_categories_url());
 		$media_url = attribute_escape($this-&gt;get_attachments_url());
-                foreach ($this-&gt;media_content_types as $med) {
-                  $accepted_media_types = $accepted_media_types . &quot;&lt;accept&gt;&quot; . $med . &quot;&lt;/accept&gt;&quot;;
-                }
+		foreach ($this-&gt;media_content_types as $med) {
+			$accepted_media_types = $accepted_media_types . &quot;&lt;accept&gt;&quot; . $med . &quot;&lt;/accept&gt;&quot;;
+		}
 		$atom_prefix=&quot;atom&quot;;
 		$atom_blogname=get_bloginfo('name');
 		$service_doc = &lt;&lt;&lt;EOD
@@ -327,6 +392,7 @@ EOD;
 			$this-&gt;auth_required(__('Sorry, you do not have the right to edit this post.'));
 
 		$publish = (isset($parsed-&gt;draft) &amp;&amp; trim($parsed-&gt;draft) == 'yes') ? false : true;
+		$post_status = ($publish) ? 'publish' : 'draft';
 
 		extract($entry);
 
@@ -340,13 +406,6 @@ EOD;
 		$post_modified = $pubtimes[0];
 		$post_modified_gmt = $pubtimes[1];
 
-		// let's not go backwards and make something draft again.
-		if(!$publish &amp;&amp; $post_status == 'draft') {
-			$post_status = ($publish) ? 'publish' : 'draft';
-		} elseif($publish) {
-			$post_status = 'publish';
-		}
-
 		$postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt');
 		$this-&gt;escape($postdata);
 
@@ -872,6 +931,14 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?&gt;
 		exit;
 	}
 
+	function forbidden($reason='') {
+		log_app('Status','403: Forbidden');
+		header('Content-Type: text/plain');
+		status_header('403');
+		echo $reason;
+		exit;
+	}
+
 	function not_found() {
 		log_app('Status','404: Not Found');
 		header('Content-Type: text/plain');
@@ -995,9 +1062,6 @@ EOD;
 	 * Access credential through various methods and perform login
 	 */
 	function authenticate() {
-		$login_data = array();
-		$already_md5 = false;
-
 		log_app(&quot;authenticate()&quot;,print_r($_ENV, true));
 
 		// if using mod_rewrite/ENV hack
@@ -1009,22 +1073,16 @@ EOD;
 
 		// If Basic Auth is working...
 		if(isset($_SERVER['PHP_AUTH_USER']) &amp;&amp; isset($_SERVER['PHP_AUTH_PW'])) {
-			$login_data = array('login' =&gt; $_SERVER['PHP_AUTH_USER'],	'password' =&gt; $_SERVER['PHP_AUTH_PW']);
-			log_app(&quot;Basic Auth&quot;,$login_data['login']);
-		} else {
-			// else, do cookie-based authentication
-			if (function_exists('wp_get_cookie_login')) {
-				$login_data = wp_get_cookie_login();
-				$already_md5 = true;
+			log_app(&quot;Basic Auth&quot;,$_SERVER['PHP_AUTH_USER']);
+			$user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
+			if ( $user &amp;&amp; !is_wp_error($user) ) {
+				wp_set_current_user($user-&gt;ID);
+				log_app(&quot;authenticate()&quot;, $_SERVER['PHP_AUTH_USER']);
+				return true;
 			}
 		}
 
-		// call wp_login and set current user
-		if (!empty($login_data) &amp;&amp; wp_login($login_data['login'], $login_data['password'], $already_md5)) {
-			 $current_user = new WP_User(0, $login_data['login']);
-			 wp_set_current_user($current_user-&gt;ID);
-			log_app(&quot;authenticate()&quot;,$login_data['login']);
-		}
+		return false;
 	}
 
 	function get_accepted_content_type($types = NULL) {</diff>
      <filename>wp-app.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,18 @@
 &lt;?php
+/**
+ * Outputs the Atom feed XML format using the feed-atom.php file in wp-includes
+ * folder. This file only sets the feed format and includes the feed-atom.php.
+ *
+ * This file is no longer used in WordPress and while it is not deprecated now.
+ * This file will most likely be deprecated or removed in a later version.
+ *
+ * The link for the atom feed is /index.php?feed=atom with permalinks off.
+ *
+ * @package WordPress
+ */
 
 if (empty($wp)) {
-	require_once('./wp-config.php');
+	require_once('./wp-load.php');
 	wp('feed=atom');
 }
 </diff>
      <filename>wp-atom.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,24 +1,20 @@
 &lt;?php
+/**
+ * Loads the WordPress environment and template.
+ *
+ * @package WordPress
+ */
 
-if (! isset($wp_did_header)):
-if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
-	if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
-	else $path = 'wp-admin/';
+if ( !isset($wp_did_header) ) {
 
-	require_once( dirname(__FILE__) . '/wp-includes/classes.php');
-	require_once( dirname(__FILE__) . '/wp-includes/functions.php');
-	require_once( dirname(__FILE__) . '/wp-includes/plugin.php');
-	wp_die(&quot;There doesn't seem to be a &lt;code&gt;wp-config.php&lt;/code&gt; file. I need this before we can get started. Need more help? &lt;a href='http://codex.wordpress.org/Editing_wp-config.php'&gt;We got it&lt;/a&gt;. You can create a &lt;code&gt;wp-config.php&lt;/code&gt; file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.&lt;/p&gt;&lt;p&gt;&lt;a href='{$path}setup-config.php' class='button'&gt;Create a Configuration File&lt;/a&gt;&quot;, &quot;WordPress &amp;rsaquo; Error&quot;);
-}
-
-$wp_did_header = true;
+	$wp_did_header = true;
 
-require_once( dirname(__FILE__) . '/wp-config.php');
+	require_once( dirname(__FILE__) . '/wp-load.php' );
 
-wp();
+	wp();
 
-require_once(ABSPATH . WPINC . '/template-loader.php');
+	require_once( ABSPATH . WPINC . '/template-loader.php' );
 
-endif;
+}
 
-?&gt;
+?&gt;
\ No newline at end of file</diff>
      <filename>wp-blog-header.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,17 +1,25 @@
 &lt;?php
+/**
+ * Handles Comment Post to WordPress and prevents duplicate comment posting.
+ *
+ * @package WordPress
+ */
+
 if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) {
 	header('Allow: POST');
 	header('HTTP/1.1 405 Method Not Allowed');
 	header('Content-Type: text/plain');
 	exit;
 }
-require( dirname(__FILE__) . '/wp-config.php' );
+
+/** Sets up the WordPress Environment. */
+require( dirname(__FILE__) . '/wp-load.php' );
 
 nocache_headers();
 
 $comment_post_ID = (int) $_POST['comment_post_ID'];
 
-$status = $wpdb-&gt;get_row(&quot;SELECT post_status, comment_status FROM $wpdb-&gt;posts WHERE ID = '$comment_post_ID'&quot;);
+$status = $wpdb-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT post_status, comment_status FROM $wpdb-&gt;posts WHERE ID = %d&quot;, $comment_post_ID) );
 
 if ( empty($status-&gt;comment_status) ) {
 	do_action('comment_id_not_found', $comment_post_ID);</diff>
      <filename>wp-comments-post.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,20 @@
 &lt;?php
+/**
+ * Outputs the RSS2 XML format comment feed using the feed-rss2.php file in
+ * wp-includes folder. This file only sets the feed format and includes the
+ * feed-rss2-comments.php.
+ *
+ * This file is no longer used in WordPress and while it is not deprecated now.
+ * This file will most likely be deprecated or removed in a later version.
+ *
+ * The link for the rss2 comment feed is /index.php?feed=rss2&amp;withcomments=1
+ * with permalinks off.
+ *
+ * @package WordPress
+ */
 
 if (empty($wp)) {
-	require_once('./wp-config.php');
+	require_once('./wp-load.php');
 	wp('feed=rss2&amp;withcomments=1');
 }
 </diff>
      <filename>wp-commentsrss2.php</filename>
    </modified>
    <modified>
      <diff>@@ -7,10 +7,12 @@ define('DB_HOST', 'localhost');    // 99% chance you won't need to change this v
 define('DB_CHARSET', 'utf8');
 define('DB_COLLATE', '');
 
-// Change SECRET_KEY to a unique phrase.  You won't have to remember it later,
-// so make it long and complicated.  You can visit https://www.grc.com/passwords.htm
-// to get a phrase generated for you, or just make something up.
-define('SECRET_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
+// Change each KEY to a different unique phrase.  You won't have to remember the phrases later,
+// so make them long and complicated.  You can visit http://api.wordpress.org/secret-key/1.1/
+// to get keys generated for you, or just make something up.  Each key should have a different phrase.
+define('AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
+define('SECURE_AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
+define('LOGGED_IN_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
 
 // You can have multiple installations in one database if you give each a unique prefix
 $table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!
@@ -23,6 +25,7 @@ define ('WPLANG', '');
 
 /* That's all, stop editing! Happy blogging. */
 
-define('ABSPATH', dirname(__FILE__).'/');
-require_once(ABSPATH.'wp-settings.php');
+if ( !defined('ABSPATH') )
+	define('ABSPATH', dirname(__FILE__) . '/');
+require_once(ABSPATH . 'wp-settings.php');
 ?&gt;</diff>
      <filename>wp-config-sample.php</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@
 Plugin Name: Akismet
 Plugin URI: http://akismet.com/
 Description: Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need a &lt;a href=&quot;http://wordpress.com/api-keys/&quot;&gt;WordPress.com API key&lt;/a&gt; to use it. You can review the spam it catches under &quot;Comments.&quot; To show off your Akismet stats just put &lt;code&gt;&amp;lt;?php akismet_counter(); ?&gt;&lt;/code&gt; in your template. See also: &lt;a href=&quot;http://wordpress.org/extend/plugins/stats/&quot;&gt;WP Stats plugin&lt;/a&gt;.
-Version: 2.1.4
+Version: 2.1.6
 Author: Matt Mullenweg
 Author URI: http://photomatt.net/
 */
@@ -271,7 +271,12 @@ function akismet_spam_count( $type = false ) {
 	if ( !$type ) { // total
 		$count = wp_cache_get( 'akismet_spam_count', 'widget' );
 		if ( false === $count ) {
-			$count = (int) $wpdb-&gt;get_var(&quot;SELECT COUNT(comment_ID) FROM $wpdb-&gt;comments WHERE comment_approved = 'spam'&quot;);
+			if ( function_exists('wp_count_comments') ) {
+				$count = wp_count_comments();
+				$count = $count-&gt;spam;
+			} else {
+				$count = (int) $wpdb-&gt;get_var(&quot;SELECT COUNT(comment_ID) FROM $wpdb-&gt;comments WHERE comment_approved = 'spam'&quot;);
+			}
 			wp_cache_set( 'akismet_spam_count', $count, 'widget', 3600 );
 		}
 		return $count;
@@ -475,7 +480,7 @@ if ( isset( $_POST['s'] ) ) {
 	if ( isset( $_GET['ctype'] ) )
 		$current_type = preg_replace( '|[^a-z]|', '', $_GET['ctype'] );
 
-	$comments = akismet_spam_comments( $current_type );
+	$comments = akismet_spam_comments( $current_type, $page );
 	$total = akismet_spam_count( $current_type );
 	$totals = akismet_spam_totals();
 ?&gt;
@@ -701,11 +706,9 @@ if ( 'moderation.php' == $pagenow ) {
 
 // For WP &gt;= 2.5
 function akismet_check_for_spam_button($comment_status) {
-	if ( 'moderated' != $comment_status )
+	if ( 'approved' == $comment_status )
 		return;
-	$count = wp_count_comments();
-	if ( !empty($count-&gt;moderated ) )
-		echo &quot;&lt;a href='edit-comments.php?page=akismet-admin&amp;amp;recheckqueue=true&amp;amp;noheader=true'&gt;&quot; . __('Check for Spam') . &quot;&lt;/a&gt;&quot;;
+	echo &quot;&lt;/div&gt;&lt;div class='alignleft'&gt;&lt;a class='button-secondary checkforspam' href='edit-comments.php?page=akismet-admin&amp;amp;recheckqueue=true&amp;amp;noheader=true'&gt;&quot; . __('Check for Spam') . &quot;&lt;/a&gt;&quot;;
 }
 add_action('manage_comments_nav', 'akismet_check_for_spam_button');
 </diff>
      <filename>wp-content/plugins/akismet/akismet.php</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/#
 Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from &lt;cite&gt;Hello, Dolly&lt;/cite&gt; in the upper right of your admin screen on every page.
 Author: Matt Mullenweg
 Version: 1.5
-Author URI: http://photomatt.net/
+Author URI: http://ma.tt/
 */
 
 // These are the lyrics to Hello Dolly</diff>
      <filename>wp-content/plugins/hello.php</filename>
    </modified>
    <modified>
      <diff>@@ -27,6 +27,6 @@ get_header();
 &lt;p&gt;&lt;?php _e('Sorry, no posts matched your criteria.'); ?&gt;&lt;/p&gt;
 &lt;?php endif; ?&gt;
 
-&lt;?php posts_nav_link(' &amp;#8212; ', __('&amp;laquo; Older Posts'), __('Newer Posts &amp;raquo;')); ?&gt;
+&lt;?php posts_nav_link(' &amp;#8212; ', __('&amp;laquo; Newer Posts'), __('Older Posts &amp;raquo;')); ?&gt;
 
 &lt;?php get_footer(); ?&gt;</diff>
      <filename>wp-content/themes/classic/index.php</filename>
    </modified>
    <modified>
      <diff>@@ -319,3 +319,45 @@ ul.post-meta span.post-meta-key {
 	font-style: normal;
 	text-transform: capitalize;
 }
+
+/* Captions &amp; aligment */
+.aligncenter,
+div.aligncenter {
+	display: block;
+	margin-left: auto;
+	margin-right: auto;
+}
+
+.alignleft {
+	float: left;
+}
+
+.alignright {
+	float: right;
+}
+
+.wp-caption {
+	border: 1px solid #ddd;
+	text-align: center;
+	background-color: #f3f3f3;
+	padding-top: 4px;
+	margin: 10px;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+.wp-caption img {
+	margin: 0;
+	padding: 0;
+	border: 0 none;
+}
+
+.wp-caption p.wp-caption-text {
+	font-size: 11px;
+	line-height: 17px;
+	padding: 0 4px 5px;
+	margin: 0;
+}
+/* End captions &amp; aligment */</diff>
      <filename>wp-content/themes/classic/style.css</filename>
    </modified>
    <modified>
      <diff>@@ -78,10 +78,10 @@
 
 &lt;?php else : ?&gt;
 
-&lt;p&gt;&lt;input type=&quot;text&quot; name=&quot;author&quot; id=&quot;author&quot; value=&quot;&lt;?php echo $comment_author; ?&gt;&quot; size=&quot;22&quot; tabindex=&quot;1&quot; /&gt;
+&lt;p&gt;&lt;input type=&quot;text&quot; name=&quot;author&quot; id=&quot;author&quot; value=&quot;&lt;?php echo $comment_author; ?&gt;&quot; size=&quot;22&quot; tabindex=&quot;1&quot; &lt;?php if ($req) echo &quot;aria-required='true'&quot;; ?&gt; /&gt;
 &lt;label for=&quot;author&quot;&gt;&lt;small&gt;Name &lt;?php if ($req) echo &quot;(required)&quot;; ?&gt;&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;
 
-&lt;p&gt;&lt;input type=&quot;text&quot; name=&quot;email&quot; id=&quot;email&quot; value=&quot;&lt;?php echo $comment_author_email; ?&gt;&quot; size=&quot;22&quot; tabindex=&quot;2&quot; /&gt;
+&lt;p&gt;&lt;input type=&quot;text&quot; name=&quot;email&quot; id=&quot;email&quot; value=&quot;&lt;?php echo $comment_author_email; ?&gt;&quot; size=&quot;22&quot; tabindex=&quot;2&quot; &lt;?php if ($req) echo &quot;aria-required='true'&quot;; ?&gt; /&gt;
 &lt;label for=&quot;email&quot;&gt;&lt;small&gt;Mail (will not be published) &lt;?php if ($req) echo &quot;(required)&quot;; ?&gt;&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;
 
 &lt;p&gt;&lt;input type=&quot;text&quot; name=&quot;url&quot; id=&quot;url&quot; value=&quot;&lt;?php echo $comment_author_url; ?&gt;&quot; size=&quot;22&quot; tabindex=&quot;3&quot; /&gt;</diff>
      <filename>wp-content/themes/default/comments.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,77 +1,77 @@
-&lt;?php
+&lt;?php
 
-$img = 'kubrickheader.jpg';
+$img = 'kubrickheader.jpg';
 
-// If we don't have image processing support, redirect.
-if ( ! function_exists('imagecreatefromjpeg') )
-	die(header(&quot;Location: kubrickheader.jpg&quot;));
+// If we don't have image processing support, redirect.
+if ( ! function_exists('imagecreatefromjpeg') )
+	die(header(&quot;Location: kubrickheader.jpg&quot;));
 
-// Assign and validate the color values
-$default = false;
-$vars = array('upper'=&gt;array('r1', 'g1', 'b1'), 'lower'=&gt;array('r2', 'g2', 'b2'));
-foreach ( $vars as $var =&gt; $subvars ) {
-	if ( isset($_GET[$var]) ) {
-		foreach ( $subvars as $index =&gt; $subvar ) {
-			$length = strlen($_GET[$var]) / 3;
-			$v = substr($_GET[$var], $index * $length, $length);
-			if ( $length == 1 ) $v = '' . $v . $v;
-			$$subvar = hexdec( $v );
-			if ( $$subvar &lt; 0 || $$subvar &gt; 255 )
-				$default = true;
-		}
-	} else {
-		$default = true;
-	}
-}
+// Assign and validate the color values
+$default = false;
+$vars = array('upper'=&gt;array('r1', 'g1', 'b1'), 'lower'=&gt;array('r2', 'g2', 'b2'));
+foreach ( $vars as $var =&gt; $subvars ) {
+	if ( isset($_GET[$var]) ) {
+		foreach ( $subvars as $index =&gt; $subvar ) {
+			$length = strlen($_GET[$var]) / 3;
+			$v = substr($_GET[$var], $index * $length, $length);
+			if ( $length == 1 ) $v = '' . $v . $v;
+			$$subvar = hexdec( $v );
+			if ( $$subvar &lt; 0 || $$subvar &gt; 255 )
+				$default = true;
+		}
+	} else {
+		$default = true;
+	}
+}
 
-if ( $default )
-	list ( $r1, $g1, $b1, $r2, $g2, $b2 ) = array ( 105, 174, 231, 65, 128, 182 );
+if ( $default )
+	list ( $r1, $g1, $b1, $r2, $g2, $b2 ) = array ( 105, 174, 231, 65, 128, 182 );
 
-// Create the image
-$im = imagecreatefromjpeg($img);
+// Create the image
+$im = imagecreatefromjpeg($img);
 
-// Get the background color, define the rectangle height
-$white = imagecolorat( $im, 15, 15 );
-$h = 182;
+// Get the background color, define the rectangle height
+$white = imagecolorat( $im, 15, 15 );
+$h = 182;
 
-// Define the boundaries of the rounded edges ( y =&gt; array ( x1, x2 ) )
-$corners = array(
-	0 =&gt; array ( 25, 734 ),
-	1 =&gt; array ( 23, 736 ),
-	2 =&gt; array ( 22, 737 ),
-	3 =&gt; array ( 21, 738 ),
-	4 =&gt; array ( 21, 738 ),
-	177 =&gt; array ( 21, 738 ),
-	178 =&gt; array ( 21, 738 ),
-	179 =&gt; array ( 22, 737 ),
-	180 =&gt; array ( 23, 736 ),
-	181 =&gt; array ( 25, 734 ),
-	);
+// Define the boundaries of the rounded edges ( y =&gt; array ( x1, x2 ) )
+$corners = array(
+	0 =&gt; array ( 25, 734 ),
+	1 =&gt; array ( 23, 736 ),
+	2 =&gt; array ( 22, 737 ),
+	3 =&gt; array ( 21, 738 ),
+	4 =&gt; array ( 21, 738 ),
+	177 =&gt; array ( 21, 738 ),
+	178 =&gt; array ( 21, 738 ),
+	179 =&gt; array ( 22, 737 ),
+	180 =&gt; array ( 23, 736 ),
+	181 =&gt; array ( 25, 734 ),
+	);
 
-// Blank out the blue thing
-for ( $i = 0; $i &lt; $h; $i++ ) {
-	$x1 = 19;
-	$x2 = 740;
-	imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white );
-}
+// Blank out the blue thing
+for ( $i = 0; $i &lt; $h; $i++ ) {
+	$x1 = 19;
+	$x2 = 740;
+	imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white );
+}
 
-// Draw a new color thing
-for ( $i = 0; $i &lt; $h; $i++ ) {
-	$x1 = 20;
-	$x2 = 739;
-	$r = ( $r2 - $r1 != 0 ) ? $r1 + ( $r2 - $r1 ) * ( $i / $h ) : $r1;
-	$g = ( $g2 - $g1 != 0 ) ? $g1 + ( $g2 - $g1 ) * ( $i / $h ) : $g1;
-	$b = ( $b2 - $b1 != 0 ) ? $b1 + ( $b2 - $b1 ) * ( $i / $h ) : $b1;
-	$color = imagecolorallocate( $im, $r, $g, $b );
-	if ( array_key_exists($i, $corners) ) {
-		imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white );
-		list ( $x1, $x2 ) = $corners[$i];
-	}
-	imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $color );
-}
+// Draw a new color thing
+for ( $i = 0; $i &lt; $h; $i++ ) {
+	$x1 = 20;
+	$x2 = 739;
+	$r = ( $r2 - $r1 != 0 ) ? $r1 + ( $r2 - $r1 ) * ( $i / $h ) : $r1;
+	$g = ( $g2 - $g1 != 0 ) ? $g1 + ( $g2 - $g1 ) * ( $i / $h ) : $g1;
+	$b = ( $b2 - $b1 != 0 ) ? $b1 + ( $b2 - $b1 ) * ( $i / $h ) : $b1;
+	$color = imagecolorallocate( $im, $r, $g, $b );
+	if ( array_key_exists($i, $corners) ) {
+		imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white );
+		list ( $x1, $x2 ) = $corners[$i];
+	}
+	imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $color );
+}
 
-//die;
-header(&quot;Content-Type: image/jpeg&quot;);
-imagejpeg($im, '', 92);
-imagedestroy($im);
-?&gt;
+//die;
+header(&quot;Content-Type: image/jpeg&quot;);
+imagejpeg($im, '', 92);
+imagedestroy($im);
+?&gt;</diff>
      <filename>wp-content/themes/default/images/header-img.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
 &lt;form method=&quot;get&quot; id=&quot;searchform&quot; action=&quot;&lt;?php bloginfo('url'); ?&gt;/&quot;&gt;
+&lt;label class=&quot;hidden&quot; for=&quot;s&quot;&gt;&lt;?php _e('Search for:'); ?&gt;&lt;/label&gt;
 &lt;div&gt;&lt;input type=&quot;text&quot; value=&quot;&lt;?php the_search_query(); ?&gt;&quot; name=&quot;s&quot; id=&quot;s&quot; /&gt;
 &lt;input type=&quot;submit&quot; id=&quot;searchsubmit&quot; value=&quot;Search&quot; /&gt;
 &lt;/div&gt;</diff>
      <filename>wp-content/themes/default/searchform.php</filename>
    </modified>
    <modified>
      <diff>@@ -45,7 +45,7 @@
 							// Neither Comments, nor Pings are open ?&gt;
 							Both comments and pings are currently closed.
 
-						&lt;?php } edit_post_link('Edit this entry.','',''); ?&gt;
+						&lt;?php } edit_post_link('Edit this entry','','.'); ?&gt;
 
 					&lt;/small&gt;
 				&lt;/p&gt;</diff>
      <filename>wp-content/themes/default/single.php</filename>
    </modified>
    <modified>
      <diff>@@ -290,7 +290,7 @@ body {
 }
 
 .postmetadata {
-	clear: left;
+	clear: both;
 }
 
 .clear {
@@ -616,6 +616,10 @@ blockquote cite {
 	text-align: center;
 	}
 
+.hidden {
+	display: none;
+	}
+
 hr {
 	display: none;
 	}
@@ -634,6 +638,41 @@ a img {
 
 
 
+/* Captions */
+.aligncenter,
+div.aligncenter {
+	display: block;
+	margin-left: auto;
+	margin-right: auto;
+}
+
+.wp-caption {
+	border: 1px solid #ddd;
+	text-align: center;
+	background-color: #f3f3f3;
+	padding-top: 4px;
+	margin: 10px;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+.wp-caption img {
+	margin: 0;
+	padding: 0;
+	border: 0 none;
+}
+
+.wp-caption p.wp-caption-text {
+	font-size: 11px;
+	line-height: 17px;
+	padding: 0 4px 5px;
+	margin: 0;
+}
+/* End captions */
+
+
 /* &quot;Daisy, Daisy, give me your answer do. I'm half crazy all for the love of you.
 	It won't be a stylish marriage, I can't afford a carriage.
 	But you'll look sweet upon the seat of a bicycle built for two.&quot; */</diff>
      <filename>wp-content/themes/default/style.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,24 @@
 &lt;?php
+/**
+ * WordPress Cron Implementation for hosts, which do not offer CRON or for which
+ * the user has not setup a CRON job pointing to this file.
+ *
+ * The HTTP request to this file will not slow down the visitor who happens to
+ * visit when the cron job is needed to run.
+ *
+ * @package WordPress
+ */
+
 ignore_user_abort(true);
-define('DOING_CRON', TRUE);
-require_once('./wp-config.php');
+
+/**
+ * Tell WordPress we are doing the CRON task.
+ *
+ * @var bool
+ */
+define('DOING_CRON', true);
+/** Setup WordPress environment */
+require_once('./wp-load.php');
 
 if ( $_GET['check'] != wp_hash('187425') )
 	exit;
@@ -15,6 +32,7 @@ $crons = _get_cron_array();
 $keys = array_keys($crons);
 if (!is_array($crons) || $keys[0] &gt; time())
 	return;
+
 foreach ($crons as $timestamp =&gt; $cronhooks) {
 	if ($timestamp &gt; time()) break;
 	foreach ($cronhooks as $hook =&gt; $keys) {
@@ -32,4 +50,4 @@ foreach ($crons as $timestamp =&gt; $cronhooks) {
 
 update_option('doing_cron', 0);
 
-?&gt;
+?&gt;
\ No newline at end of file</diff>
      <filename>wp-cron.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,18 @@
 &lt;?php
+/**
+ * Outputs the RSS2 feed XML format. This file is a shortcut or compatibility
+ * layer for easily finding the RSS feed for the site. It loads WordPress using
+ * the wp-blog-header.php file and running do_feed() function.
+ *
+ * @see do_feed() Used to display the RSS2 feed
+ *
+ * This file is no longer used in WordPress and while it is not deprecated now.
+ * This file will most likely be deprecated or removed in a later version.
+ *
+ * The link for the rss2 feed is /index.php?feed=rss2 with permalinks off.
+ *
+ * @package WordPress
+ */
 
 if (empty($doing_rss)) {
 	$doing_rss = 1;</diff>
      <filename>wp-feed.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,12 @@
 &lt;?php
-/*
+/**
  * Atom Syndication Format PHP Library
  *
  * @package AtomLib
  * @link http://code.google.com/p/phpatomlib/
  *
- * @author: Elias Torres &lt;elias@torrez.us&gt;
- * @version: 0.4
+ * @author Elias Torres &lt;elias@torrez.us&gt;
+ * @version 0.4
  * @since 2.3
  */
 </diff>
      <filename>wp-includes/atomlib.php</filename>
    </modified>
    <modified>
      <diff>@@ -2,12 +2,16 @@
 /**
  * Author Template functions for use in themes.
  *
+ * These functions must be used within the WordPress Loop.
+ *
+ * @link http://codex.wordpress.org/Author_Templates
+ *
  * @package WordPress
  * @subpackage Template
  */
 
 /**
- * get_the_author() - Get the author of the current post in the Loop.
+ * Retrieve the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -22,21 +26,22 @@ function get_the_author($deprecated = '') {
 }
 
 /**
- * the_author() - Echo the name of the author of the current post in the Loop.
+ * Display the name of the author of the current post.
  *
- * The behavior of this function is based off of old functionality predating get_the_author().
- * This function is not deprecated, but is designed to echo the value from get_the_author()
- * and as an result of any old theme that might still use the old behavior will also
- * pass the value from get_the_author().
+ * The behavior of this function is based off of old functionality predating
+ * get_the_author(). This function is not deprecated, but is designed to echo
+ * the value from get_the_author() and as an result of any old theme that might
+ * still use the old behavior will also pass the value from get_the_author().
  *
- * The normal, expected behavior of this function is to echo the author and not return it.
- * However, backwards compatiability has to be maintained.
+ * The normal, expected behavior of this function is to echo the author and not
+ * return it. However, backwards compatiability has to be maintained.
  *
  * @since 0.71
  * @see get_the_author()
+ * @link http://codex.wordpress.org/Template_Tags/the_author
  *
  * @param string $deprecated Deprecated.
- * @param string $deprecated_echo Echo the string or return it. Deprecated, use get_the_author().
+ * @param string $deprecated_echo Echo the string or return it.
  * @return string The author's display name, from get_the_author().
  */
 function the_author($deprecated = '', $deprecated_echo = true) {
@@ -46,7 +51,7 @@ function the_author($deprecated = '', $deprecated_echo = true) {
 }
 
 /**
- * get_the_author_description() - Get the description of the author of the current post in the Loop.
+ * Retrieve the description of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -58,8 +63,9 @@ function get_the_author_description() {
 }
 
 /**
- * the_author_description() - Echo the description of the author of the current post in the Loop.
+ * Display the description of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_description
  * @since 1.0.0
  * @see get_the_author_description()
  */
@@ -68,7 +74,7 @@ function the_author_description() {
 }
 
 /**
- * get_the_author_login() - Get the login name of the author of the current post in the Loop.
+ * Retrieve the login name of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -80,8 +86,9 @@ function get_the_author_login() {
 }
 
 /**
- * the_author_login() - Echo the login name of the author of the current post in the Loop.
+ * Display the login name of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_login
  * @since 0.71
  * @see get_the_author_login()
  */
@@ -90,7 +97,7 @@ function the_author_login() {
 }
 
 /**
- * get_the_author_firstname() - Get the first name of the author of the current post in the Loop.
+ * Retrieve the first name of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -102,8 +109,9 @@ function get_the_author_firstname() {
 }
 
 /**
- * the_author_firstname() - Echo the first name of the author of the current post in the Loop.
+ * Display the first name of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_firstname
  * @since 0.71
  * @uses get_the_author_firstname()
  */
@@ -112,7 +120,7 @@ function the_author_firstname() {
 }
 
 /**
- * get_the_author_lastname() - Get the last name of the author of the current post in the Loop.
+ * Retrieve the last name of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -124,8 +132,9 @@ function get_the_author_lastname() {
 }
 
 /**
- * the_author_lastname() - Echo the last name of the author of the current post in the Loop.
+ * Display the last name of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_lastname
  * @since 0.71
  * @uses get_the_author_lastname()
  */
@@ -134,7 +143,7 @@ function the_author_lastname() {
 }
 
 /**
- * get_the_author_nickname() - Get the nickname of the author of the current post in the Loop.
+ * Retrieve the nickname of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -146,8 +155,9 @@ function get_the_author_nickname() {
 }
 
 /**
- * the_author_nickname() - Echo the nickname of the author of the current post in the Loop.
+ * Display the nickname of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_nickname
  * @since 0.71
  * @uses get_the_author_nickname()
  */
@@ -156,7 +166,7 @@ function the_author_nickname() {
 }
 
 /**
- * get_the_author_ID() - Get the ID of the author of the current post in the Loop.
+ * Retrieve the ID of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -168,8 +178,9 @@ function get_the_author_ID() {
 }
 
 /**
- * the_author_ID() - Echo the ID of the author of the current post in the Loop.
+ * Display the ID of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_ID
  * @since 0.71
  * @uses get_the_author_ID()
  */
@@ -178,7 +189,7 @@ function the_author_ID() {
 }
 
 /**
- * get_the_author_email() - Get the email of the author of the current post in the Loop.
+ * Retrieve the email of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -190,8 +201,9 @@ function get_the_author_email() {
 }
 
 /**
- * the_author_email() - Echo the email of the author of the current post in the Loop.
+ * Display the email of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_email
  * @since 0.71
  * @uses get_the_author_email()
  */
@@ -200,7 +212,7 @@ function the_author_email() {
 }
 
 /**
- * get_the_author_url() - Get the URL to the home page of the author of the current post in the Loop.
+ * Retrieve the URL to the home page of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -216,8 +228,9 @@ function get_the_author_url() {
 }
 
 /**
- * the_author_url() - Echo the URL to the home page of the author of the current post in the Loop.
+ * Display the URL to the home page of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_url
  * @since 0.71
  * @uses get_the_author_url()
  */
@@ -226,8 +239,12 @@ function the_author_url() {
 }
 
 /**
- * the_author_link() - If the author has a home page set, echo an HTML link, otherwise just echo the author's name.
+ * Display either author's link or author's name.
+ *
+ * If the author has a home page set, echo an HTML link, otherwise just echo the
+ * author's name.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_link
  * @since 2.1
  * @uses get_the_author_url()
  * @uses the_author()
@@ -241,7 +258,7 @@ function the_author_link() {
 }
 
 /**
- * get_the_author_icq() - Get the ICQ number of the author of the current post in the Loop.
+ * Retrieve the ICQ number of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -253,8 +270,9 @@ function get_the_author_icq() {
 }
 
 /**
- * the_author_icq() - Echo the ICQ number of the author of the current post in the Loop.
+ * Display the ICQ number of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_icq
  * @since 0.71
  * @see get_the_author_icq()
  */
@@ -263,7 +281,7 @@ function the_author_icq() {
 }
 
 /**
- * get_the_author_aim() - Get the AIM name of the author of the current post in the Loop.
+ * Retrieve the AIM name of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -275,8 +293,9 @@ function get_the_author_aim() {
 }
 
 /**
- * the_author_aim() - Echo the AIM name of the author of the current post in the Loop.
+ * Display the AIM name of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_aim
  * @since 0.71
  * @see get_the_author_aim()
  */
@@ -285,7 +304,7 @@ function the_author_aim() {
 }
 
 /**
- * get_the_author_yim() - Get the Yahoo! IM name of the author of the current post in the Loop.
+ * Retrieve the Yahoo! IM name of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -297,8 +316,9 @@ function get_the_author_yim() {
 }
 
 /**
- * the_author_yim() - Echo the Yahoo! IM name of the author of the current post in the Loop.
+ * Display the Yahoo! IM name of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_yim
  * @since 0.71
  * @see get_the_author_yim()
  */
@@ -307,7 +327,7 @@ function the_author_yim() {
 }
 
 /**
- * get_the_author_msn() - Get the MSN address of the author of the current post in the Loop.
+ * Retrieve the MSN address of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -319,8 +339,9 @@ function get_the_author_msn() {
 }
 
 /**
- * the_author_msn() - Echo the MSN address of the author of the current post in the Loop.
+ * Display the MSN address of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_msn
  * @since 0.71
  * @see get_the_author_msn()
  */
@@ -329,7 +350,7 @@ function the_author_msn() {
 }
 
 /**
- * get_the_author_posts() - Get the number of posts by the author of the current post in the Loop.
+ * Retrieve the number of posts by the author of the current post.
  *
  * @since 1.5
  * @uses $post The current post in the Loop's DB object.
@@ -342,8 +363,9 @@ function get_the_author_posts() {
 }
 
 /**
- * the_author_posts() - Echo the number of posts by the author of the current post in the Loop.
+ * Display the number of posts by the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_posts
  * @since 0.71
  * @uses get_the_author_posts() Echos returned value from function.
  */
@@ -352,11 +374,13 @@ function the_author_posts() {
 }
 
 /**
- * the_author_posts_link() - Echo an HTML link to the author page of the author of the current post in the Loop.
+ * Display an HTML link to the author page of the author of the current post.
  *
- * Does just echo get_author_posts_url() function, like the others do. The reason for this,
- * is that another function is used to help in printing the link to the author's posts.
+ * Does just echo get_author_posts_url() function, like the others do. The
+ * reason for this, is that another function is used to help in printing the
+ * link to the author's posts.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_posts_link
  * @since 1.2
  * @uses $authordata The current author's DB object.
  * @uses get_author_posts_url()
@@ -374,7 +398,7 @@ function the_author_posts_link($deprecated = '') {
 }
 
 /**
- * get_author_posts_url() - Get the URL to the author page of the author of the current post in the Loop.
+ * Retrieve the URL to the author page of the author of the current post.
  *
  * @since 2.1
  * @uses $wp_rewrite WP_Rewrite
@@ -404,7 +428,7 @@ function get_author_posts_url($author_id, $author_nicename = '') {
 }
 
 /**
- * get_author_name() - Get the specified author's preferred display name.
+ * Retrieve the specified author's preferred display name.
  *
  * @since 1.0.0
  * @param int $auth_id The ID of the author.
@@ -416,16 +440,19 @@ function get_author_name( $auth_id ) {
 }
 
 /**
- * wp_list_authors() - List all the authors of the blog, with several options available.
+ * List all the authors of the blog, with several options available.
  *
- * optioncount (boolean) (false): Show the count in parenthesis next to the author's name.
- * exclude_admin (boolean) (true): Exclude the 'admin' user that is installed by default.
+ * optioncount (boolean) (false): Show the count in parenthesis next to the
+ *		author's name.
+ * exclude_admin (boolean) (true): Exclude the 'admin' user that is installed by
+ *		default.
  * show_fullname (boolean) (false): Show their full names.
  * hide_empty (boolean) (true): Don't show authors without any posts.
  * feed (string) (''): If isn't empty, show links to author's feeds.
  * feed_image (string) (''): If isn't empty, use this image to link to feeds.
  * echo (boolean) (true): Set to false to return the output, instead of echoing.
  *
+ * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
  * @since 1.2
  * @param array $args The argument array.
  * @return null|string The output, if echo is set to false.
@@ -507,4 +534,4 @@ function wp_list_authors($args = '') {
 	echo $return;
 }
 
-?&gt;
\ No newline at end of file
+?&gt;</diff>
      <filename>wp-includes/author-template.php</filename>
    </modified>
    <modified>
      <diff>@@ -7,24 +7,31 @@
  */
 
 /**
- * _walk_bookmarks() - The formatted output of a list of bookmarks
+ * The formatted output of a list of bookmarks
  *
  * The $bookmarks array must contain bookmark objects and will be iterated over
  * to retrieve the bookmark to be used in the output.
  *
- * The output is formatted as HTML with no way to change that format. However, what
- * is between, before, and after can be changed. The link itself will be HTML.
+ * The output is formatted as HTML with no way to change that format. However,
+ * what is between, before, and after can be changed. The link itself will be
+ * HTML.
  *
- * This function is used internally by wp_list_bookmarks() and should not be used by
- * themes.
+ * This function is used internally by wp_list_bookmarks() and should not be
+ * used by themes.
  *
  * The defaults for overwriting are:
- * 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated.
- * 'show_description' - Default is 0 (integer). Whether to show the description of the bookmark.
- * 'show_images' - Default is 1 (integer). Whether to show link image if available.
- * 'before' - Default is '&lt;li&gt;' (string). The html or text to prepend to each bookmarks.
- * 'after' - Default is '&lt;/li&gt;' (string). The html or text to append to each bookmarks.
- * 'between' - Default is '\n' (string). The string for use in between the link, description, and image.
+ * 'show_updated' - Default is 0 (integer). Will show the time of when the
+ *		bookmark was last updated.
+ * 'show_description' - Default is 0 (integer). Whether to show the description
+ *		of the bookmark.
+ * 'show_images' - Default is 1 (integer). Whether to show link image if
+ *		available.
+ * 'before' - Default is '&lt;li&gt;' (string). The html or text to prepend to each
+ *		bookmarks.
+ * 'after' - Default is '&lt;/li&gt;' (string). The html or text to append to each
+ *		bookmarks.
+ * 'between' - Default is '\n' (string). The string for use in between the link,
+ *		description, and image.
  * 'show_rating' - Default is 0 (integer). Whether to show the link rating.
  *
  * @since 2.1
@@ -69,7 +76,7 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
 
 		if ( $show_updated )
 			if ( '00' != substr($bookmark-&gt;link_updated_f, 0, 2) ) {
-				$title .= ' ';
+				$title .= ' (';
 				$title .= sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark-&gt;link_updated_f + (get_option('gmt_offset') * 3600)));
 				$title .= ')';
 			}
@@ -113,49 +120,73 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
 }
 
 /**
- * wp_list_bookmarks() - Retrieve or echo all of the bookmarks
+ * Retrieve or echo all of the bookmarks
  *
  * List of default arguments are as follows:
- * 'orderby' - Default is 'name' (string). How to order the links by. String is based off of the bookmark scheme.
- * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either ascending or descending order.
- * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to display.
- * 'category' - Default is empty string (string). Include the links in what category ID(s).
- * 'category_name' - Default is empty string (string). Get links by category name.
- * 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide links marked as 'invisible'.
- * 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated.
- * 'echo' - Default is 1 (integer). Whether to echo (default) or return the formatted bookmarks.
- * 'categorize' - Default is 1 (integer). Whether to show links listed by category (default) or show links in one column.
+ * 'orderby' - Default is 'name' (string). How to order the links by. String is
+ *		based off of the bookmark scheme.
+ * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either
+ *		ascending or descending order.
+ * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to
+ *		display.
+ * 'category' - Default is empty string (string). Include the links in what
+ *		category ID(s).
+ * 'category_name' - Default is empty string (string). Get links by category
+ *		name.
+ * 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide
+ *		links marked as 'invisible'.
+ * 'show_updated' - Default is 0 (integer). Will show the time of when the
+ *		bookmark was last updated.
+ * 'echo' - Default is 1 (integer). Whether to echo (default) or return the
+ *		formatted bookmarks.
+ * 'categorize' - Default is 1 (integer). Whether to show links listed by
+ *		category (default) or show links in one column.
  *
- * These options define how the Category name will appear before the category links are displayed, if 'categorize' is 1.
- * If 'categorize' is 0, then it will display for only the 'title_li' string and only if 'title_li' is not empty.
- * 'title_li' - Default is 'Bookmarks' (translatable string). What to show before the links appear.
- * 'title_before' - Default is '&lt;h2&gt;' (string). The HTML or text to show before the 'title_li' string.
- * 'title_after' - Default is '&lt;/h2&gt;' (string). The HTML or text to show after the 'title_li' string.
- * 'class' - Default is 'linkcat' (string). The CSS class to use for the 'title_li'.
+ * These options define how the Category name will appear before the category
+ * links are displayed, if 'categorize' is 1. If 'categorize' is 0, then it will
+ * display for only the 'title_li' string and only if 'title_li' is not empty.
+ * 'title_li' - Default is 'Bookmarks' (translatable string). What to show
+ *		before the links appear.
+ * 'title_before' - Default is '&lt;h2&gt;' (string). The HTML or text to show before
+ *		the 'title_li' string.
+ * 'title_after' - Default is '&lt;/h2&gt;' (string). The HTML or text to show after
+ *		the 'title_li' string.
+ * 'class' - Default is 'linkcat' (string). The CSS class to use for the
+ *		'title_li'.
  *
- * 'category_before' - Default is '&lt;li id=&quot;%id&quot; class=&quot;%class&quot;&gt;'. String must contain '%id' and '%class' to get
- * the id of the category and the 'class' argument. These are used for formatting in themes. Argument will be displayed
- * before the 'title_before' argument.
- * 'category_after' - Default is '&lt;/li&gt;' (string). The HTML or text that will appear after the list of links.
+ * 'category_before' - Default is '&lt;li id=&quot;%id&quot; class=&quot;%class&quot;&gt;'. String must
+ *		contain '%id' and '%class' to get
+ * the id of the category and the 'class' argument. These are used for
+ *		formatting in themes.
+ * Argument will be displayed before the 'title_before' argument.
+ * 'category_after' - Default is '&lt;/li&gt;' (string). The HTML or text that will
+ *		appear after the list of links.
  *
  * These are only used if 'categorize' is set to 1 or true.
- * 'category_orderby' - Default is 'name'. How to order the bookmark category based on term scheme.
- * 'category_order' - Default is 'ASC'. Set the order by either ASC (ascending) or DESC (descending).
+ * 'category_orderby' - Default is 'name'. How to order the bookmark category
+ *		based on term scheme.
+ * 'category_order' - Default is 'ASC'. Set the order by either ASC (ascending)
+ *		or DESC (descending).
  *
- * @see _walk_bookmarks() For other arguments that can be set in this function and passed to _walk_bookmarks().
- * @see get_bookmarks() For other arguments that can be set in this function and passed to get_bookmarks().
+ * @see _walk_bookmarks() For other arguments that can be set in this function
+ *		and passed to _walk_bookmarks().
+ * @see get_bookmarks() For other arguments that can be set in this function and
+ *		passed to get_bookmarks().
+ * @link http://codex.wordpress.org/Template_Tags/wp_list_bookmarks
  *
  * @since 2.1
- * @uses _list_bookmarks() Used to iterate over all of the bookmarks and return the html
+ * @uses _list_bookmarks() Used to iterate over all of the bookmarks and return
+ *		the html
  * @uses get_terms() Gets all of the categories that are for links.
  *
  * @param string|array $args Optional. Overwrite the defaults of the function
- * @return string|null Will only return if echo option is set to not echo. Default is not return anything.
+ * @return string|null Will only return if echo option is set to not echo.
+ *		Default is not return anything.
  */
 function wp_list_bookmarks($args = '') {
 	$defaults = array(
 		'orderby' =&gt; 'name', 'order' =&gt; 'ASC',
-		'limit' =&gt; -1, 'category' =&gt; '',
+		'limit' =&gt; -1, 'category' =&gt; '', 'exclude_category' =&gt; '',
 		'category_name' =&gt; '', 'hide_invisible' =&gt; 1,
 		'show_updated' =&gt; 0, 'echo' =&gt; 1,
 		'categorize' =&gt; 1, 'title_li' =&gt; __('Bookmarks'),
@@ -172,7 +203,7 @@ function wp_list_bookmarks($args = '') {
 
 	if ( $categorize ) {
 		//Split the bookmarks into ul's for each category
-		$cats = get_terms('link_category', &quot;category_name=$category_name&amp;include=$category&amp;orderby=$category_orderby&amp;order=$category_order&amp;hierarchical=0&quot;);
+		$cats = get_terms('link_category', array('name__like' =&gt; $category_name, 'include' =&gt; $category, 'exclude' =&gt; $exclude_category, 'orderby' =&gt; $category_orderby, 'order' =&gt; $category_order, 'hierarchical' =&gt; 0));
 
 		foreach ( (array) $cats as $cat ) {
 			$params = array_merge($r, array('category'=&gt;$cat-&gt;term_id));
@@ -181,7 +212,7 @@ function wp_list_bookmarks($args = '') {
 				continue;
 			$output .= str_replace(array('%id', '%class'), array(&quot;linkcat-$cat-&gt;term_id&quot;, $class), $category_before);
 			$catname = apply_filters( &quot;link_category&quot;, $cat-&gt;name );
-			$output .= &quot;$title_before$catname$title_after\n\t&lt;ul&gt;\n&quot;;
+			$output .= &quot;$title_before$catname$title_after\n\t&lt;ul class='xoxo blogroll'&gt;\n&quot;;
 			$output .= _walk_bookmarks($bookmarks, $r);
 			$output .= &quot;\n\t&lt;/ul&gt;\n$category_after\n&quot;;
 		}
@@ -192,7 +223,7 @@ function wp_list_bookmarks($args = '') {
 		if ( !empty($bookmarks) ) {
 			if ( !empty( $title_li ) ){
 				$output .= str_replace(array('%id', '%class'), array(&quot;linkcat-$category&quot;, $class), $category_before);
-				$output .= &quot;$title_before$title_li$title_after\n\t&lt;ul&gt;\n&quot;;
+				$output .= &quot;$title_before$title_li$title_after\n\t&lt;ul class='xoxo blogroll'&gt;\n&quot;;
 				$output .= _walk_bookmarks($bookmarks, $r);
 				$output .= &quot;\n\t&lt;/ul&gt;\n$category_after\n&quot;;
 			} else {</diff>
      <filename>wp-includes/bookmark-template.php</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,7 @@
  */
 
 /**
- * get_bookmark() - Get Bookmark data based on ID
+ * Retrieve Bookmark data based on ID
  *
  * @since 2.1
  * @uses $wpdb Database Object
@@ -37,7 +37,7 @@ function get_bookmark($bookmark_id, $output = OBJECT, $filter = 'raw') {
 }
 
 /**
- * get_bookmark_field() - Gets single bookmark data item or field.
+ * Retrieve single bookmark data item or field.
  *
  * @since 2.3
  * @uses get_bookmark() Gets bookmark object using $bookmark as ID
@@ -65,7 +65,7 @@ function get_bookmark_field( $field, $bookmark, $context = 'display' ) {
 }
 
 /**
- * get_link() - Returns bookmark data based on ID.
+ * Retrieve bookmark data based on ID.
  *
  * @since 2.0
  * @deprecated Use get_bookmark()
@@ -80,25 +80,35 @@ function get_link($bookmark_id, $output = OBJECT, $filter = 'raw') {
 }
 
 /**
- * get_bookmarks() - Retrieves the list of bookmarks
+ * Retrieves the list of bookmarks
  *
  * Attempts to retrieve from the cache first based on MD5 hash of arguments. If
  * that fails, then the query will be built from the arguments and executed. The
  * results will be stored to the cache.
  *
  * List of default arguments are as follows:
- * 'orderby' - Default is 'name' (string). How to order the links by. String is based off of the bookmark scheme.
- * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either ascending or descending order.
- * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to display.
- * 'category' - Default is empty string (string). Include the links in what category ID(s).
- * 'category_name' - Default is empty string (string). Get links by category name.
- * 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide links marked as 'invisible'.
- * 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated.
- * 'include' - Default is empty string (string). Include other categories separated by commas.
- * 'exclude' - Default is empty string (string). Exclude other categories separated by commas.
+ * 'orderby' - Default is 'name' (string). How to order the links by. String is
+ *		based off of the bookmark scheme.
+ * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either
+ *		ascending or descending order.
+ * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to
+ *		display.
+ * 'category' - Default is empty string (string). Include the links in what
+ *		category ID(s).
+ * 'category_name' - Default is empty string (string). Get links by category
+ *		name.
+ * 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide
+ *		links marked as 'invisible'.
+ * 'show_updated' - Default is 0 (integer). Will show the time of when the
+ *		bookmark was last updated.
+ * 'include' - Default is empty string (string). Include other categories
+ *		separated by commas.
+ * 'exclude' - Default is empty string (string). Exclude other categories
+ *		separated by commas.
  *
  * @since 2.1
  * @uses $wpdb Database Object
+ * @link http://codex.wordpress.org/Template_Tags/get_bookmarks
  *
  * @param string|array $args List of arguments to overwrite the defaults
  * @return array List of bookmark row objects
@@ -226,12 +236,13 @@ function get_bookmarks($args = '') {
 }
 
 /**
- * sanitize_bookmark() - Sanitizes all bookmark fields
+ * Sanitizes all bookmark fields
  *
  * @since 2.3
  *
  * @param object|array $bookmark Bookmark row
- * @param string $context Optional, default is 'display'. How to filter the fields
+ * @param string $context Optional, default is 'display'. How to filter the
+ *		fields
  * @return object|array Same type as $bookmark but with fields sanitized.
  */
 function sanitize_bookmark($bookmark, $context = 'display') {
@@ -254,25 +265,27 @@ function sanitize_bookmark($bookmark, $context = 'display') {
 }
 
 /**
- * sanitize_bookmark_field() - Sanitizes a bookmark field
+ * Sanitizes a bookmark field
  *
- * Sanitizes the bookmark fields based on what the field name is. If the field has a
- * strict value set, then it will be tested for that, else a more generic filtering is
- * applied. After the more strict filter is applied, if the $context is 'raw' then the
- * value is immediately return.
+ * Sanitizes the bookmark fields based on what the field name is. If the field
+ * has a strict value set, then it will be tested for that, else a more generic
+ * filtering is applied. After the more strict filter is applied, if the
+ * $context is 'raw' then the value is immediately return.
  *
- * Hooks exist for the more generic cases. With the 'edit' context, the 'edit_$field'
- * filter will be called and passed the $value and $bookmark_id respectively. With the
- * 'db' context, the 'pre_$field' filter is called and passed the value. The 'display'
- * context is the final context and has the $field has the filter name and is passed the
- * $value, $bookmark_id, and $context respectively.
+ * Hooks exist for the more generic cases. With the 'edit' context, the
+ * 'edit_$field' filter will be called and passed the $value and $bookmark_id
+ * respectively. With the 'db' context, the 'pre_$field' filter is called and
+ * passed the value. The 'display' context is the final context and has the
+ * $field has the filter name and is passed the $value, $bookmark_id, and
+ * $context respectively.
  *
  * @since 2.3
  *
  * @param string $field The bookmark field
  * @param mixed $value The bookmark field value
  * @param int $bookmark_id Bookmark ID
- * @param string $context How to filter the field value. Either 'raw', 'edit', 'attribute', 'js', 'db', or 'display'
+ * @param string $context How to filter the field value. Either 'raw', 'edit',
+ *		'attribute', 'js', 'db', or 'display'
  * @return mixed The filtered value
  */
 function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
@@ -318,7 +331,7 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
 }
 
 /**
- * delete_get_bookmark_cache() - Deletes entire bookmark cache
+ * Deletes entire bookmark cache
  *
  * @since 2.1
  * @uses wp_cache_delete() Deletes the contents of 'get_bookmarks'</diff>
      <filename>wp-includes/bookmark.php</filename>
    </modified>
    <modified>
      <diff>@@ -2,12 +2,14 @@
 /**
  * Object Cache API
  *
+ * @link http://codex.wordpress.org/Function_Reference/WP_Cache
+ *
  * @package WordPress
  * @subpackage Cache
  */
 
 /**
- * wp_cache_add() - Adds data to the cache, if the cache key doesn't aleady exist
+ * Adds data to the cache, if the cache key doesn't aleady exist.
  *
  * @since 2.0
  * @uses $wp_object_cache Object Cache Class
@@ -26,11 +28,12 @@ function wp_cache_add($key, $data, $flag = '', $expire = 0) {
 }
 
 /**
- * wp_cache_close() - Closes the cache
+ * Closes the cache.
  *
- * This function has ceased to do anything since WordPress 2.5.
- * The functionality was removed along with the rest of the
- * persistant cache.
+ * This function has ceased to do anything since WordPress 2.5. The
+ * functionality was removed along with the rest of the persistant cache. This
+ * does not mean that plugins can't implement this function when they need to
+ * make sure that the cache is cleaned up after WordPress no longer needs it.
  *
  * @since 2.0
  *
@@ -41,7 +44,7 @@ function wp_cache_close() {
 }
 
 /**
- * wp_cache_delete() - Removes the cache contents matching ID and flag
+ * Removes the cache contents matching ID and flag.
  *
  * @since 2.0
  * @uses $wp_object_cache Object Cache Class
@@ -58,7 +61,7 @@ function wp_cache_delete($id, $flag = '') {
 }
 
 /**
- * wp_cache_flush() - Removes all cache items
+ * Removes all cache items.
  *
  * @since 2.0
  * @uses $wp_object_cache Object Cache Class
@@ -73,7 +76,7 @@ function wp_cache_flush() {
 }
 
 /**
- * wp_cache_get() - Retrieves the cache contents from the cache by ID and flag
+ * Retrieves the cache contents from the cache by ID and flag.
  *
  * @since 2.0
  * @uses $wp_object_cache Object Cache Class
@@ -81,7 +84,8 @@ function wp_cache_flush() {
  *
  * @param int|string $id What the contents in the cache are called
  * @param string $flag Where the cache contents are grouped
- * @return bool|mixed False on failure to retrieve contents or the cache contents on success
+ * @return bool|mixed False on failure to retrieve contents or the cache
+ *		contents on success
  */
 function wp_cache_get($id, $flag = '') {
 	global $wp_object_cache;
@@ -90,7 +94,7 @@ function wp_cache_get($id, $flag = '') {
 }
 
 /**
- * wp_cache_init() - Sets up Object Cache Global and assigns it
+ * Sets up Object Cache Global and assigns it.
  *
  * @since 2.0
  * @global WP_Object_Cache $wp_object_cache WordPress Object Cache
@@ -100,7 +104,7 @@ function wp_cache_init() {
 }
 
 /**
- * wp_cache_replace() - Replaces the contents of the cache with new data
+ * Replaces the contents of the cache with new data.
  *
  * @since 2.0
  * @uses $wp_object_cache Object Cache Class
@@ -119,7 +123,7 @@ function wp_cache_replace($key, $data, $flag = '', $expire = 0) {
 }
 
 /**
- * wp_cache_set() - Saves the data to the cache
+ * Saves the data to the cache.
  *
  * @since 2.0
  * @uses $wp_object_cache Object Cache Class
@@ -138,16 +142,40 @@ function wp_cache_set($key, $data, $flag = '', $expire = 0) {
 }
 
 /**
+ * Adds a group or set of groups to the list of global groups.
+ *
+ * @since 2.6
+ *
+ * @param string|array $groups A group or an array of groups to add
+ */
+function wp_cache_add_global_groups( $groups ) {
+	// Default cache doesn't persist so nothing to do here.
+	return;
+}
+
+/**
+ * Adds a group or set of groups to the list of non-persistent groups.
+ *
+ * @since 2.6
+ *
+ * @param string|array $groups A group or an array of groups to add
+ */
+function wp_cache_add_non_persistent_groups( $groups ) {
+	// Default cache doesn't persist so nothing to do here.
+	return;
+}
+
+/**
  * WordPress Object Cache
  *
- * The WordPress Object Cache is used to save on trips to the database.
- * The Object Cache stores all of the cache data to memory and makes the
- * cache contents available by using a key, which is used to name and
- * later retrieve the cache contents.
+ * The WordPress Object Cache is used to save on trips to the database. The
+ * Object Cache stores all of the cache data to memory and makes the cache
+ * contents available by using a key, which is used to name and later retrieve
+ * the cache contents.
  *
- * The Object Cache can be replaced by other caching mechanisms by placing
- * files in the wp-content folder which is looked at in wp-settings. If
- * that file exists, then this file will not be included.
+ * The Object Cache can be replaced by other caching mechanisms by placing files
+ * in the wp-content folder which is looked at in wp-settings. If that file
+ * exists, then this file will not be included.
  *
  * @package WordPress
  * @subpackage Cache
@@ -174,15 +202,6 @@ class WP_Object_Cache {
 	var $non_existant_objects = array ();
 
 	/**
-	 * Object caches that are global
-	 *
-	 * @var array
-	 * @access private
-	 * @since 2.0
-	 */
-	var $global_groups = array ('users', 'userlogins', 'usermeta');
-
-	/**
 	 * The amount of times the cache data was already stored in the cache.
 	 *
 	 * @since 2.5
@@ -204,7 +223,8 @@ class WP_Object_Cache {
 	 * Adds data to the cache if it doesn't already exist.
 	 *
 	 * @uses WP_Object_Cache::get Checks to see if the cache already has data.
-	 * @uses WP_Object_Cache::set Sets the data after the checking the cache contents existance.
+	 * @uses WP_Object_Cache::set Sets the data after the checking the cache
+	 *		contents existance.
 	 *
 	 * @since 2.0
 	 *
@@ -227,18 +247,19 @@ class WP_Object_Cache {
 	/**
 	 * Remove the contents of the cache ID in the group
 	 *
-	 * If the cache ID does not exist in the group and $force parameter
-	 * is set to false, then nothing will happen. The $force parameter
-	 * is set to false by default.
+	 * If the cache ID does not exist in the group and $force parameter is set
+	 * to false, then nothing will happen. The $force parameter is set to false
+	 * by default.
 	 *
-	 * On success the group and the id will be added to the
+	 * On success the group and the id will be added to the 
 	 * $non_existant_objects property in the class.
 	 *
 	 * @since 2.0
 	 *
 	 * @param int|string $id What the contents in the cache are called
 	 * @param string $group Where the cache contents are grouped
-	 * @param bool $force Optional. Whether to force the unsetting of the cache ID in the group
+	 * @param bool $force Optional. Whether to force the unsetting of the cache
+	 *		ID in the group
 	 * @return bool False if the contents weren't deleted and true on success
 	 */
 	function delete($id, $group = 'default', $force = false) {
@@ -269,21 +290,22 @@ class WP_Object_Cache {
 	/**
 	 * Retrieves the cache contents, if it exists
 	 *
-	 * The contents will be first attempted to be retrieved by searching
-	 * by the ID in the cache group. If the cache is hit (success) then
-	 * the contents are returned.
+	 * The contents will be first attempted to be retrieved by searching by the
+	 * ID in the cache group. If the cache is hit (success) then the contents
+	 * are returned.
 	 *
-	 * On failure, the $non_existant_objects property is checked and if
-	 * the cache group and ID exist in there the cache misses will not be
-	 * incremented. If not in the nonexistant objects property, then the
-	 * cache misses will be incremented and the cache group and ID will
-	 * be added to the nonexistant objects.
+	 * On failure, the $non_existant_objects property is checked and if the
+	 * cache group and ID exist in there the cache misses will not be
+	 * incremented. If not in the nonexistant objects property, then the cache
+	 * misses will be incremented and the cache group and ID will be added to
+	 * the nonexistant objects.
 	 *
 	 * @since 2.0
 	 *
 	 * @param int|string $id What the contents in the cache are called
 	 * @param string $group Where the cache contents are grouped
-	 * @return bool|mixed False on failure to retrieve contents or the cache contents on success
+	 * @return bool|mixed False on failure to retrieve contents or the cache
+	 *		contents on success
 	 */
 	function get($id, $group = 'default') {
 		if (empty ($group))
@@ -327,15 +349,14 @@ class WP_Object_Cache {
 	/**
 	 * Sets the data contents into the cache
 	 *
-	 * The cache contents is grouped by the $group parameter followed
-	 * by the $id. This allows for duplicate ids in unique groups.
-	 * Therefore, naming of the group should be used with care and
-	 * should follow normal function naming guidelines outside of
-	 * core WordPress usage.
+	 * The cache contents is grouped by the $group parameter followed by the
+	 * $id. This allows for duplicate ids in unique groups. Therefore, naming of
+	 * the group should be used with care and should follow normal function
+	 * naming guidelines outside of core WordPress usage.
 	 *
-	 * The $expire parameter is not used, because the cache will
-	 * automatically expire for each time a page is accessed and PHP
-	 * finishes. The method is more for cache plugins which use files.
+	 * The $expire parameter is not used, because the cache will automatically
+	 * expire for each time a page is accessed and PHP finishes. The method is
+	 * more for cache plugins which use files.
 	 *
 	 * @since 2.0
 	 *
@@ -363,8 +384,8 @@ class WP_Object_Cache {
 	/**
 	 * Echos the stats of the caching.
 	 *
-	 * Gives the cache hits, and cache misses. Also prints every cached
-	 * group, key and the data.
+	 * Gives the cache hits, and cache misses. Also prints every cached group,
+	 * key and the data.
 	 *
 	 * @since 2.0
 	 */
@@ -402,7 +423,11 @@ class WP_Object_Cache {
 	 * @return null|WP_Object_Cache If cache is disabled, returns null.
 	 */
 	function __construct() {
-		register_shutdown_function(array(&amp;$this, &quot;__destruct&quot;)); /** @todo This should be moved to the PHP4 style constructor, PHP5 already calls __destruct() */
+		/**
+		 * @todo This should be moved to the PHP4 style constructor, PHP5
+		 * already calls __destruct()
+		 */
+		register_shutdown_function(array(&amp;$this, &quot;__destruct&quot;));
 	}
 
 	/**</diff>
      <filename>wp-includes/cache.php</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,8 @@
 /**
  * Canonical API to handle WordPress Redirecting
  *
- * Based on &quot;Permalink Redirect&quot; from Scott Yang and &quot;Enforce www. Preference&quot; by Mark Jaquith
+ * Based on &quot;Permalink Redirect&quot; from Scott Yang and &quot;Enforce www. Preference&quot;
+ * by Mark Jaquith
  *
  * @author Scott Yang
  * @author Mark Jaquith
@@ -11,31 +12,34 @@
  */
 
 /**
- * redirect_canonical() - Redirects incoming links to the proper URL based on the site url
+ * Redirects incoming links to the proper URL based on the site url
  *
- * Search engines consider www.somedomain.com and somedomain.com to be two different URLs
- * when they both go to the same location. This SEO enhancement prevents penality for
- * duplicate content by redirecting all incoming links to one or the other.
+ * Search engines consider www.somedomain.com and somedomain.com to be two
+ * different URLs when they both go to the same location. This SEO enhancement
+ * prevents penality for duplicate content by redirecting all incoming links to
+ * one or the other.
  *
- * Prevents redirection for feeds, trackbacks, searches, comment popup, and admin URLs.
- * Does not redirect on IIS, page/post previews, and on form data.
+ * Prevents redirection for feeds, trackbacks, searches, comment popup, and
+ * admin URLs. Does not redirect on IIS, page/post previews, and on form data.
  *
- * Will also attempt to find the correct link when a user enters a URL that does not exist
- * based on exact WordPress query. Will instead try to parse the URL or query in an attempt
- * to figure the correct page to go to.
+ * Will also attempt to find the correct link when a user enters a URL that does
+ * not exist based on exact WordPress query. Will instead try to parse the URL
+ * or query in an attempt to figure the correct page to go to.
  *
  * @since 2.3
  * @uses $wp_rewrite
  * @uses $is_IIS
  *
- * @param string $requested_url Optional. The URL that was requested, used to figure if redirect is needed.
+ * @param string $requested_url Optional. The URL that was requested, used to
+ *		figure if redirect is needed.
  * @param bool $do_redirect Optional. Redirect to the new URL.
- * @return null|false|string Null, if redirect not needed. False, if redirect not needed or the string of the URL
+ * @return null|false|string Null, if redirect not needed. False, if redirect
+ *		not needed or the string of the URL
  */
 function redirect_canonical($requested_url=null, $do_redirect=true) {
 	global $wp_rewrite, $is_IIS;
 
-	if ( is_feed() || is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) &amp;&amp; count($_POST) ) || is_preview() )
+	if ( is_feed() || is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) &amp;&amp; count($_POST) ) || is_preview() || is_robots() )
 		return;
 
 	if ( !$requested_url ) {
@@ -137,7 +141,8 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
 
 	// www.example.com vs example.com
 	$user_home = @parse_url(get_option('home'));
-	$redirect['host'] = $user_home['host'];
+	if ( isset($user_home['host']) )
+		$redirect['host'] = $user_home['host'];
 
 	// Handle ports
 	if ( isset($user_home['port']) )
@@ -160,11 +165,12 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
 		} else {
 			foreach ( array('single', 'category', 'page', 'day', 'month', 'year') as $type ) {
 				$func = 'is_' . $type;
-				if ( call_user_func($func) )
+				if ( call_user_func($func) ) {
 					$user_ts_type = $type;
 					break;
 				}
 			}
+		}
 		$redirect['path'] = user_trailingslashit($redirect['path'], $user_ts_type);
 	} elseif ( is_home() ) {
 		$redirect['path'] = trailingslashit($redirect['path']);
@@ -210,12 +216,13 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
 }
 
 /**
- * redirect_guess_404_permalink() - Tries to guess correct post based on query vars
+ * Attempts to guess correct post based on query vars
  *
  * @since 2.3
  * @uses $wpdb
  *
- * @return bool|string Returns False, if it can't find post, returns correct location on success.
+ * @return bool|string Returns False, if it can't find post, returns correct
+ *		location on success.
  */
 function redirect_guess_404_permalink() {
 	global $wpdb;</diff>
      <filename>wp-includes/canonical.php</filename>
    </modified>
    <modified>
      <diff>@@ -34,7 +34,7 @@ class WP_Roles {
 		}
 	}
 
-	function add_role($role, $display_name, $capabilities = '') {
+	function add_role($role, $display_name, $capabilities = array()) {
 		if ( isset($this-&gt;roles[$role]) )
 			return;
 
@@ -465,7 +465,7 @@ function get_role($role) {
 	return $wp_roles-&gt;get_role($role);
 }
 
-function add_role($role, $display_name, $capabilities = '') {
+function add_role($role, $display_name, $capabilities = array()) {
 	global $wp_roles;
 
 	if ( ! isset($wp_roles) )</diff>
      <filename>wp-includes/capabilities.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 &lt;?php
 
-function get_category_children($id, $before = '/', $after = '') {
+function get_category_children($id, $before = '/', $after = '', $visited=array()) {
 	if ( 0 == $id )
 		return '';
 
@@ -14,7 +14,8 @@ function get_category_children($id, $before = '/', $after = '') {
 		$category = get_category($cat_id);
 		if ( is_wp_error( $category ) )
 			return $category;
-		if ( $category-&gt;parent == $id ) {
+		if ( $category-&gt;parent == $id &amp;&amp; !in_array($category-&gt;term_id, $visited) ) {
+			$visited[] = $category-&gt;term_id;
 			$chain .= $before.$category-&gt;term_id.$after;
 			$chain .= get_category_children($category-&gt;term_id, $before, $after);
 		}
@@ -44,7 +45,7 @@ function get_category_link($category_id) {
 	return apply_filters('category_link', $catlink, $category_id);
 }
 
-function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE){
+function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE, $visited = array()){
 	$chain = '';
 	$parent = &amp;get_category($id);
 	if ( is_wp_error( $parent ) )
@@ -55,8 +56,10 @@ function get_category_parents($id, $link = FALSE, $separator = '/', $nicename =
 	else
 		$name = $parent-&gt;cat_name;
 
-	if ( $parent-&gt;parent &amp;&amp; ($parent-&gt;parent != $parent-&gt;term_id) )
-		$chain .= get_category_parents($parent-&gt;parent, $link, $separator, $nicename);
+	if ( $parent-&gt;parent &amp;&amp; ($parent-&gt;parent != $parent-&gt;term_id) &amp;&amp; !in_array($parent-&gt;parent, $visited) ) {
+		$visited[] = $parent-&gt;parent;
+		$chain .= get_category_parents($parent-&gt;parent, $link, $separator, $nicename, $visited);
+	}
 
 	if ( $link )
 		$chain .= '&lt;a href=&quot;' . get_category_link($parent-&gt;term_id) . '&quot; title=&quot;' . sprintf(__(&quot;View all posts in %s&quot;), $parent-&gt;cat_name) . '&quot;&gt;'.$name.'&lt;/a&gt;' . $separator;
@@ -185,9 +188,12 @@ function in_category( $category ) { // Check if the current post is in the given
 	if ( empty($category) )
 		return false;
 
-	$cat_ID = get_cat_ID($category);
-	if ( $cat_ID )
-		$category = $cat_ID;
+	// If category is not an int, check to see if it's a name
+	if ( ! is_int($category) ) {
+		$cat_ID = get_cat_ID($category);
+		if ( $cat_ID )
+			$category = $cat_ID;
+	}
 
 	$categories = get_object_term_cache($post-&gt;ID, 'category');
 	if ( false === $categories )
@@ -272,7 +278,7 @@ function wp_list_categories($args = '') {
 		'style' =&gt; 'list', 'show_count' =&gt; 0,
 		'hide_empty' =&gt; 1, 'use_desc_for_title' =&gt; 1,
 		'child_of' =&gt; 0, 'feed' =&gt; '', 'feed_type' =&gt; '',
-		'feed_image' =&gt; '', 'exclude' =&gt; '',
+		'feed_image' =&gt; '', 'exclude' =&gt; '', 'current_category' =&gt; 0,
 		'hierarchical' =&gt; true, 'title_li' =&gt; __('Categories'),
 		'echo' =&gt; 1, 'depth' =&gt; 0
 	);
@@ -309,7 +315,7 @@ function wp_list_categories($args = '') {
 			else
 				$output .= '&lt;a href=&quot;' .  get_bloginfo('url')  . '&quot;&gt;' . $show_option_all . '&lt;/a&gt;';
 
-		if ( is_category() )
+		if ( empty( $r['current_category'] ) &amp;&amp; is_category() )
 			$r['current_category'] = $wp_query-&gt;get_queried_object_id();
 
 		if ( $hierarchical )
@@ -412,7 +418,6 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
 	foreach ( $counts as $tag =&gt; $count ) {
 		$tag_id = $tag_ids[$tag];
 		$tag_link = clean_url($tag_links[$tag]);
-		$tag = str_replace(' ', '&amp;nbsp;', wp_specialchars( $tag ));
 		$a[] = &quot;&lt;a href='$tag_link' class='tag-link-$tag_id' title='&quot; . attribute_escape( sprintf( __ngettext('%d topic','%d topics',$count), $count ) ) . &quot;'$rel style='font-size: &quot; .
 			( $smallest + ( ( $count - $min_count ) * $font_step ) )
 			. &quot;$unit;'&gt;$tag&lt;/a&gt;&quot;;
@@ -536,4 +541,41 @@ function the_terms( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
 		echo $return;
 }
 
+/**
+ * Check if the current post has the given tag
+ *
+ * @package WordPress
+ * @since 2.6
+ *
+ * @uses wp_get_object_terms() Gets the tags.
+ *
+ * @param string|int|array $tag Optional. The tag name/id/slug or array of them to check for
+ * @return bool True if the current post has the given tag, or any tag, if no tag specified
+ */
+function has_tag($tag = '') {
+	global $post;
+	$taxonomy = 'post_tag';
+
+	if ( !in_the_loop() ) return false; // in-the-loop function
+
+	$post_id = (int) $post-&gt;ID;
+
+	$terms = get_object_term_cache($post_id, $taxonomy);
+	if (empty($terms))
+		 $terms = wp_get_object_terms($post_id, $taxonomy);
+	if (empty($terms)) return false;
+
+	if (empty($tag)) return (!empty($terms));
+
+	$tag = (array) $tag;
+
+	foreach($terms as $term) {
+		if ( in_array( $term-&gt;term_id, $tag ) ) return true;
+		if ( in_array( $term-&gt;name, $tag ) ) return true;
+		if ( in_array( $term-&gt;slug, $tag ) ) return true;
+	}
+
+	return false;
+}
+
 ?&gt;</diff>
      <filename>wp-includes/category-template.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,18 @@
 &lt;?php
-
+/**
+ * WordPress Category API
+ *
+ * @package WordPress
+ */
+
+/**
+ * Retrieves all category IDs.
+ *
+ * @since 2.0.0
+ * @link http://codex.wordpress.org/Function_Reference/get_all_category_ids
+ *
+ * @return object List of all of the category IDs.
+ */
 function get_all_category_ids() {
 	if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) {
 		$cat_ids = get_terms('category', 'fields=ids&amp;get=all');
@@ -9,6 +22,20 @@ function get_all_category_ids() {
 	return $cat_ids;
 }
 
+/**
+ * Retrieve list of category objects.
+ *
+ * If you change the type to 'link' in the arguments, then the link categories
+ * will be returned instead. Also all categories will be updated to be backwards
+ * compatible with pre-2.3 plugins and themes.
+ *
+ * @since 2.1.0
+ * @see get_terms() Type of arguments that can be changed.
+ * @link http://codex.wordpress.org/Function_Reference/get_categories
+ *
+ * @param string|array $args Optional. Change the defaults retrieving categories.
+ * @return array List of categories.
+ */
 function &amp;get_categories($args = '') {
 	$defaults = array('type' =&gt; 'category');
 	$args = wp_parse_args($args, $defaults);
@@ -24,8 +51,28 @@ function &amp;get_categories($args = '') {
 	return $categories;
 }
 
-// Retrieves category data given a category ID or category object.
-// Handles category caching.
+/**
+ * Retrieves category data given a category ID or category object.
+ *
+ * If you pass the $category parameter an object, which is assumed to be the
+ * category row object retrieved the database. It will cache the category data.
+ *
+ * If you pass $category an integer of the category ID, then that category will
+ * be retrieved from the database, if it isn't already cached, and pass it back.
+ *
+ * If you look at get_term(), then both types will be passed through several
+ * filters and finally sanitized based on the $filter parameter value.
+ *
+ * The category will converted to maintain backwards compatibility.
+ *
+ * @since 2.1.0
+ * @uses get_term() Used to get the category data from the taxonomy.
+ *
+ * @param int|object $category Category ID or Category row object
+ * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
+ * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
+ * @return mixed Category data in type defined by $output parameter.
+ */
 function &amp;get_category($category, $output = OBJECT, $filter = 'raw') {
 	$category = get_term($category, 'category', $output, $filter);
 	if ( is_wp_error( $category ) )
@@ -36,6 +83,25 @@ function &amp;get_category($category, $output = OBJECT, $filter = 'raw') {
 	return $category;
 }
 
+/**
+ * Retrieve category based on URL containing the category slug.
+ *
+ * Breaks the $category_path parameter up to get the category slug.
+ *
+ * Tries to find the child path and will return it. If it doesn't find a
+ * match, then it will return the first category matching slug, if $full_match,
+ * is set to false. If it does not, then it will return null.
+ *
+ * It is also possible that it will return a WP_Error object on failure. Check
+ * for it when using this function.
+ *
+ * @since 2.1.0
+ *
+ * @param string $category_path URL containing category slugs.
+ * @param bool $full_match Optional. Whether should match full path or not.
+ * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
+ * @return null|object|array Null on failure. Type is based on $output value.
+ */
 function get_category_by_path($category_path, $full_match = true, $output = OBJECT) {
 	$category_path = rawurlencode(urldecode($category_path));
 	$category_path = str_replace('%2F', '/', $category_path);
@@ -50,7 +116,7 @@ function get_category_by_path($category_path, $full_match = true, $output = OBJE
 	$categories = get_terms('category', &quot;get=all&amp;slug=$leaf_path&quot;);
 
 	if ( empty($categories) )
-		return NULL;
+		return null;
 
 	foreach ($categories as $category) {
 		$path = '/' . $leaf_path;
@@ -70,9 +136,17 @@ function get_category_by_path($category_path, $full_match = true, $output = OBJE
 	if ( ! $full_match )
 		return get_category($categories[0]-&gt;term_id, $output);
 
-	return NULL;
+	return null;
 }
 
+/**
+ * Retrieve category object by category slug.
+ *
+ * @since 2.3.0
+ *
+ * @param string $slug The category slug.
+ * @return object Category data object
+ */
 function get_category_by_slug( $slug  ) {
 	$category = get_term_by('slug', $slug, 'category');
 	if ( $category )
@@ -81,7 +155,15 @@ function get_category_by_slug( $slug  ) {
 	return $category;
 }
 
-// Get the ID of a category from its name
+
+/**
+ * Retrieve the ID of a category from its name.
+ *
+ * @since 1.0.0
+ *
+ * @param string $cat_name Optional. Default is 'General' and can be any category name.
+ * @return int 0, if failure and ID of category on success.
+ */
 function get_cat_ID($cat_name='General') {
 	$cat = get_term_by('name', $cat_name, 'category');
 	if ($cat)
@@ -89,18 +171,49 @@ function get_cat_ID($cat_name='General') {
 	return 0;
 }
 
-// Deprecate
+
+/**
+ * Retrieve the category name by the category ID.
+ *
+ * @since 0.71
+ * @deprecated Use get_cat_name()
+ * @see get_cat_name() get_catname() is deprecated in favor of get_cat_name().
+ *
+ * @param int $cat_ID Category ID
+ * @return string category name
+ */
 function get_catname($cat_ID) {
 	return get_cat_name($cat_ID);
 }
 
-// Get the name of a category from its ID
+
+/**
+ * Retrieve the name of a category from its ID.
+ *
+ * @since 1.0.0
+ *
+ * @param int $cat_id Category ID
+ * @return string Category name
+ */
 function get_cat_name($cat_id) {
 	$cat_id = (int) $cat_id;
 	$category = &amp;get_category($cat_id);
 	return $category-&gt;name;
 }
 
+
+/**
+ * Check if a category is an ancestor of another category.
+ *
+ * You can use either an id or the category object for both parameters. If you
+ * use an integer the category will be retrieved.
+ *
+ * @since 2.1.0
+ *
+ * @param int|object $cat1 ID or object to check if this is the parent category.
+ * @param int|object $cat2 The child category.
+ * @return bool Whether $cat2 is child of $cat1
+ */
 function cat_is_ancestor_of($cat1, $cat2) {
 	if ( is_int($cat1) )
 		$cat1 = &amp; get_category($cat1);
@@ -116,16 +229,51 @@ function cat_is_ancestor_of($cat1, $cat2) {
 	return cat_is_ancestor_of($cat1, get_category($cat2-&gt;parent));
 }
 
+
+/**
+ * Sanitizes category data based on context.
+ *
+ * @since 2.3.0
+ * @uses sanitize_term() See this function for what context are supported.
+ *
+ * @param object|array $category Category data
+ * @param string $context Optional. Default is 'display'.
+ * @return object|array Same type as $category with sanitized data for safe use.
+ */
 function sanitize_category($category, $context = 'display') {
 	return sanitize_term($category, 'category', $context);
 }
 
+
+/**
+ * Sanitizes data in single category key field.
+ *
+ * @since 2.3.0
+ * @uses sanitize_term_field() See function for more details.
+ *
+ * @param string $field Category key to sanitize
+ * @param mixed $value Category value to sanitize
+ * @param int $cat_id Category ID
+ * @param string $context What filter to use, 'raw', 'display', etc.
+ * @return mixed Same type as $value after $value has been sanitized.
+ */
 function sanitize_category_field($field, $value, $cat_id, $context) {
 	return sanitize_term_field($field, $value, $cat_id, 'category', $context);
 }
 
-// Tags
+/* Tags */
 
+
+/**
+ * Retrieves all post tags.
+ *
+ * @since 2.3.0
+ * @see get_terms() For list of arguments to pass.
+ * @uses apply_filters() Calls 'get_tags' hook on array of tags and with $args.
+ *
+ * @param string|array $args Tag arguments to use when retrieving tags.
+ * @return array List of tags.
+ */
 function &amp;get_tags($args = '') {
 	$tags = get_terms('post_tag', $args);
 
@@ -136,26 +284,82 @@ function &amp;get_tags($args = '') {
 	return $tags;
 }
 
+
+/**
+ * Retrieve post tag by tag ID or tag object.
+ *
+ * If you pass the $tag parameter an object, which is assumed to be the tag row
+ * object retrieved the database. It will cache the tag data.
+ *
+ * If you pass $tag an integer of the tag ID, then that tag will
+ * be retrieved from the database, if it isn't already cached, and pass it back.
+ *
+ * If you look at get_term(), then both types will be passed through several
+ * filters and finally sanitized based on the $filter parameter value.
+ *
+ * @since 2.3.0
+ *
+ * @param int|object $tag
+ * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
+ * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
+ * @return object|array Return type based on $output value.
+ */
 function &amp;get_tag($tag, $output = OBJECT, $filter = 'raw') {
 	return get_term($tag, 'post_tag', $output, $filter);
 }
 
-//
-// Cache
-//
 
+/* Cache */
+
+
+/**
+ * Update the categories cache.
+ *
+ * This function does not appear to be used anymore or does not appear to be
+ * needed. It might be a legacy function left over from when there was a need
+ * for updating the category cache.
+ *
+ * @since 1.5.0
+ *
+ * @return bool Always return True
+ */
 function update_category_cache() {
 	return true;
 }
 
+
+/**
+ * Remove the category cache data based on ID.
+ *
+ * @since 2.1.0
+ * @uses clean_term_cache() Clears the cache for the category based on ID
+ *
+ * @param int $id Category ID
+ */
 function clean_category_cache($id) {
 	clean_term_cache($id, 'category');
 }
 
-//
-// Private helpers
-//
 
+/**
+ * Update category structure to old pre 2.3 from new taxonomy structure.
+ *
+ * This function was added for the taxonomy support to update the new category
+ * structure with the old category one. This will maintain compatibility with
+ * plugins and themes which depend on the old key or property names.
+ *
+ * The parameter should only be passed a variable and not create the array or
+ * object inline to the parameter. The reason for this is that parameter is
+ * passed by reference and PHP will fail unless it has the variable.
+ *
+ * There is no return value, because everything is updated on the variable you
+ * pass to it. This is one of the features with using pass by reference in PHP.
+ *
+ * @since 2.3.0
+ * @access private
+ *
+ * @param array|object $category Category Row object or array
+ */
 function _make_cat_compat( &amp;$category) {
 	if ( is_object($category) ) {
 		$category-&gt;cat_ID = &amp;$category-&gt;term_id;
@@ -174,4 +378,5 @@ function _make_cat_compat( &amp;$category) {
 	}
 }
 
+
 ?&gt;</diff>
      <filename>wp-includes/category.php</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,12 @@
  * @license BSD License http://www.opensource.org/licenses/bsd-license.php
  */
 
+/**
+ * IXR_Value
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Value {
     var $data;
     var $type;
@@ -120,7 +126,12 @@ class IXR_Value {
     }
 }
 
-
+/**
+ * IXR_Message
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Message {
     var $message;
     var $messageType;  // methodCall / methodResponse / fault
@@ -263,7 +274,12 @@ class IXR_Message {
     }
 }
 
-
+/**
+ * IXR_Server
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Server {
     var $data;
     var $callbacks = array();
@@ -424,6 +440,12 @@ EOD;
     }
 }
 
+/**
+ * IXR_Request
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Request {
     var $method;
     var $args;
@@ -454,7 +476,12 @@ EOD;
     }
 }
 
-
+/**
+ * IXR_Client
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Client {
     var $server;
     var $port;
@@ -565,13 +592,18 @@ class IXR_Client {
     }
 }
 
-
+/**
+ * IXR_Error
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Error {
     var $code;
     var $message;
     function IXR_Error($code, $message) {
         $this-&gt;code = $code;
-        $this-&gt;message = $message;
+        $this-&gt;message = htmlspecialchars($message);
     }
     function getXml() {
         $xml = &lt;&lt;&lt;EOD
@@ -597,7 +629,12 @@ EOD;
     }
 }
 
-
+/**
+ * IXR_Date
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Date {
     var $year;
     var $month;
@@ -641,7 +678,12 @@ class IXR_Date {
     }
 }
 
-
+/**
+ * IXR_Base64
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Base64 {
     var $data;
     function IXR_Base64($data) {
@@ -652,7 +694,12 @@ class IXR_Base64 {
     }
 }
 
-
+/**
+ * IXR_IntrospectionServer
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_IntrospectionServer extends IXR_Server {
     var $signatures;
     var $help;
@@ -796,7 +843,12 @@ class IXR_IntrospectionServer extends IXR_Server {
     }
 }
 
-
+/**
+ * IXR_ClientMulticall
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_ClientMulticall extends IXR_Client {
     var $calls = array();
     function IXR_ClientMulticall($server, $path = false, $port = 80) {</diff>
      <filename>wp-includes/class-IXR.php</filename>
    </modified>
    <modified>
      <diff>@@ -8,19 +8,11 @@
  */
 
 #
-# Portable PHP password hashing framework.
-#
-# Version 0.1 / genuine.
-#
 # Written by Solar Designer &lt;solar at openwall.com&gt; in 2004-2006 and placed in
 # the public domain.
 #
 # There's absolutely no warranty.
 #
-# The homepage URL for this framework is:
-#
-#	http://www.openwall.com/phpass/
-#
 # Please be sure to update the Version line if you edit this file in any way.
 # It is suggested that you leave the main version number intact, but indicate
 # your project name (after the slash) and add your own revision information.
@@ -32,6 +24,15 @@
 # Obviously, since this code is in the public domain, the above are not
 # requirements (there can be none), but merely suggestions.
 #
+
+/**
+ * Portable PHP password hashing framework.
+ *
+ * @package phpass
+ * @version 0.1 / genuine
+ * @link http://www.openwall.com/phpass/
+ * @since 2.5
+ */
 class PasswordHash {
 	var $itoa64;
 	var $iteration_count_log2;</diff>
      <filename>wp-includes/class-phpass.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,15 +1,14 @@
 &lt;?php
-////////////////////////////////////////////////////
-// PHPMailer - PHP email class
-//
-// Class for sending email using either
-// sendmail, PHP mail(), or SMTP.  Methods are
-// based upon the standard AspEmail(tm) classes.
-//
-// Copyright (C) 2001 - 2003  Brent R. Matzelle
-//
-// License: LGPL, see LICENSE
-////////////////////////////////////////////////////
+/**
+ * PHPMailer - PHP email class
+ *
+ * Class for sending email using either sendmail, PHP mail(), or SMTP. Methods
+ * are based upon the standard AspEmail(tm) classes.
+ *
+ * @copyright 2001 - 2003 Brent R. Matzelle
+ * @license LGPL
+ * @package PHPMailer
+ */
 
 /**
  * PHPMailer - PHP email transport class</diff>
      <filename>wp-includes/class-phpmailer.php</filename>
    </modified>
    <modified>
      <diff>@@ -14,9 +14,14 @@
  *
  * pop3 class
  *
- * $Id: class-pop3.php 6440 2007-12-20 22:28:54Z westi $
+ * $Id: class-pop3.php 8082 2008-06-14 16:36:13Z westi $
  */
 
+/**
+ * POP3
+ *
+ * @package SquirrelMail
+ */
 class POP3 {
     var $ERROR      = '';       //  Error string.
 </diff>
      <filename>wp-includes/class-pop3.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,23 +1,23 @@
 &lt;?php
-////////////////////////////////////////////////////
-// SMTP - PHP SMTP class
-//
-// Version 1.02
-//
-// Define an SMTP class that can be used to connect
-// and communicate with any SMTP server. It implements
-// all the SMTP functions defined in RFC821 except TURN.
-//
-// Author: Chris Ryan
-//
-// License: LGPL, see LICENSE
-////////////////////////////////////////////////////
+/**
+ * SMTP - PHP SMTP class
+ *
+ * Define an SMTP class that can be used to connect and communicate with any
+ * SMTP server. It implements all the SMTP functions defined in RFC821 except
+ * TURN.
+ *
+ * @version 1.02
+ * @author Chris Ryan
+ * @license LGPL
+ * @package PHPMailer
+ */
 
 /**
  * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
  * commands except TURN which will always return a not implemented
  * error. SMTP also provides some utility methods for sending mail
  * to an SMTP server.
+ *
  * @package PHPMailer
  * @author Chris Ryan
  */
@@ -249,7 +249,7 @@ class SMTP
      * finializing the mail transaction. $msg_data is the message
      * that is to be send with the headers. Each header needs to be
      * on a single line followed by a &lt;CRLF&gt; with the message headers
-     * and the message body being seperated by and additional &lt;CRLF&gt;.
+     * and the message body being separated by and additional &lt;CRLF&gt;.
      *
      * Implements rfc 821: DATA &lt;CRLF&gt;
      *</diff>
      <filename>wp-includes/class-smtp.php</filename>
    </modified>
    <modified>
      <diff>@@ -8,13 +8,15 @@
  * @link http://snoopy.sourceforge.net/
  * @package Snoopy
  */
-/*************************************************
-
-Snoopy - the PHP net client
-Author: Monte Ohrt &lt;monte@ispi.net&gt;
-Copyright (c): 1999-2000 ispi, all rights reserved
-Version: 1.01
 
+if ( !in_array('Snoopy', get_declared_classes() ) ) :
+/**
+ * Snoopy - the PHP net client
+ *
+ * @author Monte Ohrt &lt;monte@ispi.net&gt;
+ * @copyright (c): 1999-2000 ispi, all rights reserved
+ * @version 1.01
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -28,22 +30,19 @@ Version: 1.01
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-You may contact the author of Snoopy by e-mail at:
-monte@ispi.net
-
-Or, write to:
-Monte Ohrt
-CTO, ispi
-237 S. 70th suite 220
-Lincoln, NE 68510
-
-The latest version of Snoopy can be obtained from:
-http://snoopy.sourceforge.net/
-
-*************************************************/
-
-if ( !in_array('Snoopy', get_declared_classes() ) ) :
+ *
+ * You may contact the author of Snoopy by e-mail at:
+ * monte@ispi.net
+ *
+ * Or, write to:
+ * Monte Ohrt
+ * CTO, ispi
+ * 237 S. 70th suite 220
+ * Lincoln, NE 68510
+ *
+ * @link http://snoopy.sourceforge.net/ The latest version of Snoopy can be
+ *		obtained
+ */
 class Snoopy
 {
 	/**** Public variables ****/</diff>
      <filename>wp-includes/class-snoopy.php</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,7 @@ class WP {
 		global $wp_rewrite;
 
 		$this-&gt;query_vars = array();
+		$taxonomy_query_vars = array();
 
 		if ( is_array($extra_query_vars) )
 			$this-&gt;extra_query_vars = &amp; $extra_query_vars;
@@ -90,6 +91,10 @@ class WP {
 			// Look for matches.
 			$request_match = $request;
 			foreach ($rewrite as $match =&gt; $query) {
+				// Don't try to match against AtomPub calls
+				if ( $req_uri == 'wp-app.php' )
+					break;
+
 				// If the requesting file is the anchor of the match, prepend it
 				// to the path info.
 				if ((! empty($req_uri)) &amp;&amp; (strpos($match, $req_uri) === 0) &amp;&amp; ($req_uri != $request)) {
@@ -105,7 +110,7 @@ class WP {
 					$query = preg_replace(&quot;!^.+\?!&quot;, '', $query);
 
 					// Substitute the substring matches into the query.
-					eval(&quot;\$query = \&quot;$query\&quot;;&quot;);
+					eval(&quot;\$query = \&quot;&quot; . addslashes($query) . &quot;\&quot;;&quot;);
 					$this-&gt;matched_query = $query;
 
 					// Parse the query.
@@ -140,6 +145,10 @@ class WP {
 
 		$this-&gt;public_query_vars = apply_filters('query_vars', $this-&gt;public_query_vars);
 
+		foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy =&gt; $t )
+			if ( isset($t-&gt;query_var) )
+				$taxonomy_query_vars[$t-&gt;query_var] = $taxonomy;
+
 		for ($i=0; $i&lt;count($this-&gt;public_query_vars); $i += 1) {
 			$wpvar = $this-&gt;public_query_vars[$i];
 			if (isset($this-&gt;extra_query_vars[$wpvar]))
@@ -153,8 +162,13 @@ class WP {
 			elseif (!empty($perma_query_vars[$wpvar]))
 				$this-&gt;query_vars[$wpvar] = $perma_query_vars[$wpvar];
 
-			if ( !empty( $this-&gt;query_vars[$wpvar] ) )
+			if ( !empty( $this-&gt;query_vars[$wpvar] ) ) {
 				$this-&gt;query_vars[$wpvar] = (string) $this-&gt;query_vars[$wpvar];
+				if ( in_array( $wpvar, $taxonomy_query_vars ) ) {
+					$this-&gt;query_vars['taxonomy'] = $taxonomy_query_vars[$wpvar];
+					$this-&gt;query_vars['term'] = $this-&gt;query_vars[$wpvar];
+				}
+			}
 		}
 
 		foreach ($this-&gt;private_query_vars as $var) {
@@ -395,31 +409,32 @@ class Walker {
 	var $db_fields;
 
 	//abstract callbacks
-	function start_lvl($output) { return $output; }
-	function end_lvl($output)   { return $output; }
-	function start_el($output)  { return $output; }
-	function end_el($output)    { return $output; }
+	function start_lvl(&amp;$output) {}
+	function end_lvl(&amp;$output)   {}
+	function start_el(&amp;$output)  {}
+	function end_el(&amp;$output)    {}
 
 	/*
  	 * display one element if the element doesn't have any children
  	 * otherwise, display the element and its children
  	 */
-	function display_element( $element, &amp;$children_elements, $max_depth, $depth=0, $args, $output ) {
+	function display_element( $element, &amp;$children_elements, $max_depth, $depth=0, $args, &amp;$output ) {
 
-		if ( !$element)
-			return $output;
+		if ( !$element )
+			return;
 
 		$id_field = $this-&gt;db_fields['id'];
 		$parent_field = $this-&gt;db_fields['parent'];
 
 		//display this element
-		$cb_args = array_merge( array($output, $element, $depth), $args);
-		$output = call_user_func_array(array(&amp;$this, 'start_el'), $cb_args);
+		$cb_args = array_merge( array(&amp;$output, $element, $depth), $args);
+		call_user_func_array(array(&amp;$this, 'start_el'), $cb_args);
 
 		if ( $max_depth == 0 ||
 		     ($max_depth != 0 &amp;&amp;  $max_depth &gt; $depth+1 )) { //whether to descend
 
-			for ( $i = 0; $i &lt; sizeof( $children_elements ); $i++ ) {
+			$num_elements = sizeof( $children_elements );
+			for ( $i = 0; $i &lt; $num_elements; $i++ ) {
 
 				$child = $children_elements[$i];
 				if ( $child-&gt;$parent_field == $element-&gt;$id_field ) {
@@ -427,12 +442,13 @@ class Walker {
 					if ( !isset($newlevel) ) {
 						$newlevel = true;
 						//start the child delimiter
-						$cb_args = array_merge( array($output, $depth), $args);
-						$output = call_user_func_array(array(&amp;$this, 'start_lvl'), $cb_args);
+						$cb_args = array_merge( array(&amp;$output, $depth), $args);
+						call_user_func_array(array(&amp;$this, 'start_lvl'), $cb_args);
 					}
 
 					array_splice( $children_elements, $i, 1 );
-					$output = $this-&gt;display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
+					$num_elements--;
+					$this-&gt;display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
 					$i = -1;
 				}
 			}
@@ -440,15 +456,13 @@ class Walker {
 
 		if ( isset($newlevel) &amp;&amp; $newlevel ){
 			//end the child delimiter
-			$cb_args = array_merge( array($output, $depth), $args);
-			$output = call_user_func_array(array(&amp;$this, 'end_lvl'), $cb_args);
+			$cb_args = array_merge( array(&amp;$output, $depth), $args);
+			call_user_func_array(array(&amp;$this, 'end_lvl'), $cb_args);
 		}
 
 		//end this element
-		$cb_args = array_merge( array($output, $element, $depth), $args);
-		$output = call_user_func_array(array(&amp;$this, 'end_el'), $cb_args);
-
-		return $output;
+		$cb_args = array_merge( array(&amp;$output, $element, $depth), $args);
+		call_user_func_array(array(&amp;$this, 'end_el'), $cb_args);
 	}
 
 	/*
@@ -476,7 +490,7 @@ class Walker {
 		if ( -1 == $max_depth ) {
 			$empty_array = array();
 			foreach ( $elements as $e )
-				$output = $this-&gt;display_element( $e, $empty_array, 1, 0, $args, $output );
+				$this-&gt;display_element( $e, $empty_array, 1, 0, $args, $output );
 			return $output;
 		}
 
@@ -500,19 +514,21 @@ class Walker {
 		if ( !$top_level_elements ) {
 
 			$root = $children_elements[0];
-			for ( $i = 0; $i &lt; sizeof( $children_elements ); $i++ ) {
+			$num_elements = sizeof($children_elements);
+			for ( $i = 0; $i &lt; $num_elements; $i++ ) {
 
 				$child = $children_elements[$i];
 				if ($root-&gt;$parent_field == $child-&gt;$parent_field ) {
 					$top_level_elements[] = $child;
 					array_splice( $children_elements, $i, 1 );
+					$num_elements--;
 					$i--;
 				}
 			}
 		}
 
 		foreach ( $top_level_elements as $e )
-			$output = $this-&gt;display_element( $e, $children_elements, $max_depth, 0, $args, $output );
+			$this-&gt;display_element( $e, $children_elements, $max_depth, 0, $args, $output );
 
 		/*
 		* if we are displaying all levels, and remaining children_elements is not empty,
@@ -521,7 +537,7 @@ class Walker {
 		if ( ( $max_depth == 0 ) &amp;&amp; sizeof( $children_elements ) &gt; 0 ) {
 			$empty_array = array();
 			foreach ( $children_elements as $orphan_e )
-				$output = $this-&gt;display_element( $orphan_e, $empty_array, 1, 0, $args, $output );
+				$this-&gt;display_element( $orphan_e, $empty_array, 1, 0, $args, $output );
 		 }
 		 return $output;
 	}
@@ -531,19 +547,17 @@ class Walker_Page extends Walker {
 	var $tree_type = 'page';
 	var $db_fields = array ('parent' =&gt; 'post_parent', 'id' =&gt; 'ID'); //TODO: decouple this
 
-	function start_lvl($output, $depth) {
+	function start_lvl(&amp;$output, $depth) {
 		$indent = str_repeat(&quot;\t&quot;, $depth);
 		$output .= &quot;\n$indent&lt;ul&gt;\n&quot;;
-		return $output;
 	}
 
-	function end_lvl($output, $depth) {
+	function end_lvl(&amp;$output, $depth) {
 		$indent = str_repeat(&quot;\t&quot;, $depth);
 		$output .= &quot;$indent&lt;/ul&gt;\n&quot;;
-		return $output;
 	}
 
-	function start_el($output, $page, $depth, $current_page, $args) {
+	function start_el(&amp;$output, $page, $depth, $current_page, $args) {
 		if ( $depth )
 			$indent = str_repeat(&quot;\t&quot;, $depth);
 		else
@@ -571,14 +585,10 @@ class Walker_Page extends Walker {
 
 			$output .= &quot; &quot; . mysql2date($date_format, $time);
 		}
-
-		return $output;
 	}
 
-	function end_el($output, $page, $depth) {
+	function end_el(&amp;$output, $page, $depth) {
 		$output .= &quot;&lt;/li&gt;\n&quot;;
-
-		return $output;
 	}
 
 }
@@ -587,18 +597,16 @@ class Walker_PageDropdown extends Walker {
 	var $tree_type = 'page';
 	var $db_fields = array ('parent' =&gt; 'post_parent', 'id' =&gt; 'ID'); //TODO: decouple this
 
-	function start_el($output, $page, $depth, $args) {
-				$pad = str_repeat('&amp;nbsp;', $depth * 3);
-
-				$output .= &quot;\t&lt;option value=\&quot;$page-&gt;ID\&quot;&quot;;
-				if ( $page-&gt;ID == $args['selected'] )
-								$output .= ' selected=&quot;selected&quot;';
-				$output .= '&gt;';
-				$title = wp_specialchars($page-&gt;post_title);
-				$output .= &quot;$pad$title&quot;;
-				$output .= &quot;&lt;/option&gt;\n&quot;;
+	function start_el(&amp;$output, $page, $depth, $args) {
+		$pad = str_repeat('&amp;nbsp;', $depth * 3);
 
-				return $output;
+		$output .= &quot;\t&lt;option value=\&quot;$page-&gt;ID\&quot;&quot;;
+		if ( $page-&gt;ID == $args['selected'] )
+			$output .= ' selected=&quot;selected&quot;';
+		$output .= '&gt;';
+		$title = wp_specialchars($page-&gt;post_title);
+		$output .= &quot;$pad$title&quot;;
+		$output .= &quot;&lt;/option&gt;\n&quot;;
 	}
 }
 
@@ -606,25 +614,23 @@ class Walker_Category extends Walker {
 	var $tree_type = 'category';
 	var $db_fields = array ('parent' =&gt; 'parent', 'id' =&gt; 'term_id'); //TODO: decouple this
 
-	function start_lvl($output, $depth, $args) {
+	function start_lvl(&amp;$output, $depth, $args) {
 		if ( 'list' != $args['style'] )
-			return $output;
+			return;
 
 		$indent = str_repeat(&quot;\t&quot;, $depth);
 		$output .= &quot;$indent&lt;ul class='children'&gt;\n&quot;;
-		return $output;
 	}
 
-	function end_lvl($output, $depth, $args) {
+	function end_lvl(&amp;$output, $depth, $args) {
 		if ( 'list' != $args['style'] )
-			return $output;
+			return;
 
 		$indent = str_repeat(&quot;\t&quot;, $depth);
 		$output .= &quot;$indent&lt;/ul&gt;\n&quot;;
-		return $output;
 	}
 
-	function start_el($output, $category, $depth, $args) {
+	function start_el(&amp;$output, $category, $depth, $args) {
 		extract($args);
 
 		$cat_name = attribute_escape( $category-&gt;name);
@@ -687,16 +693,13 @@ class Walker_Category extends Walker {
 		} else {
 			$output .= &quot;\t$link&lt;br /&gt;\n&quot;;
 		}
-
-		return $output;
 	}
 
-	function end_el($output, $page, $depth, $args) {
+	function end_el(&amp;$output, $page, $depth, $args) {
 		if ( 'list' != $args['style'] )
-			return $output;
+			return;
 
 		$output .= &quot;&lt;/li&gt;\n&quot;;
-		return $output;
 	}
 
 }
@@ -705,7 +708,7 @@ class Walker_CategoryDropdown extends Walker {
 	var $tree_type = 'category';
 	var $db_fields = array ('parent' =&gt; 'parent', 'id' =&gt; 'term_id'); //TODO: decouple this
 
-	function start_el($output, $category, $depth, $args) {
+	function start_el(&amp;$output, $category, $depth, $args) {
 		$pad = str_repeat('&amp;nbsp;', $depth * 3);
 
 		$cat_name = apply_filters('list_cats', $category-&gt;name, $category);
@@ -721,8 +724,6 @@ class Walker_CategoryDropdown extends Walker {
 			$output .= '&amp;nbsp;&amp;nbsp;' . gmdate($format, $category-&gt;last_update_timestamp);
 		}
 		$output .= &quot;&lt;/option&gt;\n&quot;;
-
-		return $output;
 	}
 }
 </diff>
      <filename>wp-includes/classes.php</filename>
    </modified>
    <modified>
      <diff>@@ -9,10 +9,10 @@
  */
 
 /**
- * get_comment_author() - Retrieve the author of the current comment
+ * Retrieve the author of the current comment.
  *
- * If the comment has an empty comment_author field, then 'Anonymous' person
- * is assumed.
+ * If the comment has an empty comment_author field, then 'Anonymous' person is
+ * assumed.
  *
  * @since 1.5
  * @uses apply_filters() Calls 'get_comment_author' hook on the comment author
@@ -29,7 +29,7 @@ function get_comment_author() {
 }
 
 /**
- * comment_author() - Displays the author of the current comment
+ * Displays the author of the current comment.
  *
  * @since 0.71
  * @uses apply_filters() Calls 'comment_author' on comment author before displaying
@@ -40,7 +40,7 @@ function comment_author() {
 }
 
 /**
- * get_comment_author_email() - Retrieve the email of the author of the current comment
+ * Retrieve the email of the author of the current comment.
  *
  * @since 1.5
  * @uses apply_filters() Calls the 'get_comment_author_email' hook on the comment author email
@@ -54,12 +54,13 @@ function get_comment_author_email() {
 }
 
 /**
- * comment_author_email() - Display the email of the author of the current global $comment
+ * Display the email of the author of the current global $comment.
  *
- * Care should be taken to protect the email address and assure that email harvesters
- * do not capture your commentors' email address. Most assume that their email address will
- * not appear in raw form on the blog. Doing so will enable anyone, including those that
- * people don't want to get the email address and use it for their own means good and bad.
+ * Care should be taken to protect the email address and assure that email
+ * harvesters do not capture your commentors' email address. Most assume that
+ * their email address will not appear in raw form on the blog. Doing so will
+ * enable anyone, including those that people don't want to get the email
+ * address and use it for their own means good and bad.
  *
  * @since 0.71
  * @uses apply_filters() Calls 'author_email' hook on the author email
@@ -69,12 +70,13 @@ function comment_author_email() {
 }
 
 /**
- * comment_author_email_link() - Display the html email link to the author of the current comment
+ * Display the html email link to the author of the current comment.
  *
- * Care should be taken to protect the email address and assure that email harvesters
- * do not capture your commentors' email address. Most assume that their email address will
- * not appear in raw form on the blog. Doing so will enable anyone, including those that
- * people don't want to get the email address and use it for their own means good and bad.
+ * Care should be taken to protect the email address and assure that email
+ * harvesters do not capture your commentors' email address. Most assume that
+ * their email address will not appear in raw form on the blog. Doing so will
+ * enable anyone, including those that people don't want to get the email
+ * address and use it for their own means good and bad.
  *
  * @since 0.71
  * @uses apply_filters() Calls 'comment_email' hook for the display of the comment author's email
@@ -96,7 +98,7 @@ function comment_author_email_link($linktext='', $before='', $after='') {
 }
 
 /**
- * get_comment_author_link() - Retrieve the html link to the url of the author of the current comment
+ * Retrieve the html link to the url of the author of the current comment.
  *
  * @since 1.5
  * @uses apply_filters() Calls 'get_comment_author_link' hook on the complete link HTML or author
@@ -116,7 +118,7 @@ function get_comment_author_link() {
 }
 
 /**
- * comment_author_link() - Display the html link to the url of the author of the current comment
+ * Display the html link to the url of the author of the current comment.
  *
  * @since 0.71
  * @see get_comment_author_link() Echos result
@@ -126,7 +128,7 @@ function comment_author_link() {
 }
 
 /**
- * get_comment_author_IP() - Retrieve the IP address of the author of the current comment
+ * Retrieve the IP address of the author of the current comment.
  *
  * @since 1.5
  * @uses $comment
@@ -140,7 +142,7 @@ function get_comment_author_IP() {
 }
 
 /**
- * comment_author_IP() - Displays the IP address of the author of the current comment
+ * Display the IP address of the author of the current comment.
  *
  * @since 0.71
  * @see get_comment_author_IP() Echos Result
@@ -150,7 +152,7 @@ function comment_author_IP() {
 }
 
 /**
- * get_comment_author_url() - Returns the url of the author of the current comment
+ * Retrieve the url of the author of the current comment.
  *
  * @since 1.5
  * @uses apply_filters() Calls 'get_comment_author_url' hook on the comment author's URL
@@ -163,7 +165,7 @@ function get_comment_author_url() {
 }
 
 /**
- * comment_author_url() - Display the url of the author of the current comment
+ * Display the url of the author of the current comment.
  *
  * @since 0.71
  * @uses apply_filters()
@@ -174,13 +176,14 @@ function comment_author_url() {
 }
 
 /**
- * get_comment_author_url_link() - Retrieves the HTML link of the url of the author of the current comment
+ * Retrieves the HTML link of the url of the author of the current comment.
  *
- * $linktext parameter is only used if the URL does not exist for the comment author. If the URL does
- * exist then the URL will be used and the $linktext will be ignored.
+ * $linktext parameter is only used if the URL does not exist for the comment
+ * author. If the URL does exist then the URL will be used and the $linktext
+ * will be ignored.
  *
- * Encapsulate the HTML link between the $before and $after. So it will appear in the order of $before,
- * link, and finally $after.
+ * Encapsulate the HTML link between the $before and $after. So it will appear
+ * in the order of $before, link, and finally $after.
  *
  * @since 1.5
  * @uses apply_filters() Calls the 'get_comment_author_url_link' on the complete HTML before returning.
@@ -202,7 +205,7 @@ function get_comment_author_url_link( $linktext = '', $before = '', $after = ''
 }
 
 /**
- * comment_author_url_link() - Displays the HTML link of the url of the author of the current comment
+ * Displays the HTML link of the url of the author of the current comment.
  *
  * @since 0.71
  * @see get_comment_author_url_link() Echos result
@@ -216,7 +219,7 @@ function comment_author_url_link( $linktext = '', $before = '', $after = '' ) {
 }
 
 /**
- * get_comment_date() - Retrieve the comment date of the current comment
+ * Retrieve the comment date of the current comment.
  *
  * @since 1.5
  * @uses apply_filters() Calls 'get_comment_date' hook with the formated date and the $d parameter respectively
@@ -235,7 +238,7 @@ function get_comment_date( $d = '' ) {
 }
 
 /**
- * comment_date() - Display the comment date of the current comment
+ * Display the comment date of the current comment.
  *
  * @since 0.71
  *
@@ -246,7 +249,7 @@ function comment_date( $d = '' ) {
 }
 
 /**
- * get_comment_excerpt() - Retrieve the excerpt of the current comment
+ * Retrieve the excerpt of the current comment.
  *
  * Will cut each word and only output the first 20 words with '...' at the end.
  * If the word count is less than 20, then no truncating is done and no '...'
@@ -278,7 +281,7 @@ function get_comment_excerpt() {
 }
 
 /**
- * comment_excerpt() - Returns the excerpt of the current comment
+ * Display the excerpt of the current comment.
  *
  * @since 1.2
  * @uses apply_filters() Calls 'comment_excerpt' hook before displaying excerpt
@@ -288,7 +291,7 @@ function comment_excerpt() {
 }
 
 /**
- * get_comment_ID() - Retrieve the comment id of the current comment
+ * Retrieve the comment id of the current comment.
  *
  * @since 1.5
  * @uses $comment
@@ -302,7 +305,7 @@ function get_comment_ID() {
 }
 
 /**
- * comment_ID() - Displays the comment id of the current comment
+ * Displays the comment id of the current comment.
  *
  * @since 0.71
  * @see get_comment_ID() Echos Result
@@ -312,7 +315,7 @@ function comment_ID() {
 }
 
 /**
- * get_comment_link() - Retrieve the link to the current comment
+ * Retrieve the link to the current comment.
  *
  * @since 1.5
  * @uses $comment
@@ -325,7 +328,7 @@ function get_comment_link() {
 }
 
 /**
- * get_comments_link() - Retrieves the link to the current post comments
+ * Retrieves the link to the current post comments.
  *
  * @since 1.5
  *
@@ -336,7 +339,7 @@ function get_comments_link() {
 }
 
 /**
- * comments_link() - Displays the link to the current post comments
+ * Displays the link to the current post comments.
  *
  * @since 0.71
  *
@@ -348,7 +351,7 @@ function comments_link( $deprecated = '', $deprecated = '' ) {
 }
 
 /**
- * get_comments_number() - Retrieve the amount of comments a post has
+ * Retrieve the amount of comments a post has.
  *
  * @since 1.5
  * @uses apply_filters() Calls the 'get_comments_number' hook on the number of comments
@@ -373,7 +376,7 @@ function get_comments_number( $post_id = 0 ) {
 }
 
 /**
- * comments_number() - Display the language string for the number of comments the current post has
+ * Display the language string for the number of comments the current post has.
  *
  * @since 0.71
  * @uses $id
@@ -389,7 +392,7 @@ function comments_number( $zero = false, $one = false, $more = false, $deprecate
 	$number = get_comments_number($id);
 
 	if ( $number &gt; 1 )
-		$output = str_replace('%', $number, ( false === $more ) ? __('% Comments') : $more);
+		$output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more);
 	elseif ( $number == 0 )
 		$output = ( false === $zero ) ? __('No Comments') : $zero;
 	else // must be one
@@ -399,7 +402,7 @@ function comments_number( $zero = false, $one = false, $more = false, $deprecate
 }
 
 /**
- * get_comment_text() - Retrieve the text of the current comment
+ * Retrieve the text of the current comment.
  *
  * @since 1.5
  * @uses $comment
@@ -412,7 +415,7 @@ function get_comment_text() {
 }
 
 /**
- * comment_text() - Displays the text of the current comment
+ * Displays the text of the current comment.
  *
  * @since 0.71
  * @uses apply_filters() Passes the comment content through the 'comment_text' hook before display
@@ -423,7 +426,7 @@ function comment_text() {
 }
 
 /**
- * get_comment_time() - Retrieve the comment time of the current comment
+ * Retrieve the comment time of the current comment.
  *
  * @since 1.5
  * @uses $comment
@@ -444,7 +447,7 @@ function get_comment_time( $d = '', $gmt = false ) {
 }
 
 /**
- * comment_time() - Display the comment time of the current comment
+ * Display the comment time of the current comment.
  *
  * @since 0.71
  *
@@ -455,7 +458,7 @@ function comment_time( $d = '' ) {
 }
 
 /**
- * get_comment_type() - Retrieve the comment type of the current comment
+ * Retrieve the comment type of the current comment.
  *
  * @since 1.5
  * @uses $comment
@@ -473,7 +476,7 @@ function get_comment_type() {
 }
 
 /**
- * comment_type() - Display the comment type of the current comment
+ * Display the comment type of the current comment.
  *
  * @since 0.71
  *
@@ -496,11 +499,11 @@ function comment_type($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pin
 }
 
 /**
- * get_trackback_url() - Retrieve The current post's trackback URL
+ * Retrieve The current post's trackback URL.
  *
- * There is a check to see if permalink's have been enabled and if so, will retrieve
- * the pretty path. If permalinks weren't enabled, the ID of the current post is used
- * and appended to the correct page to go to.
+ * There is a check to see if permalink's have been enabled and if so, will
+ * retrieve the pretty path. If permalinks weren't enabled, the ID of the
+ * current post is used and appended to the correct page to go to.
  *
  * @since 1.5
  * @uses apply_filters() Calls 'trackback_url' on the resulting trackback URL
@@ -519,7 +522,7 @@ function get_trackback_url() {
 }
 
 /**
- * trackback_url() - Displays the current post's trackback URL
+ * Displays the current post's trackback URL.
  *
  * @since 0.71
  * @uses get_trackback_url() Gets the trackback url for the current post
@@ -533,7 +536,7 @@ function trackback_url($deprecated = true) {
 }
 
 /**
- * trackback_rdf() - Generates and displays the RDF for the trackback information of current post
+ * Generates and displays the RDF for the trackback information of current post.
  *
  * @since 0.71
  *
@@ -557,7 +560,7 @@ function trackback_rdf($deprecated = '') {
 }
 
 /**
- * comments_open() - Whether the current post is open for comments
+ * Whether the current post is open for comments.
  *
  * @since 1.5
  * @uses $post
@@ -574,7 +577,7 @@ function comments_open( $post_id=NULL ) {
 }
 
 /**
- * pings_open() - Whether the current post is open for pings
+ * Whether the current post is open for pings.
  *
  * @since 1.5
  * @uses $post
@@ -591,14 +594,14 @@ function pings_open( $post_id = NULL ) {
 }
 
 /**
- * wp_comment_form_unfiltered_html_nonce() - Displays form token for unfiltered comments
+ * Displays form token for unfiltered comments.
  *
- * Will only display nonce token if the current user has permissions for unfiltered html.
- * Won't display the token for other users.
+ * Will only display nonce token if the current user has permissions for
+ * unfiltered html. Won't display the token for other users.
  *
- * The function was backported to 2.0.10 and was added to versions 2.1.3 and above. Does not
- * exist in versions prior to 2.0.10 in the 2.0 branch and in the 2.1 branch, prior to 2.1.3.
- * Technically added in 2.2.0.
+ * The function was backported to 2.0.10 and was added to versions 2.1.3 and
+ * above. Does not exist in versions prior to 2.0.10 in the 2.0 branch and in
+ * the 2.1 branch, prior to 2.1.3. Technically added in 2.2.0.
  *
  * @since 2.0.10 Backported to 2.0 branch
  * @since 2.1.3
@@ -611,10 +614,10 @@ function wp_comment_form_unfiltered_html_nonce() {
 }
 
 /**
- * comments_template() - Loads the comment template specified in $file
+ * Loads the comment template specified in $file.
  *
- * Will not display the comments template if not on single post or page, or
- * if the post does not have comments.
+ * Will not display the comments template if not on single post or page, or if
+ * the post does not have comments.
  *
  * Uses the WordPress database object to query for the comments. The comments
  * are passed through the 'comments_array' filter hook with the list of comments
@@ -665,11 +668,11 @@ function comments_template( $file = '/comments.php' ) {
 	if ( file_exists( $include ) )
 		require( $include );
 	else
-		require( ABSPATH . 'wp-content/themes/default/comments.php');
+		require( WP_CONTENT_DIR . '/themes/default/comments.php');
 }
 
 /**
- * comments_popup_script() - Displays the JS popup script to show a comment
+ * Displays the JS popup script to show a comment.
  *
  * If the $file parameter is empty, then the home page is assumed. The defaults
  * for the window are 400px by 400px.
@@ -700,9 +703,10 @@ function comments_popup_script($width=400, $height=400, $file='') {
 }
 
 /**
- * comments_popup_link() - Displays the link to the comments popup window for the current post ID.
+ * Displays the link to the comments popup window for the current post ID.
  *
- * Is not meant to be displayed on single posts and pages. Should be used on the lists of posts
+ * Is not meant to be displayed on single posts and pages. Should be used on the
+ * lists of posts
  *
  * @since 0.71
  * @uses $id</diff>
      <filename>wp-includes/comment-template.php</filename>
    </modified>
    <modified>
      <diff>@@ -6,21 +6,37 @@
  */
 
 /**
- * check_comment() - Checks whether a comment passes internal checks to be allowed to add
+ * Checks whether a comment passes internal checks to be allowed to add.
  *
- * {@internal Missing Long Description}}
+ * If comment moderation is set in the administration, then all comments,
+ * regardless of their type and whitelist will be set to false.
+ *
+ * If the number of links exceeds the amount in the administration, then the
+ * check fails.
+ *
+ * If any of the parameter contents match the blacklist of words, then the check
+ * fails.
+ *
+ * If the comment is a trackback and part of the blogroll, then the trackback is
+ * automatically whitelisted. If the comment author was approved before, then
+ * the comment is automatically whitelisted.
+ *
+ * If none of the checks fail, then the failback is to set the check to pass
+ * (return true).
  *
  * @since 1.2
  * @uses $wpdb
  *
- * @param string $author {@internal Missing Description }}
- * @param string $email {@internal Missing Description }}
- * @param string $url {@internal Missing Description }}
- * @param string $comment {@internal Missing Description }}
- * @param string $user_ip {@internal Missing Description }}
- * @param string $user_agent {@internal Missing Description }}
- * @param string $comment_type {@internal Missing Description }}
- * @return bool {@internal Missing Description }}
+ * @param string $author Comment Author's name
+ * @param string $email Comment Author's email
+ * @param string $url Comment Author's URL
+ * @param string $comment Comment contents
+ * @param string $user_ip Comment Author's IP address
+ * @param string $user_agent Comment Author's User Agent
+ * @param string $comment_type Comment type, either user submitted comment,
+ *		trackback, or pingback
+ * @return bool Whether the checks passed (true) and the comments should be
+ *		displayed or set to moderated
  */
 function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) {
 	global $wpdb;
@@ -83,7 +99,7 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
 }
 
 /**
- * get_approved_comments() - Returns the approved comments for post $post_id
+ * Retrieve the approved comments for post $post_id.
  *
  * @since 2.0
  * @uses $wpdb
@@ -97,15 +113,19 @@ function get_approved_comments($post_id) {
 }
 
 /**
- * get_comment() - Retrieves comment data given a comment ID or comment object.
+ * Retrieves comment data given a comment ID or comment object.
  *
- * {@internal Missing Long Description}}
+ * If an object is passed then the comment data will be cached and then returned
+ * after being passed through a filter.
+ *
+ * If the comment is empty, then the global comment variable will be used, if it
+ * is set.
  *
  * @since 2.0
  * @uses $wpdb
  *
- * @param object|string|int $comment {@internal Missing Description}}
- * @param string $output OBJECT or ARRAY_A or ARRAY_N constants
+ * @param object|string|int $comment Comment to retrieve.
+ * @param string $output Optional. OBJECT or ARRAY_A or ARRAY_N constants
  * @return object|array|null Depends on $output value.
  */
 function &amp;get_comment(&amp;$comment, $output = OBJECT) {
@@ -142,12 +162,12 @@ function &amp;get_comment(&amp;$comment, $output = OBJECT) {
 }
 
 /**
- * get_commentdata() - Returns an array of comment data about comment $comment_ID
+ * Retrieve an array of comment data about comment $comment_ID.
  *
- * get_comment() technically does the same thing as this function. This function also
- * appears to reference variables and then not use them or not update them when needed.
- * It is advised to switch to get_comment(), since this function might be deprecated in
- * favor of using get_comment().
+ * get_comment() technically does the same thing as this function. This function
+ * also appears to reference variables and then not use them or not update them
+ * when needed. It is advised to switch to get_comment(), since this function
+ * might be deprecated in favor of using get_comment().
  *
  * @deprecated Use get_comment()
  * @see get_comment()
@@ -162,7 +182,7 @@ function &amp;get_comment(&amp;$comment, $output = OBJECT) {
  * @param bool $include_unapproved Whether to include unapproved comments or not
  * @return array The comment data
  */
-function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { // less flexible, but saves DB queries
+function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
 	global $postc, $wpdb;
 	if ( $no_cache ) {
 		$query = $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;comments WHERE comment_ID = %d&quot;, $comment_ID);
@@ -186,7 +206,7 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
 }
 
 /**
- * get_lastcommentmodified() - The date the last comment was modified
+ * The date the last comment was modified.
  *
  * {@internal Missing Long Description}}
  *
@@ -194,7 +214,8 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
  * @uses $wpdb
  * @global array $cache_lastcommentmodified
  *
- * @param string $timezone Which timezone to use in reference to 'gmt', 'blog', or 'server' locations
+ * @param string $timezone Which timezone to use in reference to 'gmt', 'blog',
+ *		or 'server' locations
  * @return string Last comment modified date
  */
 function get_lastcommentmodified($timezone = 'server') {
@@ -223,15 +244,14 @@ function get_lastcommentmodified($timezone = 'server') {
 }
 
 /**
- * get_comment_count() - The amount of comments in a post or total comments
+ * The amount of comments in a post or total comments.
  *
  * {@internal Missing Long Description}}
  *
  * @since 2.0.0
  * @uses $wpdb
  *
- * @param int $post_id Optional. Comment amount in post if &gt; 0, else total com
-ments blog wide
+ * @param int $post_id Optional. Comment amount in post if &gt; 0, else total comments blog wide
  * @return array The amount of spam, approved, awaiting moderation, and total
  */
 function get_comment_count( $post_id = 0 ) {
@@ -241,7 +261,7 @@ function get_comment_count( $post_id = 0 ) {
 
 	$where = '';
 	if ( $post_id &gt; 0 ) {
-		$where = &quot;WHERE comment_post_ID = {$post_id}&quot;;
+		$where = $wpdb-&gt;prepare(&quot;WHERE comment_post_ID = %d&quot;, $post_id);
 	}
 
 	$totals = (array) $wpdb-&gt;get_results(&quot;
@@ -281,12 +301,12 @@ function get_comment_count( $post_id = 0 ) {
 }
 
 /**
- * sanitize_comment_cookies() - {@internal Missing Short Description}}
+ * Sanitizes the cookies sent to the user already.
  *
- * {@internal Missing Long Description}}
+ * Will only do anything if the cookies have already been created for the user.
+ * Mostly used after cookies had been sent to use elsewhere.
  *
  * @since 2.0.4
- *
  */
 function sanitize_comment_cookies() {
 	if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) {
@@ -311,7 +331,7 @@ function sanitize_comment_cookies() {
 }
 
 /**
- * wp_allow_comment() - Validates whether this comment is allowed to be made or not
+ * Validates whether this comment is allowed to be made or not.
  *
  * {@internal Missing Long Description}}
  *
@@ -344,7 +364,7 @@ function wp_allow_comment($commentdata) {
 		$post_author = $wpdb-&gt;get_var($wpdb-&gt;prepare(&quot;SELECT post_author FROM $wpdb-&gt;posts WHERE ID = %d LIMIT 1&quot;, $comment_post_ID));
 	}
 
-	if ( $userdata &amp;&amp; ( $user_id == $post_author || $user-&gt;has_cap('level_9') ) ) {
+	if ( $userdata &amp;&amp; ( $user_id == $post_author || $user-&gt;has_cap('moderate_comments') ) ) {
 		// The author and the admins get respect.
 		$approved = 1;
 	 } else {
@@ -362,7 +382,7 @@ function wp_allow_comment($commentdata) {
 }
 
 /**
- * check_comment_flood_db() - {@internal Missing Short Description}}
+ * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
@@ -379,7 +399,7 @@ function check_comment_flood_db( $ip, $email, $date ) {
 	global $wpdb;
 	if ( current_user_can( 'manage_options' ) )
 		return; // don't throttle admins
-	if ( $lasttime = $wpdb-&gt;get_var(&quot;SELECT comment_date_gmt FROM $wpdb-&gt;comments WHERE comment_author_IP = '$ip' OR comment_author_email = '$email' ORDER BY comment_date DESC LIMIT 1&quot;) ) {
+	if ( $lasttime = $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT comment_date_gmt FROM $wpdb-&gt;comments WHERE comment_author_IP = %s OR comment_author_email = %s ORDER BY comment_date DESC LIMIT 1&quot;, $ip, $email) ) ) {
 		$time_lastcomment = mysql2date('U', $lasttime);
 		$time_newcomment  = mysql2date('U', $date);
 		$flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment);
@@ -391,7 +411,7 @@ function check_comment_flood_db( $ip, $email, $date ) {
 }
 
 /**
- * wp_blacklist_check() - Does comment contain blacklisted characters or words
+ * Does comment contain blacklisted characters or words.
  *
  * {@internal Missing Long Description}}
  *
@@ -448,30 +468,55 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
 	return false;
 }
 
-function wp_count_comments() {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @param unknown_type $post_id
+ * @return unknown
+ */
+function wp_count_comments( $post_id = 0 ) {
 	global $wpdb;
 
-	$count = $wpdb-&gt;get_results( &quot;SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb-&gt;comments} GROUP BY comment_approved&quot;, ARRAY_A );
+	$post_id = (int) $post_id;
+
+	$count = wp_cache_get(&quot;comments-{$post_id}&quot;, 'counts');
 
+	if ( false !== $count )
+		return $count;
+
+	$where = '';
+	if( $post_id &gt; 0 )
+		$where = $wpdb-&gt;prepare( &quot;WHERE comment_post_ID = %d&quot;, $post_id );
+
+	$count = $wpdb-&gt;get_results( &quot;SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb-&gt;comments} {$where} GROUP BY comment_approved&quot;, ARRAY_A );
+
+	$total = 0;
 	$stats = array( );
 	$approved = array('0' =&gt; 'moderated', '1' =&gt; 'approved', 'spam' =&gt; 'spam');
 	foreach( (array) $count as $row_num =&gt; $row ) {
+		$total += $row['num_comments'];
 		$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
 	}
 
+	$stats['total_comments'] = $total;
 	foreach ( $approved as $key ) {
 		if ( empty($stats[$key]) )
 			$stats[$key] = 0;
 	}
 
-	return (object) $stats;
+	$stats = (object) $stats;
+	wp_cache_set(&quot;comments-{$post_id}&quot;, $stats, 'counts');
+
+	return $stats;
 }
 
 /**
- * wp_delete_comment() - Removes comment ID and maybe updates post comment count
+ * Removes comment ID and maybe updates post comment count.
  *
- * The post comment count will be updated if the comment was approved and has a post
- * ID available.
+ * The post comment count will be updated if the comment was approved and has a
+ * post ID available.
  *
  * @since 2.0.0
  * @uses $wpdb
@@ -487,7 +532,7 @@ function wp_delete_comment($comment_id) {
 
 	$comment = get_comment($comment_id);
 
-	if ( ! $wpdb-&gt;query(&quot;DELETE FROM $wpdb-&gt;comments WHERE comment_ID='$comment_id' LIMIT 1&quot;) )
+	if ( ! $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;comments WHERE comment_ID = %d LIMIT 1&quot;, $comment_id) ) )
 		return false;
 
 	$post_id = $comment-&gt;comment_post_ID;
@@ -501,7 +546,7 @@ function wp_delete_comment($comment_id) {
 }
 
 /**
- * wp_get_comment_status() - The status of a comment by ID
+ * The status of a comment by ID.
  *
  * @since 1.0.0
  *
@@ -528,7 +573,7 @@ function wp_get_comment_status($comment_id) {
 }
 
 /**
- * wp_get_current_commenter() - Get current commenter's name, email, and URL
+ * Get current commenter's name, email, and URL.
  *
  * Expects cookies content to already be sanitized. User of this function
  * might wish to recheck the returned array for validity.
@@ -558,7 +603,7 @@ function wp_get_current_commenter() {
 }
 
 /**
- * wp_insert_comment() - Inserts a comment to the database
+ * Inserts a comment to the database.
  *
  * {@internal Missing Long Description}}
  *
@@ -570,7 +615,7 @@ function wp_get_current_commenter() {
  */
 function wp_insert_comment($commentdata) {
 	global $wpdb;
-	extract($commentdata, EXTR_SKIP);
+	extract(stripslashes_deep($commentdata), EXTR_SKIP);
 
 	if ( ! isset($comment_author_IP) )
 		$comment_author_IP = '';
@@ -585,11 +630,10 @@ function wp_insert_comment($commentdata) {
 	if ( ! isset($user_id) )
 		$user_id = 0;
 
-	$result = $wpdb-&gt;query(&quot;INSERT INTO $wpdb-&gt;comments
+	$result = $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;INSERT INTO $wpdb-&gt;comments
 	(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id)
-	VALUES
-	('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id')
-	&quot;);
+	VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %d)&quot;,
+	$comment_post_ID, $comment_author, $comment_author_email, $comment_author_url, $comment_author_IP, $comment_date, $comment_date_gmt, $comment_content, $comment_approved, $comment_agent, $comment_type, $comment_parent, $user_id) );
 
 	$id = (int) $wpdb-&gt;insert_id;
 
@@ -600,11 +644,11 @@ function wp_insert_comment($commentdata) {
 }
 
 /**
- * wp_filter_comment() - Parses and returns comment information
+ * Parses and returns comment information.
  *
- * Sets the comment data 'filtered' field to true when finished. This
- * can be checked as to whether the comment should be filtered and to
- * keep from filtering the same comment more than once.
+ * Sets the comment data 'filtered' field to true when finished. This can be
+ * checked as to whether the comment should be filtered and to keep from
+ * filtering the same comment more than once.
  *
  * @since 2.0.0
  * @uses apply_filters() Calls 'pre_user_id' hook on comment author's user ID
@@ -631,7 +675,7 @@ function wp_filter_comment($commentdata) {
 }
 
 /**
- * wp_throttle_comment_flood() - {@internal Missing Short Description}}
+ * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
@@ -651,7 +695,7 @@ function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment)
 }
 
 /**
- * wp_new_comment() - Parses and adds a new comment to the database
+ * Parses and adds a new comment to the database.
  *
  * {@internal Missing Long Description}}
  *
@@ -699,7 +743,7 @@ function wp_new_comment( $commentdata ) {
 }
 
 /**
- * wp_set_comment_status() - Sets the status of comment ID
+ * Sets the status of comment ID.
  *
  * {@internal Missing Long Description}}
  *
@@ -714,13 +758,17 @@ function wp_set_comment_status($comment_id, $comment_status) {
 
 	switch ( $comment_status ) {
 		case 'hold':
-			$query = &quot;UPDATE $wpdb-&gt;comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1&quot;;
+			$query = $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;comments SET comment_approved='0' WHERE comment_ID = %d LIMIT 1&quot;, $comment_id);
 			break;
 		case 'approve':
-			$query = &quot;UPDATE $wpdb-&gt;comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1&quot;;
+			$query = $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;comments SET comment_approved='1' WHERE comment_ID = %d LIMIT 1&quot;, $comment_id);
+			if ( get_option('comments_notify') ) {
+				$comment = get_comment($comment_id);
+				wp_notify_postauthor($comment_id, $comment-&gt;comment_type);
+			}
 			break;
 		case 'spam':
-			$query = &quot;UPDATE $wpdb-&gt;comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1&quot;;
+			$query = $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;comments SET comment_approved='spam' WHERE comment_ID = %d LIMIT 1&quot;, $comment_id);
 			break;
 		case 'delete':
 			return wp_delete_comment($comment_id);
@@ -742,7 +790,7 @@ function wp_set_comment_status($comment_id, $comment_status) {
 }
 
 /**
- * wp_update_comment() - Parses and updates an existing comment in the database
+ * Parses and updates an existing comment in the database.
  *
  * {@internal Missing Long Description}}
  *
@@ -768,22 +816,29 @@ function wp_update_comment($commentarr) {
 	$commentarr = wp_filter_comment( $commentarr );
 
 	// Now extract the merged array.
-	extract($commentarr, EXTR_SKIP);
+	extract(stripslashes_deep($commentarr), EXTR_SKIP);
 
 	$comment_content = apply_filters('comment_save_pre', $comment_content);
 
 	$comment_date_gmt = get_gmt_from_date($comment_date);
 
-	$wpdb-&gt;query(
-		&quot;UPDATE $wpdb-&gt;comments SET
-			comment_content      = '$comment_content',
-			comment_author       = '$comment_author',
-			comment_author_email = '$comment_author_email',
-			comment_approved     = '$comment_approved',
-			comment_author_url   = '$comment_author_url',
-			comment_date         = '$comment_date',
-			comment_date_gmt     = '$comment_date_gmt'
-		WHERE comment_ID = $comment_ID&quot; );
+	$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;comments SET
+			comment_content      = %s,
+			comment_author       = %s,
+			comment_author_email = %s,
+			comment_approved     = %s,
+			comment_author_url   = %s,
+			comment_date         = %s,
+			comment_date_gmt     = %s
+		WHERE comment_ID = %d&quot;,
+			$comment_content,
+			$comment_author,
+			$comment_author_email,
+			$comment_approved,
+			$comment_author_url,
+			$comment_date,
+			$comment_date_gmt,
+			$comment_ID) );
 
 	$rval = $wpdb-&gt;rows_affected;
 
@@ -794,7 +849,7 @@ function wp_update_comment($commentarr) {
 }
 
 /**
- * wp_defer_comment_counting() - Whether to defer comment counting
+ * Whether to defer comment counting.
  *
  * When setting $defer to true, all post comment counts will not be updated
  * until $defer is set to false. When $defer is set to false, then all
@@ -821,15 +876,15 @@ function wp_defer_comment_counting($defer=null) {
 }
 
 /**
- * wp_update_comment_count() - Updates the comment count for post(s)
+ * Updates the comment count for post(s).
  *
- * When $do_deferred is false (is by default) and the comments have been
- * set to be deferred, the post_id will be added to a queue, which will
- * be updated at a later date and only updated once per post ID.
+ * When $do_deferred is false (is by default) and the comments have been set to
+ * be deferred, the post_id will be added to a queue, which will be updated at a
+ * later date and only updated once per post ID.
  *
- * If the comments have not be set up to be deferred, then the post will
- * be updated. When $do_deferred is set to true, then all previous deferred
- * post IDs will be updated along with the current $post_id.
+ * If the comments have not be set up to be deferred, then the post will be
+ * updated. When $do_deferred is set to true, then all previous deferred post
+ * IDs will be updated along with the current $post_id.
  *
  * @since 2.1.0
  * @see wp_update_comment_count_now() For what could cause a false return value
@@ -860,7 +915,7 @@ function wp_update_comment_count($post_id, $do_deferred=false) {
 }
 
 /**
- * wp_update_comment_count_now() - Updates the comment count for the post
+ * Updates the comment count for the post.
  *
  * @since 2.5
  * @uses $wpdb
@@ -879,8 +934,8 @@ function wp_update_comment_count_now($post_id) {
 		return false;
 
 	$old = (int) $post-&gt;comment_count;
-	$new = (int) $wpdb-&gt;get_var(&quot;SELECT COUNT(*) FROM $wpdb-&gt;comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1'&quot;);
-	$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;posts SET comment_count = '$new' WHERE ID = '$post_id'&quot;);
+	$new = (int) $wpdb-&gt;get_var( $wpdb-&gt;prepare(&quot;SELECT COUNT(*) FROM $wpdb-&gt;comments WHERE comment_post_ID = %d AND comment_approved = '1'&quot;, $post_id) );
+	$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET comment_count = %d WHERE ID = %d&quot;, $new, $post_id) );
 
 	if ( 'page' == $post-&gt;post_type )
 		clean_page_cache( $post_id );
@@ -898,7 +953,7 @@ function wp_update_comment_count_now($post_id) {
 //
 
 /**
- * discover_pingback_server_uri() - Finds a pingback server URI based on the given URL
+ * Finds a pingback server URI based on the given URL.
  *
  * {@internal Missing Long Description}}
  *
@@ -974,23 +1029,27 @@ function discover_pingback_server_uri($url, $timeout_bytes = 2048) {
 			$pingback_server_url_len = $pingback_href_end - $pingback_href_start;
 			$pingback_server_url = substr($contents, $pingback_href_start, $pingback_server_url_len);
 			// We may find rel=&quot;pingback&quot; but an incomplete pingback URL
-			if ( $pingback_server_url_len &gt; 0 ) // We got it!
+			if ( $pingback_server_url_len &gt; 0 ) { // We got it!
+				fclose($fp);
 				return $pingback_server_url;
+			}
 		}
 		$byte_count += strlen($line);
 		if ( $byte_count &gt; $timeout_bytes ) {
 			// It's no use going further, there probably isn't any pingback
 			// server to find in this file. (Prevents loading large files.)
+			fclose($fp);
 			return false;
 		}
 	}
 
 	// We didn't find anything.
+	fclose($fp);
 	return false;
 }
 
 /**
- * do_all_pings() - {@internal Missing Short Description}}
+ * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
@@ -1008,7 +1067,7 @@ function do_all_pings() {
 
 	// Do Enclosures
 	while ($enclosure = $wpdb-&gt;get_row(&quot;SELECT * FROM {$wpdb-&gt;posts}, {$wpdb-&gt;postmeta} WHERE {$wpdb-&gt;posts}.ID = {$wpdb-&gt;postmeta}.post_id AND {$wpdb-&gt;postmeta}.meta_key = '_encloseme' LIMIT 1&quot;)) {
-		$wpdb-&gt;query(&quot;DELETE FROM {$wpdb-&gt;postmeta} WHERE post_id = {$enclosure-&gt;ID} AND meta_key = '_encloseme';&quot;);
+		$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM {$wpdb-&gt;postmeta} WHERE post_id = %d AND meta_key = '_encloseme';&quot;, $enclosure-&gt;ID) );
 		do_enclose($enclosure-&gt;post_content, $enclosure-&gt;ID);
 	}
 
@@ -1023,7 +1082,7 @@ function do_all_pings() {
 }
 
 /**
- * do_trackbacks() - {@internal Missing Short Description}}
+ * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
@@ -1035,11 +1094,11 @@ function do_all_pings() {
 function do_trackbacks($post_id) {
 	global $wpdb;
 
-	$post = $wpdb-&gt;get_row(&quot;SELECT * FROM $wpdb-&gt;posts WHERE ID = $post_id&quot;);
+	$post = $wpdb-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT * FROM $wpdb-&gt;posts WHERE ID = %d&quot;, $post_id) );
 	$to_ping = get_to_ping($post_id);
 	$pinged  = get_pung($post_id);
 	if ( empty($to_ping) ) {
-		$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;posts SET to_ping = '' WHERE ID = '$post_id'&quot;);
+		$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET to_ping = '' WHERE ID = %d&quot;, $post_id) );
 		return;
 	}
 
@@ -1060,14 +1119,14 @@ function do_trackbacks($post_id) {
 				trackback($tb_ping, $post_title, $excerpt, $post_id);
 				$pinged[] = $tb_ping;
 			} else {
-				$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = '$post_id'&quot;);
+				$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = %d&quot;, $post_id) );
 			}
 		}
 	}
 }
 
 /**
- * generic_ping() - {@internal Missing Short Description}}
+ * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
@@ -1090,7 +1149,7 @@ function generic_ping($post_id = 0) {
 }
 
 /**
- * pingback() - Pings back the links found in a post
+ * Pings back the links found in a post.
  *
  * {@internal Missing Long Description}}
  *
@@ -1167,7 +1226,7 @@ function pingback($content, $post_ID) {
 }
 
 /**
- * privacy_ping_filter() - {@internal Missing Short Description}}
+ * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
@@ -1184,19 +1243,19 @@ function privacy_ping_filter($sites) {
 }
 
 /**
- * trackback() - Send a Trackback
+ * Send a Trackback.
  *
- * {@internal Missing Long Description}}
+ * Updates database when sending trackback to prevent duplicates.
  *
  * @since 0.71
  * @uses $wpdb
  * @uses $wp_version WordPress version
  *
- * @param string $trackback_url {@internal Missing Description}}
- * @param string $title {@internal Missing Description}}
- * @param string $excerpt {@internal Missing Description}}
- * @param int $ID {@internal Missing Description}}
- * @return unknown {@internal Missing Description}}
+ * @param string $trackback_url URL to send trackbacks.
+ * @param string $title Title of post
+ * @param string $excerpt Excerpt of post
+ * @param int $ID Post ID
+ * @return mixed Database query from update
  */
 function trackback($trackback_url, $title, $excerpt, $ID) {
 	global $wpdb, $wp_version;
@@ -1225,21 +1284,19 @@ function trackback($trackback_url, $title, $excerpt, $ID) {
 	@fclose($fs);
 
 	$tb_url = addslashes( $tb_url );
-	$wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;posts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = '$ID'&quot;);
-	return $wpdb-&gt;query(&quot;UPDATE $wpdb-&gt;posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_url', '')) WHERE ID = '$ID'&quot;);
+	$wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = %d&quot;, $ID) );
+	return $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;UPDATE $wpdb-&gt;posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_url', '')) WHERE ID = %d&quot;, $ID) );
 }
 
 /**
- * weblog_ping() - {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
+ * Send a pingback.
  *
  * @since 1.2.0
  * @uses $wp_version
  * @uses IXR_Client
  *
- * @param unknown_type $server
- * @param unknown_type $path
+ * @param string $server Host of blog to connect to.
+ * @param string $path Path to send the ping.
  */
 function weblog_ping($server = '', $path = '') {
 	global $wp_version;
@@ -1262,7 +1319,7 @@ function weblog_ping($server = '', $path = '') {
 //
 
 /**
- * clean_comment_cache() - Removes comment ID from the comment cache
+ * Removes comment ID from the comment cache.
  *
  * @since 2.3.0
  * @package WordPress
@@ -1275,7 +1332,7 @@ function clean_comment_cache($id) {
 }
 
 /**
- * update_comment_cache() - Updates the comment cache of given comments
+ * Updates the comment cache of given comments.
  *
  * Will add the comments in $comments to the cache. If comment ID already
  * exists in the comment cache then it will not be updated.</diff>
      <filename>wp-includes/comment.php</filename>
    </modified>
    <modified>
      <diff>@@ -133,6 +133,7 @@ function wp_cron() {
 function wp_get_schedules() {
 	$schedules = array(
 		'hourly' =&gt; array( 'interval' =&gt; 3600, 'display' =&gt; __('Once Hourly') ),
+		'twicedaily' =&gt; array( 'interval' =&gt; 43200, 'display' =&gt; __('Twice Daily') ),
 		'daily' =&gt; array( 'interval' =&gt; 86400, 'display' =&gt; __('Once Daily') ),
 	);
 	return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );</diff>
      <filename>wp-includes/cron.php</filename>
    </modified>
    <modified>
      <diff>@@ -153,6 +153,8 @@ add_action('check_comment_flood', 'check_comment_flood_db', 10, 3);
 add_filter('comment_flood_filter', 'wp_throttle_comment_flood', 10, 3);
 add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
 add_filter('comment_email', 'antispambot');
+add_filter('option_tag_base', '_wp_filter_taxonomy_base');
+add_filter('option_category_base', '_wp_filter_taxonomy_base');
 
 //Atom SSL support
 add_filter('atom_service_url','atom_service_url_filter');
@@ -175,9 +177,11 @@ add_action('do_pings', 'do_all_pings', 10, 1);
 add_action('do_robots', 'do_robots');
 add_action('sanitize_comment_cookies', 'sanitize_comment_cookies');
 add_action('admin_print_scripts', 'wp_print_scripts', 20);
+add_action('admin_print_styles', 'wp_print_styles', 20);
 add_action('init', 'smilies_init', 5);
 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 );
 add_action( 'shutdown', 'wp_ob_end_flush_all', 1);
+add_action( 'pre_post_update', 'wp_save_post_revision' );
 add_action('publish_post', '_publish_post_hook', 5, 1);
 add_action('future_post', '_future_post_hook', 5, 2);
 add_action('future_page', '_future_post_hook', 5, 2);</diff>
      <filename>wp-includes/default-filters.php</filename>
    </modified>
    <modified>
      <diff>@@ -1064,14 +1064,14 @@ function get_links($category = -1, $before = '', $after = '&lt;br /&gt;', $between = '
  *
  * @author Dougal
  * @since 1.0.1
- * @deprecated Use get_categories()
- * @see get_categories()
+ * @deprecated Use wp_list_bookmarks()
+ * @see wp_list_bookmarks()
  *
  * @param string $order Sort link categories by 'name' or 'id'
  * @param string $$deprecated Not Used
  */
 function get_links_list($order = 'name', $deprecated = '') {
-	_deprecated_function(__FUNCTION__, '0.0', 'get_categories()');
+	_deprecated_function(__FUNCTION__, '0.0', 'wp_list_bookmarks()');
 
 	$order = strtolower($order);
 </diff>
      <filename>wp-includes/deprecated.php</filename>
    </modified>
    <modified>
      <diff>@@ -49,7 +49,7 @@ $more = 1;
 &lt;?php atom_enclosure(); ?&gt;
 &lt;?php do_action('atom_entry'); ?&gt;
 		&lt;link rel=&quot;replies&quot; type=&quot;text/html&quot; href=&quot;&lt;?php the_permalink_rss() ?&gt;#comments&quot; thr:count=&quot;&lt;?php echo get_comments_number()?&gt;&quot;/&gt;
-		&lt;link rel=&quot;replies&quot; type=&quot;appication/atom+xml&quot; href=&quot;&lt;?php echo get_post_comments_feed_link(0,'atom') ?&gt;&quot; thr:count=&quot;&lt;?php echo get_comments_number()?&gt;&quot;/&gt;
+		&lt;link rel=&quot;replies&quot; type=&quot;application/atom+xml&quot; href=&quot;&lt;?php echo get_post_comments_feed_link(0,'atom') ?&gt;&quot; thr:count=&quot;&lt;?php echo get_comments_number()?&gt;&quot;/&gt;
 		&lt;thr:total&gt;&lt;?php echo get_comments_number()?&gt;&lt;/thr:total&gt;
 	&lt;/entry&gt;
 	&lt;?php endwhile ; ?&gt;</diff>
      <filename>wp-includes/feed-atom.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,18 +1,83 @@
 &lt;?php
+/**
+ * WordPress Feed API
+ *
+ * Many of the functions used in here belong in The Loop, or The Loop for the
+ * Feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ */
 
+/**
+ * RSS container for the bloginfo function.
+ *
+ * You can retrieve anything that you can using the get_bloginfo() function.
+ * Everything will be stripped of tags and characters converted, when the values
+ * are retrieved for use in the feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 1.5.1
+ * @uses apply_filters() Calls 'get_bloginfo_rss' hook with two parameters.
+ * @see get_bloginfo() For the list of possible values to display.
+ *
+ * @param string $show See get_bloginfo() for possible values.
+ * @return string
+ */
 function get_bloginfo_rss($show = '') {
 	$info = strip_tags(get_bloginfo($show));
 	return apply_filters('get_bloginfo_rss', convert_chars($info), $show);
 }
 
+/**
+ * Display RSS container for the bloginfo function.
+ *
+ * You can retrieve anything that you can using the get_bloginfo() function.
+ * Everything will be stripped of tags and characters converted, when the values
+ * are retrieved for use in the feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 0.71
+ * @uses apply_filters() Calls 'bloginfo_rss' hook with two parameters.
+ * @see get_bloginfo() For the list of possible values to display.
+ *
+ * @param string $show See get_bloginfo() for possible values.
+ */
 function bloginfo_rss($show = '') {
 	echo apply_filters('bloginfo_rss', get_bloginfo_rss($show), $show);
 }
 
+/**
+ * Retrieve the default feed.
+ *
+ * The default feed is 'rss2', unless a plugin changes it through the
+ * 'default_feed' filter.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.5
+ * @uses apply_filters() Calls 'default_feed' hook on the default feed string.
+ *
+ * @return string Default feed, or for example 'rss2', 'atom', etc.
+ */
 function get_default_feed() {
 	return apply_filters('default_feed', 'rss2');
 }
 
+/**
+ * Retrieve the blog title for the feed title.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.2.0
+ * @uses apply_filters() Calls 'get_wp_title_rss' hook on title.
+ * @uses wp_title() See function for $sep parameter usage.
+ *
+ * @param string $sep Optional.How to separate the title. See wp_title() for more info.
+ * @return string Error message on failure or blog title on success.
+ */
 function get_wp_title_rss($sep = '&amp;#187;') {
 	$title = wp_title($sep, false);
 	if ( is_wp_error( $title ) )
@@ -21,22 +86,79 @@ function get_wp_title_rss($sep = '&amp;#187;') {
 	return $title;
 }
 
+/**
+ * Display the blog title for display of the feed title.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.2.0
+ * @uses apply_filters() Calls 'wp_title_rss' on the blog title.
+ * @see wp_title() $sep parameter usage.
+ *
+ * @param string $sep Optional.
+ */
 function wp_title_rss($sep = '&amp;#187;') {
 	echo apply_filters('wp_title_rss', get_wp_title_rss($sep));
 }
 
+/**
+ * Retrieve the current post title for the feed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.0.0
+ * @uses apply_filters() Calls 'the_title_rss' on the post title.
+ *
+ * @return string Current post title.
+ */
 function get_the_title_rss() {
 	$title = get_the_title();
 	$title = apply_filters('the_title_rss', $title);
 	return $title;
 }
 
-
+/**
+ * Display the post title in the feed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 0.71
+ * @uses get_the_title_rss() Used to retrieve current post title.
+ */
 function the_title_rss() {
 	echo get_the_title_rss();
 }
 
-
+/**
+ * Display the post content for the feed.
+ *
+ * For encoding the html or the $encode_html parameter, there are three possible
+ * values. '0' will make urls footnotes and use make_url_footnote(). '1' will
+ * encode special characters and automatically display all of the content. The
+ * value of '2' will strip all HTML tags from the content.
+ *
+ * Also note that you cannot set the amount of words and not set the html
+ * encoding. If that is the case, then the html encoding will default to 2,
+ * which will strip all HTML tags.
+ *
+ * To restrict the amount of words of the content, you can use the cut
+ * parameter. If the content is less than the amount, then there won't be any
+ * dots added to the end. If there is content left over, then dots will be added
+ * and the rest of the content will be removed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 0.71
+ * @uses apply_filters() Calls 'the_content_rss' on the content before processing.
+ * @see get_the_content() For the $more_link_text, $stripteaser, and $more_file
+ *		parameters.
+ *
+ * @param string $more_link_text Optional. Text to display when more content is available but not displayed.
+ * @param int|bool $stripteaser Optional. Default is 0.
+ * @param string $more_file Optional.
+ * @param int $cut Optional. Amount of words to keep for the content.
+ * @param int $encode_html Optional. How to encode the content.
+ */
 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
 	$content = get_the_content($more_link_text, $stripteaser, $more_file);
 	$content = apply_filters('the_content_rss', $content);
@@ -59,6 +181,8 @@ function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file
 			$k = count($blah);
 			$use_dotdotdot = 0;
 		}
+
+		/** @todo Check performance, might be faster to use array slice instead. */
 		for ( $i=0; $i&lt;$k; $i++ )
 			$excerpt .= $blah[$i].' ';
 		$excerpt .= ($use_dotdotdot) ? '...' : '';
@@ -68,21 +192,51 @@ function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file
 	echo $content;
 }
 
-
+/**
+ * Display the post excerpt for the feed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 0.71
+ * @uses apply_filters() Calls 'the_excerpt_rss' hook on the excerpt.
+ */
 function the_excerpt_rss() {
 	$output = get_the_excerpt();
 	echo apply_filters('the_excerpt_rss', $output);
 }
 
+/**
+ * Display the permalink to the post for use in feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.3.0
+ * @uses apply_filters() Call 'the_permalink_rss' on the post permalink
+ */
 function the_permalink_rss() {
 	echo apply_filters('the_permalink_rss', get_permalink());
-
 }
 
+/**
+ * Display the feed GUID for the current comment.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since unknown
+ */
 function comment_guid() {
 	echo get_comment_guid();
 }
 
+/**
+ * Retrieve the feed GUID for the current comment.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since unknown
+ *
+ * @return bool|string false on failure or guid for comment on success.
+ */
 function get_comment_guid() {
 	global $comment;
 
@@ -92,24 +246,71 @@ function get_comment_guid() {
 	return get_the_guid($comment-&gt;comment_post_ID) . '#comment-' . $comment-&gt;comment_ID;
 }
 
+/**
+ * Display the link to the comments.
+ *
+ * @since 1.5.0
+ */
 function comment_link() {
 	echo get_comment_link();
 }
 
+/**
+ * Retrieve the current comment author for use in the feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.0.0
+ * @uses apply_filters() Calls 'comment_author_rss' hook on comment author.
+ * @uses get_comment_author()
+ *
+ * @return string Comment Author
+ */
 function get_comment_author_rss() {
 	return apply_filters('comment_author_rss', get_comment_author() );
 }
 
+/**
+ * Display the current comment author in the feed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 1.0.0
+ */
 function comment_author_rss() {
 	echo get_comment_author_rss();
 }
 
+/**
+ * Display the current comment content for use in the feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 1.0.0
+ * @uses apply_filters() Calls 'comment_text_rss' filter on comment content.
+ * @uses get_comment_text()
+ */
 function comment_text_rss() {
 	$comment_text = get_comment_text();
 	$comment_text = apply_filters('comment_text_rss', $comment_text);
 	echo $comment_text;
 }
 
+/**
+ * Retrieve all of the post categories, formatted for use in feeds.
+ *
+ * All of the categories for the current post in the feed loop, will be
+ * retrieved and have feed markup added, so that they can easily be added to the
+ * RSS2, Atom, or RSS1 and RSS0.91 RDF feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.1.0
+ * @uses apply_filters() 
+ *
+ * @param string $type Optional, default is 'rss'. Either 'rss', 'atom', or 'rdf'.
+ * @return string All of the post categories for displaying in the feed.
+ */
 function get_the_category_rss($type = 'rss') {
 	$categories = get_the_category();
 	$tags = get_the_tags();
@@ -142,10 +343,29 @@ function get_the_category_rss($type = 'rss') {
 	return apply_filters('the_category_rss', $the_list, $type);
 }
 
+/**
+ * Display the post categories in the feed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 0.71
+ * @see get_the_category_rss() For better explanation.
+ *
+ * @param string $type Optional, default is 'rss'. Either 'rss', 'atom', or 'rdf'.
+ */
 function the_category_rss($type = 'rss') {
 	echo get_the_category_rss($type);
 }
 
+/**
+ * Display the HTML type based on the blog setting.
+ *
+ * The two possible values are either 'xhtml' or 'html'.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.2.0
+ */
 function html_type_rss() {
 	$type = get_bloginfo('html_type');
 	if (strpos($type, 'xhtml') !== false)
@@ -155,7 +375,24 @@ function html_type_rss() {
 	echo $type;
 }
 
-
+/**
+ * Display the rss enclosure for the current post.
+ *
+ * Uses the global $post to check whether the post requires a password and if
+ * the user has the password for the post. If not then it will return before
+ * displaying.
+ *
+ * Also uses the function get_post_custom() to get the post's 'enclosure'
+ * metadata field and parses the value to display the enclosure(s). The
+ * enclosure(s) consist of enclosure HTML tag(s) with a URI and other
+ * attributes.
+ *
+ * @package WordPress
+ * @subpackage Template
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'rss_enclosure' hook on rss enclosure.
+ * @uses get_post_custom() To get the current post enclosure metadata.
+ */
 function rss_enclosure() {
 	global $post;
 	if ( !empty($post-&gt;post_password) &amp;&amp; (!isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || $_COOKIE['wp-postpass_'.COOKIEHASH] != $post-&gt;post_password) )
@@ -171,6 +408,23 @@ function rss_enclosure() {
 	}
 }
 
+/**
+ * Display the atom enclosure for the current post.
+ *
+ * Uses the global $post to check whether the post requires a password and if
+ * the user has the password for the post. If not then it will return before
+ * displaying.
+ *
+ * Also uses the function get_post_custom() to get the post's 'enclosure'
+ * metadata field and parses the value to display the enclosure(s). The
+ * enclosure(s) consist of link HTML tag(s) with a URI and other attributes.
+ *
+ * @package WordPress
+ * @subpackage Template
+ * @since 2.2.0
+ * @uses apply_filters() Calls 'atom_enclosure' hook on atom enclosure.
+ * @uses get_post_custom() To get the current post enclosure metadata.
+ */
 function atom_enclosure() {
 	global $post;
 	if ( !empty($post-&gt;post_password) &amp;&amp; ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post-&gt;post_password) )
@@ -187,7 +441,7 @@ function atom_enclosure() {
 }
 
 /**
- * prep_atom_text_construct() - Determine the type of a given string of data
+ * Determine the type of a string of data with the data formatted.
  *
  * Tell whether the type is text, html, or xhtml, per RFC 4287 section 3.1.
  *
@@ -202,8 +456,8 @@ function atom_enclosure() {
  * @subpackage Feed
  * @since 2.5
  *
- * @param string $data input string
- * @return array $result array(type, value)
+ * @param string $data Input string
+ * @return array array(type, value)
  */
 function prep_atom_text_construct($data) {
 	if (strpos($data, '&lt;') === false &amp;&amp; strpos($data, '&amp;') === false) {
@@ -232,14 +486,13 @@ function prep_atom_text_construct($data) {
 }
 
 /**
- * self_link() - Generate a correct link for the atom:self elemet
+ * Display the link for the currently displayed feed in a XSS safe way.
  *
- * Echo the link for the currently displayed feed in a XSS safe way.
+ * Generate a correct link for the atom:self element.
  *
  * @package WordPress
  * @subpackage Feed
  * @since 2.5
- *
  */
 function self_link() {
 	echo 'http'
@@ -248,4 +501,4 @@ function self_link() {
 		. wp_specialchars(stripslashes($_SERVER['REQUEST_URI']), 1);
 }
 
-?&gt;
+?&gt;
\ No newline at end of file</diff>
      <filename>wp-includes/feed.php</filename>
    </modified>
    <modified>
      <diff>@@ -3,9 +3,10 @@
 function wptexturize($text) {
 	global $wp_cockneyreplace;
 	$next = true;
+	$has_pre_parent = false;
 	$output = '';
 	$curl = '';
-	$textarr = preg_split('/(&lt;.*&gt;)/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
+	$textarr = preg_split('/(&lt;.*&gt;|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
 	$stop = count($textarr);
 
 	// if a plugin has provided an autocorrect array, use it
@@ -26,13 +27,17 @@ function wptexturize($text) {
 	for ( $i = 0; $i &lt; $stop; $i++ ) {
  		$curl = $textarr[$i];
 
-		if (isset($curl{0}) &amp;&amp; '&lt;' != $curl{0} &amp;&amp; $next) { // If it's not a tag
+		if (isset($curl{0}) &amp;&amp; '&lt;' != $curl{0} &amp;&amp; '[' != $curl{0} &amp;&amp; $next &amp;&amp; !$has_pre_parent) { // If it's not a tag
 			// static strings
 			$curl = str_replace($static_characters, $static_replacements, $curl);
 			// regular expressions
 			$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
-		} elseif (strpos($curl, '&lt;code') !== false || strpos($curl, '&lt;pre') !== false || strpos($curl, '&lt;kbd') !== false || strpos($curl, '&lt;style') !== false || strpos($curl, '&lt;script') !== false) {
+		} elseif (strpos($curl, '&lt;code') !== false || strpos($curl, '&lt;kbd') !== false || strpos($curl, '&lt;style') !== false || strpos($curl, '&lt;script') !== false) {
 			$next = false;
+		} elseif (strpos($curl, '&lt;pre') !== false) {
+			$has_pre_parent = true;
+		} elseif (strpos($curl, '&lt;/pre&gt;') !== false) {
+			$has_pre_parent = false;
 		} else {
 			$next = true;
 		}
@@ -92,6 +97,7 @@ function wpautop($pee, $br = 1) {
 	if (strpos($pee, '&lt;pre') !== false)
 		$pee = preg_replace_callback('!(&lt;pre.*?&gt;)(.*?)&lt;/pre&gt;!is', 'clean_pre', $pee );
 	$pee = preg_replace( &quot;|\n&lt;/p&gt;$|&quot;, '&lt;/p&gt;', $pee );
+	$pee = preg_replace('/&lt;p&gt;\s*?(' . get_shortcode_regex() . ')\s*&lt;\/p&gt;/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone
 
 	return $pee;
 }
@@ -366,6 +372,15 @@ function sanitize_title_with_dashes($title) {
 	return $title;
 }
 
+// ensures a string is a valid SQL order by clause like: post_name ASC, ID DESC
+// accepts one or more columns, with or without ASC/DESC, and also accepts RAND()
+function sanitize_sql_orderby( $orderby ){
+	preg_match('/^\s*([a-z0-9_]+(\s+(ASC|DESC))?(\s*,\s*|\s*$))+|^\s*RAND\(\s*\)\s*$/i', $orderby, $obmatches);
+	if ( !$obmatches )
+		return false;
+	return $orderby;
+}
+
 function convert_chars($content, $deprecated = '') {
 	// Translation of invalid Unicode references range to valid range
 	$wp_htmltranswinuni = array(
@@ -829,6 +844,9 @@ function human_time_diff( $from, $to = '' ) {
 function wp_trim_excerpt($text) { // Fakes an excerpt if needed
 	if ( '' == $text ) {
 		$text = get_the_content('');
+		
+		$text = strip_shortcodes( $text ); 
+		
 		$text = apply_filters('the_content', $text);
 		$text = str_replace(']]&gt;', ']]&amp;gt;', $text);
 		$text = strip_tags($text);
@@ -1111,13 +1129,9 @@ function wp_richedit_pre($text) {
 	// Filtering a blank results in an annoying &lt;br /&gt;\n
 	if ( empty($text) ) return apply_filters('richedit_pre', '');
 
-	$output = $text;
-	$output = convert_chars($output);
+	$output = convert_chars($text);
 	$output = wpautop($output);
-
-	// These must be double-escaped or planets will collide.
-	$output = str_replace('&amp;lt;', '&amp;amp;lt;', $output);
-	$output = str_replace('&amp;gt;', '&amp;amp;gt;', $output);
+	$output = htmlspecialchars($output, ENT_NOQUOTES);
 
 	return apply_filters('richedit_pre', $output);
 }</diff>
      <filename>wp-includes/formatting.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,27 @@
 &lt;?php
+/**
+ * Main WordPress API
+ *
+ * @package WordPress
+ */
 
+/**
+ * Converts MySQL DATETIME field to user specified date format.
+ *
+ * If $dateformatstring has 'G' value, then gmmktime() function will be used to
+ * make the time. If $dateformatstring is set to 'U', then mktime() function
+ * will be used to make the time.
+ *
+ * The $translate will only be used, if it is set to true and it is by default
+ * and if the $wp_locale object has the month and weekday set.
+ *
+ * @since 0.71
+ *
+ * @param string $dateformatstring Either 'G', 'U', or php date format.
+ * @param string $mysqlstring Time from mysql DATETIME field.
+ * @param bool $translate Optional. Default is true. Will switch format to locale.
+ * @return string Date formated by $dateformatstring or locale (if available).
+ */
 function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) {
 	global $wp_locale;
 	$m = $mysqlstring;
@@ -51,7 +73,21 @@ function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) {
 	return $j;
 }
 
-
+/**
+ * Retrieve the current time based on specified type.
+ *
+ * The 'mysql' type will return the time in the format for MySQL DATETIME field.
+ * The 'timestamp' type will return the current timestamp.
+ *
+ * If the $gmt is set to either '1' or 'true', then both types will use the
+ * GMT offset in the WordPress option to add the GMT offset to the time.
+ *
+ * @since 1.0.0
+ *
+ * @param string $type Either 'mysql' or 'timestamp'.
+ * @param int|bool $gmt Optional. Whether to use $gmt offset. Default is false.
+ * @return unknown
+ */
 function current_time( $type, $gmt = 0 ) {
 	switch ( $type ) {
 		case 'mysql':
@@ -63,10 +99,26 @@ function current_time( $type, $gmt = 0 ) {
 	}
 }
 
-
+/**
+ * Retrieve the date in localized format, based on timestamp.
+ *
+ * If the locale specifies the locale month and weekday, then the locale will
+ * take over the format for the date. If it isn't, then the date format string
+ * will be used instead.
+ *
+ * @since 0.71
+ *
+ * @param string $dateformatstring Format to display the date
+ * @param int $unixtimestamp Unix timestamp
+ * @return string The date, translated if locale specifies it.
+ */
 function date_i18n( $dateformatstring, $unixtimestamp ) {
 	global $wp_locale;
 	$i = $unixtimestamp;
+	// Sanity check for PHP 5.1.0-
+	if ( -1 == $i )
+		$i = false;
+	
 	if ( ( !empty( $wp_locale-&gt;month ) ) &amp;&amp; ( !empty( $wp_locale-&gt;weekday ) ) ) {
 		$datemonth = $wp_locale-&gt;get_month( date( 'm', $i ) );
 		$datemonth_abbrev = $wp_locale-&gt;get_month_abbrev( $datemonth );
@@ -88,7 +140,15 @@ function date_i18n( $dateformatstring, $unixtimestamp ) {
 	return $j;
 }
 
-
+/**
+ * Convert number to format based on the locale.
+ *
+ * @since 2.3.0
+ *
+ * @param mixed $number The number to convert based on locale.
+ * @param int $decimals Precision of the number of decimal places.
+ * @return string Converted number in string format.
+ */
 function number_format_i18n( $number, $decimals = null ) {
 	global $wp_locale;
 	// let the user override the precision only
@@ -97,10 +157,28 @@ function number_format_i18n( $number, $decimals = null ) {
 	return number_format( $number, $decimals, $wp_locale-&gt;number_format['decimal_point'], $wp_locale-&gt;number_format['thousands_sep'] );
 }
 
-
+/**
+ * Convert number of bytes largest unit bytes will fit into.
+ *
+ * It is easier to read 1kB than 1024 bytes and 1MB than 1048576 bytes. Converts
+ * number of bytes to human readable number by taking the number of that unit
+ * that the bytes will go into it. Supports TB value.
+ *
+ * Please note that integers in PHP are limited to 32 bits, unless they are on
+ * 64 bit architecture, then they have 64 bit size. If you need to place the
+ * larger size then what PHP integer type will hold, then use a string. It will
+ * be converted to a double, which should always have 64 bit length.
+ *
+ * Technically the correct unit names for powers of 1024 are KiB, MiB etc.
+ * @link http://en.wikipedia.org/wiki/Byte
+ *
+ * @since 2.3.0
+ *
+ * @param int|string $bytes Number of bytes. Note max integer size for integers.
+ * @param int $decimals Precision of number of decimal places.
+ * @return unknown
+ */
 function size_format( $bytes, $decimals = null ) {
-	// technically the correct unit names for powers of 1024 are KiB, MiB etc
-	// see http://en.wikipedia.org/wiki/Byte
 	$quant = array(
 		// ========================= Origin ====
 		'TB' =&gt; 1099511627776,  // pow( 1024, 4)
@@ -144,7 +222,14 @@ function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
 	return $week;
 }
 
-
+/**
+ * Unserialize value only if it was serialized.
+ *
+ * @since 2.0.0
+ *
+ * @param string $original Maybe unserialized original, if is needed.
+ * @return mixed Unserialized data can be any type.
+ */
 function maybe_unserialize( $original ) {
 	if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
 		if ( false !== $gm = @unserialize( $original ) )
@@ -152,7 +237,17 @@ function maybe_unserialize( $original ) {
 	return $original;
 }
 
-
+/**
+ * Check value to find if it was serialized.
+ *
+ * If $data is not an string, then returned value will always be false.
+ * Serialized data is always a string.
+ *
+ * @since 2.0.5
+ *
+ * @param mixed $data Value to check to see if was serialized.
+ * @return bool False if not serialized and true if it was.
+ */
 function is_serialized( $data ) {
 	// if it isn't a string, it isn't serialized
 	if ( !is_string( $data ) )
@@ -179,7 +274,14 @@ function is_serialized( $data ) {
 	return false;
 }
 
-
+/**
+ * Check whether serialized data is of string type.
+ *
+ * @since 2.0.5
+ *
+ * @param mixed $data Serialized data
+ * @return bool False if not a serialized string, true if it is.
+ */
 function is_serialized_string( $data ) {
 	// if it isn't a string, it isn't a serialized string
 	if ( !is_string( $data ) )
@@ -190,10 +292,33 @@ function is_serialized_string( $data ) {
 	return false;
 }
 
-
-/* Options functions */
-
-// expects $setting to already be SQL-escaped
+/**
+ * Retrieve option value based on setting name.
+ *
+ * If the option does not exist or does not have a value, then the return value
+ * will be false. This is useful to check whether you need to install an option
+ * and is commonly used during installation of plugin options and to test
+ * whether upgrading is required.
+ *
+ * You can &quot;short-circuit&quot; the retrieval of the option from the database for
+ * your plugin or core options that aren't protected. You can do so by hooking
+ * into the 'pre_option_$option' with the $option being replaced by the option
+ * name. You should not try to override special options, but you will not be
+ * prevented from doing so.
+ *
+ * There is a second filter called 'option_$option' with the $option being
+ * replaced with the option name. This gives the value as the only parameter.
+ *
+ * @since 1.5.0
+ * @package WordPress
+ * @subpackage Option
+ * @uses apply_filters() Calls 'pre_option_$optionname' false to allow
+ *		overwriting the option value in a plugin.
+ * @uses apply_filters() Calls 'option_$optionname' with the option name value.
+ *
+ * @param string $setting Name of option to retrieve. Should already be SQL-escaped
+ * @return mixed Value set for the option.
+ */
 function get_option( $setting ) {
 	global $wpdb;
 
@@ -216,7 +341,7 @@ function get_option( $setting ) {
 
 		if ( false === $value ) {
 			if ( defined( 'WP_INSTALLING' ) )
-				$supress = $wpdb-&gt;suppress_errors();
+				$suppress = $wpdb-&gt;suppress_errors();
 			// expected_slashed ($setting)
 			$row = $wpdb-&gt;get_row( &quot;SELECT option_value FROM $wpdb-&gt;options WHERE option_name = '$setting' LIMIT 1&quot; );
 			if ( defined( 'WP_INSTALLING' ) )
@@ -243,17 +368,52 @@ function get_option( $setting ) {
 	return apply_filters( 'option_' . $setting, maybe_unserialize( $value ) );
 }
 
-
+/**
+ * Protect WordPress special option from being modified.
+ *
+ * Will die if $option is in protected list.
+ *
+ * @since 2.2.0
+ * @package WordPress
+ * @subpackage Option
+ *
+ * @param string $option Option name.
+ */
 function wp_protect_special_option( $option ) {
 	$protected = array( 'alloptions', 'notoptions' );
 	if ( in_array( $option, $protected ) )
 		die( sprintf( __( '%s is a protected WP option and may not be modified' ), wp_specialchars( $option ) ) );
 }
 
+/**
+ * Print option value after sanitizing for forms.
+ *
+ * @uses attribute_escape Sanitizes value.
+ * @since 1.5.0
+ * @package WordPress
+ * @subpackage Option
+ *
+ * @param string $option Option name.
+ */
 function form_option( $option ) {
 	echo attribute_escape (get_option( $option ) );
 }
 
+/**
+ * Retrieve all autoload options or all options, if no autoloaded ones exist.
+ *
+ * This is different from wp_load_alloptions(), in this that function does not
+ * cache all options and will retrieve all options from the database every time
+ * it is called.
+ *
+ * @since 1.0.0
+ * @package WordPress
+ * @subpackage Option
+ * @uses apply_filters() Calls 'pre_option_$optionname' hook with option value as parameter.
+ * @uses apply_filters() Calls 'all_options' on options list.
+ *
+ * @return array List of all options.
+ */
 function get_alloptions() {
 	global $wpdb, $wp_queries;
 	$show = $wpdb-&gt;hide_errors();
@@ -264,7 +424,7 @@ function get_alloptions() {
 	foreach ( $options as $option ) {
 		// &quot;When trying to design a foolproof system,
 		//  never underestimate the ingenuity of the fools :)&quot; -- Dougal
-		if ( in_array( $option-&gt;option_name, array( 'siteurl', 'home', 'category_base' ) ) )
+		if ( in_array( $option-&gt;option_name, array( 'siteurl', 'home', 'category_base', 'tag_base' ) ) )
 			$option-&gt;option_value = untrailingslashit( $option-&gt;option_value );
 		$value = maybe_unserialize( $option-&gt;option_value );
 		$all_options-&gt;{$option-&gt;option_name} = apply_filters( 'pre_option_' . $option-&gt;option_name, $value );
@@ -272,7 +432,18 @@ function get_alloptions() {
 	return apply_filters( 'all_options', $all_options );
 }
 
-
+/**
+ * Loads and caches all autoloaded options, if available or all options.
+ *
+ * This is different from get_alloptions(), in that this function will cache the
+ * options and will return the cached options when called again.
+ *
+ * @since 2.2.0
+ * @package WordPress
+ * @subpackage Option
+ *
+ * @return array List all options.
+ */
 function wp_load_alloptions() {
 	global $wpdb;
 
@@ -291,8 +462,26 @@ function wp_load_alloptions() {
 	return $alloptions;
 }
 
-
-// expects $option_name to NOT be SQL-escaped
+/**
+ * Update the value of an option that was already added.
+ *
+ * If the option does not exist, then the option will be added with the option
+ * value, but you will not be able to set whether it is autoloaded. If you want
+ * to set whether an option autoloaded, then you need to use the add_option().
+ *
+ * When the option is updated, then the filter named
+ * 'update_option_$option_name', with the $option_name as the $option_name
+ * parameter value, will be called. The hook should accept two parameters, the
+ * first is the old parameter and the second is the new parameter.
+ *
+ * @since 1.0.0
+ * @package WordPress
+ * @subpackage Option
+ *
+ * @param string $option_name Option name. Expected to not be SQL-escaped
+ * @param mixed $newvalue Option value.
+ * @return bool False if value was not updated and true if value was updated.
+ */
 function update_option( $option_name, $newvalue ) {
 	global $wpdb;
 
@@ -301,8 +490,11 @@ function update_option( $option_name, $newvalue ) {
 	$safe_option_name = $wpdb-&gt;escape( $option_name );
 	$newvalue = sanitize_option( $option_name, $newvalue );
 
-	// If the new and old values are the same, no need to update.
 	$oldvalue = get_option( $safe_option_name );
+
+	$newvalue = apply_filters( 'pre_update_option_' . $option_name, $newvalue, $oldvalue );
+
+	// If the new and old values are the same, no need to update.
 	if ( $newvalue === $oldvalue )
 		return false;
 
@@ -336,9 +528,30 @@ function update_option( $option_name, $newvalue ) {
 	return false;
 }
 
-
-// thx Alex Stapleton, http://alex.vort-x.net/blog/
-// expects $name to NOT be SQL-escaped
+/**
+ * Add a new option.
+ *
+ * You can create options without values and then add values later. Does not
+ * check whether the option has already been added, but does check that you
+ * aren't adding a protected WordPress option. Care should be taken to not name
+ * options, the same as the ones which are protected and to not add options
+ * that were already added.
+ *
+ * The filter named 'add_option_$optionname', with the $optionname being
+ * replaced with the option's name, will be called. The hook should accept two
+ * parameters, the first is the option name, and the second is the value.
+ *
+ * @package WordPress
+ * @subpackage Option
+ * @since 1.0.0
+ * @link http://alex.vort-x.net/blog/ Thanks Alex Stapleton
+ *
+ * @param string $name Option name to add. Expects to NOT be SQL escaped.
+ * @param mixed $value Optional. Option value, can be anything.
+ * @param mixed $deprecated Optional. Description. Not used anymore.
+ * @param bool $autoload Optional. Default is enabled. Whether to load the option when WordPress starts up.
+ * @return null returns when finished.
+ */
 function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {
 	global $wpdb;
 
@@ -372,11 +585,20 @@ function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {
 
 	$wpdb-&gt;query( $wpdb-&gt;prepare( &quot;INSERT INTO $wpdb-&gt;options (option_name, option_value, autoload) VALUES (%s, %s, %s)&quot;, $name, $value, $autoload ) );
 
-	do_action( &quot;add_option_{$name}&quot;, $name, $value ); 
+	do_action( &quot;add_option_{$name}&quot;, $name, $value );
 	return;
 }
 
-
+/**
+ * Removes option by name and prevents removal of protected WordPress options.
+ *
+ * @package WordPress
+ * @subpackage Option
+ * @since unknown
+ *
+ * @param string $name Option name to remove.
+ * @return bool True, if succeed. False, if failure.
+ */
 function delete_option( $name ) {
 	global $wpdb;
 
@@ -401,14 +623,19 @@ function delete_option( $name ) {
 	return true;
 }
 
-
+/**
+ * Serialize data, if needed.
+ *
+ * @param mixed $data Data that might be serialized.
+ * @return mixed A scalar data
+ */
 function maybe_serialize( $data ) {
-	if ( is_string( $data ) )
-		$data = trim( $data );
-	elseif ( is_array( $data ) || is_object( $data ) )
+	if ( is_array( $data ) || is_object( $data ) )
 		return serialize( $data );
+
 	if ( is_serialized( $data ) )
 		return serialize( $data );
+
 	return $data;
 }
 
@@ -465,7 +692,22 @@ function xmlrpc_removepostdata( $content ) {
 	return $content;
 }
 
-
+/**
+ * Open the file handle for debugging.
+ *
+ * This function is used for XMLRPC feature, but it is general purpose enough
+ * to be used in anywhere.
+ *
+ * @see fopen() for mode options.
+ * @package WordPress
+ * @subpackage Debug
+ * @since unknown
+ * @uses $debug Used for whether debugging is enabled.
+ *
+ * @param string $filename File path to debug file.
+ * @param string $mode Same as fopen() mode parameter.
+ * @return bool|resource File handle. False on failure.
+ */
 function debug_fopen( $filename, $mode ) {
 	global $debug;
 	if ( 1 == $debug ) {
@@ -476,14 +718,39 @@ function debug_fopen( $filename, $mode ) {
 	}
 }
 
-
+/**
+ * Write contents to the file used for debugging.
+ *
+ * Technically, this can be used to write to any file handle when the global
+ * $debug is set to 1 or true.
+ *
+ * @package WordPress
+ * @subpackage Debug
+ * @since unknown
+ * @uses $debug Used for whether debugging is enabled.
+ *
+ * @param resource $fp File handle for debugging file.
+ * @param string $string Content to write to debug file.
+ */
 function debug_fwrite( $fp, $string ) {
 	global $debug;
 	if ( 1 == $debug )
 		fwrite( $fp, $string );
 }
 
-
+/**
+ * Close the debugging file handle.
+ *
+ * Technically, this can be used to close any file handle when the global $debug
+ * is set to 1 or true.
+ *
+ * @package WordPress
+ * @subpackage Debug
+ * @since unknown
+ * @uses $debug Used for whether debugging is enabled.
+ *
+ * @param resource $fp Debug File handle.
+ */
 function debug_fclose( $fp ) {
 	global $debug;
 	if ( 1 == $debug )
@@ -536,9 +803,19 @@ function do_enclose( $content, $post_ID ) {
 	}
 }
 
-// perform a HTTP HEAD or GET request
-// if $file_path is a writable filename, this will do a GET request and write the file to that path
-// returns a list of HTTP headers
+/**
+ * Perform a HTTP HEAD or GET request.
+ *
+ * If $file_path is a writable filename, this will do a GET request and write
+ * the file to that path.
+ *
+ * @since unknown
+ *
+ * @param string $url
+ * @param string|bool $file_path Optional. File path to write request to.
+ * @param int $red Optional. Number of Redirects. Stops at 5 redirects.
+ * @return bool|string False on failure and string of headers if HEAD request.
+ */
 function wp_get_http( $url, $file_path = false, $red = 1 ) {
 	global $wp_version;
 	@set_time_limit( 60 );
@@ -610,11 +887,30 @@ function wp_get_http( $url, $file_path = false, $red = 1 ) {
 	return $headers;
 }
 
+/**
+ * Retrieve HTTP Headers from URL.
+ *
+ * @since 1.5.1
+ *
+ * @param string $url
+ * @param int $red Optional. Number of redirects.
+ * @return bool|string False on failure, headers on success.
+ */
 function wp_get_http_headers( $url, $red = 1 ) {
 	return wp_get_http( $url, false, $red );
 }
 
-
+/**
+ * Whether today is a new day.
+ *
+ * {@internal Need to find out how this function is used.}}
+ *
+ * @since 0.71
+ * @uses $day Today
+ * @uses $previousday Previous day
+ *
+ * @return int 1 when new day, 0 if not a new day.
+ */
 function is_new_day() {
 	global $day, $previousday;
 	if ( $day != $previousday )
@@ -623,22 +919,42 @@ function is_new_day() {
 		return 0;
 }
 
-
+/**
+ * Build URL query based on an associative and, or indexed array.
+ *
+ * This is a convenient function for easily building url queries. It sets the
+ * separator to '&amp;' and uses _http_build_query() function.
+ *
+ * @see _http_build_query() Used to build the query
+ * @link http://us2.php.net/manual/en/function.http-build-query.php more on what
+ *		http_build_query() does.
+ *
+ * @since unknown
+ *
+ * @param array $data URL-encode key/value pairs.
+ * @return string URL encoded string
+ */
 function build_query( $data ) {
 	return _http_build_query( $data, NULL, '&amp;', '', false );
 }
 
-
-/*
-add_query_arg: Returns a modified querystring by adding
-a single key &amp; value or an associative array.
-Setting a key value to emptystring removes the key.
-Omitting oldquery_or_uri uses the $_SERVER value.
-
-Parameters:
-add_query_arg(newkey, newvalue, oldquery_or_uri) or
-add_query_arg(associative_array, oldquery_or_uri)
-*/
+/**
+ * Retrieve a modified URL query string.
+ *
+ * You can rebuild the URL and append a new query variable to the URL query by
+ * using this function. You can also retrieve the full URL with query data.
+ *
+ * Adding a single key &amp; value or an associative array. Setting a key value to
+ * emptystring removes the key. Omitting oldquery_or_uri uses the $_SERVER
+ * value.
+ *
+ * @since 1.5.0
+ *
+ * @param mixed $param1 Either newkey or an associative_array
+ * @param mixed $param2 Either newvalue or oldquery or uri
+ * @param mixed $param3 Optional. Old query or uri
+ * @return unknown
+ */
 function add_query_arg() {
 	$ret = '';
 	if ( is_array( func_get_arg(0) ) ) {
@@ -704,27 +1020,32 @@ function add_query_arg() {
 	return $ret;
 }
 
-
-/*
-remove_query_arg: Returns a modified querystring by removing
-a single key or an array of keys.
-Omitting oldquery_or_uri uses the $_SERVER value.
-
-Parameters:
-remove_query_arg(removekey, [oldquery_or_uri]) or
-remove_query_arg(removekeyarray, [oldquery_or_uri])
-*/
-
-function remove_query_arg( $key, $query=FALSE ) {
+/**
+ * Removes an item or list from the query string.
+ *
+ * @since 1.5.0
+ *
+ * @param string|array $key Query key or keys to remove.
+ * @param bool $query When false uses the $_SERVER value.
+ * @return unknown
+ */
+function remove_query_arg( $key, $query=false ) {
 	if ( is_array( $key ) ) { // removing multiple keys
 		foreach ( (array) $key as $k )
-			$query = add_query_arg( $k, FALSE, $query );
+			$query = add_query_arg( $k, false, $query );
 		return $query;
 	}
-	return add_query_arg( $key, FALSE, $query );
+	return add_query_arg( $key, false, $query );
 }
 
-
+/**
+ * Walks the array while sanitizing the contents.
+ *
+ * @uses $wpdb Used to sanitize values
+ *
+ * @param array $array Array to used to walk while sanitizing contents.
+ * @return array Sanitized $array.
+ */
 function add_magic_quotes( $array ) {
 	global $wpdb;
 
@@ -738,6 +1059,17 @@ function add_magic_quotes( $array ) {
 	return $array;
 }
 
+/**
+ * HTTP request for URI to retrieve content.
+ *
+ * Tries to retrieve the HTTP content with fopen first and then using cURL, if
+ * fopen can't be used.
+ *
+ * @since unknown
+ *
+ * @param string $uri URI/URL of web page to retrieve.
+ * @return string HTTP content.
+ */
 function wp_remote_fopen( $uri ) {
 	$timeout = 10;
 	$parsed_url = @parse_url( $uri );
@@ -782,7 +1114,14 @@ function wp( $query_vars = '' ) {
 		$wp_the_query = $wp_query;
 }
 
-
+/**
+ * Retrieve the description for the HTTP status.
+ *
+ * @since 2.3.0
+ *
+ * @param int $code HTTP status code.
+ * @return string Empty string if not found, or description if found.
+ */
 function get_status_header_desc( $code ) {
 	global $wp_header_to_desc;
 
@@ -842,7 +1181,17 @@ function get_status_header_desc( $code ) {
 		return '';
 }
 
-
+/**
+ * Set HTTP status header.
+ *
+ * @since unknown
+ * @uses apply_filters() Calls 'status_header' on status header string, HTTP
+ *		HTTP code, HTTP code description, and protocol string as separate
+ *		parameters.
+ *
+ * @param int $header HTTP status code
+ * @return null Does not return anything.
+ */
 function status_header( $header ) {
 	$text = get_status_header_desc( $header );
 
@@ -862,7 +1211,14 @@ function status_header( $header ) {
 		return @header( $status_header );
 }
 
-
+/**
+ * Sets the headers to prevent caching for the different browsers.
+ *
+ * Different browsers support different nocache headers, so several headers must
+ * be sent so that all of them get the point that no caching should occur.
+ *
+ * @since 2.0.0
+ */
 function nocache_headers() {
 	// why are these @-silenced when other header calls aren't?
 	@header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
@@ -871,7 +1227,11 @@ function nocache_headers() {
 	@header( 'Pragma: no-cache' );
 }
 
-
+/**
+ * Set the headers for caching for 10 days with JavaScript content type.
+ *
+ * @since 2.1.0
+ */
 function cache_javascript_headers() {
 	$expiresOffset = 864000; // 10 days
 	header( &quot;Content-Type: text/javascript; charset=&quot; . get_bloginfo( 'charset' ) );
@@ -879,13 +1239,26 @@ function cache_javascript_headers() {
 	header( &quot;Expires: &quot; . gmdate( &quot;D, d M Y H:i:s&quot;, time() + $expiresOffset ) . &quot; GMT&quot; );
 }
 
-
+/**
+ * Retrieve the number of database queries during the WordPress execution.
+ *
+ * @since 2.0.0
+ *
+ * @return int Number of database queries
+ */
 function get_num_queries() {
 	global $wpdb;
 	return $wpdb-&gt;num_queries;
 }
 
-
+/**
+ * Whether input is yes or no. Must be 'y' to be true.
+ *
+ * @since 1.0.0
+ *
+ * @param string $yn Character string containing either 'y' or 'n'
+ * @return bool True if yes, false on anything else
+ */
 function bool_from_yn( $yn ) {
 	return ( strtolower( $yn ) == 'y' );
 }
@@ -911,17 +1284,31 @@ function do_feed() {
 	do_action( $hook, $wp_query-&gt;is_comment_feed );
 }
 
-
+/**
+ * Load the RDF RSS 0.91 Feed template.
+ *
+ * @since 2.1.0
+ */
 function do_feed_rdf() {
 	load_template( ABSPATH . WPINC . '/feed-rdf.php' );
 }
 
-
+/**
+ * Load the RSS 1.0 Feed Template
+ *
+ * @since 2.1.0
+ */
 function do_feed_rss() {
 	load_template( ABSPATH . WPINC . '/feed-rss.php' );
 }
 
-
+/**
+ * Load either the RSS2 comment feed or the RSS2 posts feed.
+ *
+ * @since 2.1.0
+ *
+ * @param bool $for_comments True for the comment feed, false for normal feed.
+ */
 function do_feed_rss2( $for_comments ) {
 	if ( $for_comments )
 		load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
@@ -929,7 +1316,13 @@ function do_feed_rss2( $for_comments ) {
 		load_template( ABSPATH . WPINC . '/feed-rss2.php' );
 }
 
-
+/**
+ * Load either Atom comment feed or Atom posts feed.
+ *
+ * @since 2.1.0
+ *
+ * @param bool $for_comments True for the comment feed, false for normal feed.
+ */
 function do_feed_atom( $for_comments ) {
 	if ($for_comments)
 		load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
@@ -937,6 +1330,15 @@ function do_feed_atom( $for_comments ) {
 		load_template( ABSPATH . WPINC . '/feed-atom.php' );
 }
 
+/**
+ * Display the robot.txt file content.
+ *
+ * The echo content should be with usage of the permalinks or for creating the
+ * robot.txt file.
+ *
+ * @since 2.1.0
+ * @uses do_action() Calls 'do_robotstxt' hook for displaying robot.txt rules.
+ */
 function do_robots() {
 	header( 'Content-Type: text/plain; charset=utf-8' );
 
@@ -1079,22 +1481,30 @@ function path_join( $base, $path ) {
 function wp_upload_dir( $time = NULL ) {
 	$siteurl = get_option( 'siteurl' );
 	$upload_path = get_option( 'upload_path' );
-	if ( trim($upload_path) === '' )
-		$upload_path = 'wp-content/uploads';
-	$dir = $upload_path;
+	$upload_path = trim($upload_path);
+	if ( empty($upload_path) )
+		$dir = WP_CONTENT_DIR . '/uploads';
+	else 
+		$dir = $upload_path;
 
 	// $dir is absolute, $path is (maybe) relative to ABSPATH
-	$dir = path_join( ABSPATH, $upload_path );
-	$path = str_replace( ABSPATH, '', trim( $upload_path ) );
-
-	if ( !$url = get_option( 'upload_url_path' ) )
-		$url = trailingslashit( $siteurl ) . $path;
+	$dir = path_join( ABSPATH, $dir );
+	
+	if ( !$url = get_option( 'upload_url_path' ) ) {
+		if ( empty($upload_path) or ( $upload_path == $dir ) )
+			$url = WP_CONTENT_URL . '/uploads';
+		else
+			$url = trailingslashit( $siteurl ) . $upload_path;
+	}
 
 	if ( defined('UPLOADS') ) {
 		$dir = ABSPATH . UPLOADS;
 		$url = trailingslashit( $siteurl ) . UPLOADS;
 	}
 
+	$bdir = $dir; 
+	$burl = $url;
+
 	$subdir = '';
 	if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
 		// Generate the yearly and monthly dirs
@@ -1113,8 +1523,9 @@ function wp_upload_dir( $time = NULL ) {
 		$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $dir );
 		return array( 'error' =&gt; $message );
 	}
+	
+	$uploads = array( 'path' =&gt; $dir, 'url' =&gt; $url, 'subdir' =&gt; $subdir, 'basedir' =&gt; $bdir, 'baseurl' =&gt; $burl, 'error' =&gt; false );
 
-	$uploads = array( 'path' =&gt; $dir, 'url' =&gt; $url, 'subdir' =&gt; $subdir, 'error' =&gt; false );
 	return apply_filters( 'upload_dir', $uploads );
 }
 
@@ -1142,7 +1553,8 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL )
 			$ext = strtolower( &quot;.$ext&quot; );
 
 		$filename = str_replace( $ext, '', $filename );
-		$filename = sanitize_title_with_dashes( $filename ) . $ext;
+		// Strip % so the server doesn't try to decode entities.
+		$filename = str_replace('%', '', sanitize_title_with_dashes( $filename ) ) . $ext;
 
 		while ( file_exists( $dir . &quot;/$filename&quot; ) ) {
 			if ( '' == &quot;$number$ext&quot; )
@@ -1510,7 +1922,18 @@ function smilies_init() {
 	}
 }
 
-
+/**
+ * Merge user defined arguments into defaults array.
+ *
+ * This function is used throughout WordPress to allow for both string or array
+ * to be merged into another array.
+ *
+ * @since 2.2.0
+ *
+ * @param string|array $args Value to merge with $defaults
+ * @param array $defaults Array that serves as the defaults.
+ * @return array Merged user defined values with defaults.
+ */
 function wp_parse_args( $args, $defaults = '' ) {
 	if ( is_object( $args ) )
 		$r = get_object_vars( $args );
@@ -1524,7 +1947,15 @@ function wp_parse_args( $args, $defaults = '' ) {
 	return $r;
 }
 
-
+/**
+ * Determines if Widgets library should be loaded.
+ *
+ * Checks to make sure that the widgets library hasn't already been loaded. If
+ * it hasn't, then it will load the widgets library and run an action hook.
+ *
+ * @since 2.2.0
+ * @uses add_action() Calls '_admin_menu' hook with 'wp_widgets_add_menu' value.
+ */
 function wp_maybe_load_widgets() {
 	if ( !function_exists( 'dynamic_sidebar' ) ) {
 		require_once( ABSPATH . WPINC . '/widgets.php' );
@@ -1532,43 +1963,67 @@ function wp_maybe_load_widgets() {
 	}
 }
 
-
+/**
+ * Append the Widgets menu to the themes main menu.
+ *
+ * @since 2.2.0
+ * @uses $submenu The administration submenu list.
+ */
 function wp_widgets_add_menu() {
 	global $submenu;
 	$submenu['themes.php'][7] = array( __( 'Widgets' ), 'switch_themes', 'widgets.php' );
 	ksort( $submenu['themes.php'], SORT_NUMERIC );
 }
 
-
-// For PHP 5.2, make sure all output buffers are flushed
-// before our singletons our destroyed.
+/**
+ * Flush all output buffers for PHP 5.2.
+ *
+ * Make sure all output buffers are flushed before our singletons our destroyed.
+ *
+ * @since 2.2.0
+ */
 function wp_ob_end_flush_all() {
 	while ( @ob_end_flush() );
 }
 
-
-/*
- * require_wp_db() - require_once the correct database class file.
+/**
+ * Load the correct database class file.
  *
- * This function is used to load the database class file either at runtime or by wp-admin/setup-config.php
- * We must globalise $wpdb to ensure that it is defined globally by the inline code in wp-db.php
+ * This function is used to load the database class file either at runtime or by
+ * wp-admin/setup-config.php We must globalise $wpdb to ensure that it is
+ * defined globally by the inline code in wp-db.php.
  *
- * @global $wpdb
+ * @since 2.5
+ * @global $wpdb WordPress Database Object
  */
 function require_wp_db() {
 	global $wpdb;
-	if ( file_exists( ABSPATH . 'wp-content/db.php' ) )
-		require_once( ABSPATH . 'wp-content/db.php' );
+	if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
+		require_once( WP_CONTENT_DIR . '/db.php' );
 	else
 		require_once( ABSPATH . WPINC . '/wp-db.php' );
 }
 
+/**
+ * Load custom DB error or display WordPress DB error.
+ *
+ * If a file exists in the wp-content directory named db-error.php, then it will
+ * be loaded instead of displaying the WordPress DB error. If it is not found,
+ * then the WordPress DB error will be displayed instead.
+ *
+ * The WordPress DB error sets the HTTP status header to 500 to try to prevent
+ * search engines from caching the message. Custom DB messages should do the
+ * same.
+ *
+ * @since 2.5
+ * @uses $wpdb
+ */
 function dead_db() {
 	global $wpdb;
 
 	// Load custom DB error template, if present.
-	if ( file_exists( ABSPATH . 'wp-content/db-error.php' ) ) {
-		require_once( ABSPATH . 'wp-content/db-error.php' );
+	if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
+		require_once( WP_CONTENT_DIR . '/db-error.php' );
 		die();
 	}
 
@@ -1597,7 +2052,10 @@ function dead_db() {
 }
 
 /**
- * Converts input to an absolute integer
+ * Converts value to positive integer.
+ *
+ * @since 2.5
+ * 
  * @param mixed $maybeint data you wish to have convered to an absolute integer
  * @return int an absolute integer
  */
@@ -1606,8 +2064,14 @@ function absint( $maybeint ) {
 }
 
 /**
- * Determines if the blog can be accessed over SSL
- * @return bool whether of not SSL access is available
+ * Determines if the blog can be accessed over SSL.
+ *
+ * Determines if blog can be accessed over SSL by using cURL to access the site
+ * using the https in the siteurl. Requires cURL extension to work correctly.
+ *
+ * @since 2.5
+ *
+ * @return bool Whether or not SSL access is available
  */
 function url_is_accessable_via_ssl($url)
 {
@@ -1632,21 +2096,31 @@ function url_is_accessable_via_ssl($url)
 	return false;
 }
 
+/**
+ * Secure URL, if available or the given URL.
+ *
+ * @since 2.5
+ *
+ * @param string $url Complete URL path with transport.
+ * @return string Secure or regular URL path.
+ */
 function atom_service_url_filter($url)
 {
 	if ( url_is_accessable_via_ssl($url) )
-		return  preg_replace( '/^http:\/\//', 'https://',  $url );
+		return preg_replace( '/^http:\/\//', 'https://',  $url );
 	else
 		return $url;
 }
 
 /**
- * _deprecated_function() - Marks a function as deprecated and informs when it has been used.
+ * Marks a function as deprecated and informs when it has been used.
  *
- * There is a hook deprecated_function_run that will be called that can be used to get the backtrace
- * up to what file and function called the deprecated function.
+ * There is a hook deprecated_function_run that will be called that can be used
+ * to get the backtrace up to what file and function called the deprecated
+ * function.
  *
- * The current behavior is to trigger an user error if WP_DEBUG is defined and is true.
+ * The current behavior is to trigger an user error if WP_DEBUG is defined and
+ * is true.
  *
  * This function is to be used in every function in depreceated.php
  *
@@ -1669,19 +2143,21 @@ function _deprecated_function($function, $version, $replacement=null) {
 	// Allow plugin to filter the output error trigger
 	if( defined('WP_DEBUG') &amp;&amp; ( true === WP_DEBUG ) &amp;&amp; apply_filters( 'deprecated_function_trigger_error', true )) {
 		if( !is_null($replacement) )
-			trigger_error( printf( __(&quot;%1$s is &lt;strong&gt;deprecated&lt;/strong&gt; since version %2$s! Use %3$s instead.&quot;), $function, $version, $replacement ) );
+			trigger_error( sprintf( __('%1$s is &lt;strong&gt;deprecated&lt;/strong&gt; since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
 		else
-			trigger_error( printf( __(&quot;%1$s is &lt;strong&gt;deprecated&lt;/strong&gt; since version %2$s with no alternative available.&quot;), $function, $version ) );
+			trigger_error( sprintf( __('%1$s is &lt;strong&gt;deprecated&lt;/strong&gt; since version %2$s with no alternative available.'), $function, $version ) );
 	}
 }
 
 /**
- * _deprecated_file() - Marks a file as deprecated and informs when it has been used.
+ * Marks a file as deprecated and informs when it has been used.
  *
- * There is a hook deprecated_file_included that will be called that can be used to get the backtrace
- * up to what file and function included the deprecated file.
+ * There is a hook deprecated_file_included that will be called that can be used
+ * to get the backtrace up to what file and function included the deprecated
+ * file.
  *
- * The current behavior is to trigger an user error if WP_DEBUG is defined and is true.
+ * The current behavior is to trigger an user error if WP_DEBUG is defined and
+ * is true.
  *
  * This function is to be used in every file that is depreceated
  *
@@ -1704,14 +2180,16 @@ function _deprecated_file($file, $version, $replacement=null) {
 	// Allow plugin to filter the output error trigger
 	if( defined('WP_DEBUG') &amp;&amp; ( true === WP_DEBUG ) &amp;&amp; apply_filters( 'deprecated_file_trigger_error', true )) {
 		if( !is_null($replacement) )
-			trigger_error( printf( __(&quot;%1$s is &lt;strong&gt;deprecated&lt;/strong&gt; since version %2$s! Use %3$s instead.&quot;), $file, $version, $replacement ) );
+			trigger_error( sprintf( __('%1$s is &lt;strong&gt;deprecated&lt;/strong&gt; since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) );
 		else
-			trigger_error( printf( __(&quot;%1$s is &lt;strong&gt;deprecated&lt;/strong&gt; since version %2$s with no alternative available.&quot;), $file, $version ) );
+			trigger_error( sprintf( __('%1$s is &lt;strong&gt;deprecated&lt;/strong&gt; since version %2$s with no alternative available.'), $file, $version ) );
 	}
 }
 
 /**
- * is_lighttpd_before_150() - Is the server running earlier than 1.5.0 version of lighttpd
+ * Is the server running earlier than 1.5.0 version of lighttpd
+ *
+ * @since unknown
  *
  * @return bool Whether the server is running lighttpd &lt; 1.5.0
  */
@@ -1722,7 +2200,9 @@ function is_lighttpd_before_150() {
 }
 
 /**
- * apache_mod_loaded() - Does the specified module exist in the apache config?
+ * Does the specified module exist in the apache config?
+ *
+ * @since unknown
  *
  * @param string $mod e.g. mod_rewrite
  * @param bool $default The default return value if the module is not found
@@ -1748,4 +2228,105 @@ function apache_mod_loaded($mod, $default = false) {
 	return $default;
 }
 
-?&gt;
+/**
+ * File validates against allowed set of defined rules.
+ *
+ * A return value of '1' means that the $file contains either '..' or './'. A
+ * return value of '2' means that the $file contains ':' after the first
+ * character. A return value of '3' means that the file is not in the allowed
+ * files list.
+ *
+ * @since 2.6
+ *
+ * @param string $file File path.
+ * @param array $allowed_files List of allowed files.
+ * @return int 0 means nothing is wrong, greater than 0 means something was wrong.
+ */
+function validate_file( $file, $allowed_files = '' ) {
+	if ( false !== strpos( $file, '..' ))
+		return 1;
+
+	if ( false !== strpos( $file, './' ))
+		return 1;
+
+	if (':' == substr( $file, 1, 1 ))
+		return 2;
+
+	if (!empty ( $allowed_files ) &amp;&amp; (!in_array( $file, $allowed_files ) ) )
+		return 3;
+
+	return 0;
+}
+
+/**
+ * Determine if SSL is used.
+ *
+ * @since 2.6
+ *
+ * @return bool True if SSL, false if not used.
+ */
+function is_ssl() {
+	return ( isset($_SERVER['HTTPS']) &amp;&amp; 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false; 
+}
+
+/**
+ * Whether SSL login should be forced.
+ *
+ * @since 2.6
+ *
+ * @param string|bool $force Optional.
+ * @return bool True if forced, false if not forced.
+ */
+function force_ssl_login($force = '') {
+	static $forced;
+
+	if ( '' != $force ) {
+		$old_forced = $forced;
+		$forced = $force;
+		return $old_forced;
+	}
+
+	return $forced;
+}
+
+/**
+ * Whether to force SSL used for the Administration Panels.
+ *
+ * @since 2.6
+ *
+ * @param string|bool $force
+ * @return bool True if forced, false if not forced.
+ */
+function force_ssl_admin($force = '') {
+	static $forced;
+
+	if ( '' != $force ) {
+		$old_forced = $forced;
+		$forced = $force;
+		return $old_forced;
+	}
+
+	return $forced;
+}
+
+/**
+ * Guess the URL for the site.
+ *
+ * Will remove wp-admin links to retrieve only return URLs not in the wp-admin
+ * directory.
+ *
+ * @since 2.6
+ *
+ * @return string
+ */
+function wp_guess_url() {
+	if ( defined('WP_SITEURL') &amp;&amp; '' != WP_SITEURL ) {
+		$url = WP_SITEURL;
+	} else {
+		$schema = ( isset($_SERVER['HTTPS']) &amp;&amp; strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
+		$url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+	}
+	return $url;
+}
+
+?&gt;
\ No newline at end of file</diff>
      <filename>wp-includes/functions.php</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,7 @@ function get_header() {
 	if ( file_exists( TEMPLATEPATH . '/header.php') )
 		load_template( TEMPLATEPATH . '/header.php');
 	else
-		load_template( ABSPATH . 'wp-content/themes/default/header.php');
+		load_template( WP_CONTENT_DIR . '/themes/default/header.php');
 }
 
 
@@ -16,7 +16,7 @@ function get_footer() {
 	if ( file_exists( TEMPLATEPATH . '/footer.php') )
 		load_template( TEMPLATEPATH . '/footer.php');
 	else
-		load_template( ABSPATH . 'wp-content/themes/default/footer.php');
+		load_template( WP_CONTENT_DIR . '/themes/default/footer.php');
 }
 
 
@@ -27,15 +27,15 @@ function get_sidebar( $name = null ) {
 	elseif ( file_exists( TEMPLATEPATH . '/sidebar.php') )
 		load_template( TEMPLATEPATH . '/sidebar.php');
 	else
-		load_template( ABSPATH . 'wp-content/themes/default/sidebar.php');
+		load_template( WP_CONTENT_DIR . '/themes/default/sidebar.php');
 }
 
 
 function wp_loginout() {
 	if ( ! is_user_logged_in() )
-		$link = '&lt;a href=&quot;' . get_option('siteurl') . '/wp-login.php&quot;&gt;' . __('Log in') . '&lt;/a&gt;';
+		$link = '&lt;a href=&quot;' . site_url('wp-login.php', 'login') . '&quot;&gt;' . __('Log in') . '&lt;/a&gt;';
 	else
-		$link = '&lt;a href=&quot;' . get_option('siteurl') . '/wp-login.php?action=logout&quot;&gt;' . __('Log out') . '&lt;/a&gt;';
+		$link = '&lt;a href=&quot;' . site_url('wp-login.php?action=logout', 'login') . '&quot;&gt;' . __('Log out') . '&lt;/a&gt;';
 
 	echo apply_filters('loginout', $link);
 }
@@ -45,11 +45,11 @@ function wp_register( $before = '&lt;li&gt;', $after = '&lt;/li&gt;' ) {
 
 	if ( ! is_user_logged_in() ) {
 		if ( get_option('users_can_register') )
-			$link = $before . '&lt;a href=&quot;' . get_option('siteurl') . '/wp-login.php?action=register&quot;&gt;' . __('Register') . '&lt;/a&gt;' . $after;
+			$link = $before . '&lt;a href=&quot;' . site_url('wp-login.php?action=register', 'login') . '&quot;&gt;' . __('Register') . '&lt;/a&gt;' . $after;
 		else
 			$link = '';
 	} else {
-		$link = $before . '&lt;a href=&quot;' . get_option('siteurl') . '/wp-admin/&quot;&gt;' . __('Site Admin') . '&lt;/a&gt;' . $after;
+		$link = $before . '&lt;a href=&quot;' . admin_url() . '&quot;&gt;' . __('Site Admin') . '&lt;/a&gt;' . $after;
 	}
 
 	echo apply_filters('register', $link);
@@ -233,6 +233,19 @@ function wp_title($sep = '&amp;raquo;', $display = true, $seplocation = '') {
 		$title = strip_tags( apply_filters( 'single_post_title', $post-&gt;post_title ) );
 	}
 
+	// If there's a taxonomy
+	if ( is_tax() ) {
+		$taxonomy = get_query_var( 'taxonomy' );
+		$tax = get_taxonomy( $taxonomy );
+		$tax = $tax-&gt;label;
+		$term = $wp_query-&gt;get_queried_object();
+		$term = $term-&gt;name;
+		if ( 'right' == $seplocation )
+			$title = &quot;$term $sep $tax&quot;;
+		else
+			$title = &quot;$tax $sep $term&quot;;
+	}
+
 	$prefix = '';
 	if ( !empty($title) )
 		$prefix = &quot; $sep &quot;;
@@ -343,13 +356,17 @@ function get_archives_link($url, $text, $format = 'html', $before = '', $after =
 	$url = clean_url($url);
 
 	if ('link' == $format)
-		return &quot;\t&lt;link rel='archives' title='$title_text' href='$url' /&gt;\n&quot;;
+		$link_html = &quot;\t&lt;link rel='archives' title='$title_text' href='$url' /&gt;\n&quot;;
 	elseif ('option' == $format)
-		return &quot;\t&lt;option value='$url'&gt;$before $text $after&lt;/option&gt;\n&quot;;
+		$link_html = &quot;\t&lt;option value='$url'&gt;$before $text $after&lt;/option&gt;\n&quot;;
 	elseif ('html' == $format)
-		return &quot;\t&lt;li&gt;$before&lt;a href='$url' title='$title_text'&gt;$text&lt;/a&gt;$after&lt;/li&gt;\n&quot;;
+		$link_html = &quot;\t&lt;li&gt;$before&lt;a href='$url' title='$title_text'&gt;$text&lt;/a&gt;$after&lt;/li&gt;\n&quot;;
 	else // custom
-		return &quot;\t$before&lt;a href='$url' title='$title_text'&gt;$text&lt;/a&gt;$after\n&quot;;
+		$link_html = &quot;\t$before&lt;a href='$url' title='$title_text'&gt;$text&lt;/a&gt;$after\n&quot;;
+
+	$link_html = apply_filters( &quot;get_archives_link&quot;, $link_html );
+		
+	return $link_html;
 }
 
 
@@ -810,7 +827,7 @@ function get_post_time( $d = 'U', $gmt = false ) { // returns timestamp
 		$time = $post-&gt;post_date;
 
 	$time = mysql2date($d, $time);
-	return apply_filters('get_the_time', $time, $d, $gmt);
+	return apply_filters('get_post_time', $time, $d, $gmt);
 }
 
 
@@ -1110,34 +1127,76 @@ function wp_admin_css_color($key, $name, $url, $colors = array()) {
 	$_wp_admin_css_colors[$key] = (object) array('name' =&gt; $name, 'url' =&gt; $url, 'colors' =&gt; $colors);
 }
 
+/**
+ * wp_admin_css_uri() - Outputs the URL of a WordPress admin CSS file
+ *
+ * @see WP_Styles::_css_href and its style_loader_src filter.
+ *
+ * @param string $file file relative to wp-admin/ without its &quot;.css&quot; extension.
+ */
+
 function wp_admin_css_uri( $file = 'wp-admin' ) {
 	if ( defined('WP_INSTALLING') ) {
 		$_file = &quot;./$file.css&quot;;
 	} else {
-		if ( 'css/colors' == $file || 'css/colors-rtl' == $file ) {
-			global $_wp_admin_css_colors;
-			$color = get_user_option('admin_color');
-			if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
-				$color = 'fresh';
-			$color = $_wp_admin_css_colors[$color];
-			$_file = $color-&gt;url;
-			$_file = ('css/colors-rtl' == $file) ? str_replace('.css','-rtl.css',$_file) : $_file;
-		} else {
-			$_file = get_option( 'siteurl' ) . &quot;/wp-admin/$file.css&quot;;
-		}
+		$_file = admin_url(&quot;$file.css&quot;);
 	}
 	$_file = add_query_arg( 'version', get_bloginfo( 'version' ),  $_file );
 
 	return apply_filters( 'wp_admin_css_uri', $_file, $file );
 }
 
-function wp_admin_css( $file = 'wp-admin' ) {
+/**
+ * wp_admin_css() - Enqueues or directly prints a stylesheet link to the specified CSS file.
+ *
+ * &quot;Intelligently&quot; decides to enqueue or to print the CSS file.
+ * If the wp_print_styles action has *not* yet been called, the CSS file will be enqueued.
+ * If the wp_print_styles action *has* been called, the CSS link will be printed.
+ * Printing may be forced by passing TRUE as the $force_echo (second) parameter.
+ *
+ * For backward compatibility with WordPress 2.3 calling method:
+ * If the $file (first) parameter does not correspond to a registered CSS file, we assume $file is a
+ * file relative to wp-admin/ without its &quot;.css&quot; extension.  A stylesheet link to that generated URL is printed.
+ *
+ * @package WordPress
+ * @since 2.3
+ *
+ * @uses $wp_styles WordPress Styles Object
+ *
+ * @param string $file Style handle name or file name (without &quot;.css&quot; extension) relative to wp-admin/
+ * @param bool $force_echo Optional.  Force the stylesheet link to be printed rather than enqueued.
+ */
+
+function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
+	global $wp_styles;
+	if ( !is_a($wp_styles, 'WP_Styles') )
+		$wp_styles = new WP_Styles();
+
+	// For backward compatibility
+	$handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;
 
-	echo apply_filters( 'wp_admin_css', &quot;&lt;link rel='stylesheet' href='&quot; . wp_admin_css_uri( $file ) . &quot;' type='text/css' /&gt;\n&quot;, $file );
-	if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
-		$rtl = ( 'wp-admin' == $file ) ? 'rtl' : &quot;$file-rtl&quot;;
-		echo apply_filters( 'wp_admin_css', &quot;&lt;link rel='stylesheet' href='&quot; . wp_admin_css_uri( $rtl ) . &quot;' type='text/css' /&gt;\n&quot;, $rtl );
+	if ( $wp_styles-&gt;query( $handle ) ) {
+		if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue.  Print this one immediately
+			wp_print_styles( $handle );
+		else // Add to style queue
+			wp_enqueue_style( $handle );
+		return;
 	}
+
+	echo apply_filters( 'wp_admin_css', &quot;&lt;link rel='stylesheet' href='&quot; . clean_url( wp_admin_css_uri( $file ) ) . &quot;' type='text/css' /&gt;\n&quot;, $file );
+	if ( 'rtl' == get_bloginfo( 'text_direction' ) )
+		echo apply_filters( 'wp_admin_css', &quot;&lt;link rel='stylesheet' href='&quot; . clean_url( wp_admin_css_uri( &quot;$file-rtl&quot; ) ) . &quot;' type='text/css' /&gt;\n&quot;, &quot;$file-rtl&quot; );
+}
+
+/**
+ * Enqueues the default ThickBox js and css. 
+ * If any of the settings need to be changed, this can be done with another js file
+ * similar to media-upload.js and theme-preview.js. That file should require array('thickbox')
+ * to ensure it is loaded after. 
+ */
+function add_thickbox() {
+	wp_enqueue_script( 'thickbox' );
+	wp_enqueue_style( 'thickbox' );
 }
 
 /**</diff>
      <filename>wp-includes/general-template.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,8 @@
 var autosaveLast = '';
 var autosavePeriodical;
 var autosaveOldMessage = '';
+var autosaveDelayURL = null;
+var previewwin;
 
 jQuery(function($) {
 	autosaveLast = $('#post #title').val()+$('#post #content').val();
@@ -8,10 +10,19 @@ jQuery(function($) {
 
 	//Disable autosave after the form has been submitted
 	$(&quot;#post&quot;).submit(function() { $.cancel(autosavePeriodical); });
+	
+	// Autosave when the preview button is clicked. 
+	$('#previewview a').click(function(e) {
+		autosave();
+		autosaveDelayURL = this.href;
+		previewwin = window.open('','_blank');
+
+		e.preventDefault();
+		return false;
+	});
 });
 
-// called when autosaving pre-existing post
-function autosave_saved(response) {
+function autosave_parse_response(response) {
 	var res = wpAjax.parseAjaxResponse(response, 'autosave'); // parse the ajax response
 	var message = '';
 
@@ -41,22 +52,29 @@ function autosave_saved(response) {
 	}
 	if ( message ) { jQuery('#autosave').html(message); } // update autosave message
 	else if ( autosaveOldMessage &amp;&amp; res ) { jQuery('#autosave').html( autosaveOldMessage ); }
-	autosave_enable_buttons(); // re-enable disabled form buttons
 	return res;
 }
 
+// called when autosaving pre-existing post
+function autosave_saved(response) {
+	autosave_parse_response(response); // parse the ajax response
+	autosave_enable_buttons(); // re-enable disabled form buttons
+}
+
 // called when autosaving new post
 function autosave_saved_new(response) {
-	var res = autosave_saved(response); // parse the ajax response do the above
+	var res = autosave_parse_response(response); // parse the ajax response
 	// if no errors: update post_ID from the temporary value, grab new save-nonce for that new ID
 	if ( res &amp;&amp; res.responses.length &amp;&amp; !res.errors ) {
 		var tempID = jQuery('#post_ID').val();
 		var postID = parseInt( res.responses[0].id );
-		autosave_update_post_ID( postID );
+		autosave_update_post_ID( postID ); // disabled form buttons are re-enabled here
 		if ( tempID &lt; 0 &amp;&amp; postID &gt; 0) // update media buttons
 			jQuery('#media-buttons a').each(function(){
 				this.href = this.href.replace(tempID, postID);
 			});
+	} else {
+		autosave_enable_buttons(); // re-enable disabled form buttons
 	}
 }
 
@@ -73,6 +91,7 @@ function autosave_update_post_ID( postID ) {
 			post_type: jQuery('#post_type').val()
 		}, function(html) {
 			jQuery('#_wpnonce').val(html);
+			autosave_enable_buttons(); // re-enable disabled form buttons
 		});
 		jQuery('#hiddenaction').val('editpost');
 	}
@@ -89,6 +108,16 @@ function autosave_update_preview_link(post_id) {
 			getpermalinknonce: jQuery('#getpermalinknonce').val()
 		}, function(permalink) {
 			jQuery('#previewview').html('&lt;a target=&quot;_blank&quot; href=&quot;'+permalink+'&quot; tabindex=&quot;4&quot;&gt;'+previewText+'&lt;/a&gt;');
+
+			// Autosave when the preview button is clicked.  
+			jQuery('#previewview a').click(function(e) {
+				autosave();
+				autosaveDelayURL = this.href;
+				previewwin = window.open('','_blank');
+
+				e.preventDefault();
+				return false;
+			});
 		});
 	}
 }
@@ -118,11 +147,15 @@ function autosave_loading() {
 
 function autosave_enable_buttons() {
 	jQuery(&quot;#submitpost :button:disabled, #submitpost :submit:disabled&quot;).attr('disabled', '');
+	if ( autosaveDelayURL ) {
+		previewwin.location = autosaveDelayURL;
+		autosaveDelayURL = null;
+	}
 }
 
 function autosave_disable_buttons() {
 	jQuery(&quot;#submitpost :button:enabled, #submitpost :submit:enabled&quot;).attr('disabled', 'disabled');
-	setTimeout(autosave_enable_buttons, 1000); // Re-enable 1 sec later.  Just gives autosave a head start to avoid collisions.
+	setTimeout(autosave_enable_buttons, 5000); // Re-enable 5 sec later.  Just gives autosave a head start to avoid collisions.
 }
 
 var autosave = function() {
@@ -147,8 +180,13 @@ var autosave = function() {
 		doAutoSave = false;
 
 	/* Gotta do this up here so we can check the length when tinyMCE is in use */
-	if ( rich ) { tinyMCE.triggerSave(); }
-
+	if ( rich ) {		
+		var ed = tinyMCE.activeEditor;
+		if ( 'mce_fullscreen' == ed.id )
+			tinyMCE.get('content').setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
+		tinyMCE.get('content').save();
+	}
+	
 	post_data[&quot;content&quot;] = jQuery(&quot;#content&quot;).val();
 	if ( jQuery('#post_name').val() )
 		post_data[&quot;post_name&quot;] = jQuery('#post_name').val();
@@ -161,8 +199,6 @@ var autosave = function() {
 	autosave_disable_buttons();
 
 	var origStatus = jQuery('#original_post_status').val();
-	if ( 'draft' != origStatus ) // autosave currently only turned on for drafts
-		doAutoSave = false;
 
 	autosaveLast = jQuery(&quot;#title&quot;).val()+jQuery(&quot;#content&quot;).val();
 	goodcats = ([]);
@@ -175,8 +211,10 @@ var autosave = function() {
 		post_data[&quot;comment_status&quot;] = 'open';
 	if ( jQuery(&quot;#ping_status&quot;).attr(&quot;checked&quot;) )
 		post_data[&quot;ping_status&quot;] = 'open';
-	if( jQuery(&quot;#excerpt&quot;))
+	if ( jQuery(&quot;#excerpt&quot;).size() )
 		post_data[&quot;excerpt&quot;] = jQuery(&quot;#excerpt&quot;).val();
+	if ( jQuery(&quot;#post_author&quot;).size() )
+		post_data[&quot;post_author&quot;] = jQuery(&quot;#post_author&quot;).val();
 
 	// Don't run while the TinyMCE spellcheck is on.  Why?  Who knows.
 	if ( rich &amp;&amp; tinyMCE.activeEditor.plugins.spellchecker &amp;&amp; tinyMCE.activeEditor.plugins.spellchecker.active ) {</diff>
      <filename>wp-includes/js/autosave.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,11 @@
 /*
- * jQuery 1.2.3 - New Wave Javascript
+ * jQuery 1.2.6 - New Wave Javascript
  *
  * Copyright (c) 2008 John Resig (jquery.com)
  * Dual licensed under the MIT (MIT-LICENSE.txt)
  * and GPL (GPL-LICENSE.txt) licenses.
  *
- * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $
- * $Rev: 4663 $
+ * $Date: 2008-05-27 12:17:26 -0700 (Tue, 27 May 2008) $
+ * $Rev: 5700 $
  */
-eval(function(p,a,c,k,e,r){e=function(c){return(c&lt;a?'':e(parseInt(c/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(J(){7(1e.3N)L w=1e.3N;L E=1e.3N=J(a,b){K 1B E.2l.4T(a,b)};7(1e.$)L D=1e.$;1e.$=E;L u=/^[^&lt;]*(&lt;(.|\\s)+&gt;)[^&gt;]*$|^#(\\w+)$/;L G=/^.[^:#\\[\\.]*$/;E.1n=E.2l={4T:J(d,b){d=d||T;7(d.15){6[0]=d;6.M=1;K 6}N 7(1o d==&quot;25&quot;){L c=u.2O(d);7(c&amp;&amp;(c[1]||!b)){7(c[1])d=E.4a([c[1]],b);N{L a=T.5J(c[3]);7(a)7(a.2w!=c[3])K E().2s(d);N{6[0]=a;6.M=1;K 6}N d=[]}}N K 1B E(b).2s(d)}N 7(E.1q(d))K 1B E(T)[E.1n.21?&quot;21&quot;:&quot;3U&quot;](d);K 6.6E(d.1k==1M&amp;&amp;d||(d.5h||d.M&amp;&amp;d!=1e&amp;&amp;!d.15&amp;&amp;d[0]!=10&amp;&amp;d[0].15)&amp;&amp;E.2I(d)||[d])},5h:&quot;1.2.3&quot;,87:J(){K 6.M},M:0,22:J(a){K a==10?E.2I(6):6[a]},2F:J(b){L a=E(b);a.54=6;K a},6E:J(a){6.M=0;1M.2l.1g.1i(6,a);K 6},R:J(a,b){K E.R(6,a,b)},4X:J(b){L a=-1;6.R(J(i){7(6==b)a=i});K a},1J:J(c,a,b){L d=c;7(c.1k==4e)7(a==10)K 6.M&amp;&amp;E[b||&quot;1J&quot;](6[0],c)||10;N{d={};d[c]=a}K 6.R(J(i){Q(c 1p d)E.1J(b?6.W:6,c,E.1l(6,d[c],b,i,c))})},1j:J(b,a){7((b==\'27\'||b==\'1R\')&amp;&amp;2M(a)&lt;0)a=10;K 6.1J(b,a,&quot;2o&quot;)},1u:J(b){7(1o b!=&quot;3V&quot;&amp;&amp;b!=V)K 6.4x().3t((6[0]&amp;&amp;6[0].2i||T).5r(b));L a=&quot;&quot;;E.R(b||6,J(){E.R(6.3p,J(){7(6.15!=8)a+=6.15!=1?6.6K:E.1n.1u([6])})});K a},5m:J(b){7(6[0])E(b,6[0].2i).5k().3o(6[0]).2c(J(){L a=6;2b(a.1C)a=a.1C;K a}).3t(6);K 6},8w:J(a){K 6.R(J(){E(6).6z().5m(a)})},8p:J(a){K 6.R(J(){E(6).5m(a)})},3t:J(){K 6.3O(18,P,S,J(a){7(6.15==1)6.38(a)})},6q:J(){K 6.3O(18,P,P,J(a){7(6.15==1)6.3o(a,6.1C)})},6o:J(){K 6.3O(18,S,S,J(a){6.1a.3o(a,6)})},5a:J(){K 6.3O(18,S,P,J(a){6.1a.3o(a,6.2B)})},3h:J(){K 6.54||E([])},2s:J(b){L c=E.2c(6,J(a){K E.2s(b,a)});K 6.2F(/[^+&gt;] [^+&gt;]/.17(b)||b.1f(&quot;..&quot;)&gt;-1?E.57(c):c)},5k:J(e){L f=6.2c(J(){7(E.14.1d&amp;&amp;!E.3E(6)){L a=6.69(P),4Y=T.3s(&quot;1x&quot;);4Y.38(a);K E.4a([4Y.3d])[0]}N K 6.69(P)});L d=f.2s(&quot;*&quot;).4R().R(J(){7(6[F]!=10)6[F]=V});7(e===P)6.2s(&quot;*&quot;).4R().R(J(i){7(6.15==3)K;L c=E.O(6,&quot;2R&quot;);Q(L a 1p c)Q(L b 1p c[a])E.16.1b(d[i],a,c[a][b],c[a][b].O)});K f},1E:J(b){K 6.2F(E.1q(b)&amp;&amp;E.3y(6,J(a,i){K b.1P(a,i)})||E.3e(b,6))},56:J(b){7(b.1k==4e)7(G.17(b))K 6.2F(E.3e(b,6,P));N b=E.3e(b,6);L a=b.M&amp;&amp;b[b.M-1]!==10&amp;&amp;!b.15;K 6.1E(J(){K a?E.33(6,b)&lt;0:6!=b})},1b:J(a){K!a?6:6.2F(E.37(6.22(),a.1k==4e?E(a).22():a.M!=10&amp;&amp;(!a.12||E.12(a,&quot;3u&quot;))?a:[a]))},3H:J(a){K a?E.3e(a,6).M&gt;0:S},7j:J(a){K 6.3H(&quot;.&quot;+a)},5O:J(b){7(b==10){7(6.M){L c=6[0];7(E.12(c,&quot;2k&quot;)){L e=c.3T,5I=[],11=c.11,2X=c.U==&quot;2k-2X&quot;;7(e&lt;0)K V;Q(L i=2X?e:0,2f=2X?e+1:11.M;i&lt;2f;i++){L d=11[i];7(d.2p){b=E.14.1d&amp;&amp;!d.9J.1A.9y?d.1u:d.1A;7(2X)K b;5I.1g(b)}}K 5I}N K(6[0].1A||&quot;&quot;).1r(/\\r/g,&quot;&quot;)}K 10}K 6.R(J(){7(6.15!=1)K;7(b.1k==1M&amp;&amp;/5u|5t/.17(6.U))6.3k=(E.33(6.1A,b)&gt;=0||E.33(6.31,b)&gt;=0);N 7(E.12(6,&quot;2k&quot;)){L a=b.1k==1M?b:[b];E(&quot;98&quot;,6).R(J(){6.2p=(E.33(6.1A,a)&gt;=0||E.33(6.1u,a)&gt;=0)});7(!a.M)6.3T=-1}N 6.1A=b})},3q:J(a){K a==10?(6.M?6[0].3d:V):6.4x().3t(a)},6S:J(a){K 6.5a(a).1V()},6Z:J(i){K 6.2K(i,i+1)},2K:J(){K 6.2F(1M.2l.2K.1i(6,18))},2c:J(b){K 6.2F(E.2c(6,J(a,i){K b.1P(a,i,a)}))},4R:J(){K 6.1b(6.54)},O:J(d,b){L a=d.23(&quot;.&quot;);a[1]=a[1]?&quot;.&quot;+a[1]:&quot;&quot;;7(b==V){L c=6.5n(&quot;8P&quot;+a[1]+&quot;!&quot;,[a[0]]);7(c==10&amp;&amp;6.M)c=E.O(6[0],d);K c==V&amp;&amp;a[1]?6.O(a[0]):c}N K 6.1N(&quot;8K&quot;+a[1]+&quot;!&quot;,[a[0],b]).R(J(){E.O(6,d,b)})},35:J(a){K 6.R(J(){E.35(6,a)})},3O:J(g,f,h,d){L e=6.M&gt;1,3n;K 6.R(J(){7(!3n){3n=E.4a(g,6.2i);7(h)3n.8D()}L b=6;7(f&amp;&amp;E.12(6,&quot;1O&quot;)&amp;&amp;E.12(3n[0],&quot;4v&quot;))b=6.3S(&quot;1U&quot;)[0]||6.38(6.2i.3s(&quot;1U&quot;));L c=E([]);E.R(3n,J(){L a=e?E(6).5k(P)[0]:6;7(E.12(a,&quot;1m&quot;)){c=c.1b(a)}N{7(a.15==1)c=c.1b(E(&quot;1m&quot;,a).1V());d.1P(b,a)}});c.R(6A)})}};E.2l.4T.2l=E.2l;J 6A(i,a){7(a.3Q)E.3P({1c:a.3Q,3l:S,1H:&quot;1m&quot;});N E.5g(a.1u||a.6x||a.3d||&quot;&quot;);7(a.1a)a.1a.34(a)}E.1s=E.1n.1s=J(){L b=18[0]||{},i=1,M=18.M,5c=S,11;7(b.1k==8d){5c=b;b=18[1]||{};i=2}7(1o b!=&quot;3V&quot;&amp;&amp;1o b!=&quot;J&quot;)b={};7(M==1){b=6;i=0}Q(;i&lt;M;i++)7((11=18[i])!=V)Q(L a 1p 11){7(b===11[a])6w;7(5c&amp;&amp;11[a]&amp;&amp;1o 11[a]==&quot;3V&quot;&amp;&amp;b[a]&amp;&amp;!11[a].15)b[a]=E.1s(b[a],11[a]);N 7(11[a]!=10)b[a]=11[a]}K b};L F=&quot;3N&quot;+(1B 3v()).3L(),6t=0,5b={};L H=/z-?4X|86-?84|1w|6k|7Z-?1R/i;E.1s({7Y:J(a){1e.$=D;7(a)1e.3N=w;K E},1q:J(a){K!!a&amp;&amp;1o a!=&quot;25&quot;&amp;&amp;!a.12&amp;&amp;a.1k!=1M&amp;&amp;/J/i.17(a+&quot;&quot;)},3E:J(a){K a.1F&amp;&amp;!a.1h||a.28&amp;&amp;a.2i&amp;&amp;!a.2i.1h},5g:J(a){a=E.3g(a);7(a){L b=T.3S(&quot;6f&quot;)[0]||T.1F,1m=T.3s(&quot;1m&quot;);1m.U=&quot;1u/4m&quot;;7(E.14.1d)1m.1u=a;N 1m.38(T.5r(a));b.38(1m);b.34(1m)}},12:J(b,a){K b.12&amp;&amp;b.12.2E()==a.2E()},1T:{},O:J(c,d,b){c=c==1e?5b:c;L a=c[F];7(!a)a=c[F]=++6t;7(d&amp;&amp;!E.1T[a])E.1T[a]={};7(b!=10)E.1T[a][d]=b;K d?E.1T[a][d]:a},35:J(c,b){c=c==1e?5b:c;L a=c[F];7(b){7(E.1T[a]){2V E.1T[a][b];b=&quot;&quot;;Q(b 1p E.1T[a])1Q;7(!b)E.35(c)}}N{1S{2V c[F]}1X(e){7(c.52)c.52(F)}2V E.1T[a]}},R:J(c,a,b){7(b){7(c.M==10){Q(L d 1p c)7(a.1i(c[d],b)===S)1Q}N Q(L i=0,M=c.M;i&lt;M;i++)7(a.1i(c[i],b)===S)1Q}N{7(c.M==10){Q(L d 1p c)7(a.1P(c[d],d,c[d])===S)1Q}N Q(L i=0,M=c.M,1A=c[0];i&lt;M&amp;&amp;a.1P(1A,i,1A)!==S;1A=c[++i]){}}K c},1l:J(b,a,c,i,d){7(E.1q(a))a=a.1P(b,i);K a&amp;&amp;a.1k==51&amp;&amp;c==&quot;2o&quot;&amp;&amp;!H.17(d)?a+&quot;2S&quot;:a},1t:{1b:J(c,b){E.R((b||&quot;&quot;).23(/\\s+/),J(i,a){7(c.15==1&amp;&amp;!E.1t.3Y(c.1t,a))c.1t+=(c.1t?&quot; &quot;:&quot;&quot;)+a})},1V:J(c,b){7(c.15==1)c.1t=b!=10?E.3y(c.1t.23(/\\s+/),J(a){K!E.1t.3Y(b,a)}).6a(&quot; &quot;):&quot;&quot;},3Y:J(b,a){K E.33(a,(b.1t||b).3X().23(/\\s+/))&gt;-1}},68:J(b,c,a){L e={};Q(L d 1p c){e[d]=b.W[d];b.W[d]=c[d]}a.1P(b);Q(L d 1p c)b.W[d]=e[d]},1j:J(d,e,c){7(e==&quot;27&quot;||e==&quot;1R&quot;){L b,46={43:&quot;4W&quot;,4U:&quot;1Z&quot;,19:&quot;3D&quot;},3c=e==&quot;27&quot;?[&quot;7O&quot;,&quot;7M&quot;]:[&quot;7J&quot;,&quot;7I&quot;];J 5E(){b=e==&quot;27&quot;?d.7H:d.7F;L a=0,2N=0;E.R(3c,J(){a+=2M(E.2o(d,&quot;7E&quot;+6,P))||0;2N+=2M(E.2o(d,&quot;2N&quot;+6+&quot;5X&quot;,P))||0});b-=24.7C(a+2N)}7(E(d).3H(&quot;:4d&quot;))5E();N E.68(d,46,5E);K 24.2f(0,b)}K E.2o(d,e,c)},2o:J(e,k,j){L d;J 3x(b){7(!E.14.2d)K S;L a=T.4c.4K(b,V);K!a||a.4M(&quot;3x&quot;)==&quot;&quot;}7(k==&quot;1w&quot;&amp;&amp;E.14.1d){d=E.1J(e.W,&quot;1w&quot;);K d==&quot;&quot;?&quot;1&quot;:d}7(E.14.2z&amp;&amp;k==&quot;19&quot;){L c=e.W.50;e.W.50=&quot;0 7r 7o&quot;;e.W.50=c}7(k.1D(/4g/i))k=y;7(!j&amp;&amp;e.W&amp;&amp;e.W[k])d=e.W[k];N 7(T.4c&amp;&amp;T.4c.4K){7(k.1D(/4g/i))k=&quot;4g&quot;;k=k.1r(/([A-Z])/g,&quot;-$1&quot;).2h();L h=T.4c.4K(e,V);7(h&amp;&amp;!3x(e))d=h.4M(k);N{L f=[],2C=[];Q(L a=e;a&amp;&amp;3x(a);a=a.1a)2C.4J(a);Q(L i=0;i&lt;2C.M;i++)7(3x(2C[i])){f[i]=2C[i].W.19;2C[i].W.19=&quot;3D&quot;}d=k==&quot;19&quot;&amp;&amp;f[2C.M-1]!=V?&quot;2H&quot;:(h&amp;&amp;h.4M(k))||&quot;&quot;;Q(L i=0;i&lt;f.M;i++)7(f[i]!=V)2C[i].W.19=f[i]}7(k==&quot;1w&quot;&amp;&amp;d==&quot;&quot;)d=&quot;1&quot;}N 7(e.4n){L g=k.1r(/\\-(\\w)/g,J(a,b){K b.2E()});d=e.4n[k]||e.4n[g];7(!/^\\d+(2S)?$/i.17(d)&amp;&amp;/^\\d/.17(d)){L l=e.W.26,3K=e.3K.26;e.3K.26=e.4n.26;e.W.26=d||0;d=e.W.7f+&quot;2S&quot;;e.W.26=l;e.3K.26=3K}}K d},4a:J(l,h){L k=[];h=h||T;7(1o h.3s==\'10\')h=h.2i||h[0]&amp;&amp;h[0].2i||T;E.R(l,J(i,d){7(!d)K;7(d.1k==51)d=d.3X();7(1o d==&quot;25&quot;){d=d.1r(/(&lt;(\\w+)[^&gt;]*?)\\/&gt;/g,J(b,a,c){K c.1D(/^(aa|a6|7e|a5|4D|7a|a0|3m|9W|9U|9S)$/i)?b:a+&quot;&gt;&lt;/&quot;+c+&quot;&gt;&quot;});L f=E.3g(d).2h(),1x=h.3s(&quot;1x&quot;);L e=!f.1f(&quot;&lt;9P&quot;)&amp;&amp;[1,&quot;&lt;2k 74=\'74\'&gt;&quot;,&quot;&lt;/2k&gt;&quot;]||!f.1f(&quot;&lt;9M&quot;)&amp;&amp;[1,&quot;&lt;73&gt;&quot;,&quot;&lt;/73&gt;&quot;]||f.1D(/^&lt;(9G|1U|9E|9B|9x)/)&amp;&amp;[1,&quot;&lt;1O&gt;&quot;,&quot;&lt;/1O&gt;&quot;]||!f.1f(&quot;&lt;4v&quot;)&amp;&amp;[2,&quot;&lt;1O&gt;&lt;1U&gt;&quot;,&quot;&lt;/1U&gt;&lt;/1O&gt;&quot;]||(!f.1f(&quot;&lt;9w&quot;)||!f.1f(&quot;&lt;9v&quot;))&amp;&amp;[3,&quot;&lt;1O&gt;&lt;1U&gt;&lt;4v&gt;&quot;,&quot;&lt;/4v&gt;&lt;/1U&gt;&lt;/1O&gt;&quot;]||!f.1f(&quot;&lt;7e&quot;)&amp;&amp;[2,&quot;&lt;1O&gt;&lt;1U&gt;&lt;/1U&gt;&lt;6V&gt;&quot;,&quot;&lt;/6V&gt;&lt;/1O&gt;&quot;]||E.14.1d&amp;&amp;[1,&quot;1x&lt;1x&gt;&quot;,&quot;&lt;/1x&gt;&quot;]||[0,&quot;&quot;,&quot;&quot;];1x.3d=e[1]+d+e[2];2b(e[0]--)1x=1x.5o;7(E.14.1d){L g=!f.1f(&quot;&lt;1O&quot;)&amp;&amp;f.1f(&quot;&lt;1U&quot;)&lt;0?1x.1C&amp;&amp;1x.1C.3p:e[1]==&quot;&lt;1O&gt;&quot;&amp;&amp;f.1f(&quot;&lt;1U&quot;)&lt;0?1x.3p:[];Q(L j=g.M-1;j&gt;=0;--j)7(E.12(g[j],&quot;1U&quot;)&amp;&amp;!g[j].3p.M)g[j].1a.34(g[j]);7(/^\\s/.17(d))1x.3o(h.5r(d.1D(/^\\s*/)[0]),1x.1C)}d=E.2I(1x.3p)}7(d.M===0&amp;&amp;(!E.12(d,&quot;3u&quot;)&amp;&amp;!E.12(d,&quot;2k&quot;)))K;7(d[0]==10||E.12(d,&quot;3u&quot;)||d.11)k.1g(d);N k=E.37(k,d)});K k},1J:J(d,e,c){7(!d||d.15==3||d.15==8)K 10;L f=E.3E(d)?{}:E.46;7(e==&quot;2p&quot;&amp;&amp;E.14.2d)d.1a.3T;7(f[e]){7(c!=10)d[f[e]]=c;K d[f[e]]}N 7(E.14.1d&amp;&amp;e==&quot;W&quot;)K E.1J(d.W,&quot;9u&quot;,c);N 7(c==10&amp;&amp;E.14.1d&amp;&amp;E.12(d,&quot;3u&quot;)&amp;&amp;(e==&quot;9r&quot;||e==&quot;9o&quot;))K d.9m(e).6K;N 7(d.28){7(c!=10){7(e==&quot;U&quot;&amp;&amp;E.12(d,&quot;4D&quot;)&amp;&amp;d.1a)6Q&quot;U 9i 9h\'t 9g 9e&quot;;d.9b(e,&quot;&quot;+c)}7(E.14.1d&amp;&amp;/6O|3Q/.17(e)&amp;&amp;!E.3E(d))K d.4z(e,2);K d.4z(e)}N{7(e==&quot;1w&quot;&amp;&amp;E.14.1d){7(c!=10){d.6k=1;d.1E=(d.1E||&quot;&quot;).1r(/6M\\([^)]*\\)/,&quot;&quot;)+(2M(c).3X()==&quot;96&quot;?&quot;&quot;:&quot;6M(1w=&quot;+c*6L+&quot;)&quot;)}K d.1E&amp;&amp;d.1E.1f(&quot;1w=&quot;)&gt;=0?(2M(d.1E.1D(/1w=([^)]*)/)[1])/6L).3X():&quot;&quot;}e=e.1r(/-([a-z])/95,J(a,b){K b.2E()});7(c!=10)d[e]=c;K d[e]}},3g:J(a){K(a||&quot;&quot;).1r(/^\\s+|\\s+$/g,&quot;&quot;)},2I:J(b){L a=[];7(1o b!=&quot;93&quot;)Q(L i=0,M=b.M;i&lt;M;i++)a.1g(b[i]);N a=b.2K(0);K a},33:J(b,a){Q(L i=0,M=a.M;i&lt;M;i++)7(a[i]==b)K i;K-1},37:J(a,b){7(E.14.1d){Q(L i=0;b[i];i++)7(b[i].15!=8)a.1g(b[i])}N Q(L i=0;b[i];i++)a.1g(b[i]);K a},57:J(a){L c=[],2r={};1S{Q(L i=0,M=a.M;i&lt;M;i++){L b=E.O(a[i]);7(!2r[b]){2r[b]=P;c.1g(a[i])}}}1X(e){c=a}K c},3y:J(c,a,d){L b=[];Q(L i=0,M=c.M;i&lt;M;i++)7(!d&amp;&amp;a(c[i],i)||d&amp;&amp;!a(c[i],i))b.1g(c[i]);K b},2c:J(d,a){L c=[];Q(L i=0,M=d.M;i&lt;M;i++){L b=a(d[i],i);7(b!==V&amp;&amp;b!=10){7(b.1k!=1M)b=[b];c=c.71(b)}}K c}});L v=8Y.8W.2h();E.14={5K:(v.1D(/.+(?:8T|8S|8R|8O)[\\/: ]([\\d.]+)/)||[])[1],2d:/77/.17(v),2z:/2z/.17(v),1d:/1d/.17(v)&amp;&amp;!/2z/.17(v),48:/48/.17(v)&amp;&amp;!/(8L|77)/.17(v)};L y=E.14.1d?&quot;6H&quot;:&quot;75&quot;;E.1s({8I:!E.14.1d||T.6F==&quot;79&quot;,46:{&quot;Q&quot;:&quot;8F&quot;,&quot;8E&quot;:&quot;1t&quot;,&quot;4g&quot;:y,75:y,6H:y,3d:&quot;3d&quot;,1t:&quot;1t&quot;,1A:&quot;1A&quot;,2Y:&quot;2Y&quot;,3k:&quot;3k&quot;,8C:&quot;8B&quot;,2p:&quot;2p&quot;,8A:&quot;8z&quot;,3T:&quot;3T&quot;,6C:&quot;6C&quot;,28:&quot;28&quot;,12:&quot;12&quot;}});E.R({6B:J(a){K a.1a},8y:J(a){K E.4u(a,&quot;1a&quot;)},8x:J(a){K E.2Z(a,2,&quot;2B&quot;)},8v:J(a){K E.2Z(a,2,&quot;4t&quot;)},8u:J(a){K E.4u(a,&quot;2B&quot;)},8t:J(a){K E.4u(a,&quot;4t&quot;)},8s:J(a){K E.5i(a.1a.1C,a)},8r:J(a){K E.5i(a.1C)},6z:J(a){K E.12(a,&quot;8q&quot;)?a.8o||a.8n.T:E.2I(a.3p)}},J(c,d){E.1n[c]=J(b){L a=E.2c(6,d);7(b&amp;&amp;1o b==&quot;25&quot;)a=E.3e(b,a);K 6.2F(E.57(a))}});E.R({6y:&quot;3t&quot;,8m:&quot;6q&quot;,3o:&quot;6o&quot;,8l:&quot;5a&quot;,8k:&quot;6S&quot;},J(c,b){E.1n[c]=J(){L a=18;K 6.R(J(){Q(L i=0,M=a.M;i&lt;M;i++)E(a[i])[b](6)})}});E.R({8j:J(a){E.1J(6,a,&quot;&quot;);7(6.15==1)6.52(a)},8i:J(a){E.1t.1b(6,a)},8h:J(a){E.1t.1V(6,a)},8g:J(a){E.1t[E.1t.3Y(6,a)?&quot;1V&quot;:&quot;1b&quot;](6,a)},1V:J(a){7(!a||E.1E(a,[6]).r.M){E(&quot;*&quot;,6).1b(6).R(J(){E.16.1V(6);E.35(6)});7(6.1a)6.1a.34(6)}},4x:J(){E(&quot;&gt;*&quot;,6).1V();2b(6.1C)6.34(6.1C)}},J(a,b){E.1n[a]=J(){K 6.R(b,18)}});E.R([&quot;8f&quot;,&quot;5X&quot;],J(i,c){L b=c.2h();E.1n[b]=J(a){K 6[0]==1e?E.14.2z&amp;&amp;T.1h[&quot;5e&quot;+c]||E.14.2d&amp;&amp;1e[&quot;8e&quot;+c]||T.6F==&quot;79&quot;&amp;&amp;T.1F[&quot;5e&quot;+c]||T.1h[&quot;5e&quot;+c]:6[0]==T?24.2f(24.2f(T.1h[&quot;5d&quot;+c],T.1F[&quot;5d&quot;+c]),24.2f(T.1h[&quot;5L&quot;+c],T.1F[&quot;5L&quot;+c])):a==10?(6.M?E.1j(6[0],b):V):6.1j(b,a.1k==4e?a:a+&quot;2S&quot;)}});L C=E.14.2d&amp;&amp;4s(E.14.5K)&lt;8c?&quot;(?:[\\\\w*4r-]|\\\\\\\\.)&quot;:&quot;(?:[\\\\w\\8b-\\8a*4r-]|\\\\\\\\.)&quot;,6v=1B 4q(&quot;^&gt;\\\\s*(&quot;+C+&quot;+)&quot;),6u=1B 4q(&quot;^(&quot;+C+&quot;+)(#)(&quot;+C+&quot;+)&quot;),6s=1B 4q(&quot;^([#.]?)(&quot;+C+&quot;*)&quot;);E.1s({6r:{&quot;&quot;:J(a,i,m){K m[2]==&quot;*&quot;||E.12(a,m[2])},&quot;#&quot;:J(a,i,m){K a.4z(&quot;2w&quot;)==m[2]},&quot;:&quot;:{89:J(a,i,m){K i&lt;m[3]-0},88:J(a,i,m){K i&gt;m[3]-0},2Z:J(a,i,m){K m[3]-0==i},6Z:J(a,i,m){K m[3]-0==i},3j:J(a,i){K i==0},3J:J(a,i,m,r){K i==r.M-1},6n:J(a,i){K i%2==0},6l:J(a,i){K i%2},&quot;3j-4p&quot;:J(a){K a.1a.3S(&quot;*&quot;)[0]==a},&quot;3J-4p&quot;:J(a){K E.2Z(a.1a.5o,1,&quot;4t&quot;)==a},&quot;83-4p&quot;:J(a){K!E.2Z(a.1a.5o,2,&quot;4t&quot;)},6B:J(a){K a.1C},4x:J(a){K!a.1C},82:J(a,i,m){K(a.6x||a.81||E(a).1u()||&quot;&quot;).1f(m[3])&gt;=0},4d:J(a){K&quot;1Z&quot;!=a.U&amp;&amp;E.1j(a,&quot;19&quot;)!=&quot;2H&quot;&amp;&amp;E.1j(a,&quot;4U&quot;)!=&quot;1Z&quot;},1Z:J(a){K&quot;1Z&quot;==a.U||E.1j(a,&quot;19&quot;)==&quot;2H&quot;||E.1j(a,&quot;4U&quot;)==&quot;1Z&quot;},80:J(a){K!a.2Y},2Y:J(a){K a.2Y},3k:J(a){K a.3k},2p:J(a){K a.2p||E.1J(a,&quot;2p&quot;)},1u:J(a){K&quot;1u&quot;==a.U},5u:J(a){K&quot;5u&quot;==a.U},5t:J(a){K&quot;5t&quot;==a.U},59:J(a){K&quot;59&quot;==a.U},3I:J(a){K&quot;3I&quot;==a.U},58:J(a){K&quot;58&quot;==a.U},6j:J(a){K&quot;6j&quot;==a.U},6i:J(a){K&quot;6i&quot;==a.U},2G:J(a){K&quot;2G&quot;==a.U||E.12(a,&quot;2G&quot;)},4D:J(a){K/4D|2k|6h|2G/i.17(a.12)},3Y:J(a,i,m){K E.2s(m[3],a).M},7X:J(a){K/h\\d/i.17(a.12)},7W:J(a){K E.3y(E.3G,J(b){K a==b.Y}).M}}},6g:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?&quot;?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\(&quot;?\'?(.*?(\\(.*?\\))?[^(]*?)&quot;?\'?\\)/,1B 4q(&quot;^([:.#]*)(&quot;+C+&quot;+)&quot;)],3e:J(a,c,b){L d,2m=[];2b(a&amp;&amp;a!=d){d=a;L f=E.1E(a,c,b);a=f.t.1r(/^\\s*,\\s*/,&quot;&quot;);2m=b?c=f.r:E.37(2m,f.r)}K 2m},2s:J(t,p){7(1o t!=&quot;25&quot;)K[t];7(p&amp;&amp;p.15!=1&amp;&amp;p.15!=9)K[];p=p||T;L d=[p],2r=[],3J,12;2b(t&amp;&amp;3J!=t){L r=[];3J=t;t=E.3g(t);L o=S;L g=6v;L m=g.2O(t);7(m){12=m[1].2E();Q(L i=0;d[i];i++)Q(L c=d[i].1C;c;c=c.2B)7(c.15==1&amp;&amp;(12==&quot;*&quot;||c.12.2E()==12))r.1g(c);d=r;t=t.1r(g,&quot;&quot;);7(t.1f(&quot; &quot;)==0)6w;o=P}N{g=/^([&gt;+~])\\s*(\\w*)/i;7((m=g.2O(t))!=V){r=[];L l={};12=m[2].2E();m=m[1];Q(L j=0,3f=d.M;j&lt;3f;j++){L n=m==&quot;~&quot;||m==&quot;+&quot;?d[j].2B:d[j].1C;Q(;n;n=n.2B)7(n.15==1){L h=E.O(n);7(m==&quot;~&quot;&amp;&amp;l[h])1Q;7(!12||n.12.2E()==12){7(m==&quot;~&quot;)l[h]=P;r.1g(n)}7(m==&quot;+&quot;)1Q}}d=r;t=E.3g(t.1r(g,&quot;&quot;));o=P}}7(t&amp;&amp;!o){7(!t.1f(&quot;,&quot;)){7(p==d[0])d.4l();2r=E.37(2r,d);r=d=[p];t=&quot; &quot;+t.6e(1,t.M)}N{L k=6u;L m=k.2O(t);7(m){m=[0,m[2],m[3],m[1]]}N{k=6s;m=k.2O(t)}m[2]=m[2].1r(/\\\\/g,&quot;&quot;);L f=d[d.M-1];7(m[1]==&quot;#&quot;&amp;&amp;f&amp;&amp;f.5J&amp;&amp;!E.3E(f)){L q=f.5J(m[2]);7((E.14.1d||E.14.2z)&amp;&amp;q&amp;&amp;1o q.2w==&quot;25&quot;&amp;&amp;q.2w!=m[2])q=E(\'[@2w=&quot;\'+m[2]+\'&quot;]\',f)[0];d=r=q&amp;&amp;(!m[3]||E.12(q,m[3]))?[q]:[]}N{Q(L i=0;d[i];i++){L a=m[1]==&quot;#&quot;&amp;&amp;m[3]?m[3]:m[1]!=&quot;&quot;||m[0]==&quot;&quot;?&quot;*&quot;:m[2];7(a==&quot;*&quot;&amp;&amp;d[i].12.2h()==&quot;3V&quot;)a=&quot;3m&quot;;r=E.37(r,d[i].3S(a))}7(m[1]==&quot;.&quot;)r=E.55(r,m[2]);7(m[1]==&quot;#&quot;){L e=[];Q(L i=0;r[i];i++)7(r[i].4z(&quot;2w&quot;)==m[2]){e=[r[i]];1Q}r=e}d=r}t=t.1r(k,&quot;&quot;)}}7(t){L b=E.1E(t,r);d=r=b.r;t=E.3g(b.t)}}7(t)d=[];7(d&amp;&amp;p==d[0])d.4l();2r=E.37(2r,d);K 2r},55:J(r,m,a){m=&quot; &quot;+m+&quot; &quot;;L c=[];Q(L i=0;r[i];i++){L b=(&quot; &quot;+r[i].1t+&quot; &quot;).1f(m)&gt;=0;7(!a&amp;&amp;b||a&amp;&amp;!b)c.1g(r[i])}K c},1E:J(t,r,h){L d;2b(t&amp;&amp;t!=d){d=t;L p=E.6g,m;Q(L i=0;p[i];i++){m=p[i].2O(t);7(m){t=t.7V(m[0].M);m[2]=m[2].1r(/\\\\/g,&quot;&quot;);1Q}}7(!m)1Q;7(m[1]==&quot;:&quot;&amp;&amp;m[2]==&quot;56&quot;)r=G.17(m[3])?E.1E(m[3],r,P).r:E(r).56(m[3]);N 7(m[1]==&quot;.&quot;)r=E.55(r,m[2],h);N 7(m[1]==&quot;[&quot;){L g=[],U=m[3];Q(L i=0,3f=r.M;i&lt;3f;i++){L a=r[i],z=a[E.46[m[2]]||m[2]];7(z==V||/6O|3Q|2p/.17(m[2]))z=E.1J(a,m[2])||\'\';7((U==&quot;&quot;&amp;&amp;!!z||U==&quot;=&quot;&amp;&amp;z==m[5]||U==&quot;!=&quot;&amp;&amp;z!=m[5]||U==&quot;^=&quot;&amp;&amp;z&amp;&amp;!z.1f(m[5])||U==&quot;$=&quot;&amp;&amp;z.6e(z.M-m[5].M)==m[5]||(U==&quot;*=&quot;||U==&quot;~=&quot;)&amp;&amp;z.1f(m[5])&gt;=0)^h)g.1g(a)}r=g}N 7(m[1]==&quot;:&quot;&amp;&amp;m[2]==&quot;2Z-4p&quot;){L e={},g=[],17=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2O(m[3]==&quot;6n&quot;&amp;&amp;&quot;2n&quot;||m[3]==&quot;6l&quot;&amp;&amp;&quot;2n+1&quot;||!/\\D/.17(m[3])&amp;&amp;&quot;7U+&quot;+m[3]||m[3]),3j=(17[1]+(17[2]||1))-0,d=17[3]-0;Q(L i=0,3f=r.M;i&lt;3f;i++){L j=r[i],1a=j.1a,2w=E.O(1a);7(!e[2w]){L c=1;Q(L n=1a.1C;n;n=n.2B)7(n.15==1)n.4k=c++;e[2w]=P}L b=S;7(3j==0){7(j.4k==d)b=P}N 7((j.4k-d)%3j==0&amp;&amp;(j.4k-d)/3j&gt;=0)b=P;7(b^h)g.1g(j)}r=g}N{L f=E.6r[m[1]];7(1o f==&quot;3V&quot;)f=f[m[2]];7(1o f==&quot;25&quot;)f=6c(&quot;S||J(a,i){K &quot;+f+&quot;;}&quot;);r=E.3y(r,J(a,i){K f(a,i,m,r)},h)}}K{r:r,t:t}},4u:J(b,c){L d=[];L a=b[c];2b(a&amp;&amp;a!=T){7(a.15==1)d.1g(a);a=a[c]}K d},2Z:J(a,e,c,b){e=e||1;L d=0;Q(;a;a=a[c])7(a.15==1&amp;&amp;++d==e)1Q;K a},5i:J(n,a){L r=[];Q(;n;n=n.2B){7(n.15==1&amp;&amp;(!a||n!=a))r.1g(n)}K r}});E.16={1b:J(f,i,g,e){7(f.15==3||f.15==8)K;7(E.14.1d&amp;&amp;f.53!=10)f=1e;7(!g.2D)g.2D=6.2D++;7(e!=10){L h=g;g=J(){K h.1i(6,18)};g.O=e;g.2D=h.2D}L j=E.O(f,&quot;2R&quot;)||E.O(f,&quot;2R&quot;,{}),1v=E.O(f,&quot;1v&quot;)||E.O(f,&quot;1v&quot;,J(){L a;7(1o E==&quot;10&quot;||E.16.5f)K a;a=E.16.1v.1i(18.3R.Y,18);K a});1v.Y=f;E.R(i.23(/\\s+/),J(c,b){L a=b.23(&quot;.&quot;);b=a[0];g.U=a[1];L d=j[b];7(!d){d=j[b]={};7(!E.16.2y[b]||E.16.2y[b].4j.1P(f)===S){7(f.3F)f.3F(b,1v,S);N 7(f.6b)f.6b(&quot;4i&quot;+b,1v)}}d[g.2D]=g;E.16.2a[b]=P});f=V},2D:1,2a:{},1V:J(e,h,f){7(e.15==3||e.15==8)K;L i=E.O(e,&quot;2R&quot;),29,4X;7(i){7(h==10||(1o h==&quot;25&quot;&amp;&amp;h.7T(0)==&quot;.&quot;))Q(L g 1p i)6.1V(e,g+(h||&quot;&quot;));N{7(h.U){f=h.2q;h=h.U}E.R(h.23(/\\s+/),J(b,a){L c=a.23(&quot;.&quot;);a=c[0];7(i[a]){7(f)2V i[a][f.2D];N Q(f 1p i[a])7(!c[1]||i[a][f].U==c[1])2V i[a][f];Q(29 1p i[a])1Q;7(!29){7(!E.16.2y[a]||E.16.2y[a].4h.1P(e)===S){7(e.67)e.67(a,E.O(e,&quot;1v&quot;),S);N 7(e.66)e.66(&quot;4i&quot;+a,E.O(e,&quot;1v&quot;))}29=V;2V i[a]}}})}Q(29 1p i)1Q;7(!29){L d=E.O(e,&quot;1v&quot;);7(d)d.Y=V;E.35(e,&quot;2R&quot;);E.35(e,&quot;1v&quot;)}}},1N:J(g,c,d,f,h){c=E.2I(c||[]);7(g.1f(&quot;!&quot;)&gt;=0){g=g.2K(0,-1);L a=P}7(!d){7(6.2a[g])E(&quot;*&quot;).1b([1e,T]).1N(g,c)}N{7(d.15==3||d.15==8)K 10;L b,29,1n=E.1q(d[g]||V),16=!c[0]||!c[0].36;7(16)c.4J(6.4Z({U:g,2L:d}));c[0].U=g;7(a)c[0].65=P;7(E.1q(E.O(d,&quot;1v&quot;)))b=E.O(d,&quot;1v&quot;).1i(d,c);7(!1n&amp;&amp;d[&quot;4i&quot;+g]&amp;&amp;d[&quot;4i&quot;+g].1i(d,c)===S)b=S;7(16)c.4l();7(h&amp;&amp;E.1q(h)){29=h.1i(d,b==V?c:c.71(b));7(29!==10)b=29}7(1n&amp;&amp;f!==S&amp;&amp;b!==S&amp;&amp;!(E.12(d,\'a\')&amp;&amp;g==&quot;4V&quot;)){6.5f=P;1S{d[g]()}1X(e){}}6.5f=S}K b},1v:J(c){L a;c=E.16.4Z(c||1e.16||{});L b=c.U.23(&quot;.&quot;);c.U=b[0];L f=E.O(6,&quot;2R&quot;)&amp;&amp;E.O(6,&quot;2R&quot;)[c.U],42=1M.2l.2K.1P(18,1);42.4J(c);Q(L j 1p f){L d=f[j];42[0].2q=d;42[0].O=d.O;7(!b[1]&amp;&amp;!c.65||d.U==b[1]){L e=d.1i(6,42);7(a!==S)a=e;7(e===S){c.36();c.44()}}}7(E.14.1d)c.2L=c.36=c.44=c.2q=c.O=V;K a},4Z:J(c){L a=c;c=E.1s({},a);c.36=J(){7(a.36)a.36();a.7S=S};c.44=J(){7(a.44)a.44();a.7R=P};7(!c.2L)c.2L=c.7Q||T;7(c.2L.15==3)c.2L=a.2L.1a;7(!c.4S&amp;&amp;c.5w)c.4S=c.5w==c.2L?c.7P:c.5w;7(c.64==V&amp;&amp;c.63!=V){L b=T.1F,1h=T.1h;c.64=c.63+(b&amp;&amp;b.2v||1h&amp;&amp;1h.2v||0)-(b.62||0);c.7N=c.7L+(b&amp;&amp;b.2x||1h&amp;&amp;1h.2x||0)-(b.60||0)}7(!c.3c&amp;&amp;((c.4f||c.4f===0)?c.4f:c.5Z))c.3c=c.4f||c.5Z;7(!c.7b&amp;&amp;c.5Y)c.7b=c.5Y;7(!c.3c&amp;&amp;c.2G)c.3c=(c.2G&amp;1?1:(c.2G&amp;2?3:(c.2G&amp;4?2:0)));K c},2y:{21:{4j:J(){5M();K},4h:J(){K}},3C:{4j:J(){7(E.14.1d)K S;E(6).2j(&quot;4P&quot;,E.16.2y.3C.2q);K P},4h:J(){7(E.14.1d)K S;E(6).3w(&quot;4P&quot;,E.16.2y.3C.2q);K P},2q:J(a){7(I(a,6))K P;18[0].U=&quot;3C&quot;;K E.16.1v.1i(6,18)}},3B:{4j:J(){7(E.14.1d)K S;E(6).2j(&quot;4O&quot;,E.16.2y.3B.2q);K P},4h:J(){7(E.14.1d)K S;E(6).3w(&quot;4O&quot;,E.16.2y.3B.2q);K P},2q:J(a){7(I(a,6))K P;18[0].U=&quot;3B&quot;;K E.16.1v.1i(6,18)}}}};E.1n.1s({2j:J(c,a,b){K c==&quot;4H&quot;?6.2X(c,a,b):6.R(J(){E.16.1b(6,c,b||a,b&amp;&amp;a)})},2X:J(d,b,c){K 6.R(J(){E.16.1b(6,d,J(a){E(6).3w(a);K(c||b).1i(6,18)},c&amp;&amp;b)})},3w:J(a,b){K 6.R(J(){E.16.1V(6,a,b)})},1N:J(c,a,b){K 6.R(J(){E.16.1N(c,a,6,P,b)})},5n:J(c,a,b){7(6[0])K E.16.1N(c,a,6[0],S,b);K 10},2g:J(){L b=18;K 6.4V(J(a){6.4N=0==6.4N?1:0;a.36();K b[6.4N].1i(6,18)||S})},7D:J(a,b){K 6.2j(\'3C\',a).2j(\'3B\',b)},21:J(a){5M();7(E.2Q)a.1P(T,E);N E.3A.1g(J(){K a.1P(6,E)});K 6}});E.1s({2Q:S,3A:[],21:J(){7(!E.2Q){E.2Q=P;7(E.3A){E.R(E.3A,J(){6.1i(T)});E.3A=V}E(T).5n(&quot;21&quot;)}}});L x=S;J 5M(){7(x)K;x=P;7(T.3F&amp;&amp;!E.14.2z)T.3F(&quot;5W&quot;,E.21,S);7(E.14.1d&amp;&amp;1e==3b)(J(){7(E.2Q)K;1S{T.1F.7B(&quot;26&quot;)}1X(3a){3z(18.3R,0);K}E.21()})();7(E.14.2z)T.3F(&quot;5W&quot;,J(){7(E.2Q)K;Q(L i=0;i&lt;T.4L.M;i++)7(T.4L[i].2Y){3z(18.3R,0);K}E.21()},S);7(E.14.2d){L a;(J(){7(E.2Q)K;7(T.39!=&quot;5V&quot;&amp;&amp;T.39!=&quot;1y&quot;){3z(18.3R,0);K}7(a===10)a=E(&quot;W, 7a[7A=7z]&quot;).M;7(T.4L.M!=a){3z(18.3R,0);K}E.21()})()}E.16.1b(1e,&quot;3U&quot;,E.21)}E.R((&quot;7y,7x,3U,7w,5d,4H,4V,7v,&quot;+&quot;7G,7u,7t,4P,4O,7s,2k,&quot;+&quot;58,7K,7q,7p,3a&quot;).23(&quot;,&quot;),J(i,b){E.1n[b]=J(a){K a?6.2j(b,a):6.1N(b)}});L I=J(a,c){L b=a.4S;2b(b&amp;&amp;b!=c)1S{b=b.1a}1X(3a){b=c}K b==c};E(1e).2j(&quot;4H&quot;,J(){E(&quot;*&quot;).1b(T).3w()});E.1n.1s({3U:J(g,d,c){7(E.1q(g))K 6.2j(&quot;3U&quot;,g);L e=g.1f(&quot; &quot;);7(e&gt;=0){L i=g.2K(e,g.M);g=g.2K(0,e)}c=c||J(){};L f=&quot;4Q&quot;;7(d)7(E.1q(d)){c=d;d=V}N{d=E.3m(d);f=&quot;61&quot;}L h=6;E.3P({1c:g,U:f,1H:&quot;3q&quot;,O:d,1y:J(a,b){7(b==&quot;1W&quot;||b==&quot;5U&quot;)h.3q(i?E(&quot;&lt;1x/&gt;&quot;).3t(a.4b.1r(/&lt;1m(.|\\s)*?\\/1m&gt;/g,&quot;&quot;)).2s(i):a.4b);h.R(c,[a.4b,b,a])}});K 6},7n:J(){K E.3m(6.5T())},5T:J(){K 6.2c(J(){K E.12(6,&quot;3u&quot;)?E.2I(6.7m):6}).1E(J(){K 6.31&amp;&amp;!6.2Y&amp;&amp;(6.3k||/2k|6h/i.17(6.12)||/1u|1Z|3I/i.17(6.U))}).2c(J(i,c){L b=E(6).5O();K b==V?V:b.1k==1M?E.2c(b,J(a,i){K{31:c.31,1A:a}}):{31:c.31,1A:b}}).22()}});E.R(&quot;5S,6d,5R,6D,5Q,6m&quot;.23(&quot;,&quot;),J(i,o){E.1n[o]=J(f){K 6.2j(o,f)}});L B=(1B 3v).3L();E.1s({22:J(d,b,a,c){7(E.1q(b)){a=b;b=V}K E.3P({U:&quot;4Q&quot;,1c:d,O:b,1W:a,1H:c})},7l:J(b,a){K E.22(b,V,a,&quot;1m&quot;)},7k:J(c,b,a){K E.22(c,b,a,&quot;3i&quot;)},7i:J(d,b,a,c){7(E.1q(b)){a=b;b={}}K E.3P({U:&quot;61&quot;,1c:d,O:b,1W:a,1H:c})},85:J(a){E.1s(E.4I,a)},4I:{2a:P,U:&quot;4Q&quot;,2U:0,5P:&quot;4o/x-7h-3u-7g&quot;,5N:P,3l:P,O:V,6p:V,3I:V,49:{3M:&quot;4o/3M, 1u/3M&quot;,3q:&quot;1u/3q&quot;,1m:&quot;1u/4m, 4o/4m&quot;,3i:&quot;4o/3i, 1u/4m&quot;,1u:&quot;1u/a7&quot;,4G:&quot;*/*&quot;}},4F:{},3P:J(s){L f,2W=/=\\?(&amp;|$)/g,1z,O;s=E.1s(P,s,E.1s(P,{},E.4I,s));7(s.O&amp;&amp;s.5N&amp;&amp;1o s.O!=&quot;25&quot;)s.O=E.3m(s.O);7(s.1H==&quot;4E&quot;){7(s.U.2h()==&quot;22&quot;){7(!s.1c.1D(2W))s.1c+=(s.1c.1D(/\\?/)?&quot;&amp;&quot;:&quot;?&quot;)+(s.4E||&quot;7d&quot;)+&quot;=?&quot;}N 7(!s.O||!s.O.1D(2W))s.O=(s.O?s.O+&quot;&amp;&quot;:&quot;&quot;)+(s.4E||&quot;7d&quot;)+&quot;=?&quot;;s.1H=&quot;3i&quot;}7(s.1H==&quot;3i&quot;&amp;&amp;(s.O&amp;&amp;s.O.1D(2W)||s.1c.1D(2W))){f=&quot;4E&quot;+B++;7(s.O)s.O=(s.O+&quot;&quot;).1r(2W,&quot;=&quot;+f+&quot;$1&quot;);s.1c=s.1c.1r(2W,&quot;=&quot;+f+&quot;$1&quot;);s.1H=&quot;1m&quot;;1e[f]=J(a){O=a;1W();1y();1e[f]=10;1S{2V 1e[f]}1X(e){}7(h)h.34(g)}}7(s.1H==&quot;1m&quot;&amp;&amp;s.1T==V)s.1T=S;7(s.1T===S&amp;&amp;s.U.2h()==&quot;22&quot;){L i=(1B 3v()).3L();L j=s.1c.1r(/(\\?|&amp;)4r=.*?(&amp;|$)/,&quot;$a4=&quot;+i+&quot;$2&quot;);s.1c=j+((j==s.1c)?(s.1c.1D(/\\?/)?&quot;&amp;&quot;:&quot;?&quot;)+&quot;4r=&quot;+i:&quot;&quot;)}7(s.O&amp;&amp;s.U.2h()==&quot;22&quot;){s.1c+=(s.1c.1D(/\\?/)?&quot;&amp;&quot;:&quot;?&quot;)+s.O;s.O=V}7(s.2a&amp;&amp;!E.5H++)E.16.1N(&quot;5S&quot;);7((!s.1c.1f(&quot;a3&quot;)||!s.1c.1f(&quot;//&quot;))&amp;&amp;s.1H==&quot;1m&quot;&amp;&amp;s.U.2h()==&quot;22&quot;){L h=T.3S(&quot;6f&quot;)[0];L g=T.3s(&quot;1m&quot;);g.3Q=s.1c;7(s.7c)g.a2=s.7c;7(!f){L l=S;g.9Z=g.9Y=J(){7(!l&amp;&amp;(!6.39||6.39==&quot;5V&quot;||6.39==&quot;1y&quot;)){l=P;1W();1y();h.34(g)}}}h.38(g);K 10}L m=S;L k=1e.78?1B 78(&quot;9X.9V&quot;):1B 76();k.9T(s.U,s.1c,s.3l,s.6p,s.3I);1S{7(s.O)k.4C(&quot;9R-9Q&quot;,s.5P);7(s.5C)k.4C(&quot;9O-5A-9N&quot;,E.4F[s.1c]||&quot;9L, 9K 9I 9H 5z:5z:5z 9F&quot;);k.4C(&quot;X-9C-9A&quot;,&quot;76&quot;);k.4C(&quot;9z&quot;,s.1H&amp;&amp;s.49[s.1H]?s.49[s.1H]+&quot;, */*&quot;:s.49.4G)}1X(e){}7(s.6Y)s.6Y(k);7(s.2a)E.16.1N(&quot;6m&quot;,[k,s]);L c=J(a){7(!m&amp;&amp;k&amp;&amp;(k.39==4||a==&quot;2U&quot;)){m=P;7(d){6I(d);d=V}1z=a==&quot;2U&quot;&amp;&amp;&quot;2U&quot;||!E.6X(k)&amp;&amp;&quot;3a&quot;||s.5C&amp;&amp;E.6J(k,s.1c)&amp;&amp;&quot;5U&quot;||&quot;1W&quot;;7(1z==&quot;1W&quot;){1S{O=E.6W(k,s.1H)}1X(e){1z=&quot;5x&quot;}}7(1z==&quot;1W&quot;){L b;1S{b=k.5q(&quot;6U-5A&quot;)}1X(e){}7(s.5C&amp;&amp;b)E.4F[s.1c]=b;7(!f)1W()}N E.5v(s,k,1z);1y();7(s.3l)k=V}};7(s.3l){L d=53(c,13);7(s.2U&gt;0)3z(J(){7(k){k.9t();7(!m)c(&quot;2U&quot;)}},s.2U)}1S{k.9s(s.O)}1X(e){E.5v(s,k,V,e)}7(!s.3l)c();J 1W(){7(s.1W)s.1W(O,1z);7(s.2a)E.16.1N(&quot;5Q&quot;,[k,s])}J 1y(){7(s.1y)s.1y(k,1z);7(s.2a)E.16.1N(&quot;5R&quot;,[k,s]);7(s.2a&amp;&amp;!--E.5H)E.16.1N(&quot;6d&quot;)}K k},5v:J(s,a,b,e){7(s.3a)s.3a(a,b,e);7(s.2a)E.16.1N(&quot;6D&quot;,[a,s,e])},5H:0,6X:J(r){1S{K!r.1z&amp;&amp;9q.9p==&quot;59:&quot;||(r.1z&gt;=6T&amp;&amp;r.1z&lt;9n)||r.1z==6R||r.1z==9l||E.14.2d&amp;&amp;r.1z==10}1X(e){}K S},6J:J(a,c){1S{L b=a.5q(&quot;6U-5A&quot;);K a.1z==6R||b==E.4F[c]||E.14.2d&amp;&amp;a.1z==10}1X(e){}K S},6W:J(r,b){L c=r.5q(&quot;9k-U&quot;);L d=b==&quot;3M&quot;||!b&amp;&amp;c&amp;&amp;c.1f(&quot;3M&quot;)&gt;=0;L a=d?r.9j:r.4b;7(d&amp;&amp;a.1F.28==&quot;5x&quot;)6Q&quot;5x&quot;;7(b==&quot;1m&quot;)E.5g(a);7(b==&quot;3i&quot;)a=6c(&quot;(&quot;+a+&quot;)&quot;);K a},3m:J(a){L s=[];7(a.1k==1M||a.5h)E.R(a,J(){s.1g(3r(6.31)+&quot;=&quot;+3r(6.1A))});N Q(L j 1p a)7(a[j]&amp;&amp;a[j].1k==1M)E.R(a[j],J(){s.1g(3r(j)+&quot;=&quot;+3r(6))});N s.1g(3r(j)+&quot;=&quot;+3r(a[j]));K s.6a(&quot;&amp;&quot;).1r(/%20/g,&quot;+&quot;)}});E.1n.1s({1G:J(c,b){K c?6.2e({1R:&quot;1G&quot;,27:&quot;1G&quot;,1w:&quot;1G&quot;},c,b):6.1E(&quot;:1Z&quot;).R(J(){6.W.19=6.5s||&quot;&quot;;7(E.1j(6,&quot;19&quot;)==&quot;2H&quot;){L a=E(&quot;&lt;&quot;+6.28+&quot; /&gt;&quot;).6y(&quot;1h&quot;);6.W.19=a.1j(&quot;19&quot;);7(6.W.19==&quot;2H&quot;)6.W.19=&quot;3D&quot;;a.1V()}}).3h()},1I:J(b,a){K b?6.2e({1R:&quot;1I&quot;,27:&quot;1I&quot;,1w:&quot;1I&quot;},b,a):6.1E(&quot;:4d&quot;).R(J(){6.5s=6.5s||E.1j(6,&quot;19&quot;);6.W.19=&quot;2H&quot;}).3h()},6N:E.1n.2g,2g:J(a,b){K E.1q(a)&amp;&amp;E.1q(b)?6.6N(a,b):a?6.2e({1R:&quot;2g&quot;,27:&quot;2g&quot;,1w:&quot;2g&quot;},a,b):6.R(J(){E(6)[E(6).3H(&quot;:1Z&quot;)?&quot;1G&quot;:&quot;1I&quot;]()})},9f:J(b,a){K 6.2e({1R:&quot;1G&quot;},b,a)},9d:J(b,a){K 6.2e({1R:&quot;1I&quot;},b,a)},9c:J(b,a){K 6.2e({1R:&quot;2g&quot;},b,a)},9a:J(b,a){K 6.2e({1w:&quot;1G&quot;},b,a)},99:J(b,a){K 6.2e({1w:&quot;1I&quot;},b,a)},97:J(c,a,b){K 6.2e({1w:a},c,b)},2e:J(l,k,j,h){L i=E.6P(k,j,h);K 6[i.2P===S?&quot;R&quot;:&quot;2P&quot;](J(){7(6.15!=1)K S;L g=E.1s({},i);L f=E(6).3H(&quot;:1Z&quot;),4A=6;Q(L p 1p l){7(l[p]==&quot;1I&quot;&amp;&amp;f||l[p]==&quot;1G&quot;&amp;&amp;!f)K E.1q(g.1y)&amp;&amp;g.1y.1i(6);7(p==&quot;1R&quot;||p==&quot;27&quot;){g.19=E.1j(6,&quot;19&quot;);g.32=6.W.32}}7(g.32!=V)6.W.32=&quot;1Z&quot;;g.40=E.1s({},l);E.R(l,J(c,a){L e=1B E.2t(4A,g,c);7(/2g|1G|1I/.17(a))e[a==&quot;2g&quot;?f?&quot;1G&quot;:&quot;1I&quot;:a](l);N{L b=a.3X().1D(/^([+-]=)?([\\d+-.]+)(.*)$/),1Y=e.2m(P)||0;7(b){L d=2M(b[2]),2A=b[3]||&quot;2S&quot;;7(2A!=&quot;2S&quot;){4A.W[c]=(d||1)+2A;1Y=((d||1)/e.2m(P))*1Y;4A.W[c]=1Y+2A}7(b[1])d=((b[1]==&quot;-=&quot;?-1:1)*d)+1Y;e.45(1Y,d,2A)}N e.45(1Y,a,&quot;&quot;)}});K P})},2P:J(a,b){7(E.1q(a)||(a&amp;&amp;a.1k==1M)){b=a;a=&quot;2t&quot;}7(!a||(1o a==&quot;25&quot;&amp;&amp;!b))K A(6[0],a);K 6.R(J(){7(b.1k==1M)A(6,a,b);N{A(6,a).1g(b);7(A(6,a).M==1)b.1i(6)}})},94:J(b,c){L a=E.3G;7(b)6.2P([]);6.R(J(){Q(L i=a.M-1;i&gt;=0;i--)7(a[i].Y==6){7(c)a[i](P);a.72(i,1)}});7(!c)6.5p();K 6}});L A=J(b,c,a){7(!b)K 10;c=c||&quot;2t&quot;;L q=E.O(b,c+&quot;2P&quot;);7(!q||a)q=E.O(b,c+&quot;2P&quot;,a?E.2I(a):[]);K q};E.1n.5p=J(a){a=a||&quot;2t&quot;;K 6.R(J(){L q=A(6,a);q.4l();7(q.M)q[0].1i(6)})};E.1s({6P:J(b,a,c){L d=b&amp;&amp;b.1k==92?b:{1y:c||!c&amp;&amp;a||E.1q(b)&amp;&amp;b,2u:b,3Z:c&amp;&amp;a||a&amp;&amp;a.1k!=91&amp;&amp;a};d.2u=(d.2u&amp;&amp;d.2u.1k==51?d.2u:{90:8Z,9D:6T}[d.2u])||8X;d.5y=d.1y;d.1y=J(){7(d.2P!==S)E(6).5p();7(E.1q(d.5y))d.5y.1i(6)};K d},3Z:{70:J(p,n,b,a){K b+a*p},5j:J(p,n,b,a){K((-24.8V(p*24.8U)/2)+0.5)*a+b}},3G:[],3W:V,2t:J(b,c,a){6.11=c;6.Y=b;6.1l=a;7(!c.47)c.47={}}});E.2t.2l={4y:J(){7(6.11.30)6.11.30.1i(6.Y,[6.2J,6]);(E.2t.30[6.1l]||E.2t.30.4G)(6);7(6.1l==&quot;1R&quot;||6.1l==&quot;27&quot;)6.Y.W.19=&quot;3D&quot;},2m:J(a){7(6.Y[6.1l]!=V&amp;&amp;6.Y.W[6.1l]==V)K 6.Y[6.1l];L r=2M(E.1j(6.Y,6.1l,a));K r&amp;&amp;r&gt;-8Q?r:2M(E.2o(6.Y,6.1l))||0},45:J(c,b,d){6.5B=(1B 3v()).3L();6.1Y=c;6.3h=b;6.2A=d||6.2A||&quot;2S&quot;;6.2J=6.1Y;6.4B=6.4w=0;6.4y();L e=6;J t(a){K e.30(a)}t.Y=6.Y;E.3G.1g(t);7(E.3W==V){E.3W=53(J(){L a=E.3G;Q(L i=0;i&lt;a.M;i++)7(!a[i]())a.72(i--,1);7(!a.M){6I(E.3W);E.3W=V}},13)}},1G:J(){6.11.47[6.1l]=E.1J(6.Y.W,6.1l);6.11.1G=P;6.45(0,6.2m());7(6.1l==&quot;27&quot;||6.1l==&quot;1R&quot;)6.Y.W[6.1l]=&quot;8N&quot;;E(6.Y).1G()},1I:J(){6.11.47[6.1l]=E.1J(6.Y.W,6.1l);6.11.1I=P;6.45(6.2m(),0)},30:J(a){L t=(1B 3v()).3L();7(a||t&gt;6.11.2u+6.5B){6.2J=6.3h;6.4B=6.4w=1;6.4y();6.11.40[6.1l]=P;L b=P;Q(L i 1p 6.11.40)7(6.11.40[i]!==P)b=S;7(b){7(6.11.19!=V){6.Y.W.32=6.11.32;6.Y.W.19=6.11.19;7(E.1j(6.Y,&quot;19&quot;)==&quot;2H&quot;)6.Y.W.19=&quot;3D&quot;}7(6.11.1I)6.Y.W.19=&quot;2H&quot;;7(6.11.1I||6.11.1G)Q(L p 1p 6.11.40)E.1J(6.Y.W,p,6.11.47[p])}7(b&amp;&amp;E.1q(6.11.1y))6.11.1y.1i(6.Y);K S}N{L n=t-6.5B;6.4w=n/6.11.2u;6.4B=E.3Z[6.11.3Z||(E.3Z.5j?&quot;5j&quot;:&quot;70&quot;)](6.4w,n,0,1,6.11.2u);6.2J=6.1Y+((6.3h-6.1Y)*6.4B);6.4y()}K P}};E.2t.30={2v:J(a){a.Y.2v=a.2J},2x:J(a){a.Y.2x=a.2J},1w:J(a){E.1J(a.Y.W,&quot;1w&quot;,a.2J)},4G:J(a){a.Y.W[a.1l]=a.2J+a.2A}};E.1n.5L=J(){L b=0,3b=0,Y=6[0],5l;7(Y)8M(E.14){L d=Y.1a,41=Y,1K=Y.1K,1L=Y.2i,5D=2d&amp;&amp;4s(5K)&lt;8J&amp;&amp;!/a1/i.17(v),2T=E.1j(Y,&quot;43&quot;)==&quot;2T&quot;;7(Y.6G){L c=Y.6G();1b(c.26+24.2f(1L.1F.2v,1L.1h.2v),c.3b+24.2f(1L.1F.2x,1L.1h.2x));1b(-1L.1F.62,-1L.1F.60)}N{1b(Y.5G,Y.5F);2b(1K){1b(1K.5G,1K.5F);7(48&amp;&amp;!/^t(8H|d|h)$/i.17(1K.28)||2d&amp;&amp;!5D)2N(1K);7(!2T&amp;&amp;E.1j(1K,&quot;43&quot;)==&quot;2T&quot;)2T=P;41=/^1h$/i.17(1K.28)?41:1K;1K=1K.1K}2b(d&amp;&amp;d.28&amp;&amp;!/^1h|3q$/i.17(d.28)){7(!/^8G|1O.*$/i.17(E.1j(d,&quot;19&quot;)))1b(-d.2v,-d.2x);7(48&amp;&amp;E.1j(d,&quot;32&quot;)!=&quot;4d&quot;)2N(d);d=d.1a}7((5D&amp;&amp;(2T||E.1j(41,&quot;43&quot;)==&quot;4W&quot;))||(48&amp;&amp;E.1j(41,&quot;43&quot;)!=&quot;4W&quot;))1b(-1L.1h.5G,-1L.1h.5F);7(2T)1b(24.2f(1L.1F.2v,1L.1h.2v),24.2f(1L.1F.2x,1L.1h.2x))}5l={3b:3b,26:b}}J 2N(a){1b(E.2o(a,&quot;a8&quot;,P),E.2o(a,&quot;a9&quot;,P))}J 1b(l,t){b+=4s(l)||0;3b+=4s(t)||0}K 5l}})();',62,631,'||||||this|if||||||||||||||||||||||||||||||||||||||function|return|var|length|else|data|true|for|each|false|document|type|null|style||elem||undefined|options|nodeName||browser|nodeType|event|test|arguments|display|parentNode|add|url|msie|window|indexOf|push|body|apply|css|constructor|prop|script|fn|typeof|in|isFunction|replace|extend|className|text|handle|opacity|div|complete|status|value|new|firstChild|match|filter|documentElement|show|dataType|hide|attr|offsetParent|doc|Array|trigger|table|call|break|height|try|cache|tbody|remove|success|catch|start|hidden||ready|get|split|Math|string|left|width|tagName|ret|global|while|map|safari|animate|max|toggle|toLowerCase|ownerDocument|bind|select|prototype|cur||curCSS|selected|handler|done|find|fx|duration|scrollLeft|id|scrollTop|special|opera|unit|nextSibling|stack|guid|toUpperCase|pushStack|button|none|makeArray|now|slice|target|parseFloat|border|exec|queue|isReady|events|px|fixed|timeout|delete|jsre|one|disabled|nth|step|name|overflow|inArray|removeChild|removeData|preventDefault|merge|appendChild|readyState|error|top|which|innerHTML|multiFilter|rl|trim|end|json|first|checked|async|param|elems|insertBefore|childNodes|html|encodeURIComponent|createElement|append|form|Date|unbind|color|grep|setTimeout|readyList|mouseleave|mouseenter|block|isXMLDoc|addEventListener|timers|is|password|last|runtimeStyle|getTime|xml|jQuery|domManip|ajax|src|callee|getElementsByTagName|selectedIndex|load|object|timerId|toString|has|easing|curAnim|offsetChild|args|position|stopPropagation|custom|props|orig|mozilla|accepts|clean|responseText|defaultView|visible|String|charCode|float|teardown|on|setup|nodeIndex|shift|javascript|currentStyle|application|child|RegExp|_|parseInt|previousSibling|dir|tr|state|empty|update|getAttribute|self|pos|setRequestHeader|input|jsonp|lastModified|_default|unload|ajaxSettings|unshift|getComputedStyle|styleSheets|getPropertyValue|lastToggle|mouseout|mouseover|GET|andSelf|relatedTarget|init|visibility|click|absolute|index|container|fix|outline|Number|removeAttribute|setInterval|prevObject|classFilter|not|unique|submit|file|after|windowData|deep|scroll|client|triggered|globalEval|jquery|sibling|swing|clone|results|wrapAll|triggerHandler|lastChild|dequeue|getResponseHeader|createTextNode|oldblock|checkbox|radio|handleError|fromElement|parsererror|old|00|Modified|startTime|ifModified|safari2|getWH|offsetTop|offsetLeft|active|values|getElementById|version|offset|bindReady|processData|val|contentType|ajaxSuccess|ajaxComplete|ajaxStart|serializeArray|notmodified|loaded|DOMContentLoaded|Width|ctrlKey|keyCode|clientTop|POST|clientLeft|clientX|pageX|exclusive|detachEvent|removeEventListener|swap|cloneNode|join|attachEvent|eval|ajaxStop|substr|head|parse|textarea|reset|image|zoom|odd|ajaxSend|even|before|username|prepend|expr|quickClass|uuid|quickID|quickChild|continue|textContent|appendTo|contents|evalScript|parent|defaultValue|ajaxError|setArray|compatMode|getBoundingClientRect|styleFloat|clearInterval|httpNotModified|nodeValue|100|alpha|_toggle|href|speed|throw|304|replaceWith|200|Last|colgroup|httpData|httpSuccess|beforeSend|eq|linear|concat|splice|fieldset|multiple|cssFloat|XMLHttpRequest|webkit|ActiveXObject|CSS1Compat|link|metaKey|scriptCharset|callback|col|pixelLeft|urlencoded|www|post|hasClass|getJSON|getScript|elements|serialize|black|keyup|keypress|solid|change|mousemove|mouseup|dblclick|resize|focus|blur|stylesheet|rel|doScroll|round|hover|padding|offsetHeight|mousedown|offsetWidth|Bottom|Top|keydown|clientY|Right|pageY|Left|toElement|srcElement|cancelBubble|returnValue|charAt|0n|substring|animated|header|noConflict|line|enabled|innerText|contains|only|weight|ajaxSetup|font|size|gt|lt|uFFFF|u0128|417|Boolean|inner|Height|toggleClass|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|contentWindow|contentDocument|wrap|iframe|children|siblings|prevAll|nextAll|prev|wrapInner|next|parents|maxLength|maxlength|readOnly|readonly|reverse|class|htmlFor|inline|able|boxModel|522|setData|compatible|with|1px|ie|getData|10000|ra|it|rv|PI|cos|userAgent|400|navigator|600|slow|Function|Object|array|stop|ig|NaN|fadeTo|option|fadeOut|fadeIn|setAttribute|slideToggle|slideUp|changed|slideDown|be|can|property|responseXML|content|1223|getAttributeNode|300|method|protocol|location|action|send|abort|cssText|th|td|cap|specified|Accept|With|colg|Requested|fast|tfoot|GMT|thead|1970|Jan|attributes|01|Thu|leg|Since|If|opt|Type|Content|embed|open|area|XMLHTTP|hr|Microsoft|onreadystatechange|onload|meta|adobeair|charset|http|1_|img|br|plain|borderLeftWidth|borderTopWidth|abbr'.split('|'),0,{}));jQuery.noConflict();
\ No newline at end of file
+eval(function(p,a,c,k,e,r){e=function(c){return(c&lt;a?'':e(parseInt(c/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(H(){J w=1c.4I,3n$=1c.$;J D=1c.4I=1c.$=H(a,b){I 2r D.18.5i(a,b)};J u=/^[^&lt;]*(&lt;(.|\\s)+&gt;)[^&gt;]*$|^#(\\w+)$/,61=/^.[^:#\\[\\.]*$/,12;D.18=D.3V={5i:H(d,b){d=d||S;G(d.15){7[0]=d;7.K=1;I 7}G(1j d==&quot;1W&quot;){J c=u.2D(d);G(c&amp;&amp;(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.60(c[3]);G(a){G(a.2t!=c[3])I D().2u(d);I D(a)}d=[]}}N I D(b).2u(d)}N G(D.1F(d))I D(S)[D.18.25?&quot;25&quot;:&quot;3Y&quot;](d);I 7.6V(D.2h(d))},5w:&quot;1.2.6&quot;,8H:H(){I 7.K},K:0,3p:H(a){I a==12?D.2h(7):7[a]},2F:H(b){J a=D(b);a.5n=7;I a},6V:H(a){7.K=0;2q.3V.1A.1t(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5h:H(b){J a=-1;I D.2E(b&amp;&amp;b.5w?b[0]:b,7)},1M:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&amp;&amp;D[b||&quot;1M&quot;](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1k d)D.1M(b?7.V:7,c,D.1e(7,d[c],b,i,c))})},1h:H(b,a){G((b==\'2d\'||b==\'1T\')&amp;&amp;3e(a)&lt;0)a=12;I 7.1M(b,a,&quot;24&quot;)},1r:H(b){G(1j b!=&quot;3y&quot;&amp;&amp;b!=U)I 7.4F().3s((7[0]&amp;&amp;7[0].2z||S).5J(b));J a=&quot;&quot;;D.P(b||7,H(){D.P(7.3u,H(){G(7.15!=8)a+=7.15!=1?7.73:D.18.1r([7])})});I a},5W:H(b){G(7[0])D(b,7[0].2z).5y().38(7[0]).2i(H(){J a=7;1G(a.1s)a=a.1s;I a}).3s(7);I 7},8Z:H(a){I 7.P(H(){D(7).6P().5W(a)})},8S:H(a){I 7.P(H(){D(7).5W(a)})},3s:H(){I 7.3S(1a,M,Q,H(a){G(7.15==1)7.49(a)})},6E:H(){I 7.3S(1a,M,M,H(a){G(7.15==1)7.38(a,7.1s)})},6D:H(){I 7.3S(1a,Q,Q,H(a){7.1f.38(a,7)})},5p:H(){I 7.3S(1a,Q,M,H(a){7.1f.38(a,7.2J)})},3m:H(){I 7.5n||D([])},2u:H(b){J c=D.2i(7,H(a){I D.2u(b,a)});I 7.2F(/[^+&gt;] [^+&gt;]/.11(b)||b.1i(&quot;..&quot;)&gt;-1?D.4u(c):c)},5y:H(e){J f=7.2i(H(){G(D.14.1g&amp;&amp;!D.4o(7)){J a=7.6n(M),5f=S.3t(&quot;1w&quot;);5f.49(a);I D.4h([5f.4l])[0]}N I 7.6n(M)});J d=f.2u(&quot;*&quot;).5M().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2u(&quot;*&quot;).5M().P(H(i){G(7.15==3)I;J c=D.L(7,&quot;3x&quot;);R(J a 1k c)R(J b 1k c[a])D.W.17(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2F(D.1F(b)&amp;&amp;D.3G(7,H(a,i){I b.1l(a,i)})||D.3f(b,7))},4W:H(b){G(b.1q==56)G(61.11(b))I 7.2F(D.3f(b,7,M));N b=D.3f(b,7);J a=b.K&amp;&amp;b[b.K-1]!==12&amp;&amp;!b.15;I 7.1E(H(){I a?D.2E(7,b)&lt;0:7!=b})},17:H(a){I 7.2F(D.4u(D.39(7.3p(),1j a==\'1W\'?D(a):D.2h(a))))},3C:H(a){I!!a&amp;&amp;D.3f(a,7).K&gt;0},7V:H(a){I 7.3C(&quot;.&quot;+a)},6a:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,&quot;2y&quot;)){J e=c.63,62=[],16=c.16,2Y=c.O==&quot;2y-2Y&quot;;G(e&lt;0)I U;R(J i=2Y?e:0,2e=2Y?e+1:16.K;i&lt;2e;i++){J d=16[i];G(d.3a){b=D.14.1g&amp;&amp;!d.au.2s.aq?d.1r:d.2s;G(2Y)I b;62.1A(b)}}I 62}N I(7[0].2s||&quot;&quot;).1o(/\\r/g,&quot;&quot;)}I 12}G(b.1q==4N)b+=\'\';I 7.P(H(){G(7.15!=1)I;G(b.1q==2q&amp;&amp;/5R|5A/.11(7.O))7.4M=(D.2E(7.2s,b)&gt;=0||D.2E(7.32,b)&gt;=0);N G(D.Y(7,&quot;2y&quot;)){J a=D.2h(b);D(&quot;9U&quot;,7).P(H(){7.3a=(D.2E(7.2s,a)&gt;=0||D.2E(7.1r,a)&gt;=0)});G(!a.K)7.63=-1}N 7.2s=b})},2I:H(a){I a==12?(7[0]?7[0].4l:U):7.4F().3s(a)},7b:H(a){I 7.5p(a).1Z()},77:H(i){I 7.3w(i,i+1)},3w:H(){I 7.2F(2q.3V.3w.1t(7,1a))},2i:H(b){I 7.2F(D.2i(7,H(a,i){I b.1l(a,i,a)}))},5M:H(){I 7.17(7.5n)},L:H(d,b){J a=d.1Q(&quot;.&quot;);a[1]=a[1]?&quot;.&quot;+a[1]:&quot;&quot;;G(b===12){J c=7.5G(&quot;9B&quot;+a[1]+&quot;!&quot;,[a[0]]);G(c===12&amp;&amp;7.K)c=D.L(7[0],d);I c===12&amp;&amp;a[1]?7.L(a[0]):c}N I 7.1R(&quot;9v&quot;+a[1]+&quot;!&quot;,[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3S:H(g,f,h,d){J e=7.K&gt;1,3z;I 7.P(H(){G(!3z){3z=D.4h(g,7.2z);G(h)3z.9o()}J b=7;G(f&amp;&amp;D.Y(7,&quot;1X&quot;)&amp;&amp;D.Y(3z[0],&quot;4H&quot;))b=7.40(&quot;22&quot;)[0]||7.49(7.2z.3t(&quot;22&quot;));J c=D([]);D.P(3z,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,&quot;1m&quot;))c=c.17(a);N{G(a.15==1)c=c.17(D(&quot;1m&quot;,a).1Z());d.1l(b,a)}});c.P(6R)})}};D.18.5i.3V=D.18;H 6R(i,a){G(a.4e)D.3T({1b:a.4e,31:Q,1L:&quot;1m&quot;});N D.5u(a.1r||a.6N||a.4l||&quot;&quot;);G(a.1f)a.1f.30(a)}H 1x(){I+2r 8K}D.1n=D.18.1n=H(){J b=1a[0]||{},i=1,K=1a.K,4B=Q,16;G(b.1q==8I){4B=b;b=1a[1]||{};i=2}G(1j b!=&quot;3y&quot;&amp;&amp;1j b!=&quot;H&quot;)b={};G(K==i){b=7;--i}R(;i&lt;K;i++)G((16=1a[i])!=U)R(J c 1k 16){J a=b[c],2x=16[c];G(b===2x)6L;G(4B&amp;&amp;2x&amp;&amp;1j 2x==&quot;3y&quot;&amp;&amp;!2x.15)b[c]=D.1n(4B,a||(2x.K!=U?[]:{}),2x);N G(2x!==12)b[c]=2x}I b};J E=&quot;4I&quot;+1x(),6K=0,5q={},6G=/z-?5h|8B-?8A|1y|6A|8w-?1T/i,3N=S.3N||{};D.1n({8u:H(a){1c.$=3n$;G(a)1c.4I=w;I D},1F:H(a){I!!a&amp;&amp;1j a!=&quot;1W&quot;&amp;&amp;!a.Y&amp;&amp;a.1q!=2q&amp;&amp;/^[\\s[]?H/.11(a+&quot;&quot;)},4o:H(a){I a.1B&amp;&amp;!a.1d||a.2g&amp;&amp;a.2z&amp;&amp;!a.2z.1d},5u:H(a){a=D.3l(a);G(a){J b=S.40(&quot;6v&quot;)[0]||S.1B,1m=S.3t(&quot;1m&quot;);1m.O=&quot;1r/4v&quot;;G(D.14.1g)1m.1r=a;N 1m.49(S.5J(a));b.38(1m,b.1s);b.30(1m)}},Y:H(b,a){I b.Y&amp;&amp;b.Y.2m()==a.2m()},1Y:{},L:H(c,d,b){c=c==1c?5q:c;J a=c[E];G(!a)a=c[E]=++6K;G(d&amp;&amp;!D.1Y[a])D.1Y[a]={};G(b!==12)D.1Y[a][d]=b;I d?D.1Y[a][d]:a},3b:H(c,b){c=c==1c?5q:c;J a=c[E];G(b){G(D.1Y[a]){3d D.1Y[a][b];b=&quot;&quot;;R(b 1k D.1Y[a])1V;G(!b)D.3b(c)}}N{23{3d c[E]}21(e){G(c.5k)c.5k(E)}3d D.1Y[a]}},P:H(d,a,c){J e,i=0,K=d.K;G(c){G(K==12){R(e 1k d)G(a.1t(d[e],c)===Q)1V}N R(;i&lt;K;)G(a.1t(d[i++],c)===Q)1V}N{G(K==12){R(e 1k d)G(a.1l(d[e],e,d[e])===Q)1V}N R(J b=d[0];i&lt;K&amp;&amp;a.1l(b,i,b)!==Q;b=d[++i]){}}I d},1e:H(b,a,c,i,d){G(D.1F(a))a=a.1l(b,i);I a&amp;&amp;a.1q==4N&amp;&amp;c==&quot;24&quot;&amp;&amp;!6G.11(d)?a+&quot;2U&quot;:a},1D:{17:H(c,b){D.P((b||&quot;&quot;).1Q(/\\s+/),H(i,a){G(c.15==1&amp;&amp;!D.1D.3Q(c.1D,a))c.1D+=(c.1D?&quot; &quot;:&quot;&quot;)+a})},1Z:H(c,b){G(c.15==1)c.1D=b!=12?D.3G(c.1D.1Q(/\\s+/),H(a){I!D.1D.3Q(b,a)}).6r(&quot; &quot;):&quot;&quot;},3Q:H(b,a){I D.2E(a,(b.1D||b).6p().1Q(/\\s+/))&gt;-1}},6o:H(b,c,a){J e={};R(J d 1k c){e[d]=b.V[d];b.V[d]=c[d]}a.1l(b);R(J d 1k c)b.V[d]=e[d]},1h:H(d,e,c){G(e==&quot;2d&quot;||e==&quot;1T&quot;){J b,2L={3c:&quot;5g&quot;,5D:&quot;1C&quot;,19:&quot;3H&quot;},2S=e==&quot;2d&quot;?[&quot;5d&quot;,&quot;6i&quot;]:[&quot;5b&quot;,&quot;6g&quot;];H 5a(){b=e==&quot;2d&quot;?d.8g:d.8f;J a=0,2A=0;D.P(2S,H(){a+=3e(D.24(d,&quot;55&quot;+7,M))||0;2A+=3e(D.24(d,&quot;2A&quot;+7+&quot;47&quot;,M))||0});b-=26.85(a+2A)}G(D(d).3C(&quot;:4i&quot;))5a();N D.6o(d,2L,5a);I 26.2e(0,b)}I D.24(d,e,c)},24:H(f,l,k){J e,V=f.V;H 4d(b){G(!D.14.2f)I Q;J a=3N.53(b,U);I!a||a.52(&quot;4d&quot;)==&quot;&quot;}G(l==&quot;1y&quot;&amp;&amp;D.14.1g){e=D.1M(V,&quot;1y&quot;);I e==&quot;&quot;?&quot;1&quot;:e}G(D.14.2H&amp;&amp;l==&quot;19&quot;){J d=V.50;V.50=&quot;0 7Z 7Y&quot;;V.50=d}G(l.1I(/4g/i))l=y;G(!k&amp;&amp;V&amp;&amp;V[l])e=V[l];N G(3N.53){G(l.1I(/4g/i))l=&quot;4g&quot;;l=l.1o(/([A-Z])/g,&quot;-$1&quot;).3h();J c=3N.53(f,U);G(c&amp;&amp;!4d(f))e=c.52(l);N{J g=[],2G=[],a=f,i=0;R(;a&amp;&amp;4d(a);a=a.1f)2G.6b(a);R(;i&lt;2G.K;i++)G(4d(2G[i])){g[i]=2G[i].V.19;2G[i].V.19=&quot;3H&quot;}e=l==&quot;19&quot;&amp;&amp;g[2G.K-1]!=U?&quot;2P&quot;:(c&amp;&amp;c.52(l))||&quot;&quot;;R(i=0;i&lt;g.K;i++)G(g[i]!=U)2G[i].V.19=g[i]}G(l==&quot;1y&quot;&amp;&amp;e==&quot;&quot;)e=&quot;1&quot;}N G(f.4f){J h=l.1o(/\\-(\\w)/g,H(a,b){I b.2m()});e=f.4f[l]||f.4f[h];G(!/^\\d+(2U)?$/i.11(e)&amp;&amp;/^\\d/.11(e)){J j=V.1z,65=f.64.1z;f.64.1z=f.4f.1z;V.1z=e||0;e=V.aO+&quot;2U&quot;;V.1z=j;f.64.1z=65}}I e},4h:H(l,h){J k=[];h=h||S;G(1j h.3t==\'12\')h=h.2z||h[0]&amp;&amp;h[0].2z||S;D.P(l,H(i,d){G(!d)I;G(d.1q==4N)d+=\'\';G(1j d==&quot;1W&quot;){d=d.1o(/(&lt;(\\w+)[^&gt;]*?)\\/&gt;/g,H(b,a,c){I c.1I(/^(aN|43|7E|aH|4t|7z|aE|3A|aB|aA|az)$/i)?b:a+&quot;&gt;&lt;/&quot;+c+&quot;&gt;&quot;});J f=D.3l(d).3h(),1w=h.3t(&quot;1w&quot;);J e=!f.1i(&quot;&lt;av&quot;)&amp;&amp;[1,&quot;&lt;2y 7u=\'7u\'&gt;&quot;,&quot;&lt;/2y&gt;&quot;]||!f.1i(&quot;&lt;at&quot;)&amp;&amp;[1,&quot;&lt;7t&gt;&quot;,&quot;&lt;/7t&gt;&quot;]||f.1I(/^&lt;(ar|22|ap|al|aj)/)&amp;&amp;[1,&quot;&lt;1X&gt;&quot;,&quot;&lt;/1X&gt;&quot;]||!f.1i(&quot;&lt;4H&quot;)&amp;&amp;[2,&quot;&lt;1X&gt;&lt;22&gt;&quot;,&quot;&lt;/22&gt;&lt;/1X&gt;&quot;]||(!f.1i(&quot;&lt;ah&quot;)||!f.1i(&quot;&lt;ae&quot;))&amp;&amp;[3,&quot;&lt;1X&gt;&lt;22&gt;&lt;4H&gt;&quot;,&quot;&lt;/4H&gt;&lt;/22&gt;&lt;/1X&gt;&quot;]||!f.1i(&quot;&lt;7E&quot;)&amp;&amp;[2,&quot;&lt;1X&gt;&lt;22&gt;&lt;/22&gt;&lt;7p&gt;&quot;,&quot;&lt;/7p&gt;&lt;/1X&gt;&quot;]||D.14.1g&amp;&amp;[1,&quot;1w&lt;1w&gt;&quot;,&quot;&lt;/1w&gt;&quot;]||[0,&quot;&quot;,&quot;&quot;];1w.4l=e[1]+d+e[2];1G(e[0]--)1w=1w.5U;G(D.14.1g){J g=!f.1i(&quot;&lt;1X&quot;)&amp;&amp;f.1i(&quot;&lt;22&quot;)&lt;0?1w.1s&amp;&amp;1w.1s.3u:e[1]==&quot;&lt;1X&gt;&quot;&amp;&amp;f.1i(&quot;&lt;22&quot;)&lt;0?1w.3u:[];R(J j=g.K-1;j&gt;=0;--j)G(D.Y(g[j],&quot;22&quot;)&amp;&amp;!g[j].3u.K)g[j].1f.30(g[j]);G(/^\\s/.11(d))1w.38(h.5J(d.1I(/^\\s*/)[0]),1w.1s)}d=D.2h(1w.3u)}G(d.K===0&amp;&amp;(!D.Y(d,&quot;45&quot;)&amp;&amp;!D.Y(d,&quot;2y&quot;)))I;G(d[0]==12||D.Y(d,&quot;45&quot;)||d.16)k.1A(d);N k=D.39(k,d)});I k},1M:H(d,f,c){G(!d||d.15==3||d.15==8)I 12;J e=!D.4o(d),3W=c!==12,1g=D.14.1g;f=e&amp;&amp;D.2L[f]||f;G(d.2g){J g=/5x|4e|V/.11(f);G(f==&quot;3a&quot;&amp;&amp;D.14.2f)d.1f.63;G(f 1k d&amp;&amp;e&amp;&amp;!g){G(3W){G(f==&quot;O&quot;&amp;&amp;D.Y(d,&quot;4t&quot;)&amp;&amp;d.1f)7m&quot;O a5 a2\'t 9Z 9W&quot;;d[f]=c}G(D.Y(d,&quot;45&quot;)&amp;&amp;d.7i(f))I d.7i(f).73;I d[f]}G(1g&amp;&amp;e&amp;&amp;f==&quot;V&quot;)I D.1M(d.V,&quot;9V&quot;,c);G(3W)d.9T(f,&quot;&quot;+c);J h=1g&amp;&amp;e&amp;&amp;g?d.4K(f,2):d.4K(f);I h===U?12:h}G(1g&amp;&amp;f==&quot;1y&quot;){G(3W){d.6A=1;d.1E=(d.1E||&quot;&quot;).1o(/7d\\([^)]*\\)/,&quot;&quot;)+(3v(c)+\'\'==&quot;9P&quot;?&quot;&quot;:&quot;7d(1y=&quot;+c*79+&quot;)&quot;)}I d.1E&amp;&amp;d.1E.1i(&quot;1y=&quot;)&gt;=0?(3e(d.1E.1I(/1y=([^)]*)/)[1])/79)+\'\':&quot;&quot;}f=f.1o(/-([a-z])/9M,H(a,b){I b.2m()});G(3W)d[f]=c;I d[f]},3l:H(a){I(a||&quot;&quot;).1o(/^\\s+|\\s+$/g,&quot;&quot;)},2h:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1Q||b.4L||b.1l)a[0]=b;N 1G(i)a[--i]=b[i]}I a},2E:H(b,a){R(J i=0,K=a.K;i&lt;K;i++)G(a[i]===b)I i;I-1},39:H(a,b){J i=0,T,36=a.K;G(D.14.1g){1G(T=b[i++])G(T.15!=8)a[36++]=T}N 1G(T=b[i++])a[36++]=T;I a},4u:H(a){J c=[],2w={};23{R(J i=0,K=a.K;i&lt;K;i++){J b=D.L(a[i]);G(!2w[b]){2w[b]=M;c.1A(a[i])}}}21(e){c=a}I c},3G:H(c,a,d){J b=[];R(J i=0,K=c.K;i&lt;K;i++)G(!d!=!a(c[i],i))b.1A(c[i]);I b},2i:H(d,a){J c=[];R(J i=0,K=d.K;i&lt;K;i++){J b=a(d[i],i);G(b!=U)c[c.K]=b}I c.75.1t([],c)}});J v=9E.9C.3h();D.14={5F:(v.1I(/.+(?:9A|9z|9y|9w)[\\/: ]([\\d.]+)/)||[])[1],2f:/72/.11(v),2H:/2H/.11(v),1g:/1g/.11(v)&amp;&amp;!/2H/.11(v),3r:/3r/.11(v)&amp;&amp;!/(9s|72)/.11(v)};J y=D.14.1g?&quot;70&quot;:&quot;6Z&quot;;D.1n({6Y:!D.14.1g||S.6X==&quot;6W&quot;,2L:{&quot;R&quot;:&quot;9n&quot;,&quot;9m&quot;:&quot;1D&quot;,&quot;4g&quot;:y,6Z:y,70:y,9j:&quot;9h&quot;,9g:&quot;9e&quot;,9d:&quot;9b&quot;,9a:&quot;99&quot;}});D.P({6S:H(a){I a.1f},96:H(a){I D.4T(a,&quot;1f&quot;)},93:H(a){I D.2V(a,2,&quot;2J&quot;)},90:H(a){I D.2V(a,2,&quot;4D&quot;)},8Y:H(a){I D.4T(a,&quot;2J&quot;)},8X:H(a){I D.4T(a,&quot;4D&quot;)},8W:H(a){I D.5v(a.1f.1s,a)},8V:H(a){I D.5v(a.1s)},6P:H(a){I D.Y(a,&quot;8U&quot;)?a.8T||a.8R.S:D.2h(a.3u)}},H(c,d){D.18[c]=H(b){J a=D.2i(7,d);G(b&amp;&amp;1j b==&quot;1W&quot;)a=D.3f(b,a);I 7.2F(D.4u(a))}});D.P({6O:&quot;3s&quot;,8Q:&quot;6E&quot;,38:&quot;6D&quot;,8P:&quot;5p&quot;,8O:&quot;7b&quot;},H(c,b){D.18[c]=H(){J a=1a;I 7.P(H(){R(J i=0,K=a.K;i&lt;K;i++)D(a[i])[b](7)})}});D.P({8N:H(a){D.1M(7,a,&quot;&quot;);G(7.15==1)7.5k(a)},8M:H(a){D.1D.17(7,a)},8L:H(a){D.1D.1Z(7,a)},8J:H(a){D.1D[D.1D.3Q(7,a)?&quot;1Z&quot;:&quot;17&quot;](7,a)},1Z:H(a){G(!a||D.1E(a,[7]).r.K){D(&quot;*&quot;,7).17(7).P(H(){D.W.1Z(7);D.3b(7)});G(7.1f)7.1f.30(7)}},4F:H(){D(&quot;&gt;*&quot;,7).1Z();1G(7.1s)7.30(7.1s)}},H(a,b){D.18[a]=H(){I 7.P(b,1a)}});D.P([&quot;6M&quot;,&quot;47&quot;],H(i,c){J b=c.3h();D.18[b]=H(a){I 7[0]==1c?D.14.2H&amp;&amp;S.1d[&quot;5t&quot;+c]||D.14.2f&amp;&amp;1c[&quot;5s&quot;+c]||S.6X==&quot;6W&quot;&amp;&amp;S.1B[&quot;5t&quot;+c]||S.1d[&quot;5t&quot;+c]:7[0]==S?26.2e(26.2e(S.1d[&quot;4A&quot;+c],S.1B[&quot;4A&quot;+c]),26.2e(S.1d[&quot;2k&quot;+c],S.1B[&quot;2k&quot;+c])):a==12?(7.K?D.1h(7[0],b):U):7.1h(b,a.1q==56?a:a+&quot;2U&quot;)}});H 2a(a,b){I a[0]&amp;&amp;3v(D.24(a[0],b,M),10)||0}J C=D.14.2f&amp;&amp;3v(D.14.5F)&lt;8G?&quot;(?:[\\\\w*3n-]|\\\\\\\\.)&quot;:&quot;(?:[\\\\w\\8F-\\8E*3n-]|\\\\\\\\.)&quot;,6J=2r 4y(&quot;^&gt;\\\\s*(&quot;+C+&quot;+)&quot;),6I=2r 4y(&quot;^(&quot;+C+&quot;+)(#)(&quot;+C+&quot;+)&quot;),6H=2r 4y(&quot;^([#.]?)(&quot;+C+&quot;*)&quot;);D.1n({6F:{&quot;&quot;:H(a,i,m){I m[2]==&quot;*&quot;||D.Y(a,m[2])},&quot;#&quot;:H(a,i,m){I a.4K(&quot;2t&quot;)==m[2]},&quot;:&quot;:{8D:H(a,i,m){I i&lt;m[3]-0},8C:H(a,i,m){I i&gt;m[3]-0},2V:H(a,i,m){I m[3]-0==i},77:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3P:H(a,i,m,r){I i==r.K-1},6C:H(a,i){I i%2==0},6B:H(a,i){I i%2},&quot;3o-4w&quot;:H(a){I a.1f.40(&quot;*&quot;)[0]==a},&quot;3P-4w&quot;:H(a){I D.2V(a.1f.5U,1,&quot;4D&quot;)==a},&quot;8z-4w&quot;:H(a){I!D.2V(a.1f.5U,2,&quot;4D&quot;)},6S:H(a){I a.1s},4F:H(a){I!a.1s},8y:H(a,i,m){I(a.6N||a.8x||D(a).1r()||&quot;&quot;).1i(m[3])&gt;=0},4i:H(a){I&quot;1C&quot;!=a.O&amp;&amp;D.1h(a,&quot;19&quot;)!=&quot;2P&quot;&amp;&amp;D.1h(a,&quot;5D&quot;)!=&quot;1C&quot;},1C:H(a){I&quot;1C&quot;==a.O||D.1h(a,&quot;19&quot;)==&quot;2P&quot;||D.1h(a,&quot;5D&quot;)==&quot;1C&quot;},8v:H(a){I!a.3O},3O:H(a){I a.3O},4M:H(a){I a.4M},3a:H(a){I a.3a||D.1M(a,&quot;3a&quot;)},1r:H(a){I&quot;1r&quot;==a.O},5R:H(a){I&quot;5R&quot;==a.O},5A:H(a){I&quot;5A&quot;==a.O},5o:H(a){I&quot;5o&quot;==a.O},3K:H(a){I&quot;3K&quot;==a.O},5m:H(a){I&quot;5m&quot;==a.O},6z:H(a){I&quot;6z&quot;==a.O},6y:H(a){I&quot;6y&quot;==a.O},2p:H(a){I&quot;2p&quot;==a.O||D.Y(a,&quot;2p&quot;)},4t:H(a){I/4t|2y|6x|2p/i.11(a.Y)},3Q:H(a,i,m){I D.2u(m[3],a).K},8t:H(a){I/h\\d/i.11(a.Y)},8s:H(a){I D.3G(D.3M,H(b){I a==b.T}).K}}},6w:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?&quot;?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\(&quot;?\'?(.*?(\\(.*?\\))?[^(]*?)&quot;?\'?\\)/,2r 4y(&quot;^([:.#]*)(&quot;+C+&quot;+)&quot;)],3f:H(a,c,b){J d,1u=[];1G(a&amp;&amp;a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\s*,\\s*/,&quot;&quot;);1u=b?c=f.r:D.39(1u,f.r)}I 1u},2u:H(t,o){G(1j t!=&quot;1W&quot;)I[t];G(o&amp;&amp;o.15!=1&amp;&amp;o.15!=9)I[];o=o||S;J d=[o],2w=[],3P,Y;1G(t&amp;&amp;3P!=t){J r=[];3P=t;t=D.3l(t);J l=Q,3k=6J,m=3k.2D(t);G(m){Y=m[1].2m();R(J i=0;d[i];i++)R(J c=d[i].1s;c;c=c.2J)G(c.15==1&amp;&amp;(Y==&quot;*&quot;||c.Y.2m()==Y))r.1A(c);d=r;t=t.1o(3k,&quot;&quot;);G(t.1i(&quot; &quot;)==0)6L;l=M}N{3k=/^([&gt;+~])\\s*(\\w*)/i;G((m=3k.2D(t))!=U){r=[];J k={};Y=m[2].2m();m=m[1];R(J j=0,3j=d.K;j&lt;3j;j++){J n=m==&quot;~&quot;||m==&quot;+&quot;?d[j].2J:d[j].1s;R(;n;n=n.2J)G(n.15==1){J g=D.L(n);G(m==&quot;~&quot;&amp;&amp;k[g])1V;G(!Y||n.Y.2m()==Y){G(m==&quot;~&quot;)k[g]=M;r.1A(n)}G(m==&quot;+&quot;)1V}}d=r;t=D.3l(t.1o(3k,&quot;&quot;));l=M}}G(t&amp;&amp;!l){G(!t.1i(&quot;,&quot;)){G(o==d[0])d.4s();2w=D.39(2w,d);r=d=[o];t=&quot; &quot;+t.6t(1,t.K)}N{J h=6I;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6H;m=h.2D(t)}m[2]=m[2].1o(/\\\\/g,&quot;&quot;);J f=d[d.K-1];G(m[1]==&quot;#&quot;&amp;&amp;f&amp;&amp;f.60&amp;&amp;!D.4o(f)){J p=f.60(m[2]);G((D.14.1g||D.14.2H)&amp;&amp;p&amp;&amp;1j p.2t==&quot;1W&quot;&amp;&amp;p.2t!=m[2])p=D(\'[@2t=&quot;\'+m[2]+\'&quot;]\',f)[0];d=r=p&amp;&amp;(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]==&quot;#&quot;&amp;&amp;m[3]?m[3]:m[1]!=&quot;&quot;||m[0]==&quot;&quot;?&quot;*&quot;:m[2];G(a==&quot;*&quot;&amp;&amp;d[i].Y.3h()==&quot;3y&quot;)a=&quot;3A&quot;;r=D.39(r,d[i].40(a))}G(m[1]==&quot;.&quot;)r=D.5l(r,m[2]);G(m[1]==&quot;#&quot;){J e=[];R(J i=0;r[i];i++)G(r[i].4K(&quot;2t&quot;)==m[2]){e=[r[i]];1V}r=e}d=r}t=t.1o(h,&quot;&quot;)}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3l(b.t)}}G(t)d=[];G(d&amp;&amp;o==d[0])d.4s();2w=D.39(2w,d);I 2w},5l:H(r,m,a){m=&quot; &quot;+m+&quot; &quot;;J c=[];R(J i=0;r[i];i++){J b=(&quot; &quot;+r[i].1D+&quot; &quot;).1i(m)&gt;=0;G(!a&amp;&amp;b||a&amp;&amp;!b)c.1A(r[i])}I c},1E:H(t,r,h){J d;1G(t&amp;&amp;t!=d){d=t;J p=D.6w,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\/g,&quot;&quot;);1V}}G(!m)1V;G(m[1]==&quot;:&quot;&amp;&amp;m[2]==&quot;4W&quot;)r=61.11(m[3])?D.1E(m[3],r,M).r:D(r).4W(m[3]);N G(m[1]==&quot;.&quot;)r=D.5l(r,m[2],h);N G(m[1]==&quot;[&quot;){J g=[],O=m[3];R(J i=0,3j=r.K;i&lt;3j;i++){J a=r[i],z=a[D.2L[m[2]]||m[2]];G(z==U||/5x|4e|3a/.11(m[2]))z=D.1M(a,m[2])||\'\';G((O==&quot;&quot;&amp;&amp;!!z||O==&quot;=&quot;&amp;&amp;z==m[5]||O==&quot;!=&quot;&amp;&amp;z!=m[5]||O==&quot;^=&quot;&amp;&amp;z&amp;&amp;!z.1i(m[5])||O==&quot;$=&quot;&amp;&amp;z.6t(z.K-m[5].K)==m[5]||(O==&quot;*=&quot;||O==&quot;~=&quot;)&amp;&amp;z.1i(m[5])&gt;=0)^h)g.1A(a)}r=g}N G(m[1]==&quot;:&quot;&amp;&amp;m[2]==&quot;2V-4w&quot;){J e={},g=[],11=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2D(m[3]==&quot;6C&quot;&amp;&amp;&quot;2n&quot;||m[3]==&quot;6B&quot;&amp;&amp;&quot;2n+1&quot;||!/\\D/.11(m[3])&amp;&amp;&quot;8q+&quot;+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3j=r.K;i&lt;3j;i++){J j=r[i],1f=j.1f,2t=D.L(1f);G(!e[2t]){J c=1;R(J n=1f.1s;n;n=n.2J)G(n.15==1)n.4r=c++;e[2t]=M}J b=Q;G(3o==0){G(j.4r==d)b=M}N G((j.4r-d)%3o==0&amp;&amp;(j.4r-d)/3o&gt;=0)b=M;G(b^h)g.1A(j)}r=g}N{J f=D.6F[m[1]];G(1j f==&quot;3y&quot;)f=f[m[2]];G(1j f==&quot;1W&quot;)f=6s(&quot;Q||H(a,i){I &quot;+f+&quot;;}&quot;);r=D.3G(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4T:H(b,c){J a=[],1u=b[c];1G(1u&amp;&amp;1u!=S){G(1u.15==1)a.1A(1u);1u=1u[c]}I a},2V:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.15==1&amp;&amp;++d==e)1V;I a},5v:H(n,a){J r=[];R(;n;n=n.2J){G(n.15==1&amp;&amp;n!=a)r.1A(n)}I r}});D.W={17:H(f,i,g,e){G(f.15==3||f.15==8)I;G(D.14.1g&amp;&amp;f.4L)f=1c;G(!g.29)g.29=7.29++;G(e!=12){J h=g;g=7.3J(h,H(){I h.1t(7,1a)});g.L=e}J j=D.L(f,&quot;3x&quot;)||D.L(f,&quot;3x&quot;,{}),1H=D.L(f,&quot;1H&quot;)||D.L(f,&quot;1H&quot;,H(){G(1j D!=&quot;12&quot;&amp;&amp;!D.W.5j)I D.W.1H.1t(1a.3I.T,1a)});1H.T=f;D.P(i.1Q(/\\s+/),H(c,b){J a=b.1Q(&quot;.&quot;);b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2C[b]||D.W.2C[b].4q.1l(f)===Q){G(f.4a)f.4a(b,1H,Q);N G(f.6q)f.6q(&quot;4p&quot;+b,1H)}}d[g.29]=g;D.W.28[b]=M});f=U},29:1,28:{},1Z:H(e,h,f){G(e.15==3||e.15==8)I;J i=D.L(e,&quot;3x&quot;),1K,5h;G(i){G(h==12||(1j h==&quot;1W&quot;&amp;&amp;h.8p(0)==&quot;.&quot;))R(J g 1k i)7.1Z(e,g+(h||&quot;&quot;));N{G(h.O){f=h.2o;h=h.O}D.P(h.1Q(/\\s+/),H(b,a){J c=a.1Q(&quot;.&quot;);a=c[0];G(i[a]){G(f)3d i[a][f.29];N R(f 1k i[a])G(!c[1]||i[a][f].O==c[1])3d i[a][f];R(1K 1k i[a])1V;G(!1K){G(!D.W.2C[a]||D.W.2C[a].4G.1l(e)===Q){G(e.6m)e.6m(a,D.L(e,&quot;1H&quot;),Q);N G(e.6l)e.6l(&quot;4p&quot;+a,D.L(e,&quot;1H&quot;))}1K=U;3d i[a]}}})}R(1K 1k i)1V;G(!1K){J d=D.L(e,&quot;1H&quot;);G(d)d.T=U;D.3b(e,&quot;3x&quot;);D.3b(e,&quot;1H&quot;)}}},1R:H(h,c,f,g,i){c=D.2h(c);G(h.1i(&quot;!&quot;)&gt;=0){h=h.3w(0,-1);J a=M}G(!f){G(7.28[h])D(&quot;*&quot;).17([1c,S]).1R(h,c)}N{G(f.15==3||f.15==8)I 12;J b,1K,18=D.1F(f[h]||U),W=!c[0]||!c[0].37;G(W){c.6b({O:h,2N:f,37:H(){},3X:H(){},4J:1x()});c[0][E]=M}c[0].O=h;G(a)c[0].6k=M;J d=D.L(f,&quot;1H&quot;);G(d)b=d.1t(f,c);G((!18||(D.Y(f,\'a\')&amp;&amp;h==&quot;4n&quot;))&amp;&amp;f[&quot;4p&quot;+h]&amp;&amp;f[&quot;4p&quot;+h].1t(f,c)===Q)b=Q;G(W)c.4s();G(i&amp;&amp;D.1F(i)){1K=i.1t(f,b==U?c:c.75(b));G(1K!==12)b=1K}G(18&amp;&amp;g!==Q&amp;&amp;b!==Q&amp;&amp;!(D.Y(f,\'a\')&amp;&amp;h==&quot;4n&quot;)){7.5j=M;23{f[h]()}21(e){}}7.5j=Q}I b},1H:H(b){J a,1K,2T,5e,4m;b=1a[0]=D.W.6j(b||1c.W);2T=b.O.1Q(&quot;.&quot;);b.O=2T[0];2T=2T[1];5e=!2T&amp;&amp;!b.6k;4m=(D.L(7,&quot;3x&quot;)||{})[b.O];R(J j 1k 4m){J c=4m[j];G(5e||c.O==2T){b.2o=c;b.L=c.L;1K=c.1t(7,1a);G(a!==Q)a=1K;G(1K===Q){b.37();b.3X()}}}I a},2L:&quot;8o 8n 8m 8l 2p 8k 42 5c 6h 5I 8j L 8i 8h 4k 2o 59 58 8e 8c 57 6f 8b 8a 4j 88 87 86 6d 2N 4J 6c O 84 83 2S&quot;.1Q(&quot; &quot;),6j:H(b){G(b[E]==M)I b;J c=b;b={82:c};R(J i=7.2L.K,1e;i;){1e=7.2L[--i];b[1e]=c[1e]}b[E]=M;b.37=H(){G(c.37)c.37();c.81=Q};b.3X=H(){G(c.3X)c.3X();c.80=M};b.4J=b.4J||1x();G(!b.2N)b.2N=b.6d||S;G(b.2N.15==3)b.2N=b.2N.1f;G(!b.4j&amp;&amp;b.4k)b.4j=b.4k==b.2N?b.6c:b.4k;G(b.57==U&amp;&amp;b.5c!=U){J a=S.1B,1d=S.1d;b.57=b.5c+(a&amp;&amp;a.2c||1d&amp;&amp;1d.2c||0)-(a.69||0);b.6f=b.6h+(a&amp;&amp;a.2l||1d&amp;&amp;1d.2l||0)-(a.68||0)}G(!b.2S&amp;&amp;((b.42||b.42===0)?b.42:b.59))b.2S=b.42||b.59;G(!b.58&amp;&amp;b.5I)b.58=b.5I;G(!b.2S&amp;&amp;b.2p)b.2S=(b.2p&amp;1?1:(b.2p&amp;2?3:(b.2p&amp;4?2:0)));I b},3J:H(a,b){b.29=a.29=a.29||b.29||7.29++;I b},2C:{25:{4q:H(){54();I},4G:H(){I}},4c:{4q:H(){G(D.14.1g)I Q;D(7).2O(&quot;51&quot;,D.W.2C.4c.2o);I M},4G:H(){G(D.14.1g)I Q;D(7).3L(&quot;51&quot;,D.W.2C.4c.2o);I M},2o:H(a){G(F(a,7))I M;a.O=&quot;4c&quot;;I D.W.1H.1t(7,1a)}},3F:{4q:H(){G(D.14.1g)I Q;D(7).2O(&quot;4Z&quot;,D.W.2C.3F.2o);I M},4G:H(){G(D.14.1g)I Q;D(7).3L(&quot;4Z&quot;,D.W.2C.3F.2o);I M},2o:H(a){G(F(a,7))I M;a.O=&quot;3F&quot;;I D.W.1H.1t(7,1a)}}}};D.18.1n({2O:H(c,a,b){I c==&quot;4Y&quot;?7.2Y(c,a,b):7.P(H(){D.W.17(7,c,b||a,b&amp;&amp;a)})},2Y:H(d,b,c){J e=D.W.3J(c||b,H(a){D(7).3L(a,e);I(c||b).1t(7,1a)});I 7.P(H(){D.W.17(7,d,e,c&amp;&amp;b)})},3L:H(a,b){I 7.P(H(){D.W.1Z(7,a,b)})},1R:H(c,a,b){I 7.P(H(){D.W.1R(c,a,7,M,b)})},5G:H(c,a,b){I 7[0]&amp;&amp;D.W.1R(c,a,7[0],Q,b)},2B:H(b){J c=1a,i=1;1G(i&lt;c.K)D.W.3J(b,c[i++]);I 7.4n(D.W.3J(b,H(a){7.4X=(7.4X||0)%i;a.37();I c[7.4X++].1t(7,1a)||Q}))},7X:H(a,b){I 7.2O(\'4c\',a).2O(\'3F\',b)},25:H(a){54();G(D.2Q)a.1l(S,D);N D.3D.1A(H(){I a.1l(7,D)});I 7}});D.1n({2Q:Q,3D:[],25:H(){G(!D.2Q){D.2Q=M;G(D.3D){D.P(D.3D,H(){7.1l(S)});D.3D=U}D(S).5G(&quot;25&quot;)}}});J x=Q;H 54(){G(x)I;x=M;G(S.4a&amp;&amp;!D.14.2H)S.4a(&quot;67&quot;,D.25,Q);G(D.14.1g&amp;&amp;1c==1P)(H(){G(D.2Q)I;23{S.1B.7W(&quot;1z&quot;)}21(3g){3E(1a.3I,0);I}D.25()})();G(D.14.2H)S.4a(&quot;67&quot;,H(){G(D.2Q)I;R(J i=0;i&lt;S.4V.K;i++)G(S.4V[i].3O){3E(1a.3I,0);I}D.25()},Q);G(D.14.2f){J a;(H(){G(D.2Q)I;G(S.3i!=&quot;66&quot;&amp;&amp;S.3i!=&quot;1O&quot;){3E(1a.3I,0);I}G(a===12)a=D(&quot;V, 7z[7U=7T]&quot;).K;G(S.4V.K!=a){3E(1a.3I,0);I}D.25()})()}D.W.17(1c,&quot;3Y&quot;,D.25)}D.P((&quot;7S,7R,3Y,7Q,4A,4Y,4n,7P,&quot;+&quot;89,7O,7N,51,4Z,7M,2y,&quot;+&quot;5m,8d,7L,7K,3g&quot;).1Q(&quot;,&quot;),H(i,b){D.18[b]=H(a){I a?7.2O(b,a):7.1R(b)}});J F=H(a,c){J b=a.4j;1G(b&amp;&amp;b!=c)23{b=b.1f}21(3g){b=c}I b==c};D(1c).2O(&quot;4Y&quot;,H(){D(&quot;*&quot;).17(S).3L()});D.18.1n({6e:D.18.3Y,3Y:H(g,d,c){G(1j g!=\'1W\')I 7.6e(g);J e=g.1i(&quot; &quot;);G(e&gt;=0){J i=g.3w(e,g.K);g=g.3w(0,e)}c=c||H(){};J f=&quot;2R&quot;;G(d)G(D.1F(d)){c=d;d=U}N G(1j d==\'3y\'){d=D.3A(d);f=&quot;7J&quot;}J h=7;D.3T({1b:g,O:f,1L:&quot;2I&quot;,L:d,1O:H(a,b){G(b==&quot;1U&quot;||b==&quot;7I&quot;)h.2I(i?D(&quot;&lt;1w/&gt;&quot;).3s(a.4U.1o(/&lt;1m(.|\\s)*?\\/1m&gt;/g,&quot;&quot;)).2u(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3A(7.7H())},7H:H(){I 7.2i(H(){I D.Y(7,&quot;45&quot;)?D.2h(7.aK):7}).1E(H(){I 7.32&amp;&amp;!7.3O&amp;&amp;(7.4M||/2y|6x/i.11(7.Y)||/1r|1C|3K/i.11(7.O))}).2i(H(i,c){J b=D(7).6a();I b==U?U:b.1q==2q?D.2i(b,H(a,i){I{32:c.32,2s:a}}):{32:c.32,2s:b}}).3p()}});D.P(&quot;7G,7D,7C,7B,6u,7A&quot;.1Q(&quot;,&quot;),H(i,o){D.18[o]=H(f){I 7.2O(o,f)}});J B=1x();D.1n({3p:H(d,b,a,c){G(D.1F(b)){a=b;b=U}I D.3T({O:&quot;2R&quot;,1b:d,L:b,1U:a,1L:c})},aG:H(b,a){I D.3p(b,U,a,&quot;1m&quot;)},aF:H(c,b,a){I D.3p(c,b,a,&quot;3B&quot;)},aD:H(d,b,a,c){G(D.1F(b)){a=b;b={}}I D.3T({O:&quot;7J&quot;,1b:d,L:b,1U:a,1L:c})},aC:H(a){D.1n(D.5Z,a)},5Z:{1b:5Y.5x,28:M,O:&quot;2R&quot;,2W:0,7y:&quot;4x/x-ay-45-ax&quot;,7v:M,31:M,L:U,5r:U,3K:U,4z:{2K:&quot;4x/2K, 1r/2K&quot;,2I:&quot;1r/2I&quot;,1m:&quot;1r/4v, 4x/4v&quot;,3B:&quot;4x/3B, 1r/4v&quot;,1r:&quot;1r/as&quot;,4S:&quot;*/*&quot;}},4R:{},3T:H(s){s=D.1n(M,s,D.1n(M,{},D.5Z,s));J g,33=/=\\?(&amp;|$)/g,1v,L,O=s.O.2m();G(s.L&amp;&amp;s.7v&amp;&amp;1j s.L!=&quot;1W&quot;)s.L=D.3A(s.L);G(s.1L==&quot;4Q&quot;){G(O==&quot;2R&quot;){G(!s.1b.1I(33))s.1b+=(s.1b.1I(/\\?/)?&quot;&amp;&quot;:&quot;?&quot;)+(s.4Q||&quot;7s&quot;)+&quot;=?&quot;}N G(!s.L||!s.L.1I(33))s.L=(s.L?s.L+&quot;&amp;&quot;:&quot;&quot;)+(s.4Q||&quot;7s&quot;)+&quot;=?&quot;;s.1L=&quot;3B&quot;}G(s.1L==&quot;3B&quot;&amp;&amp;(s.L&amp;&amp;s.L.1I(33)||s.1b.1I(33))){g=&quot;4Q&quot;+B++;G(s.L)s.L=(s.L+&quot;&quot;).1o(33,&quot;=&quot;+g+&quot;$1&quot;);s.1b=s.1b.1o(33,&quot;=&quot;+g+&quot;$1&quot;);s.1L=&quot;1m&quot;;1c[g]=H(a){L=a;1U();1O();1c[g]=12;23{3d 1c[g]}21(e){}G(i)i.30(h)}}G(s.1L==&quot;1m&quot;&amp;&amp;s.1Y==U)s.1Y=Q;G(s.1Y===Q&amp;&amp;O==&quot;2R&quot;){J j=1x();J k=s.1b.1o(/(\\?|&amp;)3n=.*?(&amp;|$)/,&quot;$am=&quot;+j+&quot;$2&quot;);s.1b=k+((k==s.1b)?(s.1b.1I(/\\?/)?&quot;&amp;&quot;:&quot;?&quot;)+&quot;3n=&quot;+j:&quot;&quot;)}G(s.L&amp;&amp;O==&quot;2R&quot;){s.1b+=(s.1b.1I(/\\?/)?&quot;&amp;&quot;:&quot;?&quot;)+s.L;s.L=U}G(s.28&amp;&amp;!D.4P++)D.W.1R(&quot;7G&quot;);J n=/^(?:\\w+:)?\\/\\/([^\\/?#]+)/;G(s.1L==&quot;1m&quot;&amp;&amp;O==&quot;2R&quot;&amp;&amp;n.11(s.1b)&amp;&amp;n.2D(s.1b)[1]!=5Y.ak){J i=S.40(&quot;6v&quot;)[0];J h=S.3t(&quot;1m&quot;);h.4e=s.1b;G(s.7r)h.ai=s.7r;G(!g){J l=Q;h.ag=h.af=H(){G(!l&amp;&amp;(!7.3i||7.3i==&quot;66&quot;||7.3i==&quot;1O&quot;)){l=M;1U();1O();i.30(h)}}}i.49(h);I 12}J m=Q;J c=1c.7q?2r 7q(&quot;ad.ac&quot;):2r 6Q();G(s.5r)c.7o(O,s.1b,s.31,s.5r,s.3K);N c.7o(O,s.1b,s.31);23{G(s.L)c.4O(&quot;ab-aa&quot;,s.7y);G(s.5T)c.4O(&quot;a9-5S-a8&quot;,D.4R[s.1b]||&quot;a7, a6 a4 a3 5O:5O:5O a1&quot;);c.4O(&quot;X-a0-9Y&quot;,&quot;6Q&quot;);c.4O(&quot;9X&quot;,s.1L&amp;&amp;s.4z[s.1L]?s.4z[s.1L]+&quot;, */*&quot;:s.4z.4S)}21(e){}G(s.7k&amp;&amp;s.7k(c,s)===Q){s.28&amp;&amp;D.4P--;c.7j();I Q}G(s.28)D.W.1R(&quot;7A&quot;,[c,s]);J d=H(a){G(!m&amp;&amp;c&amp;&amp;(c.3i==4||a==&quot;2W&quot;)){m=M;G(f){7h(f);f=U}1v=a==&quot;2W&quot;?&quot;2W&quot;:!D.7g(c)?&quot;3g&quot;:s.5T&amp;&amp;D.7f(c,s.1b)?&quot;7I&quot;:&quot;1U&quot;;G(1v==&quot;1U&quot;){23{L=D.6U(c,s.1L,s.9S)}21(e){1v=&quot;5L&quot;}}G(1v==&quot;1U&quot;){J b;23{b=c.5K(&quot;7e-5S&quot;)}21(e){}G(s.5T&amp;&amp;b)D.4R[s.1b]=b;G(!g)1U()}N D.5E(s,c,1v);1O();G(s.31)c=U}};G(s.31){J f=4L(d,13);G(s.2W&gt;0)3E(H(){G(c){c.7j();G(!m)d(&quot;2W&quot;)}},s.2W)}23{c.9R(s.L)}21(e){D.5E(s,c,U,e)}G(!s.31)d();H 1U(){G(s.1U)s.1U(L,1v);G(s.28)D.W.1R(&quot;6u&quot;,[c,s])}H 1O(){G(s.1O)s.1O(c,1v);G(s.28)D.W.1R(&quot;7C&quot;,[c,s]);G(s.28&amp;&amp;!--D.4P)D.W.1R(&quot;7D&quot;)}I c},5E:H(s,a,b,e){G(s.3g)s.3g(a,b,e);G(s.28)D.W.1R(&quot;7B&quot;,[a,s,e])},4P:0,7g:H(a){23{I!a.1v&amp;&amp;5Y.9Q==&quot;5o:&quot;||(a.1v&gt;=7c&amp;&amp;a.1v&lt;9O)||a.1v==7a||a.1v==9N||D.14.2f&amp;&amp;a.1v==12}21(e){}I Q},7f:H(a,c){23{J b=a.5K(&quot;7e-5S&quot;);I a.1v==7a||b==D.4R[c]||D.14.2f&amp;&amp;a.1v==12}21(e){}I Q},6U:H(a,c,b){J d=a.5K(&quot;9L-O&quot;),2K=c==&quot;2K&quot;||!c&amp;&amp;d&amp;&amp;d.1i(&quot;2K&quot;)&gt;=0,L=2K?a.9K:a.4U;G(2K&amp;&amp;L.1B.2g==&quot;5L&quot;)7m&quot;5L&quot;;G(b)L=b(L,c);G(c==&quot;1m&quot;)D.5u(L);G(c==&quot;3B&quot;)L=6s(&quot;(&quot;+L+&quot;)&quot;);I L},3A:H(a){J s=[];H 17(b,a){s[s.K]=78(b)+\'=\'+78(a)};G(a.1q==2q||a.5w)D.P(a,H(){17(7.32,7.2s)});N R(J j 1k a)G(a[j]&amp;&amp;a[j].1q==2q)D.P(a[j],H(){17(j,7)});N 17(j,D.1F(a[j])?a[j]():a[j]);I s.6r(&quot;&amp;&quot;).1o(/%20/g,&quot;+&quot;)}});D.18.1n({1N:H(c,b){I c?7.2j({1T:&quot;1N&quot;,2d:&quot;1N&quot;,1y:&quot;1N&quot;},c,b):7.1E(&quot;:1C&quot;).P(H(){7.V.19=7.5H||&quot;&quot;;G(D.1h(7,&quot;19&quot;)==&quot;2P&quot;){J a=D(&quot;&lt;&quot;+7.2g+&quot; /&gt;&quot;).6O(&quot;1d&quot;);7.V.19=a.1h(&quot;19&quot;);G(7.V.19==&quot;2P&quot;)7.V.19=&quot;3H&quot;;a.1Z()}}).3m()},1J:H(b,a){I b?7.2j({1T:&quot;1J&quot;,2d:&quot;1J&quot;,1y:&quot;1J&quot;},b,a):7.1E(&quot;:4i&quot;).P(H(){7.5H=7.5H||D.1h(7,&quot;19&quot;);7.V.19=&quot;2P&quot;}).3m()},76:D.18.2B,2B:H(a,b){I D.1F(a)&amp;&amp;D.1F(b)?7.76.1t(7,1a):a?7.2j({1T:&quot;2B&quot;,2d:&quot;2B&quot;,1y:&quot;2B&quot;},a,b):7.P(H(){D(7)[D(7).3C(&quot;:1C&quot;)?&quot;1N&quot;:&quot;1J&quot;]()})},9J:H(b,a){I 7.2j({1T:&quot;1N&quot;},b,a)},9I:H(b,a){I 7.2j({1T:&quot;1J&quot;},b,a)},9H:H(b,a){I 7.2j({1T:&quot;2B&quot;},b,a)},9G:H(b,a){I 7.2j({1y:&quot;1N&quot;},b,a)},9F:H(b,a){I 7.2j({1y:&quot;1J&quot;},b,a)},9D:H(c,a,b){I 7.2j({1y:a},c,b)},2j:H(k,j,i,g){J h=D.74(j,i,g);I 7[h.35===Q?&quot;P&quot;:&quot;35&quot;](H(){G(7.15!=1)I Q;J f=D.1n({},h),p,1C=D(7).3C(&quot;:1C&quot;),41=7;R(p 1k k){G(k[p]==&quot;1J&quot;&amp;&amp;1C||k[p]==&quot;1N&quot;&amp;&amp;!1C)I f.1O.1l(7);G(p==&quot;1T&quot;||p==&quot;2d&quot;){f.19=D.1h(7,&quot;19&quot;);f.34=7.V.34}}G(f.34!=U)7.V.34=&quot;1C&quot;;f.44=D.1n({},k);D.P(k,H(c,a){J e=2r D.27(41,f,c);G(/2B|1N|1J/.11(a))e[a==&quot;2B&quot;?1C?&quot;1N&quot;:&quot;1J&quot;:a](k);N{J b=a.6p().1I(/^([+-]=)?([\\d+-.]+)(.*)$/),2b=e.1u(M)||0;G(b){J d=3e(b[2]),2M=b[3]||&quot;2U&quot;;G(2M!=&quot;2U&quot;){41.V[c]=(d||1)+2M;2b=((d||1)/e.1u(M))*2b;41.V[c]=2b+2M}G(b[1])d=((b[1]==&quot;-=&quot;?-1:1)*d)+2b;e.3Z(2b,d,2M)}N e.3Z(2b,a,&quot;&quot;)}});I M})},35:H(a,b){G(D.1F(a)||(a&amp;&amp;a.1q==2q)){b=a;a=&quot;27&quot;}G(!a||(1j a==&quot;1W&quot;&amp;&amp;!b))I A(7[0],a);I 7.P(H(){G(b.1q==2q)A(7,a,b);N{A(7,a).1A(b);G(A(7,a).K==1)b.1l(7)}})},9x:H(b,c){J a=D.3M;G(b)7.35([]);7.P(H(){R(J i=a.K-1;i&gt;=0;i--)G(a[i].T==7){G(c)a[i](M);a.7l(i,1)}});G(!c)7.5C();I 7}});J A=H(b,c,a){G(b){c=c||&quot;27&quot;;J q=D.L(b,c+&quot;35&quot;);G(!q||a)q=D.L(b,c+&quot;35&quot;,D.2h(a))}I q};D.18.5C=H(a){a=a||&quot;27&quot;;I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1l(7)})};D.1n({74:H(b,a,c){J d=b&amp;&amp;b.1q==9u?b:{1O:c||!c&amp;&amp;a||D.1F(b)&amp;&amp;b,2v:b,3U:c&amp;&amp;a||a&amp;&amp;a.1q!=9t&amp;&amp;a};d.2v=(d.2v&amp;&amp;d.2v.1q==4N?d.2v:D.27.5N[d.2v])||D.27.5N.71;d.5P=d.1O;d.1O=H(){G(d.35!==Q)D(7).5C();G(D.1F(d.5P))d.5P.1l(7)};I d},3U:{7n:H(p,n,b,a){I b+a*p},5Q:H(p,n,b,a){I((-26.9r(p*26.9q)/2)+0.5)*a+b}},3M:[],46:U,27:H(b,c,a){7.16=c;7.T=b;7.1e=a;G(!c.3R)c.3R={}}});D.27.3V={4E:H(){G(7.16.2Z)7.16.2Z.1l(7.T,7.1x,7);(D.27.2Z[7.1e]||D.27.2Z.4S)(7);G(7.1e==&quot;1T&quot;||7.1e==&quot;2d&quot;)7.T.V.19=&quot;3H&quot;},1u:H(a){G(7.T[7.1e]!=U&amp;&amp;7.T.V[7.1e]==U)I 7.T[7.1e];J r=3e(D.1h(7.T,7.1e,a));I r&amp;&amp;r&gt;-9p?r:3e(D.24(7.T,7.1e))||0},3Z:H(c,b,d){7.5B=1x();7.2b=c;7.3m=b;7.2M=d||7.2M||&quot;2U&quot;;7.1x=7.2b;7.36=7.4C=0;7.4E();J e=7;H t(a){I e.2Z(a)}t.T=7.T;D.3M.1A(t);G(D.46==U){D.46=4L(H(){J a=D.3M;R(J i=0;i&lt;a.K;i++)G(!a[i]())a.7l(i--,1);G(!a.K){7h(D.46);D.46=U}},13)}},1N:H(){7.16.3R[7.1e]=D.1M(7.T.V,7.1e);7.16.1N=M;7.3Z(0,7.1u());G(7.1e==&quot;2d&quot;||7.1e==&quot;1T&quot;)7.T.V[7.1e]=&quot;9l&quot;;D(7.T).1N()},1J:H(){7.16.3R[7.1e]=D.1M(7.T.V,7.1e);7.16.1J=M;7.3Z(7.1u(),0)},2Z:H(a){J t=1x();G(a||t&gt;7.16.2v+7.5B){7.1x=7.3m;7.36=7.4C=1;7.4E();7.16.44[7.1e]=M;J b=M;R(J i 1k 7.16.44)G(7.16.44[i]!==M)b=Q;G(b){G(7.16.19!=U){7.T.V.34=7.16.34;7.T.V.19=7.16.19;G(D.1h(7.T,&quot;19&quot;)==&quot;2P&quot;)7.T.V.19=&quot;3H&quot;}G(7.16.1J)7.T.V.19=&quot;2P&quot;;G(7.16.1J||7.16.1N)R(J p 1k 7.16.44)D.1M(7.T.V,p,7.16.3R[p])}G(b)7.16.1O.1l(7.T);I Q}N{J n=t-7.5B;7.4C=n/7.16.2v;7.36=D.3U[7.16.3U||(D.3U.5Q?&quot;5Q&quot;:&quot;7n&quot;)](7.4C,n,0,1,7.16.2v);7.1x=7.2b+((7.3m-7.2b)*7.36);7.4E()}I M}};D.1n(D.27,{5N:{9k:9i,an:7c,71:ao},2Z:{2c:H(a){a.T.2c=a.1x},2l:H(a){a.T.2l=a.1x},1y:H(a){D.1M(a.T.V,&quot;1y&quot;,a.1x)},4S:H(a){a.T.V[a.1e]=a.1x+a.2M}}});D.18.2k=H(){J b=0,1P=0,T=7[0],3q;G(T)9f(D.14){J d=T.1f,48=T,1p=T.1p,1S=T.2z,5V=2f&amp;&amp;3v(5F)&lt;9c&amp;&amp;!/aw/i.11(v),1h=D.24,2X=1h(T,&quot;3c&quot;)==&quot;2X&quot;;G(!(3r&amp;&amp;T==S.1d)&amp;&amp;T.6T){J c=T.6T();17(c.1z+26.2e(1S.1B.2c,1S.1d.2c),c.1P+26.2e(1S.1B.2l,1S.1d.2l));17(-1S.1B.69,-1S.1B.68)}N{17(T.5X,T.5z);1G(1p){17(1p.5X,1p.5z);G(3r&amp;&amp;!/^t(98|d|h)$/i.11(1p.2g)||2f&amp;&amp;!5V)2A(1p);G(!2X&amp;&amp;1h(1p,&quot;3c&quot;)==&quot;2X&quot;)2X=M;48=/^1d$/i.11(1p.2g)?48:1p;1p=1p.1p}1G(d&amp;&amp;d.2g&amp;&amp;!/^1d|2I$/i.11(d.2g)){G(!/^97|1X.*$/i.11(1h(d,&quot;19&quot;)))17(-d.2c,-d.2l);G(3r&amp;&amp;1h(d,&quot;34&quot;)!=&quot;4i&quot;)2A(d);d=d.1f}G((5V&amp;&amp;(2X||1h(48,&quot;3c&quot;)==&quot;5g&quot;))||(3r&amp;&amp;1h(48,&quot;3c&quot;)!=&quot;5g&quot;))17(-1S.1d.5X,-1S.1d.5z);G(2X)17(26.2e(1S.1B.2c,1S.1d.2c),26.2e(1S.1B.2l,1S.1d.2l))}3q={1P:1P,1z:b}}H 2A(a){17(D.24(a,&quot;7w&quot;,M),D.24(a,&quot;7x&quot;,M))}H 17(l,t){b+=3v(l,10)||0;1P+=3v(t,10)||0}I 3q};D.18.1n({3c:H(){J a=0,1P=0,3q;G(7[0]){J b=7.1p(),2k=7.2k(),4b=/^1d|2I$/i.11(b[0].2g)?{1P:0,1z:0}:b.2k();2k.1P-=2a(7,\'95\');2k.1z-=2a(7,\'94\');4b.1P+=2a(b,\'7x\');4b.1z+=2a(b,\'7w\');3q={1P:2k.1P-4b.1P,1z:2k.1z-4b.1z}}I 3q},1p:H(){J a=7[0].1p;1G(a&amp;&amp;(!/^1d|2I$/i.11(a.2g)&amp;&amp;D.1h(a,\'3c\')==\'aI\'))a=a.1p;I D(a)}});D.P([\'5d\',\'5b\'],H(i,b){J c=\'4A\'+b;D.18[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1c||7==S?1c.aJ(!i?a:D(1c).2c(),i?a:D(1c).2l()):7[c]=a}):7[0]==1c||7[0]==S?41[i?\'92\':\'91\']||D.6Y&amp;&amp;S.1B[c]||S.1d[c]:7[0][c]}});D.P([&quot;6M&quot;,&quot;47&quot;],H(i,b){J c=i?&quot;5d&quot;:&quot;5b&quot;,43=i?&quot;6i&quot;:&quot;6g&quot;;D.18[&quot;5s&quot;+b]=H(){I 7[b.3h()]()+2a(7,&quot;55&quot;+c)+2a(7,&quot;55&quot;+43)};D.18[&quot;aM&quot;+b]=H(a){I 7[&quot;5s&quot;+b]()+2a(7,&quot;2A&quot;+c+&quot;47&quot;)+2a(7,&quot;2A&quot;+43+&quot;47&quot;)+(a?2a(7,&quot;7F&quot;+c)+2a(7,&quot;7F&quot;+43):0)}})})();',62,671,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|nodeType|options|add|fn|display|arguments|url|window|body|prop|parentNode|msie|css|indexOf|typeof|in|call|script|extend|replace|offsetParent|constructor|text|firstChild|apply|cur|status|div|now|opacity|left|push|documentElement|hidden|className|filter|isFunction|while|handle|match|hide|ret|dataType|attr|show|complete|top|split|trigger|doc|height|success|break|string|table|cache|remove||catch|tbody|try|curCSS|ready|Math|fx|global|guid|num|start|scrollLeft|width|max|safari|tagName|makeArray|map|animate|offset|scrollTop|toUpperCase||handler|button|Array|new|value|id|find|duration|done|copy|select|ownerDocument|border|toggle|special|exec|inArray|pushStack|stack|opera|html|nextSibling|xml|props|unit|target|bind|none|isReady|GET|which|namespace|px|nth|timeout|fixed|one|step|removeChild|async|name|jsre|overflow|queue|pos|preventDefault|insertBefore|merge|selected|removeData|position|delete|parseFloat|multiFilter|error|toLowerCase|readyState|rl|re|trim|end|_|first|get|results|mozilla|append|createElement|childNodes|parseInt|slice|events|object|elems|param|json|is|readyList|setTimeout|mouseleave|grep|block|callee|proxy|password|unbind|timers|defaultView|disabled|last|has|orig|domManip|ajax|easing|prototype|set|stopPropagation|load|custom|getElementsByTagName|self|charCode|br|curAnim|form|timerId|Width|offsetChild|appendChild|addEventListener|parentOffset|mouseenter|color|src|currentStyle|float|clean|visible|relatedTarget|fromElement|innerHTML|handlers|click|isXMLDoc|on|setup|nodeIndex|shift|input|unique|javascript|child|application|RegExp|accepts|scroll|deep|state|previousSibling|update|empty|teardown|tr|jQuery|timeStamp|getAttribute|setInterval|checked|Number|setRequestHeader|active|jsonp|lastModified|_default|dir|responseText|styleSheets|not|lastToggle|unload|mouseout|outline|mouseover|getPropertyValue|getComputedStyle|bindReady|padding|String|pageX|metaKey|keyCode|getWH|Top|clientX|Left|all|container|absolute|index|init|triggered|removeAttribute|classFilter|submit|prevObject|file|after|windowData|username|inner|client|globalEval|sibling|jquery|href|clone|offsetTop|checkbox|startTime|dequeue|visibility|handleError|version|triggerHandler|oldblock|ctrlKey|createTextNode|getResponseHeader|parsererror|andSelf|speeds|00|old|swing|radio|Modified|ifModified|lastChild|safari2|wrapAll|offsetLeft|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|loaded|DOMContentLoaded|clientTop|clientLeft|val|unshift|toElement|srcElement|_load|pageY|Bottom|clientY|Right|fix|exclusive|detachEvent|removeEventListener|cloneNode|swap|toString|attachEvent|join|eval|substr|ajaxSuccess|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|expr|exclude|quickClass|quickID|quickChild|uuid|continue|Height|textContent|appendTo|contents|XMLHttpRequest|evalScript|parent|getBoundingClientRect|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|styleFloat|def|webkit|nodeValue|speed|concat|_toggle|eq|encodeURIComponent|100|304|replaceWith|200|alpha|Last|httpNotModified|httpSuccess|clearInterval|getAttributeNode|abort|beforeSend|splice|throw|linear|open|colgroup|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|borderLeftWidth|borderTopWidth|contentType|link|ajaxSend|ajaxError|ajaxComplete|ajaxStop|col|margin|ajaxStart|serializeArray|notmodified|POST|keyup|keypress|change|mousemove|mouseup|dblclick|resize|focus|blur|stylesheet|rel|hasClass|doScroll|hover|black|solid|cancelBubble|returnValue|originalEvent|wheelDelta|view|round|shiftKey|screenY|screenX|mousedown|relatedNode|prevValue|originalTarget|keydown|newValue|offsetHeight|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|charAt|0n|substring|animated|header|noConflict|enabled|line|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|417|size|Boolean|toggleClass|Date|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|contentWindow|wrap|contentDocument|iframe|children|siblings|prevAll|nextAll|wrapInner|prev|pageXOffset|pageYOffset|next|marginLeft|marginTop|parents|inline|able|rowSpan|rowspan|cellSpacing|522|cellspacing|maxLength|with|maxlength|readOnly|600|readonly|slow|1px|class|htmlFor|reverse|10000|PI|cos|compatible|Function|Object|setData|ie|stop|ra|it|rv|getData|userAgent|fadeTo|navigator|fadeOut|fadeIn|slideToggle|slideUp|slideDown|responseXML|content|ig|1223|300|NaN|protocol|send|dataFilter|setAttribute|option|cssText|changed|Accept|With|be|Requested|GMT|can|1970|Jan|property|01|Thu|Since|If|Type|Content|XMLHTTP|Microsoft|th|onreadystatechange|onload|td|charset|cap|host|colg|1_|fast|400|tfoot|specified|thead|plain|leg|attributes|opt|adobeair|urlencoded|www|embed|area|hr|ajaxSetup|post|meta|getJSON|getScript|img|static|scrollTo|elements|serialize|outer|abbr|pixelLeft'.split('|'),0,{}));jQuery.noConflict();</diff>
      <filename>wp-includes/js/jquery/jquery.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,7 @@
 /*
- *	jquery.suggest 1.1 - 2007-08-06
+ *	jquery.suggest 1.1b - 2007-08-06
+ * Patched by Mark Jaquith with Alexander Dick's &quot;multiple items&quot; patch to allow for auto-suggesting of more than one tag before submitting
+ * See: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/#comment-7228
  *	
  *	Uses code and techniques from following libraries:
  *	1. http://www.dyve.net/jquery/?autocomplete
@@ -113,6 +115,12 @@
 		
 			var q = $.trim($input.val());
 
+			if ( options.multiple ) {
+				var multipleSepPos = q.lastIndexOf(options.multipleSep);
+				if ( multipleSepPos != -1 ) {
+					q = q.substr(multipleSepPos + options.multipleSep.length);
+				}
+			}
 			if (q.length &gt;= options.minchars) {
 				
 				cached = checkCache(q);
@@ -245,7 +253,17 @@
 			$currentResult = getCurrentResult();
 		
 			if ($currentResult) {
-				$input.val($currentResult.text());
+				if ( options.multiple ) {
+					if ( $input.val().indexOf(options.multipleSep) != -1 ) {
+						$currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) );
+					} else {
+						$currentVal = &quot;&quot;;
+					}
+					$input.val( $currentVal + $currentResult.text() + options.multipleSep);
+					$input.focus();
+				} else {
+					$input.val($currentResult.text());
+				}
 				$results.hide();
 				
 				if (options.onSelect)
@@ -291,6 +309,8 @@
 			return;
 	
 		options = options || {};
+		options.multiple = options.multiple || false;
+		options.multipleSep = options.multipleSep || &quot;, &quot;;
 		options.source = source;
 		options.delay = options.delay || 100;
 		options.resultsClass = options.resultsClass || 'ac_results';</diff>
      <filename>wp-includes/js/jquery/suggest.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,529 +1,2 @@
-/*
- * Tabs 3 - New Wave Tabs
- *
- * Copyright (c) 2007 Klaus Hartl (stilbuero.de)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- */
+eval(function(p,a,c,k,e,d){e=function(c){return(c&lt;a?'':e(parseInt(c/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4(A){A.39(&quot;8.3&quot;,{38:4(){2.c.v+=&quot;.3&quot;;2.1e(1c)},37:4(B,C){5((/^7/).1Z(B)){2.16(C)}n{2.c[B]=C;2.1e()}},i:4(){f 2.$3.i},1E:4(B){f B.24&amp;&amp;B.24.13(/\\s/g,&quot;23&quot;).13(/[^A-36-35-9\\-23:\\.]/g,&quot;&quot;)||2.c.1Q+A.e(B)},8:4(C,B){f{c:2.c,34:C,1M:B}},1e:4(O){2.$h=A(&quot;1i:33(a[o])&quot;,2.l);2.$3=2.$h.1s(4(){f A(&quot;a&quot;,2)[0]});2.$b=A([]);6 P=2,D=2.c;2.$3.V(4(R,Q){5(Q.u&amp;&amp;Q.u.13(&quot;#&quot;,&quot;&quot;)){P.$b=P.$b.1b(Q.u)}n{5(A(Q).12(&quot;o&quot;)!=&quot;#&quot;){A.e(Q,&quot;o.3&quot;,Q.o);A.e(Q,&quot;q.3&quot;,Q.o);6 T=P.1E(Q);Q.o=&quot;#&quot;+T;6 S=A(&quot;#&quot;+T);5(!S.i){S=A(D.1x).12(&quot;1f&quot;,T).m(D.18).32(P.$b[R-1]||P.l);S.e(&quot;1a.3&quot;,1c)}P.$b=P.$b.1b(S)}n{D.d.1U(R+1)}}});5(O){2.l.m(D.1w);2.$b.V(4(){6 Q=A(2);Q.m(D.18)});5(D.7===1p){5(1J.u){2.$3.V(4(S,Q){5(Q.u==1J.u){D.7=S;5(A.W.1g||A.W.31){6 R=A(1J.u),T=R.12(&quot;1f&quot;);R.12(&quot;1f&quot;,&quot;&quot;);1z(4(){R.12(&quot;1f&quot;,T)},30)}2Z(0,0);f p}})}n{5(D.Y){6 J=2Y(A.Y(&quot;8-3&quot;+A.e(P.l)),10);5(J&amp;&amp;P.$3[J]){D.7=J}}n{5(P.$h.z(&quot;.&quot;+D.k).i){D.7=P.$h.Z(P.$h.z(&quot;.&quot;+D.k)[0])}}}}D.7=D.7===j||D.7!==1p?D.7:0;D.d=A.2X(D.d.2W(A.1s(2.$h.z(&quot;.&quot;+D.U),4(R,Q){f P.$h.Z(R)}))).1T();5(A.1r(D.7,D.d)!=-1){D.d.2V(A.1r(D.7,D.d),1)}2.$b.m(D.w);2.$h.r(D.k);5(D.7!==j){2.$b.t(D.7).1G().r(D.w);2.$h.t(D.7).m(D.k);6 K=4(){A(P.l).y(&quot;20&quot;,[j,P.8(P.$3[D.7],P.$b[D.7])],D.1G)};5(A.e(2.$3[D.7],&quot;q.3&quot;)){2.q(D.7,K)}n{K()}}A(2U).15(&quot;2T&quot;,4(){P.$3.14(&quot;.3&quot;);P.$h=P.$3=P.$b=j})}2S(6 G=0,N;N=2.$h[G];G++){A(N)[A.1r(G,D.d)!=-1&amp;&amp;!A(N).11(D.k)?&quot;m&quot;:&quot;r&quot;](D.U)}5(D.x===p){2.$3.1m(&quot;x.3&quot;)}6 C,I,B={&quot;2R-2Q&quot;:0,1I:1},E=&quot;2P&quot;;5(D.X&amp;&amp;D.X.2O==2N){C=D.X[0]||B,I=D.X[1]||B}n{C=I=D.X||B}6 H={1q:&quot;&quot;,2M:&quot;&quot;,2L:&quot;&quot;};5(!A.W.1g){H.1H=&quot;&quot;}4 M(R,Q,S){Q.22(C,C.1I||E,4(){Q.m(D.w).1d(H);5(A.W.1g&amp;&amp;C.1H){Q[0].21.z=&quot;&quot;}5(S){L(R,S,Q)}})}4 L(R,S,Q){5(I===B){S.1d(&quot;1q&quot;,&quot;1D&quot;)}S.22(I,I.1I||E,4(){S.r(D.w).1d(H);5(A.W.1g&amp;&amp;I.1H){S[0].21.z=&quot;&quot;}A(P.l).y(&quot;20&quot;,[j,P.8(R,S[0])],D.1G)})}4 F(R,T,Q,S){T.m(D.k).2K().r(D.k);M(R,Q,S)}2.$3.14(&quot;.3&quot;).15(D.v,4(){6 T=A(2).2J(&quot;1i:t(0)&quot;),Q=P.$b.z(&quot;:2I&quot;),S=A(2.u);5((T.11(D.k)&amp;&amp;!D.1h)||T.11(D.U)||A(2).11(D.17)||A(P.l).y(&quot;2H&quot;,[j,P.8(2,S[0])],D.16)===p){2.1t();f p}P.c.7=P.$3.Z(2);5(D.1h){5(T.11(D.k)){P.c.7=j;T.r(D.k);P.$b.1F();M(2,Q);2.1t();f p}n{5(!Q.i){P.$b.1F();6 R=2;P.q(P.$3.Z(2),4(){T.m(D.k).m(D.1v);L(R,S)});2.1t();f p}}}5(D.Y){A.Y(&quot;8-3&quot;+A.e(P.l),P.c.7,D.Y)}P.$b.1F();5(S.i){6 R=2;P.q(P.$3.Z(2),Q.i?4(){F(R,T,Q,S)}:4(){T.m(D.k);L(R,S)})}n{2G&quot;1K 2F 2E: 2D 2C 2B.&quot;}5(A.W.1g){2.1t()}f p});5(!(/^1y/).1Z(D.v)){2.$3.15(&quot;1y.3&quot;,4(){f p})}},1b:4(E,D,C){5(C==1p){C=2.$3.i}6 G=2.c;6 I=A(G.1P.13(/#\\{o\\}/g,E).13(/#\\{1j\\}/g,D));I.e(&quot;1a.3&quot;,1c);6 H=E.2A(&quot;#&quot;)==0?E.13(&quot;#&quot;,&quot;&quot;):2.1E(A(&quot;a:2z-2y&quot;,I)[0]);6 F=A(&quot;#&quot;+H);5(!F.i){F=A(G.1x).12(&quot;1f&quot;,H).m(G.w).e(&quot;1a.3&quot;,1c)}F.m(G.18);5(C&gt;=2.$h.i){I.1Y(2.l);F.1Y(2.l[0].2x)}n{I.1X(2.$h[C]);F.1X(2.$b[C])}G.d=A.1s(G.d,4(K,J){f K&gt;=C?++K:K});2.1e();5(2.$3.i==1){I.m(G.k);F.r(G.w);6 B=A.e(2.$3[0],&quot;q.3&quot;);5(B){2.q(C,B)}}2.l.y(&quot;2w&quot;,[j,2.8(2.$3[C],2.$b[C])],G.1b)},19:4(B){6 D=2.c,E=2.$h.t(B).19(),C=2.$b.t(B).19();5(E.11(D.k)&amp;&amp;2.$3.i&gt;1){2.16(B+(B+1&lt;2.$3.i?1:-1))}D.d=A.1s(A.1W(D.d,4(G,F){f G!=B}),4(G,F){f G&gt;=B?--G:G});2.1e();2.l.y(&quot;2v&quot;,[j,2.8(E.1C(&quot;a&quot;)[0],C[0])],D.19)},1V:4(B){6 C=2.c;5(A.1r(B,C.d)==-1){f}6 D=2.$h.t(B).r(C.U);5(A.W.2u){D.1d(&quot;1q&quot;,&quot;2t-1D&quot;);1z(4(){D.1d(&quot;1q&quot;,&quot;1D&quot;)},0)}C.d=A.1W(C.d,4(F,E){f F!=B});2.l.y(&quot;2s&quot;,[j,2.8(2.$3[B],2.$b[B])],C.1V)},1S:4(C){6 B=2,D=2.c;5(C!=D.7){2.$h.t(C).m(D.U);D.d.1U(C);D.d.1T();2.l.y(&quot;2r&quot;,[j,2.8(2.$3[C],2.$b[C])],D.1S)}},16:4(B){5(2q B==&quot;2p&quot;){B=2.$3.Z(2.$3.z(&quot;[o$=&quot;+B+&quot;]&quot;)[0])}2.$3.t(B).2o(2.c.v)},q:4(G,K){6 L=2,D=2.c,E=2.$3.t(G),J=E[0],H=K==1p||K===p,B=E.e(&quot;q.3&quot;);K=K||4(){};5(!B||!H&amp;&amp;A.e(J,&quot;x.3&quot;)){K();f}6 M=4(N){6 O=A(N),P=O.1C(&quot;*:2n&quot;);f P.i&amp;&amp;P||O};6 C=4(){L.$3.z(&quot;.&quot;+D.17).r(D.17).V(4(){5(D.1l){M(2).2m().1o(M(2).e(&quot;1j.3&quot;))}});L.1n=j};5(D.1l){6 I=M(J).1o();M(J).2l(&quot;&lt;1B&gt;&lt;/1B&gt;&quot;).1C(&quot;1B&quot;).e(&quot;1j.3&quot;,I).1o(D.1l)}6 F=A.1L({},D.1k,{1R:B,1A:4(O,N){A(J.u).1o(O);C();5(D.x){A.e(J,&quot;x.3&quot;,1c)}A(L.l).y(&quot;2k&quot;,[j,L.8(L.$3[G],L.$b[G])],D.q);D.1k.1A&amp;&amp;D.1k.1A(O,N);K()}});5(2.1n){2.1n.2j();C()}E.m(D.17);1z(4(){L.1n=A.2i(F)},0)},1R:4(C,B){2.$3.t(C).1m(&quot;x.3&quot;).e(&quot;q.3&quot;,B)},1a:4(){6 B=2.c;2.l.14(&quot;.3&quot;).r(B.1w).1m(&quot;3&quot;);2.$3.V(4(){6 C=A.e(2,&quot;o.3&quot;);5(C){2.o=C}6 D=A(2).14(&quot;.3&quot;);A.V([&quot;o&quot;,&quot;q&quot;,&quot;x&quot;],4(E,F){D.1m(F+&quot;.3&quot;)})});2.$h.1b(2.$b).V(4(){5(A.e(2,&quot;1a.3&quot;)){A(2).19()}n{A(2).r([B.k,B.1v,B.U,B.18,B.w].2h(&quot; &quot;))}})}});A.8.3.2g={1h:p,v:&quot;1y&quot;,d:[],Y:j,1l:&quot;2f&amp;#2e;&quot;,x:p,1Q:&quot;8-3-&quot;,1k:{},X:j,1P:\'&lt;1i&gt;&lt;a o=&quot;#{o}&quot;&gt;&lt;1O&gt;#{1j}&lt;/1O&gt;&lt;/a&gt;&lt;/1i&gt;\',1x:&quot;&lt;1N&gt;&lt;/1N&gt;&quot;,1w:&quot;8-3-2d&quot;,k:&quot;8-3-7&quot;,1v:&quot;8-3-1h&quot;,U:&quot;8-3-d&quot;,18:&quot;8-3-1M&quot;,w:&quot;8-3-2c&quot;,17:&quot;8-3-2b&quot;};A.8.3.2a=&quot;i&quot;;A.1L(A.8.3.29,{1u:j,28:4(C,F){F=F||p;6 B=2,E=2.c.7;4 G(){B.1u=27(4(){E=++E&lt;B.$3.i?E:0;B.16(E)},C)}4 D(H){5(!H||H.26){25(B.1u)}}5(C){G();5(!F){2.$3.15(2.c.v,D)}n{2.$3.15(2.c.v,4(){D();E=B.c.7;G()})}}n{D();2.$3.14(2.c.v,D)}}})})(1K)',62,196,'||this|tabs|function|if|var|selected|ui|||panels|options|disabled|data|return||lis|length|null|selectedClass|element|addClass|else|href|false|load|removeClass||eq|hash|event|hideClass|cache|triggerHandler|filter|||||||||||||||||||||disabledClass|each|browser|fx|cookie|index||hasClass|attr|replace|unbind|bind|select|loadingClass|panelClass|remove|destroy|add|true|css|tabify|id|msie|unselect|li|label|ajaxOptions|spinner|removeData|xhr|html|undefined|display|inArray|map|blur|rotation|unselectClass|navClass|panelTemplate|click|setTimeout|success|em|find|block|tabId|stop|show|opacity|duration|location|jQuery|extend|panel|div|span|tabTemplate|idPrefix|url|disable|sort|push|enable|grep|insertBefore|appendTo|test|tabsshow|style|animate|_|title|clearInterval|clientX|setInterval|rotate|prototype|getter|loading|hide|nav|8230|Loading|defaults|join|ajax|abort|tabsload|wrapInner|parent|last|trigger|string|typeof|tabsdisable|tabsenable|inline|safari|tabsremove|tabsadd|parentNode|child|first|indexOf|identifier|fragment|Mismatching|Tabs|UI|throw|tabsselect|visible|parents|siblings|height|overflow|Array|constructor|normal|width|min|for|unload|window|splice|concat|unique|parseInt|scrollTo|500|opera|insertAfter|has|tab|z0|Za|setData|init|widget'.split('|'),0,{}))
 
-(function($) {
-
-    // if the UI scope is not availalable, add it
-    $.ui = $.ui || {};
-
-    // tabs initialization
-    $.fn.tabs = function(initial, options) {
-        if (initial &amp;&amp; initial.constructor == Object) { // shift arguments
-            options = initial;
-            initial = null;
-        }
-        options = options || {};
-
-        initial = initial &amp;&amp; initial.constructor == Number &amp;&amp; --initial || 0;
-
-        return this.each(function() {
-            new $.ui.tabs(this, $.extend(options, { initial: initial }));
-        });
-    };
-
-    // other chainable tabs methods
-    $.each(['Add', 'Remove', 'Enable', 'Disable', 'Click', 'Load', 'Href'], function(i, method) {
-        $.fn['tabs' + method] = function() {
-            var args = arguments;
-            return this.each(function() {
-                var instance = $.ui.tabs.getInstance(this);
-                instance[method.toLowerCase()].apply(instance, args);
-            });
-        };
-    });
-    $.fn.tabsSelected = function() {
-        var selected = -1;
-        if (this[0]) {
-            var instance = $.ui.tabs.getInstance(this[0]),
-                $lis = $('li', this);
-            selected = $lis.index( $lis.filter('.' + instance.options.selectedClass)[0] );
-        }
-        return selected &gt;= 0 ? ++selected : -1;
-    };
-
-    // tabs class
-    $.ui.tabs = function(el, options) {
-
-        this.source = el;
-
-        this.options = $.extend({
-
-            // basic setup
-            initial: 0,
-            event: 'click',
-            disabled: [],
-            cookie: null, // pass options object as expected by cookie plugin: { expires: 7, path: '/', domain: 'jquery.com', secure: true }
-            // TODO bookmarkable: $.ajaxHistory ? true : false,
-            unselected: false,
-            unselect: options.unselected ? true : false,
-
-            // Ajax
-            spinner: 'Loading&amp;#8230;',
-            cache: false,
-            idPrefix: 'ui-tabs-',
-            ajaxOptions: {},
-
-            // animations
-            /*fxFade: null,
-            fxSlide: null,
-            fxShow: null,
-            fxHide: null,*/
-            fxSpeed: 'normal',
-            /*fxShowSpeed: null,
-            fxHideSpeed: null,*/
-
-            // callbacks
-            add: function() {},
-            remove: function() {},
-            enable: function() {},
-            disable: function() {},
-            click: function() {},
-            hide: function() {},
-            show: function() {},
-            load: function() {},
-            
-            // templates
-            tabTemplate: '&lt;li&gt;&lt;a href=&quot;#{href}&quot;&gt;&lt;span&gt;#{text}&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;',
-            panelTemplate: '&lt;div&gt;&lt;/div&gt;',
-
-            // CSS classes
-            navClass: 'ui-tabs-nav',
-            selectedClass: 'ui-tabs-selected',
-            unselectClass: 'ui-tabs-unselect',
-            disabledClass: 'ui-tabs-disabled',
-            panelClass: 'ui-tabs-panel',
-            hideClass: 'ui-tabs-hide',
-            loadingClass: 'ui-tabs-loading'
-
-        }, options);
-
-        this.options.event += '.ui-tabs'; // namespace event
-        this.options.cookie = $.cookie &amp;&amp; $.cookie.constructor == Function &amp;&amp; this.options.cookie;
-
-        // save instance for later
-        $.data(el, $.ui.tabs.INSTANCE_KEY, this);
-        
-        // create tabs
-        this.tabify(true);
-    };
-
-    // static
-    $.ui.tabs.INSTANCE_KEY = 'ui_tabs_instance';
-    $.ui.tabs.getInstance = function(el) {
-        return $.data(el, $.ui.tabs.INSTANCE_KEY);
-    };
-
-    // instance methods
-    $.extend($.ui.tabs.prototype, {
-        tabId: function(a) {
-            return a.title ? a.title.replace(/\s/g, '_')
-                : this.options.idPrefix + $.data(a);
-        },
-        tabify: function(init) {
-
-            this.$lis = $('li:has(a[href])', this.source);
-            this.$tabs = this.$lis.map(function() { return $('a', this)[0] });
-            this.$panels = $([]);
-            
-            var self = this, o = this.options;
-            
-            this.$tabs.each(function(i, a) {
-                // inline tab
-                if (a.hash &amp;&amp; a.hash.replace('#', '')) { // Safari 2 reports '#' for an empty hash
-                    self.$panels = self.$panels.add(a.hash);
-                }
-                // remote tab
-                else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just &quot;#&quot;
-                    $.data(a, 'href', a.href);
-                    var id = self.tabId(a);
-                    a.href = '#' + id;
-                    self.$panels = self.$panels.add(
-                        $('#' + id)[0] || $(o.panelTemplate).attr('id', id).addClass(o.panelClass)
-                            .insertAfter( self.$panels[i - 1] || self.source )
-                    );
-                }
-                // invalid tab href
-                else {
-                    o.disabled.push(i + 1);
-                }
-            });
-
-            if (init) {
-
-                // attach necessary classes for styling if not present
-                $(this.source).hasClass(o.navClass) || $(this.source).addClass(o.navClass);
-                this.$panels.each(function() {
-                    var $this = $(this);
-                    $this.hasClass(o.panelClass) || $this.addClass(o.panelClass);
-                });
-                
-                // disabled tabs
-                for (var i = 0, position; position = o.disabled[i]; i++) {
-                    this.disable(position);
-                }
-                
-                // Try to retrieve initial tab:
-                // 1. from fragment identifier in url if present
-                // 2. from cookie
-                // 3. from selected class attribute on &lt;li&gt;
-                // 4. otherwise use given initial argument
-                // 5. check if tab is disabled
-                this.$tabs.each(function(i, a) {
-                    if (location.hash) {
-                        if (a.hash == location.hash) {
-                            o.initial = i;
-                            // prevent page scroll to fragment
-                            //if (($.browser.msie || $.browser.opera) &amp;&amp; !o.remote) {
-                            if ($.browser.msie || $.browser.opera) {
-                                var $toShow = $(location.hash), toShowId = $toShow.attr('id');
-                                $toShow.attr('id', '');
-                                setTimeout(function() {
-                                    $toShow.attr('id', toShowId); // restore id
-                                }, 500);
-                            }
-                            scrollTo(0, 0);
-                            return false; // break
-                        }
-                    } else if (o.cookie) {
-                        o.initial = parseInt($.cookie( $.ui.tabs.INSTANCE_KEY + $.data(self.source) )) || 0;
-                        return false; // break
-                    } else if ( self.$lis.eq(i).hasClass(o.selectedClass) ) {
-                        o.initial = i;
-                        return false; // break
-                    }
-                });
-                var n = this.$lis.length;
-                while (this.$lis.eq(o.initial).hasClass(o.disabledClass) &amp;&amp; n) {
-                    o.initial = ++o.initial &lt; this.$lis.length ? o.initial : 0;
-                    n--;
-                }
-                if (!n) { // all tabs disabled, set option unselected to true
-                    o.unselected = o.unselect = true;
-                }
-
-                // highlight selected tab
-                this.$panels.addClass(o.hideClass);
-                this.$lis.removeClass(o.selectedClass);
-                if (!o.unselected) {
-                    this.$panels.eq(o.initial).show().removeClass(o.hideClass); // use show and remove class to show in any case no matter how it has been hidden before
-                    this.$lis.eq(o.initial).addClass(o.selectedClass);
-                }
-
-                // load if remote tab
-                var href = !o.unselected &amp;&amp; $.data(this.$tabs[o.initial], 'href');
-                if (href) {
-                    this.load(o.initial + 1, href);
-                }
-                
-                // disable click if event is configured to something else
-                if (!/^click/.test(o.event)) {
-                    this.$tabs.bind('click', function(e) { e.preventDefault(); });
-                }
-
-            }
-
-            // setup animations
-            var showAnim = {}, showSpeed = o.fxShowSpeed || o.fxSpeed,
-                hideAnim = {}, hideSpeed = o.fxHideSpeed || o.fxSpeed;
-            if (o.fxSlide || o.fxFade) {
-                if (o.fxSlide) {
-                    showAnim['height'] = 'show';
-                    hideAnim['height'] = 'hide';
-                }
-                if (o.fxFade) {
-                    showAnim['opacity'] = 'show';
-                    hideAnim['opacity'] = 'hide';
-                }
-            } else {
-                if (o.fxShow) {
-                    showAnim = o.fxShow;
-                } else { // use some kind of animation to prevent browser scrolling to the tab
-                    showAnim['min-width'] = 0; // avoid opacity, causes flicker in Firefox
-                    showSpeed = 1; // as little as 1 is sufficient
-                }
-                if (o.fxHide) {
-                    hideAnim = o.fxHide;
-                } else { // use some kind of animation to prevent browser scrolling to the tab
-                    hideAnim['min-width'] = 0; // avoid opacity, causes flicker in Firefox
-                    hideSpeed = 1; // as little as 1 is sufficient
-                }
-            }
-
-            // reset some styles to maintain print style sheets etc.
-            var resetCSS = { display: '', overflow: '', height: '' };
-            if (!$.browser.msie) { // not in IE to prevent ClearType font issue
-                resetCSS['opacity'] = '';
-            }
-
-            // Hide a tab, animation prevents browser scrolling to fragment,
-            // $show is optional.
-            function hideTab(clicked, $hide, $show) {
-                $hide.animate(hideAnim, hideSpeed, function() { //
-                    $hide.addClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
-                    if ($.browser.msie &amp;&amp; hideAnim['opacity']) {
-                        $hide[0].style.filter = '';
-                    }
-                    o.hide(clicked, $hide[0], $show &amp;&amp; $show[0] || null);
-                    if ($show) {
-                        showTab(clicked, $show, $hide);
-                    }
-                });
-            }
-
-            // Show a tab, animation prevents browser scrolling to fragment,
-            // $hide is optional
-            function showTab(clicked, $show, $hide) {
-                if (!(o.fxSlide || o.fxFade || o.fxShow)) {
-                    $show.css('display', 'block'); // prevent occasionally occuring flicker in Firefox cause by gap between showing and hiding the tab panels
-                }
-                $show.animate(showAnim, showSpeed, function() {
-                    $show.removeClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
-                    if ($.browser.msie &amp;&amp; showAnim['opacity']) {
-                        $show[0].style.filter = '';
-                    }
-                    o.show(clicked, $show[0], $hide &amp;&amp; $hide[0] || null);
-                });
-            }
-
-            // switch a tab
-            function switchTab(clicked, $li, $hide, $show) {
-                /*if (o.bookmarkable &amp;&amp; trueClick) { // add to history only if true click occured, not a triggered click
-                    $.ajaxHistory.update(clicked.hash);
-                }*/
-                $li.addClass(o.selectedClass)
-                    .siblings().removeClass(o.selectedClass);
-                hideTab(clicked, $hide, $show);
-            }
-
-            // attach tab event handler, unbind to avoid duplicates from former tabifying...
-            this.$tabs.unbind(o.event).bind(o.event, function() {
-
-                //var trueClick = e.clientX; // add to history only if true click occured, not a triggered click
-                var $li = $(this).parents('li:eq(0)'),
-                    $hide = self.$panels.filter(':visible'),
-                    $show = $(this.hash);
-
-                // If tab is already selected and not unselectable or tab disabled or click callback returns false stop here.
-                // Check if click handler returns false last so that it is not executed for a disabled tab!
-                if (($li.hasClass(o.selectedClass) &amp;&amp; !o.unselect) || $li.hasClass(o.disabledClass)
-                    || o.click(this, $show[0], $hide[0]) === false) {
-                    this.blur();
-                    return false;
-                }
-                
-                if (o.cookie) {
-                    $.cookie($.ui.tabs.INSTANCE_KEY + $.data(self.source), self.$tabs.index(this), o.cookie);
-                }
-                    
-                // if tab may be closed
-                if (o.unselect) {
-                    if ($li.hasClass(o.selectedClass)) {
-                        $li.removeClass(o.selectedClass);
-                        self.$panels.stop();
-                        hideTab(this, $hide);
-                        this.blur();
-                        return false;
-                    } else if (!$hide.length) {
-                        self.$panels.stop();
-                        if ($.data(this, 'href')) { // remote tab
-                            var a = this;
-                            self.load(self.$tabs.index(this) + 1, $.data(this, 'href'), function() {
-                                $li.addClass(o.selectedClass).addClass(o.unselectClass);
-                                showTab(a, $show);
-                            });
-                        } else {
-                            $li.addClass(o.selectedClass).addClass(o.unselectClass);
-                            showTab(this, $show);
-                        }
-                        this.blur();
-                        return false;
-                    }
-                }
-
-                // stop possibly running animations
-                self.$panels.stop();
-
-                // show new tab
-                if ($show.length) {
-
-                    // prevent scrollbar scrolling to 0 and than back in IE7, happens only if bookmarking/history is enabled
-                    /*if ($.browser.msie &amp;&amp; o.bookmarkable) {
-                        var showId = this.hash.replace('#', '');
-                        $show.attr('id', '');
-                        setTimeout(function() {
-                            $show.attr('id', showId); // restore id
-                        }, 0);
-                    }*/
-
-                    if ($.data(this, 'href')) { // remote tab
-                        var a = this;
-                        self.load(self.$tabs.index(this) + 1, $.data(this, 'href'), function() {
-                            switchTab(a, $li, $hide, $show);
-                        });
-                    } else {
-                        switchTab(this, $li, $hide, $show);
-                    }
-
-                    // Set scrollbar to saved position - need to use timeout with 0 to prevent browser scroll to target of hash
-                    /*var scrollX = window.pageXOffset || document.documentElement &amp;&amp; document.documentElement.scrollLeft || document.body.scrollLeft || 0;
-                    var scrollY = window.pageYOffset || document.documentElement &amp;&amp; document.documentElement.scrollTop || document.body.scrollTop || 0;
-                    setTimeout(function() {
-                        scrollTo(scrollX, scrollY);
-                    }, 0);*/
-
-                } else {
-                    throw 'jQuery UI Tabs: Mismatching fragment identifier.';
-                }
-
-                // Prevent IE from keeping other link focussed when using the back button
-                // and remove dotted border from clicked link. This is controlled in modern
-                // browsers via CSS, also blur removes focus from address bar in Firefox
-                // which can become a usability and annoying problem with tabsRotate.
-                if ($.browser.msie) {
-                    this.blur(); 
-                }
-
-                //return o.bookmarkable &amp;&amp; !!trueClick; // convert trueClick == undefined to Boolean required in IE
-                return false;
-
-            });
-
-        },
-        add: function(url, text, position) {
-            if (url &amp;&amp; text) {
-                position = position || this.$tabs.length; // append by default  
-                
-                var o = this.options,
-                    $li = $(o.tabTemplate.replace(/#\{href\}/, url).replace(/#\{text\}/, text));
-                
-                var id = url.indexOf('#') == 0 ? url.replace('#', '') : this.tabId( $('a:first-child', $li)[0] );
-                
-                // try to find an existing element before creating a new one
-                var $panel = $('#' + id);
-                $panel = $panel.length &amp;&amp; $panel
-                    || $(o.panelTemplate).attr('id', id).addClass(o.panelClass).addClass(o.hideClass);
-                if (position &gt;= this.$lis.length) {
-                    $li.appendTo(this.source);
-                    $panel.appendTo(this.source.parentNode);
-                } else {
-                    $li.insertBefore(this.$lis[position - 1]);
-                    $panel.insertBefore(this.$panels[position - 1]);
-                }
-                
-                this.tabify();
-                
-                if (this.$tabs.length == 1) {
-                     $li.addClass(o.selectedClass);
-                     $panel.removeClass(o.hideClass);
-                     var href = $.data(this.$tabs[0], 'href');
-                     if (href) {
-                         this.load(position + 1, href);
-                     }
-                }
-                o.add(this.$tabs[position], this.$panels[position]); // callback
-            } else {
-                throw 'jQuery UI Tabs: Not enough arguments to add tab.';
-            }
-        },
-        remove: function(position) {
-            if (position &amp;&amp; position.constructor == Number) {                
-                var o = this.options, $li = this.$lis.eq(position - 1).remove(),
-                    $panel = this.$panels.eq(position - 1).remove();
-                    
-                // If selected tab was removed focus tab to the right or
-                // tab to the left if last tab was removed.
-                if ($li.hasClass(o.selectedClass) &amp;&amp; this.$tabs.length &gt; 1) {
-                    this.click(position + (position &lt; this.$tabs.length ? 1 : -1));
-                }
-                this.tabify();
-                o.remove($li.end()[0], $panel[0]); // callback
-            }
-        },
-        enable: function(position) {
-            var o = this.options, $li = this.$lis.eq(position - 1);
-            $li.removeClass(o.disabledClass);
-            if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2...
-                $li.css('display', 'inline-block');
-                setTimeout(function() {
-                    $li.css('display', 'block')
-                }, 0)
-            }
-            o.enable(this.$tabs[position - 1], this.$panels[position - 1]); // callback
-        },
-        disable: function(position) {
-            var o = this.options;      
-            this.$lis.eq(position - 1).addClass(o.disabledClass);
-            o.disable(this.$tabs[position - 1], this.$panels[position - 1]); // callback
-        },
-        click: function(position) {
-            this.$tabs.eq(position - 1).trigger(this.options.event);
-        },
-        load: function(position, url, callback) {
-            var self = this, o = this.options,
-                $a = this.$tabs.eq(position - 1), a = $a[0], $span = $('span', a);
-            
-            // shift arguments
-            if (url &amp;&amp; url.constructor == Function) {
-                callback = url;
-                url = null;
-            }
-
-            // set new URL or get existing
-            if (url) {
-                $.data(a, 'href', url);
-            } else {
-                url = $.data(a, 'href');
-            }
-
-            // load
-            if (o.spinner) {
-                $.data(a, 'title', $span.html());
-                $span.html('&lt;em&gt;' + o.spinner + '&lt;/em&gt;');
-            }
-            var finish = function() {
-                self.$tabs.filter('.' + o.loadingClass).each(function() {
-                    $(this).removeClass(o.loadingClass);
-                    if (o.spinner) {
-                        $('span', this).html( $.data(this, 'title') );
-                    }
-                });
-                self.xhr = null;
-            };
-            var ajaxOptions = $.extend(o.ajaxOptions, {
-                url: url,
-                success: function(r) {
-                    $(a.hash).html(r);
-                    finish();
-                    // This callback is required because the switch has to take 
-                    // place after loading has completed.
-                    if (callback &amp;&amp; callback.constructor == Function) {
-                        callback();
-                    }
-                    if (o.cache) {
-                        $.removeData(a, 'href'); // if loaded once do not load them again
-                    }
-                    o.load(self.$tabs[position - 1], self.$panels[position - 1]); // callback
-                }
-            });
-            if (this.xhr) {
-                // terminate pending requests from other tabs and restore title
-                this.xhr.abort();
-                finish();
-            }
-            $a.addClass(o.loadingClass);
-            setTimeout(function() { // timeout is again required in IE, &quot;wait&quot; for id being restored
-                self.xhr = $.ajax(ajaxOptions);
-            }, 0);
-            
-        },
-        href: function(position, href) {
-            $.data(this.$tabs.eq(position - 1)[0], 'href', href);
-        }
-    });
-
-})(jQuery);</diff>
      <filename>wp-includes/js/jquery/ui.tabs.js</filename>
    </modified>
    <modified>
      <diff>@@ -12,7 +12,9 @@ function fileQueued(fileObj) {
 		jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
 	}
 	// Create a progress bar containing the filename
-	jQuery('#media-items').append('&lt;div id=&quot;media-item-' + fileObj.id + '&quot; class=&quot;media-item child-of-' + post_id + '&quot;&gt;&lt;div class=&quot;filename original&quot;&gt;' + fileObj.name + '&lt;/div&gt;&lt;div class=&quot;progress&quot;&gt;&lt;div class=&quot;bar&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;');
+	jQuery('#media-items').append('&lt;div id=&quot;media-item-' + fileObj.id + '&quot; class=&quot;media-item child-of-' + post_id + '&quot;&gt;&lt;div class=&quot;progress&quot;&gt;&lt;div class=&quot;bar&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;filename original&quot;&gt;' + fileObj.name + '&lt;/div&gt;&lt;/div&gt;');
+	// Display the progress div
+	jQuery('#media-item-' + fileObj.id + ' .progress').show();
 
 	// Disable the submit button
 	jQuery('#insert-gallery').attr('disabled', 'disabled');
@@ -24,16 +26,27 @@ function uploadProgress(fileObj, bytesDone, bytesTotal) {
 	// Lengthen the progress bar
 	jQuery('#media-item-' + fileObj.id + ' .bar').width(620*bytesDone/bytesTotal);
 
-	if ( bytesDone== bytesTotal )
-		jQuery('#media-item-' + fileObj.id + ' .bar').html('&lt;strong style=&quot;display: block; padding-top: 9px; padding-left: 1em;&quot;&gt;' + swfuploadL10n.crunching + '&lt;/strong&gt;');
+	if ( bytesDone == bytesTotal )
+		jQuery('#media-item-' + fileObj.id + ' .bar').html('&lt;strong class=&quot;crunching&quot;&gt;' + swfuploadL10n.crunching + '&lt;/strong&gt;');
 }
 
 function prepareMediaItem(fileObj, serverData) {
 	// Move the progress bar to 100%
 	jQuery('#media-item-' + fileObj.id + ' .bar').remove();
+	jQuery('#media-item-' + fileObj.id + ' .progress').hide();
 
-	// Append the HTML returned by the server -- thumbnail and form inputs
-	jQuery('#media-item-' + fileObj.id).append(serverData);
+	// Old style: Append the HTML returned by the server -- thumbnail and form inputs
+	if ( isNaN(serverData) || !serverData ) {
+		jQuery('#media-item-' + fileObj.id).append(serverData);
+		prepareMediaItemInit(fileObj);
+	}
+	// New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
+	else {
+		jQuery('#media-item-' + fileObj.id).load('async-upload.php', {attachment_id:serverData, fetch:1}, function(){prepareMediaItemInit(fileObj);updateMediaForm()});
+	}
+}
+		
+function prepareMediaItemInit(fileObj) {
 
 	// Clone the thumbnail as a &quot;pinkynail&quot; -- a tiny image to the left of the filename
 	jQuery('#media-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail toggle').prependTo('#media-item-' + fileObj.id);
@@ -41,11 +54,8 @@ function prepareMediaItem(fileObj, serverData) {
 	// Replace the original filename with the new (unique) one assigned during upload
 	jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new'));
 
-	// Bind toggle function to a new mask over the progress bar area
-	jQuery('#media-item-' + fileObj.id + ' .progress').clone().empty().addClass('clickmask').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).siblings('.toggle').toggle();}).appendTo('#media-item-' + fileObj.id);
-
 	// Also bind toggle to the links
-	jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;});
+	jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150, function(){window.scrollTo(0,this.parentNode.offsetTop);});jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;});
 
 	// Bind AJAX to the new Delete button
 	jQuery('#media-item-' + fileObj.id + ' a.delete').bind('click',function(){
@@ -96,7 +106,7 @@ function deleteSuccess(data, textStatus) {
 	jQuery('#media-item-' + this.id + ' .filename').append(' &lt;span class=&quot;file-error&quot;&gt;'+swfuploadL10n.deleted+'&lt;/span&gt;').siblings('a.toggle').remove();
 	jQuery('#media-item-' + this.id).children('.describe').css({backgroundColor:'#fff'}).end()
 			.animate({backgroundColor:'#ffc0c0'}, {queue:false,duration:50})
-			.animate({minHeight:0,height:36,}, 400, null, function(){jQuery(this).children('.describe').remove()})
+			.animate({minHeight:0,height:36}, 400, null, function(){jQuery(this).children('.describe').remove()})
 			.animate({backgroundColor:'#fff'}, 400)
 			.animate({height:0}, 800, null, function(){jQuery(this).remove();updateMediaForm();});
 </diff>
      <filename>wp-includes/js/swfupload/handlers.js</filename>
    </modified>
    <modified>
      <diff>@@ -82,16 +82,14 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
 }
 
 #TB_closeAjaxWindow{
-	padding:7px 10px 5px 0;
-	margin-bottom:1px;
+	padding:6px 10px 0;
 	text-align:right;
 	float:right;
 }
 
 #TB_ajaxWindowTitle{
 	float:left;
-	padding:7px 0 5px 10px;
-	margin-bottom:1px;
+	padding:6px 10px 0;
 }
 
 #TB_title{
@@ -118,12 +116,13 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
 #TB_load{
 	position: fixed;
 	display:none;
-	height:13px;
-	width:208px;
 	z-index:103;
 	top: 50%;
 	left: 50%;
-	margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
+	background-color: #E8E8E8;
+	border: 4px solid #525252;
+	margin: -45px 0pt 0pt -125px;
+	padding: 40px 15px 15px;
 }
 
 * html #TB_load { /* ie6 hack */
@@ -154,6 +153,5 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
 	clear:both;
 	border:none;
 	margin-bottom:-1px;
-	margin-top:1px;
 	_margin-bottom:1px;
 }</diff>
      <filename>wp-includes/js/thickbox/thickbox.css</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@
 // escape text only if it needs translating
 function mce_escape($text) {
 	global $language;
-	
+
 	if ( 'en' == $language ) return $text;
 	else return js_escape($text);
 }
@@ -395,7 +395,47 @@ wp_more_desc:&quot;' . mce_escape( __('Insert More tag') ) . ' (Alt+Shift+T)&quot;,
 wp_page_desc:&quot;' . mce_escape( __('Insert Page break') ) . ' (Alt+Shift+P)&quot;,
 wp_help_desc:&quot;' . mce_escape( __('Help') ) . ' (Alt+Shift+H)&quot;,
 wp_more_alt:&quot;' . mce_escape( __('More...') ) . '&quot;,
-wp_page_alt:&quot;' . mce_escape( __('Next page...') ) . '&quot;
+wp_page_alt:&quot;' . mce_escape( __('Next page...') ) . '&quot;,
+add_media:&quot;' . mce_escape( __('Add Media') ) . '&quot;,
+add_image:&quot;' . mce_escape( __('Add an Image') ) . '&quot;,
+add_video:&quot;' . mce_escape( __('Add Video') ) . '&quot;,
+add_audio:&quot;' . mce_escape( __('Add Audio') ) . '&quot;
+});
+
+tinyMCE.addI18n(&quot;' . $language . '.wpeditimage&quot;,{
+edit_img:&quot;' . mce_escape( __('Edit Image') )  . '&quot;,
+del_img:&quot;' . mce_escape( __('Delete Image') )  . '&quot;,
+adv_settings:&quot;' . mce_escape( __('Advanced Settings') )  . '&quot;,
+none:&quot;' . mce_escape( __('None') )  . '&quot;,
+size:&quot;' . mce_escape( __('Size') ) . '&quot;,
+thumbnail:&quot;' . mce_escape( __('Thumbnail') ) . '&quot;,
+medium:&quot;' . mce_escape( __('Medium') ) . '&quot;,
+full_size:&quot;' . mce_escape( __('Full Size') ) . '&quot;,
+current_link:&quot;' . mce_escape( __('Current Link') ) . '&quot;,
+link_to_img:&quot;' . mce_escape( __('Link to Image') ) . '&quot;,
+link_help:&quot;' . mce_escape( __('Enter a link URL or click above for presets.') ) . '&quot;,
+adv_img_settings:&quot;' . mce_escape( __('Advanced Image Settings') ) . '&quot;,
+source:&quot;' . mce_escape( __('Source') )  . '&quot;,
+width:&quot;' . mce_escape( __('Width') ) . '&quot;,
+height:&quot;' . mce_escape( __('Height') ) . '&quot;,
+orig_size:&quot;' . mce_escape( __('Original Size') ) . '&quot;,
+css:&quot;' . mce_escape( __('CSS Class') ) . '&quot;,
+adv_link_settings:&quot;' . mce_escape( __('Advanced Link Settings') )  . '&quot;,
+link_rel:&quot;' . mce_escape( __('Link Rel') ) . '&quot;,
+height:&quot;' . mce_escape( __('Height') ) . '&quot;,
+orig_size:&quot;' . mce_escape( __('Original Size') ) . '&quot;,
+css:&quot;' . mce_escape( __('CSS Class') ) . '&quot;,
+s60:&quot;' . mce_escape( __('60%') ) . '&quot;,
+s70:&quot;' . mce_escape( __('70%') ) . '&quot;,
+s80:&quot;' . mce_escape( __('80%') ) . '&quot;,
+s90:&quot;' . mce_escape( __('90%') ) . '&quot;,
+s100:&quot;' . mce_escape( __('100%') ) . '&quot;,
+s110:&quot;' . mce_escape( __('110%') ) . '&quot;,
+s120:&quot;' . mce_escape( __('120%') ) . '&quot;,
+s130:&quot;' . mce_escape( __('130%') ) . '&quot;,
+img_title:&quot;' . mce_escape( __('Edit Image Title') ) . '&quot;,
+caption:&quot;' . mce_escape( __('Edit Image Caption') ) . '&quot;,
+alt:&quot;' . mce_escape( __('Edit Alternate Text') ) . '&quot;
 });
-'; 
+';
 ?&gt;
\ No newline at end of file</diff>
      <filename>wp-includes/js/tinymce/langs/wp-langs.php</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1 @@
-(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=document.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{window.setTimeout(function(){tinymce.dom.Event.remove(window,'resize',t.resizeFunc);tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(document.body,'overflow',ed.getParam('fullscreen_overflow'));window.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));tinyMCE.settings=tinyMCE.oldSettings;},10);}return;}if(ed.getParam('fullscreen_new_window')){win=window.open(url+&quot;/fullscreen.htm&quot;,&quot;mceFullScreenPopup&quot;,&quot;fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=&quot;+screen.availWidth+&quot;,height=&quot;+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{tinyMCE.oldSettings=tinyMCE.settings;s.fullscreen_overflow=DOM.getStyle(document.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&amp;&amp;s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&amp;&amp;s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(document.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();window.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(document.body,'div',{id:'mce_fullscreen_container',style:'position:absolute;top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:150;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;s.save_onsavecallback=function(){ed.setContent(tinyMCE.get(s.id).getContent({format:'raw'}),{format:'raw'});ed.execCommand('mceSave');};tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent());});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();t.resizeFunc=tinymce.dom.Event.add(window,'resize',function(){var vp=tinymce.DOM.getViewPort();t.fullscreenEditor.theme.resizeTo(vp.w,vp.h);});}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+&quot;.&quot;+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})();
\ No newline at end of file
+(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=DOM.doc.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{DOM.win.setTimeout(function(){tinymce.dom.Event.remove(DOM.win,'resize',t.resizeFunc);tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(DOM.doc.body,'overflow',ed.getParam('fullscreen_overflow'));DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));tinyMCE.settings=tinyMCE.oldSettings;},10);}return;}if(ed.getParam('fullscreen_new_window')){win=DOM.win.open(url+&quot;/fullscreen.htm&quot;,&quot;mceFullScreenPopup&quot;,&quot;fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=&quot;+screen.availWidth+&quot;,height=&quot;+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{tinyMCE.oldSettings=tinyMCE.settings;s.fullscreen_overflow=DOM.getStyle(DOM.doc.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&amp;&amp;s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&amp;&amp;s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(DOM.doc.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();DOM.win.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(DOM.doc.body,'div',{id:'mce_fullscreen_container',style:'position:'+(tinymce.isIE6||(tinymce.isIE&amp;&amp;!DOM.boxModel)?'absolute':'fixed')+';top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:200000;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;s.save_onsavecallback=function(){ed.setContent(tinyMCE.get(s.id).getContent({format:'raw'}),{format:'raw'});ed.execCommand('mceSave');};tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent());t.fullscreenEditor.focus();});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();t.resizeFunc=tinymce.dom.Event.add(DOM.win,'resize',function(){var vp=tinymce.DOM.getViewPort();t.fullscreenEditor.theme.resizeTo(vp.w,vp.h);});}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+&quot;.&quot;+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})();
\ No newline at end of file</diff>
      <filename>wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js</filename>
    </modified>
    <modified>
      <diff>@@ -3,14 +3,14 @@
 &lt;head&gt;
 	&lt;title&gt;&lt;/title&gt;
 	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
-	&lt;script type=&quot;text/javascript&quot; src=&quot;../../tiny_mce.js&quot;&gt;&lt;/script&gt;
+	&lt;script type=&quot;text/javascript&quot; src=&quot;../../tiny_mce.js?ver=311&quot;&gt;&lt;/script&gt;
 	&lt;script type=&quot;text/javascript&quot;&gt;
 		function patchCallback(settings, key) {
 			if (settings[key])
 				settings[key] = &quot;window.opener.&quot; + settings[key];
 		}
 
-		var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings;
+		var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id;
 
 		// Clone array
 		for (var n in paSe)
@@ -41,13 +41,13 @@
 		settings['ask'] = false;
 		settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
 		settings['fullscreen_is_enabled'] = true;
-		settings['fullscreen_editor_id'] = window.opener.tinyMCE.activeEditor.id;
+		settings['fullscreen_editor_id'] = oeID;
 		settings['theme_advanced_resizing'] = false;
 		settings['strict_loading_mode'] = true;
 
 		settings.save_onsavecallback = function() {
-			window.opener.tinyMCE.activeEditor.setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
-			window.opener.tinyMCE.activeEditor.execCommand('mceSave');
+			window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
+			window.opener.tinyMCE.get(oeID).execCommand('mceSave');
 			window.close();
 		};
 
@@ -56,7 +56,7 @@
 		}
 
 		function moveContent() {
-			window.opener.tinyMCE.activeEditor.setContent(tinyMCE.activeEditor.getContent());
+			window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent());
 		}
 
 		function closeFullscreen() {
@@ -78,7 +78,7 @@
 		function render() {
 			var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
 
-			e.value = window.opener.tinyMCE.activeEditor.getContent();
+			e.value = window.opener.tinyMCE.get(oeID).getContent();
 
 			vp = dom.getViewPort();
 			settings.width = vp.w;</diff>
      <filename>wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1 @@
-(function(){var DOM=tinymce.DOM,Element=tinymce.dom.Element,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.InlinePopups',{init:function(ed,url){ed.onBeforeRenderUI.add(function(){ed.windowManager=new tinymce.InlineWindowManager(ed);DOM.loadCSS(url+'/skins/'+(ed.settings.inlinepopups_skin||'clearlooks2')+&quot;/window.css&quot;);});},getInfo:function(){return{longname:'InlinePopups',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',version:tinymce.majorVersion+&quot;.&quot;+tinymce.minorVersion};}});tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager',{InlineWindowManager:function(ed){var t=this;t.parent(ed);t.zIndex=1000;t.count=0;},open:function(f,p){var t=this,id,opt='',ed=t.editor,dw=0,dh=0,vp,po,mdf,clf,we,w,u;f=f||{};p=p||{};if(!f.inline)return t.parent(f,p);if(!f.type)t.bookmark=ed.selection.getBookmark('simple');id=DOM.uniqueId();vp=DOM.getViewPort();f.width=parseInt(f.width||320);f.height=parseInt(f.height||240)+(tinymce.isIE?8:0);f.min_width=parseInt(f.min_width||150);f.min_height=parseInt(f.min_height||100);f.max_width=parseInt(f.max_width||2000);f.max_height=parseInt(f.max_height||2000);f.left=f.left||Math.round(Math.max(vp.x,vp.x+(vp.w/ 2.0) - (f.width /2.0)));f.top=f.top||Math.round(Math.max(vp.y,vp.y+(vp.h/ 2.0) - (f.height /2.0)));f.movable=f.resizable=true;p.mce_width=f.width;p.mce_height=f.height;p.mce_inline=true;p.mce_window_id=id;p.mce_auto_focus=f.auto_focus;t.features=f;t.params=p;t.onOpen.dispatch(t,f,p);if(f.type){opt+=' mceModal';if(f.type)opt+=' mce'+f.type.substring(0,1).toUpperCase()+f.type.substring(1);f.resizable=false;}if(f.statusbar)opt+=' mceStatusbar';if(f.resizable)opt+=' mceResizable';if(f.minimizable)opt+=' mceMinimizable';if(f.maximizable)opt+=' mceMaximizable';if(f.movable)opt+=' mceMovable';t._addAll(document.body,['div',{id:id,'class':ed.settings.inlinepopups_skin||'clearlooks2',dir:'ltr',style:'width:100px;height:100px'},['div',{id:id+'_wrapper','class':'mceWrapper'+opt},['div',{id:id+'_top','class':'mceTop'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_title'},f.title||'']],['div',{id:id+'_middle','class':'mceMiddle'},['div',{id:id+'_left','class':'mceLeft'}],['span',{id:id+'_content'}],['div',{id:id+'_right','class':'mceRight'}]],['div',{id:id+'_bottom','class':'mceBottom'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_status'},'Content']],['a',{'class':'mceMove',tabindex:'-1',href:'javascript:;'}],['a',{'class':'mceMin',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMax',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMed',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceClose',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{id:id+'_resize_n','class':'mceResize mceResizeN',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_s','class':'mceResize mceResizeS',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_w','class':'mceResize mceResizeW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_e','class':'mceResize mceResizeE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_nw','class':'mceResize mceResizeNW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_ne','class':'mceResize mceResizeNE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_sw','class':'mceResize mceResizeSW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_se','class':'mceResize mceResizeSE',tabindex:'-1',href:'javascript:;'}]]]);DOM.setStyles(id,{top:-10000,left:-10000});if(tinymce.isGecko)DOM.setStyle(id,'overflow','auto');if(!f.type){dw+=DOM.get(id+'_left').clientWidth;dw+=DOM.get(id+'_right').clientWidth;dh+=DOM.get(id+'_top').clientHeight;dh+=DOM.get(id+'_bottom').clientHeight;}DOM.setStyles(id,{top:f.top,left:f.left,width:f.width+dw,height:f.height+dh});u=f.url||f.file;if(u&amp;&amp;tinymce.relaxedDomain)u+=(u.indexOf('?')==-1?'?':'&amp;')+'mce_rdomain='+tinymce.relaxedDomain;if(!f.type){DOM.add(id+'_content','iframe',{id:id+'_ifr',src:'javascript:&quot;&quot;',frameBorder:0,style:'border:0;width:10px;height:10px'});DOM.setStyles(id+'_ifr',{width:f.width,height:f.height});DOM.setAttrib(id+'_ifr','src',u);}else{DOM.add(id+'_wrapper','a',{id:id+'_ok','class':'mceButton mceOk',href:'javascript:;',onmousedown:'return false;'},'Ok');if(f.type=='confirm')DOM.add(id+'_wrapper','a',{'class':'mceButton mceCancel',href:'javascript:;',onmousedown:'return false;'},'Cancel');DOM.add(id+'_middle','div',{'class':'mceIcon'});DOM.setHTML(id+'_content',f.content.replace('\n','&lt;br /&gt;'));}mdf=Event.add(id,'mousedown',function(e){var n=e.target,w,vp;w=t.windows[id];t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){if(n.className=='mceMax'){w.oldPos=w.element.getXY();w.oldSize=w.element.getSize();vp=DOM.getViewPort();vp.w-=2;vp.h-=2;w.element.moveTo(vp.x,vp.y);w.element.resizeTo(vp.w,vp.h);DOM.setStyles(id+'_ifr',{width:vp.w-w.deltaWidth,height:vp.h-w.deltaHeight});DOM.addClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMed'){w.element.moveTo(w.oldPos.x,w.oldPos.y);w.element.resizeTo(w.oldSize.w,w.oldSize.h);w.iframeElement.resizeTo(w.oldSize.w-w.deltaWidth,w.oldSize.h-w.deltaHeight);DOM.removeClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMove')return t._startDrag(id,e,n.className);else if(DOM.hasClass(n,'mceResize'))return t._startDrag(id,e,n.className.substring(13));}});clf=Event.add(id,'click',function(e){var n=e.target;t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){switch(n.className){case'mceClose':t.close(null,id);return Event.cancel(e);case'mceButton mceOk':case'mceButton mceCancel':f.button_func(n.className=='mceButton mceOk');return Event.cancel(e);}}});t.windows=t.windows||{};w=t.windows[id]={id:id,mousedown_func:mdf,click_func:clf,element:new Element(id,{blocker:1,container:ed.getContainer()}),iframeElement:new Element(id+'_ifr'),features:f,deltaWidth:dw,deltaHeight:dh};w.iframeElement.on('focus',function(){t.focus(id);});if(t.count==0&amp;&amp;t.editor.getParam('dialog_type')=='modal'){DOM.add(DOM.doc.body,'div',{id:'mceModalBlocker','class':(t.editor.settings.inlinepopups_skin||'clearlooks2')+'_modalBlocker',style:{left:vp.x,top:vp.y,zIndex:t.zIndex-1}});DOM.show('mceModalBlocker');}else DOM.setStyle('mceModalBlocker','z-index',t.zIndex-1);t.focus(id);t._fixIELayout(id,1);if(DOM.get(id+'_ok'))DOM.get(id+'_ok').focus();t.count++;return w;},focus:function(id){var t=this,w=t.windows[id];w.zIndex=this.zIndex++;w.element.setStyle('zIndex',w.zIndex);w.element.update();id=id+'_wrapper';DOM.removeClass(t.lastId,'mceFocus');DOM.addClass(id,'mceFocus');t.lastId=id;},_addAll:function(te,ne){var i,n,t=this,dom=tinymce.DOM;if(is(ne,'string'))te.appendChild(dom.doc.createTextNode(ne));else if(ne.length){te=te.appendChild(dom.create(ne[0],ne[1]));for(i=2;i&lt;ne.length;i++)t._addAll(te,ne[i]);}},_startDrag:function(id,se,ac){var t=this,mu,mm,d=document,eb,w=t.windows[id],we=w.element,sp=we.getXY(),p,sz,ph,cp,vp,sx,sy,sex,sey,dx,dy,dw,dh;cp={x:0,y:0};vp=DOM.getViewPort();vp.w-=2;vp.h-=2;sex=se.screenX;sey=se.screenY;dx=dy=dw=dh=0;mu=Event.add(d,'mouseup',function(e){Event.remove(d,'mouseup',mu);Event.remove(d,'mousemove',mm);if(eb)eb.remove();we.moveBy(dx,dy);we.resizeBy(dw,dh);sz=we.getSize();DOM.setStyles(id+'_ifr',{width:sz.w-w.deltaWidth,height:sz.h-w.deltaHeight});t._fixIELayout(id,1);return Event.cancel(e);});if(ac!='Move')startMove();function startMove(){if(eb)return;t._fixIELayout(id,0);DOM.add(d.body,'div',{id:'mceEventBlocker','class':'mceEventBlocker '+(t.editor.settings.inlinepopups_skin||'clearlooks2'),style:{left:vp.x,top:vp.y,zIndex:20001}});eb=new Element('mceEventBlocker');eb.update();p=we.getXY();sz=we.getSize();sx=cp.x+p.x-vp.x;sy=cp.y+p.y-vp.y;DOM.add(eb.get(),'div',{id:'mcePlaceHolder','class':'mcePlaceHolder',style:{left:sx,top:sy,width:sz.w,height:sz.h}});ph=new Element('mcePlaceHolder');};mm=Event.add(d,'mousemove',function(e){var x,y,v;startMove();x=e.screenX-sex;y=e.screenY-sey;switch(ac){case'ResizeW':dx=x;dw=0-x;break;case'ResizeE':dw=x;break;case'ResizeN':case'ResizeNW':case'ResizeNE':if(ac==&quot;ResizeNW&quot;){dx=x;dw=0-x;}else if(ac==&quot;ResizeNE&quot;)dw=x;dy=y;dh=0-y;break;case'ResizeS':case'ResizeSW':case'ResizeSE':if(ac==&quot;ResizeSW&quot;){dx=x;dw=0-x;}else if(ac==&quot;ResizeSE&quot;)dw=x;dh=y;break;case'mceMove':dx=x;dy=y;break;}if(dw&lt;(v=w.features.min_width-sz.w)){if(dx!==0)dx+=dw-v;dw=v;}if(dh&lt;(v=w.features.min_height-sz.h)){if(dy!==0)dy+=dh-v;dh=v;}dw=Math.min(dw,w.features.max_width-sz.w);dh=Math.min(dh,w.features.max_height-sz.h);dx=Math.max(dx,vp.x-(sx+vp.x));dy=Math.max(dy,vp.y-(sy+vp.y));dx=Math.min(dx,(vp.w+vp.x)-(sx+sz.w+vp.x));dy=Math.min(dy,(vp.h+vp.y)-(sy+sz.h+vp.y));if(dx+dy!==0){if(sx+dx&lt;0)dx=0;if(sy+dy&lt;0)dy=0;ph.moveTo(sx+dx,sy+dy);}if(dw+dh!==0)ph.resizeTo(sz.w+dw,sz.h+dh);return Event.cancel(e);});return Event.cancel(se);},resizeBy:function(dw,dh,id){var w=this.windows[id];if(w){w.element.resizeBy(dw,dh);w.iframeElement.resizeBy(dw,dh);}},close:function(win,id){var t=this,w,d=document,ix=0,fw;t.count--;if(t.count==0)DOM.remove('mceModalBlocker');if(!id&amp;&amp;win){t.parent(win);return;}if(w=t.windows[id]){t.onClose.dispatch(t);Event.remove(d,'mousedown',w.mousedownFunc);Event.remove(d,'click',w.clickFunc);DOM.setAttrib(id+'_ifr','src','javascript:&quot;&quot;');w.element.remove();delete t.windows[id];each(t.windows,function(w){if(w.zIndex&gt;ix){fw=w;ix=w.zIndex;}});if(fw)t.focus(fw.id);}},setTitle:function(ti,id){var e;if(e=DOM.get(id+'_title'))e.innerHTML=DOM.encode(ti);},alert:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'alert',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},confirm:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'confirm',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},_fixIELayout:function(id,s){var w,img;if(!tinymce.isIE6)return;each(['n','s','w','e','nw','ne','sw','se'],function(v){var e=DOM.get(id+'_resize_'+v);DOM.setStyles(e,{width:s?e.clientWidth:'',height:s?e.clientHeight:'',cursor:DOM.getStyle(e,'cursor',1)});DOM.setStyle(id+&quot;_bottom&quot;,'bottom','-1px');e=0;});if(w=this.windows[id]){w.element.hide();w.element.show();each(DOM.select('div,a',id),function(e,i){if(e.currentStyle.backgroundImage!='none'){img=new Image();img.src=e.currentStyle.backgroundImage.replace(/url\(\&quot;(.+)\&quot;\)/,'$1');}});DOM.get(id).style.filter='';}}});tinymce.PluginManager.add('inlinepopups',tinymce.plugins.InlinePopups);})();
\ No newline at end of file
+(function(){var DOM=tinymce.DOM,Element=tinymce.dom.Element,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.InlinePopups',{init:function(ed,url){ed.onBeforeRenderUI.add(function(){ed.windowManager=new tinymce.InlineWindowManager(ed);DOM.loadCSS(url+'/skins/'+(ed.settings.inlinepopups_skin||'clearlooks2')+&quot;/window.css&quot;);});},getInfo:function(){return{longname:'InlinePopups',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',version:tinymce.majorVersion+&quot;.&quot;+tinymce.minorVersion};}});tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager',{InlineWindowManager:function(ed){var t=this;t.parent(ed);t.zIndex=300000;t.count=0;},open:function(f,p){var t=this,id,opt='',ed=t.editor,dw=0,dh=0,vp,po,mdf,clf,we,w,u;f=f||{};p=p||{};if(!f.inline)return t.parent(f,p);if(!f.type)t.bookmark=ed.selection.getBookmark('simple');id=DOM.uniqueId();vp=DOM.getViewPort();f.width=parseInt(f.width||320);f.height=parseInt(f.height||240)+(tinymce.isIE?8:0);f.min_width=parseInt(f.min_width||150);f.min_height=parseInt(f.min_height||100);f.max_width=parseInt(f.max_width||2000);f.max_height=parseInt(f.max_height||2000);f.left=f.left||Math.round(Math.max(vp.x,vp.x+(vp.w/ 2.0) - (f.width /2.0)));f.top=f.top||Math.round(Math.max(vp.y,vp.y+(vp.h/ 2.0) - (f.height /2.0)));f.movable=f.resizable=true;p.mce_width=f.width;p.mce_height=f.height;p.mce_inline=true;p.mce_window_id=id;p.mce_auto_focus=f.auto_focus;t.features=f;t.params=p;t.onOpen.dispatch(t,f,p);if(f.type){opt+=' mceModal';if(f.type)opt+=' mce'+f.type.substring(0,1).toUpperCase()+f.type.substring(1);f.resizable=false;}if(f.statusbar)opt+=' mceStatusbar';if(f.resizable)opt+=' mceResizable';if(f.minimizable)opt+=' mceMinimizable';if(f.maximizable)opt+=' mceMaximizable';if(f.movable)opt+=' mceMovable';t._addAll(DOM.doc.body,['div',{id:id,'class':ed.settings.inlinepopups_skin||'clearlooks2',style:'width:100px;height:100px'},['div',{id:id+'_wrapper','class':'mceWrapper'+opt},['div',{id:id+'_top','class':'mceTop'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_title'},f.title||'']],['div',{id:id+'_middle','class':'mceMiddle'},['div',{id:id+'_left','class':'mceLeft'}],['span',{id:id+'_content'}],['div',{id:id+'_right','class':'mceRight'}]],['div',{id:id+'_bottom','class':'mceBottom'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_status'},'Content']],['a',{'class':'mceMove',tabindex:'-1',href:'javascript:;'}],['a',{'class':'mceMin',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMax',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMed',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceClose',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{id:id+'_resize_n','class':'mceResize mceResizeN',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_s','class':'mceResize mceResizeS',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_w','class':'mceResize mceResizeW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_e','class':'mceResize mceResizeE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_nw','class':'mceResize mceResizeNW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_ne','class':'mceResize mceResizeNE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_sw','class':'mceResize mceResizeSW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_se','class':'mceResize mceResizeSE',tabindex:'-1',href:'javascript:;'}]]]);DOM.setStyles(id,{top:-10000,left:-10000});if(tinymce.isGecko)DOM.setStyle(id,'overflow','auto');if(!f.type){dw+=DOM.get(id+'_left').clientWidth;dw+=DOM.get(id+'_right').clientWidth;dh+=DOM.get(id+'_top').clientHeight;dh+=DOM.get(id+'_bottom').clientHeight;}DOM.setStyles(id,{top:f.top,left:f.left,width:f.width+dw,height:f.height+dh});u=f.url||f.file;if(u){if(tinymce.relaxedDomain)u+=(u.indexOf('?')==-1?'?':'&amp;')+'mce_rdomain='+tinymce.relaxedDomain;u=tinymce._addVer(u);}if(!f.type){DOM.add(id+'_content','iframe',{id:id+'_ifr',src:'javascript:&quot;&quot;',frameBorder:0,style:'border:0;width:10px;height:10px'});DOM.setStyles(id+'_ifr',{width:f.width,height:f.height});DOM.setAttrib(id+'_ifr','src',u);}else{DOM.add(id+'_wrapper','a',{id:id+'_ok','class':'mceButton mceOk',href:'javascript:;',onmousedown:'return false;'},'Ok');if(f.type=='confirm')DOM.add(id+'_wrapper','a',{'class':'mceButton mceCancel',href:'javascript:;',onmousedown:'return false;'},'Cancel');DOM.add(id+'_middle','div',{'class':'mceIcon'});DOM.setHTML(id+'_content',f.content.replace('\n','&lt;br /&gt;'));}mdf=Event.add(id,'mousedown',function(e){var n=e.target,w,vp;w=t.windows[id];t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){if(n.className=='mceMax'){w.oldPos=w.element.getXY();w.oldSize=w.element.getSize();vp=DOM.getViewPort();vp.w-=2;vp.h-=2;w.element.moveTo(vp.x,vp.y);w.element.resizeTo(vp.w,vp.h);DOM.setStyles(id+'_ifr',{width:vp.w-w.deltaWidth,height:vp.h-w.deltaHeight});DOM.addClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMed'){w.element.moveTo(w.oldPos.x,w.oldPos.y);w.element.resizeTo(w.oldSize.w,w.oldSize.h);w.iframeElement.resizeTo(w.oldSize.w-w.deltaWidth,w.oldSize.h-w.deltaHeight);DOM.removeClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMove')return t._startDrag(id,e,n.className);else if(DOM.hasClass(n,'mceResize'))return t._startDrag(id,e,n.className.substring(13));}});clf=Event.add(id,'click',function(e){var n=e.target;t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){switch(n.className){case'mceClose':t.close(null,id);return Event.cancel(e);case'mceButton mceOk':case'mceButton mceCancel':f.button_func(n.className=='mceButton mceOk');return Event.cancel(e);}}});t.windows=t.windows||{};w=t.windows[id]={id:id,mousedown_func:mdf,click_func:clf,element:new Element(id,{blocker:1,container:ed.getContainer()}),iframeElement:new Element(id+'_ifr'),features:f,deltaWidth:dw,deltaHeight:dh};w.iframeElement.on('focus',function(){t.focus(id);});if(t.count==0&amp;&amp;t.editor.getParam('dialog_type')=='modal'){DOM.add(DOM.doc.body,'div',{id:'mceModalBlocker','class':(t.editor.settings.inlinepopups_skin||'clearlooks2')+'_modalBlocker',style:{left:vp.x,top:vp.y,zIndex:t.zIndex-1}});DOM.show('mceModalBlocker');}else DOM.setStyle('mceModalBlocker','z-index',t.zIndex-1);if(tinymce.isIE6||(tinymce.isIE&amp;&amp;!DOM.boxModel))DOM.setStyles('mceModalBlocker',{position:'absolute',width:vp.w-2,height:vp.h-2});t.focus(id);t._fixIELayout(id,1);if(DOM.get(id+'_ok'))DOM.get(id+'_ok').focus();t.count++;return w;},focus:function(id){var t=this,w=t.windows[id];w.zIndex=this.zIndex++;w.element.setStyle('zIndex',w.zIndex);w.element.update();id=id+'_wrapper';DOM.removeClass(t.lastId,'mceFocus');DOM.addClass(id,'mceFocus');t.lastId=id;},_addAll:function(te,ne){var i,n,t=this,dom=tinymce.DOM;if(is(ne,'string'))te.appendChild(dom.doc.createTextNode(ne));else if(ne.length){te=te.appendChild(dom.create(ne[0],ne[1]));for(i=2;i&lt;ne.length;i++)t._addAll(te,ne[i]);}},_startDrag:function(id,se,ac){var t=this,mu,mm,d=DOM.doc,eb,w=t.windows[id],we=w.element,sp=we.getXY(),p,sz,ph,cp,vp,sx,sy,sex,sey,dx,dy,dw,dh;cp={x:0,y:0};vp=DOM.getViewPort();vp.w-=2;vp.h-=2;sex=se.screenX;sey=se.screenY;dx=dy=dw=dh=0;mu=Event.add(d,'mouseup',function(e){Event.remove(d,'mouseup',mu);Event.remove(d,'mousemove',mm);if(eb)eb.remove();we.moveBy(dx,dy);we.resizeBy(dw,dh);sz=we.getSize();DOM.setStyles(id+'_ifr',{width:sz.w-w.deltaWidth,height:sz.h-w.deltaHeight});t._fixIELayout(id,1);return Event.cancel(e);});if(ac!='Move')startMove();function startMove(){if(eb)return;t._fixIELayout(id,0);DOM.add(d.body,'div',{id:'mceEventBlocker','class':'mceEventBlocker '+(t.editor.settings.inlinepopups_skin||'clearlooks2'),style:{left:vp.x,top:vp.y,zIndex:t.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&amp;&amp;!DOM.boxModel))DOM.setStyles('mceEventBlocker',{position:'absolute',width:vp.w-2,height:vp.h-2});eb=new Element('mceEventBlocker');eb.update();p=we.getXY();sz=we.getSize();sx=cp.x+p.x-vp.x;sy=cp.y+p.y-vp.y;DOM.add(eb.get(),'div',{id:'mcePlaceHolder','class':'mcePlaceHolder',style:{left:sx,top:sy,width:sz.w,height:sz.h}});ph=new Element('mcePlaceHolder');};mm=Event.add(d,'mousemove',function(e){var x,y,v;startMove();x=e.screenX-sex;y=e.screenY-sey;switch(ac){case'ResizeW':dx=x;dw=0-x;break;case'ResizeE':dw=x;break;case'ResizeN':case'ResizeNW':case'ResizeNE':if(ac==&quot;ResizeNW&quot;){dx=x;dw=0-x;}else if(ac==&quot;ResizeNE&quot;)dw=x;dy=y;dh=0-y;break;case'ResizeS':case'ResizeSW':case'ResizeSE':if(ac==&quot;ResizeSW&quot;){dx=x;dw=0-x;}else if(ac==&quot;ResizeSE&quot;)dw=x;dh=y;break;case'mceMove':dx=x;dy=y;break;}if(dw&lt;(v=w.features.min_width-sz.w)){if(dx!==0)dx+=dw-v;dw=v;}if(dh&lt;(v=w.features.min_height-sz.h)){if(dy!==0)dy+=dh-v;dh=v;}dw=Math.min(dw,w.features.max_width-sz.w);dh=Math.min(dh,w.features.max_height-sz.h);dx=Math.max(dx,vp.x-(sx+vp.x));dy=Math.max(dy,vp.y-(sy+vp.y));dx=Math.min(dx,(vp.w+vp.x)-(sx+sz.w+vp.x));dy=Math.min(dy,(vp.h+vp.y)-(sy+sz.h+vp.y));if(dx+dy!==0){if(sx+dx&lt;0)dx=0;if(sy+dy&lt;0)dy=0;ph.moveTo(sx+dx,sy+dy);}if(dw+dh!==0)ph.resizeTo(sz.w+dw,sz.h+dh);return Event.cancel(e);});return Event.cancel(se);},resizeBy:function(dw,dh,id){var w=this.windows[id];if(w){w.element.resizeBy(dw,dh);w.iframeElement.resizeBy(dw,dh);}},close:function(win,id){var t=this,w,d=DOM.doc,ix=0,fw,id;id=t._findId(id||win);t.count--;if(t.count==0)DOM.remove('mceModalBlocker');if(!id&amp;&amp;win){t.parent(win);return;}if(w=t.windows[id]){t.onClose.dispatch(t);Event.remove(d,'mousedown',w.mousedownFunc);Event.remove(d,'click',w.clickFunc);Event.clear(id);Event.clear(id+'_ifr');DOM.setAttrib(id+'_ifr','src','javascript:&quot;&quot;');w.element.remove();delete t.windows[id];each(t.windows,function(w){if(w.zIndex&gt;ix){fw=w;ix=w.zIndex;}});if(fw)t.focus(fw.id);}},setTitle:function(w,ti){var e;w=this._findId(w);if(e=DOM.get(w+'_title'))e.innerHTML=DOM.encode(ti);},alert:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'alert',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},confirm:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'confirm',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},_findId:function(w){var t=this;if(typeof(w)=='string')return w;each(t.windows,function(wo){var ifr=DOM.get(wo.id+'_ifr');if(ifr&amp;&amp;w==ifr.contentWindow){w=wo.id;return false;}});return w;},_fixIELayout:function(id,s){var w,img;if(!tinymce.isIE6)return;each(['n','s','w','e','nw','ne','sw','se'],function(v){var e=DOM.get(id+'_resize_'+v);DOM.setStyles(e,{width:s?e.clientWidth:'',height:s?e.clientHeight:'',cursor:DOM.getStyle(e,'cursor',1)});DOM.setStyle(id+&quot;_bottom&quot;,'bottom','-1px');e=0;});if(w=this.windows[id]){w.element.hide();w.element.show();each(DOM.select('div,a',id),function(e,i){if(e.currentStyle.backgroundImage!='none'){img=new Image();img.src=e.currentStyle.backgroundImage.replace(/url\(\&quot;(.+)\&quot;\)/,'$1');}});DOM.get(id).style.filter='';}}});tinymce.PluginManager.add('inlinepopups',tinymce.plugins.InlinePopups);})();
\ No newline at end of file</diff>
      <filename>wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js</filename>
    </modified>
    <modified>
      <diff>@@ -8,6 +8,7 @@
 .clearlooks2 .mceWrapper {position:static}
 .mceEventBlocker {position:absolute; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%;}
 .clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; filter:alpha(opacity=50);}
+.clearlooks2_modalBlocker {position:absolute; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; filter:alpha(opacity=60); display:none}
 
 /* Top */
 .clearlooks2 .mceTop, 
@@ -57,69 +58,69 @@ color:#FFF
 }
 
 /* Middle */
-.clearlooks2 .mceMiddle, .clearlooks2 .mceMiddle div {top:0;}
-.clearlooks2 .mceMiddle {width:100%; height:100%; clip:rect(23px auto auto auto);}
-.clearlooks2 .mceMiddle .mceLeft {left:0; width:5px; height:100%; background:#E4F2FD;border-left:1px solid #c6d9e9;}
-.clearlooks2 .mceMiddle span {top:23px; left:5px; width:100%; height:100%; background:#FFF;}
-.clearlooks2 .mceMiddle .mceRight {right:0; width:5px; height:100%; background:#E4F2FD;border-right:1px solid #c6d9e9;}
+.clearlooks2 .mceMiddle, .clearlooks2 .mceMiddle div {top:0}
+.clearlooks2 .mceMiddle {width:100%; height:100%; clip:rect(23px auto auto auto)}
+.clearlooks2 .mceMiddle .mceLeft {left:0; width:5px; height:100%; background:#E4F2FD;border-left:1px solid #c6d9e9}
+.clearlooks2 .mceMiddle span {top:23px; left:5px; width:100%; height:100%; background:#FFF}
+.clearlooks2 .mceMiddle .mceRight {right:0; width:5px; height:100%; background:#E4F2FD;border-right:1px solid #c6d9e9}
 
 /* Bottom */
-.clearlooks2 .mceBottom, .clearlooks2 .mceBottom div {height:6px;}
-.clearlooks2 .mceBottom {left:0; bottom:0; width:100%;background:#E4F2FD;border-bottom:1px solid #c6d9e9;}
-.clearlooks2 .mceBottom div {top:0;}
-.clearlooks2 .mceBottom .mceLeft {left:0; width:5px; background:#E4F2FD  ;border-left:1px solid #c6d9e9;}
-.clearlooks2 .mceBottom .mceCenter {left:5px; width:100%;}
-.clearlooks2 .mceBottom .mceRight {right:0; width:6px; background:#E4F2FD url(img/drag.gif) no-repeat;border-right:1px solid #c6d9e9;}
-.clearlooks2 .mceBottom span {display:none;}
-.clearlooks2 .mceStatusbar .mceBottom, .clearlooks2 .mceStatusbar .mceBottom div {height:23px;}
-.clearlooks2 .mceStatusbar .mceBottom .mceLeft {background:url(img/corners.gif) -29px 0;}
-.clearlooks2 .mceStatusbar .mceBottom .mceCenter {background:url(img/horizontal.gif) 0 -52px;}
-.clearlooks2 .mceStatusbar .mceBottom .mceRight {background:url(img/corners.gif) -24px 0;}
-.clearlooks2 .mceStatusbar .mceBottom span {display:block; left:7px; font-family:Arial, Verdana; font-size:11px; line-height:23px;}
+.clearlooks2 .mceBottom, .clearlooks2 .mceBottom div {height:6px}
+.clearlooks2 .mceBottom {left:0; bottom:0; width:100%;background:#E4F2FD;border-bottom:1px solid #c6d9e9}
+.clearlooks2 .mceBottom div {top:0}
+.clearlooks2 .mceBottom .mceLeft {left:0; width:5px; background:#E4F2FD  ;border-left:1px solid #c6d9e9}
+.clearlooks2 .mceBottom .mceCenter {left:5px; width:100%}
+.clearlooks2 .mceBottom .mceRight {right:0; width:6px; background:#E4F2FD url(img/drag.gif) no-repeat;border-right:1px solid #c6d9e9}
+.clearlooks2 .mceBottom span {display:none}
+.clearlooks2 .mceStatusbar .mceBottom, .clearlooks2 .mceStatusbar .mceBottom div {height:23px}
+.clearlooks2 .mceStatusbar .mceBottom .mceLeft {background:url(img/corners.gif) -29px 0}
+.clearlooks2 .mceStatusbar .mceBottom .mceCenter {background:url(img/horizontal.gif) 0 -52px}
+.clearlooks2 .mceStatusbar .mceBottom .mceRight {background:url(img/corners.gif) -24px 0}
+.clearlooks2 .mceStatusbar .mceBottom span {display:block; left:7px; font-family:Arial, Verdana; font-size:11px; line-height:23px}
 
 /* Actions */
-.clearlooks2 a {width:29px; height:16px; top:3px;}
-.clearlooks2 .mceClose {right:6px; background:url(img/buttons.gif) -87px 0;}
-.clearlooks2 .mceMin {display:none; right:68px; background:url(img/buttons.gif) 0 0;}
-.clearlooks2 .mceMed {display:none; right:37px; background:url(img/buttons.gif) -29px 0;}
-.clearlooks2 .mceMax {display:none; right:37px; background:url(img/buttons.gif) -58px 0;}
-.clearlooks2 .mceMove {display:none;width:100%;cursor:move;background:url(img/corners.gif) no-repeat -100px -100px;}
-.clearlooks2 .mceMovable .mceMove {display:block;}
-.clearlooks2 .mceFocus .mceClose {right:6px; background:url(img/buttons.gif) -87px -16px;}
-.clearlooks2 .mceFocus .mceMin {right:68px; background:url(img/buttons.gif) 0 -16px;}
-.clearlooks2 .mceFocus .mceMed {right:37px; background:url(img/buttons.gif) -29px -16px;}
-.clearlooks2 .mceFocus .mceMax {right:37px; background:url(img/buttons.gif) -58px -16px;}
-.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px;}
-.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px;}
-.clearlooks2 .mceFocus .mceMin:hover {right:68px; background:url(img/buttons.gif) 0 -32px;}
-.clearlooks2 .mceFocus .mceMed:hover {right:37px; background:url(img/buttons.gif) -29px -32px;}
-.clearlooks2 .mceFocus .mceMax:hover {right:37px; background:url(img/buttons.gif) -58px -32px;}
+.clearlooks2 a {width:29px; height:16px; top:3px}
+.clearlooks2 .mceClose {right:6px; background:url(img/buttons.gif) -87px 0}
+.clearlooks2 .mceMin {display:none; right:68px; background:url(img/buttons.gif) 0 0}
+.clearlooks2 .mceMed {display:none; right:37px; background:url(img/buttons.gif) -29px 0}
+.clearlooks2 .mceMax {display:none; right:37px; background:url(img/buttons.gif) -58px 0}
+.clearlooks2 .mceMove {display:none;width:100%;cursor:move;background:url(img/corners.gif) no-repeat -100px -100px}
+.clearlooks2 .mceMovable .mceMove {display:block}
+.clearlooks2 .mceFocus .mceClose {right:6px; background:url(img/buttons.gif) -87px -16px}
+.clearlooks2 .mceFocus .mceMin {right:68px; background:url(img/buttons.gif) 0 -16px}
+.clearlooks2 .mceFocus .mceMed {right:37px; background:url(img/buttons.gif) -29px -16px}
+.clearlooks2 .mceFocus .mceMax {right:37px; background:url(img/buttons.gif) -58px -16px}
+.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px}
+.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px}
+.clearlooks2 .mceFocus .mceMin:hover {right:68px; background:url(img/buttons.gif) 0 -32px}
+.clearlooks2 .mceFocus .mceMed:hover {right:37px; background:url(img/buttons.gif) -29px -32px}
+.clearlooks2 .mceFocus .mceMax:hover {right:37px; background:url(img/buttons.gif) -58px -32px}
 
 /* Resize */
-.clearlooks2 .mceResize {top:auto; left:auto; display:none; width:5px; height:5px; background:url(img/horizontal.gif) no-repeat 0 -75px;}
-.clearlooks2 .mceResizable .mceResize {display:block;}
-.clearlooks2 .mceResizable .mceMin, .clearlooks2 .mceMax {display:none;}
-.clearlooks2 .mceMinimizable .mceMin {display:block;}
-.clearlooks2 .mceMaximizable .mceMax {display:block;}
-.clearlooks2 .mceMaximized .mceMed {display:block;}
-.clearlooks2 .mceMaximized .mceMax {display:none;}
-.clearlooks2 a.mceResizeN {top:0; left:0; width:100%; cursor:n-resize;}
-.clearlooks2 a.mceResizeNW {top:0; left:0; cursor:nw-resize;}
+.clearlooks2 .mceResize {top:auto; left:auto; display:none; width:5px; height:5px; background:url(img/horizontal.gif) no-repeat 0 -75px}
+.clearlooks2 .mceResizable .mceResize {display:block}
+.clearlooks2 .mceResizable .mceMin, .clearlooks2 .mceMax {display:none}
+.clearlooks2 .mceMinimizable .mceMin {display:block}
+.clearlooks2 .mceMaximizable .mceMax {display:block}
+.clearlooks2 .mceMaximized .mceMed {display:block}
+.clearlooks2 .mceMaximized .mceMax {display:none}
+.clearlooks2 a.mceResizeN {top:0; left:0; width:100%; cursor:n-resize}
+.clearlooks2 a.mceResizeNW {top:0; left:0; cursor:nw-resize}
 .clearlooks2 a.mceResizeNE {top:0; right:0; cursor:ne-resize}
-.clearlooks2 a.mceResizeW {top:0; left:0; height:100%; cursor:w-resize;}
-.clearlooks2 a.mceResizeE {top:0; right:0; height:100%; cursor:e-resize;}
+.clearlooks2 a.mceResizeW {top:0; left:0; height:100%; cursor:w-resize}
+.clearlooks2 a.mceResizeE {top:0; right:0; height:100%; cursor:e-resize}
 .clearlooks2 a.mceResizeS {bottom:0; left:0; width:100%; cursor:s-resize}
-.clearlooks2 a.mceResizeSW {bottom:0; left:0; cursor:sw-resize;}
-.clearlooks2 a.mceResizeSE {bottom:0; right:0; cursor:se-resize;}
+.clearlooks2 a.mceResizeSW {bottom:0; left:0; cursor:sw-resize}
+.clearlooks2 a.mceResizeSE {bottom:0; right:0; cursor:se-resize}
 
 /* Alert/Confirm */
-.clearlooks2 .mceButton {font-weight:bold; bottom:10px; width:80px; height:30px; background:url(img/button.gif); line-height:30px; vertical-align:middle; text-align:center; outline:0;}
-.clearlooks2 .mceMiddle .mceIcon {left:15px; top:35px; width:32px; height:32px;}
-.clearlooks2 .mceAlert .mceMiddle span, .clearlooks2 .mceConfirm .mceMiddle span {background:transparent;left:60px; top:35px; width:320px; height:50px; font-weight:bold; overflow:auto; white-space:normal;}
-.clearlooks2 a:hover {font-weight:bold;}
-.clearlooks2 .mceAlert .mceMiddle, .clearlooks2 .mceConfirm .mceMiddle {background:#E4F2FD;}
-.clearlooks2 .mceAlert .mceOk {left:50%; top:auto; margin-left: -40px;}
-.clearlooks2 .mceAlert .mceIcon {background:url(img/alert.gif);}
-.clearlooks2 .mceConfirm .mceOk {left:50%; top:auto; margin-left: -90px;}
-.clearlooks2 .mceConfirm .mceCancel {left:50%; top:auto;}
-.clearlooks2 .mceConfirm .mceIcon {background:url(img/confirm.gif);}
+.clearlooks2 .mceButton {font-weight:bold; bottom:10px; width:80px; height:30px; background:url(img/button.gif); line-height:30px; vertical-align:middle; text-align:center; outline:0}
+.clearlooks2 .mceMiddle .mceIcon {left:15px; top:35px; width:32px; height:32px}
+.clearlooks2 .mceAlert .mceMiddle span, .clearlooks2 .mceConfirm .mceMiddle span {background:transparent;left:60px; top:35px; width:320px; height:50px; font-weight:bold; overflow:auto; white-space:normal}
+.clearlooks2 a:hover {font-weight:bold}
+.clearlooks2 .mceAlert .mceMiddle, .clearlooks2 .mceConfirm .mceMiddle {background:#E4F2FD}
+.clearlooks2 .mceAlert .mceOk {left:50%; top:auto; margin-left: -40px}
+.clearlooks2 .mceAlert .mceIcon {background:url(img/alert.gif)}
+.clearlooks2 .mceConfirm .mceOk {left:50%; top:auto; margin-left: -90px}
+.clearlooks2 .mceConfirm .mceCancel {left:50%; top:auto}
+.clearlooks2 .mceConfirm .mceIcon {background:url(img/confirm.gif)}</diff>
      <filename>wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@
 &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
 &lt;head&gt;
 &lt;title&gt;Template for dialogs&lt;/title&gt;
-&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;skins/clearlooks2/window.css&quot; /&gt;
+&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;skins/clearlooks2/window.css?ver=311&quot; /&gt;
 &lt;/head&gt;
 &lt;body&gt;
 </diff>
      <filename>wp-includes/js/tinymce/plugins/inlinepopups/template.htm</filename>
    </modified>
    <modified>
      <diff>@@ -1,68 +1,16 @@
-#id, #name, #hspace, #vspace, #class_name, #align {
-	width: 100px;
-}
-
-#hspace, #vspace {
-	width: 50px;
-}
-
-#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode {
-	width: 100px;
-}
-
-#flash_base, #flash_flashvars {
-	width: 240px;
-}
-
-#width, #height {
-	width: 40px;
-}
-
-#src, #media_type {
-	width: 250px;
-}
-
-#class {
-	width: 120px;
-}
-
-#prev {
-	margin: 0;
-	border: 1px solid black;
-	width: 99%;
-	height: 230px;
-	overflow: auto;
-}
-
-.panel_wrapper div.current {
-	height: 390px;
-	overflow: auto;
-}
-
-#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options {
-	display: none;
-}
-
-.mceAddSelectValue {
-	background-color: #DDDDDD;
-}
-
-#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume {
-	width: 70px;
-}
-
-#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume {
-	width: 70px;
-}
-
-#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks {
-	width: 70px;
-}
-
-#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle {
-	width: 90px;
-}
-
-#qt_qtsrc {
-	width: 200px;
-}
+#id, #name, #hspace, #vspace, #class_name, #align {	width: 100px }
+#hspace, #vspace { width: 50px }
+#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { width: 100px }
+#flash_base, #flash_flashvars { width: 240px }
+#width, #height { width: 40px }
+#src, #media_type { width: 250px }
+#class { width: 120px }
+#prev { margin: 0; border: 1px solid black; width: 380px; height: 230px; overflow: auto }
+.panel_wrapper div.current { height: 390px; overflow: auto }
+#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { display: none }
+.mceAddSelectValue { background-color: #DDDDDD }
+#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { width: 70px }
+#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { width: 70px }
+#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { width: 70px }
+#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { width: 90px }
+#qt_qtsrc { width: 200px }</diff>
      <filename>wp-includes/js/tinymce/plugins/media/css/media.css</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1 @@
-(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&amp;&amp;isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};if(ed.settings.content_css!==false)ed.dom.loadCSS(url+&quot;/css/content.css&quot;);if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&amp;&amp;ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&amp;&amp;/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(function(ed,o){var h=o.content;h=h.replace(/&lt;script[^&gt;]*&gt;\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*&lt;\/script&gt;/gi,function(a,b,c){var o=t._parse(c);return'&lt;img class=&quot;mceItem'+b+'&quot; title=&quot;'+ed.dom.encode(c)+'&quot; src=&quot;'+url+'/img/trans.gif&quot; width=&quot;'+o.width+'&quot; height=&quot;'+o.height+'&quot; /&gt;'});h=h.replace(/&lt;object([^&gt;]*)&gt;/gi,'&lt;span class=&quot;mceItemObject&quot; $1&gt;');h=h.replace(/&lt;embed([^&gt;]*)&gt;/gi,'&lt;span class=&quot;mceItemEmbed&quot; $1&gt;');h=h.replace(/&lt;\/(object|embed)([^&gt;]*)&gt;/gi,'&lt;/span&gt;');h=h.replace(/&lt;param([^&gt;]*)&gt;/gi,function(a,b){return'&lt;span '+b.replace(/value=/gi,'_value=')+' class=&quot;mceItemParam&quot;&gt;&lt;/span&gt;'});h=h.replace(/\/ class=\&quot;mceItemParam\&quot;&gt;&lt;\/span&gt;/gi,'class=&quot;mceItemParam&quot;&gt;&lt;/span&gt;');o.content=h;});ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166b1bca-3f9c-11cf-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=ed.getParam('media_wmp6_compatible')?'05589fa1-c356-11ce-bf01-00aa0055595a':'6bf52a52-394a-11d3-b153-00c04f79faa6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02bf25d5-8c17-4b23-bc80-d3488abddc6b';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='cfcdaa03-8be4-11cf-b84b-0020afbbccfa';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\&quot;([^\&quot;]+)\&quot;','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/&lt;img[^&gt;]+&gt;/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='&lt;script type=&quot;text/javascript&quot;&gt;write'+cl.substring(7)+'({'+t._serialize(at)+'});&lt;/script&gt;';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+&quot;.&quot;+tinymce.minorVersion};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:&quot;clsid:&quot;+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src){p.src=ed.convertURL(p.src,'src',n);if(o.type=='application/x-mplayer2'){p.url=p.src;delete p.src;}}each(p,function(v,k){if(!/^(width|height|codebase|classid)$/.test(k))dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,&quot;classid&quot;).toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})();
\ No newline at end of file
+(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.onPreInit.add(function(){ed.serializer.addRules('param[name|value|_value]');});ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&amp;&amp;isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};if(ed.settings.content_css!==false)ed.dom.loadCSS(url+&quot;/css/content.css&quot;);if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&amp;&amp;ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&amp;&amp;/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(function(ed,o){var h=o.content;h=h.replace(/&lt;script[^&gt;]*&gt;\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*&lt;\/script&gt;/gi,function(a,b,c){var o=t._parse(c);return'&lt;img class=&quot;mceItem'+b+'&quot; title=&quot;'+ed.dom.encode(c)+'&quot; src=&quot;'+url+'/img/trans.gif&quot; width=&quot;'+o.width+'&quot; height=&quot;'+o.height+'&quot; /&gt;'});h=h.replace(/&lt;object([^&gt;]*)&gt;/gi,'&lt;span class=&quot;mceItemObject&quot; $1&gt;');h=h.replace(/&lt;embed([^&gt;]*)\/?&gt;/gi,'&lt;span class=&quot;mceItemEmbed&quot; $1&gt;&lt;/span&gt;');h=h.replace(/&lt;embed([^&gt;]*)&gt;/gi,'&lt;span class=&quot;mceItemEmbed&quot; $1&gt;');h=h.replace(/&lt;\/(object)([^&gt;]*)&gt;/gi,'&lt;/span&gt;');h=h.replace(/&lt;\/embed&gt;/gi,'');h=h.replace(/&lt;param([^&gt;]*)&gt;/gi,function(a,b){return'&lt;span '+b.replace(/value=/gi,'_value=')+' class=&quot;mceItemParam&quot;&gt;&lt;/span&gt;'});h=h.replace(/\/ class=\&quot;mceItemParam\&quot;&gt;&lt;\/span&gt;/gi,'class=&quot;mceItemParam&quot;&gt;&lt;/span&gt;');o.content=h;});ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166b1bca-3f9c-11cf-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=ed.getParam('media_wmp6_compatible')?'05589fa1-c356-11ce-bf01-00aa0055595a':'6bf52a52-394a-11d3-b153-00c04f79faa6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02bf25d5-8c17-4b23-bc80-d3488abddc6b';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='cfcdaa03-8be4-11cf-b84b-0020afbbccfa';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\&quot;([^\&quot;]+)\&quot;','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/&lt;img[^&gt;]+&gt;/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='&lt;script type=&quot;text/javascript&quot;&gt;write'+cl.substring(7)+'({'+t._serialize(at)+'});&lt;/script&gt;';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+&quot;.&quot;+tinymce.minorVersion};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:&quot;clsid:&quot;+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid)$/.test(k)){if(o.type=='application/x-mplayer2'&amp;&amp;k=='src')k='url';dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});}});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,&quot;classid&quot;).toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})();
\ No newline at end of file</diff>
      <filename>wp-includes/js/tinymce/plugins/media/editor_plugin.js</filename>
    </modified>
    <modified>
      <diff>@@ -598,14 +598,17 @@ function generatePreview(c) {
 	pl.name = !pl.name ? 'eobj' : pl.name;
 	pl.align = !pl.align ? '' : pl.align;
 
-	h += '&lt;object classid=&quot;clsid:' + cls + '&quot; codebase=&quot;' + codebase + '&quot; width=&quot;' + pl.width + '&quot; height=&quot;' + pl.height + '&quot; id=&quot;' + pl.id + '&quot; name=&quot;' + pl.name + '&quot; align=&quot;' + pl.align + '&quot;&gt;';
+	// Avoid annoying warning about insecure items
+	if (!tinymce.isIE || document.location.protocol != 'https:') {
+		h += '&lt;object classid=&quot;clsid:' + cls + '&quot; codebase=&quot;' + codebase + '&quot; width=&quot;' + pl.width + '&quot; height=&quot;' + pl.height + '&quot; id=&quot;' + pl.id + '&quot; name=&quot;' + pl.name + '&quot; align=&quot;' + pl.align + '&quot;&gt;';
 
-	for (n in pl) {
-		h += '&lt;param name=&quot;' + n + '&quot; value=&quot;' + pl[n] + '&quot;&gt;';
+		for (n in pl) {
+			h += '&lt;param name=&quot;' + n + '&quot; value=&quot;' + pl[n] + '&quot;&gt;';
 
-		// Add extra url parameter if it's an absolute URL
-		if (n == 'src' &amp;&amp; pl[n].indexOf('://') != -1)
-			h += '&lt;param name=&quot;url&quot; value=&quot;' + pl[n] + '&quot; /&gt;';
+			// Add extra url parameter if it's an absolute URL
+			if (n == 'src' &amp;&amp; pl[n].indexOf('://') != -1)
+				h += '&lt;param name=&quot;url&quot; value=&quot;' + pl[n] + '&quot; /&gt;';
+		}
 	}
 
 	h += '&lt;embed type=&quot;' + type + '&quot; ';
@@ -613,7 +616,11 @@ function generatePreview(c) {
 	for (n in pl)
 		h += n + '=&quot;' + pl[n] + '&quot; ';
 
-	h += '&gt;&lt;/embed&gt;&lt;/object&gt;';
+	h += '&gt;&lt;/embed&gt;';
+
+	// Avoid annoying warning about insecure items
+	if (!tinymce.isIE || document.location.protocol != 'https:')
+		h += '&lt;/object&gt;';
 
 	p.innerHTML = &quot;&lt;!-- x ---&gt;&quot; + h;
 }</diff>
      <filename>wp-includes/js/tinymce/plugins/media/js/media.js</filename>
    </modified>
    <modified>
      <diff>@@ -2,13 +2,13 @@
 &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
 &lt;head&gt;
 	&lt;title&gt;{#media_dlg.title}&lt;/title&gt;
-	&lt;script type=&quot;text/javascript&quot; src=&quot;../../tiny_mce_popup.js&quot;&gt;&lt;/script&gt;
-	&lt;script type=&quot;text/javascript&quot; src=&quot;js/media.js&quot;&gt;&lt;/script&gt;
-	&lt;script type=&quot;text/javascript&quot; src=&quot;../../utils/mctabs.js&quot;&gt;&lt;/script&gt;
-	&lt;script type=&quot;text/javascript&quot; src=&quot;../../utils/validate.js&quot;&gt;&lt;/script&gt;
-	&lt;script type=&quot;text/javascript&quot; src=&quot;../../utils/form_utils.js&quot;&gt;&lt;/script&gt;
-	&lt;script type=&quot;text/javascript&quot; src=&quot;../../utils/editable_selects.js&quot;&gt;&lt;/script&gt;
-	&lt;link href=&quot;css/media.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
+	&lt;script type=&quot;text/javascript&quot; src=&quot;../../tiny_mce_popup.js?ver=311&quot;&gt;&lt;/script&gt;
+	&lt;script type=&quot;text/javascript&quot; src=&quot;js/media.js?ver=311&quot;&gt;&lt;/script&gt;
+	&lt;script type=&quot;text/javascript&quot; src=&quot;../../utils/mctabs.js?ver=311&quot;&gt;&lt;/script&gt;
+	&lt;script type=&quot;text/javascript&quot; src=&quot;../../utils/validate.js?ver=311&quot;&gt;&lt;/script&gt;
+	&lt;script type=&quot;text/javascript&quot; src=&quot;../../utils/form_utils.js?ver=311&quot;&gt;&lt;/script&gt;
+	&lt;script type=&quot;text/javascript&quot; src=&quot;../../utils/editable_selects.js?ver=311&quot;&gt;&lt;/script&gt;
+	&lt;link href=&quot;css/media.css?ver=311&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
 	&lt;base target=&quot;_self&quot; /&gt;
 &lt;/head&gt;
 &lt;body style=&quot;display: none&quot;&gt;</diff>
      <filename>wp-includes/js/tinymce/plugins/media/media.htm</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@
 &lt;head&gt;
 &lt;title&gt;blank_page&lt;/title&gt;
 &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
-&lt;link href=&quot;css/blank.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
+&lt;link href=&quot;css/blank.css?ver=311&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
 &lt;base target=&quot;_self&quot; /&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;
 function init() {</diff>
      <filename>wp-includes/js/tinymce/plugins/paste/blank.htm</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1 @@
-(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(clipboardData.getData(&quot;Text&quot;),true);}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(t._clipboardHTML());}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam(&quot;paste_auto_cleanup_on_paste&quot;,false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&amp;&amp;ed.getParam(&quot;paste_auto_cleanup_on_paste&quot;,false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&amp;&amp;e.keyCode==86){window.setTimeout(function(){ed.execCommand(&quot;mcePasteText&quot;,true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+&quot;.&quot;+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&amp;&amp;(r=sel.getRng())&amp;&amp;r.text.length&gt;0)ed.execCommand('delete');if(html&amp;&amp;html.length&gt;0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){if(content&amp;&amp;content.length&gt;0){if(bLinebreaks){if(this.editor.getParam(&quot;paste_create_paragraphs&quot;,true)){var rl=this.editor.getParam(&quot;paste_replace_list&quot;,'\u2122,&lt;sup&gt;TM&lt;/sup&gt;,\u2026,...,\u201c|\u201d,&quot;,\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i&lt;rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);content=content.replace(/\r\n\r\n/g,'&lt;/p&gt;&lt;p&gt;');content=content.replace(/\r\r/g,'&lt;/p&gt;&lt;p&gt;');content=content.replace(/\n\n/g,'&lt;/p&gt;&lt;p&gt;');if((pos=content.indexOf('&lt;/p&gt;&lt;p&gt;'))!=-1){this.editor.execCommand(&quot;Delete&quot;);var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName==&quot;TD&quot;||node.nodeName==&quot;BODY&quot;)break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before=&quot;&quot;,after=&quot;&lt;/p&gt;&quot;;before+=content.substring(0,pos);for(var i=0;i&lt;breakElms.length;i++){before+=&quot;&lt;/&quot;+breakElms[i].nodeName+&quot;&gt;&quot;;after+=&quot;&lt;&quot;+breakElms[(breakElms.length-1)-i].nodeName+&quot;&gt;&quot;;}before+=&quot;&lt;p&gt;&quot;;content=before+content.substring(pos+7)+after;}}if(this.editor.getParam(&quot;paste_create_linebreaks&quot;,true)){content=content.replace(/\r\n/g,'&lt;br /&gt;');content=content.replace(/\r/g,'&lt;br /&gt;');content=content.replace(/\n/g,'&lt;br /&gt;');}}this.editor.execCommand(&quot;mceInsertRawHTML&quot;,false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&amp;&amp;content.length&gt;0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam(&quot;paste_replace_list&quot;,'\u2122,&lt;sup&gt;TM&lt;/sup&gt;,\u2026,...,\u201c|\u201d,&quot;,\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i&lt;rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);if(this.editor.getParam(&quot;paste_convert_headers_to_strong&quot;,false)){content=content.replace(new RegExp('&lt;p class=MsoHeading.*?&gt;(.*?)&lt;\/p&gt;','gi'),'&lt;p&gt;&lt;b&gt;$1&lt;/b&gt;&lt;/p&gt;');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt&quot;&gt;','gi'),'&quot;&gt;'+&quot;--list--&quot;);content=content.replace(new RegExp(bull+&quot;(.*?)&lt;BR&gt;&quot;,&quot;gi&quot;),&quot;&lt;p&gt;&quot;+middot+&quot;$1&lt;/p&gt;&quot;);content=content.replace(new RegExp('&lt;SPAN style=&quot;mso-list: Ignore&quot;&gt;','gi'),&quot;&lt;span&gt;&quot;+bull);content=content.replace(/&lt;o:p&gt;&lt;\/o:p&gt;/gi,&quot;&quot;);content=content.replace(new RegExp('&lt;br style=&quot;page-break-before: always;.*&gt;','gi'),'-- page break --');content=content.replace(new RegExp('&lt;(!--)([^&gt;]*)(--)&gt;','g'),&quot;&quot;);if(this.editor.getParam(&quot;paste_remove_spans&quot;,true))content=content.replace(/&lt;\/?span[^&gt;]*&gt;/gi,&quot;&quot;);if(this.editor.getParam(&quot;paste_remove_styles&quot;,true))content=content.replace(new RegExp('&lt;(\\w[^&gt;]*) style=&quot;([^&quot;]*)&quot;([^&gt;]*)','gi'),&quot;&lt;$1$3&quot;);content=content.replace(/&lt;\/?font[^&gt;]*&gt;/gi,&quot;&quot;);switch(this.editor.getParam(&quot;paste_strip_class_attributes&quot;,&quot;all&quot;)){case&quot;all&quot;:content=content.replace(/&lt;(\w[^&gt;]*) class=([^ |&gt;]*)([^&gt;]*)/gi,&quot;&lt;$1$3&quot;);break;case&quot;mso&quot;:content=content.replace(new RegExp('&lt;(\\w[^&gt;]*) class=&quot;?mso([^ |&gt;]*)([^&gt;]*)','gi'),&quot;&lt;$1$3&quot;);break;}content=content.replace(new RegExp('href=&quot;?'+this._reEscape(&quot;&quot;+document.location)+'','gi'),'href=&quot;'+this.editor.documentBaseURI.getURI());content=content.replace(/&lt;(\w[^&gt;]*) lang=([^ |&gt;]*)([^&gt;]*)/gi,&quot;&lt;$1$3&quot;);content=content.replace(/&lt;\\?\?xml[^&gt;]*&gt;/gi,&quot;&quot;);content=content.replace(/&lt;\/?\w+:[^&gt;]*&gt;/gi,&quot;&quot;);content=content.replace(/-- page break --\s*&lt;p&gt;&amp;nbsp;&lt;\/p&gt;/gi,&quot;&quot;);content=content.replace(/-- page break --/gi,&quot;&quot;);if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('&lt;/p&gt;','&lt;br /&gt;&lt;br /&gt;','gi');}if(!tinymce.isIE&amp;&amp;!this.editor.getParam('force_p_newlines')){content=content.replace(/&lt;\/?p[^&gt;]*&gt;/gi,&quot;&quot;);}content=content.replace(/&lt;\/?div[^&gt;]*&gt;/gi,&quot;&quot;);if(this.editor.getParam(&quot;paste_convert_middot_lists&quot;,true)){var div=ed.dom.create(&quot;div&quot;,null,content);var className=this.editor.getParam(&quot;paste_unindented_list_class&quot;,&quot;unIndentedList&quot;);while(this._convertMiddots(div,&quot;--list--&quot;));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam(&quot;paste_convert_headers_to_strong&quot;,false)){content=content.replace(/&lt;h[1-6]&gt;&amp;nbsp;&lt;\/h[1-6]&gt;/gi,'&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;');content=content.replace(/&lt;h[1-6]&gt;/gi,'&lt;p&gt;&lt;b&gt;');content=content.replace(/&lt;\/h[1-6]&gt;/gi,'&lt;/b&gt;&lt;/p&gt;');content=content.replace(/&lt;b&gt;&amp;nbsp;&lt;\/b&gt;/gi,'&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;');content=content.replace(/^(&amp;nbsp;)*/gi,'');}content=content.replace(/--list--/gi,&quot;&quot;);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand(&quot;mceInsertContent&quot;,false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand(&quot;mceCleanup&quot;);},1);}}},_reEscape:function(s){var l=&quot;?.\\*[](){}+^$:&quot;;var o=&quot;&quot;;for(var i=0;i&lt;s.length;i++){var c=s.charAt(i);if(l.indexOf(c)!=-1)o+='\\'+c;else o+=c;}return o;},_convertMiddots:function(div,search,class_name){var ed=this.editor,mdot=String.fromCharCode(183),bull=String.fromCharCode(8226);var nodes,prevul,i,p,ul,li,np,cp,li;nodes=div.getElementsByTagName(&quot;p&quot;);for(i=0;i&lt;nodes.length;i++){p=nodes[i];if(p.innerHTML.indexOf(search)==0){ul=ed.dom.create(&quot;ul&quot;);if(class_name)ul.className=class_name;li=ed.dom.create(&quot;li&quot;);li.innerHTML=p.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--|&amp;nbsp;',&quot;gi&quot;),'');ul.appendChild(li);np=p.nextSibling;while(np){if(np.nodeType==3&amp;&amp;new RegExp('^\\s$','m').test(np.nodeValue)){np=np.nextSibling;continue;}if(search==mdot){if(np.nodeType==1&amp;&amp;new RegExp('^o(\\s+|&amp;nbsp;)').test(np.innerHTML)){if(!prevul){prevul=ul;ul=ed.dom.create(&quot;ul&quot;);prevul.appendChild(ul);}np.innerHTML=np.innerHTML.replace(/^o/,'');}else{if(prevul){ul=prevul;prevul=null;}if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}}else{if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}cp=np.nextSibling;li=ed.dom.create(&quot;li&quot;);li.innerHTML=np.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--|&amp;nbsp;',&quot;gi&quot;),'');np.parentNode.removeChild(np);ul.appendChild(li);np=cp;}p.parentNode.replaceChild(ul,p);return true;}}return false;},_clipboardHTML:function(){var div=document.getElementById('_TinyMCE_clipboardHTML');if(!div){var div=document.createElement('DIV');div.id='_TinyMCE_clipboardHTML';with(div.style){visibility='hidden';overflow='hidden';position='absolute';width=1;height=1;}document.body.appendChild(div);}div.innerHTML='';var rng=document.body.createTextRange();rng.moveToElementText(div);rng.execCommand('Paste');var html=div.innerHTML;div.innerHTML='';return html;}});tinymce.PluginManager.add('paste',tinymce.plugins.PastePlugin);})();
\ No newline at end of file
+(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(clipboardData.getData(&quot;Text&quot;),true);}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(t._clipboardHTML());}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam(&quot;paste_auto_cleanup_on_paste&quot;,false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&amp;&amp;ed.getParam(&quot;paste_auto_cleanup_on_paste&quot;,false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&amp;&amp;e.keyCode==86){window.setTimeout(function(){ed.execCommand(&quot;mcePasteText&quot;,true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+&quot;.&quot;+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&amp;&amp;(r=sel.getRng())&amp;&amp;r.text.length&gt;0)ed.execCommand('delete');if(html&amp;&amp;html.length&gt;0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){content=this.editor.dom.encode(content);if(content&amp;&amp;content.length&gt;0){if(bLinebreaks){if(this.editor.getParam(&quot;paste_create_paragraphs&quot;,true)){var rl=this.editor.getParam(&quot;paste_replace_list&quot;,'\u2122,&lt;sup&gt;TM&lt;/sup&gt;,\u2026,...,\u201c|\u201d,&quot;,\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i&lt;rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);content=content.replace(/\r\n\r\n/g,'&lt;/p&gt;&lt;p&gt;');content=content.replace(/\r\r/g,'&lt;/p&gt;&lt;p&gt;');content=content.replace(/\n\n/g,'&lt;/p&gt;&lt;p&gt;');if((pos=content.indexOf('&lt;/p&gt;&lt;p&gt;'))!=-1){this.editor.execCommand(&quot;Delete&quot;);var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName==&quot;TD&quot;||node.nodeName==&quot;BODY&quot;)break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before=&quot;&quot;,after=&quot;&lt;/p&gt;&quot;;before+=content.substring(0,pos);for(var i=0;i&lt;breakElms.length;i++){before+=&quot;&lt;/&quot;+breakElms[i].nodeName+&quot;&gt;&quot;;after+=&quot;&lt;&quot;+breakElms[(breakElms.length-1)-i].nodeName+&quot;&gt;&quot;;}before+=&quot;&lt;p&gt;&quot;;content=before+content.substring(pos+7)+after;}}if(this.editor.getParam(&quot;paste_create_linebreaks&quot;,true)){content=content.replace(/\r\n/g,'&lt;br /&gt;');content=content.replace(/\r/g,'&lt;br /&gt;');content=content.replace(/\n/g,'&lt;br /&gt;');}}this.editor.execCommand(&quot;mceInsertRawHTML&quot;,false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&amp;&amp;content.length&gt;0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam(&quot;paste_replace_list&quot;,'\u2122,&lt;sup&gt;TM&lt;/sup&gt;,\u2026,...,\u201c|\u201d,&quot;,\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i&lt;rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);if(this.editor.getParam(&quot;paste_convert_headers_to_strong&quot;,false)){content=content.replace(new RegExp('&lt;p class=MsoHeading.*?&gt;(.*?)&lt;\/p&gt;','gi'),'&lt;p&gt;&lt;b&gt;$1&lt;/b&gt;&lt;/p&gt;');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt&quot;&gt;','gi'),'&quot;&gt;'+&quot;--list--&quot;);content=content.replace(new RegExp(bull+&quot;(.*?)&lt;BR&gt;&quot;,&quot;gi&quot;),&quot;&lt;p&gt;&quot;+middot+&quot;$1&lt;/p&gt;&quot;);content=content.replace(new RegExp('&lt;SPAN style=&quot;mso-list: Ignore&quot;&gt;','gi'),&quot;&lt;span&gt;&quot;+bull);content=content.replace(/&lt;o:p&gt;&lt;\/o:p&gt;/gi,&quot;&quot;);content=content.replace(new RegExp('&lt;br style=&quot;page-break-before: always;.*&gt;','gi'),'-- page break --');content=content.replace(new RegExp('&lt;(!--)([^&gt;]*)(--)&gt;','g'),&quot;&quot;);if(this.editor.getParam(&quot;paste_remove_spans&quot;,true))content=content.replace(/&lt;\/?span[^&gt;]*&gt;/gi,&quot;&quot;);if(this.editor.getParam(&quot;paste_remove_styles&quot;,true))content=content.replace(new RegExp('&lt;(\\w[^&gt;]*) style=&quot;([^&quot;]*)&quot;([^&gt;]*)','gi'),&quot;&lt;$1$3&quot;);content=content.replace(/&lt;\/?font[^&gt;]*&gt;/gi,&quot;&quot;);switch(this.editor.getParam(&quot;paste_strip_class_attributes&quot;,&quot;all&quot;)){case&quot;all&quot;:content=content.replace(/&lt;(\w[^&gt;]*) class=([^ |&gt;]*)([^&gt;]*)/gi,&quot;&lt;$1$3&quot;);break;case&quot;mso&quot;:content=content.replace(new RegExp('&lt;(\\w[^&gt;]*) class=&quot;?mso([^ |&gt;]*)([^&gt;]*)','gi'),&quot;&lt;$1$3&quot;);break;}content=content.replace(new RegExp('href=&quot;?'+this._reEscape(&quot;&quot;+document.location)+'','gi'),'href=&quot;'+this.editor.documentBaseURI.getURI());content=content.replace(/&lt;(\w[^&gt;]*) lang=([^ |&gt;]*)([^&gt;]*)/gi,&quot;&lt;$1$3&quot;);content=content.replace(/&lt;\\?\?xml[^&gt;]*&gt;/gi,&quot;&quot;);content=content.replace(/&lt;\/?\w+:[^&gt;]*&gt;/gi,&quot;&quot;);content=content.replace(/-- page break --\s*&lt;p&gt;&amp;nbsp;&lt;\/p&gt;/gi,&quot;&quot;);content=content.replace(/-- page break --/gi,&quot;&quot;);if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('&lt;/p&gt;','&lt;br /&gt;&lt;br /&gt;','gi');}if(!tinymce.isIE&amp;&amp;!this.editor.getParam('force_p_newlines')){content=content.replace(/&lt;\/?p[^&gt;]*&gt;/gi,&quot;&quot;);}content=content.replace(/&lt;\/?div[^&gt;]*&gt;/gi,&quot;&quot;);if(this.editor.getParam(&quot;paste_convert_middot_lists&quot;,true)){var div=ed.dom.create(&quot;div&quot;,null,content);var className=this.editor.getParam(&quot;paste_unindented_list_class&quot;,&quot;unIndentedList&quot;);while(this._convertMiddots(div,&quot;--list--&quot;));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam(&quot;paste_convert_headers_to_strong&quot;,false)){content=content.replace(/&lt;h[1-6]&gt;&amp;nbsp;&lt;\/h[1-6]&gt;/gi,'&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;');content=content.replace(/&lt;h[1-6]&gt;/gi,'&lt;p&gt;&lt;b&gt;');content=content.replace(/&lt;\/h[1-6]&gt;/gi,'&lt;/b&gt;&lt;/p&gt;');content=content.replace(/&lt;b&gt;&amp;nbsp;&lt;\/b&gt;/gi,'&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;');content=content.replace(/^(&amp;nbsp;)*/gi,'');}content=content.replace(/--list--/gi,&quot;&quot;);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand(&quot;mceInsertContent&quot;,false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand(&quot;mceCleanup&quot;);},1);}}},_reEscape:function(s){var l=&quot;?.\\*[](){}+^$:&quot;;var o=&quot;&quot;;for(var i=0;i&lt;s.length;i++){var c=s.charAt(i);if(l.indexOf(c)!=-1)o+='\\'+c;else o+=c;}return o;},_convertMiddots:function(div,search,class_name){var ed=this.editor,mdot=String.fromCharCode(183),bull=String.fromCharCode(8226);var nodes,prevul,i,p,ul,li,np,cp,li;nodes=div.getElementsByTagName(&quot;p&quot;);for(i=0;i&lt;nodes.length;i++){p=nodes[i];if(p.innerHTML.indexOf(search)==0){ul=ed.dom.create(&quot;ul&quot;);if(class_name)ul.className=class_name;li=ed.dom.create(&quot;li&quot;);li.innerHTML=p.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--|&amp;nbsp;',&quot;gi&quot;),'');ul.appendChild(li);np=p.nextSibling;while(np){if(np.nodeType==3&amp;&amp;new RegExp('^\\s$','m').test(np.nodeValue)){np=np.nextSibling;continue;}if(search==mdot){if(np.nodeType==1&amp;&amp;new RegExp('^o(\\s+|&amp;nbsp;)').test(np.innerHTML)){if(!prevul){prevul=ul;ul=ed.dom.create(&quot;ul&quot;);prevul.appendChild(ul);}np.innerHTML=np.innerHTML.replace(/^o/,'');}else{if(prevul){ul=prevul;prevul=null;}if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}}else{if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}cp=np.nextSibling;li=ed.dom.create(&quot;li&quot;);li.innerHTML=np.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--|&amp;nbsp;',&quot;gi&quot;),'');np.parentNode.removeChild(np);ul.appendChild(li);np=cp;}p.parentNode.replaceChild(ul,p);return true;}}return false;},_clipboardHTML:function(){var div=document.getElementById('_TinyMCE_clipboardHTML');if(!div){var div=document.createElement('DIV');div.id='_TinyMCE_clipboardHTML';with(div.style){visibility='hidden';overflow='hidden';position='absolute';width=1;height=1;}document.body.appendChild(div);}div.innerHTML='';var rng=document.body.createTextRange();rng.moveToElementText(div);rng.execCommand('Paste');var html=div.innerHTML;div.innerHTML='';return html;}});tinymce.PluginManager.add('paste',tinymce.plugins.PastePlugin);})();
\ No newline at end of file</diff>
      <filename>wp-includes/js/tinymce/plugins/paste/editor_plugin.js</filename>
    </modified>
    <modified>
      <diff>@@ -2,8 +2,8 @@
 &lt;head&gt;
 	&lt;title&gt;{#paste.paste_text_desc}&lt;/title&gt;
 	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
-	&lt;script type=&quot;text/javascript&quot; src=&quot;../../tiny_mce_popup.js&quot;&gt;&lt;/script&gt;
-	&lt;script type=&quot;text/javascript&quot; src=&quot;js/pastetext.js&quot;&gt;&lt;/script&gt;
+	&lt;script type=&quot;text/javascript&quot; src=&quot;../../tiny_mce_popup.js?ver=311&quot;&gt;&lt;/script&gt;
+	&lt;script type=&quot;text/javascript&quot; src=&quot;js/pastetext.js?ver=311&quot;&gt;&lt;/script&gt;
 	&lt;base target=&quot;_self&quot; /&gt;
 &lt;/head&gt;
 &lt;body onresize=&quot;resizeInputs();&quot; style=&quot;display:none; overflow:hidden;&quot;&gt;</diff>
      <filename>wp-includes/js/tinymce/plugins/paste/pastetext.htm</filename>
    </modified>
    <modified>
      <diff>@@ -2,9 +2,9 @@
 &lt;head&gt;
 	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
 	&lt;title&gt;{#paste.paste_word_desc}&lt;/title&gt;
-	&lt;script type=&quot;text/javascript&quot; src=&quot;../../tiny_mce_popup.js&quot;&gt;&lt;/script&gt;
-	&lt;script type=&quot;text/javascript&quot; src=&quot;js/pasteword.js&quot;&gt;&lt;/script&gt;
-	&lt;link href=&quot;css/pasteword.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
+	&lt;script type=&quot;text/javascript&quot; src=&quot;../../tiny_mce_popup.js?ver=311&quot;&gt;&lt;/script&gt;
+	&lt;script type=&quot;text/javascript&quot; src=&quot;js/pasteword.js?ver=311&quot;&gt;&lt;/script&gt;
+	&lt;link href=&quot;css/pasteword.css?ver=311&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
 	&lt;base target=&quot;_self&quot; /&gt;
 &lt;/head&gt;
 &lt;body onresize=&quot;resizeInputs();&quot; style=&quot;display:none; overflow:hidden;&quot;&gt;</diff>
      <filename>wp-includes/js/tinymce/plugins/paste/pasteword.htm</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1 @@
-(function(){var Event=tinymce.dom.Event,grep=tinymce.grep,each=tinymce.each,inArray=tinymce.inArray,isOldWebKit=tinymce.isOldWebKit;tinymce.create('tinymce.plugins.Safari',{init:function(ed){var t=this,dom;if(!tinymce.isWebKit)return;t.editor=ed;t.webKitFontSizes=['x-small','small','medium','large','x-large','xx-large','-webkit-xxx-large'];t.namedFontSizes=['xx-small','x-small','small','medium','large','x-large','xx-large'];ed.onPaste.add(function(ed,e){function removeStyles(e){e=e.target;if(e.nodeType==1){e.style.cssText='';each(ed.dom.select('*',e),function(e){e.style.cssText='';});}};Event.add(ed.getDoc(),'DOMNodeInserted',removeStyles);window.setTimeout(function(){Event.remove(ed.getDoc(),'DOMNodeInserted',removeStyles);},0);});ed.onKeyUp.add(function(ed,e){var h,b;if(e.keyCode==46||e.keyCode==8){b=ed.getBody();h=b.innerHTML;if(b.childNodes.length==1&amp;&amp;!/&lt;(img|hr)/.test(h)&amp;&amp;tinymce.trim(h.replace(/&lt;[^&gt;]+&gt;/g,'')).length==0)ed.setContent('',{format:'raw'});}});ed.addCommand('FormatBlock',function(u,v){var dom=ed.dom,e=dom.getParent(ed.selection.getNode(),dom.isBlock);if(e)dom.replace(dom.create(v),e,1);else ed.getDoc().execCommand(&quot;FormatBlock&quot;,false,v);});ed.addCommand('mceInsertContent',function(u,v){ed.getDoc().execCommand(&quot;InsertText&quot;,false,'mce_marker');ed.getBody().innerHTML=ed.getBody().innerHTML.replace(/mce_marker/g,v+'&lt;span id=&quot;_mce_tmp&quot;&gt;XX&lt;/span&gt;');ed.selection.select(ed.dom.get('_mce_tmp'));ed.getDoc().execCommand(&quot;Delete&quot;,false,' ');});ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&amp;&amp;(e.shiftKey||ed.settings.force_br_newlines&amp;&amp;ed.selection.getNode().nodeName!='LI')){t._insertBR(ed);Event.cancel(e);}});ed.addQueryValueHandler('FontSize',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&amp;&amp;(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&amp;&amp;(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;return ed.getDoc().queryCommandValue('FontSize');});ed.addQueryValueHandler('FontName',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&amp;&amp;(v=e.style.fontFamily))return v.replace(/, /g,',');if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&amp;&amp;(v=e.style.fontFamily))return v.replace(/, /g,',');return ed.getDoc().queryCommandValue('FontName');});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName=='IMG'){t.selElm=e;ed.selection.select(e);}else t.selElm=null;});ed.onInit.add(function(){t._fixWebKitSpans();if(isOldWebKit)t._patchSafari2x(ed);});ed.onSetContent.add(function(){dom=ed.dom;each(['strong','b','em','u','strike','sub','sup','a'],function(v){each(grep(dom.select(v)).reverse(),function(n){var nn=n.nodeName.toLowerCase(),st;if(nn=='a'){if(n.name)dom.replace(dom.create('img',{mce_name:'a',name:n.name,'class':'mceItemAnchor'}),n);return;}switch(nn){case'b':case'strong':if(nn=='b')nn='strong';st='font-weight: bold;';break;case'em':st='font-style: italic;';break;case'u':st='text-decoration: underline;';break;case'sub':st='vertical-align: sub;';break;case'sup':st='vertical-align: super;';break;case'strike':st='text-decoration: line-through;';break;}dom.replace(dom.create('span',{mce_name:nn,style:st,'class':'Apple-style-span'}),n,1);});});});ed.onPreProcess.add(function(ed,o){dom=ed.dom;each(grep(o.node.getElementsByTagName('span')).reverse(),function(n){var v,bg;if(o.get){if(dom.hasClass(n,'Apple-style-span')){bg=n.style.backgroundColor;switch(dom.getAttrib(n,'mce_name')){case'font':if(!ed.settings.convert_fonts_to_spans)dom.setAttrib(n,'style','');break;case'strong':case'em':case'sub':case'sup':dom.setAttrib(n,'style','');break;case'strike':case'u':if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');else dom.setAttrib(n,'mce_name','');break;default:if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');}if(bg)n.style.backgroundColor=bg;}}if(dom.hasClass(n,'mceItemRemoved'))dom.remove(n,1);});});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/&lt;br \/&gt;&lt;\/(h[1-6]|div|p|address|pre)&gt;/g,'&lt;/$1&gt;');o.content=o.content.replace(/ id=\&quot;undefined\&quot;/g,'');});},getInfo:function(){return{longname:'Safari compatibility',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari',version:tinymce.majorVersion+&quot;.&quot;+tinymce.minorVersion};},_fixWebKitSpans:function(){var t=this,ed=t.editor;if(!isOldWebKit){Event.add(ed.getDoc(),'DOMNodeInserted',function(e){e=e.target;if(e&amp;&amp;e.nodeType==1)t._fixAppleSpan(e);});}else{ed.onExecCommand.add(function(){each(ed.dom.select('span'),function(n){t._fixAppleSpan(n);});ed.nodeChanged();});}},_fixAppleSpan:function(e){var ed=this.editor,dom=ed.dom,fz=this.webKitFontSizes,fzn=this.namedFontSizes,s=ed.settings,st,p;if(dom.getAttrib(e,'mce_fixed'))return;if(e.nodeName=='SPAN'&amp;&amp;e.className=='Apple-style-span'){st=e.style;if(!s.convert_fonts_to_spans){if(st.fontSize){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'size',inArray(fz,st.fontSize)+1);}if(st.fontFamily){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'face',st.fontFamily);}if(st.color){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'color',dom.toHex(st.color));}if(st.backgroundColor){dom.setAttrib(e,'mce_name','font');dom.setStyle(e,'background-color',st.backgroundColor);}}else{if(st.fontSize)dom.setStyle(e,'fontSize',fzn[inArray(fz,st.fontSize)]);}if(st.fontWeight=='bold')dom.setAttrib(e,'mce_name','strong');if(st.fontStyle=='italic')dom.setAttrib(e,'mce_name','em');if(st.textDecoration=='underline')dom.setAttrib(e,'mce_name','u');if(st.textDecoration=='line-through')dom.setAttrib(e,'mce_name','strike');if(st.verticalAlign=='super')dom.setAttrib(e,'mce_name','sup');if(st.verticalAlign=='sub')dom.setAttrib(e,'mce_name','sub');dom.setAttrib(e,'mce_fixed','1');}},_patchSafari2x:function(ed){var t=this,setContent,getNode,dom=ed.dom,lr;if(ed.windowManager.onBeforeOpen){ed.windowManager.onBeforeOpen.add(function(){r=ed.selection.getRng();});}ed.selection.select=function(n){this.getSel().setBaseAndExtent(n,0,n,1);};getNode=ed.selection.getNode;ed.selection.getNode=function(){return t.selElm||getNode.call(this);};ed.selection.getRng=function(){var t=this,s=t.getSel(),d=ed.getDoc(),r,rb,ra,di;if(s.anchorNode){r=d.createRange();try{rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(1);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(1);di=rb.compareBoundaryPoints(rb.START_TO_END,ra)&lt;0;r.setStart(di?s.anchorNode:s.focusNode,di?s.anchorOffset:s.focusOffset);r.setEnd(di?s.focusNode:s.anchorNode,di?s.focusOffset:s.anchorOffset);lr=r;}catch(ex){}}return r||lr;};setContent=ed.selection.setContent;ed.selection.setContent=function(h,s){var r=this.getRng(),b;try{setContent.call(this,h,s);}catch(ex){b=dom.create('body');b.innerHTML=h;each(b.childNodes,function(n){r.insertNode(n.cloneNode(true));});}};},_insertBR:function(ed){var dom=ed.dom,s=ed.selection,r=s.getRng(),br;r.insertNode(br=dom.create('br'));r.setStartAfter(br);r.setEndAfter(br);s.setRng(r);if(s.getSel().focusNode==br.previousSibling){s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'),br));s.collapse(1);}ed.getWin().scrollTo(0,dom.getPos(s.getRng().startContainer).y);}});tinymce.PluginManager.add('safari',tinymce.plugins.Safari);})();
\ No newline at end of file
+(function(){var Event=tinymce.dom.Event,grep=tinymce.grep,each=tinymce.each,inArray=tinymce.inArray,isOldWebKit=tinymce.isOldWebKit;tinymce.create('tinymce.plugins.Safari',{init:function(ed){var t=this,dom;if(!tinymce.isWebKit)return;t.editor=ed;t.webKitFontSizes=['x-small','small','medium','large','x-large','xx-large','-webkit-xxx-large'];t.namedFontSizes=['xx-small','x-small','small','medium','large','x-large','xx-large'];ed.addCommand('CreateLink',function(u,v){var n=ed.selection.getNode(),dom=ed.dom,a;if(n&amp;&amp;(/^(left|right)$/i.test(dom.getStyle(n,'float',1))||/^(left|right)$/i.test(dom.getAttrib(n,'align')))){a=dom.create('a',{href:v},n.cloneNode());n.parentNode.replaceChild(a,n);ed.selection.select(a);}else ed.getDoc().execCommand(&quot;CreateLink&quot;,false,v);});ed.onPaste.add(function(ed,e){function removeStyles(e){e=e.target;if(e.nodeType==1){e.style.cssText='';each(ed.dom.select('*',e),function(e){e.style.cssText='';});}};Event.add(ed.getDoc(),'DOMNodeInserted',removeStyles);window.setTimeout(function(){Event.remove(ed.getDoc(),'DOMNodeInserted',removeStyles);},0);});ed.onKeyUp.add(function(ed,e){var h,b;if(e.keyCode==46||e.keyCode==8){b=ed.getBody();h=b.innerHTML;if(b.childNodes.length==1&amp;&amp;!/&lt;(img|hr)/.test(h)&amp;&amp;tinymce.trim(h.replace(/&lt;[^&gt;]+&gt;/g,'')).length==0)ed.setContent('',{format:'raw'});}});ed.addCommand('FormatBlock',function(u,v){var dom=ed.dom,e=dom.getParent(ed.selection.getNode(),dom.isBlock);if(e)dom.replace(dom.create(v),e,1);else ed.getDoc().execCommand(&quot;FormatBlock&quot;,false,v);});ed.addCommand('mceInsertContent',function(u,v){ed.getDoc().execCommand(&quot;InsertText&quot;,false,'mce_marker');ed.getBody().innerHTML=ed.getBody().innerHTML.replace(/mce_marker/g,v+'&lt;span id=&quot;_mce_tmp&quot;&gt;XX&lt;/span&gt;');ed.selection.select(ed.dom.get('_mce_tmp'));ed.getDoc().execCommand(&quot;Delete&quot;,false,' ');});ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&amp;&amp;(e.shiftKey||ed.settings.force_br_newlines&amp;&amp;ed.selection.getNode().nodeName!='LI')){t._insertBR(ed);Event.cancel(e);}});ed.addQueryValueHandler('FontSize',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&amp;&amp;(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&amp;&amp;(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;return ed.getDoc().queryCommandValue('FontSize');});ed.addQueryValueHandler('FontName',funct