Index: wp-admin/includes/post.php
===================================================================
--- wp-admin/includes/post.php	(revision 12240)
+++ wp-admin/includes/post.php	(working copy)
@@ -34,28 +34,25 @@
 	if (!empty ( $post_data['post_author_override'] ) ) {
 		$post_data['post_author'] = (int) $post_data['post_author_override'];
 	} else {
-		if (!empty ( $post_data['post_author'] ) ) {
+		if (!empty ( $post_data['post_author'] ) )
 			$post_data['post_author'] = (int) $post_data['post_author'];
-		} else {
+		else
 			$post_data['post_author'] = (int) $post_data['user_ID'];
-		}
 	}
 
 	if ( isset($post_data['user_ID']) && ($post_data['post_author'] != $post_data['user_ID']) ) {
 		if ( 'page' == $post_data['post_type'] ) {
-			if ( !current_user_can( 'edit_others_pages' ) ) {
+			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' ) ) {
+			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.' )
 				);
-			}
 		}
 	}
 
@@ -82,6 +79,7 @@
 		$publish_cap = 'publish_posts';
 		$edit_cap = 'edit_published_posts';
 	}
+
 	if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( $publish_cap )) )
 		if ( $previous_status != 'publish' || !current_user_can( $edit_cap ) )
 			$post_data['post_status'] = 'pending';
@@ -204,9 +202,9 @@
 
 	if ( current_user_can( 'edit_others_posts' ) ) {
 		if ( !empty($post_data['sticky']) )
-			stick_post($post_ID);
+			stick_post( $post_ID );
 		else
-			unstick_post($post_ID);
+			unstick_post( $post_ID );
 	}
 
 	return $post_ID;
@@ -218,8 +216,10 @@
  * Updates all bulk edited posts/pages, adding (but not removing) tags and
  * categories. Skips pages when they would be their own parent or child.
  *
- * @since unknown
+ * @since 2.7.0
  *
