Condense the logic. Props nacin.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16799 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2010-12-08 15:59:56 +00:00
parent 183e561585
commit d9b7e7cf81
1 changed files with 3 additions and 9 deletions

View File

@ -2399,9 +2399,7 @@ class wp_xmlrpc_server extends IXR_Server {
$page_template = '';
if ( !empty( $content_struct['post_type'] ) ) {
if ( $content_struct['post_type'] == 'page' ) {
if ( $publish )
$cap = 'publish_pages';
elseif ('publish' == $content_struct['page_status'])
if ( $publish || 'publish' == $content_struct['page_status'] )
$cap = 'publish_pages';
else
$cap = 'edit_pages';
@ -2410,9 +2408,7 @@ class wp_xmlrpc_server extends IXR_Server {
if ( !empty( $content_struct['wp_page_template'] ) )
$page_template = $content_struct['wp_page_template'];
} elseif ( $content_struct['post_type'] == 'post' ) {
if ( $publish )
$cap = 'publish_posts';
elseif ('publish' == $content_struct['post_status'])
if ( $publish || 'publish' == $content_struct['post_status'] )
$cap = 'publish_posts';
else
$cap = 'edit_posts';
@ -2423,9 +2419,7 @@ class wp_xmlrpc_server extends IXR_Server {
return new IXR_Error( 401, __( 'Invalid post type.' ) );
}
} else {
if ( $publish )
$cap = 'publish_posts';
elseif ('publish' == $content_struct['post_status'])
if ( $publish || 'publish' == $content_struct['post_status'] )
$cap = 'publish_posts';
else
$cap = 'edit_posts';