]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/author-template.php
WordPress 4.5
[autoinstalls/wordpress.git] / wp-includes / author-template.php
index 36d08bc81e9efafcda5825eba6ee4a7d25184a21..ba609ab27547b5b8d938474d9e2d2a71f22c7762 100644 (file)
@@ -56,12 +56,23 @@ function get_the_author($deprecated = '') {
  * @return string|null The author's display name, from get_the_author().
  */
 function the_author( $deprecated = '', $deprecated_echo = true ) {
-       if ( !empty( $deprecated ) )
+       if ( ! empty( $deprecated ) ) {
                _deprecated_argument( __FUNCTION__, '2.1' );
-       if ( $deprecated_echo !== true )
-               _deprecated_argument( __FUNCTION__, '1.5', __('Use <code>get_the_author()</code> instead if you do not want the value echoed.') );
-       if ( $deprecated_echo )
+       }
+
+       if ( true !== $deprecated_echo ) {
+               _deprecated_argument( __FUNCTION__, '1.5',
+                       /* translators: %s: get_the_author() */
+                       sprintf( __( 'Use %s instead if you do not want the value echoed.' ),
+                               '<code>get_the_author()</code>'
+                       )
+               );
+       }
+
+       if ( $deprecated_echo ) {
                echo get_the_author();
+       }
+
        return get_the_author();
 }
 
@@ -223,23 +234,17 @@ function the_author_posts() {
 }
 
 /**
- * Display an HTML link to the author page of the author of the current post.
+ * Retrieves an HTML link to the author page of the current post's author.
  *
- * Does just echo get_author_posts_url() function, like the others do. The
- * reason for this, is that another function is used to help in printing the
- * link to the author's posts.
+ * Returns an HTML-formatted link using get_author_posts_url().
  *
- * @link https://codex.wordpress.org/Template_Tags/the_author_posts_link
- * @since 1.2.0
+ * @since 4.4.0
  *
  * @global object $authordata The current author's DB object.
  *
- * @param string $deprecated Deprecated.
+ * @return string An HTML link to the author page.
  */
-function the_author_posts_link($deprecated = '') {
-       if ( !empty( $deprecated ) )
-               _deprecated_argument( __FUNCTION__, '2.1' );
-
+function get_the_author_posts_link() {
        global $authordata;
        if ( ! is_object( $authordata ) ) {
                return;
@@ -259,7 +264,22 @@ function the_author_posts_link($deprecated = '') {
         *
         * @param string $link HTML link.
         */
-       echo apply_filters( 'the_author_posts_link', $link );
+       return apply_filters( 'the_author_posts_link', $link );
+}
+
+/**
+ * Displays an HTML link to the author page of the current post's author.
+ *
+ * @since 1.2.0
+ * @since 4.4.0 Converted into a wrapper for get_the_author_posts_link()
+ *
+ * @param string $deprecated Unused.
+ */
+function the_author_posts_link( $deprecated = '' ) {
+       if ( ! empty( $deprecated ) ) {
+               _deprecated_argument( __FUNCTION__, '2.1' );
+       }
+       echo get_the_author_posts_link();
 }
 
 /**
@@ -269,9 +289,11 @@ function the_author_posts_link($deprecated = '') {
  *
  * @global WP_Rewrite $wp_rewrite
  *
+ * @param int    $author_id       Author ID.
+ * @param string $author_nicename Optional. The author's nicename (slug). Default empty.
  * @return string The URL to the author's page.
  */
-function get_author_posts_url($author_id, $author_nicename = '') {
+function get_author_posts_url( $author_id, $author_nicename = '' ) {
        global $wp_rewrite;
        $auth_ID = (int) $author_id;
        $link = $wp_rewrite->get_author_permastruct();
@@ -304,13 +326,13 @@ function get_author_posts_url($author_id, $author_nicename = '') {
 }
 
 /**
- * List all the authors of the blog, with several options available.
+ * List all the authors of the site, with several options available.
  *
  * @link https://codex.wordpress.org/Template_Tags/wp_list_authors
  *
  * @since 1.2.0
  *
- * @global wpdb $wpdb
+ * @global wpdb $wpdb WordPress database abstraction object.
  *
  * @param string|array $args {
  *     Optional. Array or string of default arguments.
@@ -444,7 +466,7 @@ function wp_list_authors( $args = '' ) {
  *
  * @since 3.2.0
  *
- * @global wpdb $wpdb
+ * @global wpdb $wpdb WordPress database abstraction object.
  *
  * @return bool Whether or not we have more than one author
  */