<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[19052] trunk/wp-admin: Move WP_Screen to a full registry.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/19052">19052</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2011-10-24 18:34:08 +0000 (Mon, 24 Oct 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move WP_Screen to a full registry. Have convert_to_screen() return a WP_Screen object. Improve and verify values for post_type and taxonomy. see <a href="http://core.trac.wordpress.org/ticket/18785">#18785</a>. also fixes <a href="http://core.trac.wordpress.org/ticket/14886">#14886</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesscreenphp">trunk/wp-admin/includes/screen.php</a></li>
<li><a href="#trunkwpadminpostphp">trunk/wp-admin/post.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesscreenphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/screen.php (19051 => 19052)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/screen.php        2011-10-24 06:40:15 UTC (rev 19051)
+++ trunk/wp-admin/includes/screen.php        2011-10-24 18:34:08 UTC (rev 19052)
</span><span class="lines">@@ -113,19 +113,10 @@
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  *
</span><span class="cx">  * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen.
</span><del>- * @return object An object containing the safe screen name and id
</del><ins>+ * @return WP_Screen Screen object.
</ins><span class="cx">  */
</span><del>-function convert_to_screen( $hook_suffix ) {
-        $screen = str_replace( array('.php', '-new', '-add', '-network', '-user' ), '', $hook_suffix);
-
-        if ( is_network_admin() )
-                $screen .= '-network';
-        elseif ( is_user_admin() )
-                $screen .= '-user';
-
-        $screen = (string) apply_filters( 'screen_meta_screen', $screen );
-        $screen = (object) array( 'id' =&gt; $screen, 'base' =&gt; $screen );
-        return $screen;
</del><ins>+function convert_to_screen( $hook_name ) {
+        return WP_Screen::get( $hook_name );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -201,10 +192,10 @@
</span><span class="cx">                 else
</span><span class="cx">                         $icon_id = $screen-&gt;base;
</span><span class="cx"> 
</span><del>-                if ( ! empty( $screen-&gt;post_type ) &amp;&amp; 'page' == $screen-&gt;post_type )
</del><ins>+                if ( 'page' == $screen-&gt;post_type )
</ins><span class="cx">                         $icon_id = 'edit-pages';
</span><span class="cx"> 
</span><del>-                if ( ! empty( $screen-&gt;post_type ) )
</del><ins>+                if ( $screen-&gt;post_type )
</ins><span class="cx">                         $class .= ' ' . sanitize_html_class( 'icon32-posts-' . $screen-&gt;post_type );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -233,14 +224,11 @@
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  * @uses $current_screen
</span><span class="cx">  *
</span><del>- * @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen.
</del><ins>+ * @param mixed $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen,
+ *        or an existing screen object.
</ins><span class="cx">  */
</span><span class="cx"> function set_current_screen( $hook_name =  '' ) {
</span><del>-        global $current_screen;
-
-        $current_screen = new WP_Screen( $hook_name );
-
-        $current_screen = apply_filters('current_screen', $current_screen);
</del><ins>+        WP_Screen::get( $hook_name )-&gt;set_current_screen();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -320,6 +308,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * The post type associated with the screen, if any.
</span><span class="cx">          * The 'edit.php?post_type=page' screen has a post type of 'page'.
</span><ins>+         * The 'edit-tags.php?taxonomy=$taxonomy&amp;post_type=page' screen has a post type of 'page'.
</ins><span class="cx">          *
</span><span class="cx">          * @since 3.3.0
</span><span class="cx">          * @var string
</span><span class="lines">@@ -343,16 +332,16 @@
</span><span class="cx">           * @var array
</span><span class="cx">           * @access private
</span><span class="cx">           */
</span><del>-        private static $_help_tabs = array();
</del><ins>+        private $_help_tabs = array();
</ins><span class="cx">  
</span><span class="cx">          /**
</span><del>-         * The help sidebar data associated with screens, if any.
</del><ins>+         * The help sidebar data associated with screen, if any.
</ins><span class="cx">          *
</span><span class="cx">          * @since 3.3.0
</span><span class="cx">          * @var string
</span><span class="cx">          * @access private
</span><span class="cx">           */
</span><del>-        private static $_help_sidebar = array();
</del><ins>+        private $_help_sidebar = '';
</ins><span class="cx"> 
</span><span class="cx">         /**
</span><span class="cx">          * Stores old string-based help.
</span><span class="lines">@@ -360,15 +349,24 @@
</span><span class="cx">         private static $_old_compat_help = array();
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * The screen options associated with screens, if any.
</del><ins>+         * The screen options associated with screen, if any.
</ins><span class="cx">          *
</span><span class="cx">          * @since 3.3.0
</span><span class="cx">          * @var array
</span><span class="cx">          * @access private
</span><span class="cx">          */
</span><del>-        private static $_options = array();
</del><ins>+        private $_options = array();
</ins><span class="cx"> 
</span><span class="cx">         /**
</span><ins>+         * The screen object registry.
+         *
+         * @since 3.3.0
+         * @var array
+         * @access private
+         */
+        private static $_registry = array();
+
+        /**
</ins><span class="cx">          * Stores the result of the public show_screen_options function.
</span><span class="cx">          *
</span><span class="cx">          * @since 3.3.0
</span><span class="lines">@@ -386,84 +384,155 @@
</span><span class="cx">          */
</span><span class="cx">         private $_screen_settings;
</span><span class="cx"> 
</span><del>-        /**
-         * Constructor
-         *
-         * @since 3.3.0
-         *
-         * @param string $id A screen id.  If empty, the $hook_suffix global is used to derive the ID.
-         */
-        public function __construct( $id = '' ) {
-                global $hook_suffix, $typenow, $taxnow;
</del><ins>+         /**
+         * Fetches a screen object.
+          *
+          * @since 3.3.0
+         * @access public
+          *
+         * @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen.
+         *         Defaults to the current $hook_suffix global.
+         * @return WP_Screen Screen object.
+          */
+        public function get( $hook_name = '' ) {

+                if ( is_a( $hook_name, 'WP_Screen' ) )
+                        return $hook_name;

+                $action = $post_type = $taxonomy = '';
</ins><span class="cx"> 
</span><del>-                $action = '';
</del><ins>+                if ( $hook_name ) {
+                        if ( '-network' == substr( $hook_name, -8 ) )
+                                $hook_name = str_replace( '-network', '', $hook_name );
+                        elseif ( '-user' == substr( $hook_name, -5 ) )
+                                $hook_name = str_replace( '-user', '', $hook_name );
+                        $id = sanitize_key( $hook_name );
+                        if ( false !== strpos( $id, '-' ) ) {
+                                list( $id, $second ) = explode( '-', $id, 2 );
+                                if ( taxonomy_exists( $second ) ) {
+                                         $id = 'edit-tags';
+                                        $taxonomy = $second;
+                                } elseif ( post_type_exists( $second ) ) {
+                                        $post_type = $second;
+                                } else {
+                                        $id .= '-' . $second;
+                                 }
+                         }
+                } else {
+                        $id = $GLOBALS['hook_suffix'];
+                        $id = str_replace( '.php', '', $id );
+                        if ( in_array( substr( $id, -4 ), array( '-add', '-new' ) ) )
+                                $action = 'add';
+                        $id = str_replace( array( '-new', '-add' ), '', $id );
+                 }

+                if ( 'index' == $id )
+                        $id = 'dashboard';

+                $base = $id;

+                // If this is the current screen, see if we can be more accurate for post types and taxonomies.
+                if ( ! $hook_name ) {
+                        switch ( $base ) {
+                                case 'post' :
+                                        if ( isset( $_GET['post'] ) )
+                                                $post_id = (int) $_GET['post'];
+                                        elseif ( isset( $_POST['post_ID'] ) )
+                                                $post_id = (int) $_POST['post_ID'];
+                                        else
+                                                $post_id = 0;
</ins><span class="cx"> 
</span><del>-                if ( empty( $id ) ) {
-                        $screen = $hook_suffix;
-                        $screen = str_replace('.php', '', $screen);
-                        if ( preg_match('/-add|-new$/', $screen) )
-                                $action = 'add';
-                        $screen = str_replace('-new', '', $screen);
-                        $screen = str_replace('-add', '', $screen);
-                        $this-&gt;id = $this-&gt;base = $screen;
-                } else {
-                        $id = sanitize_key( $id );
-                        if ( false !== strpos($id, '-') ) {
-                                list( $id, $typenow ) = explode('-', $id, 2);
-                                if ( taxonomy_exists( $typenow ) ) {
-                                        $id = 'edit-tags';
-                                        $taxnow = $typenow;
-                                        $typenow = '';
-                                }
</del><ins>+                                        if ( $post_id ) {
+                                                $post = get_post( $post_id );
+                                                if ( $post )
+                                                        $post_type = $post-&gt;post_type;
+                                        } elseif ( isset( $_POST['post_type'] ) &amp;&amp; post_type_exists( $_POST['post_type'] ) ) {
+                                                $post_type = $_GET['post_type'];
+                                        } elseif ( $action == 'add' &amp;&amp; isset( $_GET['post_type'] ) &amp;&amp; post_type_exists( $_GET['post_type'] ) ) {
+                                                $post_type = $_GET['post_type'];
+                                        }
+                                        break;
+                                case 'edit' :
+                                        if ( isset( $_GET['post_type'] ) &amp;&amp; post_type_exists( $_GET['post_type'] ) )
+                                                $post_type = $_GET['post_type'];
+                                        break;
+                                case 'edit-tags' :
+                                        if ( isset( $_REQUEST['taxonomy'] ) &amp;&amp; taxonomy_exists( $_REQUEST['taxonomy'] ) )
+                                                $taxonomy = $_REQUEST['taxonomy'];
+                                        if ( isset( $_REQUEST['post_type'] ) &amp;&amp; post_type_exists( $_REQUEST['post_type'] ) )
+                                                $post_type = $_REQUEST['post_type'];
+                                        else
+                                                $post_type = 'post';
+                                        break;
</ins><span class="cx">                         }
</span><del>-                        $this-&gt;id = $this-&gt;base = $id;
</del><ins>+                 }

+                switch ( $base ) {
+                        case 'post' :
+                                if ( ! $post_type )
+                                        $post_type = 'post';
+                                $id = $post_type;
+                                break;
+                        case 'edit' :
+                                if ( ! $post_type )
+                                        $post_type = 'post';
+                                $id .= '-' . $post_type;
+                                break;
+                        case 'edit-tags' :
+                                if ( ! $taxonomy )
+                                        $taxonomy = 'post_tag';
+                                $id = 'edit-' . $taxonomy;
+                                break;
</ins><span class="cx">                 }
</span><ins>+ 
+                if ( is_network_admin() ) {
+                        $id   .= '-network';
+                        $base .= '-network';
+                } elseif ( is_user_admin() ) {
+                        $id   .= '-user';
+                        $base .= '-user';
+                 }

+                if ( isset( self::$_registry[ $id ] ) )
+                        return self::$_registry[ $id ];
</ins><span class="cx"> 
</span><del>-                $this-&gt;action = $action;
</del><ins>+                $screen = new WP_Screen();
+                $screen-&gt;id         = $id;
+                $screen-&gt;base       = $base;
+                $screen-&gt;action     = $action;
+                $screen-&gt;post_type  = $post_type;
+                $screen-&gt;taxonomy   = $taxonomy;
+                $screen-&gt;is_user    = is_user_admin();
+                $screen-&gt;is_network = is_network_admin();
</ins><span class="cx"> 
</span><del>-                // Map index to dashboard
-                if ( 'index' == $this-&gt;base )
-                        $this-&gt;base = 'dashboard';
-                if ( 'index' == $this-&gt;id )
-                        $this-&gt;id = 'dashboard';
</del><ins>+                self::$_registry[ $id ] = $screen;
</ins><span class="cx"> 
</span><del>-                if ( 'edit' == $this-&gt;id ) {
-                        if ( empty($typenow) )
-                                $typenow = 'post';
-                        $this-&gt;id .= '-' . $typenow;
-                        $this-&gt;post_type = $typenow;
-                } elseif ( 'post' == $this-&gt;id ) {
-                        if ( empty($typenow) )
-                                $typenow = 'post';
-                        $this-&gt;id = $typenow;
-                        $this-&gt;post_type = $typenow;
-                } elseif ( 'edit-tags' == $this-&gt;id ) {
-                        if ( empty($taxnow) )
-                                $taxnow = 'post_tag';
-                        $this-&gt;id = 'edit-' . $taxnow;
-                        $this-&gt;taxonomy = $taxnow;
-                }
-
-                $this-&gt;is_network = is_network_admin();
-                $this-&gt;is_user = is_user_admin();
-
-                if ( $this-&gt;is_network ) {
-                        $this-&gt;base .= '-network';
-                        $this-&gt;id .= '-network';
-                } elseif ( $this-&gt;is_user ) {
-                        $this-&gt;base .= '-user';
-                        $this-&gt;id .= '-user';
-                }
-
-                if ( ! isset( self::$_help_tabs[ $this-&gt;id ] ) )
-                        self::$_help_tabs[ $this-&gt;id ] = array();
-                if ( ! isset( self::$_help_sidebar[ $this-&gt;id ] ) )
-                        self::$_help_sidebar[ $this-&gt;id ] = '';
-                if ( ! isset( self::$_options[ $this-&gt;id ] ) )
-                        self::$_options[ $this-&gt;id ] = array();
</del><ins>+                return $screen;
+         }

+        /**
+         * Makes the screen object the current screen.
+         *
+         * @see set_current_screen()
+         * @since 3.3.0
+         */
+        function set_current_screen() {
+                global $current_screen, $taxnow, $typenow;
+                $current_screen = $this;
+                $taxnow = $this-&gt;taxonomy;
+                $typenow = $this-&gt;post_type;
+                $current_screen = apply_filters( 'current_screen', $current_screen );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><ins>+         * Constructor
+         *
+         * @since 3.3.0
+         * @access private
+         */
+        private function __construct() {}
+
+        /**
</ins><span class="cx">          * Sets the old string-based contextual help for the screen.
</span><span class="cx">          *
</span><span class="cx">          * For backwards compatibility.
</span><span class="lines">@@ -501,7 +570,7 @@
</span><span class="cx">          * @param mixed $args Option-dependent arguments.
</span><span class="cx">          */
</span><span class="cx">         public function add_option( $option, $args = array() ) {
</span><del>-                self::$_options[ $this-&gt;id ][ $option ] = $args;
</del><ins>+                $this-&gt;_options[ $option ] = $args;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -512,14 +581,14 @@
</span><span class="cx">          * @param string
</span><span class="cx">          */
</span><span class="cx">         public function get_option( $option, $key = false ) {
</span><del>-                if ( ! isset( self::$_options[ $this-&gt;id ][ $option ] ) )
</del><ins>+                if ( ! isset( $this-&gt;_options[ $option ] ) )
</ins><span class="cx">                         return null;
</span><span class="cx">                 if ( $key ) {
</span><del>-                        if ( isset( self::$_options[ $this-&gt;id ][ $option ][ $key ] ) )
-                                return self::$_options[ $this-&gt;id ][ $option ][ $key ];
</del><ins>+                        if ( isset( $this-&gt;_options[ $option ][ $key ] ) )
+                                return $this-&gt;_options[ $option ][ $key ];
</ins><span class="cx">                         return null;
</span><span class="cx">                 }
</span><del>-                return self::$_options[ $this-&gt;id ][ $option ];
</del><ins>+                return $this-&gt;_options[ $option ];
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -550,7 +619,7 @@
</span><span class="cx">                 if ( ! $args['id'] || ! $args['title'] )
</span><span class="cx">                         return;
</span><span class="cx"> 
</span><del>-                self::$_help_tabs[ $this-&gt;id ][] = $args;
</del><ins>+                $this-&gt;_help_tabs[] = $args;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -562,7 +631,7 @@
</span><span class="cx">          * @param string $content Sidebar content in plain text or HTML.
</span><span class="cx">          */
</span><span class="cx">         public function add_help_sidebar( $content ) {
</span><del>-                self::$_help_sidebar[ $this-&gt;id ] = $content;
</del><ins>+                $this-&gt;_help_sidebar = $content;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -577,7 +646,7 @@
</span><span class="cx">                 // Call old contextual_help_list filter.
</span><span class="cx">                 self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this );
</span><span class="cx"> 
</span><del>-                if ( isset( self::$_old_compat_help[ $this-&gt;id ] ) || empty(self::$_help_tabs[ $this-&gt;id ] ) ) {
</del><ins>+                if ( isset( self::$_old_compat_help[ $this-&gt;id ] ) || empty($this-&gt;_help_tabs ) ) {
</ins><span class="cx">                         // Call old contextual_help filter.
</span><span class="cx">                         if ( isset( self::$_old_compat_help[ $this-&gt;id ] ) )
</span><span class="cx">                                 $contextual_help = apply_filters( 'contextual_help', self::$_old_compat_help[ $this-&gt;id ], $this-&gt;id, $this );
</span><span class="lines">@@ -603,8 +672,8 @@
</span><span class="cx">                                 'title'    =&gt; __('Screen Options'),
</span><span class="cx">                                 'callback' =&gt; array( $this, 'render_screen_options' ),
</span><span class="cx">                         ) );
</span><del>-                        $_options_tab = array_pop( self::$_help_tabs[ $this-&gt;id ] );
-                        array_unshift( self::$_help_tabs[ $this-&gt;id ], $_options_tab );
</del><ins>+                        $_options_tab = array_pop( $this-&gt;_help_tabs );
+                        array_unshift( $this-&gt;_help_tabs, $_options_tab );
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // Time to render!
</span><span class="lines">@@ -614,7 +683,7 @@
</span><span class="cx">                         &lt;div id=&quot;contextual-help-wrap&quot; class=&quot;hidden&quot;&gt;
</span><span class="cx">                                 &lt;div class=&quot;contextual-help-tabs&quot;&gt;
</span><span class="cx">                                         &lt;ul&gt;
</span><del>-                                        &lt;?php foreach ( self::$_help_tabs[ $this-&gt;id ] as $i =&gt; $tab ):
</del><ins>+                                        &lt;?php foreach ( $this-&gt;_help_tabs as $i =&gt; $tab ):
</ins><span class="cx">                                                 $link_id  = &quot;tab-link-{$tab['id']}&quot;;
</span><span class="cx">                                                 $panel_id = &quot;tab-panel-{$tab['id']}&quot;;
</span><span class="cx">                                                 $classes  = ( $i == 0 ) ? 'active' : '';
</span><span class="lines">@@ -629,14 +698,14 @@
</span><span class="cx">                                         &lt;/ul&gt;
</span><span class="cx">                                 &lt;/div&gt;
</span><span class="cx"> 
</span><del>-                                &lt;?php if ( ! empty( self::$_help_sidebar[ $this-&gt;id ] ) ) : ?&gt;
</del><ins>+                                &lt;?php if ( ! empty( $this-&gt;_help_sidebar ) ) : ?&gt;
</ins><span class="cx">                                 &lt;div class=&quot;contextual-help-sidebar&quot;&gt;
</span><del>-                                        &lt;?php echo self::$_help_sidebar[ $this-&gt;id ]; ?&gt;
</del><ins>+                                        &lt;?php echo self::$this-&gt;_help_sidebar; ?&gt;
</ins><span class="cx">                                 &lt;/div&gt;
</span><span class="cx">                                 &lt;?php endif; ?&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;div class=&quot;contextual-help-tabs-wrap&quot;&gt;
</span><del>-                                        &lt;?php foreach ( self::$_help_tabs[ $this-&gt;id ] as $i =&gt; $tab ):
</del><ins>+                                        &lt;?php foreach ( $this-&gt;_help_tabs as $i =&gt; $tab ):
</ins><span class="cx">                                                 $panel_id = &quot;tab-panel-{$tab['id']}&quot;;
</span><span class="cx">                                                 $classes  = ( $i == 0 ) ? 'active' : '';
</span><span class="cx">                                                 $classes .= ' help-tab-content';
</span><span class="lines">@@ -677,7 +746,7 @@
</span><span class="cx">                                 break;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( $this-&gt;_screen_settings || self::$_options[ $this-&gt;id ] )
</del><ins>+                if ( $this-&gt;_screen_settings || $this-&gt;_options )
</ins><span class="cx">                         $show_screen = true;
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this );
</span></span></pre></div>
<a id="trunkwpadminpostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post.php (19051 => 19052)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post.php        2011-10-24 06:40:15 UTC (rev 19051)
+++ trunk/wp-admin/post.php        2011-10-24 18:34:08 UTC (rev 19052)
</span><span class="lines">@@ -16,33 +16,21 @@
</span><span class="cx"> 
</span><span class="cx"> wp_reset_vars(array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder'));
</span><span class="cx"> 
</span><del>-if ( isset($_GET['post']) )
-        $post_id = (int) $_GET['post'];
-elseif ( isset($_POST['post_ID']) )
-        $post_id = (int) $_POST['post_ID'];
-else
-        $post_id = 0;
-$post_ID = $post_id;
-$post = null;
-$post_type_object = null;
-$post_type = null;
-if ( $post_id ) {
-        $post = get_post($post_id);
-        if ( $post ) {
-                $post_type_object = get_post_type_object($post-&gt;post_type);
-                if ( $post_type_object ) {
-                        $post_type = $post-&gt;post_type;
-                        $current_screen-&gt;post_type = $post-&gt;post_type;
-                        $current_screen-&gt;id = $current_screen-&gt;post_type;
-                }
-        }
-} elseif ( isset($_POST['post_type']) ) {
-        $post_type_object = get_post_type_object($_POST['post_type']);
-        if ( $post_type_object ) {
-                $post_type = $post_type_object-&gt;name;
-                $current_screen-&gt;post_type = $post_type;
-                $current_screen-&gt;id = $current_screen-&gt;post_type;
-        }
</del><ins>+if ( isset( $_GET['post'] ) )
+         $post_id = $post_ID = (int) $_GET['post'];
+elseif ( isset( $_POST['post_ID'] ) )
+         $post_id = $post_ID = (int) $_POST['post_ID'];
+ else
+         $post_id = $post_ID = 0;
+
+$post = $post_type = $post_type_object = null;
+
+if ( $post_id )
+        $post = get_post( $post_id );
+
+if ( $post ) {
+        $post_type = $post-&gt;post_type;
+        $post_type_object = get_post_type_object( $post_type );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre>
</div>
</div>

</body>
</html>