+if ( WP_NETWORK_ADMIN )
+ require(ABSPATH . 'wp-admin/network/menu.php');
+elseif ( WP_USER_ADMIN )
+ require(ABSPATH . 'wp-admin/user/menu.php');
+else
+ require(ABSPATH . 'wp-admin/menu.php');
+
+if ( current_user_can( 'manage_options' ) )
+ @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
+
+do_action('admin_init');
+
+if ( isset($plugin_page) ) {
+ if ( !empty($typenow) )
+ $the_parent = $pagenow . '?post_type=' . $typenow;
+ 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);
+ // backwards compatibility for plugins using add_management_page
+ if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) {
+ // There could be plugin specific params on the URL, so we need the whole query string
+ if ( !empty($_SERVER[ 'QUERY_STRING' ]) )
+ $query_string = $_SERVER[ 'QUERY_STRING' ];
+ else
+ $query_string = 'page=' . $plugin_page;
+ wp_redirect( admin_url('tools.php?' . $query_string) );
+ exit;
+ }
+ }
+ unset($the_parent);
+}
+
+$hook_suffix = '';
+if ( isset($page_hook) )
+ $hook_suffix = $page_hook;
+else if ( isset($plugin_page) )
+ $hook_suffix = $plugin_page;
+else if ( isset($pagenow) )
+ $hook_suffix = $pagenow;
+
+set_current_screen();