Ticket #9674: 9674.16.diff
File 9674.16.diff, 66.5 KB (added by , 15 years ago) |
---|
-
wp-admin/admin-ajax.php
1003 1003 case 'autosave-generate-nonces' : 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'); 1010 1013 die('0'); -
wp-admin/post-new.php
17 17 if ( 'post' != $post_type ) { 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'; 24 22 $submenu_file = 'post-new.php'; -
wp-admin/includes/post.php
819 819 $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0; 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); 828 829 … … 842 843 $orderby = 'date'; 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 );850 $posts_per_page = apply_filters( $per_page, $posts_per_page ); 853 851 854 wp( compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page') );855 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 ); 864 856 865 return $avail_post_stati; 857 866 } 858 867 -
wp-admin/includes/misc.php
407 407 408 408 switch ( $map_option ) { 409 409 case 'edit_per_page': 410 case 'edit_pages_per_page':411 410 case 'edit_comments_per_page': 412 411 case 'upload_per_page': 413 412 case 'categories_per_page': -
wp-admin/includes/template.php
747 747 * 748 748 * @return unknown 749 749 */ 750 function wp_manage_posts_columns() { 751 global $typenow; 750 function wp_manage_posts_columns( $screen = '') { 751 if ( empty($screen) ) 752 $post_type = 'post'; 753 else 754 $post_type = $screen->post_type; 752 755 753 756 $posts_columns = array(); 754 757 $posts_columns['cb'] = '<input type="checkbox" />'; 755 758 /* translators: manage posts column name */ 756 $posts_columns['title'] = _x(' Post', 'column name');759 $posts_columns['title'] = _x('Title', 'column name'); 757 760 $posts_columns['author'] = __('Author'); 758 if ( empty($ typenow) || is_object_in_taxonomy($typenow, 'category') )761 if ( empty($post_type) || is_object_in_taxonomy($post_type, 'category') ) 759 762 $posts_columns['categories'] = __('Categories'); 760 if ( empty($ typenow) || is_object_in_taxonomy($typenow, 'category') )763 if ( empty($post_type) || is_object_in_taxonomy($post_type, 'category') ) 761 764 $posts_columns['tags'] = __('Tags'); 762 765 $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all'; 763 if ( !in_array( $post_status, array('pending', 'draft', 'future') ) && ( empty($ typenow) || post_type_supports($typenow, 'comments') ) )766 if ( !in_array( $post_status, array('pending', 'draft', 'future') ) && ( empty($post_type) || post_type_supports($post_type, 'comments') ) ) 764 767 $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>'; 765 768 $posts_columns['date'] = __('Date'); 769 // @todo filter per type 766 770 $posts_columns = apply_filters('manage_posts_columns', $posts_columns); 767 771 768 772 return $posts_columns; … … 803 807 * @return unknown 804 808 */ 805 809 function wp_manage_pages_columns() { 806 $posts_columns = array(); 807 $posts_columns['cb'] = '<input type="checkbox" />'; 808 $posts_columns['title'] = __('Title'); 809 $posts_columns['author'] = __('Author'); 810 $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all'; 811 if ( !in_array( $post_status, array('pending', 'draft', 'future') ) ) 812 $posts_columns['comments'] = '<div class="vers"><img alt="" src="images/comment-grey-bubble.png" /></div>'; 813 $posts_columns['date'] = __('Date'); 814 $posts_columns = apply_filters('manage_pages_columns', $posts_columns); 815 816 return $posts_columns; 810 return wp_manage_posts_columns(); 817 811 } 818 812 819 813 /** … … 821 815 * 822 816 * @since unknown 823 817 * 824 * @param unknown_type $ page818 * @param unknown_type $screen 825 819 * @return unknown 826 820 */ 827 function get_column_headers($ page) {821 function get_column_headers($screen) { 828 822 global $_wp_column_headers; 829 823 830 824 if ( !isset($_wp_column_headers) ) 831 825 $_wp_column_headers = array(); 832 826 833 $map_screen = $page; 834 $type = str_replace('edit-', '', $map_screen); 835 if ( in_array($type, get_post_types()) ) 836 $map_screen = 'edit'; 827 if ( is_string($screen) ) 828 $screen = convert_to_screen($screen); 837 829 838 830 // Store in static to avoid running filters on each call 839 if ( isset($_wp_column_headers[$ page]) )840 return $_wp_column_headers[$ page];831 if ( isset($_wp_column_headers[$screen->id]) ) 832 return $_wp_column_headers[$screen->id]; 841 833 842 switch ($ map_screen) {834 switch ($screen->base) { 843 835 case 'edit': 844 $_wp_column_headers[$ page] = wp_manage_posts_columns();836 $_wp_column_headers[$screen->id] = wp_manage_posts_columns( $screen ); 845 837 break; 846 case 'edit-pages':847 $_wp_column_headers[$page] = wp_manage_pages_columns();848 break;849 838 case 'edit-comments': 850 $_wp_column_headers[$ page] = array(839 $_wp_column_headers[$screen->id] = array( 851 840 'cb' => '<input type="checkbox" />', 852 841 'author' => __('Author'), 853 842 /* translators: column name */ … … 858 847 859 848 break; 860 849 case 'link-manager': 861 $_wp_column_headers[$ page] = array(850 $_wp_column_headers[$screen->id] = array( 862 851 'cb' => '<input type="checkbox" />', 863 852 'name' => __('Name'), 864 853 'url' => __('URL'), … … 870 859 871 860 break; 872 861 case 'upload': 873 $_wp_column_headers[$ page] = wp_manage_media_columns();862 $_wp_column_headers[$screen->id] = wp_manage_media_columns(); 874 863 break; 875 864 case 'categories': 876 $_wp_column_headers[$ page] = array(865 $_wp_column_headers[$screen->id] = array( 877 866 'cb' => '<input type="checkbox" />', 878 867 'name' => __('Name'), 879 868 'description' => __('Description'), … … 883 872 884 873 break; 885 874 case 'edit-link-categories': 886 $_wp_column_headers[$ page] = array(875 $_wp_column_headers[$screen->id] = array( 887 876 'cb' => '<input type="checkbox" />', 888 877 'name' => __('Name'), 889 878 'description' => __('Description'), … … 893 882 894 883 break; 895 884 case 'edit-tags': 896 $_wp_column_headers[$ page] = array(885 $_wp_column_headers[$screen->id] = array( 897 886 'cb' => '<input type="checkbox" />', 898 887 'name' => __('Name'), 899 888 'description' => __('Description'), … … 903 892 904 893 break; 905 894 case 'users': 906 $_wp_column_headers[$ page] = array(895 $_wp_column_headers[$screen->id] = array( 907 896 'cb' => '<input type="checkbox" />', 908 897 'username' => __('Username'), 909 898 'name' => __('Name'), … … 913 902 ); 914 903 break; 915 904 default : 916 $_wp_column_headers[$ page] = array();905 $_wp_column_headers[$screen->id] = array(); 917 906 } 918 907 919 $_wp_column_headers[$ page] = apply_filters('manage_' . $page . '_columns', $_wp_column_headers[$page]);920 return $_wp_column_headers[$ page];908 $_wp_column_headers[$screen->id] = apply_filters('manage_' . $screen->id . '_columns', $_wp_column_headers[$screen->id]); 909 return $_wp_column_headers[$screen->id]; 921 910 } 922 911 923 912 /** … … 925 914 * 926 915 * @since unknown 927 916 * 928 * @param unknown_type $ type917 * @param unknown_type $screen 929 918 * @param unknown_type $id 930 919 */ 931 function print_column_headers( $type, $id = true ) { 932 $type = str_replace('.php', '', $type); 933 $columns = get_column_headers( $type ); 934 $hidden = get_hidden_columns($type); 920 function print_column_headers( $screen, $id = true ) { 921 if ( is_string($screen) ) 922 $screen = convert_to_screen($screen); 923 924 $columns = get_column_headers( $screen ); 925 $hidden = get_hidden_columns($screen); 935 926 $styles = array(); 936 927 937 928 foreach ( $columns as $column_key => $column_display_name ) { … … 950 941 if ( in_array($column_key, $hidden) ) 951 942 $style = 'display:none;'; 952 943 953 if ( isset($styles[$ type]) && isset($styles[$type][$column_key]) )954 $style .= ' ' . $styles[$ type][$column_key];944 if ( isset($styles[$screen->id]) && isset($styles[$screen->id][$column_key]) ) 945 $style .= ' ' . $styles[$screen>id][$column_key]; 955 946 $style = ' style="' . $style . '"'; 956 947 ?> 957 948 <th scope="col" <?php echo $id ? "id=\"$column_key\"" : ""; echo $class; echo $style; ?>><?php echo $column_display_name; ?></th> … … 970 961 function register_column_headers($screen, $columns) { 971 962 global $_wp_column_headers; 972 963 964 if ( is_string($screen) ) 965 $screen = convert_to_screen($screen); 966 973 967 if ( !isset($_wp_column_headers) ) 974 968 $_wp_column_headers = array(); 975 969 976 $_wp_column_headers[$screen ] = $columns;970 $_wp_column_headers[$screen->id] = $columns; 977 971 } 978 972 979 973 /** … … 981 975 * 982 976 * @since unknown 983 977 * 984 * @param unknown_type $ page978 * @param unknown_type $screen 985 979 */ 986 function get_hidden_columns($page) { 987 $page = str_replace('.php', '', $page); 988 return (array) get_user_option( 'manage-' . $page . '-columns-hidden' ); 980 function get_hidden_columns($screen) { 981 if ( is_string($screen) ) 982 $screen = convert_to_screen($screen); 983 984 return (array) get_user_option( 'manage-' . $screen->id. '-columns-hidden' ); 989 985 } 990 986 991 987 /** … … 997 993 * 998 994 * @param string $type 'post' or 'page' 999 995 */ 1000 function inline_edit_row( $ type) {996 function inline_edit_row( $screen ) { 1001 997 global $current_user, $mode; 1002 998 1003 $is_page = 'page' == $type; 1004 if ( $is_page ) { 1005 $screen = 'edit-pages'; 1006 $post = get_default_page_to_edit(); 1007 } else { 1008 $screen = 'edit'; 1009 $post = get_default_post_to_edit(); 999 if ( is_string($screen) ) { 1000 $screen = array('id' => 'edit-' . $screen, 'base' => 'edit', 'post_type' => $screen ); 1001 $screen = (object) $screen; 1010 1002 } 1011 1003 1012 $columns = $is_page ? wp_manage_pages_columns() : wp_manage_posts_columns(); 1004 $post = get_default_post_to_edit( $screen->post_type ); 1005 $post_type_object = get_post_type_object( $screen->post_type ); 1006 1007 $columns = wp_manage_posts_columns($screen); 1013 1008 $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) ); 1014 1009 $col_count = count($columns) - count($hidden); 1015 1010 $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list'; 1016 $can_publish = current_user_can("publish_{$type}s"); 1011 // @todo use capability_type 1012 $can_publish = current_user_can("publish_{$screen->post_type}s"); 1017 1013 $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true ); 1018 1014 1019 1015 ?> … … 1023 1019 $bulk = 0; 1024 1020 while ( $bulk < 2 ) { ?> 1025 1021 1026 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$ type ";1027 echo $bulk ? "bulk-edit-row bulk-edit-row-$ type" : "quick-edit-row quick-edit-row-$type";1022 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$screen->post_type "; 1023 echo $bulk ? "bulk-edit-row bulk-edit-row-$screen->post_type" : "quick-edit-row quick-edit-row-$screen->post_type"; 1028 1024 ?>" style="display: none"><td colspan="<?php echo $col_count; ?>"> 1029 1025 1030 1026 <fieldset class="inline-edit-col-left"><div class="inline-edit-col"> 1031 <h4><?php echo $bulk ? ( $is_page ? __( 'Bulk Edit Pages' ) : __( 'Bulk Edit Posts' ) ) : __( 'Quick Edit' ); ?></h4>1027 <h4><?php echo $bulk ? ( __( 'Bulk Edit' ) ) : __( 'Quick Edit' ); ?></h4> 1032 1028 1033 1029 1034 1030 <?php if ( $bulk ) : ?> … … 1061 1057 1062 1058 <?php endif; // $bulk 1063 1059 1064 $authors = get_editable_user_ids( $current_user->id, true, $ type ); // TODO: ROLE SYSTEM1060 $authors = get_editable_user_ids( $current_user->id, true, $screen->post_type ); // TODO: ROLE SYSTEM 1065 1061 $authors_dropdown = ''; 1066 1062 if ( $authors && count( $authors ) > 1 ) : 1067 1063 $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0); … … 1091 1087 </em> 1092 1088 <label class="alignleft inline-edit-private"> 1093 1089 <input type="checkbox" name="keep_private" value="private" /> 1094 <span class="checkbox-title"><?php echo $is_page ? __('Private page') : __('Private post'); ?></span>1090 <span class="checkbox-title"><?php echo __('Private'); ?></span> 1095 1091 </label> 1096 1092 </div> 1097 1093 … … 1099 1095 1100 1096 </div></fieldset> 1101 1097 1102 <?php if ( !$is_page&& !$bulk ) : ?>1098 <?php if ( is_object_in_taxonomy($screen->post_type, 'categories') && !$bulk ) : ?> 1103 1099 1104 1100 <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col"> 1105 1101 <span class="title inline-edit-categories-label"><?php _e( 'Categories' ); ?> … … 1111 1107 </ul> 1112 1108 </div></fieldset> 1113 1109 1114 <?php endif; // ! $is_page&& !$bulk ?>1110 <?php endif; // !hierarchical && !$bulk ?> 1115 1111 1116 1112 <fieldset class="inline-edit-col-right"><div class="inline-edit-col"> 1117 1113 … … 1120 1116 echo $authors_dropdown; 1121 1117 ?> 1122 1118 1123 <?php if ( $ is_page) : ?>1119 <?php if ( $post_type_object->hierarchical ) : ?> 1124 1120 1125 1121 <label> 1126 1122 <span class="title"><?php _e( 'Parent' ); ?></span> … … 1220 1216 </select> 1221 1217 </label> 1222 1218 1223 <?php if ( !$is_page && $can_publish && current_user_can( 'edit_others_posts' ) ) : ?>1219 <?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( 'edit_others_posts' ) ) : ?> 1224 1220 1225 1221 <?php if ( $bulk ) : ?> 1226 1222 … … 1259 1255 <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel alignleft"><?php _e('Cancel'); ?></a> 1260 1256 <?php if ( ! $bulk ) { 1261 1257 wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); 1262 $update_text = ( $is_page ) ? __( 'Update Page' ) : __( 'Update Post' );1258 $update_text = __( 'Update' ); 1263 1259 ?> 1264 1260 <a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a> 1265 1261 <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" /> 1266 1262 <?php } else { 1267 $update_text = ( $is_page ) ? __( 'Update Pages' ) : __( 'Update Posts' );1263 $update_text = __( 'Update' ); 1268 1264 ?> 1269 1265 <input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo esc_attr( $update_text ); ?>" /> 1270 1266 <?php } ?> … … 1368 1364 * @param unknown_type $mode 1369 1365 */ 1370 1366 function _post_row($a_post, $pending_comments, $mode) { 1371 global $post, $current_user ;1367 global $post, $current_user, $current_screen; 1372 1368 static $rowclass; 1373 1369 1374 1370 $global_post = $post; … … 1382 1378 ?> 1383 1379 <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top"> 1384 1380 <?php 1385 $posts_columns = get_column_headers( 'edit');1386 $hidden = get_hidden_columns( 'edit');1381 $posts_columns = get_column_headers( $current_screen ); 1382 $hidden = get_hidden_columns( $current_screen ); 1387 1383 foreach ( $posts_columns as $column_name=>$column_display_name ) { 1388 1384 $class = "class=\"$column_name column-$column_name\""; 1389 1385 … … 1578 1574 * @param unknown_type $level 1579 1575 */ 1580 1576 function display_page_row( $page, $level = 0 ) { 1581 global $post ;1577 global $post, $current_screen; 1582 1578 static $rowclass; 1583 1579 1584 1580 $post = $page; … … 1605 1601 $pad = str_repeat( '— ', $level ); 1606 1602 $id = (int) $page->ID; 1607 1603 $rowclass = 'alternate' == $rowclass ? '' : 'alternate'; 1608 $posts_columns = get_column_headers( 'edit-pages');1609 $hidden = get_hidden_columns( 'edit-pages');1604 $posts_columns = get_column_headers( $current_screen ); 1605 $hidden = get_hidden_columns( $current_screen ); 1610 1606 $title = _draft_or_post_title(); 1611 1607 ?> 1612 1608 <tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit"> … … 3055 3051 * 3056 3052 * @since unknown 3057 3053 * 3058 * @param unknown_type $ page3054 * @param unknown_type $screen 3059 3055 */ 3060 function meta_box_prefs($ page) {3056 function meta_box_prefs($screen) { 3061 3057 global $wp_meta_boxes; 3062 3058 3063 if ( empty($wp_meta_boxes[$page]) ) 3059 if ( is_string($screen) ) 3060 $screen = convert_to_screen($screen); 3061 3062 if ( empty($wp_meta_boxes[$screen->id]) ) 3064 3063 return; 3065 3064 3066 $hidden = get_hidden_meta_boxes($ page);3065 $hidden = get_hidden_meta_boxes($screen); 3067 3066 3068 foreach ( array_keys($wp_meta_boxes[$ page]) as $context ) {3069 foreach ( array_keys($wp_meta_boxes[$ page][$context]) as $priority ) {3070 foreach ( $wp_meta_boxes[$ page][$context][$priority] as $box ) {3067 foreach ( array_keys($wp_meta_boxes[$screen->id]) as $context ) { 3068 foreach ( array_keys($wp_meta_boxes[$screen->id][$context]) as $priority ) { 3069 foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) { 3071 3070 if ( false == $box || ! $box['title'] ) 3072 3071 continue; 3073 3072 // Submit box cannot be hidden … … 3082 3081 } 3083 3082 } 3084 3083 3085 function get_hidden_meta_boxes($page) { 3086 $hidden = (array) get_user_option( "meta-box-hidden_$page" ); 3084 function get_hidden_meta_boxes($screen) { 3085 if ( is_string($screen) ) 3086 $screen = convert_to_screen($screen); 3087 3087 3088 $hidden = (array) get_user_option( "meta-box-hidden_$screen->id" ); 3089 3088 3090 // Hide slug boxes by default 3089 3091 if ( empty($hidden[0]) ) { 3090 3092 $hidden = array('slugdiv'); … … 3278 3280 * @since unknown 3279 3281 */ 3280 3282 function favorite_actions( $screen = null ) { 3281 switch ( $screen ) { 3282 case 'post-new.php': 3283 if ( is_string($screen) ) 3284 $screen = convert_to_screen($screen); 3285 3286 switch ( $screen->id ) { 3287 case 'post': 3283 3288 $default_action = array('edit.php' => array(__('Edit Posts'), 'edit_posts')); 3284 3289 break; 3285 case 'edit-page s.php':3286 $default_action = array('p age-new.php' => array(__('New Page'), 'edit_pages'));3290 case 'edit-page': 3291 $default_action = array('post-new.php?post_type=page' => array(__('New Page'), 'edit_pages')); 3287 3292 break; 3288 case 'page -new.php':3289 $default_action = array('edit -pages.php' => array(__('Edit Pages'), 'edit_pages'));3293 case 'page': 3294 $default_action = array('edit.php?post_type=page' => array(__('Edit Pages'), 'edit_pages')); 3290 3295 break; 3291 3296 case 'upload.php': 3292 3297 $default_action = array('media-new.php' => array(__('New Media'), 'upload_files')); 3293 3298 break; 3294 case 'media -new.php':3299 case 'media': 3295 3300 $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files')); 3296 3301 break; 3297 case 'link-manager .php':3302 case 'link-manager': 3298 3303 $default_action = array('link-add.php' => array(__('New Link'), 'manage_links')); 3299 3304 break; 3300 case 'link-add .php':3305 case 'link-add': 3301 3306 $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links')); 3302 3307 break; 3303 case 'users .php':3308 case 'users': 3304 3309 $default_action = array('user-new.php' => array(__('New User'), 'create_users')); 3305 3310 break; 3306 case 'user -new.php':3311 case 'user': 3307 3312 $default_action = array('users.php' => array(__('Edit Users'), 'edit_users')); 3308 3313 break; 3309 case 'plugins .php':3314 case 'plugins': 3310 3315 $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins')); 3311 3316 break; 3312 case 'plugin-install .php':3317 case 'plugin-install': 3313 3318 $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins')); 3314 3319 break; 3315 case 'themes .php':3320 case 'themes': 3316 3321 $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes')); 3317 3322 break; 3318 case 'theme-install .php':3323 case 'theme-install': 3319 3324 $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes')); 3320 3325 break; 3321 3326 default: … … 3483 3488 } 3484 3489 } 3485 3490 3486 function screen_meta($screen) { 3487 global $wp_meta_boxes, $_wp_contextual_help, $typenow; 3488 3491 // Convert a screen string to a screen object 3492 function convert_to_screen( $screen ) { 3489 3493 $screen = str_replace('.php', '', $screen); 3490 3494 $screen = str_replace('-new', '', $screen); 3491 3495 $screen = str_replace('-add', '', $screen); 3492 3496 $screen = apply_filters('screen_meta_screen', $screen); 3493 3497 3498 $screen = array('id' => $screen, 'base' => $screen); 3499 return (object) $screen; 3500 } 3501 3502 function screen_meta($screen) { 3503 global $wp_meta_boxes, $_wp_contextual_help, $post_type; 3504 3505 if ( is_string($screen) ) 3506 $screen = convert_to_screen($screen); 3507 3494 3508 $column_screens = get_column_headers($screen); 3495 3509 $meta_screens = array('index' => 'dashboard'); 3496 3510 3497 // Give post_type pages their own screen 3498 if ( 'post' == $screen ) { 3499 if ( !empty($typenow) ) 3500 $screen = $typenow; 3511 if ( isset($meta_screens[$screen->id]) ) { 3512 $screen->id = $meta_screens[$screen->id]; 3513 $screen->base = $screen->id; 3501 3514 } 3502 if ( 'edit' == $screen ) {3503 if ( !empty($typenow) )3504 $screen = 'edit-' . $typenow;3505 }3506 3515 3507 if ( isset($meta_screens[$screen]) )3508 $screen = $meta_screens[$screen];3509 3516 $show_screen = false; 3510 3517 $show_on_screen = false; 3511 if ( !empty($wp_meta_boxes[$screen ]) || !empty($column_screens) ) {3518 if ( !empty($wp_meta_boxes[$screen->id]) || !empty($column_screens) ) { 3512 3519 $show_screen = true; 3513 3520 $show_on_screen = true; 3514 3521 } … … 3522 3529 3523 3530 $settings = ''; 3524 3531 3525 switch ( $screen ) { 3526 case 'post': 3527 if ( !isset($_wp_contextual_help['post']) ) { 3528 $help = drag_drop_help(); 3529 $help .= '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>') . '</p>'; 3530 $_wp_contextual_help['post'] = $help; 3531 } 3532 break; 3533 case 'page': 3534 if ( !isset($_wp_contextual_help['page']) ) { 3535 $help = drag_drop_help(); 3536 $_wp_contextual_help['page'] = $help; 3537 } 3538 break; 3539 case 'dashboard': 3540 if ( !isset($_wp_contextual_help['dashboard']) ) { 3541 $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"; 3542 $help .= drag_drop_help(); 3543 $_wp_contextual_help['dashboard'] = $help; 3544 } 3545 break; 3546 case 'link': 3547 if ( !isset($_wp_contextual_help['link']) ) { 3548 $help = drag_drop_help(); 3549 $_wp_contextual_help['link'] = $help; 3550 } 3551 break; 3552 case 'options-general': 3553 if ( !isset($_wp_contextual_help['options-general']) ) 3554 $_wp_contextual_help['options-general'] = __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>'); 3555 break; 3556 case 'theme-install': 3557 case 'plugin-install': 3558 if ( ( !isset($_GET['tab']) || 'dashboard' == $_GET['tab'] ) && !isset($_wp_contextual_help[$screen]) ) { 3559 $help = plugins_search_help(); 3560 $_wp_contextual_help[$screen] = $help; 3561 } 3562 break; 3532 switch ( $screen->id ) { 3563 3533 case 'widgets': 3564 if ( !isset($_wp_contextual_help['widgets']) ) {3565 $help = widgets_help();3566 $_wp_contextual_help['widgets'] = $help;3567 }3568 3534 $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"; 3569 3535 $show_screen = true; 3570 3536 break; … … 3604 3570 <div id="contextual-help-wrap" class="hidden"> 3605 3571 <?php 3606 3572 $contextual_help = ''; 3607 if ( isset($_wp_contextual_help[$screen ]) ) {3573 if ( isset($_wp_contextual_help[$screen->id]) ) { 3608 3574 if ( !empty($title) ) 3609 3575 $contextual_help .= '<h5>' . sprintf(__('Get help with “%s”'), $title) . '</h5>'; 3610 3576 else 3611 3577 $contextual_help .= '<h5>' . __('Get help with this page') . '</h5>'; 3612 $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen ] . "</div>\n";3578 $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen->id] . "</div>\n"; 3613 3579 3614 3580 $contextual_help .= '<h5>' . __('Other Help') . '</h5>'; 3615 3581 } else { … … 3651 3617 function add_contextual_help($screen, $help) { 3652 3618 global $_wp_contextual_help; 3653 3619 3620 if ( is_string($screen) ) 3621 $screen = convert_to_screen($screen); 3622 3654 3623 if ( !isset($_wp_contextual_help) ) 3655 3624 $_wp_contextual_help = array(); 3656 3625 3657 $_wp_contextual_help[$screen ] = $help;3626 $_wp_contextual_help[$screen->id] = $help; 3658 3627 } 3659 3628 3660 3629 function drag_drop_help() { … … 3674 3643 '; 3675 3644 } 3676 3645 3677 function widgets_help() {3678 return '3679 <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>3680 <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>3681 <p>' . __('To remove a widget from a sidebar <em>and keep its configuration</em>, drag it to Inactive Widgets.') . '</p>3682 <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>3683 ';3684 }3685 3686 3646 function screen_layout($screen) { 3687 3647 global $screen_layout_columns; 3688 3648 3649 if ( is_string($screen) ) 3650 $screen = convert_to_screen($screen); 3651 3689 3652 $columns = array('dashboard' => 4, 'post' => 2, 'page' => 2, 'link' => 2); 3690 3653 3691 3654 // Add custom post types 3692 3655 foreach ( get_post_types( array('_show' => true) ) as $post_type ) 3693 3656 $columns[$post_type] = 2; 3694 3657 3695 $columns = apply_filters('screen_layout_columns', $columns, $screen );3658 $columns = apply_filters('screen_layout_columns', $columns, $screen->id, $screen); 3696 3659 3697 if ( !isset($columns[$screen ]) ) {3660 if ( !isset($columns[$screen->id]) ) { 3698 3661 $screen_layout_columns = 0; 3699 3662 return ''; 3700 3663 } 3701 3664 3702 $screen_layout_columns = get_user_option("screen_layout_$screen ");3703 $num = $columns[$screen ];3665 $screen_layout_columns = get_user_option("screen_layout_$screen->id"); 3666 $num = $columns[$screen->id]; 3704 3667 3705 3668 if ( ! $screen_layout_columns ) 3706 3669 $screen_layout_columns = 2; … … 3716 3679 } 3717 3680 3718 3681 function screen_options($screen) { 3719 $map_screen = $screen; 3720 $type = str_replace('edit-', '', $map_screen); 3721 if ( in_array($type, get_post_types()) ) 3722 $map_screen = 'edit'; 3682 if ( is_string($screen) ) 3683 $screen = convert_to_screen($screen); 3723 3684 3724 switch ( $ map_screen) {3685 switch ( $screen->base ) { 3725 3686 case 'edit': 3726 3687 $per_page_label = __('Posts per page:'); 3727 3688 break; … … 3747 3708 return ''; 3748 3709 } 3749 3710 3750 $option = str_replace( '-', '_', " ${screen}_per_page" );3711 $option = str_replace( '-', '_', "{$screen->id}_per_page" ); 3751 3712 $per_page = (int) get_user_option( $option ); 3752 3713 if ( empty( $per_page ) || $per_page < 1 ) { 3753 if ( 'plugins' == $screen )3714 if ( 'plugins' == $screen->id ) 3754 3715 $per_page = 999; 3755 3716 else 3756 3717 $per_page = 20; … … 3772 3733 return $return; 3773 3734 } 3774 3735 3775 function screen_icon($ name= '') {3776 global $ parent_file, $hook_suffix;3736 function screen_icon($screen = '') { 3737 global $current_screen; 3777 3738 3739 if ( empty($screen) ) 3740 $screen = $current_screen; 3741 elseif ( is_string($screen) ) 3742 $name = $screen; 3743 3778 3744 if ( empty($name) ) { 3779 if ( isset($parent_file) && !empty($parent_file) ) { 3780 $name = $parent_file; 3781 if ( false !== $pos = strpos($name, '?post_type=') ) 3782 $name = substr($name, 0, $pos); 3783 $name = substr($name, 0, -4); 3784 } 3745 if ( !empty($screen->parent_base) ) 3746 $name = $screen->parent_base; 3785 3747 else 3786 $name = str_replace(array('.php', '-new', '-add'), '', $hook_suffix);3748 $name = $screen->base; 3787 3749 } 3788 3750 ?> 3789 3751 <div id="icon-<?php echo $name; ?>" class="icon32"><br /></div> -
wp-admin/post.php
23 23 else 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 } 36 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; 48 } 37 49 } 38 50 39 51 /** … … 108 120 case 'post': 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 ) 114 126 $_POST['publish'] = 'publish'; // tell write_post() to publish … … 163 175 if ( 'post' == $post_type ) { 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 178 } 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 } 179 $parent_file = "edit.php?post_type=$post_type"; 180 $submenu_file = "edit.php?post_type=$post_type"; 177 181 } 178 182 179 183 wp_enqueue_script('post'); … … 213 217 wp_update_attachment_metadata( $post_id, $newmeta ); 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(); 219 223 … … 223 227 break; 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); 229 233 … … 238 242 break; 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) ) 244 248 wp_die( __('You are not allowed to move this item out of the trash.') ); … … 251 255 break; 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) ) 257 261 wp_die( __('You are not allowed to delete this item.') ); … … 280 284 break; 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(); 288 289 break; -
wp-admin/admin.php
177 177 if ( !empty($_REQUEST['action']) ) 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 ?> -
wp-admin/edit-post-rows.php
13 13 <table class="widefat post fixed" cellspacing="0"> 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> 19 19 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> 35 No newline at end of file -
wp-admin/options-general.php
50 50 } 51 51 add_filter('admin_head', 'add_js'); 52 52 53 add_contextual_help($current_screen, __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>')); 54 53 55 include('./admin-header.php'); 54 56 ?> 55 57 -
wp-admin/index.php
23 23 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 28 31 $today = current_time('mysql', 1); -
wp-admin/edit-link-form.php
34 34 do_action('do_meta_boxes', 'link', 'advanced', $link); 35 35 do_action('do_meta_boxes', 'link', 'side', $link); 36 36 37 add_contextual_help($current_screen, drag_drop_help()); 38 37 39 require_once ('admin-header.php'); 38 40 39 41 ?> -
wp-admin/edit-form-advanced.php
142 142 do_action('do_meta_boxes', $post_type, 'advanced', $post); 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 ?> 147 149 -
wp-admin/plugin-install.php
52 52 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 ?> 57 59 <div class="wrap"> -
wp-admin/menu.php
68 68 $submenu['link-manager.php'][10] = array( _x('Add New', 'links'), 'manage_links', 'link-add.php' ); 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' ); 77 77 -
wp-admin/admin-header.php
29 29 wp_admin_css( 'css/ms' ); 30 30 wp_enqueue_script('utils'); 31 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 47 32 $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix); 48 33 ?> 49 34 <script type="text/javascript"> … … 119 104 <a href="<?php echo wp_logout_url() ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a></p> 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'); 128 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 ?> 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'); 134 125 -
wp-admin/plugins.php
236 236 $help .= '<p>' . sprintf(__('You can find additional plugins for your site by using the new <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> directly and installing manually. To <em>manually</em> install a plugin you generally just need to upload the plugin file into your <code>%2$s</code> directory. Once a plugin has been installed, you may activate it here.'), 'plugin-install.php', WP_PLUGIN_DIR) . '</p>'; 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() ) { 242 242 $menu_perms = get_site_option('menu_items', array()); -
wp-admin/edit.php
20 20 unset( $_redirect ); 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 26 26 $post_type = 'post'; 27 27 $_GET['post_type'] = $post_type; 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 ) { 32 33 $parent_file = "edit.php?post_type=$post_type"; … … 38 39 $post_new_file = 'post-new.php'; 39 40 } 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 ); 51 41 52 // Handle bulk actions 42 53 if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) || isset($_GET['bulk_edit']) ) { 43 54 check_admin_referer('bulk-posts'); … … 61 72 case 'trash': 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) ) 68 79 wp_die( __('Error in moving to trash...') ); … … 74 85 case 'untrash': 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) ) 81 92 wp_die( __('Error in restoring from trash...') ); … … 89 100 foreach( (array) $post_ids as $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' ) { 96 107 if ( ! wp_delete_attachment($post_id) ) … … 130 141 wp_enqueue_script('inline-edit-post'); 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; 136 147 if ( $user_posts_count && empty($_GET['post_status']) && empty($_GET['all_posts']) && empty($_GET['author']) ) … … 139 150 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 159 144 if ( !isset( $_GET['paged'] ) )145 $_GET['paged'] = 1;146 147 160 if ( empty($_GET['mode']) ) 148 161 $mode = 'list'; 149 162 else … … 158 171 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; ?> 164 177 … … 173 186 unset($_GET['skipped']); 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 />'; 189 202 unset($_GET['trashed']); 190 203 } 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 } 196 209 … … 212 225 if ( $user_posts ) { 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 } 218 231 … … 261 274 'format' => '', 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 268 281 $is_trash = isset($_GET['post_status']) && $_GET['post_status'] == 'trash'; … … 318 331 <?php } ?> 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 } ?> 332 347 </div> 333 348 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 340 355 ); echo $page_links_text; ?></div> … … 373 388 <?php } ?> 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 } ?> 379 394 <br class="clear" /> … … 393 408 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> 399 414 <br class="clear" /> -
wp-admin/theme-install.php
52 52 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 ?> 57 59 <div class="wrap"> -
wp-admin/widgets.php
33 33 $title = __( 'Widgets' ); 34 34 $parent_file = 'themes.php'; 35 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); 43 36 44 // register the inactive_widgets area as sidebar 37 45 register_sidebar(array( 38 46 'name' => __('Inactive Widgets'), -
wp-admin/edit-pages.php
1 <?php2 /**3 * Edit Pages Administration Panel.4 *5 * @package WordPress6 * @subpackage Administration7 */8 9 /** WordPress Administration Bootstrap */10 require_once('admin.php');11 12 if ( !current_user_can('edit_pages') )13 wp_die(__('Cheatin’ uh?'));14 15 // Handle bulk actions16 if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) || isset($_GET['bulk_edit']) ) {17 check_admin_referer('bulk-pages');18 $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );19 20 if ( strpos($sendback, 'page.php') !== false )21 $sendback = admin_url('post-new.php?post_type=page');22 23 if ( isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {24 $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_GET['post_status']);25 $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = %s", $post_status ) );26 $doaction = 'delete';27 } elseif ( ( $_GET['action'] != -1 || $_GET['action2'] != -1 ) && ( isset($_GET['post']) || isset($_GET['ids']) ) ) {28 $post_ids = isset($_GET['post']) ? array_map( 'intval', (array) $_GET['post'] ) : explode(',', $_GET['ids']);29 $doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2'];30 } else {31 wp_redirect( admin_url('edit-pages.php') );32 }33 34 switch ( $doaction ) {35 case 'trash':36 $trashed = 0;37 foreach( (array) $post_ids as $post_id ) {38 if ( !current_user_can('delete_page', $post_id) )39 wp_die( __('You are not allowed to move this page to the trash.') );40 41 if ( !wp_trash_post($post_id) )42 wp_die( __('Error in moving to trash...') );43 44 $trashed++;45 }46 $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids)), $sendback );47 break;48 case 'untrash':49 $untrashed = 0;50 foreach( (array) $post_ids as $post_id ) {51 if ( !current_user_can('delete_page', $post_id) )52 wp_die( __('You are not allowed to restore this page from the trash.') );53 54 if ( !wp_untrash_post($post_id) )55 wp_die( __('Error in restoring from trash...') );56 57 $untrashed++;58 }59 $sendback = add_query_arg('untrashed', $untrashed, $sendback);60 break;61 case 'delete':62 $deleted = 0;63 foreach( (array) $post_ids as $post_id ) {64 $post_del = & get_post($post_id);65 66 if ( !current_user_can('delete_page', $post_id) )67 wp_die( __('You are not allowed to delete this page.') );68 69 if ( $post_del->post_type == 'attachment' ) {70 if ( ! wp_delete_attachment($post_id) )71 wp_die( __('Error in deleting...') );72 } else {73 if ( !wp_delete_post($post_id) )74 wp_die( __('Error in deleting...') );75 }76 $deleted++;77 }78 $sendback = add_query_arg('deleted', $deleted, $sendback);79 break;80 case 'edit':81 $_GET['post_type'] = 'page';82 $done = bulk_edit_posts($_GET);83 84 if ( is_array($done) ) {85 $done['updated'] = count( $done['updated'] );86 $done['skipped'] = count( $done['skipped'] );87 $done['locked'] = count( $done['locked'] );88 $sendback = add_query_arg( $done, $sendback );89 }90 break;91 }92 93 if ( isset($_GET['action']) )94 $sendback = remove_query_arg( array('action', 'action2', 'post_parent', 'page_template', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view', 'post_type'), $sendback );95 96 wp_redirect($sendback);97 exit();98 } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {99 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );100 exit;101 }102 103 if ( empty($title) )104 $title = __('Edit Pages');105 $parent_file = 'edit-pages.php';106 wp_enqueue_script('inline-edit-post');107 108 $post_stati = array( // array( adj, noun )109 'publish' => array(_x('Published', 'page'), __('Published pages'), _nx_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>', 'page')),110 'future' => array(_x('Scheduled', 'page'), __('Scheduled pages'), _nx_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>', 'page')),111 'pending' => array(_x('Pending Review', 'page'), __('Pending pages'), _nx_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>', 'page')),112 'draft' => array(_x('Draft', 'page'), _x('Drafts', 'manage posts header'), _nx_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>', 'page')),113 'private' => array(_x('Private', 'page'), __('Private pages'), _nx_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', 'page')),114 'trash' => array(_x('Trash', 'page'), __('Trash pages'), _nx_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', 'page'))115 );116 117 if ( !EMPTY_TRASH_DAYS )118 unset($post_stati['trash']);119 120 $post_stati = apply_filters('page_stati', $post_stati);121 122 $query = array('post_type' => 'page', 'orderby' => 'menu_order title',123 'posts_per_page' => -1, 'posts_per_archive_page' => -1, 'order' => 'asc');124 125 $post_status_label = __('Pages');126 if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {127 $post_status_label = $post_stati[$_GET['post_status']][1];128 $query['post_status'] = $_GET['post_status'];129 $query['perm'] = 'readable';130 }131 132 $query = apply_filters('manage_pages_query', $query);133 wp($query);134 135 if ( is_singular() ) {136 wp_enqueue_script( 'admin-comments' );137 enqueue_comment_hotkeys_js();138 }139 140 require_once('admin-header.php'); ?>141 142 <div class="wrap">143 <?php screen_icon(); ?>144 <h2><?php echo esc_html( $title ); ?> <a href="post-new.php?post_type=page" class="button add-new-h2"><?php echo esc_html_x('Add New', 'page'); ?></a> <?php145 if ( isset($_GET['s']) && $_GET['s'] )146 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( get_search_query() ) ); ?>147 </h2>148 149 <?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) ) { ?>150 <div id="message" class="updated"><p>151 <?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {152 printf( _n( '%s page updated.', '%s pages updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );153 unset($_GET['updated']);154 }155 if ( isset($_GET['skipped']) && (int) $_GET['skipped'] ) {156 printf( _n( '%s page not updated, invalid parent page specified.', '%s pages not updated, invalid parent page specified.', $_GET['skipped'] ), number_format_i18n( $_GET['skipped'] ) );157 unset($_GET['skipped']);158 }159 if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {160 printf( _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['skipped'] ) );161 unset($_GET['locked']);162 }163 if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {164 printf( _n( 'Page permanently deleted.', '%s pages permanently deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );165 unset($_GET['deleted']);166 }167 if ( isset($_GET['trashed']) && (int) $_GET['trashed'] ) {168 printf( _n( 'Page moved to the trash.', '%s pages moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) );169 $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;170 echo ' <a href="' . esc_url( wp_nonce_url( "edit-pages.php?doaction=undo&action=untrash&ids=$ids", "bulk-pages" ) ) . '">' . __('Undo') . '</a><br />';171 unset($_GET['trashed']);172 }173 if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) {174 printf( _n( 'Page restored from the trash.', '%s pages restored from the trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) );175 unset($_GET['untrashed']);176 }177 $_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed'), $_SERVER['REQUEST_URI'] );178 ?>179 </p></div>180 <?php } ?>181 182 <?php if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>183 <div id="message" class="updated"><p><strong><?php _e('Your page has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View page'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit page'); ?></a></p></div>184 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);185 endif; ?>186 187 <form id="posts-filter" action="<?php echo admin_url('edit-pages.php'); ?>" method="get">188 <ul class="subsubsub">189 <?php190 191 $avail_post_stati = get_available_post_statuses('page');192 if ( empty($locked_post_status) ) :193 $status_links = array();194 $num_posts = wp_count_posts('page', 'readable');195 $total_posts = array_sum( (array) $num_posts ) - $num_posts->trash;196 $class = empty($_GET['post_status']) ? ' class="current"' : '';197 $status_links[] = "<li><a href='edit-pages.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'pages' ), number_format_i18n( $total_posts ) ) . '</a>';198 foreach ( $post_stati as $status => $label ) {199 $class = '';200 201 if ( !in_array($status, $avail_post_stati) || $num_posts->$status <= 0 )202 continue;203 204 if ( isset( $_GET['post_status'] ) && $status == $_GET['post_status'] )205 $class = ' class="current"';206 207 $status_links[] = "<li><a href='edit-pages.php?post_status=$status'$class>" . sprintf( _nx( $label[2][0], $label[2][1], $num_posts->$status, $label[2][2] ), number_format_i18n( $num_posts->$status ) ) . '</a>';208 }209 echo implode( " |</li>\n", $status_links ) . '</li>';210 unset($status_links);211 endif;212 ?>213 </ul>214 215 <p class="search-box">216 <label class="screen-reader-text" for="page-search-input"><?php _e( 'Search Pages' ); ?>:</label>217 <input type="text" id="page-search-input" name="s" value="<?php _admin_search_query(); ?>" />218 <input type="submit" value="<?php esc_attr_e( 'Search Pages' ); ?>" class="button" />219 </p>220 221 <input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_GET['post_status']) ? esc_attr($_GET['post_status']) : 'all'; ?>" />222 223 <?php if ($posts) { ?>224 225 <div class="tablenav">226 227 <?php228 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;229 if ( empty($pagenum) )230 $pagenum = 1;231 $per_page = (int) get_user_option( 'edit_pages_per_page' );232 if ( empty( $per_page ) || $per_page < 1 )233 $per_page = 20;234 $per_page = apply_filters( 'edit_pages_per_page', $per_page );235 236 $num_pages = ceil($wp_query->post_count / $per_page);237 $page_links = paginate_links( array(238 'base' => add_query_arg( 'pagenum', '%#%' ),239 'format' => '',240 'prev_text' => __('«'),241 'next_text' => __('»'),242 'total' => $num_pages,243 'current' => $pagenum244 ));245 246 $is_trash = isset($_GET['post_status']) && $_GET['post_status'] == 'trash';247 248 if ( $page_links ) : ?>249 <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s',250 number_format_i18n( ( $pagenum - 1 ) * $per_page + 1 ),251 number_format_i18n( min( $pagenum * $per_page, $wp_query->post_count ) ),252 number_format_i18n( $wp_query->post_count ),253 $page_links254 ); echo $page_links_text; ?></div>255 <?php endif; ?>256 257 <div class="alignleft actions">258 <select name="action">259 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>260 <?php if ( $is_trash ) { ?>261 <option value="untrash"><?php _e('Restore'); ?></option>262 <?php } else { ?>263 <option value="edit"><?php _e('Edit'); ?></option>264 <?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?>265 <option value="delete"><?php _e('Delete Permanently'); ?></option>266 <?php } else { ?>267 <option value="trash"><?php _e('Move to Trash'); ?></option>268 <?php } ?>269 </select>270 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />271 <?php wp_nonce_field('bulk-pages'); ?>272 <?php if ( $is_trash ) { ?>273 <input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />274 <?php } ?>275 </div>276 277 <br class="clear" />278 </div>279 280 <div class="clear"></div>281 282 <table class="widefat page fixed" cellspacing="0">283 <thead>284 <tr>285 <?php print_column_headers('edit-pages'); ?>286 </tr>287 </thead>288 289 <tfoot>290 <tr>291 <?php print_column_headers('edit-pages', false); ?>292 </tr>293 </tfoot>294 295 <tbody>296 <?php page_rows($posts, $pagenum, $per_page); ?>297 </tbody>298 </table>299 300 <div class="tablenav">301 <?php302 if ( $page_links )303 echo "<div class='tablenav-pages'>$page_links_text</div>";304 ?>305 306 <div class="alignleft actions">307 <select name="action2">308 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>309 <?php if ( $is_trash ) { ?>310 <option value="untrash"><?php _e('Restore'); ?></option>311 <?php } else { ?>312 <option value="edit"><?php _e('Edit'); ?></option>313 <?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?>314 <option value="delete"><?php _e('Delete Permanently'); ?></option>315 <?php } else { ?>316 <option value="trash"><?php _e('Move to Trash'); ?></option>317 <?php } ?>318 </select>319 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />320 <?php if ( $is_trash ) { ?>321 <input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />322 <?php } ?>323 </div>324 325 <br class="clear" />326 </div>327 328 <?php } else { ?>329 <div class="clear"></div>330 <p><?php _e('No pages found.') ?></p>331 <?php332 } // end if ($posts)333 ?>334 335 </form>336 337 <?php inline_edit_row( 'page' ) ?>338 339 <div id="ajax-response"></div>340 341 342 <?php343 344 if ( 1 == count($posts) && is_singular() ) :345 346 $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );347 if ( $comments ) :348 // Make sure comments, post, and post_author are cached349 update_comment_cache($comments);350 $post = get_post($id);351 $authordata = get_userdata($post->post_author);352 ?>353 354 <br class="clear" />355 356 <table class="widefat" cellspacing="0">357 <thead>358 <tr>359 <th scope="col" class="column-comment">360 <?php /* translators: column name */ echo _x('Comment', 'column name') ?>361 </th>362 <th scope="col" class="column-author"><?php _e('Author') ?></th>363 <th scope="col" class="column-date"><?php _e('Submitted') ?></th>364 </tr>365 </thead>366 <tbody id="the-comment-list" class="list:comment">367 <?php368 foreach ($comments as $comment)369 _wp_comment_row( $comment->comment_ID, 'single', false, false );370 ?>371 </tbody>372 </table>373 374 <?php375 wp_comment_reply();376 endif; // comments377 endif; // posts;378 379 ?>380 381 </div>382 383 <?php384 include('admin-footer.php'); -
wp-admin/themes.php
61 61 $help .= '<p>' . __('Once a theme is uploaded, you should see it on this page.') . '</p>' ; 62 62 } 63 63 64 add_contextual_help( 'themes', $help);64 add_contextual_help($current_screen, $help); 65 65 66 66 add_thickbox(); 67 67 wp_enqueue_script( 'theme-preview' );