From 9b9366c67521aa4f128894dfc1f7efeb0ff4875f Mon Sep 17 00:00:00 2001 From: James Collins Date: Thu, 19 Apr 2012 17:14:48 +1000 Subject: [PATCH] Body Classes should be sanitised Correctly add the current theme's name to the classes. Previously, theme names that contain spaces and other strange characters would cause problems. Also ensure that any other body classes that WooCommerce adds are also sanitised. --- woocommerce.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/woocommerce.php b/woocommerce.php index f300dd83747..54761377f79 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -424,7 +424,7 @@ class Woocommerce { * Add body classes **/ function wp_head() { - $this->add_body_class('theme-' . strtolower( get_current_theme() )); + $this->add_body_class('theme-' . get_current_theme() ); if ( is_woocommerce() ) $this->add_body_class('woocommerce'); @@ -1354,7 +1354,7 @@ class Woocommerce { /** Body Classes **********************************************************/ function add_body_class( $class ) { - $this->_body_classes[] = $class; + $this->_body_classes[] = sanitize_html_class( strtolower($class) ); } function output_body_class( $classes ) {