Changeset 12728
- Timestamp:
- 01/15/2010 04:58:36 PM (15 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 1 deleted
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r12597 r12728 1004 1004 check_ajax_referer( 'autosave', 'autosavenonce' ); 1005 1005 $ID = (int) $_POST['post_ID']; 1006 $post_type = ( 'page' == $_POST['post_type'] ) ? 'page' : 'post'; 1007 if ( current_user_can( "edit_{$post_type}", $ID ) ) 1006 $post_type = $_POST['post_type']; 1007 $post_type_object = get_post_type_object($post_type); 1008 if ( !$post_type_object ) 1009 die('0'); 1010 if ( current_user_can( $post_type_object->edit_cap, $ID ) ) 1008 1011 die( json_encode( array( 'updateNonce' => wp_create_nonce( "update-{$post_type}_{$ID}" ), 'deleteURL' => str_replace( '&', '&', wp_nonce_url( admin_url( $post_type . '.php?action=trash&post=' . $ID ), "trash-{$post_type}_{$ID}" ) ) ) ) ); 1009 1012 do_action('autosave_generate_nonces'); -
trunk/wp-admin/admin-header.php
r12702 r12728 29 29 wp_admin_css( 'css/ms' ); 30 30 wp_enqueue_script('utils'); 31 32 $hook_suffix = '';33 if ( isset($page_hook) )34 $hook_suffix = $page_hook;35 else if ( isset($plugin_page) )36 $hook_suffix = $plugin_page;37 else if ( isset($pagenow) )38 $hook_suffix = $pagenow;39 40 if ( isset($submenu_file) && (false !== $pos = strpos($submenu_file, 'post_type=')) )41 $typenow = substr($submenu_file, $pos + 10);42 elseif ( isset($parent_file) && (false !== $pos = strpos($parent_file, 'post_type=')) )43 $typenow = substr($parent_file, $pos + 10);44 else45 $typenow = '';46 31 47 32 $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix); … … 120 105 </div> 121 106 122 <?php favorite_actions($ hook_suffix); ?>107 <?php favorite_actions($current_screen); ?> 123 108 </div> 124 109 </div> 125 110 126 111 <div id="wpbody"> 127 <?php require(ABSPATH . 'wp-admin/menu-header.php'); ?> 112 <?php 113 require(ABSPATH . 'wp-admin/menu-header.php'); 114 115 $current_screen->parent_file = $parent_file; 116 $current_screen->parent_base = preg_replace('/\?.*$/', '', $parent_file); 117 $current_screen->parent_base = str_replace('.php', '', $current_screen->parent_base); 118 ?> 128 119 129 120 <div id="wpbody-content"> 130 121 <?php 131 screen_meta($ hook_suffix);122 screen_meta($current_screen); 132 123 133 124 do_action('admin_notices'); -
trunk/wp-admin/admin.php
r12720 r12728 178 178 do_action('admin_action_' . $_REQUEST['action']); 179 179 180 $hook_suffix = ''; 181 if ( isset($page_hook) ) 182 $hook_suffix = $page_hook; 183 else if ( isset($plugin_page) ) 184 $hook_suffix = $plugin_page; 185 else if ( isset($pagenow) ) 186 $hook_suffix = $pagenow; 187 188 if ( isset($_GET['post_type']) ) 189 $typenow = $_GET['post_type']; 190 else 191 $typenow = ''; 192 // @todo validate typenow against post types. 193 194 /** 195 * Global object containing info about the current screen. 196 */ 197 $current_screen = $hook_suffix; 198 $current_screen = str_replace('.php', '', $current_screen); 199 $current_screen = str_replace('-new', '', $current_screen); 200 $current_screen = str_replace('-add', '', $current_screen); 201 $current_screen = array('id' => $current_screen, 'base' => $current_screen); 202 $current_screen = (object) $current_screen; 203 if ( 'edit' == $current_screen->id ) { 204 if ( empty($typenow) ) 205 $typenow = 'post'; 206 $current_screen->id .= '-' . $typenow; 207 $current_screen->post_type = $typenow; 208 } elseif ( 'post' == $current_screen->id ) { 209 if ( empty($typenow) ) 210 $typenow = 'post'; 211 $current_screen->id = $typenow; 212 $current_screen->post_type = $typenow; 213 } else { 214 $typenow = ''; 215 } 216 217 $current_screen = apply_filters('current_screen', $current_screen); 218 180 219 ?> -
trunk/wp-admin/edit-form-advanced.php
r12710 r12728 143 143 do_action('do_meta_boxes', $post_type, 'side', $post); 144 144 145 add_contextual_help($current_screen, drag_drop_help()); 146 145 147 require_once('admin-header.php'); 146 148 ?> -
trunk/wp-admin/edit-link-form.php
r12546 r12728 34 34 do_action('do_meta_boxes', 'link', 'advanced', $link); 35 35 do_action('do_meta_boxes', 'link', 'side', $link); 36 37 add_contextual_help($current_screen, drag_drop_help()); 36 38 37 39 require_once ('admin-header.php'); -
trunk/wp-admin/edit-post-rows.php
r11768 r12728 14 14 <thead> 15 15 <tr> 16 <?php print_column_headers( 'edit'); ?>16 <?php print_column_headers( $current_screen ); ?> 17 17 </tr> 18 18 </thead> … … 20 20 <tfoot> 21 21 <tr> 22 <?php print_column_headers( 'edit', false); ?>22 <?php print_column_headers($current_screen, false); ?> 23 23 </tr> 24 24 </tfoot> 25 25 26 26 <tbody> 27 <?php post_rows(); ?> 27 <?php 28 if ( $post_type_object->hierarchical ) 29 page_rows($posts, $pagenum, $per_page); 30 else 31 post_rows(); 32 ?> 28 33 </tbody> 29 34 </table> -
trunk/wp-admin/edit.php
r12719 r12728 21 21 } 22 22 23 if ( isset($_GET['post_type']) && in_array( $_GET['post_type'], get_post_types( array('_show' => true) ) ) )23 if ( isset($_GET['post_type']) && ( in_array( $_GET['post_type'], get_post_types( array('_show' => true ) ) ) || in_array( $_GET['post_type'], get_post_types( array('_builtin' => true ) ) ) ) ) 24 24 $post_type = $_GET['post_type']; 25 25 else … … 28 28 29 29 $post_type_object = get_post_type_object($post_type); 30 $post_type_cap = $post_type_object->capability_type; 30 31 31 32 if ( 'post' != $post_type ) { … … 38 39 $post_new_file = 'post-new.php'; 39 40 } 41 42 $pagenum = isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 0; 43 if ( empty($pagenum) ) 44 $pagenum = 1; 45 $per_page = 'edit_' . $post_type . '_per_page'; 46 $per_page = (int) get_user_option( $per_page ); 47 if ( empty( $per_page ) || $per_page < 1 ) 48 $per_page = 15; 49 // @todo filter based on type 50 $per_page = apply_filters( 'edit_posts_per_page', $per_page ); 40 51 41 52 // Handle bulk actions … … 62 73 $trashed = 0; 63 74 foreach( (array) $post_ids as $post_id ) { 64 if ( !current_user_can('delete_ post', $post_id) )65 wp_die( __('You are not allowed to move this postto the trash.') );75 if ( !current_user_can('delete_' . $post_type_cap, $post_id) ) 76 wp_die( __('You are not allowed to move this item to the trash.') ); 66 77 67 78 if ( !wp_trash_post($post_id) ) … … 75 86 $untrashed = 0; 76 87 foreach( (array) $post_ids as $post_id ) { 77 if ( !current_user_can('delete_ post', $post_id) )78 wp_die( __('You are not allowed to restore this postfrom the trash.') );88 if ( !current_user_can('delete_' . $post_type_cap, $post_id) ) 89 wp_die( __('You are not allowed to restore this item from the trash.') ); 79 90 80 91 if ( !wp_untrash_post($post_id) ) … … 90 101 $post_del = & get_post($post_id); 91 102 92 if ( !current_user_can('delete_ post', $post_id) )93 wp_die( __('You are not allowed to delete this post.') );103 if ( !current_user_can('delete_' . $post_type_cap, $post_id) ) 104 wp_die( __('You are not allowed to delete this item.') ); 94 105 95 106 if ( $post_del->post_type == 'attachment' ) { … … 131 142 132 143 $user_posts = false; 133 if ( !current_user_can('edit_others_ posts') ) {144 if ( !current_user_can('edit_others_' . $post_type_cap . 's') ) { 134 145 $user_posts_count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(1) FROM $wpdb->posts WHERE post_type = '%s' AND post_status != 'trash' AND post_author = %d", $post_type, $current_user->ID) ); 135 146 $user_posts = true; … … 140 151 $avail_post_stati = wp_edit_posts_query(); 141 152 153 if ( $post_type_object->hierarchical ) 154 $num_pages = ceil($wp_query->post_count / $per_page); 155 else 156 $num_pages = $wp_query->max_num_pages; 157 142 158 require_once('admin-header.php'); 143 144 if ( !isset( $_GET['paged'] ) )145 $_GET['paged'] = 1;146 159 147 160 if ( empty($_GET['mode']) ) … … 159 172 <?php 160 173 if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?> 161 <div id="message" class="updated"><p><strong><?php _e(' Your posthas been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div>174 <div id="message" class="updated"><p><strong><?php _e('This has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div> 162 175 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']); 163 176 endif; ?> … … 174 187 175 188 if ( isset($_GET['locked']) && (int) $_GET['locked'] ) { 176 printf( _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['locked'] ) );189 printf( _n( '%s item not updated, somebody is editing it.', '%s items not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['locked'] ) ); 177 190 unset($_GET['locked']); 178 191 } 179 192 180 193 if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) { 181 printf( _n( ' Post permanently deleted.', '%s posts permanently deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );194 printf( _n( 'Item permanently deleted.', '%s items permanently deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) ); 182 195 unset($_GET['deleted']); 183 196 } 184 197 185 198 if ( isset($_GET['trashed']) && (int) $_GET['trashed'] ) { 186 printf( _n( ' Post moved to the trash.', '%s posts moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) );199 printf( _n( 'Item moved to the trash.', '%s items moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) ); 187 200 $ids = isset($_GET['ids']) ? $_GET['ids'] : 0; 188 201 echo ' <a href="' . esc_url( wp_nonce_url( "edit.php?doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a><br />'; … … 191 204 192 205 if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) { 193 printf( _n( ' Post restored from the trash.', '%s posts restored from the trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) );206 printf( _n( 'Item restored from the trash.', '%s items restored from the trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) ); 194 207 unset($_GET['undeleted']); 195 208 } … … 213 226 if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user->ID ) ) 214 227 $class = ' class="current"'; 215 $status_links[] = "<li><a href='edit.php?author=$current_user->ID'$class>" . sprintf( _nx( 'M y Posts <span class="count">(%s)</span>', 'My Posts<span class="count">(%s)</span>', $user_posts_count, 'posts' ), number_format_i18n( $user_posts_count ) ) . '</a>';228 $status_links[] = "<li><a href='edit.php?author=$current_user->ID'$class>" . sprintf( _nx( 'Mine <span class="count">(%s)</span>', 'Mine <span class="count">(%s)</span>', $user_posts_count, 'posts' ), number_format_i18n( $user_posts_count ) ) . '</a>'; 216 229 $allposts = '?all_posts=1'; 217 230 } … … 262 275 'prev_text' => __('«'), 263 276 'next_text' => __('»'), 264 'total' => $ wp_query->max_num_pages,265 'current' => $ _GET['paged']277 'total' => $num_pages, 278 'current' => $pagenum 266 279 )); 267 280 … … 319 332 320 333 <?php 321 $dropdown_options = array('show_option_all' => __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1, 322 'show_count' => 0, 'orderby' => 'name', 'selected' => $cat); 323 wp_dropdown_categories($dropdown_options); 324 do_action('restrict_manage_posts'); 334 if ( is_object_in_taxonomy($post_type, 'category') ) { 335 $dropdown_options = array('show_option_all' => __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1, 336 'show_count' => 0, 'orderby' => 'name', 'selected' => $cat); 337 wp_dropdown_categories($dropdown_options); 338 do_action('restrict_manage_posts'); 339 } 325 340 ?> 326 341 <input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" /> 327 342 <?php } 328 343 329 if ( $is_trash && current_user_can('edit_others_ posts') ) { ?>344 if ( $is_trash && current_user_can('edit_others_' . $post_type_cap .'s') ) { ?> 330 345 <input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" /> 331 346 <?php } ?> … … 334 349 <?php if ( $page_links ) { ?> 335 350 <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s', 336 number_format_i18n( ( $ _GET['paged'] - 1 ) * $wp_query->query_vars['posts_per_page']+ 1 ),337 number_format_i18n( min( $ _GET['paged'] * $wp_query->query_vars['posts_per_page'], $wp_query->found_posts ) ),351 number_format_i18n( ( $pagenum - 1 ) * $per_page + 1 ), 352 number_format_i18n( min( $pagenum * $per_page, $wp_query->found_posts ) ), 338 353 number_format_i18n( $wp_query->found_posts ), 339 354 $page_links … … 374 389 </select> 375 390 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" /> 376 <?php if ( $is_trash && current_user_can('edit_others_ posts') ) { ?>391 <?php if ( $is_trash && current_user_can('edit_others_' . $post_type_cap . 's') ) { ?> 377 392 <input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" /> 378 393 <?php } ?> … … 394 409 </form> 395 410 396 <?php inline_edit_row( 'post'); ?>411 <?php inline_edit_row( $current_screen ); ?> 397 412 398 413 <div id="ajax-response"></div> -
trunk/wp-admin/includes/misc.php
r12726 r12728 411 411 switch ( $map_option ) { 412 412 case 'edit_per_page': 413 case 'edit_pages_per_page':414 413 case 'edit_comments_per_page': 415 414 case 'upload_per_page': -
trunk/wp-admin/includes/post.php
r12719 r12728 820 820 $post_stati = get_post_stati(); 821 821 822 if ( isset($q['post_type']) && in_array( $q['post_type'], get_post_types( array('_show' => true)) ) )822 if ( isset($q['post_type']) && in_array( $q['post_type'], get_post_types() ) ) 823 823 $post_type = $q['post_type']; 824 824 else 825 825 $post_type = 'post'; 826 $post_type_object = get_post_type_object($post_type); 826 827 827 828 $avail_post_stati = get_available_post_statuses($post_type); … … 843 844 } 844 845 845 if ( 'post' != $post_type ) 846 $per_page = 'edit_' . $post_type . '_per_page'; 847 else 848 $per_page = 'edit_per_page'; 849 $posts_per_page = (int) get_user_option( 'edit_per_page' ); 846 $per_page = 'edit_' . $post_type . '_per_page'; 847 $posts_per_page = (int) get_user_option( $per_page ); 850 848 if ( empty( $posts_per_page ) || $posts_per_page < 1 ) 851 849 $posts_per_page = 15; 852 $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page ); 853 854 wp( compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page') ); 850 $posts_per_page = apply_filters( $per_page, $posts_per_page ); 851 852 853 $query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page'); 854 855 // Hierarchical types require special args. 856 if ( $post_type_object->hierarchical ) { 857 $query['orderby'] = 'menu_order title'; 858 $query['order'] = 'asc'; 859 $query['posts_per_page'] = -1; 860 $query['posts_per_archive_page'] = -1; 861 } 862 863 wp( $query ); 855 864 856 865 return $avail_post_stati; -
trunk/wp-admin/includes/template.php
r12726 r12728 749 749 * @return unknown 750 750 */ 751 function wp_manage_posts_columns() { 752 global $typenow; 751 function wp_manage_posts_columns( $screen = '') { 752 if ( empty($screen) ) 753 $post_type = 'post'; 754 else 755 $post_type = $screen->post_type; 753 756 754 757 $posts_columns = array(); 755 758 $posts_columns['cb'] = '<input type="checkbox" />'; 756 759 /* translators: manage posts column name */ 757 $posts_columns['title'] = _x(' Post', 'column name');760 $posts_columns['title'] = _x('Title', 'column name'); 758 761 $posts_columns['author'] = __('Author'); 759 if ( empty($ typenow) || is_object_in_taxonomy($typenow, 'category') )762 if ( empty($post_type) || is_object_in_taxonomy($post_type, 'category') ) 760 763 $posts_columns['categories'] = __('Categories'); 761 if ( empty($ typenow) || is_object_in_taxonomy($typenow, 'category') )764 if ( empty($post_type) || is_object_in_taxonomy($post_type, 'category') ) 762 765 $posts_columns['tags'] = __('Tags'); 763 766 $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all'; 764 if ( !in_array( $post_status, array('pending', 'draft', 'future') ) && ( empty($ typenow) || post_type_supports($typenow, 'comments') ) )767 if ( !in_array( $post_status, array('pending', 'draft', 'future') ) && ( empty($post_type) || post_type_supports($post_type, 'comments') ) ) 765 768 $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>'; 766 769 $posts_columns['date'] = __('Date'); 770 // @todo filter per type 767 771 $posts_columns = apply_filters('manage_posts_columns', $posts_columns); 768 772 … … 805 809 */ 806 810 function wp_manage_pages_columns() { 807 $posts_columns = array(); 808 $posts_columns['cb'] = '<input type="checkbox" />'; 809 $posts_columns['title'] = __('Title'); 810 $posts_columns['author'] = __('Author'); 811 $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all'; 812 if ( !in_array( $post_status, array('pending', 'draft', 'future') ) ) 813 $posts_columns['comments'] = '<div class="vers"><img alt="" src="images/comment-grey-bubble.png" /></div>'; 814 $posts_columns['date'] = __('Date'); 815 $posts_columns = apply_filters('manage_pages_columns', $posts_columns); 816 817 return $posts_columns; 818 } 819 820 /** 821 * {@internal Missing Short Description}} 822 * 823 * @since unknown 824 * 825 * @param unknown_type $page 811 return wp_manage_posts_columns(); 812 } 813 814 /** 815 * {@internal Missing Short Description}} 816 * 817 * @since unknown 818 * 819 * @param unknown_type $screen 826 820 * @return unknown 827 821 */ 828 function get_column_headers($ page) {822 function get_column_headers($screen) { 829 823 global $_wp_column_headers; 830 824 … … 832 826 $_wp_column_headers = array(); 833 827 834 $map_screen = $page; 835 $type = str_replace('edit-', '', $map_screen); 836 if ( in_array($type, get_post_types()) ) 837 $map_screen = 'edit'; 828 if ( is_string($screen) ) 829 $screen = convert_to_screen($screen); 838 830 839 831 // Store in static to avoid running filters on each call 840 if ( isset($_wp_column_headers[$ page]) )841 return $_wp_column_headers[$ page];842 843 switch ($ map_screen) {832 if ( isset($_wp_column_headers[$screen->id]) ) 833 return $_wp_column_headers[$screen->id]; 834 835 switch ($screen->base) { 844 836 case 'edit': 845 $_wp_column_headers[$ page] = wp_manage_posts_columns();837 $_wp_column_headers[$screen->id] = wp_manage_posts_columns( $screen ); 846 838 break; 847 case 'edit-pages':848 $_wp_column_headers[$page] = wp_manage_pages_columns();849 break;850 839 case 'edit-comments': 851 $_wp_column_headers[$ page] = array(840 $_wp_column_headers[$screen->id] = array( 852 841 'cb' => '<input type="checkbox" />', 853 842 'author' => __('Author'), … … 860 849 break; 861 850 case 'link-manager': 862 $_wp_column_headers[$ page] = array(851 $_wp_column_headers[$screen->id] = array( 863 852 'cb' => '<input type="checkbox" />', 864 853 'name' => __('Name'), … … 872 861 break; 873 862 case 'upload': 874 $_wp_column_headers[$ page] = wp_manage_media_columns();863 $_wp_column_headers[$screen->id] = wp_manage_media_columns(); 875 864 break; 876 865 case 'categories': 877 $_wp_column_headers[$ page] = array(866 $_wp_column_headers[$screen->id] = array( 878 867 'cb' => '<input type="checkbox" />', 879 868 'name' => __('Name'), … … 885 874 break; 886 875 case 'edit-link-categories': 887 $_wp_column_headers[$ page] = array(876 $_wp_column_headers[$screen->id] = array( 888 877 'cb' => '<input type="checkbox" />', 889 878 'name' => __('Name'), … … 895 884 break; 896 885 case 'edit-tags': 897 $_wp_column_headers[$ page] = array(886 $_wp_column_headers[$screen->id] = array( 898 887 'cb' => '<input type="checkbox" />', 899 888 'name' => __('Name'), … … 905 894 break; 906 895 case 'users': 907 $_wp_column_headers[$ page] = array(896 $_wp_column_headers[$screen->id] = array( 908 897 'cb' => '<input type="checkbox" />', 909 898 'username' => __('Username'), … … 915 904 break; 916 905 default : 917 $_wp_column_headers[$ page] = array();918 } 919 920 $_wp_column_headers[$ page] = apply_filters('manage_' . $page . '_columns', $_wp_column_headers[$page]);921 return $_wp_column_headers[$ page];922 } 923 924 /** 925 * {@internal Missing Short Description}} 926 * 927 * @since unknown 928 * 929 * @param unknown_type $ type906 $_wp_column_headers[$screen->id] = array(); 907 } 908 909 $_wp_column_headers[$screen->id] = apply_filters('manage_' . $screen->id . '_columns', $_wp_column_headers[$screen->id]); 910 return $_wp_column_headers[$screen->id]; 911 } 912 913 /** 914 * {@internal Missing Short Description}} 915 * 916 * @since unknown 917 * 918 * @param unknown_type $screen 930 919 * @param unknown_type $id 931 920 */ 932 function print_column_headers( $type, $id = true ) { 933 $type = str_replace('.php', '', $type); 934 $columns = get_column_headers( $type ); 935 $hidden = get_hidden_columns($type); 921 function print_column_headers( $screen, $id = true ) { 922 if ( is_string($screen) ) 923 $screen = convert_to_screen($screen); 924 925 $columns = get_column_headers( $screen ); 926 $hidden = get_hidden_columns($screen); 936 927 $styles = array(); 937 928 … … 952 943 $style = 'display:none;'; 953 944 954 if ( isset($styles[$ type]) && isset($styles[$type][$column_key]) )955 $style .= ' ' . $styles[$ type][$column_key];945 if ( isset($styles[$screen->id]) && isset($styles[$screen->id][$column_key]) ) 946 $style .= ' ' . $styles[$screen>id][$column_key]; 956 947 $style = ' style="' . $style . '"'; 957 948 ?> … … 972 963 global $_wp_column_headers; 973 964 965 if ( is_string($screen) ) 966 $screen = convert_to_screen($screen); 967 974 968 if ( !isset($_wp_column_headers) ) 975 969 $_wp_column_headers = array(); 976 970 977 $_wp_column_headers[$screen] = $columns; 978 } 979 980 /** 981 * {@internal Missing Short Description}} 982 * 983 * @since unknown 984 * 985 * @param unknown_type $page 986 */ 987 function get_hidden_columns($page) { 988 $page = str_replace('.php', '', $page); 989 return (array) get_user_option( 'manage-' . $page . '-columns-hidden' ); 971 $_wp_column_headers[$screen->id] = $columns; 972 } 973 974 /** 975 * {@internal Missing Short Description}} 976 * 977 * @since unknown 978 * 979 * @param unknown_type $screen 980 */ 981 function get_hidden_columns($screen) { 982 if ( is_string($screen) ) 983 $screen = convert_to_screen($screen); 984 985 return (array) get_user_option( 'manage-' . $screen->id. '-columns-hidden' ); 990 986 } 991 987 … … 999 995 * @param string $type 'post' or 'page' 1000 996 */ 1001 function inline_edit_row( $ type) {997 function inline_edit_row( $screen ) { 1002 998 global $current_user, $mode; 1003 999 1004 $is_page = 'page' == $type; 1005 if ( $is_page ) { 1006 $screen = 'edit-pages'; 1007 $post = get_default_page_to_edit(); 1008 } else { 1009 $screen = 'edit'; 1010 $post = get_default_post_to_edit(); 1011 } 1012 1013 $columns = $is_page ? wp_manage_pages_columns() : wp_manage_posts_columns(); 1000 if ( is_string($screen) ) { 1001 $screen = array('id' => 'edit-' . $screen, 'base' => 'edit', 'post_type' => $screen ); 1002 $screen = (object) $screen; 1003 } 1004 1005 $post = get_default_post_to_edit( $screen->post_type ); 1006 $post_type_object = get_post_type_object( $screen->post_type ); 1007 1008 $columns = wp_manage_posts_columns($screen); 1014 1009 $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) ); 1015 1010 $col_count = count($columns) - count($hidden); 1016 1011 $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list'; 1017 $can_publish = current_user_can("publish_{$type}s"); 1012 // @todo use capability_type 1013 $can_publish = current_user_can("publish_{$screen->post_type}s"); 1018 1014 $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true ); 1019 1015 … … 1025 1021 while ( $bulk < 2 ) { ?> 1026 1022 1027 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$ type ";1028 echo $bulk ? "bulk-edit-row bulk-edit-row-$ type" : "quick-edit-row quick-edit-row-$type";1023 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$screen->post_type "; 1024 echo $bulk ? "bulk-edit-row bulk-edit-row-$screen->post_type" : "quick-edit-row quick-edit-row-$screen->post_type"; 1029 1025 ?>" style="display: none"><td colspan="<?php echo $col_count; ?>"> 1030 1026 1031 1027 <fieldset class="inline-edit-col-left"><div class="inline-edit-col"> 1032 <h4><?php echo $bulk ? ( $is_page ? __( 'Bulk Edit Pages' ) : __( 'Bulk Edit Posts' ) ) : __( 'Quick Edit' ); ?></h4>1028 <h4><?php echo $bulk ? ( __( 'Bulk Edit' ) ) : __( 'Quick Edit' ); ?></h4> 1033 1029 1034 1030 … … 1063 1059 <?php endif; // $bulk 1064 1060 1065 $authors = get_editable_user_ids( $current_user->id, true, $ type ); // TODO: ROLE SYSTEM1061 $authors = get_editable_user_ids( $current_user->id, true, $screen->post_type ); // TODO: ROLE SYSTEM 1066 1062 $authors_dropdown = ''; 1067 1063 if ( $authors && count( $authors ) > 1 ) : … … 1093 1089 <label class="alignleft inline-edit-private"> 1094 1090 <input type="checkbox" name="keep_private" value="private" /> 1095 <span class="checkbox-title"><?php echo $is_page ? __('Private page') : __('Private post'); ?></span>1091 <span class="checkbox-title"><?php echo __('Private'); ?></span> 1096 1092 </label> 1097 1093 </div> … … 1101 1097 </div></fieldset> 1102 1098 1103 <?php if ( !$is_page&& !$bulk ) : ?>1099 <?php if ( is_object_in_taxonomy($screen->post_type, 'categories') && !$bulk ) : ?> 1104 1100 1105 1101 <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col"> … … 1113 1109 </div></fieldset> 1114 1110 1115 <?php endif; // ! $is_page&& !$bulk ?>1111 <?php endif; // !hierarchical && !$bulk ?> 1116 1112 1117 1113 <fieldset class="inline-edit-col-right"><div class="inline-edit-col"> … … 1122 1118 ?> 1123 1119 1124 <?php if ( $ is_page) : ?>1120 <?php if ( $post_type_object->hierarchical ) : ?> 1125 1121 1126 1122 <label> … … 1222 1218 </label> 1223 1219 1224 <?php if ( !$is_page && $can_publish && current_user_can( 'edit_others_posts' ) ) : ?>1220 <?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( 'edit_others_posts' ) ) : ?> 1225 1221 1226 1222 <?php if ( $bulk ) : ?> … … 1261 1257 <?php if ( ! $bulk ) { 1262 1258 wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); 1263 $update_text = ( $is_page ) ? __( 'Update Page' ) : __( 'Update Post' );1259 $update_text = __( 'Update' ); 1264 1260 ?> 1265 1261 <a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a> 1266 1262 <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" /> 1267 1263 <?php } else { 1268 $update_text = ( $is_page ) ? __( 'Update Pages' ) : __( 'Update Posts' );1264 $update_text = __( 'Update' ); 1269 1265 ?> 1270 1266 <input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo esc_attr( $update_text ); ?>" /> … … 1370 1366 */ 1371 1367 function _post_row($a_post, $pending_comments, $mode) { 1372 global $post, $current_user ;1368 global $post, $current_user, $current_screen; 1373 1369 static $rowclass; 1374 1370 … … 1384 1380 <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top"> 1385 1381 <?php 1386 $posts_columns = get_column_headers( 'edit');1387 $hidden = get_hidden_columns( 'edit');1382 $posts_columns = get_column_headers( $current_screen ); 1383 $hidden = get_hidden_columns( $current_screen ); 1388 1384 foreach ( $posts_columns as $column_name=>$column_display_name ) { 1389 1385 $class = "class=\"$column_name column-$column_name\""; … … 1580 1576 */ 1581 1577 function display_page_row( $page, $level = 0 ) { 1582 global $post ;1578 global $post, $current_screen; 1583 1579 static $rowclass; 1584 1580 … … 1607 1603 $id = (int) $page->ID; 1608 1604 $rowclass = 'alternate' == $rowclass ? '' : 'alternate'; 1609 $posts_columns = get_column_headers( 'edit-pages');1610 $hidden = get_hidden_columns( 'edit-pages');1605 $posts_columns = get_column_headers( $current_screen ); 1606 $hidden = get_hidden_columns( $current_screen ); 1611 1607 $title = _draft_or_post_title(); 1612 1608 ?> … … 3057 3053 * @since unknown 3058 3054 * 3059 * @param unknown_type $ page3060 */ 3061 function meta_box_prefs($ page) {3055 * @param unknown_type $screen 3056 */ 3057 function meta_box_prefs($screen) { 3062 3058 global $wp_meta_boxes; 3063 3059 3064 if ( empty($wp_meta_boxes[$page]) ) 3060 if ( is_string($screen) ) 3061 $screen = convert_to_screen($screen); 3062 3063 if ( empty($wp_meta_boxes[$screen->id]) ) 3065 3064 return; 3066 3065 3067 $hidden = get_hidden_meta_boxes($ page);3068 3069 foreach ( array_keys($wp_meta_boxes[$ page]) as $context ) {3070 foreach ( array_keys($wp_meta_boxes[$ page][$context]) as $priority ) {3071 foreach ( $wp_meta_boxes[$ page][$context][$priority] as $box ) {3066 $hidden = get_hidden_meta_boxes($screen); 3067 3068 foreach ( array_keys($wp_meta_boxes[$screen->id]) as $context ) { 3069 foreach ( array_keys($wp_meta_boxes[$screen->id][$context]) as $priority ) { 3070 foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) { 3072 3071 if ( false == $box || ! $box['title'] ) 3073 3072 continue; … … 3084 3083 } 3085 3084 3086 function get_hidden_meta_boxes($page) { 3087 $hidden = (array) get_user_option( "meta-box-hidden_$page" ); 3085 function get_hidden_meta_boxes($screen) { 3086 if ( is_string($screen) ) 3087 $screen = convert_to_screen($screen); 3088 3089 $hidden = (array) get_user_option( "meta-box-hidden_$screen->id" ); 3088 3090 3089 3091 // Hide slug boxes by default … … 3280 3282 */ 3281 3283 function favorite_actions( $screen = null ) { 3282 switch ( $screen ) { 3283 case 'post-new.php': 3284 if ( is_string($screen) ) 3285 $screen = convert_to_screen($screen); 3286 3287 switch ( $screen->id ) { 3288 case 'post': 3284 3289 $default_action = array('edit.php' => array(__('Edit Posts'), 'edit_posts')); 3285 3290 break; 3286 case 'edit-page s.php':3287 $default_action = array('p age-new.php' => array(__('New Page'), 'edit_pages'));3291 case 'edit-page': 3292 $default_action = array('post-new.php?post_type=page' => array(__('New Page'), 'edit_pages')); 3288 3293 break; 3289 case 'page -new.php':3290 $default_action = array('edit -pages.php' => array(__('Edit Pages'), 'edit_pages'));3294 case 'page': 3295 $default_action = array('edit.php?post_type=page' => array(__('Edit Pages'), 'edit_pages')); 3291 3296 break; 3292 3297 case 'upload.php': 3293 3298 $default_action = array('media-new.php' => array(__('New Media'), 'upload_files')); 3294 3299 break; 3295 case 'media -new.php':3300 case 'media': 3296 3301 $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files')); 3297 3302 break; 3298 case 'link-manager .php':3303 case 'link-manager': 3299 3304 $default_action = array('link-add.php' => array(__('New Link'), 'manage_links')); 3300 3305 break; 3301 case 'link-add .php':3306 case 'link-add': 3302 3307 $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links')); 3303 3308 break; 3304 case 'users .php':3309 case 'users': 3305 3310 $default_action = array('user-new.php' => array(__('New User'), 'create_users')); 3306 3311 break; 3307 case 'user -new.php':3312 case 'user': 3308 3313 $default_action = array('users.php' => array(__('Edit Users'), 'edit_users')); 3309 3314 break; 3310 case 'plugins .php':3315 case 'plugins': 3311 3316 $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins')); 3312 3317 break; 3313 case 'plugin-install .php':3318 case 'plugin-install': 3314 3319 $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins')); 3315 3320 break; 3316 case 'themes .php':3321 case 'themes': 3317 3322 $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes')); 3318 3323 break; 3319 case 'theme-install .php':3324 case 'theme-install': 3320 3325 $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes')); 3321 3326 break; … … 3485 3490 } 3486 3491 3487 function screen_meta($screen) { 3488 global $wp_meta_boxes, $_wp_contextual_help, $typenow; 3489 3492 // Convert a screen string to a screen object 3493 function convert_to_screen( $screen ) { 3490 3494 $screen = str_replace('.php', '', $screen); 3491 3495 $screen = str_replace('-new', '', $screen); … … 3493 3497 $screen = apply_filters('screen_meta_screen', $screen); 3494 3498 3499 $screen = array('id' => $screen, 'base' => $screen); 3500 return (object) $screen; 3501 } 3502 3503 function screen_meta($screen) { 3504 global $wp_meta_boxes, $_wp_contextual_help, $post_type; 3505 3506 if ( is_string($screen) ) 3507 $screen = convert_to_screen($screen); 3508 3495 3509 $column_screens = get_column_headers($screen); 3496 3510 $meta_screens = array('index' => 'dashboard'); 3497 3511 3498 // Give post_type pages their own screen 3499 if ( 'post' == $screen ) { 3500 if ( !empty($typenow) ) 3501 $screen = $typenow; 3502 } 3503 if ( 'edit' == $screen ) { 3504 if ( !empty($typenow) ) 3505 $screen = 'edit-' . $typenow; 3506 } 3507 3508 if ( isset($meta_screens[$screen]) ) 3509 $screen = $meta_screens[$screen]; 3512 if ( isset($meta_screens[$screen->id]) ) { 3513 $screen->id = $meta_screens[$screen->id]; 3514 $screen->base = $screen->id; 3515 } 3516 3510 3517 $show_screen = false; 3511 3518 $show_on_screen = false; 3512 if ( !empty($wp_meta_boxes[$screen ]) || !empty($column_screens) ) {3519 if ( !empty($wp_meta_boxes[$screen->id]) || !empty($column_screens) ) { 3513 3520 $show_screen = true; 3514 3521 $show_on_screen = true; … … 3524 3531 $settings = ''; 3525 3532 3526 switch ( $screen ) { 3527 case 'post': 3528 if ( !isset($_wp_contextual_help['post']) ) { 3529 $help = drag_drop_help(); 3530 $help .= '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>') . '</p>'; 3531 $_wp_contextual_help['post'] = $help; 3532 } 3533 break; 3534 case 'page': 3535 if ( !isset($_wp_contextual_help['page']) ) { 3536 $help = drag_drop_help(); 3537 $_wp_contextual_help['page'] = $help; 3538 } 3539 break; 3540 case 'dashboard': 3541 if ( !isset($_wp_contextual_help['dashboard']) ) { 3542 $help = '<p>' . __('The modules on this screen can be arranged in several columns. You can select the number of columns from the Screen Options tab.') . "</p>\n"; 3543 $help .= drag_drop_help(); 3544 $_wp_contextual_help['dashboard'] = $help; 3545 } 3546 break; 3547 case 'link': 3548 if ( !isset($_wp_contextual_help['link']) ) { 3549 $help = drag_drop_help(); 3550 $_wp_contextual_help['link'] = $help; 3551 } 3552 break; 3553 case 'options-general': 3554 if ( !isset($_wp_contextual_help['options-general']) ) 3555 $_wp_contextual_help['options-general'] = __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>'); 3556 break; 3557 case 'theme-install': 3558 case 'plugin-install': 3559 if ( ( !isset($_GET['tab']) || 'dashboard' == $_GET['tab'] ) && !isset($_wp_contextual_help[$screen]) ) { 3560 $help = plugins_search_help(); 3561 $_wp_contextual_help[$screen] = $help; 3562 } 3563 break; 3533 switch ( $screen->id ) { 3564 3534 case 'widgets': 3565 if ( !isset($_wp_contextual_help['widgets']) ) {3566 $help = widgets_help();3567 $_wp_contextual_help['widgets'] = $help;3568 }3569 3535 $settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n"; 3570 3536 $show_screen = true; … … 3606 3572 <?php 3607 3573 $contextual_help = ''; 3608 if ( isset($_wp_contextual_help[$screen ]) ) {3574 if ( isset($_wp_contextual_help[$screen->id]) ) { 3609 3575 if ( !empty($title) ) 3610 3576 $contextual_help .= '<h5>' . sprintf(__('Get help with “%s”'), $title) . '</h5>'; 3611 3577 else 3612 3578 $contextual_help .= '<h5>' . __('Get help with this page') . '</h5>'; 3613 $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen ] . "</div>\n";3579 $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen->id] . "</div>\n"; 3614 3580 3615 3581 $contextual_help .= '<h5>' . __('Other Help') . '</h5>'; … … 3653 3619 global $_wp_contextual_help; 3654 3620 3621 if ( is_string($screen) ) 3622 $screen = convert_to_screen($screen); 3623 3655 3624 if ( !isset($_wp_contextual_help) ) 3656 3625 $_wp_contextual_help = array(); 3657 3626 3658 $_wp_contextual_help[$screen ] = $help;3627 $_wp_contextual_help[$screen->id] = $help; 3659 3628 } 3660 3629 … … 3676 3645 } 3677 3646 3678 function widgets_help() {3679 return '3680 <p>' . __('Widgets are added and arranged by simple drag ’n’ drop. If you hover your mouse over the titlebar of a widget, you’ll see a 4-arrow cursor which indicates that the widget is movable. Click on the titlebar, hold down the mouse button and drag the widget to a sidebar. As you drag, you’ll see a dotted box that also moves. This box shows where the widget will go once you drop it.') . '</p>3681 <p>' . __('To remove a widget from a sidebar, drag it back to Available Widgets or click on the arrow on its titlebar to reveal its settings, and then click Remove.') . '</p>3682 <p>' . __('To remove a widget from a sidebar <em>and keep its configuration</em>, drag it to Inactive Widgets.') . '</p>3683 <p>' . __('The Inactive Widgets area stores widgets that are configured but not curently used. If you change themes and the new theme has fewer sidebars than the old, all extra widgets will be stored to Inactive Widgets automatically.') . '</p>3684 ';3685 }3686 3687 3647 function screen_layout($screen) { 3688 3648 global $screen_layout_columns; 3649 3650 if ( is_string($screen) ) 3651 $screen = convert_to_screen($screen); 3689 3652 3690 3653 $columns = array('dashboard' => 4, 'post' => 2, 'page' => 2, 'link' => 2); … … 3694 3657 $columns[$post_type] = 2; 3695 3658 3696 $columns = apply_filters('screen_layout_columns', $columns, $screen );3697 3698 if ( !isset($columns[$screen ]) ) {3659 $columns = apply_filters('screen_layout_columns', $columns, $screen->id, $screen); 3660 3661 if ( !isset($columns[$screen->id]) ) { 3699 3662 $screen_layout_columns = 0; 3700 3663 return ''; 3701 3664 } 3702 3665 3703 $screen_layout_columns = get_user_option("screen_layout_$screen ");3704 $num = $columns[$screen ];3666 $screen_layout_columns = get_user_option("screen_layout_$screen->id"); 3667 $num = $columns[$screen->id]; 3705 3668 3706 3669 if ( ! $screen_layout_columns ) … … 3718 3681 3719 3682 function screen_options($screen) { 3720 $map_screen = $screen; 3721 $type = str_replace('edit-', '', $map_screen); 3722 if ( in_array($type, get_post_types()) ) 3723 $map_screen = 'edit'; 3724 3725 switch ( $map_screen ) { 3683 if ( is_string($screen) ) 3684 $screen = convert_to_screen($screen); 3685 3686 switch ( $screen->base ) { 3726 3687 case 'edit': 3727 3688 $per_page_label = __('Posts per page:'); … … 3749 3710 } 3750 3711 3751 $option = str_replace( '-', '_', " ${screen}_per_page" );3712 $option = str_replace( '-', '_', "{$screen->id}_per_page" ); 3752 3713 $per_page = (int) get_user_option( $option ); 3753 3714 if ( empty( $per_page ) || $per_page < 1 ) { 3754 if ( 'plugins' == $screen )3715 if ( 'plugins' == $screen->id ) 3755 3716 $per_page = 999; 3756 3717 else … … 3774 3735 } 3775 3736 3776 function screen_icon($name = '') { 3777 global $parent_file, $hook_suffix; 3737 function screen_icon($screen = '') { 3738 global $current_screen; 3739 3740 if ( empty($screen) ) 3741 $screen = $current_screen; 3742 elseif ( is_string($screen) ) 3743 $name = $screen; 3778 3744 3779 3745 if ( empty($name) ) { 3780 if ( isset($parent_file) && !empty($parent_file) ) { 3781 $name = $parent_file; 3782 if ( false !== $pos = strpos($name, '?post_type=') ) 3783 $name = substr($name, 0, $pos); 3784 $name = substr($name, 0, -4); 3785 } 3746 if ( !empty($screen->parent_base) ) 3747 $name = $screen->parent_base; 3786 3748 else 3787 $name = str_replace(array('.php', '-new', '-add'), '', $hook_suffix);3749 $name = $screen->base; 3788 3750 } 3789 3751 ?> -
trunk/wp-admin/index.php
r11380 r12728 24 24 $title = __('Dashboard'); 25 25 $parent_file = 'index.php'; 26 27 add_contextual_help($current_screen, '<p>' . __('The modules on this screen can be arranged in several columns. You can select the number of columns from the Screen Options tab.') . "</p>\n" . drag_drop_help() ); 28 26 29 require_once('admin-header.php'); 27 30 -
trunk/wp-admin/menu.php
r12702 r12728 69 69 $submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-link-categories.php' ); 70 70 71 $menu[20] = array( __('Pages'), 'edit_pages', 'edit -pages.php', '', 'menu-top', 'menu-pages', 'div' );72 $submenu['edit -pages.php'][5] = array( __('Edit'), 'edit_pages', 'edit-pages.php' );71 $menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top', 'menu-pages', 'div' ); 72 $submenu['edit.php?post_type=page'][5] = array( __('Edit'), 'edit_pages', 'edit.php?post_type=page' ); 73 73 /* translators: add new page */ 74 $submenu['edit -pages.php'][10] = array( _x('Add New', 'page'), 'edit_pages', 'post-new.php?post_type=page' );74 $submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), 'edit_pages', 'post-new.php?post_type=page' ); 75 75 76 76 $menu[25] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top', 'menu-comments', 'div' ); -
trunk/wp-admin/options-general.php
r12712 r12728 50 50 } 51 51 add_filter('admin_head', 'add_js'); 52 53 add_contextual_help($current_screen, __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>')); 52 54 53 55 include('./admin-header.php'); -
trunk/wp-admin/plugin-install.php
r12103 r12728 53 53 do_action('install_plugins_pre_' . $tab); //Used to override the general interface, Eg, install or plugin information. 54 54 55 add_contextual_help($current_screen, plugins_search_help()); 56 55 57 include('admin-header.php'); 56 58 ?> -
trunk/wp-admin/plugins.php
r12722 r12728 237 237 } 238 238 239 add_contextual_help( 'plugins', $help);239 add_contextual_help($current_screen, $help); 240 240 241 241 if ( is_multisite() && is_super_admin() ) { -
trunk/wp-admin/post-new.php
r12702 r12728 18 18 $parent_file = "edit.php?post_type=$post_type"; 19 19 $submenu_file = "post-new.php?post_type=$post_type"; 20 if ( 'page' == $post_type )21 $parent_file = 'edit-pages.php';22 20 } else { 23 21 $parent_file = 'edit.php'; -
trunk/wp-admin/post.php
r12708 r12728 24 24 $post_id = 0; 25 25 $post_ID = $post_id; 26 27 26 $post = null; 28 27 $post_type_object = null; 29 28 $post_type_cap = null; 29 $post_type = null; 30 30 if ( $post_id ) { 31 31 $post = get_post($post_id); 32 32 if ( $post ) { 33 33 $post_type_object = get_post_type_object($post->post_type); 34 if ( $post_type_object ) 34 if ( $post_type_object ) { 35 $post_type = $post->post_type; 36 $current_screen->post_type = $post->post_type; 37 $current_screen->id = $current_screen->post_type; 35 38 $post_type_cap = $post_type_object->capability_type; 39 } 40 } 41 } elseif ( isset($_POST['post_type']) ) { 42 $post_type_object = get_post_type_object($_POST['post_type']); 43 if ( $post_type_object ) { 44 $post_type = $post_type_object->name; 45 $current_screen->post_type = $post_type; 46 $current_screen->id = $current_screen->post_type; 47 $post_type_cap = $post_type_object->capability_type; 36 48 } 37 49 } … … 109 121 case 'post-quickpress-publish': 110 122 case 'post-quickpress-save': 111 check_admin_referer('add- post');123 check_admin_referer('add-' . $post_type); 112 124 113 125 if ( 'post-quickpress-publish' == $action ) … … 164 176 $parent_file = "edit.php"; 165 177 $submenu_file = "edit.php"; 166 } elseif ( 'page' == $post_type ) { 167 $parent_file = "edit-pages.php"; 168 $submenu_file = "edit-pages.php"; 169 } else { 170 if ( $post_type_object->hierarchical ) { 171 $parent_file = "edit-pages.php?post_type=$post_type"; 172 $submenu_file = "edit-pages.php?post_type=$post_type"; 173 } else { 174 $parent_file = "edit.php?post_type=$post_type"; 175 $submenu_file = "edit.php?post_type=$post_type"; 176 } 178 } else { 179 $parent_file = "edit.php?post_type=$post_type"; 180 $submenu_file = "edit.php?post_type=$post_type"; 177 181 } 178 182 … … 214 218 215 219 case 'editpost': 216 check_admin_referer('update-' . $post ->post_type . '_' . $post_id);220 check_admin_referer('update-' . $post_type . '_' . $post_id); 217 221 218 222 $post_id = edit_post(); … … 224 228 225 229 case 'trash': 226 check_admin_referer('trash- post_' . $post_id);230 check_admin_referer('trash-' . $post_type . '_' . $post_id); 227 231 228 232 $post = & get_post($post_id); … … 239 243 240 244 case 'untrash': 241 check_admin_referer('untrash- post_' . $post_id);245 check_admin_referer('untrash-' . $post_type . '_' . $post_id); 242 246 243 247 if ( !current_user_can('delete_' . $post_type_cap, $post_id) ) … … 252 256 253 257 case 'delete': 254 check_admin_referer('delete- post_' . $post_id);258 check_admin_referer('delete-' . $post_type . '_' . $post_id); 255 259 256 260 if ( !current_user_can('delete_' . $post_type_cap, $post_id) ) … … 281 285 282 286 default: 283 if ( $post_type_object->hierarchical )284 wp_redirect('edit-pages.php');285 else286 287 wp_redirect('edit.php'); 287 288 exit(); -
trunk/wp-admin/theme-install.php
r12103 r12728 53 53 do_action('install_themes_pre_' . $tab); //Used to override the general interface, Eg, install or theme information. 54 54 55 add_contextual_help($current_screen, plugins_search_help()); 56 55 57 include('admin-header.php'); 56 58 ?> -
trunk/wp-admin/themes.php
r12724 r12728 62 62 } 63 63 64 add_contextual_help( 'themes', $help);64 add_contextual_help($current_screen, $help); 65 65 66 66 add_thickbox(); -
trunk/wp-admin/widgets.php
r12546 r12728 33 33 $title = __( 'Widgets' ); 34 34 $parent_file = 'themes.php'; 35 36 $help = ' 37 <p>' . __('Widgets are added and arranged by simple drag ’n’ drop. If you hover your mouse over the titlebar of a widget, you’ll see a 4-arrow cursor which indicates that the widget is movable. Click on the titlebar, hold down the mouse button and drag the widget to a sidebar. As you drag, you’ll see a dotted box that also moves. This box shows where the widget will go once you drop it.') . '</p> 38 <p>' . __('To remove a widget from a sidebar, drag it back to Available Widgets or click on the arrow on its titlebar to reveal its settings, and then click Remove.') . '</p> 39 <p>' . __('To remove a widget from a sidebar <em>and keep its configuration</em>, drag it to Inactive Widgets.') . '</p> 40 <p>' . __('The Inactive Widgets area stores widgets that are configured but not curently used. If you change themes and the new theme has fewer sidebars than the old, all extra widgets will be stored to Inactive Widgets automatically.') . '</p> 41 '; 42 add_contextual_help($current_screen, $help); 35 43 36 44 // register the inactive_widgets area as sidebar
Note: See TracChangeset
for help on using the changeset viewer.