Revisions: Mark deprecated arguments in wp_list_post_revisions().

* Second argument is now a string, which controls the revision type
* Back compat for $args['type']
* Remove lines for the old form-table format, since it's now just a list 

props a.hoereth. fixes #24213.

git-svn-id: http://core.svn.wordpress.org/trunk@24175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2013-05-04 12:54:00 +00:00
parent 2f1777986c
commit 8ebc1c654e
2 changed files with 38 additions and 89 deletions

View File

@ -603,7 +603,7 @@ function post_author_meta_box($post) {
* @param object $post
*/
function post_revisions_meta_box( $post ) {
wp_list_post_revisions();
wp_list_post_revisions( $post );
}
// -- Page related Meta Boxes

View File

@ -1384,17 +1384,6 @@ function wp_post_revision_title_expanded( $revision, $link = true ) {
* Can output either a UL with edit links or a TABLE with diff interface, and
* restore action links.
*
* Second argument controls parameters:
* (bool) parent : include the parent (the "Current Revision") in the list.
* Deprecated (ignored), since 3.6 the revisions always include
* a copy of the current post.
* (string) format : 'list' or 'form-table'. 'list' outputs UL, 'form-table'
* outputs TABLE with UI.
* (int) right : what revision is currently being viewed - used in
* form-table format.
* (int) left : what revision is currently being diffed against right -
* used in form-table format.
*
* @package WordPress
* @subpackage Post_Revisions
* @since 2.6.0
@ -1404,18 +1393,19 @@ function wp_post_revision_title_expanded( $revision, $link = true ) {
* @uses get_edit_post_link()
* @uses get_the_author_meta()
*
* @todo split into two functions (list, form-table) ?
*
* @param int|object $post_id Post ID or post object.
* @param string|array $args See description {@link wp_parse_args()}.
* @param string $type 'all' (default), 'revision' or 'autosave'
* @return null
*/
function wp_list_post_revisions( $post_id = 0, $args = null ) {
function wp_list_post_revisions( $post_id = 0, $type = 'all' ) {
if ( ! $post = get_post( $post_id ) )
return;
$defaults = array( 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' );
extract( wp_parse_args( $args, $defaults ), EXTR_SKIP );
// $args array with (parent, format, right, left, type) deprecated since 3.6
if ( is_array( $type ) ) {
$type = ! empty( $type['type'] ) ? $type['type'] : $type;
_deprecated_argument( __FUNCTION__, '3.6' );
}
if ( ! $revisions = wp_get_post_revisions( $post->ID ) )
return;
@ -1432,46 +1422,6 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) {
$rows .= "\t<li>" . wp_post_revision_title_expanded( $revision ) . "</li>\n";
}
if ( 'form-table' == $format ) : ?>
<form action="revision.php" method="get">
<div class="tablenav">
<div class="alignleft">
<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Compare Revisions' ); ?>" />
<input type="hidden" name="action" value="diff" />
<input type="hidden" name="post_type" value="<?php echo esc_attr($post->post_type); ?>" />
</div>
</div>
<br class="clear" />
<table class="widefat post-revisions" cellspacing="0" id="post-revisions">
<col />
<col />
<col style="width: 33%" />
<col style="width: 33%" />
<col style="width: 33%" />
<thead>
<tr>
<th scope="col"><?php /* translators: column name in revisions */ _ex( 'Old', 'revisions column name' ); ?></th>
<th scope="col"><?php /* translators: column name in revisions */ _ex( 'New', 'revisions column name' ); ?></th>
<th scope="col"><?php /* translators: column name in revisions */ _ex( 'Date Created', 'revisions column name' ); ?></th>
<th scope="col"><?php _e( 'Author' ); ?></th>
<th scope="col" class="action-links"><?php _e( 'Actions' ); ?></th>
</tr>
</thead>
<tbody>
<?php echo $rows; ?>
</tbody>
</table>
</form>
<?php
else :
echo "<ul class='post-revisions'>\n";
echo $rows;
@ -1501,5 +1451,4 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) {
echo "</ul>";
}
endif;
}