]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/capabilities.php
Wordpress 3.2.1
[autoinstalls/wordpress.git] / wp-includes / capabilities.php
index 7d8a00d73bbf721518d08ed1e3547c848b08a94d..28e75415527cff258d7f82f1f3ddb3b05472b871 100644 (file)
@@ -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 ) {