[2.2] Simplified attribute name sanitisation which maintains UTF8 char integrity.

Fixes #5434
This commit is contained in:
Mike Jolley 2014-05-07 15:02:00 +01:00
parent 588242e5bd
commit 83f1236875
1 changed files with 2 additions and 7 deletions

View File

@ -15,19 +15,14 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Sanitize taxonomy names. Slug format (no spaces, lowercase).
*
* Doesn't use sanitize_title as this destroys utf chars.
* urldecode is used to reverse munging of UTF8 characters.
*
* @access public
* @param mixed $taxonomy
* @return string
*/
function wc_sanitize_taxonomy_name( $taxonomy ) {
$filtered = strtolower( remove_accents( stripslashes( strip_tags( $taxonomy ) ) ) );
$filtered = preg_replace( '/&.+?;/', '', $filtered ); // Kill entities
$filtered = str_replace( array( '.', '\'', '"' ), '', $filtered ); // Kill quotes and full stops.
$filtered = str_replace( array( ' ', '_' ), '-', $filtered ); // Replace spaces and underscores.
return apply_filters( 'sanitize_taxonomy_name', $filtered, $taxonomy );
return apply_filters( 'sanitize_taxonomy_name', urldecode( sanitize_title( $taxonomy ) ), $taxonomy );
}
/**