inclue link list category as css class
===

I'd like to render some extra css classes in my wordpress links list, specifically id like to render the link category as a css class, so for example:

    link       : http://www.foobar.com/
    gategories : friends, colleagues
    name       : Foo Bar

Currentyly renders as:

    <a href="http://www.foobar.com/" target="_blank">Foo Bar</a>

But I want it to render as:

    <a href="http://www.foobar.com/" target="_blank" class="friends colleagues">Foo Bar</a>

I know that you use the following function to build the links list but i cant work out how to modify it to do what I need:

    function wp_list_bookmarks($args = '') {
    	$defaults = array(
    		'orderby' => 'name', 'order' => 'ASC',
    		'limit' => -1, 'category' => '', 'exclude_category' => '',
    		'category_name' => '', 'hide_invisible' => 1,
    		'show_updated' => 0, 'echo' => 1,
    		'categorize' => 1, 'title_li' => __('Bookmarks'),
    		'title_before' => '<h2>', 'title_after' => '</h2>',
    		'category_orderby' => 'name', 'category_order' => 'ASC',
    		'class' => 'linkcat', 'category_before' => '<li id="%id" class="%class">',
    		'category_after' => '</li>'
    	);
    
    	$r = wp_parse_args( $args, $defaults );
    	extract( $r, EXTR_SKIP );
    
    	$output = '';
    
    	if(1) {
    		//output one single list using title_li for the title
    		$bookmarks = get_bookmarks($r);
    
    		if ( !empty($bookmarks) ) {
    			if ( !empty( $title_li ) ){
    				$output .= str_replace(array('%id', '%class'), array("linkcat-$category", $class), $category_before);
    				$output .= "$title_before$title_li$title_after\n\t<ul class=\"xoxo blogroll $category\">\n";
    				$output .= _walk_bookmarks($bookmarks, $r);
    				$output .= "\n\t</ul>\n$category_after\n";
    			} else {
    				$output .= _walk_bookmarks($bookmarks, $r);
    			}
    		}
    	}
    
    	$output = apply_filters( 'wp_list_bookmarks', $output );
    
    	if ( !$echo )
    		return $output;
    	echo $output;
    }
    
    ?>

Thanks!

