X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/f9001779751f83dc8a10e478bfecb4d8dd5f964c..99a64b9fd0d5ebb21c33c3a0b5865e9c412b430c:/wp-includes/capabilities.php diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index 7d8a00d7..28e75415 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -73,14 +73,11 @@ class WP_Roles { var $use_db = true; /** - * PHP4 Constructor - Call {@link WP_Roles::_init()} method. + * Constructor * * @since 2.0.0 - * @access public - * - * @return WP_Roles */ - function WP_Roles() { + function __construct() { $this->_init(); } @@ -269,7 +266,7 @@ class WP_Role { var $capabilities; /** - * PHP4 Constructor - Set up object properties. + * Constructor - Set up object properties. * * The list of capabilities, must have the key as the name of the capability * and the value a boolean of whether it is granted to the role. @@ -279,9 +276,8 @@ class WP_Role { * * @param string $role Role name. * @param array $capabilities List of capabilities. - * @return WP_Role */ - function WP_Role( $role, $capabilities ) { + function __construct( $role, $capabilities ) { $this->name = $role; $this->capabilities = $capabilities; } @@ -460,7 +456,7 @@ class WP_User { var $filter = null; /** - * PHP4 Constructor - Sets up the object properties. + * Constructor - Sets up the object properties. * * Retrieves the userdata and then assigns all of the data keys to direct * properties of the object. Calls {@link WP_User::_init_caps()} after @@ -474,7 +470,7 @@ class WP_User { * @param int $blog_id Optional Blog ID, defaults to current blog. * @return WP_User */ - function WP_User( $id, $name = '', $blog_id = '' ) { + function __construct( $id, $name = '', $blog_id = '' ) { if ( empty( $id ) && empty( $name ) ) return; @@ -824,6 +820,11 @@ function map_meta_cap( $cap, $user_id ) { case 'delete_page': $author_data = get_userdata( $user_id ); $post = get_post( $args[0] ); + + if ( 'revision' == $post->post_type ) { + $post = get_post( $post->post_parent ); + } + $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type->map_meta_cap ) { @@ -869,6 +870,11 @@ function map_meta_cap( $cap, $user_id ) { case 'edit_page': $author_data = get_userdata( $user_id ); $post = get_post( $args[0] ); + + if ( 'revision' == $post->post_type ) { + $post = get_post( $post->post_parent ); + } + $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type->map_meta_cap ) { @@ -913,6 +919,11 @@ function map_meta_cap( $cap, $user_id ) { case 'read_page': $author_data = get_userdata( $user_id ); $post = get_post( $args[0] ); + + if ( 'revision' == $post->post_type ) { + $post = get_post( $post->post_parent ); + } + $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type->map_meta_cap ) {