Changeset 48577 for trunk/src/wp-includes/comment-template.php
- Timestamp:
- 07/23/2020 01:09:50 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/comment-template.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-template.php
r48473 r48577 308 308 $url = ''; 309 309 $id = 0; 310 310 311 if ( ! empty( $comment ) ) { 311 312 $author_url = ( 'http://' === $comment->comment_author_url ) ? '' : $comment->comment_author_url; … … 1556 1557 */ 1557 1558 function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) { 1558 $ id= get_the_ID();1559 $ title= get_the_title();1560 $number = get_comments_number( $id );1559 $post_id = get_the_ID(); 1560 $post_title = get_the_title(); 1561 $number = get_comments_number( $post_id ); 1561 1562 1562 1563 if ( false === $zero ) { 1563 1564 /* translators: %s: Post title. */ 1564 $zero = sprintf( __( 'No Comments<span class="screen-reader-text"> on %s</span>' ), $ title );1565 $zero = sprintf( __( 'No Comments<span class="screen-reader-text"> on %s</span>' ), $post_title ); 1565 1566 } 1566 1567 1567 1568 if ( false === $one ) { 1568 1569 /* translators: %s: Post title. */ 1569 $one = sprintf( __( '1 Comment<span class="screen-reader-text"> on %s</span>' ), $ title );1570 $one = sprintf( __( '1 Comment<span class="screen-reader-text"> on %s</span>' ), $post_title ); 1570 1571 } 1571 1572 … … 1573 1574 /* translators: 1: Number of comments, 2: Post title. */ 1574 1575 $more = _n( '%1$s Comment<span class="screen-reader-text"> on %2$s</span>', '%1$s Comments<span class="screen-reader-text"> on %2$s</span>', $number ); 1575 $more = sprintf( $more, number_format_i18n( $number ), $ title );1576 $more = sprintf( $more, number_format_i18n( $number ), $post_title ); 1576 1577 } 1577 1578 1578 1579 if ( false === $none ) { 1579 1580 /* translators: %s: Post title. */ 1580 $none = sprintf( __( 'Comments Off<span class="screen-reader-text"> on %s</span>' ), $ title );1581 $none = sprintf( __( 'Comments Off<span class="screen-reader-text"> on %s</span>' ), $post_title ); 1581 1582 } 1582 1583 … … 1600 1601 * 1601 1602 * @param string $respond_link The default response link. 1602 * @param int eger $idThe post ID.1603 * @param int $post_id The post ID. 1603 1604 */ 1604 echo apply_filters( 'respond_link', $respond_link, $ id );1605 echo apply_filters( 'respond_link', $respond_link, $post_id ); 1605 1606 } else { 1606 1607 comments_link(); … … 1911 1912 * @since 3.0.0 1912 1913 * 1913 * @param int $ id Optional. Post ID. Defaultcurrent post ID.1914 * @return string Hidden input HTML for replying to comments 1915 */ 1916 function get_comment_id_fields( $ id = 0 ) {1917 if ( empty( $ id ) ) {1918 $ id = get_the_ID();1914 * @param int $post_id Optional. Post ID. Defaults to the current post ID. 1915 * @return string Hidden input HTML for replying to comments. 1916 */ 1917 function get_comment_id_fields( $post_id = 0 ) { 1918 if ( empty( $post_id ) ) { 1919 $post_id = get_the_ID(); 1919 1920 } 1920 1921 1921 1922 $replytoid = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0; 1922 $result = "<input type='hidden' name='comment_post_ID' value='$ id' id='comment_post_ID' />\n";1923 $result = "<input type='hidden' name='comment_post_ID' value='$post_id' id='comment_post_ID' />\n"; 1923 1924 $result .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$replytoid' />\n"; 1924 1925 … … 1928 1929 * @since 3.0.0 1929 1930 * 1930 * @param string $result The HTML-formatted hidden idfield comment elements.1931 * @param int $ idThe post ID.1932 * @param int $replytoid The idof the comment being replied to.1933 */ 1934 return apply_filters( 'comment_id_fields', $result, $ id, $replytoid );1931 * @param string $result The HTML-formatted hidden ID field comment elements. 1932 * @param int $post_id The post ID. 1933 * @param int $replytoid The ID of the comment being replied to. 1934 */ 1935 return apply_filters( 'comment_id_fields', $result, $post_id, $replytoid ); 1935 1936 } 1936 1937 … … 1938 1939 * Outputs hidden input HTML for replying to comments. 1939 1940 * 1941 * Adds two hidden inputs to the comment form to identify the `comment_post_ID` 1942 * and `comment_parent` values for threaded comments. 1943 * 1944 * This tag must be within the `<form>` section of the `comments.php` template. 1945 * 1940 1946 * @since 2.7.0 1941 1947 * 1942 * @param int $id Optional. Post ID. Default current post ID. 1943 */ 1944 function comment_id_fields( $id = 0 ) { 1945 echo get_comment_id_fields( $id ); 1948 * @see get_comment_id_fields() 1949 * 1950 * @param int $post_id Optional. Post ID. Defaults to the current post ID. 1951 */ 1952 function comment_id_fields( $post_id = 0 ) { 1953 echo get_comment_id_fields( $post_id ); 1946 1954 } 1947 1955
Note: See TracChangeset
for help on using the changeset viewer.