Ticket #18733: revision-number.patch
| File revision-number.patch, 4.8 KB (added by , 14 years ago) |
|---|
-
wp-admin/revision.php
116 116 $redirect = 'edit.php?post_type=' . $post->post_type; 117 117 break; 118 118 } 119 119 120 $revision_num = wp_post_revision_num( $revision, false ); 121 120 122 $post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>'; 121 123 $revision_title = wp_post_revision_title( $revision, false ); 122 $h2 = sprintf( __( 'Revision for “%1$s” created on %2$s' ), $post_title, $revision_title );124 $h2 = sprintf( __( 'Revision %1$s for “%2$s” created on %3$s' ), $revision_num, $post_title, $revision_title ); 123 125 $title = __( 'Revisions' ); 124 126 125 127 // Sets up the diff radio buttons … … 155 157 156 158 <table class="form-table ie-fixed"> 157 159 <col class="th" /> 158 <?php if ( 'diff' == $action ) : ?> 160 <?php 161 162 if ( 'diff' == $action ) : 163 $left_revision_num = wp_post_revision_num( $left_revision, true ); 164 $right_revision_num = wp_post_revision_num( $right_revision, true ); 165 166 ?> 159 167 <tr id="revision"> 160 168 <th scope="row"></th> 161 169 <th scope="col" class="th-full"> 162 <span class="alignleft"><?php printf( __('Older: %s'), wp_post_revision_title( $left_revision ) ); ?> </span>163 <span class="alignright"><?php printf( __('Newer: %s'), wp_post_revision_title( $right_revision ) ); ?> </span>170 <span class="alignleft"><?php printf( __('Older: %s'), wp_post_revision_title( $left_revision ) ); ?> <?php echo $left_revision_num; ?></span> 171 <span class="alignright"><?php printf( __('Newer: %s'), wp_post_revision_title( $right_revision ) ); ?> <?php echo $right_revision_num; ?></span> 164 172 </th> 165 173 </tr> 166 174 <?php endif; -
wp-includes/post-template.php
1299 1299 } 1300 1300 1301 1301 /** 1302 * Retrieve revision id of a revision (linked to that revisions's page). 1303 * 1304 * @package WordPress 1305 * @subpackage Post_Revisions 1306 * @since 3.3 1307 * 1308 * @uses date_i18n() 1309 * 1310 * @param int|object $revision Revision ID or revision object. 1311 * @param bool $link Optional, default is true. Link to revisions's page? 1312 * @return string revision number or link to revision page. 1313 */ 1314 1315 function wp_post_revision_num($revision, $link = true) { 1316 if ( !$revision = get_post( $revision ) ) 1317 return $revision; 1318 1319 if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) 1320 return false; 1321 1322 if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) 1323 $revision_num = "<a href='$link'>#$revision->ID</a>"; 1324 else 1325 $revision_num = "#$revision->ID"; 1326 1327 return $revision_num; 1328 } 1329 1330 /** 1302 1331 * Display list of a post's revisions. 1303 1332 * 1304 1333 * Can output either a UL with edit links or a TABLE with diff interface, and … … 1363 1392 continue; 1364 1393 if ( 'revision' === $type && wp_is_post_autosave( $revision ) ) 1365 1394 continue; 1366 1395 1396 $revision_num = wp_post_revision_num( $revision ); 1367 1397 $date = wp_post_revision_title( $revision ); 1368 1398 $name = get_the_author_meta( 'display_name', $revision->post_author ); 1369 1399 … … 1384 1414 $rows .= "<tr$class>\n"; 1385 1415 $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='$revision->ID'$left_checked /></th>\n"; 1386 1416 $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='right' value='$revision->ID'$right_checked /></th>\n"; 1387 $rows .= "\t<td>$date</td>\n"; 1417 $rows .= "\t<td>$revision_num</td>\n"; 1418 $rows .= "\t<td>$date</td>\n"; 1388 1419 $rows .= "\t<td>$name</td>\n"; 1389 1420 $rows .= "\t<td class='action-links'>$actions</td>\n"; 1390 1421 $rows .= "</tr>\n"; 1391 1422 } else { 1392 1423 $title = sprintf( $titlef, $date, $name ); 1393 $rows .= "\t<li>$title </li>\n";1424 $rows .= "\t<li>$title $revision_num</li>\n"; 1394 1425 } 1395 1426 } 1396 1427 … … 1409 1440 <br class="clear" /> 1410 1441 1411 1442 <table class="widefat post-revisions" cellspacing="0" id="post-revisions"> 1443 <col /> 1412 1444 <col /> 1413 1445 <col /> 1414 1446 <col style="width: 33%" /> … … 1418 1450 <tr> 1419 1451 <th scope="col"><?php /* translators: column name in revisons */ _ex( 'Old', 'revisions column name' ); ?></th> 1420 1452 <th scope="col"><?php /* translators: column name in revisons */ _ex( 'New', 'revisions column name' ); ?></th> 1453 <th scope="col"><?php /* translators: column name in revisons */ _ex( 'Revision', 'revisions column name' ); ?></th> 1421 1454 <th scope="col"><?php /* translators: column name in revisons */ _ex( 'Date Created', 'revisions column name' ); ?></th> 1422 1455 <th scope="col"><?php _e( 'Author' ); ?></th> 1423 1456 <th scope="col" class="action-links"><?php _e( 'Actions' ); ?></th>