Ticket #12997: 12997.diff
File 12997.diff, 2.1 KB (added by , 15 years ago) |
---|
-
wp-includes/capabilities.php
299 299 function add_cap( $cap, $grant = true ) { 300 300 global $wp_roles; 301 301 302 if ( ! isset( $wp_roles ) )303 $wp_roles = new WP_Roles();304 305 302 $this->capabilities[$cap] = $grant; 306 303 $wp_roles->add_cap( $this->name, $cap, $grant ); 307 304 } … … 322 319 function remove_cap( $cap ) { 323 320 global $wp_roles; 324 321 325 if ( ! isset( $wp_roles ) )326 $wp_roles = new WP_Roles();327 328 322 unset( $this->capabilities[$cap] ); 329 323 $wp_roles->remove_cap( $this->name, $cap ); 330 324 } … … 539 533 function get_role_caps() { 540 534 global $wp_roles; 541 535 542 if ( ! isset( $wp_roles ) ) 543 $wp_roles = new WP_Roles(); 544 545 //Filter out caps that are not role names and assign to $this->roles 536 // Filter out caps that are not role names and assign to $this->roles 546 537 if ( is_array( $this->caps ) ) 547 538 $this->roles = array_filter( array_keys( $this->caps ), array( &$wp_roles, 'is_role' ) ); 548 539 … … 1109 1100 function get_role( $role ) { 1110 1101 global $wp_roles; 1111 1102 1112 if ( ! isset( $wp_roles ) )1113 $wp_roles = new WP_Roles();1114 1115 1103 return $wp_roles->get_role( $role ); 1116 1104 } 1117 1105 … … 1129 1117 function add_role( $role, $display_name, $capabilities = array() ) { 1130 1118 global $wp_roles; 1131 1119 1132 if ( ! isset( $wp_roles ) )1133 $wp_roles = new WP_Roles();1134 1135 1120 return $wp_roles->add_role( $role, $display_name, $capabilities ); 1136 1121 } 1137 1122 … … 1147 1132 function remove_role( $role ) { 1148 1133 global $wp_roles; 1149 1134 1150 if ( ! isset( $wp_roles ) )1151 $wp_roles = new WP_Roles();1152 1153 1135 return $wp_roles->remove_role( $role ); 1154 1136 } 1155 1137 -
wp-settings.php
234 234 $wp =& new WP(); 235 235 236 236 /** 237 * WordPress Roles Object 238 * @global object $wp_roles 239 * @since 2.0.0 240 */ 241 $wp_roles =& new WP_Roles(); 242 243 /** 237 244 * WordPress Widget Factory Object 238 245 * @global object $wp_widget_factory 239 246 * @since 2.8.0