Make WordPress Core


Ignore:
Timestamp:
01/08/2015 10:51:30 PM (11 years ago)
Author:
wonderboymusic
Message:

After [31105], don't ditch the isset() calls for BC. Declare $page_hook as null so it is initialized for all execution paths but will still fail isset() checks.

Fixes #30958.

File:
1 edited

Legend:

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

    r31105 r31106  
    9696global $pagenow, $hook_suffix, $plugin_page, $typenow, $taxnow;
    9797
    98 $page_hook = '';
    99 $hook_suffix = '';
    100 $plugin_page = '';
    101 $typenow = '';
    102 $taxnow = '';
     98$page_hook = null;
    10399
    104100$editing = false;
    105101
    106 if ( isset( $_GET['page'] ) ) {
     102if ( isset($_GET['page']) ) {
    107103    $plugin_page = wp_unslash( $_GET['page'] );
    108     $plugin_page = plugin_basename( $plugin_page );
    109 }
    110 
    111 if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) {
     104    $plugin_page = plugin_basename($plugin_page);
     105}
     106
     107if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) )
    112108    $typenow = $_REQUEST['post_type'];
    113 }
    114 
    115 if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) {
     109else
     110    $typenow = '';
     111
     112if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) )
    116113    $taxnow = $_REQUEST['taxonomy'];
    117 }
     114else
     115    $taxnow = '';
    118116
    119117if ( WP_NETWORK_ADMIN )
     
    154152do_action( 'admin_init' );
    155153
    156 if ( $plugin_page ) {
    157     if ( $typenow ) {
     154if ( isset($plugin_page) ) {
     155    if ( !empty($typenow) )
    158156        $the_parent = $pagenow . '?post_type=' . $typenow;
    159     } else {
     157    else
    160158        $the_parent = $pagenow;
    161     }
    162159    if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) {
    163160        $page_hook = get_plugin_page_hook($plugin_page, $plugin_page);
     
    177174}
    178175
    179 if ( $page_hook ) {
     176$hook_suffix = '';
     177if ( isset( $page_hook ) ) {
    180178    $hook_suffix = $page_hook;
    181 } elseif ( $plugin_page ) {
     179} elseif ( isset( $plugin_page ) ) {
    182180    $hook_suffix = $plugin_page;
    183 } elseif ( $pagenow ) {
     181} elseif ( isset( $pagenow ) ) {
    184182    $hook_suffix = $pagenow;
    185183}
     
    188186
    189187// Handle plugin admin pages.
    190 if ( $plugin_page ) {
     188if ( isset($plugin_page) ) {
    191189    if ( $page_hook ) {
    192190        /**
Note: See TracChangeset for help on using the changeset viewer.