From 65fdf82523ea65f8df0ff66d84ef1125f99a440d Mon Sep 17 00:00:00 2001 From: donncha Date: Tue, 25 Jul 2006 12:01:00 +0000 Subject: WP Merge git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@707 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/admin-functions.php | 55 ++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'wp-admin/admin-functions.php') diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 8fa5184..9ab92cb 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -700,31 +700,7 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) { continue; } if ($category->category_parent == $parent) { - $category->cat_name = wp_specialchars($category->cat_name,'double'); - $pad = str_repeat('— ', $level); - if ( current_user_can('manage_categories') ) { - $edit = "".__('Edit').""; - $default_cat_id = get_option('default_category'); - $default_link_cat_id = get_option('default_link_category'); - - if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) ) - $edit .= "cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . sprintf(__("You are about to delete the category "%s".\\nAll of its posts will go into the default category of "%s"\\nAll of its bookmarks will go into the default category of "%s".\\n"OK" to delete, "Cancel" to stop."), js_escape($category->cat_name), js_escape(get_catname($default_cat_id)), js_escape(get_catname($default_link_cat_id))) . "' );\" class='delete'>".__('Delete').""; - else - $edit .= "".__("Default"); - } - else - $edit = ''; - - $class = ('alternate' == $class) ? '' : 'alternate'; - - $category->category_count = number_format( $category->category_count ); - $category->link_count = number_format( $category->link_count ); - echo "$category->cat_ID$pad $category->cat_name - $category->category_description - $category->category_count - $category->link_count - $edit - "; + echo "\t" . _cat_row( $category, $level ); cat_rows($category->cat_ID, $level +1, $categories); } } @@ -733,6 +709,35 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) { } } +function _cat_row( $category, $level, $name_override = false ) { + global $class; + + $pad = str_repeat('— ', $level); + if ( current_user_can('manage_categories') ) { + $edit = "".__('Edit').""; + $default_cat_id = get_option('default_category'); + $default_link_cat_id = get_option('default_link_category'); + + if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) ) + $edit .= "cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . sprintf(__("You are about to delete the category "%s".\\nAll of its posts will go into the default category of "%s"\\nAll of its bookmarks will go into the default category of "%s".\\n"OK" to delete, "Cancel" to stop."), js_escape($category->cat_name), js_escape(get_catname($default_cat_id)), js_escape(get_catname($default_link_cat_id))) . "' );\" class='delete'>".__('Delete').""; + else + $edit .= "".__("Default"); + } else + $edit = ''; + + $class = ( ( defined('DOING_AJAX') && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'"; + + $category->category_count = number_format( $category->category_count ); + $category->link_count = number_format( $category->link_count ); + return " + $category->cat_ID + " . ( $name_override ? $name_override : $pad . ' ' . $category->cat_name ) . " + $category->category_description + $category->category_count + $category->link_count + $edit\n\t\n"; +} + function page_rows($parent = 0, $level = 0, $pages = 0, $hierarchy = true) { global $wpdb, $class, $post; -- cgit