X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/699231ae09f7057a4d0000cdf32e50a3df6a04ca..8a4706fdeb1ae30268e510df6ccf3c39b3028059:/wp-includes/comment-template.php
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php
index 4bc9edb8..8be25e10 100644
--- a/wp-includes/comment-template.php
+++ b/wp-includes/comment-template.php
@@ -55,7 +55,7 @@ function comment_author( $comment_ID = 0 ) {
* @uses apply_filters() Calls the 'get_comment_author_email' hook on the comment author email
* @uses $comment
*
- * @param int $comment_ID The ID of the comment for which to get the author's email. Optional.
+ * @param int $comment_ID The ID of the comment for which to get the author's email. Optional.
* @return string The current comment author's email
*/
function get_comment_author_email( $comment_ID = 0 ) {
@@ -141,7 +141,7 @@ function get_comment_author_email_link($linktext='', $before='', $after='') {
* @since 1.5.0
* @uses apply_filters() Calls 'get_comment_author_link' hook on the complete link HTML or author
*
- * @param int $comment_ID The ID of the comment for which to get the author's link. Optional.
+ * @param int $comment_ID The ID of the comment for which to get the author's link. Optional.
* @return string Comment Author name or HTML link for author's URL
*/
function get_comment_author_link( $comment_ID = 0 ) {
@@ -162,7 +162,7 @@ function get_comment_author_link( $comment_ID = 0 ) {
* @since 0.71
* @see get_comment_author_link() Echoes result
*
- * @param int The ID of the comment for which to print the author's link. Optional.
+ * @param int $comment_ID The ID of the comment for which to print the author's link. Optional.
*/
function comment_author_link( $comment_ID = 0 ) {
echo get_comment_author_link( $comment_ID );
@@ -189,7 +189,7 @@ function get_comment_author_IP( $comment_ID = 0 ) {
* @since 0.71
* @see get_comment_author_IP() Echoes Result
*
- * @param int $comment_ID The ID of the comment for which to print the author's IP address. Optional.
+ * @param int $comment_ID The ID of the comment for which to print the author's IP address. Optional.
*/
function comment_author_IP( $comment_ID = 0 ) {
echo get_comment_author_IP( $comment_ID );
@@ -201,7 +201,7 @@ function comment_author_IP( $comment_ID = 0 ) {
* @since 1.5.0
* @uses apply_filters() Calls 'get_comment_author_url' hook on the comment author's URL
*
- * @param int $comment_ID The ID of the comment for which to get the author's URL. Optional.
+ * @param int $comment_ID The ID of the comment for which to get the author's URL. Optional.
* @return string
*/
function get_comment_author_url( $comment_ID = 0 ) {
@@ -362,7 +362,7 @@ function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
* Retrieve the comment date of the current comment.
*
* @since 1.5.0
- * @uses apply_filters() Calls 'get_comment_date' hook with the formated date and the $d parameter respectively
+ * @uses apply_filters() Calls 'get_comment_date' hook with the formatted date and the $d parameter respectively
* @uses $comment
*
* @param string $d The format of the date (defaults to user's config)
@@ -384,7 +384,7 @@ function get_comment_date( $d = '', $comment_ID = 0 ) {
* @since 0.71
*
* @param string $d The format of the date (defaults to user's config)
- * @param int $comment_ID The ID of the comment for which to print the date. Optional.
+ * @param int $comment_ID The ID of the comment for which to print the date. Optional.
*/
function comment_date( $d = '', $comment_ID = 0 ) {
echo get_comment_date( $d, $comment_ID );
@@ -545,11 +545,10 @@ function comments_link( $deprecated = '', $deprecated_2 = '' ) {
* @return int The number of comments a post has
*/
function get_comments_number( $post_id = 0 ) {
- global $id;
- $post_id = (int) $post_id;
+ $post_id = absint( $post_id );
if ( !$post_id )
- $post_id = (int) $id;
+ $post_id = get_the_ID();
$post = get_post($post_id);
if ( ! isset($post->comment_count) )
@@ -564,7 +563,6 @@ function get_comments_number( $post_id = 0 ) {
* Display the language string for the number of comments the current post has.
*
* @since 0.71
- * @uses $id
* @uses apply_filters() Calls the 'comments_number' hook on the output and number of comments respectively.
*
* @param string $zero Text for no comments
@@ -573,12 +571,10 @@ function get_comments_number( $post_id = 0 ) {
* @param string $deprecated Not used.
*/
function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) {
- global $id;
-
if ( !empty( $deprecated ) )
_deprecated_argument( __FUNCTION__, '1.3' );
- $number = get_comments_number($id);
+ $number = get_comments_number();
if ( $number > 1 )
$output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more);
@@ -601,7 +597,7 @@ function comments_number( $zero = false, $one = false, $more = false, $deprecate
*/
function get_comment_text( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
- return apply_filters('get_comment_text', $comment->comment_content);
+ return apply_filters( 'get_comment_text', $comment->comment_content, $comment );
}
/**
@@ -614,7 +610,8 @@ function get_comment_text( $comment_ID = 0 ) {
* @param int $comment_ID The ID of the comment for which to print the text. Optional.
*/
function comment_text( $comment_ID = 0 ) {
- echo apply_filters('comment_text', get_comment_text() );
+ $comment = get_comment( $comment_ID );
+ echo apply_filters( 'comment_text', get_comment_text( $comment_ID ), $comment );
}
/**
@@ -678,9 +675,9 @@ function get_comment_type( $comment_ID = 0 ) {
* @param string $pingbacktxt The string to display for pingback type
*/
function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = false) {
- if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' );
- if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' );
- if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' );
+ if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' );
+ if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' );
+ if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' );
$type = get_comment_type();
switch( $type ) {
case 'trackback' :
@@ -703,16 +700,14 @@ function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt =
*
* @since 1.5.0
* @uses apply_filters() Calls 'trackback_url' on the resulting trackback URL
- * @uses $id
*
* @return string The trackback URL after being filtered
*/
function get_trackback_url() {
- global $id;
if ( '' != get_option('permalink_structure') ) {
$tb_url = trailingslashit(get_permalink()) . user_trailingslashit('trackback', 'single_trackback');
} else {
- $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . $id;
+ $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . get_the_ID();
}
return apply_filters('trackback_url', $tb_url);
}
@@ -735,6 +730,36 @@ function trackback_url( $deprecated_echo = true ) {
return get_trackback_url();
}
+/**
+ * Generates and displays the RDF for the trackback information of current post.
+ *
+ * Deprecated in 3.0.0, and restored in 3.0.1.
+ *
+ * @since 0.71
+ *
+ * @param int $deprecated Not used (Was $timezone = 0)
+ */
+function trackback_rdf( $deprecated = '' ) {
+ if ( !empty( $deprecated ) )
+ _deprecated_argument( __FUNCTION__, '2.5' );
+
+ if ( false !== stripos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') )
+ return;
+
+ echo '
@@ -1353,14 +1378,14 @@ class Walker_Comment extends Walker {
/**
* @see Walker::end_el()
- * @since unknown
+ * @since 2.7.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $comment
* @param int $depth Depth of comment.
* @param array $args
*/
- function end_el(&$output, $comment, $depth, $args) {
+ function end_el(&$output, $comment, $depth = 0, $args = array() ) {
if ( !empty($args['end-callback']) ) {
call_user_func($args['end-callback'], $comment, $args, $depth);
return;
@@ -1382,7 +1407,7 @@ class Walker_Comment extends Walker {
* @uses Walker_Comment
*
* @param string|array $args Formatting options
- * @param array $comments Optional array of comment objects. Defaults to $wp_query->comments
+ * @param array $comments Optional array of comment objects. Defaults to $wp_query->comments
*/
function wp_list_comments($args = array(), $comments = null ) {
global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop;
@@ -1403,7 +1428,7 @@ function wp_list_comments($args = array(), $comments = null ) {
if ( empty($comments) )
return;
if ( 'all' != $r['type'] ) {
- $comments_by_type = &separate_comments($comments);
+ $comments_by_type = separate_comments($comments);
if ( empty($comments_by_type[$r['type']]) )
return;
$_comments = $comments_by_type[$r['type']];
@@ -1415,7 +1440,7 @@ function wp_list_comments($args = array(), $comments = null ) {
return;
if ( 'all' != $r['type'] ) {
if ( empty($wp_query->comments_by_type) )
- $wp_query->comments_by_type = &separate_comments($wp_query->comments);
+ $wp_query->comments_by_type = separate_comments($wp_query->comments);
if ( empty($wp_query->comments_by_type[$r['type']]) )
return;
$_comments = $wp_query->comments_by_type[$r['type']];
@@ -1482,7 +1507,7 @@ function wp_list_comments($args = array(), $comments = null ) {
* @return void
*/
function comment_form( $args = array(), $post_id = null ) {
- global $user_identity, $id;
+ global $id;
if ( null === $post_id )
$post_id = $id;
@@ -1490,13 +1515,15 @@ function comment_form( $args = array(), $post_id = null ) {
$id = $post_id;
$commenter = wp_get_current_commenter();
+ $user = wp_get_current_user();
+ $user_identity = $user->exists() ? $user->display_name : '';
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$fields = array(
- 'author' => '
' . ( $req ? '*' : '' ) . + 'email' => '
' . '
', 'url' => '' . '
', @@ -1506,8 +1533,8 @@ function comment_form( $args = array(), $post_id = null ) { $defaults = array( 'fields' => apply_filters( 'comment_form_default_fields', $fields ), 'comment_field' => '', - 'must_log_in' => '' . sprintf( __( 'You must be logged in to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '
', - 'logged_in_as' => '' . sprintf( __( 'Logged in as %2$s. Log out?' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '
', + 'must_log_in' => '' . sprintf( __( 'You must be logged in to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '
', + 'logged_in_as' => '' . sprintf( __( 'Logged in as %2$s. Log out?' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '
', 'comment_notes_before' => '' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '
', 'comment_notes_after' => ' ', 'id_form' => 'commentform', @@ -1521,7 +1548,7 @@ function comment_form( $args = array(), $post_id = null ) { $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); ?> - +- +
@@ -1560,5 +1587,3 @@ function comment_form( $args = array(), $post_id = null ) {