Make WordPress Core

Changeset 12728


Ignore:
Timestamp:
01/15/2010 04:58:36 PM (15 years ago)
Author:
ryan
Message:

Merge edit-pages.php into edit.php. see #9674

Location:
trunk/wp-admin
Files:
1 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r12597 r12728  
    10041004    check_ajax_referer( 'autosave', 'autosavenonce' );
    10051005    $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 ) )
    10081011        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}" ) ) ) ) );
    10091012    do_action('autosave_generate_nonces');
  • trunk/wp-admin/admin-header.php

    r12702 r12728  
    2929    wp_admin_css( 'css/ms' );
    3030wp_enqueue_script('utils');
    31 
    32 $hook_suffix = '';
    33 if ( isset($page_hook) )
    34     $hook_suffix = $page_hook;
    35 else if ( isset($plugin_page) )
    36     $hook_suffix = $plugin_page;
    37 else if ( isset($pagenow) )
    38     $hook_suffix = $pagenow;
    39 
    40 if ( isset($submenu_file) && (false !== $pos = strpos($submenu_file, 'post_type=')) )
    41     $typenow = substr($submenu_file, $pos + 10);
    42 elseif ( isset($parent_file) && (false !== $pos = strpos($parent_file, 'post_type=')) )
    43     $typenow = substr($parent_file, $pos + 10);
    44 else
    45     $typenow = '';
    4631
    4732$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
     
    120105</div>
    121106
    122 <?php favorite_actions($hook_suffix); ?>
     107<?php favorite_actions($current_screen); ?>
    123108</div>
    124109</div>
    125110
    126111<div id="wpbody">
    127 <?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
     112<?php
     113require(ABSPATH . 'wp-admin/menu-header.php');
     114
     115$current_screen->parent_file = $parent_file;
     116$current_screen->parent_base = preg_replace('/\?.*$/', '', $parent_file);
     117$current_screen->parent_base = str_replace('.php', '', $current_screen->parent_base);
     118?>
    128119
    129120<div id="wpbody-content">
    130121<?php
    131 screen_meta($hook_suffix);
     122screen_meta($current_screen);
    132123
    133124do_action('admin_notices');
  • trunk/wp-admin/admin.php

    r12720 r12728  
    178178    do_action('admin_action_' . $_REQUEST['action']);
    179179
     180$hook_suffix = '';
     181if ( isset($page_hook) )
     182    $hook_suffix = $page_hook;
     183else if ( isset($plugin_page) )
     184    $hook_suffix = $plugin_page;
     185else if ( isset($pagenow) )
     186    $hook_suffix = $pagenow;
     187
     188if ( isset($_GET['post_type']) )
     189    $typenow = $_GET['post_type'];
     190else
     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;
     203if ( '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
    180219?>
  • trunk/wp-admin/edit-form-advanced.php

    r12710 r12728  
    143143do_action('do_meta_boxes', $post_type, 'side', $post);
    144144
     145add_contextual_help($current_screen, drag_drop_help());
     146
    145147require_once('admin-header.php');
    146148?>
  • trunk/wp-admin/edit-link-form.php

    r12546 r12728  
    3434do_action('do_meta_boxes', 'link', 'advanced', $link);
    3535do_action('do_meta_boxes', 'link', 'side', $link);
     36
     37add_contextual_help($current_screen, drag_drop_help());
    3638
    3739require_once ('admin-header.php');
  • trunk/wp-admin/edit-post-rows.php

    r11768 r12728  
    1414    <thead>
    1515    <tr>
    16 <?php print_column_headers('edit'); ?>
     16<?php print_column_headers( $current_screen ); ?>
    1717    </tr>
    1818    </thead>
     
    2020    <tfoot>
    2121    <tr>
    22 <?php print_column_headers('edit', false); ?>
     22<?php print_column_headers($current_screen, false); ?>
    2323    </tr>
    2424    </tfoot>
    2525
    2626    <tbody>
    27 <?php post_rows(); ?>
     27<?php
     28if ( $post_type_object->hierarchical )
     29    page_rows($posts, $pagenum, $per_page);
     30else
     31    post_rows();
     32?>
    2833    </tbody>
    2934</table>
  • trunk/wp-admin/edit.php

    r12719 r12728  
    2121}
    2222
    23 if ( isset($_GET['post_type']) && in_array( $_GET['post_type'], get_post_types( array('_show' => true) ) ) )
     23if ( 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 ) ) ) ) )
    2424    $post_type = $_GET['post_type'];
    2525else
     
    2828
    2929$post_type_object = get_post_type_object($post_type);
     30$post_type_cap = $post_type_object->capability_type;
    3031
    3132if ( 'post' != $post_type ) {
     
    3839    $post_new_file = 'post-new.php';
    3940}
     41
     42$pagenum = isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 0;
     43if ( empty($pagenum) )
     44    $pagenum = 1;
     45$per_page = 'edit_' . $post_type . '_per_page';
     46$per_page = (int) get_user_option( $per_page );
     47if ( 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 );
    4051
    4152// Handle bulk actions
     
    6273            $trashed = 0;
    6374            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 post to 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.') );
    6677
    6778                if ( !wp_trash_post($post_id) )
     
    7586            $untrashed = 0;
    7687            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 post from 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.') );
    7990
    8091                if ( !wp_untrash_post($post_id) )
     
    90101                $post_del = & get_post($post_id);
    91102
    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.') );
    94105
    95106                if ( $post_del->post_type == 'attachment' ) {
     
    131142
    132143$user_posts = false;
    133 if ( !current_user_can('edit_others_posts') ) {
     144if ( !current_user_can('edit_others_' . $post_type_cap . 's') ) {
    134145    $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) );
    135146    $user_posts = true;
     
    140151$avail_post_stati = wp_edit_posts_query();
    141152
     153if ( $post_type_object->hierarchical )
     154    $num_pages = ceil($wp_query->post_count / $per_page);
     155else
     156    $num_pages = $wp_query->max_num_pages;
     157
    142158require_once('admin-header.php');
    143 
    144 if ( !isset( $_GET['paged'] ) )
    145     $_GET['paged'] = 1;
    146159
    147160if ( empty($_GET['mode']) )
     
    159172<?php
    160173if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
    161 <div id="message" class="updated"><p><strong><?php _e('Your post 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>
     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>
    162175<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
    163176endif; ?>
     
    174187
    175188if ( 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'] ) );
    177190    unset($_GET['locked']);
    178191}
    179192
    180193if ( 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'] ) );
    182195    unset($_GET['deleted']);
    183196}
    184197
    185198if ( 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'] ) );
    187200    $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
    188201    echo ' <a href="' . esc_url( wp_nonce_url( "edit.php?doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a><br />';
     
    191204
    192205if ( 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'] ) );
    194207    unset($_GET['undeleted']);
    195208}
     
    213226    if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user->ID ) )
    214227        $class = ' class="current"';
    215     $status_links[] = "<li><a href='edit.php?author=$current_user->ID'$class>" . sprintf( _nx( 'My 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>';
    216229    $allposts = '?all_posts=1';
    217230}
     
    262275    'prev_text' => __('&laquo;'),
    263276    'next_text' => __('&raquo;'),
    264     'total' => $wp_query->max_num_pages,
    265     'current' => $_GET['paged']
     277    'total' => $num_pages,
     278    'current' => $pagenum
    266279));
    267280
     
    319332
    320333<?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');
     334if ( 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}
    325340?>
    326341<input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" />
    327342<?php }
    328343
    329 if ( $is_trash && current_user_can('edit_others_posts') ) { ?>
     344if ( $is_trash && current_user_can('edit_others_' . $post_type_cap .'s') ) { ?>
    330345<input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
    331346<?php } ?>
     
    334349<?php if ( $page_links ) { ?>
    335350<div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%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 ) ),
    338353    number_format_i18n( $wp_query->found_posts ),
    339354    $page_links
     
    374389</select>
    375390<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') ) { ?>
    377392<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
    378393<?php } ?>
     
    394409</form>
    395410
    396 <?php inline_edit_row( 'post' ); ?>
     411<?php inline_edit_row( $current_screen ); ?>
    397412
    398413<div id="ajax-response"></div>
  • trunk/wp-admin/includes/misc.php

    r12726 r12728  
    411411        switch ( $map_option ) {
    412412            case 'edit_per_page':
    413             case 'edit_pages_per_page':
    414413            case 'edit_comments_per_page':
    415414            case 'upload_per_page':
  • trunk/wp-admin/includes/post.php

    r12719 r12728  
    820820    $post_stati  = get_post_stati();
    821821
    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() ) )
    823823        $post_type = $q['post_type'];
    824824    else
    825825        $post_type = 'post';
     826    $post_type_object = get_post_type_object($post_type);
    826827
    827828    $avail_post_stati = get_available_post_statuses($post_type);
     
    843844    }
    844845
    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 );
    850848    if ( empty( $posts_per_page ) || $posts_per_page < 1 )
    851849        $posts_per_page = 15;
    852     $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page );
    853 
    854     wp( compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page') );
     850    $posts_per_page = apply_filters( $per_page, $posts_per_page );
     851
     852
     853    $query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page');
     854
     855    // Hierarchical types require special args.
     856    if ( $post_type_object->hierarchical ) {
     857        $query['orderby'] = 'menu_order title';
     858        $query['order'] = 'asc';
     859        $query['posts_per_page'] = -1;
     860        $query['posts_per_archive_page'] = -1;
     861    }
     862
     863    wp( $query );
    855864
    856865    return $avail_post_stati;
  • trunk/wp-admin/includes/template.php

    r12726 r12728  
    749749 * @return unknown
    750750 */
    751 function wp_manage_posts_columns() {
    752     global $typenow;
     751function wp_manage_posts_columns( $screen = '') {
     752    if ( empty($screen) )
     753        $post_type = 'post';
     754    else
     755        $post_type = $screen->post_type;
    753756
    754757    $posts_columns = array();
    755758    $posts_columns['cb'] = '<input type="checkbox" />';
    756759    /* translators: manage posts column name */
    757     $posts_columns['title'] = _x('Post', 'column name');
     760    $posts_columns['title'] = _x('Title', 'column name');
    758761    $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') )
    760763        $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') )
    762765        $posts_columns['tags'] = __('Tags');
    763766    $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') ) )
    765768        $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
    766769    $posts_columns['date'] = __('Date');
     770    // @todo filter per type
    767771    $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
    768772
     
    805809 */
    806810function 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
    826820 * @return unknown
    827821 */
    828 function get_column_headers($page) {
     822function get_column_headers($screen) {
    829823    global $_wp_column_headers;
    830824
     
    832826        $_wp_column_headers = array();
    833827
    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);
    838830
    839831    // 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) {
    844836        case 'edit':
    845              $_wp_column_headers[$page] = wp_manage_posts_columns();
     837             $_wp_column_headers[$screen->id] = wp_manage_posts_columns( $screen );
    846838             break;
    847         case 'edit-pages':
    848             $_wp_column_headers[$page] = wp_manage_pages_columns();
    849             break;
    850839        case 'edit-comments':
    851             $_wp_column_headers[$page] = array(
     840            $_wp_column_headers[$screen->id] = array(
    852841                'cb' => '<input type="checkbox" />',
    853842                'author' => __('Author'),
     
    860849            break;
    861850        case 'link-manager':
    862             $_wp_column_headers[$page] = array(
     851            $_wp_column_headers[$screen->id] = array(
    863852                'cb' => '<input type="checkbox" />',
    864853                'name' => __('Name'),
     
    872861            break;
    873862        case 'upload':
    874             $_wp_column_headers[$page] = wp_manage_media_columns();
     863            $_wp_column_headers[$screen->id] = wp_manage_media_columns();
    875864            break;
    876865        case 'categories':
    877             $_wp_column_headers[$page] = array(
     866            $_wp_column_headers[$screen->id] = array(
    878867                'cb' => '<input type="checkbox" />',
    879868                'name' => __('Name'),
     
    885874            break;
    886875        case 'edit-link-categories':
    887             $_wp_column_headers[$page] = array(
     876            $_wp_column_headers[$screen->id] = array(
    888877                'cb' => '<input type="checkbox" />',
    889878                'name' => __('Name'),
     
    895884            break;
    896885        case 'edit-tags':
    897             $_wp_column_headers[$page] = array(
     886            $_wp_column_headers[$screen->id] = array(
    898887                'cb' => '<input type="checkbox" />',
    899888                'name' => __('Name'),
     
    905894            break;
    906895        case 'users':
    907             $_wp_column_headers[$page] = array(
     896            $_wp_column_headers[$screen->id] = array(
    908897                'cb' => '<input type="checkbox" />',
    909898                'username' => __('Username'),
     
    915904            break;
    916905        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 $type
     906            $_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
    930919 * @param unknown_type $id
    931920 */
    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);
     921function 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);
    936927    $styles = array();
    937928
     
    952943            $style = 'display:none;';
    953944
    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];
    956947        $style = ' style="' . $style . '"';
    957948?>
     
    972963    global $_wp_column_headers;
    973964
     965    if ( is_string($screen) )
     966        $screen = convert_to_screen($screen);
     967
    974968    if ( !isset($_wp_column_headers) )
    975969        $_wp_column_headers = array();
    976970
    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 */
     981function 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' );
    990986}
    991987
     
    999995 * @param string $type 'post' or 'page'
    1000996 */
    1001 function inline_edit_row( $type ) {
     997function inline_edit_row( $screen ) {
    1002998    global $current_user, $mode;
    1003999
    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);
    10141009    $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) );
    10151010    $col_count = count($columns) - count($hidden);
    10161011    $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");
    10181014    $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
    10191015
     
    10251021    while ( $bulk < 2 ) { ?>
    10261022
    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";
    10291025    ?>" style="display: none"><td colspan="<?php echo $col_count; ?>">
    10301026
    10311027    <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>
    10331029
    10341030
     
    10631059<?php endif; // $bulk
    10641060
    1065         $authors = get_editable_user_ids( $current_user->id, true, $type ); // TODO: ROLE SYSTEM
     1061        $authors = get_editable_user_ids( $current_user->id, true, $screen->post_type ); // TODO: ROLE SYSTEM
    10661062        $authors_dropdown = '';
    10671063        if ( $authors && count( $authors ) > 1 ) :
     
    10931089            <label class="alignleft inline-edit-private">
    10941090                <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>
    10961092            </label>
    10971093        </div>
     
    11011097    </div></fieldset>
    11021098
    1103 <?php if ( !$is_page && !$bulk ) : ?>
     1099<?php if ( is_object_in_taxonomy($screen->post_type, 'categories') && !$bulk ) : ?>
    11041100
    11051101    <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
     
    11131109    </div></fieldset>
    11141110
    1115 <?php endif; // !$is_page && !$bulk ?>
     1111<?php endif; // !hierarchical && !$bulk ?>
    11161112
    11171113    <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
     
    11221118?>
    11231119
    1124 <?php if ( $is_page ) : ?>
     1120<?php if ( $post_type_object->hierarchical ) : ?>
    11251121
    11261122        <label>
     
    12221218            </label>
    12231219
    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' ) ) : ?>
    12251221
    12261222<?php   if ( $bulk ) : ?>
     
    12611257        <?php if ( ! $bulk ) {
    12621258            wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
    1263             $update_text = ( $is_page ) ? __( 'Update Page' ) : __( 'Update Post' );
     1259            $update_text = __( 'Update' );
    12641260            ?>
    12651261            <a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a>
    12661262            <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" />
    12671263        <?php } else {
    1268             $update_text = ( $is_page ) ? __( 'Update Pages' ) : __( 'Update Posts' );
     1264            $update_text = __( 'Update' );
    12691265        ?>
    12701266            <input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo esc_attr( $update_text ); ?>" />
     
    13701366 */
    13711367function _post_row($a_post, $pending_comments, $mode) {
    1372     global $post, $current_user;
     1368    global $post, $current_user, $current_screen;
    13731369    static $rowclass;
    13741370
     
    13841380    <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top">
    13851381<?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 );
    13881384    foreach ( $posts_columns as $column_name=>$column_display_name ) {
    13891385        $class = "class=\"$column_name column-$column_name\"";
     
    15801576 */
    15811577function display_page_row( $page, $level = 0 ) {
    1582     global $post;
     1578    global $post, $current_screen;
    15831579    static $rowclass;
    15841580
     
    16071603    $id = (int) $page->ID;
    16081604    $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 );
    16111607    $title = _draft_or_post_title();
    16121608?>
     
    30573053 * @since unknown
    30583054 *
    3059  * @param unknown_type $page
    3060  */
    3061 function meta_box_prefs($page) {
     3055 * @param unknown_type $screen
     3056 */
     3057function meta_box_prefs($screen) {
    30623058    global $wp_meta_boxes;
    30633059
    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]) )
    30653064        return;
    30663065
    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 ) {
    30723071                if ( false == $box || ! $box['title'] )
    30733072                    continue;
     
    30843083}
    30853084
    3086 function get_hidden_meta_boxes($page) {
    3087     $hidden = (array) get_user_option( "meta-box-hidden_$page" );
     3085function 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" );
    30883090
    30893091    // Hide slug boxes by default
     
    32803282 */
    32813283function 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':
    32843289            $default_action = array('edit.php' => array(__('Edit Posts'), 'edit_posts'));
    32853290            break;
    3286         case 'edit-pages.php':
    3287             $default_action = array('page-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'));
    32883293            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'));
    32913296            break;
    32923297        case 'upload.php':
    32933298            $default_action = array('media-new.php' => array(__('New Media'), 'upload_files'));
    32943299            break;
    3295         case 'media-new.php':
     3300        case 'media':
    32963301            $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files'));
    32973302            break;
    3298         case 'link-manager.php':
     3303        case 'link-manager':
    32993304            $default_action = array('link-add.php' => array(__('New Link'), 'manage_links'));
    33003305            break;
    3301         case 'link-add.php':
     3306        case 'link-add':
    33023307            $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links'));
    33033308            break;
    3304         case 'users.php':
     3309        case 'users':
    33053310            $default_action = array('user-new.php' => array(__('New User'), 'create_users'));
    33063311            break;
    3307         case 'user-new.php':
     3312        case 'user':
    33083313            $default_action = array('users.php' => array(__('Edit Users'), 'edit_users'));
    33093314            break;
    3310         case 'plugins.php':
     3315        case 'plugins':
    33113316            $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins'));
    33123317            break;
    3313         case 'plugin-install.php':
     3318        case 'plugin-install':
    33143319            $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins'));
    33153320            break;
    3316         case 'themes.php':
     3321        case 'themes':
    33173322            $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes'));
    33183323            break;
    3319         case 'theme-install.php':
     3324        case 'theme-install':
    33203325            $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes'));
    33213326            break;
     
    34853490}
    34863491
    3487 function screen_meta($screen) {
    3488     global $wp_meta_boxes, $_wp_contextual_help, $typenow;
    3489 
     3492// Convert a screen string to a screen object
     3493function convert_to_screen( $screen ) {
    34903494    $screen = str_replace('.php', '', $screen);
    34913495    $screen = str_replace('-new', '', $screen);
     
    34933497    $screen = apply_filters('screen_meta_screen', $screen);
    34943498
     3499    $screen = array('id' => $screen, 'base' => $screen);
     3500    return (object) $screen;
     3501}
     3502
     3503function 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
    34953509    $column_screens = get_column_headers($screen);
    34963510    $meta_screens = array('index' => 'dashboard');
    34973511
    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
    35103517    $show_screen = false;
    35113518    $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) ) {
    35133520        $show_screen = true;
    35143521        $show_on_screen = true;
     
    35243531    $settings = '';
    35253532
    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 ) {
    35643534        case 'widgets':
    3565             if ( !isset($_wp_contextual_help['widgets']) ) {
    3566                 $help = widgets_help();
    3567                 $_wp_contextual_help['widgets'] = $help;
    3568             }
    35693535            $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";
    35703536            $show_screen = true;
     
    36063572    <?php
    36073573    $contextual_help = '';
    3608     if ( isset($_wp_contextual_help[$screen]) ) {
     3574    if ( isset($_wp_contextual_help[$screen->id]) ) {
    36093575        if ( !empty($title) )
    36103576            $contextual_help .= '<h5>' . sprintf(__('Get help with &#8220;%s&#8221;'), $title) . '</h5>';
    36113577        else
    36123578            $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";
    36143580
    36153581        $contextual_help .= '<h5>' . __('Other Help') . '</h5>';
     
    36533619    global $_wp_contextual_help;
    36543620
     3621    if ( is_string($screen) )
     3622        $screen = convert_to_screen($screen);
     3623
    36553624    if ( !isset($_wp_contextual_help) )
    36563625        $_wp_contextual_help = array();
    36573626
    3658     $_wp_contextual_help[$screen] = $help;
     3627    $_wp_contextual_help[$screen->id] = $help;
    36593628}
    36603629
     
    36763645}
    36773646
    3678 function widgets_help() {
    3679     return '
    3680     <p>' . __('Widgets are added and arranged by simple drag &#8217;n&#8217; drop. If you hover your mouse over the titlebar of a widget, you&#8217;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&#8217;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 
    36873647function screen_layout($screen) {
    36883648    global $screen_layout_columns;
     3649
     3650    if ( is_string($screen) )
     3651        $screen = convert_to_screen($screen);
    36893652
    36903653    $columns = array('dashboard' => 4, 'post' => 2, 'page' => 2, 'link' => 2);
     
    36943657        $columns[$post_type] = 2;
    36953658
    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]) ) {
    36993662        $screen_layout_columns = 0;
    37003663        return '';
    37013664    }
    37023665
    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];
    37053668
    37063669    if ( ! $screen_layout_columns )
     
    37183681
    37193682function 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 ) {
    37263687        case 'edit':
    37273688            $per_page_label = __('Posts per page:');
     
    37493710    }
    37503711
    3751     $option = str_replace( '-', '_', "${screen}_per_page" );
     3712    $option = str_replace( '-', '_', "{$screen->id}_per_page" );
    37523713    $per_page = (int) get_user_option( $option );
    37533714    if ( empty( $per_page ) || $per_page < 1 ) {
    3754         if ( 'plugins' == $screen )
     3715        if ( 'plugins' == $screen->id )
    37553716            $per_page = 999;
    37563717        else
     
    37743735}
    37753736
    3776 function screen_icon($name = '') {
    3777     global $parent_file, $hook_suffix;
     3737function screen_icon($screen = '') {
     3738    global $current_screen;
     3739
     3740    if ( empty($screen) )
     3741        $screen = $current_screen;
     3742    elseif ( is_string($screen) )
     3743        $name = $screen;
    37783744
    37793745    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;
    37863748        else
    3787             $name = str_replace(array('.php', '-new', '-add'), '', $hook_suffix);
     3749            $name = $screen->base;
    37883750    }
    37893751?>
  • trunk/wp-admin/index.php

    r11380 r12728  
    2424$title = __('Dashboard');
    2525$parent_file = 'index.php';
     26
     27add_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
    2629require_once('admin-header.php');
    2730
  • trunk/wp-admin/menu.php

    r12702 r12728  
    6969    $submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-link-categories.php' );
    7070
    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' );
    7373    /* 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' );
    7575
    7676$menu[25] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top', 'menu-comments', 'div' );
  • trunk/wp-admin/options-general.php

    r12712 r12728  
    5050}
    5151add_filter('admin_head', 'add_js');
     52
     53add_contextual_help($current_screen, __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>'));
    5254
    5355include('./admin-header.php');
  • trunk/wp-admin/plugin-install.php

    r12103 r12728  
    5353do_action('install_plugins_pre_' . $tab); //Used to override the general interface, Eg, install or plugin information.
    5454
     55add_contextual_help($current_screen, plugins_search_help());
     56
    5557include('admin-header.php');
    5658?>
  • trunk/wp-admin/plugins.php

    r12722 r12728  
    237237}
    238238
    239 add_contextual_help('plugins', $help);
     239add_contextual_help($current_screen, $help);
    240240
    241241if ( is_multisite() && is_super_admin() ) {
  • trunk/wp-admin/post-new.php

    r12702 r12728  
    1818    $parent_file = "edit.php?post_type=$post_type";
    1919    $submenu_file = "post-new.php?post_type=$post_type";
    20     if ( 'page' == $post_type )
    21         $parent_file = 'edit-pages.php';
    2220} else {
    2321    $parent_file = 'edit.php';
  • trunk/wp-admin/post.php

    r12708 r12728  
    2424    $post_id = 0;
    2525$post_ID = $post_id;
    26 
    2726$post = null;
    2827$post_type_object = null;
    2928$post_type_cap = null;
     29$post_type = null;
    3030if ( $post_id ) {
    3131    $post = get_post($post_id);
    3232    if ( $post ) {
    3333        $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;
    3538            $post_type_cap = $post_type_object->capability_type;
     39        }
     40    }
     41} elseif ( isset($_POST['post_type']) ) {
     42    $post_type_object = get_post_type_object($_POST['post_type']);
     43    if ( $post_type_object ) {
     44        $post_type = $post_type_object->name;
     45        $current_screen->post_type = $post_type;
     46        $current_screen->id = $current_screen->post_type;
     47        $post_type_cap = $post_type_object->capability_type;
    3648    }
    3749}
     
    109121case 'post-quickpress-publish':
    110122case 'post-quickpress-save':
    111     check_admin_referer('add-post');
     123    check_admin_referer('add-' . $post_type);
    112124
    113125    if ( 'post-quickpress-publish' == $action )
     
    164176        $parent_file = "edit.php";
    165177        $submenu_file = "edit.php";
    166     } elseif ( 'page' == $post_type ) {
    167         $parent_file = "edit-pages.php";
    168         $submenu_file = "edit-pages.php";
    169     } else {
    170         if ( $post_type_object->hierarchical ) {
    171             $parent_file = "edit-pages.php?post_type=$post_type";
    172             $submenu_file = "edit-pages.php?post_type=$post_type";
    173         } else {
    174             $parent_file = "edit.php?post_type=$post_type";
    175             $submenu_file = "edit.php?post_type=$post_type";
    176         }
     178    } else {
     179        $parent_file = "edit.php?post_type=$post_type";
     180        $submenu_file = "edit.php?post_type=$post_type";
    177181    }
    178182
     
    214218
    215219case 'editpost':
    216     check_admin_referer('update-' . $post->post_type . '_' . $post_id);
     220    check_admin_referer('update-' . $post_type . '_' . $post_id);
    217221
    218222    $post_id = edit_post();
     
    224228
    225229case 'trash':
    226     check_admin_referer('trash-post_' . $post_id);
     230    check_admin_referer('trash-' . $post_type . '_' . $post_id);
    227231
    228232    $post = & get_post($post_id);
     
    239243
    240244case 'untrash':
    241     check_admin_referer('untrash-post_' . $post_id);
     245    check_admin_referer('untrash-' . $post_type . '_' . $post_id);
    242246
    243247    if ( !current_user_can('delete_' . $post_type_cap, $post_id) )
     
    252256
    253257case 'delete':
    254     check_admin_referer('delete-post_' . $post_id);
     258    check_admin_referer('delete-' . $post_type . '_' . $post_id);
    255259
    256260    if ( !current_user_can('delete_' . $post_type_cap, $post_id) )
     
    281285
    282286default:
    283     if ( $post_type_object->hierarchical )
    284         wp_redirect('edit-pages.php');
    285     else
    286287        wp_redirect('edit.php');
    287288    exit();
  • trunk/wp-admin/theme-install.php

    r12103 r12728  
    5353do_action('install_themes_pre_' . $tab); //Used to override the general interface, Eg, install or theme information.
    5454
     55add_contextual_help($current_screen, plugins_search_help());
     56
    5557include('admin-header.php');
    5658?>
  • trunk/wp-admin/themes.php

    r12724 r12728  
    6262}
    6363
    64 add_contextual_help('themes', $help);
     64add_contextual_help($current_screen, $help);
    6565
    6666add_thickbox();
  • trunk/wp-admin/widgets.php

    r12546 r12728  
    3333$title = __( 'Widgets' );
    3434$parent_file = 'themes.php';
     35
     36$help = '
     37    <p>' . __('Widgets are added and arranged by simple drag &#8217;n&#8217; drop. If you hover your mouse over the titlebar of a widget, you&#8217;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&#8217;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';
     42add_contextual_help($current_screen, $help);
    3543
    3644// register the inactive_widgets area as sidebar
Note: See TracChangeset for help on using the changeset viewer.