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