<!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>[13338] trunk/wp-includes/custom-navigation.php: More output consolidation.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13338">13338</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-02-23 20:22:56 +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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludescustomnavigationphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/custom-navigation.php (13337 => 13338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/custom-navigation.php        2010-02-23 19:58:53 UTC (rev 13337)
+++ trunk/wp-includes/custom-navigation.php        2010-02-23 20:22:56 UTC (rev 13338)
</span><span class="lines">@@ -227,11 +227,10 @@
</span><span class="cx">                 break;
</span><span class="cx"> 
</span><span class="cx">                 case 'default':
</span><ins>+                        $templatedir = get_bloginfo('url');
</ins><span class="cx"> ?&gt;
</span><span class="cx">                                         &lt;dl&gt;
</span><span class="cx">                                         &lt;dt&gt;
</span><del>-
-                                        &lt;?php $templatedir = get_bloginfo('url'); ?&gt;
</del><span class="cx">                                         &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;
</span><span class="cx">                                         &lt;/dl&gt;
</span><span class="cx"> &lt;?php
</span><span class="lines">@@ -333,62 +332,34 @@
</span><span class="cx"> 
</span><span class="cx">         // Display Loop
</span><span class="cx">         foreach ( $pages_array as $post ) {
</span><del>-                if ($post-&gt;post_parent == 0) {
-                        // Custom Menu
</del><ins>+                if ( $post-&gt;post_parent == 0 ) {
+                        $post = setup_menu_item($post, 'page', $intCounter);
</ins><span class="cx">                         if ( $type == 'menu' ) {
</span><del>-                                $post = setup_menu_item($post, 'page', $intCounter);
</del><span class="cx">                                 ?&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;li id=&quot;menu-&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo $intCounter; ?&gt;&quot;&gt;
</span><del>-
-                                        &lt;?php output_menu_item($post, 'menu', $intCounter); ?&gt;
-
-                                        &lt;?php $parentli = $post-&gt;ID; ?&gt;
-                                        &lt;?php $intCounter++; ?&gt;
</del><span class="cx">                                         &lt;?php
</span><del>-
-                                                //Recursive function
</del><ins>+                                                output_menu_item($post, 'menu', $intCounter);
+                                                $parentli = $post-&gt;ID;
+                                                $intCounter++;
</ins><span class="cx">                                                 $intCounter = wp_custom_navigation_default_sub_items($post-&gt;ID, $intCounter, $parentli, 'pages', 'menu');
</span><del>-
</del><span class="cx">                                         ?&gt;
</span><del>-
</del><span class="cx">                                 &lt;/li&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;?php
</span><del>-
</del><span class="cx">                         } elseif ( $type == 'default' ) {
</span><span class="cx">                                 // Sidebar Menu
</span><span class="cx">                                 ?&gt;
</span><del>-
</del><span class="cx">                                  &lt;li&gt;
</span><del>-                                        &lt;dl&gt;
-                                        &lt;dt&gt;
</del><span class="cx">                                         &lt;?php
</span><del>-                                                $post_text = htmlentities($post-&gt;post_title);
-                                                $post_url = get_permalink($post-&gt;ID);
-                                                $post_id = $post-&gt;ID;
-                                                $post_parent_id = $post-&gt;post_parent;
-
-                                                $description = htmlentities(get_post_meta($post_id, 'page-description', true));
-
-                                        ?&gt;
-                                        &lt;?php $templatedir = get_bloginfo('url'); ?&gt;
-
-                                        &lt;span class=&quot;title&quot;&gt;&lt;?php echo $post-&gt;post_title; ?&gt;&lt;/span&gt; &lt;a onclick=&quot;appendToList('&lt;?php echo $templatedir; ?&gt;','Page','&lt;?php echo $post_text; ?&gt;','&lt;?php echo $post_url; ?&gt;','&lt;?php echo $post_id; ?&gt;','&lt;?php echo $post_parent_id ?&gt;','&lt;?php echo $description; ?&gt;')&quot; name=&quot;&lt;?php echo $post_text; ?&gt;&quot; value=&quot;&lt;?php echo get_permalink($post-&gt;ID); ?&gt;&quot;&gt;&lt;img alt=&quot;Add to Custom Menu&quot; title=&quot;Add to Custom Menu&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-add.png&quot; /&gt;&lt;/a&gt;&lt;/dt&gt;
-                                        &lt;/dl&gt;
-                                        &lt;?php $parentli = $post-&gt;ID; ?&gt;
-                                        &lt;?php $intCounter++; ?&gt;
-                                        &lt;?php
-
-                                                //Recursive function
-                                                $intCounter = wp_custom_navigation_default_sub_items($post_id, $intCounter, $parentli, 'pages', 'default');
-
</del><ins>+                                                output_menu_item($post, 'default');
+                                                $parentli = $post-&gt;ID;
+                                                $intCounter++;
+                                                $intCounter = wp_custom_navigation_default_sub_items($post-&gt;ID, $intCounter, $parentli, 'pages', 'default');
</ins><span class="cx">                                          ?&gt;
</span><del>-
</del><span class="cx">                                 &lt;/li&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;?php
</span><del>-
</del><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -418,7 +389,7 @@
</span><span class="cx">         $categories_array = get_categories($category_args);
</span><span class="cx"> 
</span><span class="cx">         if ( !$categories_array ) {
</span><del>-                echo 'Not Found';
</del><ins>+                _e('Not Found');
</ins><span class="cx">                 return $intCounter;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -431,14 +402,11 @@
</span><span class="cx">                                 ?&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;li id=&quot;menu-&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo $intCounter; ?&gt;&quot;&gt;
</span><del>-                                        &lt;?php output_menu_item($cat_item, 'menu'); ?&gt;
-                                        &lt;?php $parentli = $cat_item-&gt;cat_ID; ?&gt;
-                                        &lt;?php $intCounter++; ?&gt;
</del><span class="cx">                                         &lt;?php
</span><del>-
-                                                // Recursive function
-                                                $intCounter = wp_custom_navigation_default_sub_items($cat_item-&gt;cat_ID, $intCounter, $parentli, 'categories','menu');
-
</del><ins>+                                                output_menu_item($cat_item, 'menu');
+                                                $parentli = $cat_item-&gt;cat_ID;
+                                                $intCounter++;
+                                                $intCounter = wp_custom_navigation_default_sub_items($cat_item-&gt;cat_ID, $intCounter, $parentli, 'categories', 'menu');
</ins><span class="cx">                                         ?&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;/li&gt;
</span><span class="lines">@@ -448,22 +416,10 @@
</span><span class="cx">                                 // Sidebar Menu
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                                 &lt;li&gt;
</span><del>-                                        &lt;dl&gt;
-                                        &lt;dt&gt;
</del><span class="cx">                                         &lt;?php
</span><del>-                                        $post_text = htmlentities($cat_item-&gt;cat_name);
-                                        $post_url = get_category_link($cat_item-&gt;cat_ID);
-                                        $post_id = $cat_item-&gt;cat_ID;
-                                        $post_parent_id = $cat_item-&gt;parent;
-                                        $description = htmlentities(strip_tags($cat_item-&gt;description));
-                                        ?&gt;
-                                        &lt;?php $templatedir = get_bloginfo('url'); ?&gt;
-                                        &lt;span class=&quot;title&quot;&gt;&lt;?php echo esc_html($cat_item-&gt;cat_name); ?&gt;&lt;/span&gt; &lt;a onclick=&quot;appendToList('&lt;?php echo $templatedir; ?&gt;','Category','&lt;?php echo $post_text; ?&gt;','&lt;?php echo $post_url; ?&gt;','&lt;?php echo $post_id; ?&gt;','&lt;?php echo $post_parent_id ?&gt;','&lt;?php echo $description; ?&gt;')&quot; name=&quot;&lt;?php echo $post_text; ?&gt;&quot; value=&quot;&lt;?php echo $post_url;  ?&gt;&quot;&gt;&lt;img alt=&quot;=&quot;&lt;?php esc_attr_e('Add to Custom Menu'); ?&gt;&quot; title=&quot;=&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 $parentli = $cat_item-&gt;cat_ID; ?&gt;
-                                        &lt;?php $intCounter++; ?&gt;
-                                        &lt;?php
-                                                // Recursive function
</del><ins>+                                                output_menu_item($cat_item, 'default');
+                                                $parentli = $cat_item-&gt;cat_ID;
+                                                $intCounter++;
</ins><span class="cx">                                                 $intCounter = wp_custom_navigation_default_sub_items($cat_item-&gt;cat_ID, $intCounter, $parentli, 'categories', 'default');
</span><span class="cx">                                         ?&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -517,70 +473,32 @@
</span><span class="cx">                 &lt;?php
</span><span class="cx">                 // Display Loop
</span><span class="cx">                 foreach ( $sub_array as $sub_item ) {
</span><del>-                        // Prepare Menu Data
</del><span class="cx">                         $sub_item = setup_menu_item($sub_item, $item_type, $counter);
</span><span class="cx"> 
</span><del>-                        if ( $type == 'categories' ) {
-                                // Category Menu Item
-                                $link = get_category_link($sub_item-&gt;cat_ID);
-                                $title = htmlentities($sub_item-&gt;cat_name);
-                                $parent_id = $sub_item-&gt;cat_ID;
-                                $itemid = $sub_item-&gt;cat_ID;
-                                $linktype = 'category';
-                                $appendtype = 'Category';
-                                $description = htmlentities(strip_tags($sub_item-&gt;description));
-                        } elseif ( $type == 'pages' ) {
-                                //Page Menu Item
-                                $link = get_permalink($sub_item-&gt;ID);
-                                $title = htmlentities($sub_item-&gt;post_title);
-                                $parent_id = $sub_item-&gt;ID;
-                                $linktype = 'page';
-                                $itemid = $sub_item-&gt;ID;
-                                $appendtype = 'Page';
-                                $description = htmlentities(get_post_meta($itemid, 'page-description', true));
-                        } else {
-                                // Custom Menu Item
-                                $title = '';
-                                $linktype = 'custom';
-                                $appendtype= 'Custom';
-                        }
-
-                        // Custom Menu
</del><span class="cx">                         if ( $output_type == 'menu' ) {
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                                 &lt;li id=&quot;menu-&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $counter; ?&gt;&quot;&gt;
</span><del>-                                        &lt;?php output_menu_item($sub_item, 'menu'); ?&gt;
-                                        &lt;?php $counter++; ?&gt;
</del><span class="cx">                                         &lt;?php
</span><del>-
-                                                // Do recursion
-                                                $counter = wp_custom_navigation_default_sub_items($parent_id, $counter, $parent_id, $type, 'menu');
-
</del><ins>+                                                output_menu_item($sub_item, 'menu');
+                                                $counter++;
+                                                $counter = wp_custom_navigation_default_sub_items($sub_item-&gt;ID, $counter, $sub_item-&gt;ID, $type, 'menu');
</ins><span class="cx">                                         ?&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;/li&gt;
</span><span class="cx">                                 &lt;?php
</span><del>-                        } elseif ($output_type == 'default') {
</del><ins>+                        } elseif ( $output_type == 'default' ) {
</ins><span class="cx">                                 // Sidebar Menu
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                                 &lt;li&gt;
</span><del>-                                        &lt;dl&gt;
-                                        &lt;dt&gt;
-
-                                        &lt;?php $templatedir = get_bloginfo('url'); ?&gt;
-                                        &lt;span class=&quot;title&quot;&gt;&lt;?php echo $title; ?&gt;&lt;/span&gt; &lt;a onclick=&quot;appendToList('&lt;?php echo $templatedir; ?&gt;','&lt;?php echo $appendtype; ?&gt;','&lt;?php echo $title; ?&gt;','&lt;?php echo $link; ?&gt;','&lt;?php echo $itemid; ?&gt;','&lt;?php echo $parent_id ?&gt;','&lt;?php echo $description; ?&gt;')&quot; name=&quot;&lt;?php echo $title; ?&gt;&quot; value=&quot;&lt;?php echo $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;
</del><span class="cx">                                         &lt;?php
</span><del>-
-                                                // Do recursion
-                                                $counter = wp_custom_navigation_default_sub_items($itemid, $counter, $parent_id, $type, 'default');
-
</del><ins>+                                                output_menu_item($sub_item, 'default');
+                                                //$counter++;
+                                                $counter = wp_custom_navigation_default_sub_items($sub_item-&gt;ID, $counter, $sub_item-&gt;ID, $type, 'default');
</ins><span class="cx">                                         ?&gt;
</span><span class="cx">                                 &lt;/li&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;?php
</span><span class="cx">                         }
</span><del>-
</del><span class="cx">                 }
</span><span class="cx">                 ?&gt;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>