if (!isset($nav_menu_option['auto_add'])) { $nav_menu_option['auto_add'] = array(); } if ($auto_add) { if (!in_array($nav_menu_selected_id, $nav_menu_option['auto_add'])) { $nav_menu_option['auto_add'][] = $nav_menu_selected_id; } } else { if (false !== ($key = array_search($nav_menu_selected_id, $nav_menu_option['auto_add']))) { unset($nav_menu_option['auto_add'][$key]); } } // Remove nonexistent/deleted menus $nav_menu_option['auto_add'] = array_intersect($nav_menu_option['auto_add'], nxt_get_nav_menus(array('fields' => 'ids'))); update_option('nav_menu_options', $nav_menu_option); nxt_defer_term_counting(false); do_action('nxt_update_nav_menu', $nav_menu_selected_id); $messages[] = '<div id="message" class="updated"><p>' . sprintf(__('The <strong>%s</strong> menu has been updated.'), $nav_menu_selected_title) . '</p></div>'; unset($menu_items, $unsorted_menu_items); } } break; } // Get all nav menus $nav_menus = nxt_get_nav_menus(array('orderby' => 'name')); // Get recently edited nav menu $recently_edited = (int) get_user_option('nav_menu_recently_edited'); // If there was no recently edited menu, and $nav_menu_selected_id is a nav menu, update recently edited menu. if (!$recently_edited && is_nav_menu($nav_menu_selected_id)) { $recently_edited = $nav_menu_selected_id; // Else if $nav_menu_selected_id is not a menu and not requesting that we create a new menu, but $recently_edited is a menu, grab that one.
/** * Updates the amount of terms in taxonomy. * * If there is a taxonomy callback applied, then it will be called for updating * the count. * * The default action is to count what the amount of terms have the relationship * of term ID. Once that is done, then update the database. * * @package NXTClass * @subpackage Taxonomy * @since 2.3.0 * @uses $nxtdb * * @param int|array $terms The term_taxonomy_id of the terms * @param string $taxonomy The context of the term. * @return bool If no terms will return false, and if successful will return true. */ function nxt_update_term_count($terms, $taxonomy, $do_deferred = false) { static $_deferred = array(); if ($do_deferred) { foreach ((array) array_keys($_deferred) as $tax) { nxt_update_term_count_now($_deferred[$tax], $tax); unset($_deferred[$tax]); } } if (empty($terms)) { return false; } if (!is_array($terms)) { $terms = array($terms); } if (nxt_defer_term_counting()) { if (!isset($_deferred[$taxonomy])) { $_deferred[$taxonomy] = array(); } $_deferred[$taxonomy] = array_unique(array_merge($_deferred[$taxonomy], $terms)); return true; } return nxt_update_term_count_now($terms, $taxonomy); }
/** * Performs post-import cleanup of files and the cache */ function import_end() { nxt_import_cleanup($this->id); nxt_cache_flush(); foreach (get_taxonomies() as $tax) { delete_option("{$tax}_children"); _get_term_hierarchy($tax); } nxt_defer_term_counting(false); nxt_defer_comment_counting(false); echo '<p>' . __('All done.', 'nxtclass-importer') . ' <a href="' . admin_url() . '">' . __('Have fun!', 'nxtclass-importer') . '</a>' . '</p>'; echo '<p>' . __('Remember to update the passwords and roles of imported users.', 'nxtclass-importer') . '</p>'; do_action('import_end'); }