mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-03 20:24:26 +00:00
Properly declare $hook_suffix, $plugin_page, $typenow, and $taxnow as globals in wp-admin/admin.php.
Fixes #30958. git-svn-id: https://develop.svn.wordpress.org/trunk@31105 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -90,22 +90,31 @@ $time_format = get_option('time_format');
|
||||
|
||||
wp_enqueue_script( 'common' );
|
||||
|
||||
// $pagenow is set in vars.php
|
||||
// The remaining variables are imported as globals elsewhere,
|
||||
// declared as globals here
|
||||
global $pagenow, $hook_suffix, $plugin_page, $typenow, $taxnow;
|
||||
|
||||
$page_hook = '';
|
||||
$hook_suffix = '';
|
||||
$plugin_page = '';
|
||||
$typenow = '';
|
||||
$taxnow = '';
|
||||
|
||||
$editing = false;
|
||||
|
||||
if ( isset($_GET['page']) ) {
|
||||
if ( isset( $_GET['page'] ) ) {
|
||||
$plugin_page = wp_unslash( $_GET['page'] );
|
||||
$plugin_page = plugin_basename($plugin_page);
|
||||
$plugin_page = plugin_basename( $plugin_page );
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) )
|
||||
if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) {
|
||||
$typenow = $_REQUEST['post_type'];
|
||||
else
|
||||
$typenow = '';
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) )
|
||||
if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) {
|
||||
$taxnow = $_REQUEST['taxonomy'];
|
||||
else
|
||||
$taxnow = '';
|
||||
}
|
||||
|
||||
if ( WP_NETWORK_ADMIN )
|
||||
require(ABSPATH . 'wp-admin/network/menu.php');
|
||||
@@ -144,11 +153,12 @@ if ( current_user_can( 'manage_options' ) ) {
|
||||
*/
|
||||
do_action( 'admin_init' );
|
||||
|
||||
if ( isset($plugin_page) ) {
|
||||
if ( !empty($typenow) )
|
||||
if ( $plugin_page ) {
|
||||
if ( $typenow ) {
|
||||
$the_parent = $pagenow . '?post_type=' . $typenow;
|
||||
else
|
||||
} else {
|
||||
$the_parent = $pagenow;
|
||||
}
|
||||
if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) {
|
||||
$page_hook = get_plugin_page_hook($plugin_page, $plugin_page);
|
||||
|
||||
@@ -166,19 +176,18 @@ if ( isset($plugin_page) ) {
|
||||
unset($the_parent);
|
||||
}
|
||||
|
||||
$hook_suffix = '';
|
||||
if ( isset( $page_hook ) ) {
|
||||
if ( $page_hook ) {
|
||||
$hook_suffix = $page_hook;
|
||||
} elseif ( isset( $plugin_page ) ) {
|
||||
} elseif ( $plugin_page ) {
|
||||
$hook_suffix = $plugin_page;
|
||||
} elseif ( isset( $pagenow ) ) {
|
||||
} elseif ( $pagenow ) {
|
||||
$hook_suffix = $pagenow;
|
||||
}
|
||||
|
||||
set_current_screen();
|
||||
|
||||
// Handle plugin admin pages.
|
||||
if ( isset($plugin_page) ) {
|
||||
if ( $plugin_page ) {
|
||||
if ( $page_hook ) {
|
||||
/**
|
||||
* Fires before a particular screen is loaded.
|
||||
|
||||
Reference in New Issue
Block a user