From d9b7e7cf81785f986f40b91f81fad8d724bfeac7 Mon Sep 17 00:00:00 2001 From: westi Date: Wed, 8 Dec 2010 15:59:56 +0000 Subject: [PATCH] Condense the logic. Props nacin. git-svn-id: http://svn.automattic.com/wordpress/trunk@16799 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-xmlrpc-server.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index b8825febc7..c33368ac4e 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -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';