Batch editing, first cut, see #6815
git-svn-id: http://svn.automattic.com/wordpress/trunk@8973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
78f973ad2c
commit
339e87dc5c
|
@ -731,8 +731,15 @@ break;
|
||||||
case 'inline-save':
|
case 'inline-save':
|
||||||
check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
|
check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
|
||||||
|
|
||||||
if ( ! isset($_POST['post_ID']) )
|
if ( ! isset($_POST['post_ID']) || ! ( $id = (int) $_POST['post_ID'] ) )
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
if ( $last = wp_check_post_lock( $id ) ) {
|
||||||
|
$last_user = get_userdata( $last );
|
||||||
|
$last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
|
||||||
|
echo '<tr><td colspan="8"><div class="error"><p>' . sprintf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ), wp_specialchars( $last_user_name ) ) . '</p></div></td></tr>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
inline_save_row( $_POST );
|
inline_save_row( $_POST );
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ if ( $page_links )
|
||||||
<option value="" selected><?php _e('Actions'); ?></option>
|
<option value="" selected><?php _e('Actions'); ?></option>
|
||||||
<option value="delete"><?php _e('Delete'); ?></option>
|
<option value="delete"><?php _e('Delete'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
|
||||||
<?php wp_nonce_field('bulk-categories'); ?>
|
<?php wp_nonce_field('bulk-categories'); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,8 @@ th.check-column + th, th.check-column + td {
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
.widefat .num {
|
.widefat .num,
|
||||||
|
.widefat .column-comments {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ if ( $page_links )
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<option value="delete"><?php _e('Delete'); ?></option>
|
<option value="delete"><?php _e('Delete'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" name="doaction" value="<?php _e('Apply'); ?>" class="button-secondary apply" />
|
<input type="submit" name="doaction" id="doaction" value="<?php _e('Apply'); ?>" class="button-secondary apply" />
|
||||||
<?php wp_nonce_field('bulk-comments'); ?>
|
<?php wp_nonce_field('bulk-comments'); ?>
|
||||||
<?php if ( isset($_GET['apage']) ) { ?>
|
<?php if ( isset($_GET['apage']) ) { ?>
|
||||||
<input type="hidden" name="apage" value="<?php echo absint( $_GET['apage'] ); ?>" />
|
<input type="hidden" name="apage" value="<?php echo absint( $_GET['apage'] ); ?>" />
|
||||||
|
|
|
@ -118,7 +118,7 @@ if ( $page_links )
|
||||||
<option value="" selected><?php _e('Actions'); ?></option>
|
<option value="" selected><?php _e('Actions'); ?></option>
|
||||||
<option value="delete"><?php _e('Delete'); ?></option>
|
<option value="delete"><?php _e('Delete'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
|
||||||
<?php wp_nonce_field('bulk-link-categories'); ?>
|
<?php wp_nonce_field('bulk-link-categories'); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -9,33 +9,52 @@
|
||||||
/** WordPress Administration Bootstrap */
|
/** WordPress Administration Bootstrap */
|
||||||
require_once('admin.php');
|
require_once('admin.php');
|
||||||
|
|
||||||
// Handle bulk deletes
|
// Handle bulk actions
|
||||||
if ( isset($_GET['action']) && isset($_GET['post']) && isset($_GET['doaction']) ) {
|
if ( isset($_GET['action']) && $_GET['action'] != -1 ) {
|
||||||
check_admin_referer('bulk-pages');
|
switch ( $_GET['action'] ) {
|
||||||
if ( $_GET['action'] == 'delete' ) {
|
case 'delete':
|
||||||
foreach( (array) $_GET['post'] as $post_id_del ) {
|
if ( isset($_GET['post']) && isset($_GET['doaction']) ) {
|
||||||
$post_del = & get_post($post_id_del);
|
check_admin_referer('bulk-pages');
|
||||||
|
foreach( (array) $_GET['post'] as $post_id_del ) {
|
||||||
if ( !current_user_can('delete_page', $post_id_del) )
|
$post_del = & get_post($post_id_del);
|
||||||
wp_die( __('You are not allowed to delete this page.') );
|
|
||||||
|
if ( !current_user_can('delete_page', $post_id_del) )
|
||||||
if ( $post_del->post_type == 'attachment' ) {
|
wp_die( __('You are not allowed to delete this page.') );
|
||||||
if ( ! wp_delete_attachment($post_id_del) )
|
|
||||||
wp_die( __('Error in deleting...') );
|
if ( $post_del->post_type == 'attachment' ) {
|
||||||
} else {
|
if ( ! wp_delete_attachment($post_id_del) )
|
||||||
if ( !wp_delete_post($post_id_del) )
|
wp_die( __('Error in deleting...') );
|
||||||
wp_die( __('Error in deleting...') );
|
} else {
|
||||||
|
if ( !wp_delete_post($post_id_del) )
|
||||||
|
wp_die( __('Error in deleting...') );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
case 'edit':
|
||||||
$sendback = wp_get_referer();
|
if ( isset($_GET['post']) ) {
|
||||||
if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
|
check_admin_referer('bulk-pages');
|
||||||
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
|
$_GET['post_status'] = $_GET['_status'];
|
||||||
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
|
|
||||||
|
if ( -1 == $_GET['post_author'] )
|
||||||
wp_redirect($sendback);
|
unset($_GET['post_author']);
|
||||||
exit();
|
|
||||||
|
$done = bulk_edit_posts($_GET);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
$sendback = wp_get_referer();
|
||||||
|
if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
|
||||||
|
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
|
||||||
|
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
|
||||||
|
if ( isset($done) ) {
|
||||||
|
$done['upd'] = count( $done['upd'] );
|
||||||
|
$done['skip'] = count( $done['skip'] );
|
||||||
|
$sendback = add_query_arg( $done, $sendback );
|
||||||
|
unset($done);
|
||||||
|
}
|
||||||
|
wp_redirect($sendback);
|
||||||
|
exit();
|
||||||
} elseif ( !empty($_GET['_wp_http_referer']) ) {
|
} elseif ( !empty($_GET['_wp_http_referer']) ) {
|
||||||
wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
|
wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
|
||||||
exit;
|
exit;
|
||||||
|
@ -85,6 +104,18 @@ require_once('admin-header.php');
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<?php if ( isset($_GET['upd']) && (int) $_GET['upd'] ) { ?>
|
||||||
|
<div id="message" class="updated fade"><p>
|
||||||
|
<?php printf( __ngettext( '%d page updated.', '%d pages updated.', $_GET['upd'] ), number_format_i18n( $_GET['upd'] ) );
|
||||||
|
unset($_GET['upd']);
|
||||||
|
|
||||||
|
if ( isset($_GET['skip']) && (int) $_GET['skip'] ) {
|
||||||
|
printf( __ngettext( ' %d page not updated. Somebody is editing it.', ' %d pages not updated. Somebody is editing them.', $_GET['skip'] ), number_format_i18n( $_GET['skip'] ) );
|
||||||
|
unset($_GET['skip']);
|
||||||
|
} ?>
|
||||||
|
</p></div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<form id="adv-settings" action="" method="get">
|
<form id="adv-settings" action="" method="get">
|
||||||
<div id="show-settings"><a href="#edit_settings" id="show-settings-link" class="hide-if-no-js"><?php _e('Advanced Options') ?></a>
|
<div id="show-settings"><a href="#edit_settings" id="show-settings-link" class="hide-if-no-js"><?php _e('Advanced Options') ?></a>
|
||||||
|
@ -175,7 +206,7 @@ if ( $page_links )
|
||||||
<option value="edit"><?php _e('Edit'); ?></option>
|
<option value="edit"><?php _e('Edit'); ?></option>
|
||||||
<option value="delete"><?php _e('Delete'); ?></option>
|
<option value="delete"><?php _e('Delete'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
|
||||||
<?php wp_nonce_field('bulk-pages'); ?>
|
<?php wp_nonce_field('bulk-pages'); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -197,12 +228,13 @@ if ($posts) {
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php inline_edit_row( 'page' ) ?>
|
|
||||||
<?php page_rows($posts, $pagenum, $per_page); ?>
|
<?php page_rows($posts, $pagenum, $per_page); ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<?php inline_edit_row( 'page' ) ?>
|
||||||
|
|
||||||
<div id="ajax-response"></div>
|
<div id="ajax-response"></div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -15,8 +15,6 @@ if ( ! defined('ABSPATH') ) die();
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<?php inline_edit_row( 'post' ) ?>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ( have_posts() ) {
|
if ( have_posts() ) {
|
||||||
|
|
|
@ -184,7 +184,7 @@ if ( $page_links )
|
||||||
<option value="" selected><?php _e('Actions'); ?></option>
|
<option value="" selected><?php _e('Actions'); ?></option>
|
||||||
<option value="delete"><?php _e('Delete'); ?></option>
|
<option value="delete"><?php _e('Delete'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
|
||||||
<?php wp_nonce_field('bulk-tags'); ?>
|
<?php wp_nonce_field('bulk-tags'); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
require_once('admin.php');
|
require_once('admin.php');
|
||||||
|
|
||||||
// Handle bulk actions
|
// Handle bulk actions
|
||||||
if ( isset($_GET['action']) && $_GET['action'] != -1 && isset($_GET['doaction']) ) {
|
if ( isset($_GET['action']) && $_GET['action'] != -1 ) {
|
||||||
switch ( $_GET['action'] ) {
|
switch ( $_GET['action'] ) {
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if ( isset($_GET['post']) ) {
|
if ( isset($_GET['post']) && isset($_GET['doaction']) ) {
|
||||||
check_admin_referer('bulk-posts');
|
check_admin_referer('bulk-posts');
|
||||||
foreach( (array) $_GET['post'] as $post_id_del ) {
|
foreach( (array) $_GET['post'] as $post_id_del ) {
|
||||||
$post_del = & get_post($post_id_del);
|
$post_del = & get_post($post_id_del);
|
||||||
|
@ -32,14 +32,28 @@ if ( isset($_GET['action']) && $_GET['action'] != -1 && isset($_GET['doaction'])
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'edit':
|
case 'edit':
|
||||||
// TODO: Decide what to do here - add bulk edit feature, or just disallow if >1 post selected
|
if ( isset($_GET['post']) ) {
|
||||||
|
check_admin_referer('bulk-posts');
|
||||||
|
$_GET['post_status'] = $_GET['_status'];
|
||||||
|
|
||||||
|
if ( -1 == $_GET['post_author'] )
|
||||||
|
unset($_GET['post_author']);
|
||||||
|
|
||||||
|
$done = bulk_edit_posts($_GET);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sendback = wp_get_referer();
|
$sendback = wp_get_referer();
|
||||||
if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
|
if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
|
||||||
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
|
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
|
||||||
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
|
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
|
||||||
|
if ( isset($done) ) {
|
||||||
|
$done['upd'] = count( $done['upd'] );
|
||||||
|
$done['skip'] = count( $done['skip'] );
|
||||||
|
$sendback = add_query_arg( $done, $sendback );
|
||||||
|
unset($done);
|
||||||
|
}
|
||||||
wp_redirect($sendback);
|
wp_redirect($sendback);
|
||||||
exit();
|
exit();
|
||||||
} elseif ( !empty($_GET['_wp_http_referer']) ) {
|
} elseif ( !empty($_GET['_wp_http_referer']) ) {
|
||||||
|
@ -79,6 +93,23 @@ else
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<?php if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
|
||||||
|
<div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div>
|
||||||
|
<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
|
||||||
|
endif; ?>
|
||||||
|
|
||||||
|
<?php if ( isset($_GET['upd']) && (int) $_GET['upd'] ) { ?>
|
||||||
|
<div id="message" class="updated fade"><p>
|
||||||
|
<?php printf( __ngettext( '%d post updated.', '%d posts updated.', $_GET['upd'] ), number_format_i18n( $_GET['upd'] ) );
|
||||||
|
unset($_GET['upd']);
|
||||||
|
|
||||||
|
if ( isset($_GET['skip']) && (int) $_GET['skip'] ) {
|
||||||
|
printf( __ngettext( ' %d post not updated. Somebody is editing it.', ' %d posts not updated. Somebody is editing them.', $_GET['skip'] ), number_format_i18n( $_GET['skip'] ) );
|
||||||
|
unset($_GET['skip']);
|
||||||
|
} ?>
|
||||||
|
</p></div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
|
|
||||||
<form id="adv-settings" action="" method="get">
|
<form id="adv-settings" action="" method="get">
|
||||||
|
@ -154,14 +185,7 @@ unset( $status_links );
|
||||||
|
|
||||||
<?php if ( isset($_GET['post_status'] ) ) : ?>
|
<?php if ( isset($_GET['post_status'] ) ) : ?>
|
||||||
<input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
|
<input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
|
||||||
<?php endif;
|
<?php endif; ?>
|
||||||
|
|
||||||
if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
|
|
||||||
<div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div>
|
|
||||||
<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
|
|
||||||
endif;
|
|
||||||
?>
|
|
||||||
|
|
||||||
<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
|
<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
|
||||||
|
|
||||||
<ul class="view-switch">
|
<ul class="view-switch">
|
||||||
|
@ -189,7 +213,7 @@ if ( $page_links )
|
||||||
<option value="edit"><?php _e('Edit'); ?></option>
|
<option value="edit"><?php _e('Edit'); ?></option>
|
||||||
<option value="delete"><?php _e('Delete'); ?></option>
|
<option value="delete"><?php _e('Delete'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
|
||||||
<?php wp_nonce_field('bulk-posts'); ?>
|
<?php wp_nonce_field('bulk-posts'); ?>
|
||||||
<?php
|
<?php
|
||||||
if ( !is_singular() ) {
|
if ( !is_singular() ) {
|
||||||
|
@ -243,6 +267,8 @@ do_action('restrict_manage_posts');
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<?php inline_edit_row( 'post' ); ?>
|
||||||
|
|
||||||
<div id="ajax-response"></div>
|
<div id="ajax-response"></div>
|
||||||
|
|
||||||
<div class="tablenav">
|
<div class="tablenav">
|
||||||
|
|
|
@ -31,7 +31,7 @@ endif;
|
||||||
<option value="" selected><?php _e('Actions'); ?></option>
|
<option value="" selected><?php _e('Actions'); ?></option>
|
||||||
<option value="archive"><?php _e('Archive'); ?></option>
|
<option value="archive"><?php _e('Archive'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
|
||||||
</div>
|
</div>
|
||||||
<br class="clear" />
|
<br class="clear" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -177,6 +177,68 @@ function edit_post( $post_data = null ) {
|
||||||
return $post_ID;
|
return $post_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bulk_edit_posts( $post_data = null ) {
|
||||||
|
|
||||||
|
if ( empty($post_data) )
|
||||||
|
$post_data = &$_POST;
|
||||||
|
|
||||||
|
if ( 'page' == $post_data['post_type'] ) {
|
||||||
|
if ( ! current_user_can( 'edit_pages' ) )
|
||||||
|
wp_die( __('You are not allowed to edit pages.') );
|
||||||
|
} else {
|
||||||
|
if ( ! current_user_can( 'edit_posts' ) )
|
||||||
|
wp_die( __('You are not allowed to edit posts.') );
|
||||||
|
}
|
||||||
|
|
||||||
|
$post_IDs = array_map( intval, (array) $post_data['post'] );
|
||||||
|
|
||||||
|
if ( isset($post_data['post_category']) ) {
|
||||||
|
if ( is_array($post_data['post_category']) && ! empty($post_data['post_category']) )
|
||||||
|
$new_cats = array_map( absint, $post_data['post_category'] );
|
||||||
|
else
|
||||||
|
unset($post_data['post_category']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset($post_data['tags_input']) ) {
|
||||||
|
if ( ! empty($post_data['tags_input']) ) {
|
||||||
|
$new_tags = preg_replace( '/\s*,\s*/', ',', rtrim($post_data['tags_input'], ' ,') );
|
||||||
|
$new_tags = explode(',', $new_tags);
|
||||||
|
} else {
|
||||||
|
unset($post_data['tags_input']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private' );
|
||||||
|
foreach ( $reset as $field ) {
|
||||||
|
if ( isset($post_data[$field]) && '' == $post_data[$field] )
|
||||||
|
unset($post_data[$field]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$updated = $skipped = array();
|
||||||
|
foreach ( $post_IDs as $post_ID ) {
|
||||||
|
|
||||||
|
if ( wp_check_post_lock( $post_ID ) ) {
|
||||||
|
$skipped[] = $post_ID;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset($new_cats) ) {
|
||||||
|
$cats = (array) wp_get_post_categories($post_ID);
|
||||||
|
$post_data['post_category'] = array_unique( array_merge($cats, $new_cats) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset($new_tags) ) {
|
||||||
|
$tags = wp_get_post_tags($post_ID, array('fields' => 'names'));
|
||||||
|
$post_data['tags_input'] = array_unique( array_merge($tags, $new_tags) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$post_data['ID'] = $post_ID;
|
||||||
|
$updated[] = wp_update_post( $post_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
return array( 'upd' => $updated, 'skip' => $skipped );
|
||||||
|
}
|
||||||
|
|
||||||
// Default post information to use when populating the "Write Post" form.
|
// Default post information to use when populating the "Write Post" form.
|
||||||
function get_default_post_to_edit() {
|
function get_default_post_to_edit() {
|
||||||
if ( !empty( $_REQUEST['post_title'] ) )
|
if ( !empty( $_REQUEST['post_title'] ) )
|
||||||
|
|
|
@ -622,8 +622,14 @@ function inline_edit_row( $type ) {
|
||||||
$hidden_count = empty($hidden[0]) ? 0 : count($hidden);
|
$hidden_count = empty($hidden[0]) ? 0 : count($hidden);
|
||||||
$col_count = count($columns) - $hidden_count;
|
$col_count = count($columns) - $hidden_count;
|
||||||
$m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
|
$m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
|
||||||
?>
|
$can_publish = current_user_can('publish_posts'); ?>
|
||||||
<tr title="<?php _e('Double-click to cancel'); ?>" id="inline-edit" style="display: none"><td colspan="<?php echo $col_count; ?>">
|
|
||||||
|
<form method="get" action=""><table style="display: none"><tbody id="inlineedit">
|
||||||
|
<?php
|
||||||
|
$bulk = 0;
|
||||||
|
while ( $bulk < 2 ) { ?>
|
||||||
|
|
||||||
|
<tr title="<?php _e('Double-click to cancel'); ?>" id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" style="display: none"><td colspan="<?php echo $col_count; ?>">
|
||||||
<?php
|
<?php
|
||||||
foreach($columns as $column_name=>$column_display_name) {
|
foreach($columns as $column_name=>$column_display_name) {
|
||||||
$class = "class=\"$column_name column-$column_name quick-edit-div\"";
|
$class = "class=\"$column_name column-$column_name quick-edit-div\"";
|
||||||
|
@ -640,7 +646,7 @@ function inline_edit_row( $type ) {
|
||||||
|
|
||||||
case 'modified':
|
case 'modified':
|
||||||
case 'date':
|
case 'date':
|
||||||
?>
|
if ( ! $bulk ) { ?>
|
||||||
<div <?php echo $attributes; ?> title="<?php _e('Timestamp'); ?>">
|
<div <?php echo $attributes; ?> title="<?php _e('Timestamp'); ?>">
|
||||||
<div class="title"><?php _e('Timestamp'); ?></div>
|
<div class="title"><?php _e('Timestamp'); ?></div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
|
@ -648,10 +654,19 @@ function inline_edit_row( $type ) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'title':
|
case 'title':
|
||||||
$attributes = "class=\"$type-title column-title quick-edit-div\"" . $style; ?>
|
$attributes = "class=\"$type-title column-title quick-edit-div\"" . $style; ?>
|
||||||
|
<?php if ( $bulk ) { ?>
|
||||||
|
<div <?php echo $attributes; ?> id="bulk-title-div" title="<?php $is_page ? _e('Selected pages') : _e('Selected posts'); ?>">
|
||||||
|
<div class="title"><?php $is_page ? _e('Selected pages') : _e('Selected posts'); ?></div>
|
||||||
|
<div class="in">
|
||||||
|
<div id="bulk-titles"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } else { ?>
|
||||||
<div <?php echo $attributes ?>>
|
<div <?php echo $attributes ?>>
|
||||||
<div class="title"><?php _e('Title'); ?></div>
|
<div class="title"><?php _e('Title'); ?></div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
|
@ -660,25 +675,36 @@ function inline_edit_row( $type ) {
|
||||||
<label title="<?php _e('Slug'); ?>"><?php _e('Slug'); ?><input type="text" name="post_name" value="" /></label></div>
|
<label title="<?php _e('Slug'); ?>"><?php _e('Slug'); ?><input type="text" name="post_name" value="" /></label></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ( $is_page ) { ?>
|
<?php if ( $is_page ) { ?>
|
||||||
<div class="parent quick-edit-div" title="<?php _e('Page Parent'); ?>">
|
<div class="parent quick-edit-div" title="<?php _e('Page Parent'); ?>">
|
||||||
<div class="title"><?php _e('Page Parent'); ?></div>
|
<div class="title"><?php _e('Page Parent'); ?></div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<select name="post_parent">
|
<select name="post_parent">
|
||||||
|
<?php if ( $bulk ) { ?>
|
||||||
|
<option value=""><?php _e('- No Change -'); ?></option>
|
||||||
|
<?php } ?>
|
||||||
<option value="0"><?php _e('Main Page (no parent)'); ?></option>
|
<option value="0"><?php _e('Main Page (no parent)'); ?></option>
|
||||||
<?php parent_dropdown(); ?>
|
<?php parent_dropdown(); ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="template quick-edit-div" title="<?php _e('Page Template'); ?>">
|
<div class="template quick-edit-div" title="<?php _e('Page Template'); ?>">
|
||||||
<div class="title"><?php _e('Page Template'); ?></div>
|
<div class="title"><?php _e('Page Template'); ?></div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<select name="page_template">
|
<select name="page_template">
|
||||||
<option value='default'><?php _e('Default Template'); ?></option>
|
<?php if ( $bulk ) { ?>
|
||||||
|
<option value=""><?php _e('- No Change -'); ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
<option value="default"><?php _e('Default Template'); ?></option>
|
||||||
<?php page_template_dropdown() ?>
|
<?php page_template_dropdown() ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if ( ! $bulk ) { ?>
|
||||||
<div class="order quick-edit-div" title="<?php _e('Page Order'); ?>">
|
<div class="order quick-edit-div" title="<?php _e('Page Order'); ?>">
|
||||||
<div class="title"><?php _e('Page Order'); ?></div>
|
<div class="title"><?php _e('Page Order'); ?></div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
|
@ -686,10 +712,12 @@ function inline_edit_row( $type ) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php }
|
<?php }
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'categories': ?>
|
case 'categories': ?>
|
||||||
|
<?php if ( ! $bulk ) { ?>
|
||||||
<div <?php echo $attributes ?> title="<?php _e('Categories'); ?>">
|
<div <?php echo $attributes ?> title="<?php _e('Categories'); ?>">
|
||||||
<div class="title"><?php _e('Categories'); ?>
|
<div class="title"><?php _e('Categories'); ?>
|
||||||
<span class="catshow"><?php _e('(expand)'); ?></span>
|
<span class="catshow"><?php _e('(expand)'); ?></span>
|
||||||
|
@ -698,28 +726,42 @@ function inline_edit_row( $type ) {
|
||||||
<?php wp_category_checklist(); ?>
|
<?php wp_category_checklist(); ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'tags': ?>
|
case 'tags': ?>
|
||||||
|
<?php if ( ! $bulk ) { ?>
|
||||||
<div <?php echo $attributes ?> title="<?php _e('Tags'); ?>">
|
<div <?php echo $attributes ?> title="<?php _e('Tags'); ?>">
|
||||||
<div class="title"><?php _e('Tags'); ?></div>
|
<div class="title"><?php _e('Tags'); ?></div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<textarea cols="22" rows="1" type="text" name="tags_input" class="tags_input"></textarea>
|
<textarea cols="22" rows="1" type="text" name="tags_input" class="tags_input"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'comments':
|
case 'comments':
|
||||||
$attributes = 'class="comments column-comments num quick-edit-div"' . $style; ?>
|
?>
|
||||||
<div <?php echo $attributes ?> title="<?php _e('Comments and Pings'); ?>">
|
<div <?php echo $attributes ?> title="<?php _e('Comments and Pings'); ?>">
|
||||||
<div class="title"><?php _e('Comments and Pings'); ?></div>
|
<div class="title"><?php _e('Comments and Pings'); ?></div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
|
<?php if ( $bulk ) { ?>
|
||||||
|
<select name="comment_status">
|
||||||
|
<option value=""><?php _e('- No Change -'); ?></option>
|
||||||
|
<option value="open"><?php _e('Allow Comments'); ?></option>
|
||||||
|
<option value="closed"><?php _e('Disallow Comments'); ?></option>
|
||||||
|
</select>
|
||||||
|
<select name="ping_status">
|
||||||
|
<option value=""><?php _e('- No Change -'); ?></option>
|
||||||
|
<option value="open"><?php _e('Allow Pings'); ?></option>
|
||||||
|
<option value="closed"><?php _e('Disallow Pings'); ?></option>
|
||||||
|
</select>
|
||||||
|
<?php } else { ?>
|
||||||
<label><input type="checkbox" name="comment_status" value="open" />
|
<label><input type="checkbox" name="comment_status" value="open" />
|
||||||
<?php _e('Allow Comments'); ?></label><br />
|
<?php _e('Allow Comments'); ?></label><br />
|
||||||
<label><input type="checkbox" name="ping_status" value="open" />
|
<label><input type="checkbox" name="ping_status" value="open" />
|
||||||
<?php _e('Allow Pings'); ?></label>
|
<?php _e('Allow Pings'); ?></label>
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
@ -731,20 +773,24 @@ function inline_edit_row( $type ) {
|
||||||
<div <?php echo $attributes ?> title="<?php _e('Author'); ?>">
|
<div <?php echo $attributes ?> title="<?php _e('Author'); ?>">
|
||||||
<div class="title"><?php _e('Author'); ?></div>
|
<div class="title"><?php _e('Author'); ?></div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'selected' => $post->post_author) ); ?>
|
<?php
|
||||||
|
$users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors');
|
||||||
|
if ( $bulk ) $users_opt['show_option_none'] = __('- No Change -');
|
||||||
|
wp_dropdown_users( $users_opt ); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( ! $bulk ) { ?>
|
||||||
<div class="password quick-edit-div" title="<?php _e('Password'); ?>">
|
<div class="password quick-edit-div" title="<?php _e('Password'); ?>">
|
||||||
<div class="title"><?php _e('Password'); ?></div>
|
<div class="title"><?php _e('Password'); ?></div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<input type="text" name="post_password" value="<?php the_post_password(); ?>" />
|
<input type="text" name="post_password" value="" />
|
||||||
<label title="<?php _e('Privacy'); ?>">
|
<label title="<?php _e('Privacy'); ?>">
|
||||||
<input type="checkbox" name="keep_private" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php echo $is_page ? __('Keep this page private') : __('Keep this post private'); ?></label>
|
<input type="checkbox" name="keep_private" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php echo $is_page ? __('Keep this page private') : __('Keep this post private'); ?></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'status': ?>
|
case 'status': ?>
|
||||||
|
@ -752,17 +798,23 @@ function inline_edit_row( $type ) {
|
||||||
<div class="title"><?php _e('Status'); ?></div>
|
<div class="title"><?php _e('Status'); ?></div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<select name="_status">
|
<select name="_status">
|
||||||
<?php if ( current_user_can('publish_posts') ) { // Contributors only get "Unpublished" and "Pending Review" ?>
|
<?php if ( $bulk ) { ?>
|
||||||
<option value='publish'><?php _e('Published') ?></option>
|
<option value=""><?php _e('- No Change -'); ?></option>
|
||||||
<option value='future'><?php _e('Scheduled') ?></option>
|
<?php if ( $can_publish ) { ?>
|
||||||
|
<option value="private"><?php _e('Private') ?></option>
|
||||||
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<option value='pending'><?php _e('Pending Review') ?></option>
|
<?php if ( $can_publish ) { // Contributors only get "Unpublished" and "Pending Review" ?>
|
||||||
<option value='draft'><?php _e('Unpublished') ?></option>
|
<option value="publish"><?php _e('Published') ?></option>
|
||||||
|
<option value="future"><?php _e('Scheduled') ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
<option value="pending"><?php _e('Pending Review') ?></option>
|
||||||
|
<option value="draft"><?php _e('Unpublished') ?></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ( current_user_can( 'edit_others_posts' ) && ! $is_page ) { ?>
|
<?php if ( ! $is_page && ! $bulk && current_user_can( 'edit_others_posts' ) ) { ?>
|
||||||
<div class="sticky quick-edit-div" <?php echo $style; ?> title="<?php _e('Sticky') ?>">
|
<div class="sticky quick-edit-div" <?php echo $style; ?> title="<?php _e('Sticky') ?>">
|
||||||
<div class="title"><?php _e('Sticky'); ?></div>
|
<div class="title"><?php _e('Sticky'); ?></div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
|
@ -773,24 +825,12 @@ function inline_edit_row( $type ) {
|
||||||
<?php }
|
<?php }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'control_view': ?>
|
default:
|
||||||
<div><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></div>
|
if ( $bulk )
|
||||||
<?php
|
do_action('bulk_edit_custom_box', $column_name, $type);
|
||||||
break;
|
else
|
||||||
|
do_action('quick_edit_custom_box', $column_name, $type);
|
||||||
|
|
||||||
case 'control_edit': ?>
|
|
||||||
<div><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></div>
|
|
||||||
<?php
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'control_delete': ?>
|
|
||||||
<div><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></div>
|
|
||||||
<?php
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: ?>
|
|
||||||
<div><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></div>
|
|
||||||
<?php
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} ?>
|
} ?>
|
||||||
|
@ -799,10 +839,14 @@ function inline_edit_row( $type ) {
|
||||||
<div class="quick-edit-save">
|
<div class="quick-edit-save">
|
||||||
<a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel"><?php _e('Cancel'); ?></a>
|
<a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel"><?php _e('Cancel'); ?></a>
|
||||||
<a accesskey="s" href="#inline-edit" title="<?php _e('Save'); ?>" class="button-secondary save"><?php _e('Save'); ?></a>
|
<a accesskey="s" href="#inline-edit" title="<?php _e('Save'); ?>" class="button-secondary save"><?php _e('Save'); ?></a>
|
||||||
<?php wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ) ?>
|
<?php if ( ! $bulk ) wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); ?>
|
||||||
<input type="hidden" name="post_view" value="<?php echo $m; ?>" />
|
<input type="hidden" name="post_view" value="<?php echo $m; ?>" />
|
||||||
</div>
|
</div>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
<?php
|
||||||
|
$bulk++;
|
||||||
|
} ?>
|
||||||
|
</tbody></table></form>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -844,31 +888,31 @@ function get_inline_data($post) {
|
||||||
$title = __('(no title)');
|
$title = __('(no title)');
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div id="inline_' . $post->ID . '">
|
<div class="hidden" id="inline_' . $post->ID . '">
|
||||||
<input type="hidden" name="" class="post_title" value="' . $title . '" />
|
<div class="post_title">' . $title . '</div>
|
||||||
<input type="hidden" name="" class="post_name" value="' . $post->post_name . '" />
|
<div class="post_name">' . $post->post_name . '</div>
|
||||||
<input type="hidden" name="" class="post_author" value="' . $post->post_author . '" />
|
<div class="post_author">' . $post->post_author . '</div>
|
||||||
<input type="hidden" name="" class="comment_status" value="' . $post->comment_status . '" />
|
<div class="comment_status">' . $post->comment_status . '</div>
|
||||||
<input type="hidden" name="" class="ping_status" value="' . $post->ping_status . '" />
|
<div class="ping_status">' . $post->ping_status . '</div>
|
||||||
<input type="hidden" name="" class="_status" value="' . $post->post_status . '" />
|
<div class="_status">' . $post->post_status . '</div>
|
||||||
<input type="hidden" name="" class="jj" value="' . mysql2date( 'd', $post->post_date ) . '" />
|
<div class="jj">' . mysql2date( 'd', $post->post_date ) . '</div>
|
||||||
<input type="hidden" name="" class="mm" value="' . mysql2date( 'm', $post->post_date ) . '" />
|
<div class="mm">' . mysql2date( 'm', $post->post_date ) . '</div>
|
||||||
<input type="hidden" name="" class="aa" value="' . mysql2date( 'Y', $post->post_date ) . '" />
|
<div class="aa">' . mysql2date( 'Y', $post->post_date ) . '</div>
|
||||||
<input type="hidden" name="" class="hh" value="' . mysql2date( 'H', $post->post_date ) . '" />
|
<div class="hh">' . mysql2date( 'H', $post->post_date ) . '</div>
|
||||||
<input type="hidden" name="" class="mn" value="' . mysql2date( 'i', $post->post_date ) . '" />
|
<div class="mn">' . mysql2date( 'i', $post->post_date ) . '</div>
|
||||||
<input type="hidden" name="" class="post_password" value="' . wp_specialchars($post->post_password, 1) . '" />';
|
<div class="post_password">' . wp_specialchars($post->post_password, 1) . '</div>';
|
||||||
|
|
||||||
if( $post->post_type == 'page' )
|
if( $post->post_type == 'page' )
|
||||||
echo '
|
echo '
|
||||||
<input type="hidden" name="" class="post_parent" value="' . $post->post_parent . '" />
|
<div class="post_parent">' . $post->post_parent . '</div>
|
||||||
<input type="hidden" name="" class="page_template" value="' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . '" />
|
<div class="page_template">' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . '</div>
|
||||||
<input type="hidden" name="" class="menu_order" value="' . $post->menu_order . '" />';
|
<div class="menu_order">' . $post->menu_order . '</div>';
|
||||||
|
|
||||||
if( $post->post_type == 'post' )
|
if( $post->post_type == 'post' )
|
||||||
echo '
|
echo '
|
||||||
<input type="hidden" name="" class="tags_input" value="' . wp_specialchars( str_replace( ',', ', ', get_tags_to_edit($post->ID) ), 1) . '" />
|
<div class="tags_input">' . wp_specialchars( str_replace( ',', ', ', get_tags_to_edit($post->ID) ), 1) . '</div>
|
||||||
<input type="hidden" name="" class="post_category" value="' . implode( ',', wp_get_post_categories( $post->ID ) ) . '" />
|
<div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div>
|
||||||
<input type="hidden" name="" class="sticky" value="' . (is_sticky($post->ID) ? 'sticky' : '') . '" />';
|
<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
@ -1035,7 +1079,6 @@ function _post_row($a_post, $pending_comments, $mode) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'comments':
|
case 'comments':
|
||||||
$attributes = 'class="comments column-comments num"' . $style;
|
|
||||||
?>
|
?>
|
||||||
<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
|
<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
|
||||||
<?php
|
<?php
|
||||||
|
@ -1210,7 +1253,6 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'comments':
|
case 'comments':
|
||||||
$attributes = 'class="comments column-comments num"' . $style;
|
|
||||||
?>
|
?>
|
||||||
<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
|
<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -1,33 +1,73 @@
|
||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
inlineEdit = {
|
inlineEdit = {
|
||||||
type : '',
|
|
||||||
rows : '',
|
|
||||||
|
|
||||||
init : function() {
|
init : function() {
|
||||||
var t = this, blankRow = $('#inline-edit');
|
var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit');
|
||||||
|
|
||||||
t.type = $('table.widefat').hasClass('page') ? 'page' : 'post';
|
t.type = $('table.widefat').hasClass('page') ? 'page' : 'post';
|
||||||
|
t.what = '#'+t.type+'-';
|
||||||
|
|
||||||
// get all editable rows
|
// get all editable rows
|
||||||
t.rows = $('tr.iedit');
|
t.rows = $('tr.iedit');
|
||||||
|
|
||||||
// prepare the edit row
|
// prepare the edit row
|
||||||
blankRow.dblclick(function() { inlineEdit.toggle(this); })
|
qeRow.dblclick(function() { inlineEdit.toggle(this); })
|
||||||
.keyup(function(e) { if(e.which == 27) return inlineEdit.revert(this); });
|
.keyup(function(e) { if(e.which == 27) return inlineEdit.revert(); });
|
||||||
|
|
||||||
$('a.cancel', blankRow).click(function() { return inlineEdit.revert(this); });
|
bulkRow.dblclick(function() { inlineEdit.revert(); })
|
||||||
$('a.save', blankRow).click(function() { return inlineEdit.save(this); });
|
.keyup(function(e) { if (e.which == 27) return inlineEdit.revert(); });
|
||||||
|
|
||||||
|
$('a.cancel', qeRow).click(function() { return inlineEdit.revert(); });
|
||||||
|
$('a.save', qeRow).click(function() { return inlineEdit.save(this); });
|
||||||
|
|
||||||
|
$('a.cancel', bulkRow).click(function() { return inlineEdit.revert(); });
|
||||||
|
$('a.save', bulkRow).click(function() { return inlineEdit.saveBulk(); });
|
||||||
|
|
||||||
// add events
|
// add events
|
||||||
t.rows.dblclick(function() { inlineEdit.toggle(this); });
|
t.rows.dblclick(function() { inlineEdit.toggle(this); });
|
||||||
t.addEvents(t.rows);
|
t.addEvents(t.rows);
|
||||||
|
|
||||||
|
$('#bulk-title-div').after(
|
||||||
|
$('#inline-edit div.categories').clone(),
|
||||||
|
$('#inline-edit div.tags').clone()
|
||||||
|
);
|
||||||
|
|
||||||
|
// categories expandable?
|
||||||
|
$('span.catshow').click(function() {
|
||||||
|
$('.inline-editor ul.cat-checklist').addClass("cat-hover");
|
||||||
|
$('.inline-editor span.cathide').show();
|
||||||
|
$(this).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('span.cathide').click(function() {
|
||||||
|
$('.inline-editor ul.cat-checklist').removeClass("cat-hover");
|
||||||
|
$('.inline-editor span.catshow').show();
|
||||||
|
$(this).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('select[name="_status"] option[value="future"]', bulkRow).remove();
|
||||||
|
|
||||||
|
$('#doaction').click(function(e){
|
||||||
|
if ( $('select[name="action"]').val() == 'edit' ) {
|
||||||
|
e.preventDefault();
|
||||||
|
t.setBulk();
|
||||||
|
} else if ( $('form#posts-filter tr.inline-editor').length > 0 ) {
|
||||||
|
t.revert();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#post-query-submit').click(function(e){
|
||||||
|
if ( $('form#posts-filter tr.inline-editor').length > 0 )
|
||||||
|
t.revert();
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle : function(el) {
|
toggle : function(el) {
|
||||||
var t = this;
|
var t = this;
|
||||||
|
|
||||||
$('#'+t.type+'-'+t.getId(el)).css('display') == 'none' ? t.revert(el) : t.edit(el);
|
$(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
|
||||||
},
|
},
|
||||||
|
|
||||||
addEvents : function(r) {
|
addEvents : function(r) {
|
||||||
|
@ -38,48 +78,66 @@ inlineEdit = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
edit : function(id) {
|
setBulk : function() {
|
||||||
var t = this, type = t.type, old = $('tr.inline-editor').attr('id');
|
var te = '', c = '';
|
||||||
|
this.revert();
|
||||||
|
|
||||||
if( typeof(id) == 'object' )
|
$('table.widefat tbody').prepend( $('#bulk-edit') );
|
||||||
|
$('#bulk-edit').addClass('inline-editor').show();
|
||||||
|
|
||||||
|
$('tbody th.check-column input[type="checkbox"]').each(function(i){
|
||||||
|
if ( $(this).attr('checked') ) {
|
||||||
|
var id = $(this).val();
|
||||||
|
c = c == '' ? ' class="alternate"' : '';
|
||||||
|
te += '<div'+c+'>'+$('#inline_'+id+' .post_title').text()+'</div>';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#bulk-titles').html(te);
|
||||||
|
|
||||||
|
// enable autocomplete for tags
|
||||||
|
if ( this.type == 'post' )
|
||||||
|
$('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
|
||||||
|
},
|
||||||
|
|
||||||
|
edit : function(id) {
|
||||||
|
var t = this;
|
||||||
|
t.revert();
|
||||||
|
|
||||||
|
if ( typeof(id) == 'object' )
|
||||||
id = t.getId(id);
|
id = t.getId(id);
|
||||||
|
|
||||||
if ( old ) {
|
|
||||||
old = old.split('-')[1];
|
|
||||||
t.revert(old);
|
|
||||||
}
|
|
||||||
|
|
||||||
var fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'post_password'];
|
var fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'post_password'];
|
||||||
if ( type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
|
if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
|
||||||
if ( type == 'post' ) fields.push('tags_input');
|
if ( t.type == 'post' ) fields.push('tags_input');
|
||||||
|
|
||||||
// add the new blank row
|
// add the new blank row
|
||||||
var editRow = $('#inline-edit').clone(true);
|
var editRow = $('#inline-edit').clone(true);
|
||||||
|
|
||||||
if ( $('#'+type+'-'+id).hasClass('alternate') )
|
if ( $(t.what+id).hasClass('alternate') )
|
||||||
$(editRow).addClass('alternate');
|
$(editRow).addClass('alternate');
|
||||||
$('#'+type+'-'+id).hide().after(editRow);
|
$(t.what+id).hide().after(editRow);
|
||||||
|
|
||||||
// populate the data
|
// populate the data
|
||||||
var rowData = $('#inline_'+id);
|
var rowData = $('#inline_'+id);
|
||||||
for ( var f = 0; f < fields.length; f++ ) {
|
for ( var f = 0; f < fields.length; f++ ) {
|
||||||
$(':input[name="'+fields[f]+'"]', editRow).val( $('.'+fields[f], rowData).val() );
|
$(':input[name="'+fields[f]+'"]', editRow).val( $('.'+fields[f], rowData).text() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $('.comment_status', rowData).val() == 'open' )
|
if ( $('.comment_status', rowData).text() == 'open' )
|
||||||
$('input[name="comment_status"]', editRow).attr("checked", "checked");
|
$('input[name="comment_status"]', editRow).attr("checked", "checked");
|
||||||
if ( $('.ping_status', rowData).val() == 'open' )
|
if ( $('.ping_status', rowData).text() == 'open' )
|
||||||
$('input[name="ping_status"]', editRow).attr("checked", "checked");
|
$('input[name="ping_status"]', editRow).attr("checked", "checked");
|
||||||
if ( $('.sticky', rowData).val() == 'sticky' )
|
if ( $('.sticky', rowData).text() == 'sticky' )
|
||||||
$('input[name="sticky"]', editRow).attr("checked", "checked");
|
$('input[name="sticky"]', editRow).attr("checked", "checked");
|
||||||
|
|
||||||
// categories
|
// categories
|
||||||
var cats;
|
var cats;
|
||||||
if ( cats = $('.post_category', rowData).val() )
|
if ( cats = $('.post_category', rowData).text() )
|
||||||
$('ul.cat-checklist :checkbox').val(cats.split(','));
|
$('ul.cat-checklist :checkbox', editRow).val(cats.split(','));
|
||||||
|
|
||||||
// handle the post status
|
// handle the post status
|
||||||
var status = $('._status', rowData).val();
|
var status = $('._status', rowData).text();
|
||||||
if ( status != 'future' ) $('select[name="_status"] option[value="future"]', editRow).remove();
|
if ( status != 'future' ) $('select[name="_status"] option[value="future"]', editRow).remove();
|
||||||
if ( status == 'private' ) $('input[name="keep_private"]', editRow).attr("checked", "checked");
|
if ( status == 'private' ) $('input[name="keep_private"]', editRow).attr("checked", "checked");
|
||||||
|
|
||||||
|
@ -99,24 +157,11 @@ inlineEdit = {
|
||||||
pageOpt.remove();
|
pageOpt.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
// categories expandable?
|
|
||||||
$('span.catshow', editRow).click(function() {
|
|
||||||
$('ul.cat-checklist', editRow).addClass("cat-hover");
|
|
||||||
$('span.cathide', editRow).show();
|
|
||||||
$(this).hide();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('span.cathide', editRow).click(function() {
|
|
||||||
$('ul.cat-checklist', editRow).removeClass("cat-hover");
|
|
||||||
$('span.catshow', editRow).show();
|
|
||||||
$(this).hide();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
|
$(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
|
||||||
$('.ptitle', editRow).focus();
|
$('.ptitle', editRow).focus();
|
||||||
|
|
||||||
// enable autocomplete for tags
|
// enable autocomplete for tags
|
||||||
if ( type == 'post' )
|
if ( t.type == 'post' )
|
||||||
$('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
|
$('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -140,25 +185,36 @@ inlineEdit = {
|
||||||
|
|
||||||
// make ajax request
|
// make ajax request
|
||||||
$.post('admin-ajax.php', params,
|
$.post('admin-ajax.php', params,
|
||||||
function(html) {
|
function(r) {
|
||||||
var row = $('#'+inlineEdit.type+'-'+id);
|
var row = $(inlineEdit.what+id);
|
||||||
$('#edit-'+id).hide();
|
$('#edit-'+id).remove();
|
||||||
html = $(html).html();
|
row.html($(r).html()).show()
|
||||||
row.html(html).show();
|
.animate( { backgroundColor: '#CCEEBB' }, 500)
|
||||||
row.animate( { backgroundColor: '#FFFBCC' }, 200)
|
.animate( { backgroundColor: '#eefee7' }, 500);
|
||||||
.animate( { backgroundColor: row.css('background-color') }, 500);
|
|
||||||
inlineEdit.addEvents(row);
|
inlineEdit.addEvents(row);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
revert : function(id) {
|
saveBulk : function() {
|
||||||
if ( typeof(id) == 'object' )
|
$('form#posts-filter').submit();
|
||||||
id = this.getId(id);
|
},
|
||||||
|
|
||||||
$('#edit-'+id).remove();
|
revert : function() {
|
||||||
$('#'+this.type+'-'+id).show();
|
var id;
|
||||||
|
|
||||||
|
if ( id = $('table.widefat tr.inline-editor').attr('id') ) {
|
||||||
|
if ( 'bulk-edit' == id ) {
|
||||||
|
$('table.widefat #bulk-edit').removeClass('inline-editor').hide();
|
||||||
|
$('#bulk-titles').html('');
|
||||||
|
$('#inlineedit').append( $('#bulk-edit') );
|
||||||
|
} else {
|
||||||
|
$('#'+id).remove();
|
||||||
|
id = id.substr( id.lastIndexOf('-') + 1 );
|
||||||
|
$(this.what+id).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
|
@ -120,7 +120,7 @@ if ( isset($_GET['deleted']) ) {
|
||||||
<option value="" selected><?php _e('Actions'); ?></option>
|
<option value="" selected><?php _e('Actions'); ?></option>
|
||||||
<option value="delete"><?php _e('Delete'); ?></option>
|
<option value="delete"><?php _e('Delete'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
|
||||||
<?php
|
<?php
|
||||||
$categories = get_terms('link_category', "hide_empty=1");
|
$categories = get_terms('link_category', "hide_empty=1");
|
||||||
$select_cat = "<select name=\"cat_id\">\n";
|
$select_cat = "<select name=\"cat_id\">\n";
|
||||||
|
|
|
@ -331,7 +331,7 @@ function print_plugins_table($plugins, $context = '') {
|
||||||
<option value="" selected><?php _e('Actions'); ?></option>
|
<option value="" selected><?php _e('Actions'); ?></option>
|
||||||
<option value="deactivate-selected"><?php _e('Deactivate'); ?></option>
|
<option value="deactivate-selected"><?php _e('Deactivate'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" name="doaction" value="<?php _e('Apply'); ?>" class="button-secondary action" />
|
<input type="submit" name="doaction_active" value="<?php _e('Apply'); ?>" class="button-secondary action" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br class="clear" />
|
<br class="clear" />
|
||||||
|
@ -356,7 +356,7 @@ function print_plugins_table($plugins, $context = '') {
|
||||||
<option value="delete-selected"><?php _e('Delete'); ?></option>
|
<option value="delete-selected"><?php _e('Delete'); ?></option>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction_recent" class="button-secondary action" />
|
||||||
<input type="submit" name="clear-recent-list" value="<?php _e('Clear List') ?>" class="button-secondary" />
|
<input type="submit" name="clear-recent-list" value="<?php _e('Clear List') ?>" class="button-secondary" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -271,7 +271,7 @@ if ( $page_links )
|
||||||
<option value="attach"><?php _e('Attach to a post'); ?></option>
|
<option value="attach"><?php _e('Attach to a post'); ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" id="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
<input type="submit" id="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
|
||||||
<?php wp_nonce_field('bulk-media'); ?>
|
<?php wp_nonce_field('bulk-media'); ?>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,7 @@ unset($role_links);
|
||||||
<option value="" selected><?php _e('Actions'); ?></option>
|
<option value="" selected><?php _e('Actions'); ?></option>
|
||||||
<option value="delete"><?php _e('Delete'); ?></option>
|
<option value="delete"><?php _e('Delete'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
|
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
|
||||||
<label class="hidden" for="new_role"><?php _e('Change role to…') ?></label><select name="new_role" id="new_role"><option value=''><?php _e('Change role to…') ?></option><?php wp_dropdown_roles(); ?></select>
|
<label class="hidden" for="new_role"><?php _e('Change role to…') ?></label><select name="new_role" id="new_role"><option value=''><?php _e('Change role to…') ?></option><?php wp_dropdown_roles(); ?></select>
|
||||||
<input type="submit" value="<?php _e('Change'); ?>" name="changeit" class="button-secondary" />
|
<input type="submit" value="<?php _e('Change'); ?>" name="changeit" class="button-secondary" />
|
||||||
<?php wp_nonce_field('bulk-users'); ?>
|
<?php wp_nonce_field('bulk-users'); ?>
|
||||||
|
|
|
@ -2203,7 +2203,9 @@ a.togbox {
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-editor div.title {
|
.inline-editor div.title {
|
||||||
padding: 2px 5px;
|
height: 18px;
|
||||||
|
line-height: 16px;
|
||||||
|
padding: 1px 5px;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2212,6 +2214,12 @@ a.togbox {
|
||||||
width: 260px;
|
width: 260px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#bulk-edit .post-title,
|
||||||
|
#bulk-edit .page-title {
|
||||||
|
width: 200px;
|
||||||
|
height: 179px;
|
||||||
|
}
|
||||||
|
|
||||||
.inline-editor .post-title .ptitle,
|
.inline-editor .post-title .ptitle,
|
||||||
.inline-editor .page-title .ptitle {
|
.inline-editor .page-title .ptitle {
|
||||||
width: 245px;
|
width: 245px;
|
||||||
|
@ -2258,7 +2266,7 @@ a.togbox {
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-editor .categories {
|
.inline-editor .categories {
|
||||||
width: 180px;
|
width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-editor .categories ul.cat-checklist {
|
.inline-editor .categories ul.cat-checklist {
|
||||||
|
@ -2275,7 +2283,7 @@ a.togbox {
|
||||||
|
|
||||||
.inline-editor .categories ul.cat-hover {
|
.inline-editor .categories ul.cat-hover {
|
||||||
height: 200px;
|
height: 200px;
|
||||||
overflow: auto;
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-editor .categories ul.children {
|
.inline-editor .categories ul.children {
|
||||||
|
@ -2301,14 +2309,14 @@ a.togbox {
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-editor .tags {
|
.inline-editor .tags {
|
||||||
width: 220px;
|
width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-editor textarea {
|
.inline-editor textarea {
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
height: 45px;
|
height: 45px;
|
||||||
width: 200px;
|
width: 180px;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2317,10 +2325,33 @@ a.togbox {
|
||||||
width: 160px;
|
width: 160px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#wpbody-content .inline-editor .comments select {
|
||||||
|
margin-bottom: 3px;
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inline-editor .parent {
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wpbody-content .inline-editor .parent select {
|
||||||
|
width: 170px;
|
||||||
|
}
|
||||||
|
|
||||||
.inline-editor .quick-edit-save {
|
.inline-editor .quick-edit-save {
|
||||||
padding: 8px 10px;
|
padding: 8px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#bulk-titles {
|
||||||
|
height: 150px;
|
||||||
|
overflow: auto;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bulk-titles div {
|
||||||
|
padding: 1px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Media library */
|
/* Media library */
|
||||||
#wpbody-content .media-item-info tr {
|
#wpbody-content .media-item-info tr {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
|
Loading…
Reference in New Issue