Changeset 18194 for trunk/wp-includes/admin-bar.php
- Timestamp:
- 06/08/2011 04:49:27 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/admin-bar.php
r18164 r18194 90 90 /* Add the "My Account" sub menus */ 91 91 $wp_admin_bar->add_menu( array( 'parent' => $id, 'title' => __( 'Edit My Profile' ), 'href' => get_edit_profile_url( $user_id ) ) ); 92 if ( is_multisite() )93 $wp_admin_bar->add_menu( array( 'parent' => $id, 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );94 else95 $wp_admin_bar->add_menu( array( 'parent' => $id, 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );96 92 $wp_admin_bar->add_menu( array( 'parent' => $id, 'title' => __( 'Log Out' ), 'href' => wp_logout_url() ) ); 97 93 } 94 } 95 96 /** 97 * Add the "Dashboard"/"View Site" menu. 98 * 99 * @since 3.2.0 100 */ 101 function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { 102 if ( is_admin() ) 103 $wp_admin_bar->add_menu( array( 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); 104 elseif ( is_multisite() ) 105 $wp_admin_bar->add_menu( array( 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( get_current_user_id() ) ) ); 106 else 107 $wp_admin_bar->add_menu( array( 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); 98 108 } 99 109 … … 161 171 */ 162 172 function wp_admin_bar_edit_menu( $wp_admin_bar ) { 163 $current_object = get_queried_object(); 164 165 if ( empty($current_object) ) 166 return; 167 168 if ( ! empty( $current_object->post_type ) && ( $post_type_object = get_post_type_object( $current_object->post_type ) ) && current_user_can( $post_type_object->cap->edit_post, $current_object->ID ) && ( $post_type_object->show_ui || 'attachment' == $current_object->post_type ) ) { 169 $wp_admin_bar->add_menu( array( 'id' => 'edit', 'title' => $post_type_object->labels->edit_item, 'href' => get_edit_post_link( $current_object->ID ) ) ); 170 } elseif ( ! empty( $current_object->taxonomy ) && ( $tax = get_taxonomy( $current_object->taxonomy ) ) && current_user_can( $tax->cap->edit_terms ) && $tax->show_ui ) { 171 $wp_admin_bar->add_menu( array( 'id' => 'edit', 'title' => $tax->labels->edit_item, 'href' => get_edit_term_link( $current_object->term_id, $current_object->taxonomy ) ) ); 173 global $post, $tag; 174 175 if ( is_admin() ) { 176 $current_screen = get_current_screen(); 177 178 if ( 'post' == $current_screen->base 179 && 'add' != $current_screen->action 180 && ( $post_type_object = get_post_type_object( $post->post_type ) ) 181 && current_user_can( $post_type_object->cap->read_post, $post->ID ) 182 && ( $post_type_object->public ) ) 183 { 184 $wp_admin_bar->add_menu( array( 185 'id' => 'view', 186 'title' => $post_type_object->labels->view_item, 187 'href' => get_permalink( $post->ID ) 188 ) ); 189 } elseif ( 'edit-tags' == $current_screen->base 190 && isset( $tag ) && is_object( $tag ) 191 && ( $tax = get_taxonomy( $tag->taxonomy ) ) 192 && $tax->public ) 193 { 194 $wp_admin_bar->add_menu( array( 195 'id' => 'view', 196 'title' => $tax->labels->view_item, 197 'href' => get_term_link( $tag ) 198 ) ); 199 } 200 } else { 201 $current_object = get_queried_object(); 202 203 if ( empty($current_object) ) 204 return; 205 206 if ( ! empty( $current_object->post_type ) 207 && ( $post_type_object = get_post_type_object( $current_object->post_type ) ) 208 && current_user_can( $post_type_object->cap->edit_post, $current_object->ID ) 209 && ( $post_type_object->show_ui || 'attachment' == $current_object->post_type ) ) 210 { 211 $wp_admin_bar->add_menu( array( 212 'id' => 'edit', 213 'title' => $post_type_object->labels->edit_item, 214 'href' => get_edit_post_link( $current_object->ID ) 215 ) ); 216 } elseif ( ! empty( $current_object->taxonomy ) 217 && ( $tax = get_taxonomy( $current_object->taxonomy ) ) 218 && current_user_can( $tax->cap->edit_terms ) 219 && $tax->show_ui ) 220 { 221 $wp_admin_bar->add_menu( array( 222 'id' => 'edit', 223 'title' => $tax->labels->edit_item, 224 'href' => get_edit_term_link( $current_object->term_id, $current_object->taxonomy ) 225 ) ); 226 } 172 227 } 173 228 }
Note: See TracChangeset
for help on using the changeset viewer.