Changeset 26485 for trunk/src/wp-includes/formatting.php
- Timestamp:
- 11/30/2013 06:35:37 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r26328 r26485 102 102 // Transform into regexp sub-expression used in _wptexturize_pushpop_element 103 103 // Must do this every time in case plugins use these filters in a context sensitive manner 104 $no_texturize_tags = '(' . implode('|', apply_filters('no_texturize_tags', $default_no_texturize_tags) ) . ')'; 105 $no_texturize_shortcodes = '(' . implode('|', apply_filters('no_texturize_shortcodes', $default_no_texturize_shortcodes) ) . ')'; 104 /** 105 * Filter the list of HTML elements not to texturize. 106 * 107 * @since 2.8.0 108 * 109 * @param array $default_no_texturize_tags An array of HTML element names. 110 */ 111 $no_texturize_tags = '(' . implode( '|', apply_filters( 'no_texturize_tags', $default_no_texturize_tags ) ) . ')'; 112 /** 113 * Filter the list of shortcodes not to texturize. 114 * 115 * @since 2.8.0 116 * 117 * @param array $default_no_texturize_shortcodes An array of shortcode names. 118 */ 119 $no_texturize_shortcodes = '(' . implode( '|', apply_filters( 'no_texturize_shortcodes', $default_no_texturize_shortcodes ) ) . ')'; 106 120 107 121 $no_texturize_tags_stack = array(); … … 843 857 $filename_raw = $filename; 844 858 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0)); 845 $special_chars = apply_filters('sanitize_file_name_chars', $special_chars, $filename_raw); 859 /** 860 * Filter the list of characters to remove from a filename. 861 * 862 * @since 2.8.0 863 * 864 * @param array $special_chars Characters to remove. 865 * @param string $filename_raw Filename as it was passed into sanitize_file_name(). 866 */ 867 $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw ); 846 868 $filename = str_replace($special_chars, '', $filename); 847 869 $filename = preg_replace('/[\s-]+/', '-', $filename); … … 852 874 853 875 // Return if only one extension 854 if ( count($parts) <= 2 ) 855 return apply_filters('sanitize_file_name', $filename, $filename_raw); 876 if ( count( $parts ) <= 2 ) { 877 /** 878 * Filter a sanitized filename string. 879 * 880 * @since 2.8.0 881 * 882 * @param string $filename Sanitized filename. 883 * @param string $filename_raw The filename prior to sanitization. 884 */ 885 return apply_filters( 'sanitize_file_name', $filename, $filename_raw ); 886 } 856 887 857 888 // Process multiple extensions … … 860 891 $mimes = get_allowed_mime_types(); 861 892 862 // Loop over any intermediate extensions. Munge them with a trailing underscore if they are a 2 - 5 character 863 // long alpha string not in the extension whitelist. 893 /* 894 * Loop over any intermediate extensions. Postfix them with a trailing underscore 895 * if they are a 2 - 5 character long alpha string not in the extension whitelist. 896 */ 864 897 foreach ( (array) $parts as $part) { 865 898 $filename .= '.' . $part; … … 879 912 } 880 913 $filename .= '.' . $extension; 881 914 /** This filter is documented in wp-includes/formatting.php */ 882 915 return apply_filters('sanitize_file_name', $filename, $filename_raw); 883 916 } … … 892 925 * 893 926 * @since 2.0.0 894 * @uses apply_filters() Calls 'sanitize_user' hook on username, raw username,895 * and $strict parameter.896 927 * 897 928 * @param string $username The username to be sanitized. … … 915 946 $username = preg_replace( '|\s+|', ' ', $username ); 916 947 948 /** 949 * Filter a sanitized username string. 950 * 951 * @since 2.0.11 952 * 953 * @param string $username Sanitized username. 954 * @param string $raw_username The username prior to sanitization. 955 * @param bool $strict Whether to limit the sanitization to specific characters. Default false. 956 */ 917 957 return apply_filters( 'sanitize_user', $username, $raw_username, $strict ); 918 958 } … … 932 972 $key = strtolower( $key ); 933 973 $key = preg_replace( '/[^a-z0-9_\-]/', '', $key ); 974 975 /** 976 * Filter a sanitized key string. 977 * 978 * @since 3.0.0 979 * 980 * @param string $key Sanitized key. 981 * @param string $raw_key The key prior to sanitization. 982 */ 934 983 return apply_filters( 'sanitize_key', $key, $raw_key ); 935 984 } … … 955 1004 $title = remove_accents($title); 956 1005 957 $title = apply_filters('sanitize_title', $title, $raw_title, $context); 1006 /** 1007 * Filter a sanitized title string. 1008 * 1009 * @since 1.2.1 1010 * 1011 * @param string $title Sanitized title. 1012 * @param string $raw_title The title prior to sanitization. 1013 * @param string $context The context for which the title is being sanitized. 1014 */ 1015 $title = apply_filters( 'sanitize_title', $title, $raw_title, $context ); 958 1016 959 1017 if ( '' === $title || false === $title ) … … 1087 1145 $sanitized = $fallback; 1088 1146 1147 /** 1148 * Filter a sanitized HTML class string. 1149 * 1150 * @since 2.8.0 1151 * 1152 * @param string $sanitized The sanitized HTML class. 1153 * @param string $class HTML class before sanitization. 1154 * @param string $fallback The fallback string. 1155 */ 1089 1156 return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback ); 1090 1157 } … … 1171 1238 function balanceTags( $text, $force = false ) { 1172 1239 if ( $force || get_option('use_balanceTags') == 1 ) { 1240 /** 1241 * Filter the list of delimiters to be used before tags are balanced. 1242 * 1243 * @since 3.8.0 1244 * 1245 * @param array $delimiters An array of delimiters, e.g '<!--more.*?-->', '<!--nextpage-->'. 1246 */ 1173 1247 $balance_tags_delimiters = apply_filters( 'balance_tags_delimiters', array( '<!--more.*?-->', '<!--nextpage-->' ) ); 1174 1248 // Capture lets PREG_SPLIT_DELIM_CAPTURE return the delimiters … … 1326 1400 */ 1327 1401 function format_to_edit( $content, $richedit = false ) { 1402 /** 1403 * Filter the text to be formatted for editing. 1404 * 1405 * @since 1.2.1 1406 * 1407 * @param string $content The text, prior to formatting for editing. 1408 */ 1328 1409 $content = apply_filters( 'format_to_edit', $content ); 1329 1410 if ( ! $richedit ) … … 1341 1422 */ 1342 1423 function format_to_post($content) { 1343 $content = apply_filters('format_to_post', $content); 1424 /** 1425 * Filter the string returned by format_to_post(). 1426 * 1427 * @since 1.2.1 1428 * 1429 * @param string $content The string to format. 1430 */ 1431 $content = apply_filters( 'format_to_post', $content ); 1344 1432 return $content; 1345 1433 } … … 1777 1865 $smiley_masked = esc_attr( $smiley ); 1778 1866 1867 /** 1868 * Filter the Smiley image URL before it's used in the image element. 1869 * 1870 * @since 2.9.0 1871 * 1872 * @param string $smiley_url URL for the smiley image. 1873 * @param string $img Filename for the smiley image. 1874 * @param string $site_url Site URL, as returned by site_url(). 1875 */ 1779 1876 $src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() ); 1780 1877 … … 1850 1947 // Test for the minimum length the email can be 1851 1948 if ( strlen( $email ) < 3 ) { 1949 /** 1950 * Filter whether an email address is valid. 1951 * 1952 * This filter is evaluated under several different contexts, such as 'email_too_short', 1953 * 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits', 1954 * 'domain_no_periods', 'sub_hyphen_limits', 'sub_invalid_chars', or no specific context. 1955 * 1956 * @since 2.8.0 1957 * 1958 * @param bool $is_email Whether the email address has passed the is_email() checks. Default false. 1959 * @param string $email The email address being checked. 1960 * @param string $message An explanatory message to the user. 1961 * @param string $context Context under which the email was tested. 1962 */ 1852 1963 return apply_filters( 'is_email', false, $email, 'email_too_short' ); 1853 1964 } … … 1855 1966 // Test for an @ character after the first position 1856 1967 if ( strpos( $email, '@', 1 ) === false ) { 1968 /** This filter is documented in wp-includes/formatting.php */ 1857 1969 return apply_filters( 'is_email', false, $email, 'email_no_at' ); 1858 1970 } … … 1864 1976 // Test for invalid characters 1865 1977 if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) { 1978 /** This filter is documented in wp-includes/formatting.php */ 1866 1979 return apply_filters( 'is_email', false, $email, 'local_invalid_chars' ); 1867 1980 } … … 1870 1983 // Test for sequences of periods 1871 1984 if ( preg_match( '/\.{2,}/', $domain ) ) { 1985 /** This filter is documented in wp-includes/formatting.php */ 1872 1986 return apply_filters( 'is_email', false, $email, 'domain_period_sequence' ); 1873 1987 } … … 1875 1989 // Test for leading and trailing periods and whitespace 1876 1990 if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) { 1991 /** This filter is documented in wp-includes/formatting.php */ 1877 1992 return apply_filters( 'is_email', false, $email, 'domain_period_limits' ); 1878 1993 } … … 1883 1998 // Assume the domain will have at least two subs 1884 1999 if ( 2 > count( $subs ) ) { 2000 /** This filter is documented in wp-includes/formatting.php */ 1885 2001 return apply_filters( 'is_email', false, $email, 'domain_no_periods' ); 1886 2002 } … … 1890 2006 // Test for leading and trailing hyphens and whitespace 1891 2007 if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) { 2008 /** This filter is documented in wp-includes/formatting.php */ 1892 2009 return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' ); 1893 2010 } … … 1895 2012 // Test for invalid characters 1896 2013 if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) ) { 2014 /** This filter is documented in wp-includes/formatting.php */ 1897 2015 return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' ); 1898 2016 } … … 1900 2018 1901 2019 // Congratulations your email made it! 2020 /** This filter is documented in wp-includes/formatting.php */ 1902 2021 return apply_filters( 'is_email', $email, $email, null ); 1903 2022 } … … 2079 2198 // Test for the minimum length the email can be 2080 2199 if ( strlen( $email ) < 3 ) { 2200 /** 2201 * Filter a sanitized email address. 2202 * 2203 * This filter is evaluated under several contexts, including 'email_too_short', 2204 * 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits', 2205 * 'domain_no_periods', 'domain_no_valid_subs', or no context. 2206 * 2207 * @since 2.8.0 2208 * 2209 * @param string $email The sanitized email address. 2210 * @param string $email The email address, as provided to sanitize_email(). 2211 * @param string $message A message to pass to the user. 2212 */ 2081 2213 return apply_filters( 'sanitize_email', '', $email, 'email_too_short' ); 2082 2214 } … … 2084 2216 // Test for an @ character after the first position 2085 2217 if ( strpos( $email, '@', 1 ) === false ) { 2218 /** This filter is documented in wp-includes/formatting.php */ 2086 2219 return apply_filters( 'sanitize_email', '', $email, 'email_no_at' ); 2087 2220 } … … 2094 2227 $local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local ); 2095 2228 if ( '' === $local ) { 2229 /** This filter is documented in wp-includes/formatting.php */ 2096 2230 return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' ); 2097 2231 } … … 2101 2235 $domain = preg_replace( '/\.{2,}/', '', $domain ); 2102 2236 if ( '' === $domain ) { 2237 /** This filter is documented in wp-includes/formatting.php */ 2103 2238 return apply_filters( 'sanitize_email', '', $email, 'domain_period_sequence' ); 2104 2239 } … … 2107 2242 $domain = trim( $domain, " \t\n\r\0\x0B." ); 2108 2243 if ( '' === $domain ) { 2244 /** This filter is documented in wp-includes/formatting.php */ 2109 2245 return apply_filters( 'sanitize_email', '', $email, 'domain_period_limits' ); 2110 2246 } … … 2115 2251 // Assume the domain will have at least two subs 2116 2252 if ( 2 > count( $subs ) ) { 2253 /** This filter is documented in wp-includes/formatting.php */ 2117 2254 return apply_filters( 'sanitize_email', '', $email, 'domain_no_periods' ); 2118 2255 } … … 2137 2274 // If there aren't 2 or more valid subs 2138 2275 if ( 2 > count( $new_subs ) ) { 2276 /** This filter is documented in wp-includes/formatting.php */ 2139 2277 return apply_filters( 'sanitize_email', '', $email, 'domain_no_valid_subs' ); 2140 2278 } … … 2147 2285 2148 2286 // Congratulations your email made it! 2287 /** This filter is documented in wp-includes/formatting.php */ 2149 2288 return apply_filters( 'sanitize_email', $email, $email, null ); 2150 2289 } … … 2226 2365 $text = strip_shortcodes( $text ); 2227 2366 2228 $text = apply_filters('the_content', $text); 2367 /** This filter is documented in wp-includes/post-template.php */ 2368 $text = apply_filters( 'the_content', $text ); 2229 2369 $text = str_replace(']]>', ']]>', $text); 2230 $excerpt_length = apply_filters('excerpt_length', 55); 2231 $excerpt_more = apply_filters('excerpt_more', ' ' . '[…]'); 2370 2371 /** 2372 * Filter the number of words in an excerpt. 2373 * 2374 * @since 2.7.0 2375 * 2376 * @param int $number The number of words. Default 55. 2377 */ 2378 $excerpt_length = apply_filters( 'excerpt_length', 55 ); 2379 /** 2380 * Filter the string in the "more" link displayed after a trimmed excerpt. 2381 * 2382 * @since 2.9.0 2383 * 2384 * @param string $more_string The string shown within the more link. 2385 */ 2386 $excerpt_more = apply_filters( 'excerpt_more', ' ' . '[…]' ); 2232 2387 $text = wp_trim_words( $text, $excerpt_length, $excerpt_more ); 2233 2388 } 2234 return apply_filters('wp_trim_excerpt', $text, $raw_excerpt); 2389 /** 2390 * Filter the trimmed excerpt string. 2391 * 2392 * @since 2.8.0 2393 * 2394 * @param string $text The trimmed text. 2395 * @param string $raw_excerpt The text prior to trimming. 2396 */ 2397 return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt ); 2235 2398 } 2236 2399 … … 2272 2435 $text = implode( $sep, $words_array ); 2273 2436 } 2437 /** 2438 * Filter the text content after words have been trimmed. 2439 * 2440 * @since 3.3.0 2441 * 2442 * @param string $text The trimmed text. 2443 * @param int $num_words The number of words to trim the text to. Default 5. 2444 * @param string $more An optional string to append to the end of the trimmed text, e.g. …. 2445 * @param string $original_text The text before it was trimmed. 2446 */ 2274 2447 return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text ); 2275 2448 } … … 2285 2458 function ent2ncr($text) { 2286 2459 2287 // Allow a plugin to short-circuit and override the mappings. 2460 /** 2461 * Filter text before named entities are converted into numbered entities. 2462 * 2463 * A non-null string must be returned for the filter to be evaluated. 2464 * 2465 * @since 3.3.0 2466 * 2467 * @param null $converted_text The text to be converted. Default null. 2468 * @param string $text The text prior to entity conversion. 2469 */ 2288 2470 $filtered = apply_filters( 'pre_ent2ncr', null, $text ); 2289 2471 if( null !== $filtered ) … … 2564 2746 */ 2565 2747 function wp_richedit_pre($text) { 2566 // Filtering a blank results in an annoying <br />\n 2567 if ( empty($text) ) return apply_filters('richedit_pre', ''); 2748 if ( empty( $text ) ) { 2749 /** 2750 * Filter text returned for the rich text editor. 2751 * 2752 * This filter is first evaluated, and the value returned, if an empty string 2753 * is passed to wp_richedit_pre(). If an empty string is passed, it results 2754 * in a break tag and line feed. 2755 * 2756 * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre() 2757 * return after being formatted. 2758 * 2759 * @since 2.0.0 2760 * 2761 * @param string $output Text for the rich text editor. 2762 */ 2763 return apply_filters( 'richedit_pre', '' ); 2764 } 2568 2765 2569 2766 $output = convert_chars($text); … … 2571 2768 $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); 2572 2769 2573 return apply_filters('richedit_pre', $output); 2770 /** This filter is documented in wp-includes/formatting.php */ 2771 return apply_filters( 'richedit_pre', $output ); 2574 2772 } 2575 2773 … … 2589 2787 $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > & 2590 2788 2591 return apply_filters('htmledit_pre', $output); 2789 /** 2790 * Filter the text before it is formatted for the HTML editor. 2791 * 2792 * @since 2.5.0 2793 * 2794 * @param string $output The HTML-formatted text. 2795 */ 2796 return apply_filters( 'htmledit_pre', $output ); 2592 2797 } 2593 2798 … … 2684 2889 } 2685 2890 2686 return apply_filters('clean_url', $good_protocol_url, $original_url, $_context); 2891 /** 2892 * Filter a string cleaned and escaped for output as a URL. 2893 * 2894 * @since 2.3.0 2895 * 2896 * @param string $good_protocol_url The cleaned URL to be returned. 2897 * @param string $original_url The URL prior to cleaning. 2898 * @param string $_context If 'display', replace ampersands and single quotes only. 2899 */ 2900 return apply_filters( 'clean_url', $good_protocol_url, $original_url, $_context ); 2687 2901 } 2688 2902 … … 2735 2949 $safe_text = str_replace( "\r", '', $safe_text ); 2736 2950 $safe_text = str_replace( "\n", '\\n', addslashes( $safe_text ) ); 2951 /** 2952 * Filter a string cleaned and escaped for output in JavaScript. 2953 * 2954 * Text passed to esc_js() is stripped of invalid or special characters, 2955 * and properly slashed for output. 2956 * 2957 * @since 2.0.11 2958 * 2959 * @param string $safe_text The text after it has been escaped. 2960 * @param string $text The text prior to being escaped. 2961 */ 2737 2962 return apply_filters( 'js_escape', $safe_text, $text ); 2738 2963 } … … 2749 2974 $safe_text = wp_check_invalid_utf8( $text ); 2750 2975 $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES ); 2976 /** 2977 * Filter a string cleaned and escaped for output in HTML. 2978 * 2979 * Text passed to esc_html() is stripped of invalid or special characters 2980 * before output. 2981 * 2982 * @since 2.8.0 2983 * 2984 * @param string $safe_text The text after it has been escaped. 2985 * @param string $text The text prior to being escaped. 2986 */ 2751 2987 return apply_filters( 'esc_html', $safe_text, $text ); 2752 2988 } … … 2763 2999 $safe_text = wp_check_invalid_utf8( $text ); 2764 3000 $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES ); 3001 /** 3002 * Filter a string cleaned and escaped for output in an HTML attribute. 3003 * 3004 * Text passed to esc_attr() is stripped of invalid or special characters 3005 * before output. 3006 * 3007 * @since 2.0.11 3008 * 3009 * @param string $safe_text The text after it has been escaped. 3010 * @param string $text The text prior to being escaped. 3011 */ 2765 3012 return apply_filters( 'attribute_escape', $safe_text, $text ); 2766 3013 } … … 2776 3023 function esc_textarea( $text ) { 2777 3024 $safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) ); 3025 /** 3026 * Filter a string cleaned and escaped for output in a textarea element. 3027 * 3028 * @since 3.1.0 3029 * 3030 * @param string $safe_text The text after it has been escaped. 3031 * @param string $text The text prior to being escaped. 3032 */ 2778 3033 return apply_filters( 'esc_textarea', $safe_text, $text ); 2779 3034 } … … 2789 3044 function tag_escape($tag_name) { 2790 3045 $safe_tag = strtolower( preg_replace('/[^a-zA-Z0-9_:]/', '', $tag_name) ); 2791 return apply_filters('tag_escape', $safe_tag, $tag_name); 3046 /** 3047 * Filter a string cleaned and escaped for output as an HTML tag. 3048 * 3049 * @since 2.8.0 3050 * 3051 * @param string $safe_tag The tag name after it has been escaped. 3052 * @param string $tag_name The text before it was escaped. 3053 */ 3054 return apply_filters( 'tag_escape', $safe_tag, $tag_name ); 2792 3055 } 2793 3056 … … 2995 3258 } 2996 3259 2997 $value = apply_filters("sanitize_option_{$option}", $value, $option); 3260 /** 3261 * Filter an option value following sanitization. 3262 * 3263 * @since 2.3.0 3264 * 3265 * @param string $value The sanitized option value. 3266 * @param string $option The option name. 3267 */ 3268 $value = apply_filters( "sanitize_option_{$option}", $value, $option ); 2998 3269 2999 3270 return $value; … … 3007 3278 * 3008 3279 * @since 2.2.1 3009 * @uses apply_filters() for the 'wp_parse_str' filter.3010 3280 * 3011 3281 * @param string $string The string to be parsed. … … 3016 3286 if ( get_magic_quotes_gpc() ) 3017 3287 $array = stripslashes_deep( $array ); 3288 /** 3289 * Filter the array of variables derived from a parsed string. 3290 * 3291 * @since 2.3.0 3292 * 3293 * @param array $array The array populated with variables. 3294 */ 3018 3295 $array = apply_filters( 'wp_parse_str', $array ); 3019 3296 } … … 3096 3373 } 3097 3374 3098 // Apply filters OR sprintf 3375 /** 3376 * Filter a fragment from the pattern passed to wp_sprintf(). 3377 * 3378 * If the fragment is unchanged, then sprintf() will be run on the fragment. 3379 * 3380 * @since 2.5.0 3381 * 3382 * @param string $fragment A fragment from the pattern. 3383 * @param string $arg The argument. 3384 */ 3099 3385 $_fragment = apply_filters( 'wp_sprintf', $fragment, $arg ); 3100 3386 if ( $_fragment != $fragment ) … … 3133 3419 return ''; 3134 3420 3135 // Translate and filter the delimiter set (avoid ampersands and entities here) 3136 $l = apply_filters('wp_sprintf_l', array( 3421 /** 3422 * Filter the translated delimiters used by wp_sprintf_l(). 3423 * 3424 * Please note: Ampersands and entities should be avoided here. 3425 * 3426 * @since 2.5.0 3427 * 3428 * @param array $delimiters An array of translated delimiters. 3429 */ 3430 $l = apply_filters( 'wp_sprintf_l', array( 3137 3431 /* translators: used between list items, there is a space after the comma */ 3138 3432 'between' => __(', '), … … 3141 3435 /* translators: used between only two list items, there is a space after the and */ 3142 3436 'between_only_two' => __(' and '), 3143 ));3437 ) ); 3144 3438 3145 3439 $args = (array) $args; … … 3333 3627 } 3334 3628 3335 return apply_filters('sanitize_text_field', $filtered, $str); 3629 /** 3630 * Filter a sanitized text field string. 3631 * 3632 * @since 2.9.0 3633 * 3634 * @param string $filtered The sanitized string. 3635 * @param string $str The string prior to being sanitized. 3636 */ 3637 return apply_filters( 'sanitize_text_field', $filtered, $str ); 3336 3638 } 3337 3639 … … 3382 3684 function sanitize_mime_type( $mime_type ) { 3383 3685 $sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type ); 3686 /** 3687 * Filter a mime type following sanitization. 3688 * 3689 * @since 3.1.3 3690 * 3691 * @param string $sani_mime_type The sanitized mime type. 3692 * @param string $mime_type The mime type prior to sanitization. 3693 */ 3384 3694 return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type ); 3385 3695 } … … 3401 3711 $urls_to_ping = array_map( 'esc_url_raw', $urls_to_ping ); 3402 3712 $urls_to_ping = implode( "\n", $urls_to_ping ); 3713 /** 3714 * Filter a list of trackback URLs following sanitization. 3715 * 3716 * The string returned here consists of a space or carriage return-delimited list 3717 * of trackback URLs. 3718 * 3719 * @since 3.4.0 3720 * 3721 * @param string $urls_to_ping Sanitized space or carriage return separated URLs. 3722 * @param string $to_ping Space or carriage return separated URLs before sanitization. 3723 */ 3403 3724 return apply_filters( 'sanitize_trackback_urls', $urls_to_ping, $to_ping ); 3404 3725 }
Note: See TracChangeset
for help on using the changeset viewer.