Changeset 12821
- Timestamp:
- 01/25/2010 05:34:13 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment-template.php
r12811 r12821 18 18 * @uses apply_filters() Calls 'get_comment_author' hook on the comment author 19 19 * 20 * @param int $comment_ID The ID of the comment for which to retrieve the author. Optional. 20 21 * @return string The comment author 21 22 */ 22 function get_comment_author( ) {23 global $comment;23 function get_comment_author( $comment_ID = 0 ) { 24 $comment = get_comment( $comment_ID ); 24 25 if ( empty($comment->comment_author) ) { 25 26 if (!empty($comment->user_id)){ … … 40 41 * @since 0.71 41 42 * @uses apply_filters() Calls 'comment_author' on comment author before displaying 42 */ 43 function comment_author() { 44 $author = apply_filters('comment_author', get_comment_author() ); 43 * 44 * @param int $comment_ID The ID of the comment for which to print the author. Optional. 45 */ 46 function comment_author( $comment_ID = 0 ) { 47 $author = apply_filters('comment_author', get_comment_author( $comment_ID ) ); 45 48 echo $author; 46 49 } … … 53 56 * @uses $comment 54 57 * 58 * @param int $comment_ID The ID of the comment for which to get the author's email. Optional. 55 59 * @return string The current comment author's email 56 60 */ 57 function get_comment_author_email( ) {58 global $comment;61 function get_comment_author_email( $comment_ID = 0 ) { 62 $comment = get_comment( $comment_ID ); 59 63 return apply_filters('get_comment_author_email', $comment->comment_author_email); 60 64 } … … 71 75 * @since 0.71 72 76 * @uses apply_filters() Calls 'author_email' hook on the author email 73 */ 74 function comment_author_email() { 75 echo apply_filters('author_email', get_comment_author_email() ); 77 * 78 * @param int $comment_ID The ID of the comment for which to print the author's email. Optional. 79 */ 80 function comment_author_email( $comment_ID = 0 ) { 81 echo apply_filters('author_email', get_comment_author_email( $comment_ID ) ); 76 82 } 77 83 … … 136 142 * @uses apply_filters() Calls 'get_comment_author_link' hook on the complete link HTML or author 137 143 * 144 * @param int $comment_ID The ID of the comment for which to get the author's link. Optional. 138 145 * @return string Comment Author name or HTML link for author's URL 139 146 */ 140 function get_comment_author_link( ) {147 function get_comment_author_link( $comment_ID = 0 ) { 141 148 /** @todo Only call these functions when they are needed. Include in if... else blocks */ 142 $url = get_comment_author_url( );143 $author = get_comment_author( );149 $url = get_comment_author_url( $comment_ID ); 150 $author = get_comment_author( $comment_ID ); 144 151 145 152 if ( empty( $url ) || 'http://' == $url ) … … 155 162 * @since 0.71 156 163 * @see get_comment_author_link() Echos result 157 */ 158 function comment_author_link() { 159 echo get_comment_author_link(); 164 * 165 * @param int The ID of the comment for which to print the author's link. Optional. 166 */ 167 function comment_author_link( $comment_ID = 0 ) { 168 echo get_comment_author_link( $comment_ID ); 160 169 } 161 170 … … 167 176 * @uses apply_filters() 168 177 * 169 * @return unknown 170 */ 171 function get_comment_author_IP() { 172 global $comment; 178 * @param int $comment_ID The ID of the comment for which to get the author's IP address. Optional. 179 * @return string The comment author's IP address. 180 */ 181 function get_comment_author_IP( $comment_ID = 0 ) { 182 $comment = get_comment( $comment_ID ); 173 183 return apply_filters('get_comment_author_IP', $comment->comment_author_IP); 174 184 } … … 179 189 * @since 0.71 180 190 * @see get_comment_author_IP() Echos Result 181 */ 182 function comment_author_IP() { 183 echo get_comment_author_IP(); 191 * 192 * @param int $comment_ID The ID of the comment for which to print the author's IP address. Optional. 193 */ 194 function comment_author_IP( $comment_ID = 0 ) { 195 echo get_comment_author_IP( $comment_ID ); 184 196 } 185 197 … … 190 202 * @uses apply_filters() Calls 'get_comment_author_url' hook on the comment author's URL 191 203 * 204 * @param int $comment_ID The ID of the comment for which to get the author's URL. Optional. 192 205 * @return string 193 206 */ 194 function get_comment_author_url( ) {195 global $comment;207 function get_comment_author_url( $comment_ID = 0 ) { 208 $comment = get_comment( $comment_ID ); 196 209 $url = ('http://' == $comment->comment_author_url) ? '' : $comment->comment_author_url; 197 210 $url = esc_url( $url, array('http', 'https') ); … … 205 218 * @uses apply_filters() 206 219 * @uses get_comment_author_url() Retrieves the comment author's URL 207 */ 208 function comment_author_url() { 209 echo apply_filters('comment_url', get_comment_author_url()); 220 * 221 * @param int $comment_ID The ID of the comment for which to print the author's URL. Optional. 222 */ 223 function comment_author_url( $comment_ID = 0 ) { 224 echo apply_filters('comment_url', get_comment_author_url( $comment_ID )); 210 225 } 211 226 … … 352 367 * 353 368 * @param string $d The format of the date (defaults to user's config) 369 * @param int $comment_ID The ID of the comment for which to get the date. Optional. 354 370 * @return string The comment's date 355 371 */ 356 function get_comment_date( $d = '' ) {357 global $comment;372 function get_comment_date( $d = '', $comment_ID = 0 ) { 373 $comment = get_comment( $comment_ID ); 358 374 if ( '' == $d ) 359 375 $date = mysql2date(get_option('date_format'), $comment->comment_date); … … 369 385 * 370 386 * @param string $d The format of the date (defaults to user's config) 371 */ 372 function comment_date( $d = '' ) { 373 echo get_comment_date( $d ); 387 * @param int $comment_ID The ID of the comment for which to print the date. Optional. 388 */ 389 function comment_date( $d = '', $comment_ID = 0 ) { 390 echo get_comment_date( $d, $comment_ID ); 374 391 } 375 392 … … 385 402 * @uses apply_filters() Calls 'get_comment_excerpt' on truncated comment 386 403 * 404 * @param int $comment_ID The ID of the comment for which to get the excerpt. Optional. 387 405 * @return string The maybe truncated comment with 20 words or less 388 406 */ 389 function get_comment_excerpt( ) {390 global $comment;407 function get_comment_excerpt( $comment_ID = 0 ) { 408 $comment = get_comment( $comment_ID ); 391 409 $comment_text = strip_tags($comment->comment_content); 392 410 $blah = explode(' ', $comment_text); … … 411 429 * @since 1.2.0 412 430 * @uses apply_filters() Calls 'comment_excerpt' hook before displaying excerpt 413 */ 414 function comment_excerpt() { 431 * 432 * @param int $comment_ID The ID of the comment for which to print the excerpt. Optional. 433 */ 434 function comment_excerpt( $comment_ID = 0 ) { 415 435 echo apply_filters('comment_excerpt', get_comment_excerpt() ); 416 436 } … … 576 596 * @uses $comment 577 597 * 598 * @param int $comment_ID The ID of the comment for which to get the text. Optional. 578 599 * @return string The comment content 579 600 */ 580 function get_comment_text( ) {581 global $comment;601 function get_comment_text( $comment_ID = 0 ) { 602 $comment = get_comment( $comment_ID ); 582 603 return apply_filters('get_comment_text', $comment->comment_content); 583 604 } … … 589 610 * @uses apply_filters() Passes the comment content through the 'comment_text' hook before display 590 611 * @uses get_comment_text() Gets the comment content 591 */ 592 function comment_text() { 612 * 613 * @param int $comment_ID The ID of the comment for which to print the text. Optional. 614 */ 615 function comment_text( $comment_ID = 0 ) { 593 616 echo apply_filters('comment_text', get_comment_text() ); 594 617 } … … 634 657 * @uses apply_filters() Calls the 'get_comment_type' hook on the comment type 635 658 * 659 * @param int $comment_ID The ID of the comment for which to get the type. Optional. 636 660 * @return string The comment type 637 661 */ 638 function get_comment_type() { 639 global $comment; 640 662 function get_comment_type( $comment_ID = 0 ) { 663 $comment = get_comment( $comment_ID ); 641 664 if ( '' == $comment->comment_type ) 642 665 $comment->comment_type = 'comment';
Note: See TracChangeset
for help on using the changeset viewer.