wp/wp-admin/includes/comment.php
author ymh <ymh.work@gmail.com>
Mon, 14 Oct 2019 17:39:30 +0200
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
permissions -rw-r--r--
resynchronize code repo with production
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * WordPress Comment Administration API.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * @subpackage Administration
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
     7
 * @since 2.3.0
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
 * Determine if a comment exists based on author and date.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    13
 * For best performance, use `$timezone = 'gmt'`, which queries a field that is properly indexed. The default value
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    14
 * for `$timezone` is 'blog' for legacy reasons.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    15
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
 * @since 2.0.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    17
 * @since 4.4.0 Added the `$timezone` parameter.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    18
 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    19
 * @global wpdb $wpdb WordPress database abstraction object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    21
 * @param string $comment_author Author of the comment.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    22
 * @param string $comment_date   Date of the comment.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    23
 * @param string $timezone       Timezone. Accepts 'blog' or 'gmt'. Default 'blog'.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    24
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
 * @return mixed Comment post ID on success.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    27
function comment_exists( $comment_author, $comment_date, $timezone = 'blog' ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
	global $wpdb;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    30
	$date_field = 'comment_date';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    31
	if ( 'gmt' === $timezone ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    32
		$date_field = 'comment_date_gmt';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    33
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
	return $wpdb->get_var( $wpdb->prepare("SELECT comment_post_ID FROM $wpdb->comments
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    36
			WHERE comment_author = %s AND $date_field = %s",
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    37
			stripslashes( $comment_author ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    38
			stripslashes( $comment_date )
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    39
	) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
 * Update a comment with values provided in $_POST.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
 * @since 2.0.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
function edit_comment() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
	if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) )
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    49
		wp_die ( __( 'Sorry, you are not allowed to edit comments on this post.' ) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
	if ( isset( $_POST['newcomment_author'] ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
		$_POST['comment_author'] = $_POST['newcomment_author'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
	if ( isset( $_POST['newcomment_author_email'] ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
		$_POST['comment_author_email'] = $_POST['newcomment_author_email'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
	if ( isset( $_POST['newcomment_author_url'] ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
		$_POST['comment_author_url'] = $_POST['newcomment_author_url'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
	if ( isset( $_POST['comment_status'] ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
		$_POST['comment_approved'] = $_POST['comment_status'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
	if ( isset( $_POST['content'] ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
		$_POST['comment_content'] = $_POST['content'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
	if ( isset( $_POST['comment_ID'] ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
		$_POST['comment_ID'] = (int) $_POST['comment_ID'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
	foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
		if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
			$_POST['edit_date'] = '1';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
			break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
	if ( !empty ( $_POST['edit_date'] ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
		$aa = $_POST['aa'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
		$mm = $_POST['mm'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
		$jj = $_POST['jj'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
		$hh = $_POST['hh'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
		$mn = $_POST['mn'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
		$ss = $_POST['ss'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
		$jj = ($jj > 31 ) ? 31 : $jj;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
		$hh = ($hh > 23 ) ? $hh -24 : $hh;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
		$mn = ($mn > 59 ) ? $mn -60 : $mn;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
		$ss = ($ss > 59 ) ? $ss -60 : $ss;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
		$_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
	wp_update_comment( $_POST );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    89
 * Returns a WP_Comment object based on comment ID.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
 * @since 2.0.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
 * @param int $id ID of comment to retrieve.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    94
 * @return WP_Comment|false Comment if found. False on failure.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
function get_comment_to_edit( $id ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
	if ( !$comment = get_comment($id) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
	$comment->comment_ID = (int) $comment->comment_ID;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
	$comment->comment_post_ID = (int) $comment->comment_post_ID;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
	$comment->comment_content = format_to_edit( $comment->comment_content );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
	/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   105
	 * Filters the comment content before editing.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
	 * @since 2.0.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
	 * @param string $comment->comment_content Comment content.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
	$comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
	$comment->comment_author = format_to_edit( $comment->comment_author );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
	$comment->comment_author_email = format_to_edit( $comment->comment_author_email );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
	$comment->comment_author_url = format_to_edit( $comment->comment_author_url );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
	$comment->comment_author_url = esc_url($comment->comment_author_url);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
	return $comment;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
 * Get the number of pending comments on a post or posts
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
 * @since 2.3.0
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   125
 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   126
 * @global wpdb $wpdb WordPress database abstraction object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
 * @param int|array $post_id Either a single Post ID or an array of Post IDs
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
 * @return int|array Either a single Posts pending comments as an int or an array of ints keyed on the Post IDs
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
function get_pending_comments_num( $post_id ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
	global $wpdb;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
	$single = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
	if ( !is_array($post_id) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
		$post_id_array = (array) $post_id;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
		$single = true;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
	} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
		$post_id_array = $post_id;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
	$post_id_array = array_map('intval', $post_id_array);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
	$post_id_in = "'" . implode("', '", $post_id_array) . "'";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
	$pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id_in ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_A );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   146
	if ( $single ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
		if ( empty($pending) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
			return 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
		else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
			return absint($pending[0]['num_comments']);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
	$pending_keyed = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
	// Default to zero pending for all posts in request
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
	foreach ( $post_id_array as $id )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
		$pending_keyed[$id] = 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
	if ( !empty($pending) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
		foreach ( $pending as $pend )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
			$pending_keyed[$pend['comment_post_ID']] = absint($pend['num_comments']);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
	return $pending_keyed;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
 * Add avatars to relevant places in admin, or try to.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
 * @since 2.5.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
 * @param string $name User name.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
 * @return string Avatar with Admin name.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
function floated_admin_avatar( $name ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   175
	$avatar = get_avatar( get_comment(), 32, 'mystery' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
	return "$avatar $name";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   179
/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   180
 * @since 2.7.0
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   181
 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
function enqueue_comment_hotkeys_js() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
	if ( 'true' == get_user_option( 'comment_shortcuts' ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
		wp_enqueue_script( 'jquery-table-hotkeys' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
}
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   186
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   187
/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   188
 * Display error message at bottom of comments.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   189
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   190
 * @param string $msg Error Message. Assumed to contain HTML and be sanitized.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   191
 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   192
function comment_footer_die( $msg ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   193
	echo "<div class='wrap'><p>$msg</p></div>";
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   194
	include( ABSPATH . 'wp-admin/admin-footer.php' );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   195
	die;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   196
}