Make WordPress Core


Ignore:
Timestamp:
01/08/2015 10:14:58 PM (9 years ago)
Author:
wonderboymusic
Message:

Properly declare $hook_suffix, $plugin_page, $typenow, and $taxnow as globals in wp-admin/admin.php.

Fixes #30958.

File:
1 edited

Legend:

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

    r31090 r31105  
    9191wp_enqueue_script( 'common' );
    9292
     93// $pagenow is set in vars.php
     94// The remaining variables are imported as globals elsewhere,
     95//     declared as globals here
     96global $pagenow, $hook_suffix, $plugin_page, $typenow, $taxnow;
     97
     98$page_hook = '';
     99$hook_suffix = '';
     100$plugin_page = '';
     101$typenow = '';
     102$taxnow = '';
     103
    93104$editing = false;
    94105
    95 if ( isset($_GET['page']) ) {
     106if ( isset( $_GET['page'] ) ) {
    96107    $plugin_page = wp_unslash( $_GET['page'] );
    97     $plugin_page = plugin_basename($plugin_page);
    98 }
    99 
    100 if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) )
     108    $plugin_page = plugin_basename( $plugin_page );
     109}
     110
     111if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) {
    101112    $typenow = $_REQUEST['post_type'];
    102 else
    103     $typenow = '';
    104 
    105 if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) )
     113}
     114
     115if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) {
    106116    $taxnow = $_REQUEST['taxonomy'];
    107 else
    108     $taxnow = '';
     117}
    109118
    110119if ( WP_NETWORK_ADMIN )
     
    145154do_action( 'admin_init' );
    146155
    147 if ( isset($plugin_page) ) {
    148     if ( !empty($typenow) )
     156if ( $plugin_page ) {
     157    if ( $typenow ) {
    149158        $the_parent = $pagenow . '?post_type=' . $typenow;
    150     else
     159    } else {
    151160        $the_parent = $pagenow;
     161    }
    152162    if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) {
    153163        $page_hook = get_plugin_page_hook($plugin_page, $plugin_page);
     
    167177}
    168178
    169 $hook_suffix = '';
    170 if ( isset( $page_hook ) ) {
     179if ( $page_hook ) {
    171180    $hook_suffix = $page_hook;
    172 } elseif ( isset( $plugin_page ) ) {
     181} elseif ( $plugin_page ) {
    173182    $hook_suffix = $plugin_page;
    174 } elseif ( isset( $pagenow ) ) {
     183} elseif ( $pagenow ) {
    175184    $hook_suffix = $pagenow;
    176185}
     
    179188
    180189// Handle plugin admin pages.
    181 if ( isset($plugin_page) ) {
     190if ( $plugin_page ) {
    182191    if ( $page_hook ) {
    183192        /**
Note: See TracChangeset for help on using the changeset viewer.