From 84867b3e9c80883b58bcb0268a7b59dc23fdbc29 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 10 Jan 2015 05:29:22 +0000 Subject: [PATCH] Admin globals: * Declare `$wp_importers` as a global in `admin.php` * Declare `$post_type`, `$post_type_object`, and `$post` as globals where applicable See #30799. Built from https://develop.svn.wordpress.org/trunk@31121 git-svn-id: http://core.svn.wordpress.org/trunk@31102 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin.php | 4 +++- wp-admin/edit-form-advanced.php | 2 ++ wp-admin/edit-tags.php | 3 +++ wp-admin/edit.php | 2 ++ wp-admin/post-new.php | 14 ++++++++------ wp-admin/post.php | 2 +- wp-includes/version.php | 2 +- 7 files changed, 20 insertions(+), 9 deletions(-) diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 7941d26a35..dc2713ff7d 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -91,9 +91,11 @@ $time_format = get_option('time_format'); wp_enqueue_script( 'common' ); // $pagenow is set in vars.php +// $wp_importers is sometimes set in wp-admin/includes/import.php +// // The remaining variables are imported as globals elsewhere, // declared as globals here -global $pagenow, $hook_suffix, $plugin_page, $typenow, $taxnow; +global $pagenow, $wp_importers, $hook_suffix, $plugin_page, $typenow, $taxnow; $page_hook = null; diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index a9222ce6fc..54695159de 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -10,6 +10,8 @@ if ( !defined('ABSPATH') ) die('-1'); +global $post_type, $post_type_object, $post; + wp_enqueue_script('post'); $_wp_editor_expand = $_content_editor_dfw = false; diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index aebb08ec96..74bb52bacd 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -20,6 +20,9 @@ if ( ! $tax ) if ( ! current_user_can( $tax->cap->manage_terms ) ) wp_die( __( 'Cheatin’ uh?' ), 403 ); +// $post_type is set when the WP_Terms_List_Table instance is created +global $post_type; + $wp_list_table = _get_list_table('WP_Terms_List_Table'); $pagenum = $wp_list_table->get_pagenum(); diff --git a/wp-admin/edit.php b/wp-admin/edit.php index b5c4cde6ff..5798c98d4a 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -18,6 +18,8 @@ if ( 'attachment' === $typenow ) { } } +global $post_type, $post_type_object; + $post_type = $typenow; $post_type_object = get_post_type_object( $post_type ); diff --git a/wp-admin/post-new.php b/wp-admin/post-new.php index d919d55ca1..0a1181587d 100644 --- a/wp-admin/post-new.php +++ b/wp-admin/post-new.php @@ -9,13 +9,15 @@ /** Load WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); -if ( !isset($_GET['post_type']) ) - $post_type = 'post'; -elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) ) - $post_type = $_GET['post_type']; -else - wp_die( __('Invalid post type') ); +global $post_type, $post_type_object, $post; +if ( ! isset( $_GET['post_type'] ) ) { + $post_type = 'post'; +} elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) ) { + $post_type = $_GET['post_type']; +} else { + wp_die( __('Invalid post type') ); +} $post_type_object = get_post_type_object( $post_type ); if ( 'post' == $post_type ) { diff --git a/wp-admin/post.php b/wp-admin/post.php index 805c46e6ed..01d703dd2d 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -23,7 +23,7 @@ elseif ( isset( $_POST['post_ID'] ) ) else $post_id = $post_ID = 0; -$post = $post_type = $post_type_object = null; +global $post_type, $post_type_object, $post; if ( $post_id ) $post = get_post( $post_id ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 32ce69676e..9dd924d616 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31120'; +$wp_version = '4.2-alpha-31121'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.