<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[13336] trunk/wp-includes: More output consolidation.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13336">13336</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-02-23 19:28:41 +0000 (Tue, 23 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>More output consolidation. see <a href="http://trac.wordpress.org/ticket/11817">#11817</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludescustomnavigationphp">trunk/wp-includes/custom-navigation.php</a></li>
<li><a href="#trunkwpincludesdefaultwidgetsphp">trunk/wp-includes/default-widgets.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludescustomnavigationphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/custom-navigation.php (13335 => 13336)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/custom-navigation.php        2010-02-23 19:08:46 UTC (rev 13335)
+++ trunk/wp-includes/custom-navigation.php        2010-02-23 19:28:41 UTC (rev 13336)
</span><span class="lines">@@ -136,6 +136,7 @@
</span><span class="cx">         if ( $menu_item-&gt;ID == $wp_query-&gt;get_queried_object_id() )
</span><span class="cx">                 $menu_item-&gt;li_class = 'class=&quot;current_page_item&quot;';
</span><span class="cx"> 
</span><ins>+        $menu_item-&gt;anchor_title = '';
</ins><span class="cx"> /* @todo: update to use tax/post data
</span><span class="cx"> 
</span><span class="cx">                         //SET anchor title
</span><span class="lines">@@ -163,7 +164,7 @@
</span><span class="cx">         return $menu_item;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function output_menu_item($menu_item, $context) {
</del><ins>+function output_menu_item($menu_item, $context, $args = array() ) {
</ins><span class="cx">         switch( $context ) {
</span><span class="cx">                 case 'backend':
</span><span class="cx">                 case 'menu':
</span><span class="lines">@@ -197,6 +198,44 @@
</span><span class="cx">                                                 &lt;input type=&quot;hidden&quot; name=&quot;newwindow&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;newwindow&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo ( '' == $menu_item-&gt;post_content_filtered ? '0' : '1' ); ?&gt;&quot; /&gt;
</span><span class="cx"> &lt;?php
</span><span class="cx">                 break;
</span><ins>+
+                case 'frontend':
+                        // Override for menu descriptions
+                        $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options');
+                        if ( $advanced_option_descriptions == 'no' )
+                                $args['desc'] = 2;
+?&gt;
+                        &lt;a title=&quot;&lt;?php echo $menu_item-&gt;anchor_title; ?&gt;&quot; href=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot; &lt;?php echo $menu_item-&gt;target; ?&gt;&gt;&lt;?php echo $args['before_title'] . $menu_item-&gt;title . $args['after_title']; ?&gt;&lt;?php
+
+                                                        if ( $advanced_option_descriptions == 'no' ) {
+                                                                // 2 widget override do NOT display descriptions
+                                                                // 1 widget override display descriptions
+                                                                // 0 widget override not set
+                                                                if ( ($args['desc'] == 1) || ($args['desc'] == 0) ) {
+                                                                        ?&gt;&lt;span class=&quot;nav-description&quot;&gt;&lt;?php echo $menu_item-&gt;description; ?&gt;&lt;/span&gt;&lt;?php
+                                                                }
+                                                        } else {
+                                                                // 2 widget override do NOT display descriptions
+                                                                // 1 widget override display descriptions
+                                                                // 0 widget override not set
+                                                                if ( $args['desc'] == 1 ) {
+                                                                        ?&gt;&lt;span class=&quot;nav-description&quot;&gt;&lt;?php echo $menu_item-&gt;description; ?&gt;&lt;/span&gt;&lt;?php
+                                                                }
+                                                        }
+                                                ?&gt;&lt;/a&gt;
+&lt;?php
+                break;
+
+                case 'default':
+?&gt;
+                                        &lt;dl&gt;
+                                        &lt;dt&gt;
+
+                                        &lt;?php $templatedir = get_bloginfo('url'); ?&gt;
+                                        &lt;span class=&quot;title&quot;&gt;&lt;?php echo $menu_item-&gt;title; ?&gt;&lt;/span&gt; &lt;a onclick=&quot;appendToList('&lt;?php echo $templatedir; ?&gt;','&lt;?php echo $menu_item-&gt;append; ?&gt;','&lt;?php echo $menu_item-&gt;title; ?&gt;','&lt;?php echo $menu_item-&gt;link; ?&gt;','&lt;?php echo $menu_item-&gt;ID; ?&gt;','&lt;?php echo $menu_item-&gt;parent_item ?&gt;','&lt;?php echo $menu_item-&gt;description; ?&gt;')&quot; name=&quot;&lt;?php echo $menu_item-&gt;title; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot;&gt;&lt;img alt=&quot;&lt;?php esc_attr_e('Add to Custom Menu'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('Add to Custom Menu'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-add.png'); ?&gt;&quot; /&gt;&lt;/a&gt; &lt;/dt&gt;
+                                        &lt;/dl&gt;
+&lt;?php
+                break;
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -227,10 +266,6 @@
</span><span class="cx"> 
</span><span class="cx">                 $menu_objects = get_objects_in_term( $id, 'nav_menu' );
</span><span class="cx">                 $menu_items = wp_custom_navigation_get_menu_items( $menu_objects, 'menu_order' );
</span><del>-                // Override for menu descriptions
-                $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options');
-                if ( $advanced_option_descriptions == 'no' )
-                        $desc = 2;
</del><span class="cx"> 
</span><span class="cx">                 $parent_stack = array();
</span><span class="cx">                 $current_parent = 0;
</span><span class="lines">@@ -245,31 +280,7 @@
</span><span class="cx">                         $menu_item = setup_menu_item($menu_item);
</span><span class="cx">                         // List Items
</span><span class="cx">                         ?&gt;&lt;li id=&quot;menu-&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; &lt;?php echo $menu_item-&gt;li_class; ?&gt;&gt;&lt;?php
</span><del>-                                        //@todo: update front end to use post data
-                                        //FRONTEND Link
-                                        if ( $type == 'frontend' ) {
-                                                ?&gt;&lt;a title=&quot;&lt;?php echo $menu_item-&gt;anchor_title; ?&gt;&quot; href=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot; &lt;?php echo $menu_item-&gt;target; ?&gt;&gt;&lt;?php echo $before_title.$menu_item-&gt;title.$after_title; ?&gt;&lt;?php
-
-                                                        if ( $advanced_option_descriptions == 'no' ) {
-                                                                // 2 widget override do NOT display descriptions
-                                                                // 1 widget override display descriptions
-                                                                // 0 widget override not set
-                                                                if ( ($desc == 1) || ($desc == 0) ) {
-                                                                        ?&gt;&lt;span class=&quot;nav-description&quot;&gt;&lt;?php echo $menu_item-&gt;description; ?&gt;&lt;/span&gt;&lt;?php
-                                                                }
-                                                        } else {
-                                                                // 2 widget override do NOT display descriptions
-                                                                // 1 widget override display descriptions
-                                                                // 0 widget override not set
-                                                                if ( $desc == 1 ) {
-                                                                        ?&gt;&lt;span class=&quot;nav-description&quot;&gt;&lt;?php echo $menu_item-&gt;description; ?&gt;&lt;/span&gt;&lt;?php
-                                                                }
-                                                        }
-
-                                                ?&gt;&lt;/a&gt;&lt;?php
-                                        } elseif ( $type == 'backend' ) {
-                                                output_menu_item($menu_item, 'backend');
-                                        }
</del><ins>+                        output_menu_item($menu_item, $type, $args);
</ins><span class="cx">                         // Indent children
</span><span class="cx">                         $last_item = ( count( $menu_items ) == $menu_item-&gt;menu_order );
</span><span class="cx">                         if ( $last_item || $current_parent != $menu_items[ $key + 1 ]-&gt;post_parent ) {
</span></span></pre></div>
<a id="trunkwpincludesdefaultwidgetsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/default-widgets.php (13335 => 13336)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/default-widgets.php        2010-02-23 19:08:46 UTC (rev 13335)
+++ trunk/wp-includes/default-widgets.php        2010-02-23 19:28:41 UTC (rev 13336)
</span><span class="lines">@@ -1044,8 +1044,8 @@
</span><span class="cx">  class WP_CustomNavWidget extends WP_Widget {
</span><span class="cx"> 
</span><span class="cx">         function WP_CustomNavWidget() {
</span><del>-                $widget_ops = array('description' =&gt; 'Use this widget to add one of your Custom Navigation Menus as a widget.' );
-                parent::WP_Widget(false, __('Custom Navigation Menu'),$widget_ops);
</del><ins>+                $widget_ops = array('description' =&gt; __('Use this widget to add one of your Custom Navigation Menus as a widget.') );
+                parent::WP_Widget(false, __('Custom Navigation Menu'), $widget_ops);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function widget($args, $instance) {
</span><span class="lines">@@ -1059,56 +1059,39 @@
</span><span class="cx">                 $navulid = $instance['navulid'];
</span><span class="cx">                 $navulclass = $instance['navulclass'];
</span><span class="cx"> 
</span><del>-                //Override for menu descriptions
</del><ins>+                // Override for menu descriptions
</ins><span class="cx">                 $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options');
</span><del>-                if ($advanced_option_descriptions == 'no')
-                {
</del><ins>+                if ( $advanced_option_descriptions == 'no' ) {
</ins><span class="cx">                         $navwidgetdescription = 2;
</span><del>-                }
-                else
-                {
</del><ins>+                } else {
</ins><span class="cx">                         $navwidgetdescription = $instance['navwidgetdescription'];
</span><span class="cx">                 }
</span><span class="cx">                 $menuexists = false;
</span><span class="cx"> 
</span><span class="cx">                 global $wpdb;
</span><span class="cx"> 
</span><del>-                //GET menu name
-                if ($navmenu &gt; 0)
-                {
-                        $table_name_menus = $wpdb-&gt;prefix . &quot;custom_nav_menus&quot;;
-                        $wp_result = $wpdb-&gt;get_results(&quot;SELECT menu_name FROM &quot;.$table_name_menus.&quot; WHERE id='&quot;.$navmenu.&quot;'&quot;);
-                        $wp_custom_nav_menu_name = $wp_result[0]-&gt;menu_name;
</del><ins>+                // GET menu name
+                if ( $navmenu &gt; 0 ) {
+                        $custom_menu = get_term( (int) $nav_menu, 'nav_menu' );
+                        $wp_custom_nav_menu_name = $custom_menu-&gt;name;
</ins><span class="cx">                         $menuexists = true;
</span><del>-                }
-                //Do nothing
-                else
-                {
</del><ins>+                } else {
</ins><span class="cx">                         $menuexists = false;
</span><span class="cx">                 }
</span><span class="cx">                 ?&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;?php
</span><span class="cx">                         //DEVELOPER settings enabled
</span><del>-                        if ($navdeveloper == 'yes')
-                        {
</del><ins>+                        if ( $navdeveloper == 'yes' ) {
</ins><span class="cx">                                 //DISPLAY Custom DIV
</span><del>-                                if ($navdiv == 'yes')
-                                {
</del><ins>+                                if ( $navdiv == 'yes' ) {
</ins><span class="cx">                                         ?&gt;
</span><span class="cx">                                         &lt;div id=&quot;&lt;?php echo $navdivid;  ?&gt;&quot; class=&quot;&lt;?php echo $navdivclass; ?&gt;&quot;&gt;
</span><span class="cx">                                         &lt;?php
</span><span class="cx">                                 }
</span><del>-                                //Do NOT display DIV
-                                else
-                                {
-
-                                }
-
</del><span class="cx">                         }
</span><span class="cx">                         //DISPLAY default DIV
</span><del>-                        else
-                        {
</del><ins>+                        else {
</ins><span class="cx">                                 ?&gt;
</span><span class="cx">                                 &lt;div class=&quot;widget&quot;&gt;
</span><span class="cx">                                 &lt;?php
</span><span class="lines">@@ -1118,31 +1101,21 @@
</span><span class="cx">                         &lt;h3&gt;&lt;?php echo $navtitle; ?&gt;&lt;/h3&gt;
</span><span class="cx">                         &lt;?php
</span><span class="cx"> 
</span><del>-                        if ($menuexists)
-                        {
</del><ins>+                        if ( $menuexists ) {
</ins><span class="cx">                                 ?&gt;
</span><span class="cx">                         &lt;?php
</span><span class="cx"> 
</span><span class="cx">                         //DEVELOPER settings enabled
</span><del>-                                if ($navdeveloper == 'yes')
-                                {
</del><ins>+                                if ( $navdeveloper == 'yes' ) {
</ins><span class="cx">                                         //DISPLAY Custom UL
</span><del>-                                        if ($navul == 'yes')
-                                        {
</del><ins>+                                        if ( $navul == 'yes' ) {
</ins><span class="cx">                                                 ?&gt;
</span><span class="cx">                                                 &lt;ul id=&quot;&lt;?php echo $navulid;  ?&gt;&quot; class=&quot;&lt;?php echo $navulclass; ?&gt;&quot;&gt;
</span><span class="cx">                                                 &lt;?php
</span><span class="cx">                                         }
</span><del>-                                        //Do NOT display UL
-                                        else
-                                        {
-
-                                        }
-
</del><span class="cx">                                 }
</span><span class="cx">                                 //DISPLAY default UL
</span><del>-                                else
-                                {
</del><ins>+                                else {
</ins><span class="cx">                                         ?&gt;
</span><span class="cx">                                         &lt;ul class=&quot;custom-nav&quot;&gt;
</span><span class="cx">                                         &lt;?php
</span><span class="lines">@@ -1152,33 +1125,23 @@
</span><span class="cx"> 
</span><span class="cx">                                                 &lt;?php
</span><span class="cx">                                                         //DISPLAY custom navigation menu
</span><del>-                                                        if (get_option('wp_custom_nav_menu') == 'true') {
-                                                        custom_nav('name='.$wp_custom_nav_menu_name.'&amp;desc='.$navwidgetdescription);
-                                                }
</del><ins>+                                                        if ( get_option('wp_custom_nav_menu') == 'true' )
+                                                        custom_nav( array('id' =&gt; $navmenu, 'name' =&gt; $wp_custom_nav_menu_name, 'desc' =&gt; $navwidgetdescription) );
</ins><span class="cx">                                                 ?&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;?php
</span><span class="cx"> 
</span><span class="cx">                                         //DEVELOPER settings enabled
</span><del>-                                        if ($navdeveloper == 'yes')
-                                        {
</del><ins>+                                        if ( $navdeveloper == 'yes' ) {
</ins><span class="cx">                                                 //DISPLAY Custom UL
</span><del>-                                                if ($navul == 'yes')
-                                                {
</del><ins>+                                                if ( $navul == 'yes' ) {
</ins><span class="cx">                                                         ?&gt;
</span><span class="cx">                                                         &lt;/ul&gt;
</span><span class="cx">                                                         &lt;?php
</span><span class="cx">                                                 }
</span><del>-                                                //Do NOT display UL
-                                                else
-                                                {
-
-                                                }
-
</del><span class="cx">                                         }
</span><span class="cx">                                         //DISPLAY default UL
</span><del>-                                        else
-                                        {
</del><ins>+                                        else {
</ins><span class="cx">                                                 ?&gt;
</span><span class="cx">                                                 &lt;/ul&gt;
</span><span class="cx">                                                 &lt;?php
</span><span class="lines">@@ -1186,16 +1149,13 @@
</span><span class="cx"> 
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                         &lt;?php
</span><ins>+                        } else {
+                                _e('You have not setup the custom navigation widget correctly, please check your settings in the backend.');
</ins><span class="cx">                         }
</span><del>-                        else
-                        {
-                                echo &quot;You have not setup the custom navigation widget correctly, please check your settings in the backend.&quot;;
-                        }
</del><span class="cx">                         ?&gt;
</span><span class="cx">                 &lt;?php
</span><span class="cx">                         //DEVELOPER settings enabled
</span><del>-                        if ($navdeveloper == 'yes')
-                        {
</del><ins>+                        if ($navdeveloper == 'yes') {
</ins><span class="cx">                                 //DISPLAY Custom DIV
</span><span class="cx">                                 if ($navdiv == 'yes')
</span><span class="cx">                                 {
</span><span class="lines">@@ -1240,14 +1200,10 @@
</span><span class="cx"> 
</span><span class="cx">                 global $wpdb;
</span><span class="cx"> 
</span><del>-                //GET Menu Items for SELECT OPTIONS
-                $table_name_custom_menus = $wpdb-&gt;prefix . &quot;custom_nav_menus&quot;;
-                $custom_menu_records = $wpdb-&gt;get_results(&quot;SELECT id,menu_name FROM &quot;.$table_name_custom_menus);
</del><ins>+                // Get menus
+                $custom_menus = get_terms( 'nav_menu', array( 'hide_empty' =&gt; false ) );
</ins><span class="cx"> 
</span><del>-                //CHECK if menus exist
-                if ($custom_menu_records &gt; 0)
-                {
-
</del><ins>+                if ( $custom_menus ) {
</ins><span class="cx">                         ?&gt;
</span><span class="cx"> 
</span><span class="cx">                          &lt;p&gt;
</span><span class="lines">@@ -1257,16 +1213,14 @@
</span><span class="cx">                                         &lt;?php
</span><span class="cx"> 
</span><span class="cx">                                         //DISPLAY SELECT OPTIONS
</span><del>-                                        foreach ($custom_menu_records as $custom_menu_record)
-                                        {
-                                                if ($navmenu == $custom_menu_record-&gt;id) {
</del><ins>+                                        foreach ( $custom_menus as $menu ) {
+                                                if ( $navmenu == $menu-&gt;term_id) {
</ins><span class="cx">                                                         $selected_option = 'selected=&quot;selected&quot;';
</span><del>-                                                }
-                                                else {
</del><ins>+                                                } else {
</ins><span class="cx">                                                         $selected_option = '';
</span><span class="cx">                                                 }
</span><span class="cx">                                                 ?&gt;
</span><del>-                                                &lt;option value=&quot;&lt;?php echo $custom_menu_record-&gt;id; ?&gt;&quot; &lt;?php echo $selected_option; ?&gt;&gt;&lt;?php echo $custom_menu_record-&gt;menu_name; ?&gt;&lt;/option&gt;
</del><ins>+                                                &lt;option value=&quot;&lt;?php echo $menu-&gt;term_id; ?&gt;&quot; &lt;?php echo $selected_option; ?&gt;&gt;&lt;?php echo $menu-&gt;name; ?&gt;&lt;/option&gt;
</ins><span class="cx">                                                 &lt;?php
</span><span class="cx"> 
</span><span class="cx">                                         }
</span><span class="lines">@@ -1276,7 +1230,6 @@
</span><span class="cx">                         &lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;p&gt;
</span><del>-
</del><span class="cx">                         &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('navtitle'); ?&gt;&quot;&gt;&lt;?php _e('Title:'); ?&gt;&lt;/label&gt;
</span><span class="cx">                             &lt;input type=&quot;text&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navtitle'); ?&gt;&quot; value=&quot;&lt;?php echo $navtitle; ?&gt;&quot; class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id('navtitle'); ?&gt;&quot; /&gt;
</span><span class="cx">                     &lt;/p&gt;
</span><span class="lines">@@ -1316,8 +1269,7 @@
</span><span class="cx"> 
</span><span class="cx">                         &lt;?php
</span><span class="cx"> 
</span><del>-                        if ($checked == 'yes')
-                        {
</del><ins>+                        if ( $checked == 'yes' ) {
</ins><span class="cx"> 
</span><span class="cx">                                 ?&gt;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>