Make WordPress Core


Ignore:
Timestamp:
03/23/2004 04:45:27 AM (21 years ago)
Author:
rboren
Message:

Add feed and feed_image options to wp_list_cats() and wp_list_authors().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/template-functions-author.php

    r979 r987  
    107107    if (!isset($r['show_fullname'])) $r['show_fullname'] = false;
    108108    if (!isset($r['hide_empty'])) $r['hide_empty'] = true;
     109    if (!isset($r['feed'])) $r['feed'] = '';
     110    if (!isset($r['feed_image'])) $r['feed_image'] = '';
    109111
    110     list_authors($r['optioncount'], $r['exclude_admin'], $r['show_fullname'], $r[hide_empty]);
     112    list_authors($r['optioncount'], $r['exclude_admin'], $r['show_fullname'], $r[hide_empty], $r['feed'], $r['feed_image']);
    111113}
    112114
    113 function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true) {
     115function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
    114116    global $tableusers, $wpdb, $blogfilename;
    115117
     
    129131            if (! $hide_empty) echo $name;
    130132        } else {
    131             echo '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="Posts by ' . $author->user_nickname . '">' . $name . ($optioncount ? " ($posts)" : '')."</a>";
     133            $link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="Posts by ' . htmlspecialchars($author->user_nickname) . '">' . stripslashes($name) . '</a>';
     134
     135            if ( (! empty($feed_image)) || (! empty($feed)) ) {
     136               
     137                $link .= ' ';
     138
     139                if (empty($feed_image)) {
     140                    $link .= '(';
     141                }
     142
     143                $link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename)  . '"';
     144
     145                if (! empty($feed)) {
     146                    $title =  ' title="' . stripslashes($feed) . '"';
     147                    $alt = ' alt="' . stripslashes($feed) . '"';
     148                    $name = stripslashes($feed);
     149                    $link .= $title;
     150                }
     151
     152                $link .= '>';
     153
     154                if (! empty($feed_image)) {
     155                    $link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />';
     156                } else {
     157                    $link .= $name;
     158                }
     159               
     160                $link .= '</a>';
     161
     162                if (empty($feed_image)) {
     163                    $link .= ')';
     164                }
     165            }
     166
     167            if ($optioncount) {
     168                $link .= ' ('. $posts . ')';
     169            }
    132170        }
    133         if (! ($posts == 0 && $hide_empty)) echo "</li>";
     171
     172        if (! ($posts == 0 && $hide_empty)) echo "$link</li>";
    134173    }
    135174}
Note: See TracChangeset for help on using the changeset viewer.