wp/wp-admin/includes/revision.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
--- a/wp/wp-admin/includes/revision.php	Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-admin/includes/revision.php	Wed Sep 21 18:19:35 2022 +0200
@@ -15,7 +15,7 @@
  * @param WP_Post|int $post         The post object or post ID.
  * @param int         $compare_from The revision ID to compare from.
  * @param int         $compare_to   The revision ID to come to.
- * @return array|bool Associative array of a post's revisioned fields and their diffs.
+ * @return array|false Associative array of a post's revisioned fields and their diffs.
  *                    Or, false on failure.
  */
 function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
@@ -68,8 +68,14 @@
 		/**
 		 * Contextually filter a post revision field.
 		 *
-		 * The dynamic portion of the hook name, `$field`, corresponds to each of the post
-		 * fields of the revision object being iterated over in a foreach statement.
+		 * The dynamic portion of the hook name, `$field`, corresponds to a name of a
+		 * field of the revision object.
+		 *
+		 * Possible hook names include:
+		 *
+		 *  - `_wp_post_revision_field_post_title`
+		 *  - `_wp_post_revision_field_post_content`
+		 *  - `_wp_post_revision_field_post_excerpt`
 		 *
 		 * @since 3.6.0
 		 *
@@ -86,6 +92,8 @@
 
 		$args = array(
 			'show_split_view' => true,
+			'title_left'      => __( 'Removed' ),
+			'title_right'     => __( 'Added' ),
 		);
 
 		/**
@@ -275,11 +283,11 @@
 	 * If we only have one revision, the initial revision is missing; This happens
 	 * when we have an autsosave and the user has clicked 'View the Autosave'
 	 */
-	if ( 1 === sizeof( $revisions ) ) {
+	if ( 1 === count( $revisions ) ) {
 		$revisions[ $post->ID ] = array(
 			'id'         => $post->ID,
 			'title'      => get_the_title( $post->ID ),
-			'author'     => $authors[ $post->post_author ],
+			'author'     => $authors[ $revision->post_author ],
 			'date'       => date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_modified ) ),
 			'dateShort'  => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), strtotime( $post->post_modified ) ),
 			/* translators: %s: Human-readable time difference. */