* @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 );
* @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) )
* 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
* @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);
*/
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 );
}
/**
* @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 );
}
/**
* @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' :
*
* @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);
}
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 '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
+ <rdf:Description rdf:about="';
+ the_permalink();
+ echo '"'."\n";
+ echo ' dc:identifier="';
+ the_permalink();
+ echo '"'."\n";
+ echo ' dc:title="'.str_replace('--', '--', wptexturize(strip_tags(get_the_title()))).'"'."\n";
+ echo ' trackback:ping="'.get_trackback_url().'"'." />\n";
+ echo '</rdf:RDF>';
+}
+
/**
* Whether the current post is open for comments.
*
* @since 1.5.0
* @global array $comment List of comment objects for the current post
* @uses $wpdb
- * @uses $id
* @uses $post
* @uses $withcomments Will not try to get the comments if the post has none.
*
elseif ( file_exists( TEMPLATEPATH . $file ) )
require( TEMPLATEPATH . $file );
else // Backward compat code will be removed in a future release
- require( WPINC . '/theme-compat/comments.php');
+ require( ABSPATH . WPINC . '/theme-compat/comments.php');
}
/**
* lists of posts
*
* @since 0.71
- * @uses $id
* @uses $wpcommentspopupfile
* @uses $wpcommentsjavascript
* @uses $post
* @return null Returns null on single posts and pages.
*/
function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
- global $id, $wpcommentspopupfile, $wpcommentsjavascript;
+ global $wpcommentspopupfile, $wpcommentsjavascript;
- if ( false === $zero ) $zero = __( 'No Comments' );
- if ( false === $one ) $one = __( '1 Comment' );
- if ( false === $more ) $more = __( '% Comments' );
- if ( false === $none ) $none = __( 'Comments Off' );
+ $id = get_the_ID();
+
+ if ( false === $zero ) $zero = __( 'No Comments' );
+ if ( false === $one ) $one = __( '1 Comment' );
+ if ( false === $more ) $more = __( '% Comments' );
+ if ( false === $none ) $none = __( 'Comments Off' );
$number = get_comments_number( $id );
if ( get_option('comment_registration') && !$user_ID )
$link = '<a rel="nofollow" class="comment-reply-login" href="' . esc_url( wp_login_url( get_permalink() ) ) . '">' . $login_text . '</a>';
else
- $link = "<a rel='nofollow' class='comment-reply-link' href='" . esc_url( add_query_arg( 'replytocom', $comment->comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
+ $link = "<a class='comment-reply-link' href='" . esc_url( add_query_arg( 'replytocom', $comment->comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);
}
*
* @return string Hidden input HTML for replying to comments
*/
-function get_comment_id_fields() {
- global $id;
+function get_comment_id_fields( $id = 0 ) {
+ if ( empty( $id ) )
+ $id = get_the_ID();
$replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
$result = "<input type='hidden' name='comment_post_ID' value='$id' id='comment_post_ID' />\n";
* @since 2.7.0
* @see get_comment_id_fields() Echoes result
*/
-function comment_id_fields() {
- echo get_comment_id_fields();
+function comment_id_fields( $id = 0 ) {
+ echo get_comment_id_fields( $id );
}
/**
*
* @package WordPress
* @uses Walker
- * @since unknown
+ * @since 2.7.0
*/
class Walker_Comment extends Walker {
/**
* @see Walker::$tree_type
- * @since unknown
+ * @since 2.7.0
* @var string
*/
var $tree_type = 'comment';
/**
* @see Walker::$db_fields
- * @since unknown
+ * @since 2.7.0
* @var array
*/
var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID');
/**
* @see Walker::start_lvl()
- * @since unknown
+ * @since 2.7.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of comment.
/**
* @see Walker::end_lvl()
- * @since unknown
+ * @since 2.7.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of comment.
/**
* @see Walker::start_el()
- * @since unknown
+ * @since 2.7.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $comment Comment data object.
<?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
</div>
<?php if ($comment->comment_approved == '0') : ?>
- <em><?php _e('Your comment is awaiting moderation.') ?></em>
+ <em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?></em>
<br />
<?php endif; ?>
/**
* @see Walker::end_el()
- * @since unknown
+ * @since 2.7.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $comment
<?php echo $args['comment_notes_after']; ?>
<p class="form-submit">
<input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" value="<?php echo esc_attr( $args['label_submit'] ); ?>" />
- <?php comment_id_fields(); ?>
+ <?php comment_id_fields( $post_id ); ?>
</p>
<?php do_action( 'comment_form', $post_id ); ?>
</form>