wordpress php internet explorer browser detection, add body class

ie_detection_to_body aggiunge delle classi css utilizzando body_class di wordpress, adottando un approcio simile a questo snippet

/*
    ie_detection_to_body uses worpress body_class filter
    http://codex.wordpress.org/Function_Reference/body_class
    it has a similar approach of http://simplemediacode.info/?p=1006
Copyright (C) 2013 Valerio Vendrame (lelebart) http://www.valeriovendrame.it/
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
function ie_detection_to_body( $classes ) {
    global $is_IE; $browser = $_SERVER['HTTP_USER_AGENT'];
    if ( $is_IE ) {    
        $classes[] = 'ie';    
        if ( isset( $browser ) && ( strpos( $browser , 'MSIE' ) !== false ) ) {
            preg_match('/MSIE (.*?);/', $browser, $matches);
            if ( count ( $matches ) > 1 ) {
                $classes[] = 'ie' . intval( $matches[1] );
                $classes[] = 'ie' . str_replace(".", "-", $matches[1] );
            }
        }
    }
    return $classes;
}
add_filter( 'body_class', 'ie_detection_to_body' );

pensato per un uso del tipo

.regola { /* per tutti */ }
.ie .regola { /* per internet explorer */ }
.ie.ie5.ie5-5 .regola { /* per internet explorer 5.5 */ }
.ie.ie7 .regola { /* per internet explorer 7.0 */ }