Changeset 15948 for trunk/wp-includes/formatting.php
- Timestamp:
- 10/24/2010 08:33:54 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r15931 r15948 725 725 * Sanitize username stripping out unsafe characters. 726 726 * 727 * If $strict is true, only alphanumeric characters (as well as _, space, ., -, 728 * @) are returned. 729 * Removes tags, octets, entities, and if strict is enabled, will remove all 730 * non-ASCII characters. After sanitizing, it passes the username, raw username 731 * (the username in the parameter), and the strict parameter as parameters for 732 * the filter. 727 * Removes tags, octets, entities, and if strict is enabled, will only keep 728 * alphanumeric, _, space, ., -, @. After sanitizing, it passes the username, 729 * raw username (the username in the parameter), and the value of $strict as 730 * parameters for the 'sanitize_user' filter. 733 731 * 734 732 * @since 2.0.0 … … 752 750 $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username ); 753 751 752 $username = trim( $username ); 754 753 // Consolidate contiguous whitespace 755 754 $username = preg_replace( '|\s+|', ' ', $username ); … … 761 760 * Sanitize a string key. 762 761 * 763 * Keys are used as internal identifiers. They should be lowercase ASCII. Dashes and underscores are allowed.762 * Keys are used as internal identifiers. Lowercase alphanumeric characters, dashes and underscores are allowed. 764 763 * 765 764 * @since 3.0.0 … … 770 769 function sanitize_key( $key ) { 771 770 $raw_key = $key; 772 773 $key = preg_replace('|[^a-z0-9 _.\-@]|i', '', $key); 774 775 // Consolidate contiguous whitespace 776 $key = preg_replace('|\s+|', ' ', $key); 777 778 return apply_filters('sanitize_key', $key, $raw_key); 771 $key = strtolower( $key ); 772 $key = preg_replace( '/[^a-z0-9_\-]/', '', $key ); 773 return apply_filters( 'sanitize_key', $key, $raw_key ); 779 774 } 780 775
Note: See TracChangeset
for help on using the changeset viewer.