Ticket #13876: 13876.2.diff
File 13876.2.diff, 2.9 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/template.php
3316 3316 * @since unknown 3317 3317 */ 3318 3318 function favorite_actions( $screen = null ) { 3319 global $post_type_object;3320 3321 3319 $default_action = false; 3322 3320 3323 3321 if ( is_string($screen) ) 3324 3322 $screen = convert_to_screen($screen); 3325 3323 3326 if ( isset($post_type_object) ) { 3327 switch ( $screen->id ) { 3328 case $post_type_object->name: 3329 $default_action = array('edit.php?post_type=' . $post_type_object->name => array($post_type_object->labels->edit_item, $post_type_object->cap->edit_posts)); 3330 break; 3331 case "edit-{$post_type_object->name}": 3332 $default_action = array('post-new.php?post_type=' . $post_type_object->name => array($post_type_object->labels->new_item, $post_type_object->cap->edit_posts)); 3333 break; 3334 } 3324 if ( isset($screen->post_type) ) { 3325 $post_type_object = get_post_type_object($screen->post_type); 3326 if ( 'add' != $screen->action ) 3327 $default_action = array('post-new.php?post_type=' . $post_type_object->name => array($post_type_object->labels->new_item, $post_type_object->cap->edit_posts)); 3328 else 3329 $default_action = array('edit.php?post_type=' . $post_type_object->name => array($post_type_object->labels->edit_item, $post_type_object->cap->edit_posts)); 3335 3330 } 3336 3331 3337 3332 if ( !$default_action ) { … … 3343 3338 $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files')); 3344 3339 break; 3345 3340 case 'link-manager': 3346 $default_action = array('link-add.php' => array(__('New Link'), 'manage_links')); 3341 case 'link': 3342 if ( 'add' != $screen->action ) 3343 $default_action = array('link-add.php' => array(__('New Link'), 'manage_links')); 3344 else 3345 $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links')); 3347 3346 break; 3348 case 'link-add':3349 $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links'));3350 break;3351 3347 case 'users': 3352 3348 $default_action = array('user-new.php' => array(__('New User'), 'create_users')); 3353 3349 break; … … 3902 3898 function set_current_screen( $id = '' ) { 3903 3899 global $current_screen, $hook_suffix, $typenow, $taxnow; 3904 3900 3901 $action = ''; 3902 3905 3903 if ( empty($id) ) { 3906 3904 $current_screen = $hook_suffix; 3907 3905 $current_screen = str_replace('.php', '', $current_screen); 3906 if ( preg_match('/-add|-new$/', $current_screen) ) 3907 $action = 'add'; 3908 3908 $current_screen = str_replace('-new', '', $current_screen); 3909 3909 $current_screen = str_replace('-add', '', $current_screen); 3910 3910 $current_screen = array('id' => $current_screen, 'base' => $current_screen); … … 3923 3923 3924 3924 $current_screen = (object) $current_screen; 3925 3925 3926 $current_screen->action = $action; 3927 3926 3928 // Map index to dashboard 3927 3929 if ( 'index' == $current_screen->base ) 3928 3930 $current_screen->base = 'dashboard';