From 346990432c386b751bb5e9904ecdb6b481389763 Mon Sep 17 00:00:00 2001 From: rboren Date: Tue, 23 Mar 2004 04:45:27 +0000 Subject: [PATCH] Add feed and feed_image options to wp_list_cats() and wp_list_authors(). git-svn-id: http://svn.automattic.com/wordpress/trunk@987 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/template-functions-author.php | 47 +++++++++++++++++++-- wp-includes/template-functions-category.php | 42 ++++++++++++++++-- 2 files changed, 81 insertions(+), 8 deletions(-) diff --git a/wp-includes/template-functions-author.php b/wp-includes/template-functions-author.php index fad647bddf..b8331328b4 100644 --- a/wp-includes/template-functions-author.php +++ b/wp-includes/template-functions-author.php @@ -106,11 +106,13 @@ function wp_list_authors($args = '') { if (!isset($r['exclude_admin'])) $r['exclude_admin'] = true; if (!isset($r['show_fullname'])) $r['show_fullname'] = false; if (!isset($r['hide_empty'])) $r['hide_empty'] = true; + if (!isset($r['feed'])) $r['feed'] = ''; + if (!isset($r['feed_image'])) $r['feed_image'] = ''; - list_authors($r['optioncount'], $r['exclude_admin'], $r['show_fullname'], $r[hide_empty]); + list_authors($r['optioncount'], $r['exclude_admin'], $r['show_fullname'], $r[hide_empty], $r['feed'], $r['feed_image']); } -function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true) { +function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { global $tableusers, $wpdb, $blogfilename; $query = "SELECT ID, user_nickname, user_firstname, user_lastname, user_nicename from $tableusers " . ($exclude_admin ? "WHERE user_nickname <> 'admin' " : '') . "ORDER BY user_nickname"; @@ -128,9 +130,46 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam if ($posts == 0) { if (! $hide_empty) echo $name; } else { - echo '' . $name . ($optioncount ? " ($posts)" : '').""; + $link = '' . stripslashes($name) . ''; + + if ( (! empty($feed_image)) || (! empty($feed)) ) { + + $link .= ' '; + + if (empty($feed_image)) { + $link .= '('; + } + + $link .= ''; + } else { + $link .= $name; + } + + $link .= ''; + + if (empty($feed_image)) { + $link .= ')'; + } + } + + if ($optioncount) { + $link .= ' ('. $posts . ')'; + } } - if (! ($posts == 0 && $hide_empty)) echo ""; + + if (! ($posts == 0 && $hide_empty)) echo "$link"; } } diff --git a/wp-includes/template-functions-category.php b/wp-includes/template-functions-category.php index e058516f39..f59ec1ae35 100644 --- a/wp-includes/template-functions-category.php +++ b/wp-includes/template-functions-category.php @@ -247,12 +247,13 @@ function wp_list_cats($args = '') { if (!isset($r['child_of'])) $r['child_of'] = 0; if (!isset($r['categories'])) $r['categories'] = 0; if (!isset($r['recurse'])) $r['recurse'] = 0; - list_cats($r['optionall'], $r['all'], $r['sort_column'], $r['sort_order'], $r['file'], - $r['list'], $r['optiondates'], $r['optioncount'], $r['hide_empty'], $r['use_desc_for_title'], - $r['children'], $r['child_of'], $r['categories'], $r['recurse']); + if (!isset($r['feed'])) $r['feed'] = ''; + if (!isset($r['feed_image'])) $r['feed_image'] = ''; + + list_cats($r['optionall'], $r['all'], $r['sort_column'], $r['sort_order'], $r['file'], $r['list'], $r['optiondates'], $r['optioncount'], $r['hide_empty'], $r['use_desc_for_title'], $r['children'], $r['child_of'], $r['categories'], $r['recurse'], $r['feed'], $r['feed_image']); } -function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0) { +function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '') { global $tablecategories, $tableposts, $tablepost2cat, $wpdb; global $pagenow; global $querystring_start, $querystring_equal, $querystring_separator; @@ -318,6 +319,39 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde } $link .= '>'; $link .= stripslashes($category->cat_name).''; + + if ( (! empty($feed_image)) || (! empty($feed)) ) { + + $link .= ' '; + + if (empty($feed_image)) { + $link .= '('; + } + + $link .= ''; + } else { + $link .= $name; + } + + $link .= ''; + + if (empty($feed_image)) { + $link .= ')'; + } + } + if (intval($optioncount) == 1) { $link .= ' ('.intval($category_posts["$category->cat_ID"]).')'; }