From 8961a61f89f3c1ee9be8db794c751bd33f3144f3 Mon Sep 17 00:00:00 2001 From: nacin Date: Thu, 16 Feb 2012 15:42:02 +0000 Subject: [PATCH] Combine two identical case statements. git-svn-id: http://svn.automattic.com/wordpress/trunk@19933 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 7e5a760a7..e7a022686 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -2620,21 +2620,13 @@ function wp_make_link_relative( $link ) { function sanitize_option($option, $value) { switch ( $option ) { - case 'admin_email': - $value = sanitize_email($value); - if ( !is_email($value) ) { + case 'admin_email' : + case 'new_admin_email' : + $value = sanitize_email( $value ); + if ( ! is_email( $value ) ) { $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization - if ( function_exists('add_settings_error') ) - add_settings_error('admin_email', 'invalid_admin_email', __('The email address entered did not appear to be a valid email address. Please enter a valid email address.')); - } - break; - - case 'new_admin_email': - $value = sanitize_email($value); - if ( !is_email($value) ) { - $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization - if ( function_exists('add_settings_error') ) - add_settings_error('new_admin_email', 'invalid_admin_email', __('The email address entered did not appear to be a valid email address. Please enter a valid email address.')); + if ( function_exists( 'add_settings_error' ) ) + add_settings_error( $option, 'invalid_admin_email', __( 'The email address entered did not appear to be a valid email address. Please enter a valid email address.' ) ); } break;