Changeset 5638 for trunk/wp-includes/author-template.php
- Timestamp:
- 06/02/2007 03:04:01 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/author-template.php
r5624 r5638 1 1 <?php 2 2 3 /** 4 * Get the author of the current post in the Loop. 5 * @global object $authordata The current author's DB object. 6 * @param string $deprecated Deprecated. 7 * @return string The author's display name. 8 */ 3 9 function get_the_author($deprecated = '') { 4 10 global $authordata; … … 6 12 } 7 13 8 // Using echo = false is deprecated. Use get_the_author instead. 14 /** 15 * Echo the name of the author of the current post in the Loop. 16 * @see get_the_author() 17 * @param string $deprecated Deprecated. 18 * @param string $deprecated_echo Echo the string or return it. Deprecated, use get_the_author(). 19 * @return string The author's display name, from get_the_author(). 20 */ 9 21 function the_author($deprecated = '', $deprecated_echo = true) { 10 22 if ( $deprecated_echo ) … … 13 25 } 14 26 27 /** 28 * Get the description of the author of the current post in the Loop. 29 * @global object $authordata The current author's DB object. 30 * @return string The author's description. 31 */ 15 32 function get_the_author_description() { 16 33 global $authordata; 17 34 return $authordata->description; 18 35 } 36 37 /** 38 * Echo the description of the author of the current post in the Loop. 39 * @see get_the_author_description() 40 * @return null 41 */ 19 42 function the_author_description() { 20 43 echo get_the_author_description(); 21 44 } 22 45 46 /** 47 * Get the login name of the author of the current post in the Loop. 48 * @global object $authordata The current author's DB object. 49 * @return string The author's login name (username). 50 */ 23 51 function get_the_author_login() { 24 52 global $authordata; … … 26 54 } 27 55 56 /** 57 * Echo the login name of the author of the current post in the Loop. 58 * @see get_the_author_login() 59 * @return null 60 */ 28 61 function the_author_login() { 29 62 echo get_the_author_login(); 30 63 } 31 64 65 /** 66 * Get the first name of the author of the current post in the Loop. 67 * @global object $authordata The current author's DB object. 68 * @return string The author's first name. 69 */ 32 70 function get_the_author_firstname() { 33 71 global $authordata; 34 72 return $authordata->first_name; 35 73 } 74 75 /** 76 * Echo the first name of the author of the current post in the Loop. 77 * @see get_the_author_firstname() 78 * @return null 79 */ 36 80 function the_author_firstname() { 37 81 echo get_the_author_firstname(); 38 82 } 39 83 84 /** 85 * Get the last name of the author of the current post in the Loop. 86 * @global object $authordata The current author's DB object. 87 * @return string The author's last name. 88 */ 40 89 function get_the_author_lastname() { 41 90 global $authordata; … … 43 92 } 44 93 94 /** 95 * Echo the last name of the author of the current post in the Loop. 96 * @see get_the_author_lastname() 97 * @return null 98 */ 45 99 function the_author_lastname() { 46 100 echo get_the_author_lastname(); 47 101 } 48 102 103 /** 104 * Get the nickname of the author of the current post in the Loop. 105 * @global object $authordata The current author's DB object. 106 * @return string The author's nickname. 107 */ 49 108 function get_the_author_nickname() { 50 109 global $authordata; … … 52 111 } 53 112 113 /** 114 * Echo the nickname of the author of the current post in the Loop. 115 * @see get_the_author_nickname() 116 * @return null 117 */ 54 118 function the_author_nickname() { 55 119 echo get_the_author_nickname(); 56 120 } 57 121 122 /** 123 * Get the ID of the author of the current post in the Loop. 124 * @global object $authordata The current author's DB object. 125 * @return int The author's ID. 126 */ 58 127 function get_the_author_ID() { 59 128 global $authordata; 60 return $authordata->ID; 61 } 129 return (int) $authordata->ID; 130 } 131 132 /** 133 * Echo the ID of the author of the current post in the Loop. 134 * @see get_the_author_ID() 135 * @return null 136 */ 62 137 function the_author_ID() { 63 138 echo get_the_author_id(); 64 139 } 65 140 141 /** 142 * Get the email of the author of the current post in the Loop. 143 * @global object $authordata The current author's DB object. 144 * @return string The author's username. 145 */ 66 146 function get_the_author_email() { 67 147 global $authordata; … … 69 149 } 70 150 151 /** 152 * Echo the email of the author of the current post in the Loop. 153 * @see get_the_author_email() 154 * @return null 155 */ 71 156 function the_author_email() { 72 157 echo apply_filters('the_author_email', get_the_author_email() ); 73 158 } 74 159 160 /** 161 * Get the URL to the home page of the author of the current post in the Loop. 162 * @global object $authordata The current author's DB object. 163 * @return string The URL to the author's page. 164 */ 75 165 function get_the_author_url() { 76 166 global $authordata; … … 78 168 } 79 169 170 /** 171 * Echo the URL to the home page of the author of the current post in the Loop. 172 * @see get_the_author_url() 173 * @return null 174 */ 80 175 function the_author_url() { 81 176 echo get_the_author_url(); 82 177 } 83 178 179 /** 180 * If the author has a home page set, echo an HTML link, otherwise just echo the author's name. 181 * @see get_the_author_url() 182 * @see the_author() 183 * @return null 184 */ 84 185 function the_author_link() { 85 186 if (get_the_author_url()) { … … 90 191 } 91 192 193 /** 194 * Get the ICQ number of the author of the current post in the Loop. 195 * @global object $authordata The current author's DB object. 196 * @return string The author's ICQ number. 197 */ 92 198 function get_the_author_icq() { 93 199 global $authordata; … … 95 201 } 96 202 203 /** 204 * Echo the ICQ number of the author of the current post in the Loop. 205 * @see get_the_author_icq() 206 * @return null 207 */ 97 208 function the_author_icq() { 98 209 echo get_the_author_icq(); 99 210 } 100 211 212 /** 213 * Get the AIM name of the author of the current post in the Loop. 214 * @global object $authordata The current author's DB object. 215 * @return string The author's AIM name. 216 */ 101 217 function get_the_author_aim() { 102 218 global $authordata; … … 104 220 } 105 221 222 /** 223 * Echo the AIM name of the author of the current post in the Loop. 224 * @see get_the_author_aim() 225 * @return null 226 */ 106 227 function the_author_aim() { 107 228 echo get_the_author_aim(); 108 229 } 109 230 231 /** 232 * Get the Yahoo! IM name of the author of the current post in the Loop. 233 * @global object $authordata The current author's DB object. 234 * @return string The author's Yahoo! IM name. 235 */ 110 236 function get_the_author_yim() { 111 237 global $authordata; … … 113 239 } 114 240 241 /** 242 * Echo the Yahoo! IM name of the author of the current post in the Loop. 243 * @see get_the_author_yim() 244 * @return null 245 */ 115 246 function the_author_yim() { 116 247 echo get_the_author_yim(); 117 248 } 118 249 250 /** 251 * Get the MSN address of the author of the current post in the Loop. 252 * @global object $authordata The current author's DB object. 253 * @return string The author's MSN address. 254 */ 119 255 function get_the_author_msn() { 120 256 global $authordata; … … 122 258 } 123 259 260 /** 261 * Echo the MSN address of the author of the current post in the Loop. 262 * @see get_the_author_msn() 263 * @return null 264 */ 124 265 function the_author_msn() { 125 266 echo get_the_author_msn(); 126 267 } 127 268 269 /** 270 * Get the number of posts by the author of the current post in the Loop. 271 * @global object $post The current post in the Loop's DB object. 272 * @see get_usernumposts() 273 * @return int The number of posts by the author. 274 */ 128 275 function get_the_author_posts() { 129 276 global $post; 130 $posts = get_usernumposts($post->post_author); 131 return $posts; 132 } 133 277 return get_usernumposts($post->post_author); 278 } 279 280 /** 281 * Echo the number of posts by the author of the current post in the Loop. 282 * @see get_the_author_posts() 283 * @return null 284 */ 134 285 function the_author_posts() { 135 286 echo get_the_author_posts(); 136 287 } 137 288 289 /** 290 * Echo an HTML link to the author page of the author of the current post in the Loop. 291 * @global object $authordata The current author's DB object. 292 * @see get_author_posts_url() 293 * @see get_the_author() 294 * @return null 295 */ 138 296 /* the_author_posts_link() requires no get_, use get_author_posts_url() */ 139 297 function the_author_posts_link($deprecated = '') { 140 298 global $authordata; 141 142 echo '<a href="' . get_author_posts_url($authordata->ID, $authordata->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape(get_the_author())) . '">' . get_the_author() . '</a>'; 143 } 144 299 printf( 300 '<a href="%1$s" title="%2$s">%3$s</a>', 301 get_author_posts_url( $authordata->ID, $authordata->user_nicename ), 302 sprintf( __( 'Posts by %s' ), attribute_escape( get_the_author() ) ), 303 get_the_author() 304 ); 305 } 306 307 /** 308 * Get the URL to the author page of the author of the current post in the Loop. 309 * @global object $wpdb WordPress database layer. 310 * @global object $wp_rewrite WP_Rewrite 311 * @global object $post The current post in the Loop's DB object. 312 * @return string The URL to the author's page. 313 */ 145 314 function get_author_posts_url($author_id, $author_nicename = '') { 146 global $wpdb, $wp_rewrite, $post , $cache_userdata;315 global $wpdb, $wp_rewrite, $post; 147 316 $auth_ID = (int) $author_id; 148 317 $link = $wp_rewrite->get_author_permastruct(); … … 166 335 } 167 336 168 // Get author's preferred display name 337 /** 338 * Get the specified author's preferred display name. 339 * @param int $auth_id The ID of the author. 340 * @return string The author's display name. 341 */ 169 342 function get_author_name( $auth_id ) { 170 343 $authordata = get_userdata( $auth_id ); 171 172 344 return $authordata->display_name; 173 345 } 174 346 347 /** 348 * List all the authors of the blog, with several options available. 349 * optioncount (boolean) (false): Show the count in parenthesis next to the author's name. 350 * exclude_admin (boolean) (true): Exclude the 'admin' user that is installed by default. 351 * show_fullname (boolean) (false): Show their full names. 352 * hide_empty (boolean) (true): Don't show authors without any posts. 353 * feed (string) (''): If isn't empty, show links to author's feeds. 354 * feed_image (string) (''): If isn't empty, use this image to link to feeds. 355 * echo (boolean) (true): Set to false to return the output, instead of echoing. 356 * @param array $args The argument array. 357 * @return null|string The output, if echo is set to false. 358 */ 175 359 function wp_list_authors($args = '') { 176 360 global $wpdb;
Note: See TracChangeset
for help on using the changeset viewer.