Make WordPress Core

Ticket #5638: 5638.r8783.diff

File 5638.r8783.diff, 6.1 KB (added by jacobsantos, 16 years ago)

Completes formatting.php based off of r5638.

  • formatting.php

     
    154154/**
    155155 * Checks to see if a string is utf8 encoded.
    156156 *
     157 * @author bmorel at ssi dot fr
     158 *
    157159 * @since 1.2.1
    158160 *
    159161 * @param string $Str The string to be checked
     
    211213}
    212214
    213215/**
    214  * {@internal Missing Short Description}}
     216 * Encode the Unicode values to be used in the URI.
    215217 *
    216  * {@internal Missing Long Description}}
    217  *
    218218 * @since 1.5.0
    219219 *
    220  * @param unknown_type $utf8_string
    221  * @param unknown_type $length
    222  * @return unknown
     220 * @param string $utf8_string
     221 * @param int $length Max length of the string
     222 * @return string String with Unicode encoded for URI.
    223223 */
    224224function utf8_uri_encode( $utf8_string, $length = 0 ) {
    225225        $unicode = '';
     
    263263}
    264264
    265265/**
    266  * Replaces accents in a string.
     266 * Converts all accent characters to ASCII characters.
    267267 *
     268 * If there are no accent characters, then the string given is just returned.
     269 *
    268270 * @since 1.2.1
    269271 *
    270  * @param string $string The text to be filtered.
     272 * @param string $string Text that might have accent characters
    271273 * @return string Filtered string with replaced "nice" characters.
    272274 */
    273275function remove_accents($string) {
     
    403405/**
    404406 * Filters certain characters from the file name.
    405407 *
    406  * {@internal Missing Long Description}}
     408 * Turns all strings to lowercase removing most characters except alphanumeric
     409 * with spaces, dashes and periods. All spaces and underscores are converted to
     410 * dashes. Multiple dashes are converted to a single dash. Finally, if the file
     411 * name ends with a dash, it is removed.
    407412 *
    408413 * @since 2.1.0
    409414 *
    410  * @param string $name The string to be sanitized.
    411  * @return string Sanitized string.
     415 * @param string $name The file name
     416 * @return string Sanitized file name
    412417 */
    413418function sanitize_file_name( $name ) { // Like sanitize_title, but with periods
    414419        $name = strtolower( $name );
     
    426431 *
    427432 * If $strict is true, only alphanumeric characters (as well as _, space, ., -,
    428433 * @) are returned.
     434 * Removes tags, octets, entities, and if strict is enabled, will remove all
     435 * non-ASCII characters. After sanitizing, it passes the username, raw username
     436 * (the username in the parameter), and the strict parameter as parameters for
     437 * the filter.
    429438 *
    430439 * @since 2.0.0
     440 * @uses apply_filters() Calls 'sanitize_user' hook on username, raw username,
     441 *              and $strict parameter.
    431442 *
    432443 * @param string $username The username to be sanitized.
    433444 * @param bool $strict If set limits $username to specific characters. Default false.
     
    795806 * back '0010'. If you set the number to '4' and the number is '5000', then you
    796807 * will get back '5000'.
    797808 *
     809 * Uses sprintf to append the amount of zeros based on the $threshold parameter
     810 * and the size of the number. If the number is large enough, then no zeros will
     811 * be appended.
     812 *
    798813 * @since 0.71
    799814 *
    800  * @param mixed $number Will convert to string and add zeros
    801  * @param int $threshold Amount of digits
    802  * @return string Adds leading zeros to number if needed
     815 * @param mixed $number Number to append zeros to if not greater than threshold.
     816 * @param int $threshold Digit places number needs to be to not have zeros added.
     817 * @return string Adds leading zeros to number if needed.
    803818 */
    804819function zeroise($number, $threshold) {
    805820        return sprintf('%0'.$threshold.'s', $number);
     
    907922}
    908923
    909924/**
    910  * antispambot() - {@internal Missing Short Description}}
     925 * Converts email addresses characters to HTML entities to block spam bots.
    911926 *
    912  * {@internal Missing Long Description}}
    913  *
    914927 * @since 0.71
    915928 *
    916  * @param unknown_type $emailaddy
    917  * @param unknown_type $mailto
    918  * @return unknown
     929 * @param string $emailaddy Email address.
     930 * @param int $mailto Optional. Range from 0 to 1. Used for encoding.
     931 * @return string Converted email address.
    919932 */
    920933function antispambot($emailaddy, $mailto=0) {
    921934        $emailNOSPAMaddy = '';
     
    10281041}
    10291042
    10301043/**
    1031  * wp_rel_nofollow() - {@internal Missing Short Description}}
     1044 * Adds rel nofollow string to all HTML A elements in content.
    10321045 *
    1033  * {@internal Missing Long Description}}
    1034  *
    10351046 * @since 1.5.0
    10361047 *
    1037  * @param unknown_type $text
    1038  * @return unknown
     1048 * @param string $text Content that may contain HTML A elements.
     1049 * @return string Converted content.
    10391050 */
    10401051function wp_rel_nofollow( $text ) {
    10411052        global $wpdb;
     
    10471058}
    10481059
    10491060/**
    1050  * wp_rel_nofollow_callback() - {@internal Missing Short Description}}
     1061 * Callback to used to add rel=nofollow string to HTML A element.
    10511062 *
    1052  * {@internal Missing Long Description}}
     1063 * Will remove already existing rel="nofollow" and rel='nofollow' from the
     1064 * string to prevent from invalidating (X)HTML.
    10531065 *
    10541066 * @since 2.3.0
    10551067 *
    1056  * @param unknown_type $matches
    1057  * @return unknown
     1068 * @param array $matches Single Match
     1069 * @return string HTML A Element with rel nofollow.
    10581070 */
    10591071function wp_rel_nofollow_callback( $matches ) {
    10601072        $text = $matches[1];
     
    10631075}
    10641076
    10651077/**
    1066  * convert_smilies() - {@internal Missing Short Description}}
     1078 * Convert text equivalent of smilies to images.
    10671079 *
    1068  * {@internal Missing Long Description}}
     1080 * Will only convert smilies if the option 'use_smilies' is true and the globals
     1081 * used in the function aren't empty.
    10691082 *
    10701083 * @since 0.71
     1084 * @uses $wp_smiliessearch, $wp_smiliesreplace Smiley replacement arrays.
    10711085 *
    1072  * @param string $text
    1073  * @return string
     1086 * @param string $text Content to convert smilies from text.
     1087 * @return string Converted content with text smilies replaced with images.
    10741088 */
    10751089function convert_smilies($text) {
    10761090        global $wp_smiliessearch, $wp_smiliesreplace;
     
    11151129}
    11161130
    11171131/**
    1118  * {@internal Missing Short Description}}
     1132 * Convert to ASCII from email subjects.
    11191133 *
    1120  * {@internal Missing Long Description}}
    1121  *
    11221134 * @since 1.2.0
    11231135 * @usedby wp_mail() handles charsets in email subjects
    11241136 *
    1125  * @param string $string
    1126  * @return string
     1137 * @param string $string Subject line
     1138 * @return string Converted string to ASCII
    11271139 */
    11281140function wp_iso_descrambler($string) {
    11291141        /* this may only work with iso-8859-1, I'm afraid */