Changeset 7907 for trunk/wp-includes/post-template.php
- Timestamp:
- 05/08/2008 05:25:07 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r7883 r7907 567 567 568 568 /** 569 * wp_post_revision_ti me() - returns formatted datetimestamp of a revision569 * wp_post_revision_title() - returns formatted datetimestamp of a revision (linked to that revisions's page) 570 570 * 571 571 * @package WordPress … … 573 573 * @since 2.6 574 574 * 575 * @uses wp_get_revision()576 575 * @uses date_i18n() 577 576 * 578 577 * @param int|object $revision revision ID or revision object 578 * @param bool $link optional Link to revisions's page? 579 579 * @return string i18n formatted datetimestamp or localized 'Corrent Revision' 580 580 */ 581 function wp_post_revision_time( $revision ) { 582 if ( !$revision = wp_get_revision( $revision ) ) { 583 if ( $revision = get_post( $revision ) ) 584 return __( 'Current Revision' ); 581 function wp_post_revision_title( $revision, $link = true ) { 582 if ( !$revision = get_post( $revision ) ) 585 583 return $revision; 586 } 587 588 $datef = _c( 'j F, Y @ G:i|revision date format'); 589 return date_i18n( $datef, strtotime( $revision->post_date_gmt . ' +0000' ) ); 584 585 if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) 586 return false; 587 588 $datef = _c( 'j F, Y @ G:i|revision date format'); 589 $autosavef = __( '%s [Autosave]' ); 590 $currentf = __( '%s [Current Revision]' ); 591 592 $date = date_i18n( $datef, strtotime( $revision->post_modified_gmt . ' +0000' ) ); 593 if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) 594 $date = "<a href='$link'>$date</a>"; 595 596 if ( 'revision' != $revision->post_type ) 597 $date = sprintf( $currentf, $date ); 598 elseif ( "{$revision->post_parent}-autosave" == $revision->post_name ) 599 $date = sprintf( $autosavef, $date ); 600 601 return $date; 590 602 } 591 603 … … 606 618 * 607 619 * @uses wp_get_post_revisions() 608 * @uses wp_post_revision_ti me()620 * @uses wp_post_revision_title() 609 621 * @uses get_edit_post_link() 610 622 * @uses get_author_name() … … 631 643 $class = false; 632 644 foreach ( $revisions as $revision ) { 633 $date = wp_post_revision_time( $revision ); 634 if ( $link = get_edit_post_link( $revision->ID ) ) 635 $date = "<a href='$link'>$date</a>"; 645 $date = wp_post_revision_title( $revision ); 636 646 $name = get_author_name( $revision->post_author ); 637 647 638 648 if ( 'form-table' == $format ) { 639 649 if ( $left ) 640 $ old_checked = $left == $revision->ID ? ' checked="checked"' : '';650 $left_checked = $left == $revision->ID ? ' checked="checked"' : ''; 641 651 else 642 $ old_checked = $new_checked ? ' checked="checked"' : '';643 $ new_checked = $right == $revision->ID ? ' checked="checked"' : '';652 $left_checked = $right_checked ? ' checked="checked"' : ''; // [sic] (the next one) 653 $right_checked = $right == $revision->ID ? ' checked="checked"' : ''; 644 654 645 655 $class = $class ? '' : " class='alternate'"; 646 656 647 657 if ( $post->ID != $revision->ID && current_user_can( 'edit_post', $post->ID ) ) 648 $actions = '<a href="' . wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'diff' => false, ' restore' => 'restore' ) ), "restore-post_$post->ID|$revision->ID" ) . '">' . __( 'Restore' ) . '</a>';658 $actions = '<a href="' . wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'diff' => false, 'action' => 'restore' ) ), "restore-post_$post->ID|$revision->ID" ) . '">' . __( 'Restore' ) . '</a>'; 649 659 else 650 660 $actions = ''; 651 661 652 662 $rows .= "<tr$class>\n"; 653 $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name=' diff' value='$revision->ID'$old_checked /><input type='radio' name='revision' value='$revision->ID'$new_checked />\n";663 $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='$revision->ID'$left_checked /><input type='radio' name='right' value='$revision->ID'$right_checked />\n"; 654 664 $rows .= "\t<td>$date</td>\n"; 655 665 $rows .= "\t<td>$name</td>\n"; … … 657 667 $rows .= "</tr>\n"; 658 668 } else { 659 $rows .= "\t<li>" . sprintf( $titlef, $date, $name ). "</li>\n"; 669 $title = sprintf( $titlef, $date, $name ); 670 $rows .= "\t<li>$title</li>\n"; 660 671 } 661 672 } … … 668 679 <div class="alignleft"> 669 680 <input type="submit" class="button-secondary" value="<?php _e( 'Compare Revisions' ); ?>" /> 681 <input type="hidden" name="action" value="diff" /> 670 682 </div> 671 683 </div>
Note: See TracChangeset
for help on using the changeset viewer.