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:
parent
2f1777986c
commit
8ebc1c654e
|
@ -602,8 +602,8 @@ function post_author_meta_box($post) {
|
||||||
*
|
*
|
||||||
* @param object $post
|
* @param object $post
|
||||||
*/
|
*/
|
||||||
function post_revisions_meta_box($post) {
|
function post_revisions_meta_box( $post ) {
|
||||||
wp_list_post_revisions();
|
wp_list_post_revisions( $post );
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- Page related Meta Boxes
|
// -- Page related Meta Boxes
|
||||||
|
|
|
@ -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
|
* Can output either a UL with edit links or a TABLE with diff interface, and
|
||||||
* restore action links.
|
* 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
|
* @package WordPress
|
||||||
* @subpackage Post_Revisions
|
* @subpackage Post_Revisions
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
|
@ -1404,25 +1393,26 @@ function wp_post_revision_title_expanded( $revision, $link = true ) {
|
||||||
* @uses get_edit_post_link()
|
* @uses get_edit_post_link()
|
||||||
* @uses get_the_author_meta()
|
* @uses get_the_author_meta()
|
||||||
*
|
*
|
||||||
* @todo split into two functions (list, form-table) ?
|
|
||||||
*
|
|
||||||
* @param int|object $post_id Post ID or post object.
|
* @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
|
* @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 ) )
|
if ( ! $post = get_post( $post_id ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$defaults = array( 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' );
|
// $args array with (parent, format, right, left, type) deprecated since 3.6
|
||||||
extract( wp_parse_args( $args, $defaults ), EXTR_SKIP );
|
if ( is_array( $type ) ) {
|
||||||
|
$type = ! empty( $type['type'] ) ? $type['type'] : $type;
|
||||||
|
_deprecated_argument( __FUNCTION__, '3.6' );
|
||||||
|
}
|
||||||
|
|
||||||
if ( !$revisions = wp_get_post_revisions( $post->ID ) )
|
if ( ! $revisions = wp_get_post_revisions( $post->ID ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$rows = '';
|
$rows = '';
|
||||||
foreach ( $revisions as $revision ) {
|
foreach ( $revisions as $revision ) {
|
||||||
if ( !current_user_can( 'read_post', $revision->ID ) )
|
if ( ! current_user_can( 'read_post', $revision->ID ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$is_autosave = wp_is_post_autosave( $revision );
|
$is_autosave = wp_is_post_autosave( $revision );
|
||||||
|
@ -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";
|
$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 "<ul class='post-revisions'>\n";
|
||||||
echo $rows;
|
echo $rows;
|
||||||
|
|
||||||
|
@ -1501,5 +1451,4 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) {
|
||||||
echo "</ul>";
|
echo "</ul>";
|
||||||
}
|
}
|
||||||
|
|
||||||
endif;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue