Make WordPress Core


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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?>
Note: See TracChangeset for help on using the changeset viewer.