<!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>[18941] trunk/wp-admin: Enforce IDs for add_help_tab().</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/18941">18941</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2011-10-11 19:29:09 +0000 (Tue, 11 Oct 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Enforce IDs for add_help_tab(). props mbijon. Restore default_contextual_help, for now. see <a href="http://core.trac.wordpress.org/ticket/18785">#18785</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmineditformadvancedphp">trunk/wp-admin/edit-form-advanced.php</a></li>
<li><a href="#trunkwpadminincludesscreenphp">trunk/wp-admin/includes/screen.php</a></li>
<li><a href="#trunkwpadminindexphp">trunk/wp-admin/index.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmineditformadvancedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-form-advanced.php (18940 => 18941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-form-advanced.php        2011-10-11 17:59:51 UTC (rev 18940)
+++ trunk/wp-admin/edit-form-advanced.php        2011-10-11 19:29:09 UTC (rev 18941)
</span><span class="lines">@@ -189,6 +189,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $current_screen-&gt;add_help_tab( array(
</span><ins>+                'id'      =&gt; 'publish-box',
</ins><span class="cx">                 'title'   =&gt; __('Publish Box'),
</span><span class="cx">                 'content' =&gt; $publish_box,
</span><span class="cx">         ) );
</span><span class="lines">@@ -197,6 +198,7 @@
</span><span class="cx">         $discussion_settings .= '&lt;p&gt;' . __('&lt;strong&gt;Discussion&lt;/strong&gt; - You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '&lt;/p&gt;';
</span><span class="cx"> 
</span><span class="cx">         $current_screen-&gt;add_help_tab( array(
</span><ins>+                'id'      =&gt; 'discussion-settings',
</ins><span class="cx">                 'title'   =&gt; __('Discussion Settings'),
</span><span class="cx">                 'content' =&gt; $discussion_settings,
</span><span class="cx">         ) );
</span><span class="lines">@@ -208,12 +210,25 @@
</span><span class="cx">                         '&lt;p&gt;' . __('&lt;a href=&quot;http://wordpress.org/support/&quot; target=&quot;_blank&quot;&gt;Support Forums&lt;/a&gt;') . '&lt;/p&gt;'
</span><span class="cx">         );
</span><span class="cx"> } elseif ( 'page' == $post_type ) {
</span><del>-        $current_screen-&gt;add_help_tab( 'about-pages', __('About Pages'), '&lt;p&gt;' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the &amp;#8220;Parent&amp;#8221; of the other, creating a group of Pages.') . '&lt;/p&gt;' .
-                                '&lt;p&gt;' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the new in 3.2 distraction-free writing space, available in both the Visual and HTML modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box:') . '&lt;/p&gt;' );
-        $current_screen-&gt;add_help_tab('page-attributes', ('Page Attributes'),
-                                '&lt;p&gt;' . __('&lt;strong&gt;Parent&lt;/strong&gt; - You can arrange your pages in hierarchies. For example, you could have an &amp;#8220;About&amp;#8221; page that has &amp;#8220;Life Story&amp;#8221; and &amp;#8220;My Dog&amp;#8221; pages under it. There are no limits to how many levels you can nest pages.') . '&lt;/p&gt;' .
-                                '&lt;p&gt;' . __('&lt;strong&gt;Template&lt;/strong&gt; - Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&amp;#8217;ll see them in this dropdown menu.') . '&lt;/p&gt;' .
-                                '&lt;p&gt;' . __('&lt;strong&gt;Order&lt;/strong&gt; - Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '&lt;/p&gt;' );
</del><ins>+        $about_pages = '&lt;p&gt;' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the &amp;#8220;Parent&amp;#8221; of the other, creating a group of Pages.') . '&lt;/p&gt;' .
+                '&lt;p&gt;' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the new in 3.2 distraction-free writing space, available in both the Visual and HTML modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box:') . '&lt;/p&gt;';
+        
+        $current_screen-&gt;add_help_tab( array(
+                'id'      =&gt; 'about-pages',
+                'title'   =&gt; __('About Pages'),
+                'content' =&gt; $about_pages,
+        ) );
+        
+        $page_attributes = '&lt;p&gt;' . __('&lt;strong&gt;Parent&lt;/strong&gt; - You can arrange your pages in hierarchies. For example, you could have an &amp;#8220;About&amp;#8221; page that has &amp;#8220;Life Story&amp;#8221; and &amp;#8220;My Dog&amp;#8221; pages under it. There are no limits to how many levels you can nest pages.') . '&lt;/p&gt;' .
+                '&lt;p&gt;' . __('&lt;strong&gt;Template&lt;/strong&gt; - Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&amp;#8217;ll see them in this dropdown menu.') . '&lt;/p&gt;' .
+                '&lt;p&gt;' . __('&lt;strong&gt;Order&lt;/strong&gt; - Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '&lt;/p&gt;';
+        
+        $current_screen-&gt;add_help_tab( array(
+                'id' =&gt; 'page-attributes',
+                'title' =&gt; __('Page Attributes'),
+                'content' =&gt; $page_attributes,
+        ) );
+        
</ins><span class="cx">         $current_screen-&gt;add_help_sidebar(
</span><span class="cx">                         '&lt;p&gt;&lt;strong&gt;' . __('For more information:') . '&lt;/strong&gt;&lt;/p&gt;' .
</span><span class="cx">                         '&lt;p&gt;' . __('&lt;a href=&quot;http://codex.wordpress.org/Pages_Add_New_Screen&quot; target=&quot;_blank&quot;&gt;Documentation on Adding New Pages&lt;/a&gt;') . '&lt;/p&gt;' .
</span></span></pre></div>
<a id="trunkwpadminincludesscreenphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/screen.php (18940 => 18941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/screen.php        2011-10-11 17:59:51 UTC (rev 18940)
+++ trunk/wp-admin/includes/screen.php        2011-10-11 19:29:09 UTC (rev 18941)
</span><span class="lines">@@ -590,7 +590,7 @@
</span><span class="cx">          *
</span><span class="cx">          * @param array $args
</span><span class="cx">          * - string   - title    - Title for the tab.
</span><del>-         * - string   - id       - Tab ID. Optional.
</del><ins>+         * - string   - id       - Tab ID. Must be HTML-safe.
</ins><span class="cx">          * - string   - content  - Help tab content in plain text or HTML. Optional.
</span><span class="cx">          * - callback - callback - A callback to generate the tab content. Optional.
</span><span class="cx">          *
</span><span class="lines">@@ -604,14 +604,12 @@
</span><span class="cx">                 );
</span><span class="cx">                 $args = wp_parse_args( $args, $defaults );
</span><span class="cx"> 
</span><del>-                // Ensure we have a title.
-                if ( ! $args['title'] )
</del><ins>+                $args['id'] = sanitize_html_class( $args['id'] );
+
+                // Ensure we have an ID and title.
+                if ( ! $args['id'] || ! $args['title'] )
</ins><span class="cx">                         return;
</span><span class="cx"> 
</span><del>-                // Create an id from the title if one is not provided.
-                if ( ! $args['id'] )
-                        $args['id'] = sanitize_html_class( $args['title'] );
-
</del><span class="cx">                 $this-&gt;_help_tabs[] = $args;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -642,11 +640,20 @@
</span><span class="cx">                         $_wp_contextual_help = array();
</span><span class="cx">                 $_wp_contextual_help = apply_filters( 'contextual_help_list', $_wp_contextual_help, $this );
</span><span class="cx"> 
</span><del>-                if ( isset( $_wp_contextual_help[ $this-&gt;id ] ) ) {
</del><ins>+                if ( isset( $_wp_contextual_help[ $this-&gt;id ] ) || ! $this-&gt;_help_tabs ) {
</ins><span class="cx">                         // Call old contextual_help filter.
</span><del>-                        $contextual_help = apply_filters( 'contextual_help', $_wp_contextual_help[ $this-&gt;id ], $this-&gt;id, $this );
</del><ins>+                        if ( isset( $_wp_contextual_help[ $this-&gt;id ] ) )
+                                $contextual_help = apply_filters( 'contextual_help', $_wp_contextual_help[ $this-&gt;id ], $this-&gt;id, $this );
</ins><span class="cx"> 
</span><ins>+                        if ( empty( $contextual_help ) ) {
+                                $default_help = __( '&lt;a href=&quot;http://codex.wordpress.org/&quot; target=&quot;_blank&quot;&gt;Documentation&lt;/a&gt;' );
+                                $default_help .= '&lt;br /&gt;';
+                                $default_help .= __( '&lt;a href=&quot;http://wordpress.org/support/&quot; target=&quot;_blank&quot;&gt;Support Forums&lt;/a&gt;' );
+                                $contextual_help = '&lt;p&gt;' . apply_filters( 'default_contextual_help', $default_help ) . '&lt;/p&gt;';
+                        }
+
</ins><span class="cx">                         $this-&gt;add_help_tab( array(
</span><ins>+                                'id'      =&gt; 'contextual-help',
</ins><span class="cx">                                 'title'   =&gt; __('Screen Info'),
</span><span class="cx">                                 'content' =&gt; $contextual_help,
</span><span class="cx">                         ) );
</span><span class="lines">@@ -655,6 +662,7 @@
</span><span class="cx">                 // Add screen options tab
</span><span class="cx">                 if ( $this-&gt;show_screen_options() ) {
</span><span class="cx">                         $this-&gt;add_help_tab( array(
</span><ins>+                                'id'       =&gt; 'screen-options',
</ins><span class="cx">                                 'title'    =&gt; __('Screen Options'),
</span><span class="cx">                                 'callback' =&gt; array( $this, 'render_screen_options' ),
</span><span class="cx">                         ) );
</span></span></pre></div>
<a id="trunkwpadminindexphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/index.php (18940 => 18941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/index.php        2011-10-11 17:59:51 UTC (rev 18940)
+++ trunk/wp-admin/index.php        2011-10-11 19:29:09 UTC (rev 18941)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> $help_navigation .= '&lt;p&gt;' . __('Links in the &amp;#8220;admin bar&amp;#8221; at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.') . '&lt;/p&gt;';
</span><span class="cx"> 
</span><span class="cx"> $current_screen-&gt;add_help_tab( array(
</span><ins>+        'id'      =&gt; 'help-navigation',
</ins><span class="cx">         'title'   =&gt; __('Navigation'),
</span><span class="cx">         'content' =&gt; $help_navigation,
</span><span class="cx"> ) );
</span><span class="lines">@@ -46,6 +47,7 @@
</span><span class="cx"> $help_layout .= '&lt;p&gt;' . __('&lt;strong&gt;Box Controls&lt;/strong&gt; - Click the title bar of the box to expand or collapse it. In addition, some box have configurable content, and will show a &amp;#8220;Configure&amp;#8221; link in the title bar if you hover over it.') . '&lt;/p&gt;';
</span><span class="cx"> 
</span><span class="cx"> $current_screen-&gt;add_help_tab( array(
</span><ins>+        'id'      =&gt; 'help-layout',
</ins><span class="cx">         'title'   =&gt; __('Layout'),
</span><span class="cx">         'content' =&gt; $help_layout,
</span><span class="cx"> ) );
</span><span class="lines">@@ -61,6 +63,7 @@
</span><span class="cx"> $help_content .= '&lt;p&gt;' . __('&lt;strong&gt;Plugins&lt;/strong&gt; - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory.') . '&lt;/p&gt;';
</span><span class="cx"> 
</span><span class="cx"> $current_screen-&gt;add_help_tab( array(
</span><ins>+        'id'      =&gt; 'help-content',
</ins><span class="cx">         'title'   =&gt; __('Content'),
</span><span class="cx">         'content' =&gt; $help_content,
</span><span class="cx"> ) );
</span></span></pre>
</div>
</div>

</body>
</html>