Changeset 11433 for trunk/wp-includes/formatting.php
- Timestamp:
- 05/22/2009 05:44:26 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r11414 r11433 717 717 return false; 718 718 return $orderby; 719 } 720 721 /** 722 * Santises a css classname to ensure it only contains valid characters 723 * 724 * Strips the classname down to A-Z,a-z,0-9,'-' if this results in an empty 725 * string then it will return the alternative value supplied. 726 * 727 * @param string $classname The classname to be sanitised 728 * @param string $alternative The value to return if the sanitisation end's up as an empty string. 729 * @return string The sanitised value 730 */ 731 function sanitise_css_classname($classname, $alternative){ 732 //Strip out any % encoded octets 733 $sanitised = preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $classname); 734 735 //Limit to A-Z,a-z,0-9,'-' 736 $sanitised = preg_replace('/[^A-Za-z0-9-]/', '', $sanitised); 737 738 if ('' == $sanitised) 739 $sanitised = $alternative; 740 741 return apply_filters('sanitise_css_classname',$sanitised, $classname, $alternative); 719 742 } 720 743
Note: See TracChangeset
for help on using the changeset viewer.