Changeset 12728 for trunk/wp-admin/includes/template.php
- Timestamp:
- 01/15/2010 04:58:36 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 ?>
Note: See TracChangeset
for help on using the changeset viewer.