Changeset 24175
- Timestamp:
- 05/04/2013 12:54:00 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/meta-boxes.php
r23352 r24175 603 603 * @param object $post 604 604 */ 605 function post_revisions_meta_box( $post) {606 wp_list_post_revisions( );605 function post_revisions_meta_box( $post ) { 606 wp_list_post_revisions( $post ); 607 607 } 608 608 -
trunk/wp-includes/post-template.php
r24157 r24175 1385 1385 * restore action links. 1386 1386 * 1387 * Second argument controls parameters:1388 * (bool) parent : include the parent (the "Current Revision") in the list.1389 * Deprecated (ignored), since 3.6 the revisions always include1390 * a copy of the current post.1391 * (string) format : 'list' or 'form-table'. 'list' outputs UL, 'form-table'1392 * outputs TABLE with UI.1393 * (int) right : what revision is currently being viewed - used in1394 * form-table format.1395 * (int) left : what revision is currently being diffed against right -1396 * used in form-table format.1397 *1398 1387 * @package WordPress 1399 1388 * @subpackage Post_Revisions … … 1405 1394 * @uses get_the_author_meta() 1406 1395 * 1407 * @todo split into two functions (list, form-table) ?1408 *1409 1396 * @param int|object $post_id Post ID or post object. 1410 * @param string |array $args See description {@link wp_parse_args()}.1397 * @param string $type 'all' (default), 'revision' or 'autosave' 1411 1398 * @return null 1412 1399 */ 1413 function wp_list_post_revisions( $post_id = 0, $ args = null) {1414 if ( ! $post = get_post( $post_id ) )1400 function wp_list_post_revisions( $post_id = 0, $type = 'all' ) { 1401 if ( ! $post = get_post( $post_id ) ) 1415 1402 return; 1416 1403 1417 $defaults = array( 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' ); 1418 extract( wp_parse_args( $args, $defaults ), EXTR_SKIP ); 1419 1420 if ( !$revisions = wp_get_post_revisions( $post->ID ) ) 1404 // $args array with (parent, format, right, left, type) deprecated since 3.6 1405 if ( is_array( $type ) ) { 1406 $type = ! empty( $type['type'] ) ? $type['type'] : $type; 1407 _deprecated_argument( __FUNCTION__, '3.6' ); 1408 } 1409 1410 if ( ! $revisions = wp_get_post_revisions( $post->ID ) ) 1421 1411 return; 1422 1412 1423 1413 $rows = ''; 1424 1414 foreach ( $revisions as $revision ) { 1425 if ( ! current_user_can( 'read_post', $revision->ID ) )1415 if ( ! current_user_can( 'read_post', $revision->ID ) ) 1426 1416 continue; 1427 1417 … … 1433 1423 } 1434 1424 1435 if ( 'form-table' == $format ) : ?> 1436 1437 <form action="revision.php" method="get"> 1438 1439 <div class="tablenav"> 1440 <div class="alignleft"> 1441 <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Compare Revisions' ); ?>" /> 1442 <input type="hidden" name="action" value="diff" /> 1443 <input type="hidden" name="post_type" value="<?php echo esc_attr($post->post_type); ?>" /> 1444 </div> 1445 </div> 1446 1447 <br class="clear" /> 1448 1449 <table class="widefat post-revisions" cellspacing="0" id="post-revisions"> 1450 <col /> 1451 <col /> 1452 <col style="width: 33%" /> 1453 <col style="width: 33%" /> 1454 <col style="width: 33%" /> 1455 <thead> 1456 <tr> 1457 <th scope="col"><?php /* translators: column name in revisions */ _ex( 'Old', 'revisions column name' ); ?></th> 1458 <th scope="col"><?php /* translators: column name in revisions */ _ex( 'New', 'revisions column name' ); ?></th> 1459 <th scope="col"><?php /* translators: column name in revisions */ _ex( 'Date Created', 'revisions column name' ); ?></th> 1460 <th scope="col"><?php _e( 'Author' ); ?></th> 1461 <th scope="col" class="action-links"><?php _e( 'Actions' ); ?></th> 1462 </tr> 1463 </thead> 1464 <tbody> 1465 1466 <?php echo $rows; ?> 1467 1468 </tbody> 1469 </table> 1470 1471 </form> 1472 1473 <?php 1474 else : 1475 echo "<ul class='post-revisions'>\n"; 1476 echo $rows; 1477 1478 // if the post was previously restored from a revision 1479 // show the restore event details 1480 if ( $restored_from_meta = get_post_meta( $post->ID, '_post_restored_from', true ) ) { 1481 $author = get_user_by( 'id', $restored_from_meta[ 'restored_by_user' ] ); 1482 /* translators: revision date format, see http://php.net/date */ 1483 $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); 1484 $date = date_i18n( $datef, strtotime( $restored_from_meta[ 'restored_time' ] ) ); 1485 $time_diff = human_time_diff( $restored_from_meta[ 'restored_time' ] ) ; 1425 echo "<ul class='post-revisions'>\n"; 1426 echo $rows; 1427 1428 // if the post was previously restored from a revision 1429 // show the restore event details 1430 if ( $restored_from_meta = get_post_meta( $post->ID, '_post_restored_from', true ) ) { 1431 $author = get_user_by( 'id', $restored_from_meta[ 'restored_by_user' ] ); 1432 /* translators: revision date format, see http://php.net/date */ 1433 $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); 1434 $date = date_i18n( $datef, strtotime( $restored_from_meta[ 'restored_time' ] ) ); 1435 $time_diff = human_time_diff( $restored_from_meta[ 'restored_time' ] ) ; 1436 ?> 1437 <hr /> 1438 <div id="revisions-meta-restored"> 1439 <?php 1440 printf( 1441 /* translators: restored revision details: 1: gravatar image, 2: author name, 3: time ago, 4: date */ 1442 __( 'Previously restored by %1$s %2$s, %3$s ago (%4$s)' ), 1443 get_avatar( $author->ID, 24 ), 1444 $author->display_name, 1445 $time_diff, 1446 $date 1447 ); 1486 1448 ?> 1487 <hr /> 1488 <div id="revisions-meta-restored"> 1489 <?php 1490 printf( 1491 /* translators: restored revision details: 1: gravatar image, 2: author name, 3: time ago, 4: date */ 1492 __( 'Previously restored by %1$s %2$s, %3$s ago (%4$s)' ), 1493 get_avatar( $author->ID, 24 ), 1494 $author->display_name, 1495 $time_diff, 1496 $date 1497 ); 1498 ?> 1499 </div> 1500 <?php 1449 </div> 1450 <?php 1501 1451 echo "</ul>"; 1502 } 1503 1504 endif; 1505 } 1452 } 1453 1454 }
Note: See TracChangeset
for help on using the changeset viewer.