Make WordPress Core

Ticket #24213: post-template.php.patch

File post-template.php.patch, 4.2 KB (added by a.hoereth, 12 years ago)

$format deprecated, removed 'form-table' conditional, re-indented rest

  • wp-includes/post-template.php

     
    14041404 * @uses get_edit_post_link()
    14051405 * @uses get_the_author_meta()
    14061406 *
    1407  * @todo split into two functions (list, form-table) ?
    1408  *
    14091407 * @param int|object $post_id Post ID or post object.
    14101408 * @param string|array $args See description {@link wp_parse_args()}.
    14111409 * @return null
     
    14141412        if ( !$post = get_post( $post_id ) )
    14151413                return;
    14161414
    1417         $defaults = array( 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' );
     1415        $defaults = array( 'right' => false, 'left' => false, 'format' => '', 'type' => 'all' );
    14181416        extract( wp_parse_args( $args, $defaults ), EXTR_SKIP );
     1417       
     1418        if ( !empty( $format ) )
     1419                _deprecated_argument( __FUNCTION__, '3.6' );
    14191420
    14201421        if ( !$revisions = wp_get_post_revisions( $post->ID ) )
    14211422                return;
     
    14321433                $rows .= "\t<li>" . wp_post_revision_title_expanded( $revision ) . "</li>\n";
    14331434        }
    14341435
    1435         if ( 'form-table' == $format ) : ?>
     1436        echo "<ul class='post-revisions'>\n";
     1437        echo $rows;
    14361438
    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' ] ) ;
     1439        // if the post was previously restored from a revision
     1440        // show the restore event details
     1441        if ( $restored_from_meta = get_post_meta( $post->ID, '_post_restored_from', true ) ) {
     1442                $author = get_user_by( 'id', $restored_from_meta[ 'restored_by_user' ] );
     1443                /* translators: revision date format, see http://php.net/date */
     1444                $datef = _x( 'j F, Y @ G:i:s', 'revision date format');
     1445                $date = date_i18n( $datef, strtotime( $restored_from_meta[ 'restored_time' ] ) );
     1446                $time_diff = human_time_diff( $restored_from_meta[ 'restored_time' ] ) ;
     1447                ?>
     1448                <hr />
     1449                <div id="revisions-meta-restored">
     1450                        <?php
     1451                        printf(
     1452                                /* translators: restored revision details: 1: gravatar image, 2: author name, 3: time ago, 4: date */
     1453                                __( 'Previously restored by %1$s %2$s, %3$s ago (%4$s)' ),
     1454                                get_avatar( $author->ID, 24 ),
     1455                                $author->display_name,
     1456                                $time_diff,
     1457                                $date
     1458                        );
    14861459                        ?>
    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
     1460                </div>
     1461                <?php
    15011462                echo "</ul>";
    1502                 }
     1463        }
    15031464
    1504         endif;
    15051465}