<!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->ID == $wp_query->get_queried_object_id() )
</span><span class="cx">                 $menu_item->li_class = 'class="current_page_item"';
</span><span class="cx">
</span><ins>+        $menu_item->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">                                                 <input type="hidden" name="newwindow<?php echo $menu_item->menu_order; ?>" id="newwindow<?php echo $menu_item->menu_order; ?>" value="<?php echo ( '' == $menu_item->post_content_filtered ? '0' : '1' ); ?>" />
</span><span class="cx"> <?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;
+?>
+                        <a title="<?php echo $menu_item->anchor_title; ?>" href="<?php echo $menu_item->link; ?>" <?php echo $menu_item->target; ?>><?php echo $args['before_title'] . $menu_item->title . $args['after_title']; ?><?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) ) {
+                                                                        ?><span class="nav-description"><?php echo $menu_item->description; ?></span><?php
+                                                                }
+                                                        } else {
+                                                                // 2 widget override do NOT display descriptions
+                                                                // 1 widget override display descriptions
+                                                                // 0 widget override not set
+                                                                if ( $args['desc'] == 1 ) {
+                                                                        ?><span class="nav-description"><?php echo $menu_item->description; ?></span><?php
+                                                                }
+                                                        }
+                                                ?></a>
+<?php
+                break;
+
+                case 'default':
+?>
+                                        <dl>
+                                        <dt>
+
+                                        <?php $templatedir = get_bloginfo('url'); ?>
+                                        <span class="title"><?php echo $menu_item->title; ?></span> <a onclick="appendToList('<?php echo $templatedir; ?>','<?php echo $menu_item->append; ?>','<?php echo $menu_item->title; ?>','<?php echo $menu_item->link; ?>','<?php echo $menu_item->ID; ?>','<?php echo $menu_item->parent_item ?>','<?php echo $menu_item->description; ?>')" name="<?php echo $menu_item->title; ?>" value="<?php echo $menu_item->link; ?>"><img alt="<?php esc_attr_e('Add to Custom Menu'); ?>" title="<?php esc_attr_e('Add to Custom Menu'); ?>" src="<?php echo admin_url('images/ico-add.png'); ?>" /></a> </dt>
+                                        </dl>
+<?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">                         ?><li id="menu-<?php echo $menu_item->ID; ?>" value="<?php echo $menu_item->ID; ?>" <?php echo $menu_item->li_class; ?>><?php
</span><del>-                                        //@todo: update front end to use post data
-                                        //FRONTEND Link
-                                        if ( $type == 'frontend' ) {
-                                                ?><a title="<?php echo $menu_item->anchor_title; ?>" href="<?php echo $menu_item->link; ?>" <?php echo $menu_item->target; ?>><?php echo $before_title.$menu_item->title.$after_title; ?><?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) ) {
-                                                                        ?><span class="nav-description"><?php echo $menu_item->description; ?></span><?php
-                                                                }
-                                                        } else {
-                                                                // 2 widget override do NOT display descriptions
-                                                                // 1 widget override display descriptions
-                                                                // 0 widget override not set
-                                                                if ( $desc == 1 ) {
-                                                                        ?><span class="nav-description"><?php echo $menu_item->description; ?></span><?php
-                                                                }
-                                                        }
-
-                                                ?></a><?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->menu_order );
</span><span class="cx">                         if ( $last_item || $current_parent != $menu_items[ $key + 1 ]->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' => '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' => __('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 > 0)
-                {
-                        $table_name_menus = $wpdb->prefix . "custom_nav_menus";
-                        $wp_result = $wpdb->get_results("SELECT menu_name FROM ".$table_name_menus." WHERE id='".$navmenu."'");
-                        $wp_custom_nav_menu_name = $wp_result[0]->menu_name;
</del><ins>+                // GET menu name
+                if ( $navmenu > 0 ) {
+                        $custom_menu = get_term( (int) $nav_menu, 'nav_menu' );
+                        $wp_custom_nav_menu_name = $custom_menu->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">                 ?>
</span><span class="cx">
</span><span class="cx">                 <?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">                                         ?>
</span><span class="cx">                                         <div id="<?php echo $navdivid; ?>" class="<?php echo $navdivclass; ?>">
</span><span class="cx">                                         <?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">                                 ?>
</span><span class="cx">                                 <div class="widget">
</span><span class="cx">                                 <?php
</span><span class="lines">@@ -1118,31 +1101,21 @@
</span><span class="cx">                         <h3><?php echo $navtitle; ?></h3>
</span><span class="cx">                         <?php
</span><span class="cx">
</span><del>-                        if ($menuexists)
-                        {
</del><ins>+                        if ( $menuexists ) {
</ins><span class="cx">                                 ?>
</span><span class="cx">                 <?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">                                                 ?>
</span><span class="cx">                                                 <ul id="<?php echo $navulid; ?>" class="<?php echo $navulclass; ?>">
</span><span class="cx">                                                 <?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">                                         ?>
</span><span class="cx">                                         <ul class="custom-nav">
</span><span class="cx">                                         <?php
</span><span class="lines">@@ -1152,33 +1125,23 @@
</span><span class="cx">
</span><span class="cx">                                                 <?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.'&desc='.$navwidgetdescription);
-                                         }
</del><ins>+                                                        if ( get_option('wp_custom_nav_menu') == 'true' )
+                                                 custom_nav( array('id' => $navmenu, 'name' => $wp_custom_nav_menu_name, 'desc' => $navwidgetdescription) );
</ins><span class="cx">                                                 ?>
</span><span class="cx">
</span><span class="cx">                                 <?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">                                                         ?>
</span><span class="cx">                                                         </ul>
</span><span class="cx">                                                         <?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">                                                 ?>
</span><span class="cx">                                                 </ul>
</span><span class="cx">                                                 <?php
</span><span class="lines">@@ -1186,16 +1149,13 @@
</span><span class="cx">
</span><span class="cx">                                 ?>
</span><span class="cx">                         <?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 "You have not setup the custom navigation widget correctly, please check your settings in the backend.";
-                        }
</del><span class="cx">                         ?>
</span><span class="cx">                 <?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->prefix . "custom_nav_menus";
-                $custom_menu_records = $wpdb->get_results("SELECT id,menu_name FROM ".$table_name_custom_menus);
</del><ins>+                // Get menus
+                $custom_menus = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
</ins><span class="cx">
</span><del>-                //CHECK if menus exist
-                if ($custom_menu_records > 0)
-                {
-
</del><ins>+                if ( $custom_menus ) {
</ins><span class="cx">                         ?>
</span><span class="cx">
</span><span class="cx">                          <p>
</span><span class="lines">@@ -1257,16 +1213,14 @@
</span><span class="cx">                                         <?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->id) {
</del><ins>+                                        foreach ( $custom_menus as $menu ) {
+                                                if ( $navmenu == $menu->term_id) {
</ins><span class="cx">                                                         $selected_option = 'selected="selected"';
</span><del>-                                                }
-                                                else {
</del><ins>+                                                } else {
</ins><span class="cx">                                                         $selected_option = '';
</span><span class="cx">                                                 }
</span><span class="cx">                                                 ?>
</span><del>-                                                <option value="<?php echo $custom_menu_record->id; ?>" <?php echo $selected_option; ?>><?php echo $custom_menu_record->menu_name; ?></option>
</del><ins>+                                                <option value="<?php echo $menu->term_id; ?>" <?php echo $selected_option; ?>><?php echo $menu->name; ?></option>
</ins><span class="cx">                                                 <?php
</span><span class="cx">
</span><span class="cx">                                         }
</span><span class="lines">@@ -1276,7 +1230,6 @@
</span><span class="cx">                         </p>
</span><span class="cx">
</span><span class="cx">                         <p>
</span><del>-
</del><span class="cx">                  <label for="<?php echo $this->get_field_id('navtitle'); ?>"><?php _e('Title:'); ?></label>
</span><span class="cx">                          <input type="text" name="<?php echo $this->get_field_name('navtitle'); ?>" value="<?php echo $navtitle; ?>" class="widefat" id="<?php echo $this->get_field_id('navtitle'); ?>" />
</span><span class="cx">                  </p>
</span><span class="lines">@@ -1316,8 +1269,7 @@
</span><span class="cx">
</span><span class="cx">                         <?php
</span><span class="cx">
</span><del>-                        if ($checked == 'yes')
-                        {
</del><ins>+                        if ( $checked == 'yes' ) {
</ins><span class="cx">
</span><span class="cx">                                 ?>
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>