Changeset 23365
- Timestamp:
- 02/01/2013 06:07:08 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r23361 r23365 6 6 * 7 7 * @package WordPress 8 * */8 */ 9 9 10 10 /** … … 135 135 * on tag close. Assumes first character of $text is tag opening. 136 136 * 137 * @since 2.9.0 137 138 * @access private 138 * @since 2.9.0139 139 * 140 140 * @param string $text Text to check. First character is assumed to be $opening … … 263 263 * @since 3.1.0 264 264 * @access private 265 * 265 266 * @param array $matches preg_replace_callback matches array 266 267 * @return string … … 364 365 * 365 366 * @since 1.2.2 367 * @access private 366 368 * 367 369 * @param string $string The text which is to be encoded. … … 443 445 * or ENT_QUOTES to do both " and '. Default is ENT_NOQUOTES where no quotes are decoded. 444 446 * 445 * @since 2.8 447 * @since 2.8.0 446 448 * 447 449 * @param string $string The text which is to be decoded. … … 500 502 * Checks for invalid UTF8 in a string. 501 503 * 502 * @since 2.8 504 * @since 2.8.0 503 505 * 504 506 * @param string $string The text which is to be checked. … … 825 827 826 828 /** 827 * Sanitizes a filename replacing whitespace with dashes829 * Sanitizes a filename, replacing whitespace with dashes. 828 830 * 829 831 * Removes special characters that are illegal in filenames on certain 830 832 * operating systems and special characters requiring special escaping 831 833 * to manipulate at the command line. Replaces spaces and consecutive 832 * dashes with a single dash. Trim period, dash and underscore from beginning834 * dashes with a single dash. Trims period, dash and underscore from beginning 833 835 * and end of filename. 834 836 * … … 882 884 883 885 /** 884 * Sanitize usernamestripping out unsafe characters.886 * Sanitizes a username, stripping out unsafe characters. 885 887 * 886 888 * Removes tags, octets, entities, and if strict is enabled, will only keep … … 917 919 918 920 /** 919 * Sanitize a string key.921 * Sanitizes a string key. 920 922 * 921 923 * Keys are used as internal identifiers. Lowercase alphanumeric characters, dashes and underscores are allowed. … … 934 936 935 937 /** 936 * Sanitizes title or usefallback title.938 * Sanitizes a title, or returns a fallback title. 937 939 * 938 940 * Specifically, HTML and PHP tags are stripped. Further actions can be added … … 947 949 * @return string The sanitized string. 948 950 */ 949 function sanitize_title( $title, $fallback_title = '', $context = 'save') {951 function sanitize_title( $title, $fallback_title = '', $context = 'save' ) { 950 952 $raw_title = $title; 951 953 … … 961 963 } 962 964 963 function sanitize_title_for_query($title) { 964 return sanitize_title($title, '', 'query'); 965 } 966 967 /** 968 * Sanitizes title, replacing whitespace and a few other characters with dashes. 965 /** 966 * Sanitizes a title with the 'query' context. 967 * 968 * Used for querying the database for a value from URL. 969 * 970 * @since 3.1.0 971 * @uses sanitize_title() 972 * 973 * @param string $title The string to be sanitized. 974 * @return string The sanitized string. 975 */ 976 function sanitize_title_for_query( $title ) { 977 return sanitize_title( $title, '', 'query' ); 978 } 979 980 /** 981 * Sanitizes a title, replacing whitespace and a few other characters with dashes. 969 982 * 970 983 * Limits the output to alphanumeric characters, underscore (_) and dash (-). … … 978 991 * @return string The sanitized title. 979 992 */ 980 function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display') {993 function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) { 981 994 $title = strip_tags($title); 982 995 // Preserve escaped octets. … … 1050 1063 1051 1064 /** 1052 * Sanitizes a html classname to ensure it only contains valid characters1065 * Sanitizes an HTML classname to ensure it only contains valid characters. 1053 1066 * 1054 1067 * Strips the string down to A-Z,a-z,0-9,_,-. If this results in an empty … … 1884 1897 * @since 3.1.0 1885 1898 * @access private 1899 * 1886 1900 * @param array $match The preg_replace_callback matches array 1887 1901 * @return array Converted chars … … 2706 2720 * Escaping for textarea values. 2707 2721 * 2708 * @since 3.1 2722 * @since 3.1.0 2709 2723 * 2710 2724 * @param string $text … … 2717 2731 2718 2732 /** 2719 * Escape a HTML tag name.2733 * Escape an HTML tag name. 2720 2734 * 2721 2735 * @since 2.5.0 … … 3190 3204 } 3191 3205 3192 // normalize EOL characters and strip duplicate whitespace 3206 /** 3207 * Normalize EOL characters and strip duplicate whitespace. 3208 * 3209 * @since 2.7.0 3210 * 3211 * @param string $str The string to normalize. 3212 * @return string The normalized string. 3213 */ 3193 3214 function normalize_whitespace( $str ) { 3194 $str = trim( $str);3195 $str = str_replace( "\r", "\n", $str);3215 $str = trim( $str ); 3216 $str = str_replace( "\r", "\n", $str ); 3196 3217 $str = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str ); 3197 3218 return $str;
Note: See TracChangeset
for help on using the changeset viewer.