From b446d77af9bcf4354a03a9601330454eb8c977fa Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 12 Feb 2008 09:02:02 +0000 Subject: [PATCH] Manage categories redesign. Add categories search. git-svn-id: https://develop.svn.wordpress.org/trunk@6799 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/categories.php | 28 ++++++++++++++++++++++++---- wp-admin/includes/template.php | 27 +++++++++++++-------------- wp-admin/link-manager.php | 2 +- wp-includes/taxonomy.php | 7 ++++++- 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 2fbdabec66..bf24c463b8 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -84,19 +84,39 @@ $messages[5] = __('Category not updated.');
+
-

add new)'), '#addcat') ?>

+

add new)'), '#addcat') ?>

-

+

+ +

+ + +

+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ - + - diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index a02d691f8d..fbfc3e0baa 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -6,8 +6,12 @@ // Dandy new recursive multiple category stuff. function cat_rows( $parent = 0, $level = 0, $categories = 0 ) { - if ( !$categories ) - $categories = get_categories( 'hide_empty=0' ); + if ( !$categories ) { + $args = array('hide_empty' => 0); + if ( !empty($_GET['s']) ) + $args['search'] = $_GET['s']; + $categories = get_categories( $args ); + } $children = _get_term_hierarchy('category'); @@ -38,26 +42,21 @@ function _cat_row( $category, $level, $name_override = false ) { $pad = str_repeat( '— ', $level ); if ( current_user_can( 'manage_categories' ) ) { - $edit = "".__( 'Edit' ).""; + $edit = "". ( $name_override ? $name_override : $pad . ' ' . $category->name ) .""; $default_cat_id = (int) get_option( 'default_category' ); - - if ( $category->term_id != $default_cat_id ) - $edit .= " - - + + - - \n\t\n"; + \n\t\n"; return apply_filters('cat_row', $output); } diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php index c939c9c712..6df201ae4e 100644 --- a/wp-admin/link-manager.php +++ b/wp-admin/link-manager.php @@ -117,7 +117,7 @@ $link_columns = apply_filters('manage_link_columns', $link_columns); if ( 'all' == $cat_id ) $cat_id = ''; $args = array('category' => $cat_id, 'hide_invisible' => 0, 'orderby' => $sqlorderby, 'hide_empty' => 0); -if ( $_GET['s'] ) +if ( !empty($_GET['s']) ) $args['search'] = $_GET['s']; $links = get_bookmarks( $args ); if ( $links ) { diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index c3ab070c2f..b08a5e6c15 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -525,7 +525,7 @@ function &get_terms($taxonomies, $args = '') { 'hide_empty' => true, 'exclude' => '', 'include' => '', 'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '', 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', - 'pad_counts' => false, 'offset' => ''); + 'pad_counts' => false, 'offset' => '', 'search' => ''); $args = wp_parse_args( $args, $defaults ); $args['number'] = absint( $args['number'] ); $args['offset'] = absint( $args['offset'] ); @@ -635,6 +635,11 @@ function &get_terms($taxonomies, $args = '') { } else $number = ''; + if ( !empty($search) ) { + $search = like_escape($search); + $where .= " AND (t.name LIKE '%$search%')"; + } + if ( 'all' == $fields ) $select_this = 't.*, tt.*'; else if ( 'ids' == $fields )
term_id ) . "' class='delete:the-list:cat-$category->term_id delete'>".__( 'Delete' ).""; - else - $edit .= "".__( "Default" ); - } else - $edit = ''; + } else { + $edit = ( $name_override ? $name_override : $pad . ' ' . $category->name ); + } $class = " class='alternate'" == $class ? '' : " class='alternate'"; $category->count = number_format_i18n( $category->count ); $posts_count = ( $category->count > 0 ) ? "$category->count" : $category->count; $output = "
$category->term_id" . ( $name_override ? $name_override : $pad . ' ' . $category->name ) . "$edit $category->description$posts_count$edit
$posts_count