wp/wp-admin/includes/comment.php
changeset 21 48c4eec2b7e6
parent 18 be944660c56a
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  * @since 2.3.0
     7  * @since 2.3.0
     8  */
     8  */
     9 
     9 
    10 /**
    10 /**
    11  * Determine if a comment exists based on author and date.
    11  * Determines if a comment exists based on author and date.
    12  *
    12  *
    13  * For best performance, use `$timezone = 'gmt'`, which queries a field that is properly indexed. The default value
    13  * For best performance, use `$timezone = 'gmt'`, which queries a field that is properly indexed. The default value
    14  * for `$timezone` is 'blog' for legacy reasons.
    14  * for `$timezone` is 'blog' for legacy reasons.
    15  *
    15  *
    16  * @since 2.0.0
    16  * @since 2.0.0
    40 		)
    40 		)
    41 	);
    41 	);
    42 }
    42 }
    43 
    43 
    44 /**
    44 /**
    45  * Update a comment with values provided in $_POST.
    45  * Updates a comment with values provided in $_POST.
    46  *
    46  *
    47  * @since 2.0.0
    47  * @since 2.0.0
    48  * @since 5.5.0 A return value was added.
    48  * @since 5.5.0 A return value was added.
    49  *
    49  *
    50  * @return int|WP_Error The value 1 if the comment was updated, 0 if not updated.
    50  * @return int|WP_Error The value 1 if the comment was updated, 0 if not updated.
   133 
   133 
   134 	return $comment;
   134 	return $comment;
   135 }
   135 }
   136 
   136 
   137 /**
   137 /**
   138  * Get the number of pending comments on a post or posts
   138  * Gets the number of pending comments on a post or posts.
   139  *
   139  *
   140  * @since 2.3.0
   140  * @since 2.3.0
   141  *
   141  *
   142  * @global wpdb $wpdb WordPress database abstraction object.
   142  * @global wpdb $wpdb WordPress database abstraction object.
   143  *
   143  *
   195 	$avatar = get_avatar( get_comment(), 32, 'mystery' );
   195 	$avatar = get_avatar( get_comment(), 32, 'mystery' );
   196 	return "$avatar $name";
   196 	return "$avatar $name";
   197 }
   197 }
   198 
   198 
   199 /**
   199 /**
       
   200  * Enqueues comment shortcuts jQuery script.
       
   201  *
   200  * @since 2.7.0
   202  * @since 2.7.0
   201  */
   203  */
   202 function enqueue_comment_hotkeys_js() {
   204 function enqueue_comment_hotkeys_js() {
   203 	if ( 'true' === get_user_option( 'comment_shortcuts' ) ) {
   205 	if ( 'true' === get_user_option( 'comment_shortcuts' ) ) {
   204 		wp_enqueue_script( 'jquery-table-hotkeys' );
   206 		wp_enqueue_script( 'jquery-table-hotkeys' );
   205 	}
   207 	}
   206 }
   208 }
   207 
   209 
   208 /**
   210 /**
   209  * Display error message at bottom of comments.
   211  * Displays error message at bottom of comments.
   210  *
   212  *
   211  * @param string $msg Error Message. Assumed to contain HTML and be sanitized.
   213  * @param string $msg Error Message. Assumed to contain HTML and be sanitized.
   212  */
   214  */
   213 function comment_footer_die( $msg ) {
   215 function comment_footer_die( $msg ) {
   214 	echo "<div class='wrap'><p>$msg</p></div>";
   216 	echo "<div class='wrap'><p>$msg</p></div>";