<!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>[15078] trunk/wp-includes: Cleanups.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15078">15078</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-05-31 16:11:20 +0000 (Mon, 31 May 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Cleanups.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesdefaultfiltersphp">trunk/wp-includes/default-filters.php</a></li>
<li><a href="#trunkwpincludesnavmenuphp">trunk/wp-includes/nav-menu.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesdefaultfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/default-filters.php (15077 => 15078)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/default-filters.php        2010-05-31 15:47:53 UTC (rev 15077)
+++ trunk/wp-includes/default-filters.php        2010-05-31 16:11:20 UTC (rev 15078)
</span><span class="lines">@@ -229,10 +229,13 @@
</span><span class="cx"> add_action( 'transition_post_status', '_transition_post_status', 5, 3 );
</span><span class="cx"> add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' );
</span><span class="cx"> add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' );
</span><ins>+
+// Navigation menu actions
</ins><span class="cx"> add_action( 'trash_post', '_wp_trash_menu_item' );
</span><span class="cx"> add_action( 'untrash_post', '_wp_untrash_menu_item' );
</span><span class="cx"> add_action( 'delete_post', '_wp_delete_post_menu_item' );
</span><span class="cx"> add_action( 'delete_term', '_wp_delete_tax_menu_item' );
</span><ins>+add_action( 'transition_post_status', '_wp_auto_add_pages_to_menu', 10, 3 );
</ins><span class="cx">
</span><span class="cx"> // Post Thumbnail CSS class filtering
</span><span class="cx"> add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add' );
</span></span></pre></div>
<a id="trunkwpincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/nav-menu.php (15077 => 15078)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu.php        2010-05-31 15:47:53 UTC (rev 15077)
+++ trunk/wp-includes/nav-menu.php        2010-05-31 16:11:20 UTC (rev 15078)
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx"> * @uses get_term_by
</span><span class="cx"> *
</span><span class="cx"> * @param string $menu Menu id, slug or name
</span><del>- * @return mixed false if $menu param isn't supplied or term does not exist, menu object if successfull
</del><ins>+ * @return mixed false if $menu param isn't supplied or term does not exist, menu object if successful.
</ins><span class="cx"> */
</span><span class="cx"> function wp_get_nav_menu_object( $menu ) {
</span><span class="cx">         if ( ! $menu )
</span><span class="lines">@@ -30,15 +30,14 @@
</span><span class="cx">         if ( ! $menu_obj )
</span><span class="cx">                 $menu_obj = get_term_by( 'name', $menu, 'nav_menu' );
</span><span class="cx">
</span><del>-        if ( ! $menu_obj ) {
</del><ins>+        if ( ! $menu_obj )
</ins><span class="cx">                 $menu_obj = false;
</span><del>-        }
</del><span class="cx">
</span><span class="cx">         return $menu_obj;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Check if the given ID is a nav menu.
</del><ins>+ * Check if the given ID is a navigation menu.
</ins><span class="cx"> *
</span><span class="cx"> * Returns true if it is; false otherwise.
</span><span class="cx"> *
</span><span class="lines">@@ -65,7 +64,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Register nav menus for a theme.
</del><ins>+ * Register navigation menus for a theme.
</ins><span class="cx"> *
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> *
</span><span class="lines">@@ -80,7 +79,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Register nav menu for a theme.
</del><ins>+ * Register a navigation menu for a theme.
</ins><span class="cx"> *
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> *
</span><span class="lines">@@ -91,7 +90,7 @@
</span><span class="cx">         register_nav_menus( array( $location => $description ) );
</span><span class="cx"> }
</span><span class="cx"> /**
</span><del>- * Returns an array of all registered nav menus in a theme
</del><ins>+ * Returns an array of all registered navigation menus in a theme
</ins><span class="cx"> *
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> * @return array
</span><span class="lines">@@ -104,14 +103,14 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Returns an array with the registered nav menu locations and the menu assigned to it
</del><ins>+ * Returns an array with the registered navigation menu locations and the menu assigned to it
</ins><span class="cx"> *
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> * @return array
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> function get_nav_menu_locations() {
</span><del>-        return get_theme_mod('nav_menu_locations');
</del><ins>+        return get_theme_mod( 'nav_menu_locations' );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -129,16 +128,12 @@
</span><span class="cx"> /**
</span><span class="cx"> * Create a Navigation Menu.
</span><span class="cx"> *
</span><del>- * Optional args:
- * slug - the url friendly version of the nav menu.
- *
</del><span class="cx"> * @since 3.0.0
</span><span class="cx"> *
</span><span class="cx"> * @param string $menu_name Menu Name
</span><del>- * @param string $args Optional.
- * @return mixed Menu object on sucess|WP_Error on failure
</del><ins>+ * @return mixed Menu object on success|WP_Error on failure
</ins><span class="cx"> */
</span><del>-function wp_create_nav_menu( $menu_name, $args = array() ) {
</del><ins>+function wp_create_nav_menu( $menu_name ) {
</ins><span class="cx">         $menu_exists = get_term_by( 'name', $menu_name, 'nav_menu' );
</span><span class="cx">
</span><span class="cx">         if ( $menu_exists )
</span><span class="lines">@@ -151,12 +146,10 @@
</span><span class="cx">
</span><span class="cx">         $result = get_term( $menu['term_id'], 'nav_menu' );
</span><span class="cx">
</span><del>-        if ( $result && !is_wp_error($result) ) {
</del><ins>+        if ( $result && !is_wp_error($result) )
</ins><span class="cx">                 do_action( 'wp_create_nav_menu', $menu['term_id'] );
</span><del>-                return $result;
-        } else {
-                return $result;
-        }
</del><ins>+
+        return $result;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -165,15 +158,15 @@
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> *
</span><span class="cx"> * @param string $menu name|id|slug
</span><del>- * @return mixed Menu object on sucess|WP_Error on failure
</del><ins>+ * @return mixed Menu object on success|WP_Error on failure
</ins><span class="cx"> */
</span><span class="cx"> function wp_delete_nav_menu( $menu ) {
</span><span class="cx">         $menu = wp_get_nav_menu_object( $menu );
</span><del>-        if ( ! $menu )
</del><ins>+        if ( ! $menu )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><span class="cx">         $menu_objects = get_objects_in_term( $menu->term_id, 'nav_menu' );
</span><del>-        if ( !empty( $menu_objects ) ) {
</del><ins>+        if ( ! empty( $menu_objects ) ) {
</ins><span class="cx">                 foreach ( $menu_objects as $item ) {
</span><span class="cx">                         wp_delete_post( $item );
</span><span class="cx">                 }
</span><span class="lines">@@ -181,12 +174,10 @@
</span><span class="cx">
</span><span class="cx">         $result = wp_delete_term( $menu->term_id, 'nav_menu' );
</span><span class="cx">
</span><del>-        if ( $result && !is_wp_error($result) ) {
</del><ins>+        if ( $result && !is_wp_error($result) )
</ins><span class="cx">                 do_action( 'wp_delete_nav_menu', $menu->term_id );
</span><del>-                return $result;
-        } else {
-                return $result;
-        }
</del><ins>+
+        return $result;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -210,36 +201,34 @@
</span><span class="cx">         if ( is_wp_error( $_menu ) )
</span><span class="cx">                 return $_menu;
</span><span class="cx">
</span><del>-        if ( $_menu && isset( $_menu->term_id ) ) {
-                $args = array(
-                        'description' => ( isset( $menu_data['description'] ) ? $menu_data['description'] : '' ),
-                        'name' => ( isset( $menu_data['menu-name'] ) ? $menu_data['menu-name'] : '' ),
-                        'parent' => ( isset( $menu_data['parent'] ) ? (int) $menu_data['parent'] : 0 ),
-                        'slug' => null,
-                );
</del><ins>+        if ( ! $_menu || ! isset( $_menu->term_id ) )
+                return 0;
</ins><span class="cx">
</span><del>-                $menu_id = (int) $_menu->term_id;
</del><ins>+        $args = array(
+                'description' => ( isset( $menu_data['description'] ) ? $menu_data['description'] : '' ),
+                'name' => ( isset( $menu_data['menu-name'] ) ? $menu_data['menu-name'] : '' ),
+                'parent' => ( isset( $menu_data['parent'] ) ? (int) $menu_data['parent'] : 0 ),
+                'slug' => null,
+        );
</ins><span class="cx">
</span><del>-                // double-check that we're not changing a menu to the name of another
-                $_possible_existing = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' );
-                if (
-                        $_possible_existing &&
-                        ! is_wp_error( $_possible_existing ) &&
-                        isset( $_possible_existing->term_id ) &&
-                        $_possible_existing->term_id != $menu_id
-                ) {
-                        return new WP_Error( 'menu_exists', sprintf( __('The menu name <strong>%s</strong> conflicts with another menu name. Please try another.'), esc_html( $menu_data['menu-name'] ) ) );
-                }
</del><ins>+        $menu_id = (int) $_menu->term_id;
</ins><span class="cx">
</span><del>-                $update_response = wp_update_term( $menu_id, 'nav_menu', $args );
</del><ins>+        // double-check that we're not changing a menu to the name of another
+        $_possible_existing = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' );
+        if (
+                $_possible_existing &&
+                ! is_wp_error( $_possible_existing ) &&
+                isset( $_possible_existing->term_id ) &&
+                $_possible_existing->term_id != $menu_id
+        )
+                return new WP_Error( 'menu_exists', sprintf( __('The menu name <strong>%s</strong> conflicts with another menu name. Please try another.'), esc_html( $menu_data['menu-name'] ) ) );
</ins><span class="cx">
</span><del>-                if ( ! is_wp_error( $update_response ) )
-                        return $menu_id;
-                else
-                        return $update_response;
-        } else {
-                return 0;
-        }
</del><ins>+        $update_response = wp_update_term( $menu_id, 'nav_menu', $args );
+
+        if ( ! is_wp_error( $update_response ) )
+                return $menu_id;
+        else
+                return $update_response;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -315,18 +304,16 @@
</span><span class="cx">                         $original_parent = (int) $original_object->post_parent;
</span><span class="cx">                         $original_title = $original_object->post_title;
</span><span class="cx">
</span><del>-                        if ( 'trash' == get_post_status( $args['menu-item-object-id'] ) ) {
</del><ins>+                        if ( 'trash' == get_post_status( $args['menu-item-object-id'] ) )
</ins><span class="cx">                                 return new WP_Error('update_nav_menu_item_failed', sprintf(__('The menu item "%1$s" belongs to something that is in the trash, so it cannot be updated.'), $args['menu-item-title'] ) );
</span><del>-                        }
</del><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 if ( empty( $args['menu-item-title'] ) || $args['menu-item-title'] == $original_title ) {
</span><span class="cx">                         $args['menu-item-title'] = '';
</span><span class="cx">
</span><span class="cx">                         // hack to get wp to create a post object when too many properties are empty
</span><del>-                        if ( empty( $args['menu-item-description'] ) ) {
</del><ins>+                        if ( empty( $args['menu-item-description'] ) )
</ins><span class="cx">                                 $args['menu-item-description'] = ' ';
</span><del>-                        }
</del><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -362,29 +349,29 @@
</span><span class="cx">                 $args['menu-item-object'] = 'custom';
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        if ( $menu_item_db_id && ! is_wp_error( $menu_item_db_id ) ) {
</del><ins>+        if ( ! $menu_item_db_id || is_wp_error( $menu_item_db_id ) )
+                return $menu_item_db_id;
</ins><span class="cx">
</span><del>-                $menu_item_db_id = (int) $menu_item_db_id;
</del><ins>+        $menu_item_db_id = (int) $menu_item_db_id;
</ins><span class="cx">
</span><del>-                update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key($args['menu-item-type']) );
-                update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', (int) $args['menu-item-parent-id'] );
-                update_post_meta( $menu_item_db_id, '_menu_item_object_id', (int) $args['menu-item-object-id'] );
-                update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key($args['menu-item-object']) );
-                update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key($args['menu-item-target']) );
-                
-                $args['menu-item-classes'] = array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-classes'] ) );
-                $args['menu-item-xfn'] = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-xfn'] ) ) );
-                update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] );
-                update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] );
-                update_post_meta( $menu_item_db_id, '_menu_item_url', esc_url_raw($args['menu-item-url']) );
-                
-                if ( 0 == $menu_id )
-                        update_post_meta( $menu_item_db_id, '_menu_item_orphaned', time() );
-                else
-                        delete_post_meta( $menu_item_db_id, '_menu_item_orphaned' );
</del><ins>+        update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key($args['menu-item-type']) );
+        update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', (int) $args['menu-item-parent-id'] );
+        update_post_meta( $menu_item_db_id, '_menu_item_object_id', (int) $args['menu-item-object-id'] );
+        update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key($args['menu-item-object']) );
+        update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key($args['menu-item-target']) );
+        
+        $args['menu-item-classes'] = array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-classes'] ) );
+        $args['menu-item-xfn'] = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-xfn'] ) ) );
+        update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] );
+        update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] );
+        update_post_meta( $menu_item_db_id, '_menu_item_url', esc_url_raw($args['menu-item-url']) );
+        
+        if ( 0 == $menu_id )
+                update_post_meta( $menu_item_db_id, '_menu_item_orphaned', time() );
+        else
+                delete_post_meta( $menu_item_db_id, '_menu_item_orphaned' );
</ins><span class="cx">
</span><del>-                do_action('wp_update_nav_menu_item', $menu_id, $menu_item_db_id, $args );
-        }
</del><ins>+        do_action('wp_update_nav_menu_item', $menu_id, $menu_item_db_id, $args );
</ins><span class="cx">
</span><span class="cx">         return $menu_item_db_id;
</span><span class="cx"> }
</span><span class="lines">@@ -403,7 +390,6 @@
</span><span class="cx">         return get_terms( 'nav_menu', $args);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-
</del><span class="cx"> /**
</span><span class="cx"> * Sort menu items by the desired key.
</span><span class="cx"> *
</span><span class="lines">@@ -414,30 +400,24 @@
</span><span class="cx"> * @param object $b The second object to compare
</span><span class="cx"> * @return int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b.
</span><span class="cx"> */
</span><del>-function _sort_nav_menu_items($a, $b) {
</del><ins>+function _sort_nav_menu_items( $a, $b ) {
</ins><span class="cx">         global $_menu_item_sort_prop;
</span><span class="cx">
</span><del>-        if ( empty( $_menu_item_sort_prop ) ) {
</del><ins>+        if ( empty( $_menu_item_sort_prop ) )
</ins><span class="cx">                 return 0;
</span><del>-        }
</del><span class="cx">
</span><del>-        if ( isset( $a->$_menu_item_sort_prop ) && isset( $b->$_menu_item_sort_prop ) ) {
-                $_a = (int) $a->$_menu_item_sort_prop;
-                $_b = (int) $b->$_menu_item_sort_prop;
</del><ins>+        if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) )
+                return 0;
</ins><span class="cx">
</span><del>-                if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop ) {
-                        return 0;
-                } elseif (
-                        ( $_a == $a->$_menu_item_sort_prop ) &&
-                        ( $_b == $b->$_menu_item_sort_prop )
-                ) {
-                        return $_a < $_b ? -1 : 1;
-                } else {
-                        return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop );
-                }
-        } else {
</del><ins>+        $_a = (int) $a->$_menu_item_sort_prop;
+        $_b = (int) $b->$_menu_item_sort_prop;
+
+        if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop )
</ins><span class="cx">                 return 0;
</span><del>-        }
</del><ins>+        elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop )
+                return $_a < $_b ? -1 : 1;
+        else
+                return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -464,8 +444,9 @@
</span><span class="cx">         if ( empty( $items ) )
</span><span class="cx">                 return $items;
</span><span class="cx">
</span><del>-        $defaults = array( 'order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'nav_menu_item', 'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order', 'nopaging' => true,
-                                         'update_post_term_cache' => false);
</del><ins>+        $defaults = array( 'order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'nav_menu_item',
+                'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order', 'nopaging' => true,
+                'update_post_term_cache' => false );
</ins><span class="cx">         $args = wp_parse_args( $args, $defaults );
</span><span class="cx">         if ( count( $items ) > 1 )
</span><span class="cx">                 $args['include'] = implode( ',', $items );
</span><span class="lines">@@ -478,14 +459,14 @@
</span><span class="cx">                 return false;
</span><span class="cx">
</span><span class="cx">         // Get all posts and terms at once to prime the caches
</span><del>-        if ( empty($fetched[$menu->term_id]) || $_wp_using_ext_object_cache ) {
</del><ins>+        if ( empty( $fetched[$menu->term_id] ) || $_wp_using_ext_object_cache ) {
</ins><span class="cx">                 $fetched[$menu->term_id] = true;
</span><span class="cx">                 $posts = array();
</span><span class="cx">                 $terms = array();
</span><span class="cx">                 foreach ( $items as $item ) {
</span><span class="cx">                         $object_id = get_post_meta( $item->ID, '_menu_item_object_id', true );
</span><del>-                        $object = get_post_meta( $item->ID, '_menu_item_object', true );
-                        $type = get_post_meta( $item->ID, '_menu_item_type', true );
</del><ins>+                        $object = get_post_meta( $item->ID, '_menu_item_object', true );
+                        $type = get_post_meta( $item->ID, '_menu_item_type', true );
</ins><span class="cx">
</span><span class="cx">                         if ( 'post_type' == $type )
</span><span class="cx">                                 $posts[$object][] = $object_id;
</span><span class="lines">@@ -493,14 +474,14 @@
</span><span class="cx">                                 $terms[$object][] = $object_id;
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                if ( !empty($posts) ) {
</del><ins>+                if ( ! empty( $posts ) ) {
</ins><span class="cx">                         foreach ( array_keys($posts) as $post_type ) {
</span><span class="cx">                                 get_posts( array('post__in' => $posts[$post_type], 'post_type' => $post_type, 'nopaging' => true, 'update_post_term_cache' => false) );
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">                 unset($posts);
</span><span class="cx">
</span><del>-                if ( !empty($terms) ) {
</del><ins>+                if ( ! empty( $terms ) ) {
</ins><span class="cx">                         foreach ( array_keys($terms) as $taxonomy ) {
</span><span class="cx">                                 get_terms($taxonomy, array('include' => $terms[$taxonomy]) );
</span><span class="cx">                         }
</span><span class="lines">@@ -655,7 +636,7 @@
</span><span class="cx">         );
</span><span class="cx">         foreach( (array) $menu_items as $menu_item ) {
</span><span class="cx">                 if ( isset( $menu_item->ID ) && is_nav_menu_item( $menu_item->ID ) ) {
</span><del>-                        if ( get_post_meta($menu_item->ID, '_menu_item_type', true) != $object_type )
</del><ins>+                        if ( get_post_meta( $menu_item->ID, '_menu_item_type', true ) != $object_type )
</ins><span class="cx">                                 continue;
</span><span class="cx">
</span><span class="cx">                         $menu_item_ids[] = (int) $menu_item->ID;
</span><span class="lines">@@ -784,6 +765,5 @@
</span><span class="cx">                 wp_update_nav_menu_item( $menu_id, 0, $args );
</span><span class="cx">         }
</span><span class="cx"> }
</span><del>-add_action( 'transition_post_status', '_wp_auto_add_pages_to_menu', 10, 3 );
</del><span class="cx">
</span><span class="cx"> ?>
</span></span></pre>
</div>
</div>
</body>
</html>