Make WordPress Core


Ignore:
Timestamp:
06/02/2007 03:04:01 AM (18 years ago)
Author:
rob1n
Message:

phpDoc effort for wp-includes/author-template.php. fixes #4393

File:
1 edited

Legend:

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

    r5624 r5638  
    11<?php
    22
     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 */
    39function get_the_author($deprecated = '') {
    410    global $authordata;
     
    612}
    713
    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 */
    921function the_author($deprecated = '', $deprecated_echo = true) {
    1022    if ( $deprecated_echo )
     
    1325}
    1426
     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 */
    1532function get_the_author_description() {
    1633    global $authordata;
    1734    return $authordata->description;
    1835}
     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 */
    1942function the_author_description() {
    2043    echo get_the_author_description();
    2144}
    2245
     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 */
    2351function get_the_author_login() {
    2452    global $authordata;
     
    2654}
    2755
     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 */
    2861function the_author_login() {
    2962    echo get_the_author_login();
    3063}
    3164
     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 */
    3270function get_the_author_firstname() {
    3371    global $authordata;
    3472    return $authordata->first_name;
    3573}
     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 */
    3680function the_author_firstname() {
    3781    echo get_the_author_firstname();
    3882}
    3983
     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 */
    4089function get_the_author_lastname() {
    4190    global $authordata;
     
    4392}
    4493
     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 */
    4599function the_author_lastname() {
    46100    echo get_the_author_lastname();
    47101}
    48102
     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 */
    49108function get_the_author_nickname() {
    50109    global $authordata;
     
    52111}
    53112
     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 */
    54118function the_author_nickname() {
    55119    echo get_the_author_nickname();
    56120}
    57121
     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 */
    58127function get_the_author_ID() {
    59128    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 */
    62137function the_author_ID() {
    63138    echo get_the_author_id();
    64139}
    65140
     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 */
    66146function get_the_author_email() {
    67147    global $authordata;
     
    69149}
    70150
     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 */
    71156function the_author_email() {
    72157    echo apply_filters('the_author_email', get_the_author_email() );
    73158}
    74159
     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 */
    75165function get_the_author_url() {
    76166    global $authordata;
     
    78168}
    79169
     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 */
    80175function the_author_url() {
    81176    echo get_the_author_url();
    82177}
    83178
     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 */
    84185function the_author_link() {
    85186    if (get_the_author_url()) {
     
    90191}
    91192
     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 */
    92198function get_the_author_icq() {
    93199    global $authordata;
     
    95201}
    96202
     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 */
    97208function the_author_icq() {
    98209    echo get_the_author_icq();
    99210}
    100211
     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 */
    101217function get_the_author_aim() {
    102218    global $authordata;
     
    104220}
    105221
     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 */
    106227function the_author_aim() {
    107228    echo get_the_author_aim();
    108229}
    109230
     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 */
    110236function get_the_author_yim() {
    111237    global $authordata;
     
    113239}
    114240
     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 */
    115246function the_author_yim() {
    116247    echo get_the_author_yim();
    117248}
    118249
     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 */
    119255function get_the_author_msn() {
    120256    global $authordata;
     
    122258}
    123259
     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 */
    124265function the_author_msn() {
    125266    echo get_the_author_msn();
    126267}
    127268
     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 */
    128275function get_the_author_posts() {
    129276    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 */
    134285function the_author_posts() {
    135286    echo get_the_author_posts();
    136287}
    137288
     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 */
    138296/* the_author_posts_link() requires no get_, use get_author_posts_url() */
    139297function the_author_posts_link($deprecated = '') {
    140298    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 */
    145314function get_author_posts_url($author_id, $author_nicename = '') {
    146     global $wpdb, $wp_rewrite, $post, $cache_userdata;
     315    global $wpdb, $wp_rewrite, $post;
    147316    $auth_ID = (int) $author_id;
    148317    $link = $wp_rewrite->get_author_permastruct();
     
    166335}
    167336
    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 */
    169342function get_author_name( $auth_id ) {
    170343    $authordata = get_userdata( $auth_id );
    171 
    172344    return $authordata->display_name;
    173345}
    174346
     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 */
    175359function wp_list_authors($args = '') {
    176360    global $wpdb;
Note: See TracChangeset for help on using the changeset viewer.