Changeset 32590
- Timestamp:
- 05/25/2015 02:58:00 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r32520 r32590 22 22 * 23 23 * @since 0.71 24 * @uses $wp_cockneyreplace Array of formatted entities for certain common phrases 24 * 25 * @global array $wp_cockneyreplace Array of formatted entities for certain common phrases 26 * @global array $shortcode_tags 27 * @staticvar array $static_characters 28 * @staticvar array $static_replacements 29 * @staticvar array $dynamic_characters 30 * @staticvar array $dynamic_replacements 31 * @staticvar array $default_no_texturize_tags 32 * @staticvar array $default_no_texturize_shortcodes 33 * @staticvar bool $run_texturize 25 34 * 26 35 * @param string $text The text to be formatted 27 * @param bool $reset Set to true for unit testing. Translated patterns will reset.36 * @param bool $reset Set to true for unit testing. Translated patterns will reset. 28 37 * @return string The string replaced with html entities 29 38 */ 30 function wptexturize( $text, $reset = false) {39 function wptexturize( $text, $reset = false ) { 31 40 global $wp_cockneyreplace, $shortcode_tags; 32 41 static $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements, … … 298 307 299 308 // Replace each & with & unless it already looks like an entity. 300 $text = preg_replace('/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&', $text); 301 302 return $text; 309 return preg_replace( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&', $text ); 303 310 } 304 311 … … 314 321 * 315 322 * @param string $text Text to check. Must be a tag like `<html>` or `[shortcode]`. 316 * @param array $stack List of open tag elements.317 * @param array $disabled_elements The tag names to match against. Spaces are not allowed in tag names.318 */ 319 function _wptexturize_pushpop_element( $text, &$stack, $disabled_elements) {323 * @param array $stack List of open tag elements. 324 * @param array $disabled_elements The tag names to match against. Spaces are not allowed in tag names. 325 */ 326 function _wptexturize_pushpop_element( $text, &$stack, $disabled_elements ) { 320 327 // Is it an opening tag or closing tag? 321 328 if ( '/' !== $text[1] ) { … … 371 378 * @return string Text which has been converted into correct paragraph tags. 372 379 */ 373 function wpautop( $pee, $br = true) {380 function wpautop( $pee, $br = true ) { 374 381 $pre_tags = array(); 375 382 … … 420 427 421 428 // Standardize newline characters to "\n". 422 $pee = str_replace(array("\r\n", "\r"), "\n", $pee); 429 $pee = str_replace(array("\r\n", "\r"), "\n", $pee); 423 430 424 431 // Collapse line breaks before and after <option> elements so they don't get autop'd. … … 463 470 464 471 // Under certain strange conditions it could create a P of entirely whitespace. 465 $pee = preg_replace('|<p>\s*</p>|', '', $pee); 472 $pee = preg_replace('|<p>\s*</p>|', '', $pee); 466 473 467 474 // Add a closing <p> inside <div>, <address>, or <form> tag if missing. 468 475 $pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee); 469 476 470 477 // If an opening or closing block element tag is wrapped in a <p>, unwrap it. 471 $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); 472 478 $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); 479 473 480 // In some cases <li> may get wrapped in <p>, fix them. 474 $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); 475 481 $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); 482 476 483 // If a <blockquote> is wrapped with a <p>, move it inside the <blockquote>. 477 484 $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee); 478 485 $pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee); 479 486 480 487 // If an opening or closing block element tag is preceded by an opening <p> tag, remove it. 481 488 $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee); 482 489 483 490 // If an opening or closing block element tag is followed by a closing <p> tag, remove it. 484 491 $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); … … 490 497 491 498 // Replace any new line characters that aren't preceded by a <br /> with a <br />. 492 $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); 499 $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); 493 500 494 501 // Replace newline placeholders with newlines. … … 498 505 // If a <br /> tag is after an opening or closing block tag, remove it. 499 506 $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee); 500 507 501 508 // If a <br /> tag is before a subset of opening or closing block tags, remove it. 502 509 $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee); … … 520 527 */ 521 528 function _autop_newline_preservation_helper( $matches ) { 522 return str_replace( "\n", "<WPPreserveNewline />", $matches[0]);529 return str_replace( "\n", "<WPPreserveNewline />", $matches[0] ); 523 530 } 524 531 … … 529 536 * 530 537 * @since 2.9.0 538 * 539 * @global array $shortcode_tags 531 540 * 532 541 * @param string $pee The content. … … 590 599 * @return bool True if $str fits a UTF-8 model, false otherwise. 591 600 */ 592 function seems_utf8( $str) {601 function seems_utf8( $str ) { 593 602 mbstring_binary_safe_encoding(); 594 603 $length = strlen($str); … … 622 631 * @access private 623 632 * 624 * @param string $string The text which is to be encoded. 625 * @param int $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES. 626 * @param string $charset Optional. The character encoding of the string. Default is false. 627 * @param boolean $double_encode Optional. Whether to encode existing html entities. Default is false. 633 * @staticvar string|false $_charset 634 * 635 * @param string $string The text which is to be encoded. 636 * @param int $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES. 637 * @param string $charset Optional. The character encoding of the string. Default is false. 638 * @param bool $double_encode Optional. Whether to encode existing html entities. Default is false. 628 639 * @return string The encoded text with HTML entities. 629 640 */ … … 702 713 * @since 2.8.0 703 714 * 704 * @param string $string The text which is to be decoded. 705 * @param mixed $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old _wp_specialchars() values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES. 715 * @param string $string The text which is to be decoded. 716 * @param string|int $quote_style Optional. Converts double quotes if set to ENT_COMPAT, 717 * both single and double if set to ENT_QUOTES or 718 * none if set to ENT_NOQUOTES. 719 * Also compatible with old _wp_specialchars() values; 720 * converting single quotes if set to 'single', 721 * double if set to 'double' or both if otherwise set. 722 * Default is ENT_NOQUOTES. 706 723 * @return string The decoded text without HTML entities. 707 724 */ … … 759 776 * @since 2.8.0 760 777 * 761 * @param string $string The text which is to be checked. 762 * @param boolean $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false. 778 * @staticvar bool $is_utf8 779 * @staticvar bool $utf8_pcre 780 * 781 * @param string $string The text which is to be checked. 782 * @param bool $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false. 763 783 * @return string The checked text. 764 784 */ … … 808 828 * 809 829 * @param string $utf8_string 810 * @param int $length Maxlength of the string830 * @param int $length Max length of the string 811 831 * @return string String with Unicode encoded for URI. 812 832 */ … … 871 891 * @return string Filtered string with replaced "nice" characters. 872 892 */ 873 function remove_accents( $string) {893 function remove_accents( $string ) { 874 894 if ( !preg_match('/[\x80-\xff]/', $string) ) 875 895 return $string; … … 1188 1208 * 1189 1209 * @param string $username The username to be sanitized. 1190 * @param bool $strictIf set limits $username to specific characters. Default false.1210 * @param bool $strict If set limits $username to specific characters. Default false. 1191 1211 * @return string The sanitized username, after passing through filters. 1192 1212 */ … … 1254 1274 * @since 1.0.0 1255 1275 * 1256 * @param string $title The string to be sanitized.1276 * @param string $title The string to be sanitized. 1257 1277 * @param string $fallback_title Optional. A title to use if $title is empty. 1258 * @param string $context Optional. The operation for which the string is sanitized1278 * @param string $context Optional. The operation for which the string is sanitized 1259 1279 * @return string The sanitized string. 1260 1280 */ … … 1304 1324 * @since 1.2.0 1305 1325 * 1306 * @param string $title The title to be sanitized.1326 * @param string $title The title to be sanitized. 1307 1327 * @param string $raw_title Optional. Not used. 1308 * @param string $context Optional. The operation for which the string is sanitized.1328 * @param string $context Optional. The operation for which the string is sanitized. 1309 1329 * @return string The sanitized title. 1310 1330 */ … … 1373 1393 * 1374 1394 * @param string $orderby Order by clause to be validated. 1375 * @return string| boolReturns $orderby if valid, false otherwise.1395 * @return string|false Returns $orderby if valid, false otherwise. 1376 1396 */ 1377 1397 function sanitize_sql_orderby( $orderby ) { … … 1392 1412 * @since 2.8.0 1393 1413 * 1394 * @param string $class The classname to be sanitized1414 * @param string $class The classname to be sanitized 1395 1415 * @param string $fallback Optional. The value to return if the sanitization ends up as an empty string. 1396 1416 * Defaults to an empty string. … … 1428 1448 * @since 0.71 1429 1449 * 1430 * @param string $content String of characters to be converted.1450 * @param string $content String of characters to be converted. 1431 1451 * @param string $deprecated Not used. 1432 1452 * @return string Converted string. 1433 1453 */ 1434 function convert_chars( $content, $deprecated = '') {1454 function convert_chars( $content, $deprecated = '' ) { 1435 1455 if ( !empty( $deprecated ) ) 1436 1456 _deprecated_argument( __FUNCTION__, '0.71' ); … … 1494 1514 * @since 0.71 1495 1515 * 1496 * @param string $text Text to be balanced1497 * @param bool $force If true, forces balancing, ignoring the value of the option. Default false.1516 * @param string $text Text to be balanced 1517 * @param bool $force If true, forces balancing, ignoring the value of the option. Default false. 1498 1518 * @return string Balanced text 1499 1519 */ … … 1646 1666 * @since 0.71 1647 1667 * 1648 * @param string $content The text about to be edited.1649 * @param bool $richedit Whether the $content should not pass through htmlspecialchars(). Default false (meaning it will be passed).1668 * @param string $content The text about to be edited. 1669 * @param bool $richedit Whether the $content should not pass through htmlspecialchars(). Default false (meaning it will be passed). 1650 1670 * @return string The text after the filter (and possibly htmlspecialchars()) has been run. 1651 1671 */ … … 1677 1697 * @since 0.71 1678 1698 * 1679 * @param mixed $numberNumber to append zeros to if not greater than threshold.1680 * @param int $threshold Digit places number needs to be to not have zeros added.1699 * @param int $number Number to append zeros to if not greater than threshold. 1700 * @param int $threshold Digit places number needs to be to not have zeros added. 1681 1701 * @return string Adds leading zeros to number if needed. 1682 1702 */ 1683 function zeroise( $number, $threshold) {1684 return sprintf( '%0'.$threshold.'s', $number);1703 function zeroise( $number, $threshold ) { 1704 return sprintf( '%0' . $threshold . 's', $number ); 1685 1705 } 1686 1706 … … 1693 1713 * @return string String with backslashes inserted. 1694 1714 */ 1695 function backslashit( $string) {1715 function backslashit( $string ) { 1696 1716 if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' ) 1697 1717 $string = '\\\\' . $string; … … 1761 1781 * @return mixed Stripped value. 1762 1782 */ 1763 function stripslashes_deep( $value) {1783 function stripslashes_deep( $value ) { 1764 1784 if ( is_array($value) ) { 1765 1785 $value = array_map('stripslashes_deep', $value); … … 1785 1805 * @return array|string $value The encoded array (or string from the callback). 1786 1806 */ 1787 function urlencode_deep($value) { 1788 $value = is_array($value) ? array_map('urlencode_deep', $value) : urlencode($value); 1789 return $value; 1807 function urlencode_deep( $value ) { 1808 return is_array( $value ) ? array_map( 'urlencode_deep', $value ) : urlencode( $value ); 1790 1809 } 1791 1810 … … 1808 1827 * 1809 1828 * @param string $email_address Email address. 1810 * @param int $hex_encodingOptional. Set to 1 to enable hex encoding.1829 * @param int $hex_encoding Optional. Set to 1 to enable hex encoding. 1811 1830 * @return string Converted email address. 1812 1831 */ … … 1824 1843 } 1825 1844 1826 $email_no_spam_address = str_replace( '@', '@', $email_no_spam_address ); 1827 1828 return $email_no_spam_address; 1845 return str_replace( '@', '@', $email_no_spam_address ); 1829 1846 } 1830 1847 … … 1841 1858 * @return string HTML A element with URI address. 1842 1859 */ 1843 function _make_url_clickable_cb( $matches) {1860 function _make_url_clickable_cb( $matches ) { 1844 1861 $url = $matches[2]; 1845 1862 … … 1878 1895 * @return string HTML A element with URL address. 1879 1896 */ 1880 function _make_web_ftp_clickable_cb( $matches) {1897 function _make_web_ftp_clickable_cb( $matches ) { 1881 1898 $ret = ''; 1882 1899 $dest = $matches[2]; … … 1906 1923 * @return string HTML A element with email address. 1907 1924 */ 1908 function _make_email_clickable_cb( $matches) {1925 function _make_email_clickable_cb( $matches ) { 1909 1926 $email = $matches[2] . '@' . $matches[3]; 1910 1927 return $matches[1] . "<a href=\"mailto:$email\">$email</a>"; … … 1977 1994 1978 1995 // Cleanup of accidental links within links 1979 $r = preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r ); 1980 return $r; 1996 return preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r ); 1981 1997 } 1982 1998 … … 2007 2023 * 2008 2024 * @param string $string The string to split. 2009 * @param int $goalThe desired chunk length.2025 * @param int $goal The desired chunk length. 2010 2026 * @return array Numeric array of chunks. 2011 2027 */ … … 2049 2065 $text = stripslashes($text); 2050 2066 $text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text); 2051 $text = wp_slash($text); 2052 return $text; 2067 return wp_slash( $text ); 2053 2068 } 2054 2069 … … 2077 2092 * `<img>` string for that smiley. 2078 2093 * 2094 * @since 2.8.0 2095 * 2079 2096 * @global array $wpsmiliestrans 2080 * @since 2.8.02081 2097 * 2082 2098 * @param array $matches Single match. Smiley code to convert to image. … … 2122 2138 * 2123 2139 * @since 0.71 2124 * @uses $wp_smiliessearch 2140 * 2141 * @global string|array $wp_smiliessearch 2125 2142 * 2126 2143 * @param string $text Content to convert smilies from text. … … 2173 2190 * @since 0.71 2174 2191 * 2175 * @param string $email Email address to verify.2176 * @param bool ean$deprecated Deprecated.2192 * @param string $email Email address to verify. 2193 * @param bool $deprecated Deprecated. 2177 2194 * @return string|bool Either false or the valid email address. 2178 2195 */ … … 2266 2283 * @return string Converted string to ASCII 2267 2284 */ 2268 function wp_iso_descrambler( $string) {2285 function wp_iso_descrambler( $string ) { 2269 2286 /* this may only work with iso-8859-1, I'm afraid */ 2270 2287 if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) { … … 2272 2289 } else { 2273 2290 $subject = str_replace('_', ' ', $matches[2]); 2274 $subject = preg_replace_callback('#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject); 2275 return $subject; 2291 return preg_replace_callback( '#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject ); 2276 2292 } 2277 2293 } … … 2360 2376 * @return int|float The offset in seconds. 2361 2377 */ 2362 function iso8601_timezone_to_offset( $timezone) {2378 function iso8601_timezone_to_offset( $timezone ) { 2363 2379 // $timezone is either 'Z' or '[+|-]hhmm' 2364 2380 if ($timezone == 'Z') { … … 2379 2395 * 2380 2396 * @param string $date_string Date and time in ISO 8601 format {@link http://en.wikipedia.org/wiki/ISO_8601}. 2381 * @param string $timezone Optional. If set to GMT returns the time minus gmt_offset. Default is 'user'.2397 * @param string $timezone Optional. If set to GMT returns the time minus gmt_offset. Default is 'user'. 2382 2398 * @return string The date and time in MySQL DateTime format - Y-m-d H:i:s. 2383 2399 */ 2384 function iso8601_to_datetime( $date_string, $timezone = 'user') {2400 function iso8601_to_datetime( $date_string, $timezone = 'user' ) { 2385 2401 $timezone = strtolower($timezone); 2386 2402 … … 2417 2433 * @return string Content that has filtered links. 2418 2434 */ 2419 function popuplinks( $text) {2435 function popuplinks( $text ) { 2420 2436 $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text); 2421 2437 return $text; … … 2533 2549 * 2534 2550 * @param int $from Unix timestamp from which the difference begins. 2535 * @param int $to Optional. Unix timestamp to end the time difference. Default becomes time() if not set.2551 * @param int $to Optional. Unix timestamp to end the time difference. Default becomes time() if not set. 2536 2552 * @return string Human readable time difference. 2537 2553 */ … … 2604 2620 * @return string The excerpt. 2605 2621 */ 2606 function wp_trim_excerpt( $text = '') {2622 function wp_trim_excerpt( $text = '' ) { 2607 2623 $raw_excerpt = $text; 2608 2624 if ( '' == $text ) { … … 2653 2669 * @since 3.3.0 2654 2670 * 2655 * @param string $text Text to trim.2656 * @param int $num_words Number of words. Default 55.2657 * @param string $more Optional. What to append if $text needs to be trimmed. Default '…'.2671 * @param string $text Text to trim. 2672 * @param int $num_words Number of words. Default 55. 2673 * @param string $more Optional. What to append if $text needs to be trimmed. Default '…'. 2658 2674 * @return string Trimmed text. 2659 2675 */ … … 2702 2718 * @return string Text with converted entities. 2703 2719 */ 2704 function ent2ncr( $text) {2720 function ent2ncr( $text ) { 2705 2721 2706 2722 /** … … 2991 3007 * @return string The formatted text after filter is applied. 2992 3008 */ 2993 function wp_richedit_pre( $text) {3009 function wp_richedit_pre( $text ) { 2994 3010 if ( empty( $text ) ) { 2995 3011 /** … … 3029 3045 * @return string Formatted text after filter applied. 3030 3046 */ 3031 function wp_htmledit_pre( $output) {3047 function wp_htmledit_pre( $output ) { 3032 3048 if ( !empty($output) ) 3033 3049 $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > & … … 3053 3069 * @access private 3054 3070 * 3055 * @param string|array $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles. 3056 * @param string $subject The string being searched and replaced on, otherwise known as the haystack. 3071 * @param string|array $search The value being searched for, otherwise known as the needle. 3072 * An array may be used to designate multiple needles. 3073 * @param string $subject The string being searched and replaced on, otherwise known as the haystack. 3057 3074 * @return string The string with the replaced svalues. 3058 3075 */ … … 3076 3093 * 3077 3094 * @since 2.8.0 3095 * 3096 * @global wpdb $wpdb 3097 * 3078 3098 * @param string|array $data Unescaped data 3079 3099 * @return string|array Escaped data … … 3093 3113 * @since 2.8.0 3094 3114 * 3095 * @param string $url The URL to be cleaned. 3096 * @param array $protocols Optional. An array of acceptable protocols. 3097 * Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn' if not set. 3098 * @param string $_context Private. Use esc_url_raw() for database usage. 3115 * @param string $url The URL to be cleaned. 3116 * @param array $protocols Optional. An array of acceptable protocols. 3117 * Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 3118 * 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 3119 * 'rtsp', 'svn' if not set. 3120 * @param string $_context Private. Use esc_url_raw() for database usage. 3099 3121 * @return string The cleaned $url after the 'clean_url' filter is applied. 3100 3122 */ … … 3150 3172 * @since 2.8.0 3151 3173 * 3152 * @param string $url The URL to be cleaned.3153 * @param array $protocols An array of acceptable protocols.3174 * @param string $url The URL to be cleaned. 3175 * @param array $protocols An array of acceptable protocols. 3154 3176 * @return string The cleaned URL. 3155 3177 */ … … 3168 3190 * @return string Converted text. 3169 3191 */ 3170 function htmlentities2( $myHTML) {3192 function htmlentities2( $myHTML ) { 3171 3193 $translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES ); 3172 3194 $translation_table[chr(38)] = '&'; … … 3285 3307 * @return string 3286 3308 */ 3287 function tag_escape( $tag_name) {3309 function tag_escape( $tag_name ) { 3288 3310 $safe_tag = strtolower( preg_replace('/[^a-zA-Z0-9_:]/', '', $tag_name) ); 3289 3311 /** … … 3322 3344 * @since 2.0.5 3323 3345 * 3346 * @global wpdb $wpdb 3347 * 3324 3348 * @param string $option The name of the option. 3325 * @param string $value The unsanitised value.3349 * @param string $value The unsanitised value. 3326 3350 * @return string Sanitized value. 3327 3351 */ 3328 function sanitize_option( $option, $value) {3352 function sanitize_option( $option, $value ) { 3329 3353 global $wpdb; 3330 3354 … … 3524 3548 * @param string $original_value The original value passed to the function. 3525 3549 */ 3526 $value = apply_filters( "sanitize_option_{$option}", $value, $option, $original_value ); 3527 3528 return $value; 3550 return apply_filters( "sanitize_option_{$option}", $value, $option, $original_value ); 3529 3551 } 3530 3552 … … 3538 3560 * 3539 3561 * @param string $string The string to be parsed. 3540 * @param array $arrayVariables will be stored in this array.3562 * @param array $array Variables will be stored in this array. 3541 3563 */ 3542 3564 function wp_parse_str( $string, &$array ) { … … 3588 3610 * @link http://www.php.net/sprintf 3589 3611 * 3590 * @param string $pattern The string which formatted args are inserted.3612 * @param string $pattern The string which formatted args are inserted. 3591 3613 * @param mixed $args ,... Arguments to be formatted into the $pattern string. 3592 3614 * @return string The formatted string. … … 3663 3685 * 3664 3686 * @param string $pattern Content containing '%l' at the beginning. 3665 * @param array $argsList items to prepend to the content and replace '%l'.3687 * @param array $args List items to prepend to the content and replace '%l'. 3666 3688 * @return string Localized list items and rest of the content. 3667 3689 */ 3668 function wp_sprintf_l( $pattern, $args) {3690 function wp_sprintf_l( $pattern, $args ) { 3669 3691 // Not a match 3670 3692 if ( substr($pattern, 0, 2) != '%l' ) … … 3721 3743 * @since 2.5.0 3722 3744 * 3723 * @param string $str String to get the excerpt from.3724 * @param int eger$count Maximum number of characters to take.3725 * @param string $more Optional. What to append if $str needs to be trimmed. Defaults to empty string.3745 * @param string $str String to get the excerpt from. 3746 * @param int $count Maximum number of characters to take. 3747 * @param string $more Optional. What to append if $str needs to be trimmed. Defaults to empty string. 3726 3748 * @return string The excerpt. 3727 3749 */ … … 3746 3768 * @since 2.7.0 3747 3769 * 3770 * @global string $_links_add_base 3771 * 3748 3772 * @param string $content String to search for links in. 3749 * @param string $base The base URL to prefix to links.3750 * @param array $attrsThe attributes which should be processed.3773 * @param string $base The base URL to prefix to links. 3774 * @param array $attrs The attributes which should be processed. 3751 3775 * @return string The processed content. 3752 3776 */ … … 3764 3788 * @access private 3765 3789 * 3790 * @global string $_links_add_base 3791 * 3766 3792 * @param string $m The matched link. 3767 3793 * @return string The processed link. 3768 3794 */ 3769 function _links_add_base( $m) {3795 function _links_add_base( $m ) { 3770 3796 global $_links_add_base; 3771 3797 //1 = attribute name 2 = quotation mark 3 = URL … … 3788 3814 * @since 2.7.0 3789 3815 * 3816 * @global string $_links_add_target 3817 * 3790 3818 * @param string $content String to search for links in. 3791 * @param string $target The Target to add to the links.3792 * @param array $tagsAn array of tags to apply to.3819 * @param string $target The Target to add to the links. 3820 * @param array $tags An array of tags to apply to. 3793 3821 * @return string The processed content. 3794 3822 */ … … 3806 3834 * @access private 3807 3835 * 3836 * @global string $_links_add_target 3837 * 3808 3838 * @param string $m The matched link. 3809 3839 * @return string The processed link. … … 3840 3870 * @since 2.9.0 3841 3871 * 3842 * @param string $string String containing HTML tags3843 * @param bool $remove_breaks optionalWhether to remove left over line breaks and white space chars3872 * @param string $string String containing HTML tags 3873 * @param bool $remove_breaks Optional. Whether to remove left over line breaks and white space chars 3844 3874 * @return string The processed string. 3845 3875 */ … … 3868 3898 * @return string 3869 3899 */ 3870 function sanitize_text_field( $str) {3900 function sanitize_text_field( $str ) { 3871 3901 $filtered = wp_check_invalid_utf8( $str ); 3872 3902 … … 3906 3936 * @since 3.1.0 3907 3937 * 3908 * @param string $path A path.3938 * @param string $path A path. 3909 3939 * @param string $suffix If the filename ends in suffix this will also be cut off. 3910 3940 * @return string … … 3920 3950 * 3921 3951 * @since 3.0.0 3952 * 3953 * @staticvar string|false $dblq 3922 3954 */ 3923 3955 function capital_P_dangit( $text ) { … … 4036 4068 * 4037 4069 * @param string $content A string which might contain a URL. 4038 * @return string The found URL.4070 * @return string|false The found URL. 4039 4071 */ 4040 4072 function get_url_in_content( $content ) { … … 4058 4090 * 4059 4091 * @since 4.0.0 4092 * 4093 * @staticvar string $spaces 4060 4094 * 4061 4095 * @return string The spaces regexp. … … 4087 4121 * 4088 4122 * @since 4.2.0 4123 * 4124 * @staticvar bool $printed 4089 4125 */ 4090 4126 function print_emoji_styles() { … … 4114 4150 } 4115 4151 4152 /** 4153 * 4154 * @global string $wp_version 4155 * @staticvar bool $printed 4156 */ 4116 4157 function print_emoji_detection_script() { 4117 4158 global $wp_version;
Note: See TracChangeset
for help on using the changeset viewer.