Code Duplication    Length = 35-35 lines in 2 locations

wp-includes/comment.php 2 locations

@@ 1261-1295 (lines=35) @@
1258
 * @param int|WP_Comment $comment_id Comment ID or WP_Comment object.
1259
 * @return bool True on success, false on failure.
1260
 */
1261
function wp_untrash_comment($comment_id) {
1262
	$comment = get_comment( $comment_id );
1263
	if ( ! $comment ) {
1264
		return false;
1265
	}
1266
1267
	/**
1268
	 * Fires immediately before a comment is restored from the Trash.
1269
	 *
1270
	 * @since 2.9.0
1271
	 *
1272
	 * @param int $comment_id The comment ID.
1273
	 */
1274
	do_action( 'untrash_comment', $comment->comment_ID );
1275
1276
	$status = (string) get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true );
1277
	if ( empty($status) )
1278
		$status = '0';
1279
1280
	if ( wp_set_comment_status( $comment, $status ) ) {
1281
		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' );
1282
		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' );
1283
		/**
1284
		 * Fires immediately after a comment is restored from the Trash.
1285
		 *
1286
		 * @since 2.9.0
1287
		 *
1288
		 * @param int $comment_id The comment ID.
1289
		 */
1290
		do_action( 'untrashed_comment', $comment->comment_ID );
1291
		return true;
1292
	}
1293
1294
	return false;
1295
}
1296
1297
/**
1298
 * Marks a comment as Spam
@@ 1347-1381 (lines=35) @@
1344
 * @param int|WP_Comment $comment_id Comment ID or WP_Comment object.
1345
 * @return bool True on success, false on failure.
1346
 */
1347
function wp_unspam_comment( $comment_id ) {
1348
	$comment = get_comment( $comment_id );
1349
	if ( ! $comment ) {
1350
		return false;
1351
	}
1352
1353
	/**
1354
	 * Fires immediately before a comment is unmarked as Spam.
1355
	 *
1356
	 * @since 2.9.0
1357
	 *
1358
	 * @param int $comment_id The comment ID.
1359
	 */
1360
	do_action( 'unspam_comment', $comment->comment_ID );
1361
1362
	$status = (string) get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true );
1363
	if ( empty($status) )
1364
		$status = '0';
1365
1366
	if ( wp_set_comment_status( $comment, $status ) ) {
1367
		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' );
1368
		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' );
1369
		/**
1370
		 * Fires immediately after a comment is unmarked as Spam.
1371
		 *
1372
		 * @since 2.9.0
1373
		 *
1374
		 * @param int $comment_id The comment ID.
1375
		 */
1376
		do_action( 'unspammed_comment', $comment->comment_ID );
1377
		return true;
1378
	}
1379
1380
	return false;
1381
}
1382
1383
/**
1384
 * The status of a comment by ID.