<!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"> ?>
</span><span class="cx">                                         <dl>
</span><span class="cx">                                         <dt>
</span><del>-
-                                        <?php $templatedir = get_bloginfo('url'); ?>
</del><span class="cx">                                         <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>
</span><span class="cx">                                         </dl>
</span><span class="cx"> <?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->post_parent == 0) {
-                        // Custom Menu
</del><ins>+                if ( $post->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">                                 ?>
</span><span class="cx">
</span><span class="cx">                                 <li id="menu-<?php echo $intCounter; ?>" value="<?php echo $intCounter; ?>">
</span><del>-
-                                        <?php output_menu_item($post, 'menu', $intCounter); ?>
-
-                                        <?php $parentli = $post->ID; ?>
-                                        <?php $intCounter++; ?>
</del><span class="cx">                                         <?php
</span><del>-
-                                                //Recursive function
</del><ins>+                                                output_menu_item($post, 'menu', $intCounter);
+                                                $parentli = $post->ID;
+                                                $intCounter++;
</ins><span class="cx">                                                 $intCounter = wp_custom_navigation_default_sub_items($post->ID, $intCounter, $parentli, 'pages', 'menu');
</span><del>-
</del><span class="cx">                                         ?>
</span><del>-
</del><span class="cx">                                 </li>
</span><span class="cx">
</span><span class="cx">                                 <?php
</span><del>-
</del><span class="cx">                         } elseif ( $type == 'default' ) {
</span><span class="cx">                                 // Sidebar Menu
</span><span class="cx">                                 ?>
</span><del>-
</del><span class="cx">                                  <li>
</span><del>-                                        <dl>
-                                        <dt>
</del><span class="cx">                                         <?php
</span><del>-                                                $post_text = htmlentities($post->post_title);
-                                                $post_url = get_permalink($post->ID);
-                                                $post_id = $post->ID;
-                                                $post_parent_id = $post->post_parent;
-
-                                                $description = htmlentities(get_post_meta($post_id, 'page-description', true));
-
-                                        ?>
-                                        <?php $templatedir = get_bloginfo('url'); ?>
-
-                                        <span class="title"><?php echo $post->post_title; ?></span> <a onclick="appendToList('<?php echo $templatedir; ?>','Page','<?php echo $post_text; ?>','<?php echo $post_url; ?>','<?php echo $post_id; ?>','<?php echo $post_parent_id ?>','<?php echo $description; ?>')" name="<?php echo $post_text; ?>" value="<?php echo get_permalink($post->ID); ?>"><img alt="Add to Custom Menu" title="Add to Custom Menu" src="<?php echo get_bloginfo('url'); ?>/wp-admin/images/ico-add.png" /></a></dt>
-                                        </dl>
-                                        <?php $parentli = $post->ID; ?>
-                                        <?php $intCounter++; ?>
-                                        <?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->ID;
+                                                $intCounter++;
+                                                $intCounter = wp_custom_navigation_default_sub_items($post->ID, $intCounter, $parentli, 'pages', 'default');
</ins><span class="cx">                                          ?>
</span><del>-
</del><span class="cx">                                 </li>
</span><span class="cx">
</span><span class="cx">                                 <?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">                                 ?>
</span><span class="cx">
</span><span class="cx">                                 <li id="menu-<?php echo $intCounter; ?>" value="<?php echo $intCounter; ?>">
</span><del>-                                        <?php output_menu_item($cat_item, 'menu'); ?>
-                                        <?php $parentli = $cat_item->cat_ID; ?>
-                                        <?php $intCounter++; ?>
</del><span class="cx">                                         <?php
</span><del>-
-                                                // Recursive function
-                                                $intCounter = wp_custom_navigation_default_sub_items($cat_item->cat_ID, $intCounter, $parentli, 'categories','menu');
-
</del><ins>+                                                output_menu_item($cat_item, 'menu');
+                                                $parentli = $cat_item->cat_ID;
+                                                $intCounter++;
+                                                $intCounter = wp_custom_navigation_default_sub_items($cat_item->cat_ID, $intCounter, $parentli, 'categories', 'menu');
</ins><span class="cx">                                         ?>
</span><span class="cx">
</span><span class="cx">                                 </li>
</span><span class="lines">@@ -448,22 +416,10 @@
</span><span class="cx">                                 // Sidebar Menu
</span><span class="cx">                                 ?>
</span><span class="cx">                                 <li>
</span><del>-                                        <dl>
-                                        <dt>
</del><span class="cx">                                         <?php
</span><del>-                                        $post_text = htmlentities($cat_item->cat_name);
-                                        $post_url = get_category_link($cat_item->cat_ID);
-                                        $post_id = $cat_item->cat_ID;
-                                        $post_parent_id = $cat_item->parent;
-                                        $description = htmlentities(strip_tags($cat_item->description));
-                                        ?>
-                                        <?php $templatedir = get_bloginfo('url'); ?>
-                                        <span class="title"><?php echo esc_html($cat_item->cat_name); ?></span> <a onclick="appendToList('<?php echo $templatedir; ?>','Category','<?php echo $post_text; ?>','<?php echo $post_url; ?>','<?php echo $post_id; ?>','<?php echo $post_parent_id ?>','<?php echo $description; ?>')" name="<?php echo $post_text; ?>" value="<?php echo $post_url; ?>"><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 $parentli = $cat_item->cat_ID; ?>
-                                        <?php $intCounter++; ?>
-                                        <?php
-                                                // Recursive function
</del><ins>+                                                output_menu_item($cat_item, 'default');
+                                                $parentli = $cat_item->cat_ID;
+                                                $intCounter++;
</ins><span class="cx">                                                 $intCounter = wp_custom_navigation_default_sub_items($cat_item->cat_ID, $intCounter, $parentli, 'categories', 'default');
</span><span class="cx">                                         ?>
</span><span class="cx">
</span><span class="lines">@@ -517,70 +473,32 @@
</span><span class="cx">                 <?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->cat_ID);
-                                $title = htmlentities($sub_item->cat_name);
-                                $parent_id = $sub_item->cat_ID;
-                                $itemid = $sub_item->cat_ID;
-                                $linktype = 'category';
-                                $appendtype = 'Category';
-                                $description = htmlentities(strip_tags($sub_item->description));
-                        } elseif ( $type == 'pages' ) {
-                                //Page Menu Item
-                                $link = get_permalink($sub_item->ID);
-                                $title = htmlentities($sub_item->post_title);
-                                $parent_id = $sub_item->ID;
-                                $linktype = 'page';
-                                $itemid = $sub_item->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">                                 ?>
</span><span class="cx">                                 <li id="menu-<?php echo $counter; ?>" value="<?php echo $counter; ?>">
</span><del>-                                        <?php output_menu_item($sub_item, 'menu'); ?>
-                                        <?php $counter++; ?>
</del><span class="cx">                                         <?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->ID, $counter, $sub_item->ID, $type, 'menu');
</ins><span class="cx">                                         ?>
</span><span class="cx">
</span><span class="cx">                                 </li>
</span><span class="cx">                                 <?php
</span><del>-                        } elseif ($output_type == 'default') {
</del><ins>+                        } elseif ( $output_type == 'default' ) {
</ins><span class="cx">                                 // Sidebar Menu
</span><span class="cx">                                 ?>
</span><span class="cx">                                 <li>
</span><del>-                                        <dl>
-                                        <dt>
-
-                                        <?php $templatedir = get_bloginfo('url'); ?>
-                                        <span class="title"><?php echo $title; ?></span> <a onclick="appendToList('<?php echo $templatedir; ?>','<?php echo $appendtype; ?>','<?php echo $title; ?>','<?php echo $link; ?>','<?php echo $itemid; ?>','<?php echo $parent_id ?>','<?php echo $description; ?>')" name="<?php echo $title; ?>" value="<?php echo $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>
</del><span class="cx">                                         <?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->ID, $counter, $sub_item->ID, $type, 'default');
</ins><span class="cx">                                         ?>
</span><span class="cx">                                 </li>
</span><span class="cx">
</span><span class="cx">                                 <?php
</span><span class="cx">                         }
</span><del>-
</del><span class="cx">                 }
</span><span class="cx">                 ?>
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>