+ * @param unknown_type $post_data
+ *
  * @return array
  */
 function bulk_edit_posts( $post_data = null ) {
@@ -366,7 +366,7 @@
 /**
  * {@internal Missing Short Description}}
  *
- * @since unknown
+ * @since 2.5.0
  *
  * @return unknown
  */
@@ -736,8 +736,8 @@
 		if ( ! empty( $attachment) && ! is_object( get_post( $attachment['post_parent'] ) ) ) {
 			$attachment['post_parent'] = $post_ID;
 			// Escape data pulled from DB.
-			$attachment = add_magic_quotes( $attachment);
-			wp_update_post( $attachment);
+			$attachment = add_magic_quotes( $attachment );
+			wp_update_post( $attachment );
 		}
 
 		$post_search[$i] = $anchor;
@@ -749,9 +749,9 @@
 	$post['post_content'] = str_replace( $post_search, $post_replace, $post['post_content'] );
 
 	// Escape data pulled from DB.
-	$post = add_magic_quotes( $post);
+	$post = add_magic_quotes( $post );
 
-	return wp_update_post( $post);
+	return wp_update_post( $post );
 }
 
 function _fix_attachment_links_replace_cb($match) {
@@ -779,7 +779,7 @@
 /**
  * {@internal Missing Short Description}}
  *
- * @since unknown
+ * @since 2.5.0
  *
  * @param unknown_type $type
  * @return unknown
@@ -793,10 +793,10 @@
 /**
  * {@internal Missing Short Description}}
  *
- * @since unknown
+ * @since 2.5.0
  *
  * @param unknown_type $q
- * @return unknown
+ * @return array
  */
 function wp_edit_posts_query( $q = false ) {
 	if ( false === $q )
@@ -881,16 +881,17 @@
  * @since unknown
  *
  * @param unknown_type $q
- * @return unknown
+ * @return array
  */
 function wp_edit_attachments_query( $q = false ) {
 	if ( false === $q )
 		$q = $_GET;
 
-	$q['m']   = isset( $q['m'] ) ? (int) $q['m'] : 0;
+	$q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0;
 	$q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
 	$q['post_type'] = 'attachment';
 	$q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : 'inherit';
+
 	$media_per_page = get_user_option('upload_per_page');
 	if ( empty($media_per_page) )
 		$media_per_page = 20;
@@ -914,6 +915,9 @@
  *
  * @param unknown_type $id
  * @param unknown_type $page
+ *
+ * @uses get_user_option()
+ *
  * @return unknown
  */
 function postbox_classes( $id, $page ) {
@@ -922,7 +926,7 @@
 	$current_user = wp_get_current_user();
 	if ( $closed = get_user_option('closedpostboxes_'.$page, 0, false ) ) {
 		if ( !is_array( $closed ) ) return '';
-		return in_array( $id, $closed )? 'closed' : '';
+			return in_array( $id, $closed )? 'closed' : '';
 	} else {
 		return '';
 	}
@@ -936,20 +940,20 @@
  * @param unknown_type $id
  * @param unknown_type $title
  * @param unknown_type $name
- * @return unknown
+ * @return array
  */
-function get_sample_permalink($id, $title = null, $name = null) {
+function get_sample_permalink( $id, $title = null, $name = null ) {
 	$post = &get_post($id);
-	if (!$post->ID) {
+	if ( !$post->ID )
 		return array('', '');
-	}
+
 	$original_status = $post->post_status;
 	$original_date = $post->post_date;
 	$original_name = $post->post_name;
 
 	// Hack: get_permalink would return ugly permalink for
 	// drafts, so we will fake, that our post is published
-	if (in_array($post->post_status, array('draft', 'pending'))) {
+	if ( in_array( $post->post_status, array('draft', 'pending') ) ) {
 		$post->post_status = 'publish';
 		$post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID);
 	}
@@ -958,9 +962,8 @@
 
 	// If the user wants to set a new name -- override the current one
 	// Note: if empty name is supplied -- use the title instead, see #6072
-	if (!is_null($name)) {
+	if ( !is_null($name) )
 		$post->post_name = sanitize_title($name? $name : $title, $post->ID);
-	}
 
 	$post->filter = 'sample';
 
@@ -972,7 +975,7 @@
 		$uri = untrailingslashit($uri);
 		$uri = strrev( stristr( strrev( $uri ), '/' ) );
 		$uri = untrailingslashit($uri);
-		if ( !empty($uri) )
+		if ( !empty( $uri ) )
 			$uri .='/';
 		$permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink);
 	}
@@ -994,7 +997,7 @@
  * @param unknown_type $id
  * @param unknown_type $new_title
  * @param unknown_type $new_slug
- * @return unknown
+ * @return string html
  */
 function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
 	$post = &get_post($id);
@@ -1020,17 +1023,15 @@
 	}
 
 	if ( function_exists('mb_strlen') ) {
-		if ( mb_strlen($post_name) > 30 ) {
+		if ( mb_strlen($post_name) > 30 )
 			$post_name_abridged = mb_substr($post_name, 0, 14). '&hellip;' . mb_substr($post_name, -14);
-		} else {
+		else
 			$post_name_abridged = $post_name;
-		}
 	} else {
-		if ( strlen($post_name) > 30 ) {
+		if ( strlen($post_name) > 30 )
 			$post_name_abridged = substr($post_name, 0, 14). '&hellip;' . substr($post_name, -14);
-		} else {
+		else
 			$post_name_abridged = $post_name;
-		}
 	}
 
 	$post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
@@ -1120,6 +1121,7 @@
  * Outputs the notice message to say that someone else is editing this post at the moment.
  *
  * @since 2.8.5
+ *
  * @return none
  */
 function _admin_notice_post_locked() {
@@ -1151,6 +1153,8 @@
  *
  * @uses _wp_translate_postdata()
  * @uses _wp_post_revision_fields()
+ *
+ * @return unknown
  */
 function wp_create_post_autosave( $post_id ) {
 	$translated = _wp_translate_postdata( true );
@@ -1177,7 +1181,7 @@
  * Save draft or manually autosave for showing preview.
  *
  * @package WordPress
- * @since 2.7
+ * @since 2.7.0
  *
  * @uses wp_write_post()
  * @uses edit_post()
@@ -1238,7 +1242,7 @@
  * Adds the TinyMCE editor used on the Write and Edit screens.
  *
  * @package WordPress
- * @since 2.7
+ * @since 2.7.0
  *
  * TinyMCE is loaded separately from other Javascript by using wp-tinymce.php. It outputs concatenated
  * and optionaly pre-compressed version of the core and all default plugins. Additional plugins are loaded
@@ -1420,11 +1424,10 @@
 	// You can modify initArray to add, remove, change elements of the config before tinyMCE.init
 	// Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through "tiny_mce_before_init".
 	// Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0.
-	if ( $teeny ) {
+	if ( $teeny )
 		$initArray = apply_filters('teeny_mce_before_init', $initArray);
-	} else {
+	else
 		$initArray = apply_filters('tiny_mce_before_init', $initArray);
-	}
 
 	if ( empty($initArray['theme_advanced_buttons3']) && !empty($initArray['theme_advanced_buttons4']) ) {
 		$initArray['theme_advanced_buttons3'] = $initArray['theme_advanced_buttons4'];
