Make WordPress Core

Changeset 987


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().

Location:
trunk/wp-includes
Files:
2 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}
  • trunk/wp-includes/template-functions-category.php

    r979 r987  
    248248    if (!isset($r['categories'])) $r['categories'] = 0;
    249249    if (!isset($r['recurse'])) $r['recurse'] = 0;
    250     list_cats($r['optionall'], $r['all'], $r['sort_column'], $r['sort_order'], $r['file'],
    251     $r['list'], $r['optiondates'], $r['optioncount'], $r['hide_empty'], $r['use_desc_for_title'],
    252     $r['children'], $r['child_of'], $r['categories'], $r['recurse']);
    253 }
    254 
    255 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) {
     250    if (!isset($r['feed'])) $r['feed'] = '';
     251    if (!isset($r['feed_image'])) $r['feed_image'] = '';
     252
     253    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']);
     254}
     255
     256function 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 = '') {
    256257    global $tablecategories, $tableposts, $tablepost2cat, $wpdb;
    257258    global $pagenow;
     
    319320            $link .= '>';
    320321            $link .= stripslashes($category->cat_name).'</a>';
     322
     323            if ( (! empty($feed_image)) || (! empty($feed)) ) {
     324               
     325                $link .= ' ';
     326
     327                if (empty($feed_image)) {
     328                    $link .= '(';
     329                }
     330
     331                $link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename)  . '"';
     332
     333                if (! empty($feed)) {
     334                    $title =  ' title="' . stripslashes($feed) . '"';
     335                    $alt = ' alt="' . stripslashes($feed) . '"';
     336                    $name = stripslashes($feed);
     337                    $link .= $title;
     338                }
     339
     340                $link .= '>';
     341
     342                if (! empty($feed_image)) {
     343                    $link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />';
     344                } else {
     345                    $link .= $name;
     346                }
     347               
     348                $link .= '</a>';
     349
     350                if (empty($feed_image)) {
     351                    $link .= ')';
     352                }
     353            }
     354
    321355            if (intval($optioncount) == 1) {
    322356                $link .= ' ('.intval($category_posts["$category->cat_ID"]).')';
Note: See TracChangeset for help on using the changeset viewer.