From 5c2d25aa77625897e12aca6de5b5fa63f36af938 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 16 May 2014 11:10:14 +0000 Subject: [PATCH] Filter out empty and duplicate values in Comment Moderation and Comment Blacklist settings. props GaVrA. fixes #23800. Built from https://develop.svn.wordpress.org/trunk@28444 git-svn-id: http://core.svn.wordpress.org/trunk@28271 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 5efe0cdadb..aef9c5555c 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -3289,6 +3289,14 @@ function sanitize_option($option, $value) { if ( ! get_role( $value ) && get_role( 'subscriber' ) ) $value = 'subscriber'; break; + + case 'moderation_keys': + case 'blacklist_keys': + $value = explode( "\n", $value ); + $value = array_filter( array_map( 'trim', $value ) ); + $value = array_unique( $value ); + $value = implode( "\n", $value ); + break; } /**