* @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 ) {
* @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 ) {
* @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 );
* @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 ) {
* @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 );
* @param int $post_id An optional post ID to check instead of the current post.
* @return bool True if the comments are open
*/
-function comments_open( $post_id=NULL ) {
+function comments_open( $post_id = null ) {
$_post = get_post($post_id);
* @param int $post_id An optional post ID to check instead of the current post.
* @return bool True if pings are accepted
*/
-function pings_open( $post_id = NULL ) {
+function pings_open( $post_id = null ) {
$_post = get_post($post_id);
* @uses $post Gets the ID of the current post for the token
*/
function wp_comment_form_unfiltered_html_nonce() {
- global $post;
+ $post = get_post();
+ $post_id = $post ? $post->ID : 0;
- $post_id = 0;
- if ( !empty($post) )
- $post_id = $post->ID;
-
- if ( current_user_can('unfiltered_html') )
- wp_nonce_field('unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment', false);
+ if ( current_user_can( 'unfiltered_html' ) ) {
+ wp_nonce_field( 'unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment_disabled', false );
+ echo "<script>(function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();</script>\n";
+ }
}
/**
update_comment_cache($wp_query->comments);
if ( $separate_comments ) {
- $wp_query->comments_by_type = &separate_comments($comments);
+ $wp_query->comments_by_type = separate_comments($comments);
$comments_by_type = &$wp_query->comments_by_type;
}
- $overridden_cpage = FALSE;
+ $overridden_cpage = false;
if ( '' == get_query_var('cpage') && get_option('page_comments') ) {
set_query_var( 'cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1 );
- $overridden_cpage = TRUE;
+ $overridden_cpage = true;
}
- if ( !defined('COMMENTS_TEMPLATE') || !COMMENTS_TEMPLATE)
+ if ( !defined('COMMENTS_TEMPLATE') )
define('COMMENTS_TEMPLATE', true);
$include = apply_filters('comments_template', STYLESHEETPATH . $file );
if ( file_exists( $include ) )
require( $include );
elseif ( file_exists( TEMPLATEPATH . $file ) )
- require( TEMPLATEPATH . $file );
+ require( TEMPLATEPATH . $file );
else // Backward compat code will be removed in a future release
require( ABSPATH . WPINC . '/theme-compat/comments.php');
}
* @since 2.7.0
*
* @param array $args Optional. Override default options.
- * @param int|object $post Optional. Post that the comment is going to be displayed on. Defaults to current post.
+ * @param int|object $post Optional. Post that the comment is going to be displayed on. Defaults to current post.
* @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
*/
function get_post_reply_link($args = array(), $post = null) {
* @param string $replytext Optional. Text to display when replying to a comment. Accepts "%s" for the author of the comment being replied to.
* @param string $linktoparent Optional. Boolean to control making the author's name a link to their comment.
*/
-function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = TRUE ) {
+function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) {
global $comment;
if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' );
* @param int $depth Depth of comment.
* @param array $args Uses 'style' argument for type of HTML list.
*/
- function start_lvl(&$output, $depth, $args) {
+ function start_lvl( &$output, $depth = 0, $args = array() ) {
$GLOBALS['comment_depth'] = $depth + 1;
switch ( $args['style'] ) {
* @param int $depth Depth of comment.
* @param array $args Will only append content if style argument value is 'ol' or 'ul'.
*/
- function end_lvl(&$output, $depth, $args) {
+ function end_lvl( &$output, $depth = 0, $args = array() ) {
$GLOBALS['comment_depth'] = $depth + 1;
switch ( $args['style'] ) {
* @param int $depth Depth of comment in reference to parents.
* @param array $args
*/
- function start_el(&$output, $comment, $depth, $args) {
+ function start_el( &$output, $comment, $depth, $args, $id = 0 ) {
$depth++;
$GLOBALS['comment_depth'] = $depth;
+ $GLOBALS['comment'] = $comment;
if ( !empty($args['callback']) ) {
call_user_func($args['callback'], $comment, $args, $depth);
return;
}
- $GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ( 'div' == $args['style'] ) {
* @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;
* @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;
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']];
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']];
$commenter = wp_get_current_commenter();
$user = wp_get_current_user();
- $user_identity = ! empty( $user->ID ) ? $user->display_name : '';
+ $user_identity = $user->exists() ? $user->display_name : '';
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$fields = array(
- 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
+ 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
- 'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
+ 'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
'<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label>' .
'<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
$defaults = array(
'fields' => apply_filters( 'comment_form_default_fields', $fields ),
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
- 'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
- 'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
+ 'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
+ 'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>',
'id_form' => 'commentform',
$args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) );
?>
- <?php if ( comments_open() ) : ?>
+ <?php if ( comments_open( $post_id ) ) : ?>
<?php do_action( 'comment_form_before' ); ?>
<div id="respond">
<h3 id="reply-title"><?php comment_form_title( $args['title_reply'], $args['title_reply_to'] ); ?> <small><?php cancel_comment_reply_link( $args['cancel_reply_link'] ); ?></small></h3>
<?php endif; ?>
<?php
}
-
-?>