From 4585195977b1a2021412d6c419f62d7a1f7c1850 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 16 May 2014 11:09:28 +0000 Subject: [PATCH] Filter out empty and duplicate values in Comment Moderation and Comment Blacklist settings. props GaVrA. fixes #23800. git-svn-id: https://develop.svn.wordpress.org/trunk@28444 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/formatting.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 5efe0cdadb..aef9c5555c 100644 --- a/src/wp-includes/formatting.php +++ b/src/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; } /**