| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
function get_the_author($deprecated = '') { |
|---|
| 4 |
global $authordata; |
|---|
| 5 |
return apply_filters('the_author', $authordata->display_name); |
|---|
| 6 |
} |
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
function the_author($deprecated = '', $deprecated_echo = true) { |
|---|
| 10 |
if ( $deprecated_echo ) |
|---|
| 11 |
echo get_the_author(); |
|---|
| 12 |
return get_the_author(); |
|---|
| 13 |
} |
|---|
| 14 |
|
|---|
| 15 |
function get_the_author_description() { |
|---|
| 16 |
global $authordata; |
|---|
| 17 |
return $authordata->description; |
|---|
| 18 |
} |
|---|
| 19 |
function the_author_description() { |
|---|
| 20 |
echo get_the_author_description(); |
|---|
| 21 |
} |
|---|
| 22 |
|
|---|
| 23 |
function get_the_author_login() { |
|---|
| 24 |
global $authordata; |
|---|
| 25 |
return $authordata->user_login; |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
function the_author_login() { |
|---|
| 29 |
echo get_the_author_login(); |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
function get_the_author_firstname() { |
|---|
| 33 |
global $authordata; |
|---|
| 34 |
return $authordata->first_name; |
|---|
| 35 |
} |
|---|
| 36 |
function the_author_firstname() { |
|---|
| 37 |
echo get_the_author_firstname(); |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
function get_the_author_lastname() { |
|---|
| 41 |
global $authordata; |
|---|
| 42 |
return $authordata->last_name; |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
function the_author_lastname() { |
|---|
| 46 |
echo get_the_author_lastname(); |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
function get_the_author_nickname() { |
|---|
| 50 |
global $authordata; |
|---|
| 51 |
return $authordata->nickname; |
|---|
| 52 |
} |
|---|
| 53 |
|
|---|
| 54 |
function the_author_nickname() { |
|---|
| 55 |
echo get_the_author_nickname(); |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
function get_the_author_ID() { |
|---|
| 59 |
global $authordata; |
|---|
| 60 |
return $authordata->ID; |
|---|
| 61 |
} |
|---|
| 62 |
function the_author_ID() { |
|---|
| 63 |
echo get_the_author_id(); |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
function get_the_author_email() { |
|---|
| 67 |
global $authordata; |
|---|
| 68 |
return $authordata->user_email; |
|---|
| 69 |
} |
|---|
| 70 |
|
|---|
| 71 |
function the_author_email() { |
|---|
| 72 |
echo apply_filters('the_author_email', get_the_author_email() ); |
|---|
| 73 |
} |
|---|
| 74 |
|
|---|
| 75 |
function get_the_author_url() { |
|---|
| 76 |
global $authordata; |
|---|
| 77 |
return $authordata->user_url; |
|---|
| 78 |
} |
|---|
| 79 |
|
|---|
| 80 |
function the_author_url() { |
|---|
| 81 |
echo get_the_author_url(); |
|---|
| 82 |
} |
|---|
| 83 |
|
|---|
| 84 |
function get_the_author_icq() { |
|---|
| 85 |
global $authordata; |
|---|
| 86 |
return $authordata->icq; |
|---|
| 87 |
} |
|---|
| 88 |
|
|---|
| 89 |
function the_author_icq() { |
|---|
| 90 |
echo get_the_author_icq(); |
|---|
| 91 |
} |
|---|
| 92 |
|
|---|
| 93 |
function get_the_author_aim() { |
|---|
| 94 |
global $authordata; |
|---|
| 95 |
return str_replace(' ', '+', $authordata->aim); |
|---|
| 96 |
} |
|---|
| 97 |
|
|---|
| 98 |
function the_author_aim() { |
|---|
| 99 |
echo get_the_author_aim(); |
|---|
| 100 |
} |
|---|
| 101 |
|
|---|
| 102 |
function get_the_author_yim() { |
|---|
| 103 |
global $authordata; |
|---|
| 104 |
return $authordata->yim; |
|---|
| 105 |
} |
|---|
| 106 |
|
|---|
| 107 |
function the_author_yim() { |
|---|
| 108 |
echo get_the_author_yim(); |
|---|
| 109 |
} |
|---|
| 110 |
|
|---|
| 111 |
function get_the_author_msn() { |
|---|
| 112 |
global $authordata; |
|---|
| 113 |
return $authordata->msn; |
|---|
| 114 |
} |
|---|
| 115 |
|
|---|
| 116 |
function the_author_msn() { |
|---|
| 117 |
echo get_the_author_msn(); |
|---|
| 118 |
} |
|---|
| 119 |
|
|---|
| 120 |
function get_the_author_posts() { |
|---|
| 121 |
global $post; |
|---|
| 122 |
$posts = get_usernumposts($post->post_author); |
|---|
| 123 |
return $posts; |
|---|
| 124 |
} |
|---|
| 125 |
|
|---|
| 126 |
function the_author_posts() { |
|---|
| 127 |
echo get_the_author_posts(); |
|---|
| 128 |
} |
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
function the_author_posts_link($deprecated = '') { |
|---|
| 132 |
global $authordata; |
|---|
| 133 |
|
|---|
| 134 |
echo '<a href="' . get_author_link(0, $authordata->ID, $authordata->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape(get_the_author())) . '">' . get_the_author() . '</a>'; |
|---|
| 135 |
} |
|---|
| 136 |
|
|---|
| 137 |
function get_author_link($echo = false, $author_id, $author_nicename = '') { |
|---|
| 138 |
global $wpdb, $wp_rewrite, $post, $cache_userdata; |
|---|
| 139 |
$auth_ID = (int) $author_id; |
|---|
| 140 |
$link = $wp_rewrite->get_author_permastruct(); |
|---|
| 141 |
|
|---|
| 142 |
if ( empty($link) ) { |
|---|
| 143 |
$file = get_settings('home') . '/'; |
|---|
| 144 |
$link = $file . '?author=' . $auth_ID; |
|---|
| 145 |
} else { |
|---|
| 146 |
if ( '' == $author_nicename ) { |
|---|
| 147 |
$user = get_userdata($author_id); |
|---|
| 148 |
if ( !empty($user->user_nicename) ) |
|---|
| 149 |
$author_nicename = $user->user_nicename; |
|---|
| 150 |
} |
|---|
| 151 |
$link = str_replace('%author%', $author_nicename, $link); |
|---|
| 152 |
$link = get_settings('home') . trailingslashit($link); |
|---|
| 153 |
} |
|---|
| 154 |
|
|---|
| 155 |
$link = apply_filters('author_link', $link, $author_id, $author_nicename); |
|---|
| 156 |
|
|---|
| 157 |
if ( $echo ) |
|---|
| 158 |
echo $link; |
|---|
| 159 |
return $link; |
|---|
| 160 |
} |
|---|
| 161 |
|
|---|
| 162 |
function wp_list_authors($args = '') { |
|---|
| 163 |
parse_str($args, $r); |
|---|
| 164 |
|
|---|
| 165 |
if ( !isset($r['optioncount']) ) |
|---|
| 166 |
$r['optioncount'] = false; |
|---|
| 167 |
if ( !isset($r['exclude_admin']) ) |
|---|
| 168 |
$r['exclude_admin'] = true; |
|---|
| 169 |
if ( !isset($r['show_fullname']) ) |
|---|
| 170 |
$r['show_fullname'] = false; |
|---|
| 171 |
if ( !isset($r['hide_empty']) ) |
|---|
| 172 |
$r['hide_empty'] = true; |
|---|
| 173 |
if ( !isset($r['feed']) ) |
|---|
| 174 |
$r['feed'] = ''; |
|---|
| 175 |
if ( !isset($r['feed_image']) ) |
|---|
| 176 |
$r['feed_image'] = ''; |
|---|
| 177 |
|
|---|
| 178 |
list_authors($r['optioncount'], $r['exclude_admin'], $r['show_fullname'], $r['hide_empty'], $r['feed'], $r['feed_image']); |
|---|
| 179 |
} |
|---|
| 180 |
|
|---|
| 181 |
function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { |
|---|
| 182 |
global $wpdb; |
|---|
| 183 |
$query = "SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name"; |
|---|
| 184 |
$authors = $wpdb->get_results($query); |
|---|
| 185 |
|
|---|
| 186 |
foreach ( (array) $authors as $author ) { |
|---|
| 187 |
$author = get_userdata( $author->ID ); |
|---|
| 188 |
$posts = get_usernumposts($author->ID); |
|---|
| 189 |
$name = $author->nickname; |
|---|
| 190 |
|
|---|
| 191 |
if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') ) |
|---|
| 192 |
$name = "$author->first_name $author->last_name"; |
|---|
| 193 |
|
|---|
| 194 |
if ( !($posts == 0 && $hide_empty) ) |
|---|
| 195 |
echo "<li>"; |
|---|
| 196 |
if ( $posts == 0 ) { |
|---|
| 197 |
if ( !$hide_empty ) |
|---|
| 198 |
$link = $name; |
|---|
| 199 |
} else { |
|---|
| 200 |
$link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>'; |
|---|
| 201 |
|
|---|
| 202 |
if ( (! empty($feed_image)) || (! empty($feed)) ) { |
|---|
| 203 |
$link .= ' '; |
|---|
| 204 |
if (empty($feed_image)) |
|---|
| 205 |
$link .= '('; |
|---|
| 206 |
$link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"'; |
|---|
| 207 |
|
|---|
| 208 |
if ( !empty($feed) ) { |
|---|
| 209 |
$title = ' title="' . $feed . '"'; |
|---|
| 210 |
$alt = ' alt="' . $feed . '"'; |
|---|
| 211 |
$name = $feed; |
|---|
| 212 |
$link .= $title; |
|---|
| 213 |
} |
|---|
| 214 |
|
|---|
| 215 |
$link .= '>'; |
|---|
| 216 |
|
|---|
| 217 |
if ( !empty($feed_image) ) |
|---|
| 218 |
$link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />'; |
|---|
| 219 |
else |
|---|
| 220 |
$link .= $name; |
|---|
| 221 |
|
|---|
| 222 |
$link .= '</a>'; |
|---|
| 223 |
|
|---|
| 224 |
if ( empty($feed_image) ) |
|---|
| 225 |
$link .= ')'; |
|---|
| 226 |
} |
|---|
| 227 |
|
|---|
| 228 |
if ( $optioncount ) |
|---|
| 229 |
$link .= ' ('. $posts . ')'; |
|---|
| 230 |
|
|---|
| 231 |
} |
|---|
| 232 |
|
|---|
| 233 |
if ( !($posts == 0 && $hide_empty) ) |
|---|
| 234 |
echo "$link</li>"; |
|---|
| 235 |
} |
|---|
| 236 |
} |
|---|
| 237 |
|
|---|
| 238 |
?> |
|---|
| 239 |
|
|---|