Ticket #5638: phpdoc.formatting.diff

File phpdoc.formatting.diff, 33.3 KB (added by scohoust, 4 years ago)

Expanded phpdoc for formatting.php

  • Users/Scott/Sites/wp/trunk/wp-includes/formatting.php

     
    11<?php 
    22/** 
    3  * Main Wordpress Formatting API  
     3 * Main Wordpress Formatting API. 
    44 * 
    5  * Handles many functions for formatting output 
     5 * Handles many functions for formatting output. 
    66 * 
    77 * @package WordPress 
    88 **/ 
     
    1818 * <code> 
    1919 * &#8217;cause today&#8217;s effort makes it worth tomorrow&#8217;s &#8220;holiday&#8221;&#8230; 
    2020 * </code> 
    21  * Code within certain html blocks are skipped.  
     21 * Code within certain html blocks are skipped. 
    2222 * 
    2323 * @since 0.71 
    2424 * @uses $wp_cockneyreplace Array of formatted entities for certain common phrases 
     
    7676} 
    7777 
    7878/** 
    79  * Accepts matches array from preg_replace_callback in wpautop() or a string 
     79 * Accepts matches array from preg_replace_callback in wpautop() or a string. 
    8080 * 
    81  * Ensures that the contents of a <<pre>>...<</pre>> HTML block are not converted into paragraphs or line-breaks. 
     81 * Ensures that the contents of a <<pre>>...<</pre>> HTML block are not 
     82 * converted into paragraphs or line-breaks. 
    8283 * 
    8384 * @since 1.2.0 
    8485 * 
    85  * @param array|string $matches The array or string  
     86 * @param array|string $matches The array or string 
    8687 * @return string The pre block without paragraph/line-break conversion. 
    8788 */ 
    8889function clean_pre($matches) { 
     
    99100} 
    100101 
    101102/** 
    102  * Replaces double line-breaks with paragraph elements 
     103 * Replaces double line-breaks with paragraph elements. 
    103104 * 
    104  * A group of regex replaces used to identify text formatted with newlines and replace 
    105  * double line-breaks with HTML paragraph tags. The remaining line-breaks after conversion 
    106  * become <<br />> tags, unless $br is set to '0' or 'false'.  
    107  *  
     105 * A group of regex replaces used to identify text formatted with newlines and 
     106 * replace double line-breaks with HTML paragraph tags. The remaining 
     107 * line-breaks after conversion become <<br />> tags, unless $br is set to '0' 
     108 *  or 'false'. 
    108109 * 
    109110 * @since 0.71 
    110111 * 
    111112 * @param string $pee The text which has to be formatted. 
    112  * @param int|bool $br Optional. If set, this will convert all remaining line-breaks after paragraphing. Default true.  
    113  * @return string Text which has been converted into correct paragraph tags.  
     113 * @param int|bool $br Optional. If set, this will convert all remaining line-breaks after paragraphing. Default true. 
     114 * @return string Text which has been converted into correct paragraph tags. 
    114115 */ 
    115116function wpautop($pee, $br = 1) { 
    116117        $pee = $pee . "\n"; // just to make things a little easier, pad the end 
     
    179180} 
    180181 
    181182/** 
    182  * Converts a number of special characters into their HTML entities 
     183 * Converts a number of special characters into their HTML entities. 
    183184 * 
    184  * Differs from htmlspecialchars as existing HTML entities will not be encoded. Specificically 
    185  * changes: & to &#038;, < to &lt; and > to &gt;.  
     185 * Differs from htmlspecialchars as existing HTML entities will not be encoded. 
     186 * Specificically changes: & to &#038;, < to &lt; and > to &gt;. 
    186187 * 
    187  * $quotes can be set to 'single' to encode ' to &#039;, 'double' to encode " to &quot;, or '1' to do both.  
    188  * Default is 0 where no quotes are encoded.  
     188 * $quotes can be set to 'single' to encode ' to &#039;, 'double' to encode " to 
     189 * &quot;, or '1' to do both. Default is 0 where no quotes are encoded. 
    189190 * 
    190191 * @since 1.2.2 
    191192 * 
    192  * @param string $text The text which is to be encoded 
    193  * @param mixed $quotes Optional. Converts single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default 0.  
    194  * @return string The encoded text with HTML entities.  
     193 * @param string $text The text which is to be encoded. 
     194 * @param mixed $quotes Optional. Converts single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default 0. 
     195 * @return string The encoded text with HTML entities. 
    195196 */ 
    196197function wp_specialchars( $text, $quotes = 0 ) { 
    197198        // Like htmlspecialchars except don't double-encode HTML entities 
     
    264265} 
    265266 
    266267/** 
    267  * Replaces accents in a string 
     268 * Replaces accents in a string. 
    268269 * 
    269270 * {@internal Missing Long Description}} 
    270271 * 
    271272 * @since 1.2.1 
    272273 * 
    273274 * @param string $string The text to be filtered. 
    274  * @return string Filtered string with replaced "nice" characters 
     275 * @return string Filtered string with replaced "nice" characters. 
    275276 */ 
    276277function remove_accents($string) { 
    277278        if ( !preg_match('/[\x80-\xff]/', $string) ) 
     
    404405} 
    405406 
    406407/** 
    407  * Filters certain characters from the file name.  
     408 * Filters certain characters from the file name. 
    408409 * 
    409410 * {@internal Missing Long Description}} 
    410411 * 
    411412 * @since 2.1.0 
    412413 * 
    413  * @param string $name The string to be sanitized 
    414  * @return string Sanitized string 
     414 * @param string $name The string to be sanitized. 
     415 * @return string Sanitized string. 
    415416 */ 
    416417function sanitize_file_name( $name ) { // Like sanitize_title, but with periods 
    417418        $name = strtolower( $name ); 
     
    426427} 
    427428 
    428429/** 
    429  * Removes characters from the username 
     430 * Removes characters from the username. 
    430431 * 
    431  * If $strict is true, only alphanumeric characters (as well as _, space, ., -, @) are returned.  
     432 * If $strict is true, only alphanumeric characters (as well as _, space, ., -, 
     433 * @) are returned. 
    432434 * 
    433435 * @since 2.0.0 
    434436 * 
    435  * @param string $username The username to be sanitized.  
    436  * @param bool $strict If set limits $username to specific characters. Default false.  
    437  * @return string The sanitized username, after passing through filters.  
     437 * @param string $username The username to be sanitized. 
     438 * @param bool $strict If set limits $username to specific characters. Default false. 
     439 * @return string The sanitized username, after passing through filters. 
    438440 */ 
    439441function sanitize_user( $username, $strict = false ) { 
    440442        $raw_username = $username; 
     
    451453} 
    452454 
    453455/** 
    454  * Returns a string which has been sanitized.  
     456 * Returns a string which has been sanitized. 
    455457 * 
    456  * Specifically, HTML and PHP tags are stripped. Further actions can be added via the 
    457  * plugin API. If $title is empty and $fallback_title is set, the latter will be used.  
     458 * Specifically, HTML and PHP tags are stripped. Further actions can be added 
     459 * via the plugin API. If $title is empty and $fallback_title is set, the latter 
     460 * will be used. 
    458461 * 
    459462 * @since 1.0.0 
    460463 * 
    461  * @param string $title The string to be sanitized.  
    462  * @param string $fallback_title Optional. A title to use if $title is empty.   
    463  * @return string The sanitized string.  
     464 * @param string $title The string to be sanitized. 
     465 * @param string $fallback_title Optional. A title to use if $title is empty. 
     466 * @return string The sanitized string. 
    464467 */ 
    465468function sanitize_title($title, $fallback_title = '') { 
    466469        $title = strip_tags($title); 
     
    473476} 
    474477 
    475478/** 
    476  * Replaces the string with safe characters. Whitespace becomes a dash.  
     479 * Replaces the string with safe characters. Whitespace becomes a dash. 
    477480 * 
    478  * Limits the output to alphanumeric characters, underscore (_) and dash (-).  
     481 * Limits the output to alphanumeric characters, underscore (_) and dash (-). 
    479482 * 
    480483 * @since 1.2.0 
    481484 * 
    482  * @param string $title The title to be sanitized 
    483  * @return string The sanitized title 
     485 * @param string $title The title to be sanitized. 
     486 * @return string The sanitized title. 
    484487 */ 
    485488function sanitize_title_with_dashes($title) { 
    486489        $title = strip_tags($title); 
     
    510513} 
    511514 
    512515/** 
    513  * Ensures a string is a valid SQL order by clause.  
     516 * Ensures a string is a valid SQL order by clause. 
    514517 * 
    515  * Accepts one or more columns, with or without ASC/DESC, and also accepts RAND() 
     518 * Accepts one or more columns, with or without ASC/DESC, and also accepts 
     519 * RAND(). 
    516520 * 
    517521 * @since 2.5.1 
    518522 * 
    519  * @param string $orderby Order by string to be checked 
     523 * @param string $orderby Order by string to be checked. 
    520524 * @return string|false Returns the order by clause if it is a match, false otherwise.  
    521525 */ 
    522526function sanitize_sql_orderby( $orderby ){ 
     
    527531} 
    528532 
    529533/** 
    530  * Converts a number of characters from a string 
     534 * Converts a number of characters from a string. 
    531535 * 
    532  * Metadata tags <<title>> and <<category>> are removed, <<br>> and <<hr>> are converted into correct 
    533  * XHTML and Unicode characters are converted to the valid range.  
     536 * Metadata tags <<title>> and <<category>> are removed, <<br>> and <<hr>> are 
     537 * converted into correct XHTML and Unicode characters are converted to the 
     538 * valid range. 
    534539 * 
    535540 * @since 0.71 
    536541 * 
    537  * @param string $content String of characters to be converted 
    538  * @param string $deprecated Not used 
     542 * @param string $content String of characters to be converted. 
     543 * @param string $deprecated Not used. 
    539544 * @return string Converted string. 
    540545 */ 
    541546function convert_chars($content, $deprecated = '') { 
     
    593598} 
    594599 
    595600/** 
    596  * Fixes javascript bugs in browsers.  
     601 * Fixes javascript bugs in browsers. 
    597602 * 
    598603 * {@internal Missing Long Description}} 
    599604 * 
     
    601606 * @uses $is_macIE 
    602607 * @uses $is_winIE 
    603608 * 
    604  * @param string $text Text to be made safe 
    605  * @return string Fixed text 
     609 * @param string $text Text to be made safe. 
     610 * @return string Fixed text. 
    606611 */ 
    607612function funky_javascript_fix($text) { 
    608613        // Fixes for browsers' javascript bugs 
     
    648653 *                       Added Cleaning Hooks 
    649654 *              1.0  First Version 
    650655 * 
    651  * @param string $text Text to be balanced 
    652  * @return string Balanced text 
     656 * @param string $text Text to be balanced. 
     657 * @return string Balanced text. 
    653658 */ 
    654659function force_balance_tags( $text ) { 
    655660        $tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = ''; 
     
    751756} 
    752757 
    753758/** 
    754  * Acts on text which is about to be edited 
     759 * Acts on text which is about to be edited. 
    755760 * 
    756  * Unless $richedit is set, it is simply a holder for the 'format_to_edit' filter. If $richedit 
    757  * is set true htmlspecialchars() will be run on the content, converting special characters to  
    758  * HTMl entities.  
     761 * Unless $richedit is set, it is simply a holder for the 'format_to_edit' 
     762 * filter. If $richedit is set true htmlspecialchars() will be run on the 
     763 * content, converting special characters to HTMl entities. 
    759764 * 
    760765 * @since 0.71 
    761766 * 
    762  * @param string $content The text about to be edited.  
    763  * @param bool $richedit Whether or not the $content should pass through htmlspecialchars(). Default false.  
    764  * @return string The text after the filter (and possibly htmlspecialchars()) has been run.  
     767 * @param string $content The text about to be edited. 
     768 * @param bool $richedit Whether or not the $content should pass through htmlspecialchars(). Default false. 
     769 * @return string The text after the filter (and possibly htmlspecialchars()) has been run. 
    765770 */ 
    766771function format_to_edit($content, $richedit = false) { 
    767772        $content = apply_filters('format_to_edit', $content); 
     
    778783 * @since 0.71 
    779784 * 
    780785 * @param string $content The text to pass through the filter. 
    781  * @return string Text returned from the 'format_to_post' filter.  
     786 * @return string Text returned from the 'format_to_post' filter. 
    782787 */ 
    783788function format_to_post($content) { 
    784789        $content = apply_filters('format_to_post', $content); 
     
    786791} 
    787792 
    788793/** 
    789  * Add leading zeros when necessary 
     794 * Add leading zeros when necessary. 
    790795 * 
    791796 * {@internal Missing Long Description}} 
    792797 * 
     
    817822} 
    818823 
    819824/** 
    820  * Appends a trailing slash 
     825 * Appends a trailing slash. 
    821826 * 
    822  * Will remove trailing slash if it exists already before adding 
    823  * a trailing slash. This prevents double slashing a string or 
    824  * path. 
     827 * Will remove trailing slash if it exists already before adding a trailing 
     828 * slash. This prevents double slashing a string or path. 
    825829 * 
    826  * The primary use of this is for paths and thus should be used 
    827  * for paths. It is not restricted to paths and offers no specific 
    828  * path support. 
     830 * The primary use of this is for paths and thus should be used for paths. It is 
     831 * not restricted to paths and offers no specific path support. 
    829832 * 
    830833 * @since 1.2.0 
    831  * @uses untrailingslashit() Unslashes string if it was slashed already 
     834 * @uses untrailingslashit() Unslashes string if it was slashed already. 
    832835 * 
    833  * @param string $string What to add the trailing slash to 
    834  * @return string String with trailing slash added 
     836 * @param string $string What to add the trailing slash to. 
     837 * @return string String with trailing slash added. 
    835838 */ 
    836839function trailingslashit($string) { 
    837840        return untrailingslashit($string) . '/'; 
    838841} 
    839842 
    840843/** 
    841  * Removes trailing slash if it exists 
     844 * Removes trailing slash if it exists. 
    842845 * 
    843  * The primary use of this is for paths and thus should be used 
    844  * for paths. It is not restricted to paths and offers no specific 
    845  * path support. 
     846 * The primary use of this is for paths and thus should be used for paths. It is 
     847 * not restricted to paths and offers no specific path support. 
    846848 * 
    847849 * @since 2.2.0 
    848850 * 
    849  * @param string $string What to remove the trailing slash from 
    850  * @return string String without the trailing slash 
     851 * @param string $string What to remove the trailing slash from. 
     852 * @return string String without the trailing slash. 
    851853 */ 
    852854function untrailingslashit($string) { 
    853855        return rtrim($string, '/'); 
    854856} 
    855857 
    856858/** 
    857  * addslashes_gpc() - {@internal Missing Short Description}} 
     859 * Adds slashes to escape strings. 
    858860 * 
    859  * {@internal Missing Long Description}} 
     861 * Slashes will first be removed if magic_quotes_gpc is set,  
     862 * see {@link http://www.php.net/magic_quotes} for more details.  
    860863 * 
    861864 * @since 0.71 
    862865 * 
    863  * @param unknown_type $gpc 
    864  * @return unknown 
     866 * @param string $gpc The string returned from HTTP request data. 
     867 * @return string Returns a string escaped with slashes.  
    865868 */ 
    866869function addslashes_gpc($gpc) { 
    867870        global $wpdb; 
     
    874877} 
    875878 
    876879/** 
    877  * stripslashes_deep() - {@internal Missing Short Description}} 
     880 * Navigates through an array and removes slashes from the values. 
    878881 * 
    879  * {@internal Missing Long Description}} 
     882 * If an array is passed, the array_map() function causes a callback to 
     883 * pass the value back to the function. The slashes from this value will 
     884 * removed.  
    880885 * 
    881886 * @since 2.0.0 
    882887 * 
    883  * @param unknown_type $value 
    884  * @return unknown 
     888 * @param array|string $value The array or string to be striped. 
     889 * @return array|string Stripped array (or string in the callback). 
    885890 */ 
    886891function stripslashes_deep($value) { 
    887892         $value = is_array($value) ? 
     
    892897} 
    893898 
    894899/** 
    895  * urlencode_deep() - {@internal Missing Short Description}} 
     900 * Navigates through an array and encodes the values to be used in a URL. 
    896901 * 
    897  * {@internal Missing Long Description}} 
     902 * Uses a callback to pass the value of the array back to the function as a  
     903 * string.  
    898904 * 
    899905 * @since 2.2.0 
    900906 * 
    901  * @param unknown_type $value 
    902  * @return unknown 
     907 * @param array|string $value The array or string to be encoded. 
     908 * @return array|string $value The encoded array (or string from the callback). 
    903909 */ 
    904910function urlencode_deep($value) { 
    905911         $value = is_array($value) ? 
     
    942948 * 
    943949 * {@internal Missing Long Description}} 
    944950 * 
    945  * @since 2.5 
     951 * @since 2.5.0 
    946952 * @access private 
    947953 * 
    948954 * @param unknown_type $matches 
     
    967973 * 
    968974 * {@internal Missing Long Description}} 
    969975 * 
    970  * @since 2.5 
     976 * @since 2.5.0 
    971977 * @access private 
    972978 * 
    973979 * @param unknown_type $matches 
     
    993999 * 
    9941000 * {@internal Missing Long Description}} 
    9951001 * 
    996  * @since 2.5 
     1002 * @since 2.5.0 
    9971003 * @access private 
    9981004 * 
    9991005 * @param unknown_type $matches 
     
    10931099} 
    10941100 
    10951101/** 
    1096  * is_email() - {@internal Missing Short Description}} 
     1102 * Checks to see if the text is a valid email address. 
    10971103 * 
    10981104 * {@internal Missing Long Description}} 
    10991105 * 
    11001106 * @since 0.71 
    11011107 * 
    1102  * @param unknown_type $user_email 
    1103  * @return unknown 
     1108 * @param string $user_email The email address to be checked. 
     1109 * @return bool Returns true if valid, otherwise false. 
    11041110 */ 
    11051111function is_email($user_email) { 
    11061112        $chars = "/^([a-z0-9+_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,6}\$/i"; 
     
    11381144} 
    11391145 
    11401146/** 
    1141  * get_gmt_from_date() - Give it a date, it will give you the same date as GMT 
     1147 * Returns a date in the GMT equivalent. 
    11421148 * 
    1143  * {@internal Missing Long Description}} 
     1149 * Requires and returns a date in the Y-m-d H:i:s format. 
     1150 * Simply subtracts the value of gmt_offset. 
    11441151 * 
    11451152 * @since 1.2.0 
    11461153 * 
    1147  * @param unknown_type $string 
    1148  * @return unknown 
     1154 * @param string $string The date to be converted. 
     1155 * @return string GMT version of the date provided. 
    11491156 */ 
    11501157function get_gmt_from_date($string) { 
    1151         // note: this only substracts $time_difference from the given date 
    11521158        preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches); 
    11531159        $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 
    11541160        $string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_option('gmt_offset') * 3600); 
     
    11561162} 
    11571163 
    11581164/** 
    1159  * get_date_from_gmt() - Give it a GMT date, it will give you the same date with $time_difference added 
     1165 * Converts a GMT date into the correct format for the blog. 
    11601166 * 
    1161  * {@internal Missing Long Description}} 
     1167 * Requires and returns in the Y-m-d H:i:s format. Simply 
     1168 * adds the value of gmt_offset. 
    11621169 * 
    11631170 * @since 1.2.0 
    11641171 * 
    1165  * @param unknown_type $string 
    1166  * @return unknown 
     1172 * @param string $string The date to be converted. 
     1173 * @return string Formatted date relative to the GMT offset. 
    11671174 */ 
    11681175function get_date_from_gmt($string) { 
    1169         // note: this only adds $time_difference to the given date 
    11701176        preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches); 
    11711177        $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 
    11721178        $string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_option('gmt_offset')*3600); 
     
    11741180} 
    11751181 
    11761182/** 
    1177  * iso8601_timezone_to_offset() - Computes an offset in seconds from an iso8601 timezone 
     1183 * Computes an offset in seconds from an iso8601 timezone. 
    11781184 * 
    11791185 * {@internal Missing Long Description}} 
    11801186 * 
    11811187 * @since 1.5.0 
    11821188 * 
    1183  * @param unknown_type $timezone 
    1184  * @return unknown 
     1189 * @param string $timezone Either 'Z' for 0 offset or '±hhmm'. 
     1190 * @return int|float The offset in seconds.  
    11851191 */ 
    11861192function iso8601_timezone_to_offset($timezone) { 
    11871193        // $timezone is either 'Z' or '[+|-]hhmm' 
     
    11971203} 
    11981204 
    11991205/** 
    1200  * iso8601_to_datetime() - Converts an iso8601 date to MySQL DateTime format used by post_date[_gmt] 
     1206 * Converts an iso8601 date to MySQL DateTime format used by post_date[_gmt]. 
    12011207 * 
    12021208 * {@internal Missing Long Description}} 
    12031209 * 
    12041210 * @since 1.5.0 
    12051211 * 
    1206  * @param unknown_type $date_string 
    1207  * @param unknown_type $timezone 
    1208  * @return unknown 
     1212 * @param string $date_string Date and time in ISO 8601 format {@link http://en.wikipedia.org/wiki/ISO_8601}. 
     1213 * @param unknown_type $timezone Optional. If set to GMT returns the time minus gmt_offset. Default USER. 
     1214 * @return string The date and time in MySQL DateTime format - Y-m-d H:i:s. 
    12091215 */ 
    12101216function iso8601_to_datetime($date_string, $timezone = USER) { 
    12111217        if ($timezone == GMT) { 
     
    12291235} 
    12301236 
    12311237/** 
    1232  * Adds a element attributes to open links in new windows 
     1238 * Adds a element attributes to open links in new windows. 
    12331239 * 
    1234  * Comment text in popup windows should be filtered through this. Right 
    1235  * now it's a moderately dumb function, ideally it would detect whether 
    1236  * a target or rel attribute was already there and adjust its actions 
    1237  * accordingly. 
     1240 * Comment text in popup windows should be filtered through this. Right now it's 
     1241 * a moderately dumb function, ideally it would detect whether a target or rel 
     1242 * attribute was already there and adjust its actions accordingly. 
    12381243 * 
    12391244 * @since 0.71 
    12401245 * 
    1241  * @param string $text Content to replace links to open in a new window 
    1242  * @return string Content that has filtered links 
     1246 * @param string $text Content to replace links to open in a new window. 
     1247 * @return string Content that has filtered links. 
    12431248 */ 
    12441249function popuplinks($text) { 
    12451250        $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text); 
     
    12471252} 
    12481253 
    12491254/** 
    1250  * Strips out all characters that are not allowable in an email 
     1255 * Strips out all characters that are not allowable in an email. 
    12511256 * 
    12521257 * @since 1.5.0 
    12531258 * 
    1254  * @param string $email Email address to filter 
    1255  * @return string Filtered email address 
     1259 * @param string $email Email address to filter. 
     1260 * @return string Filtered email address. 
    12561261 */ 
    12571262function sanitize_email($email) { 
    12581263        return preg_replace('/[^a-z0-9+_.@-]/i', '', $email); 
    12591264} 
    12601265 
    12611266/** 
    1262  * human_time_diff() - {@internal Missing Short Description}} 
     1267 * Determines the difference between two timestamps. 
    12631268 * 
    1264  * {@internal Missing Long Description}} 
     1269 * The difference is returned in a human readable format such as 
     1270 * "1 hour", "5 mins", "2 days".  
    12651271 * 
    12661272 * @since 1.5.0 
    12671273 * 
    1268  * @param unknown_type $from 
    1269  * @param unknown_type $to 
    1270  * @return unknown 
     1274 * @param int $from Unix timestamp from which the difference begins. 
     1275 * @param int $to Optional. Unix timestamp to end the time difference. Default becomes time() if not set. 
     1276 * @return string Human readable time difference. 
    12711277 */ 
    12721278function human_time_diff( $from, $to = '' ) { 
    12731279        if ( empty($to) ) 
     
    12961302} 
    12971303 
    12981304/** 
    1299  * wp_trim_excerpt() - {@internal Missing Short Description}} 
     1305 * Generates an excerpt from the content if needed. 
    13001306 * 
    13011307 * {@internal Missing Long Description}} 
    13021308 * 
    13031309 * @since 1.5.0 
    13041310 * 
    1305  * @param unknown_type $text 
    1306  * @return unknown 
     1311 * @param string $text The exerpt. If set to empty an excerpt is generated. 
     1312 * @return string The excerpt. 
    13071313 */ 
    13081314function wp_trim_excerpt($text) { // Fakes an excerpt if needed 
    13091315        if ( '' == $text ) { 
     
    13261332} 
    13271333 
    13281334/** 
    1329  * ent2ncr() - {@internal Missing Short Description}} 
     1335 * Converts named entities into numbered entities. 
    13301336 * 
    13311337 * {@internal Missing Long Description}} 
    13321338 * 
    13331339 * @since 1.5.1 
    13341340 * 
    1335  * @param unknown_type $text 
    1336  * @return unknown 
     1341 * @param string $text The text within which entities will be converted. 
     1342 * @return string Text with converted entities.  
    13371343 */ 
    13381344function ent2ncr($text) { 
    13391345        $to_ncr = array( 
     
    16001606} 
    16011607 
    16021608/** 
    1603  * wp_richedit_pre() - {@internal Missing Short Description}} 
     1609 * Formats text for the rich text editor and applies filter. 
    16041610 * 
    1605  * {@internal Missing Long Description}} 
     1611 * The filter 'richedit_pre' is applied here. If $text is empty 
     1612 * the filter will be applied to an empty string. 
    16061613 * 
    16071614 * @since 2.0.0 
    16081615 * 
    1609  * @param unknown_type $text 
    1610  * @return unknown 
     1616 * @param string $text The text to be formatted. 
     1617 * @return string The formatted text after filter is applied. 
    16111618 */ 
    16121619function wp_richedit_pre($text) { 
    16131620        // Filtering a blank results in an annoying <br />\n 
     
    16201627        return apply_filters('richedit_pre', $output); 
    16211628} 
    16221629 
     1630/** 
     1631 * Formats text for the HTML editor and applies a filter. 
     1632 * 
     1633 * Unless $output is empty it will pass through htmlspecialchars 
     1634 * before the 'htmledit_pre' filter is applied. 
     1635 * 
     1636 * @since unknown 
     1637 * 
     1638 * @param string $output The text to be formatted. 
     1639 * @return string Formatted text after filter applied. 
     1640 */ 
    16231641function wp_htmledit_pre($output) { 
    16241642        if ( !empty($output) ) 
    16251643                $output = htmlspecialchars($output, ENT_NOQUOTES); // convert only < > & 
     
    16281646} 
    16291647 
    16301648/** 
    1631  * clean_url() - {@internal Missing Short Description}} 
     1649 * Checks and cleans a URL.  
    16321650 * 
    1633  * {@internal Missing Long Description}} 
     1651 * A number of characters are removed from the URL. If the URL is 
     1652 * for displaying (the default behaviour) amperstands are also replaced. 
     1653 * The 'clean_url' filter is applied to the returned cleaned URL. 
    16341654 * 
    16351655 * @since 1.2.0 
     1656 * @uses wp_kses_bad_protocol() To only permit protocols in the URL set 
     1657 *      via $protocols or the common ones set in the function. 
    16361658 * 
    1637  * @param unknown_type $url 
    1638  * @param unknown_type $protocols 
    1639  * @param unknown_type $context 
    1640  * @return unknown 
     1659 * @param string $url The URL to be cleaned. 
     1660 * @param array $protocols Optional. An array of acceptable protocols.  
     1661 *              Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet' if not set.  
     1662 * @param string $context Optional. How the URL will be used. Default is 'display'.  
     1663 * @return string The cleaned $url after the 'cleaned_url' filter is applied. 
    16411664 */ 
    16421665function clean_url( $url, $protocols = null, $context = 'display' ) { 
    16431666        $original_url = $url; 
     
    16551678                substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) ) 
    16561679                $url = 'http://' . $url; 
    16571680 
    1658         // Replace ampersands ony when displaying. 
     1681        // Replace ampersands only when displaying. 
    16591682        if ( 'display' == $context ) 
    16601683                $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&#038;$1', $url); 
    16611684 
     
    16681691} 
    16691692 
    16701693/** 
    1671  * sanitize_url() - {@internal Missing Short Description}} 
     1694 * Performs clean_url() for database usage. 
    16721695 * 
    1673  * {@internal Missing Long Description}} 
     1696 * @see clean_url() 
    16741697 * 
    16751698 * @since 2.3.1 
    16761699 * 
    1677  * @param unknown_type $url 
    1678  * @param unknown_type $protocols 
    1679  * @return unknown 
     1700 * @param string $url The URL to be cleaned. 
     1701 * @param array $protocols An array of acceptable protocols. 
     1702 * @return string The cleaned URL. 
    16801703 */ 
    16811704function sanitize_url( $url, $protocols = null ) { 
    16821705        return clean_url( $url, $protocols, 'db' ); 
    16831706} 
    16841707 
    16851708/** 
    1686  * Convert entities, while preserving already-encoded entities 
     1709 * Convert entities, while preserving already-encoded entities. 
    16871710 * 
    16881711 * {@internal Missing Long Description}} 
    16891712 * 
     
    16911714 * 
    16921715 * @since 1.2.2 
    16931716 * 
    1694  * @param unknown_type $myHTML 
    1695  * @return unknown 
     1717 * @param string $myHTML The text to be converted. 
     1718 * @return string Converted text. 
    16961719 */ 
    16971720function htmlentities2($myHTML) { 
    16981721        $translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES ); 
     
    17011724} 
    17021725 
    17031726/** 
    1704  * Escape single quotes, specialchar double quotes, and fix line endings 
     1727 * Escape single quotes, specialchar double quotes, and fix line endings. 
    17051728 * 
    1706  * {@internal Missing Long Description}} 
     1729 * The filter 'js_escape' is also applied here. 
    17071730 * 
    17081731 * @since 2.0.4 
    17091732 * 
    1710  * @param string $text 
    1711  * @return unknown 
     1733 * @param string $text The text to be escaped. 
     1734 * @return string Escaped text. 
    17121735 */ 
    17131736function js_escape($text) { 
    17141737        $safe_text = wp_specialchars($text, 'double'); 
     
    17171740        return apply_filters('js_escape', $safe_text, $text); 
    17181741} 
    17191742 
    1720 // Escaping for HTML attributes 
     1743/** 
     1744 * Escaping for HTML attributes. 
     1745 * 
     1746 * @since unknown 
     1747 * 
     1748 * @param string $text 
     1749 * @return string 
     1750 */ 
    17211751function attribute_escape($text) { 
    17221752        $safe_text = wp_specialchars($text, true); 
    17231753        return apply_filters('attribute_escape', $safe_text, $text); 
    17241754} 
    17251755 
    1726 // Escape a HTML tag name 
     1756/** 
     1757 * Escape a HTML tag name. 
     1758 * 
     1759 * @since unknown 
     1760 * 
     1761 * @param string $tag_name 
     1762 * @return string 
     1763 */ 
    17271764function tag_escape($tag_name) { 
    17281765        $safe_tag = strtolower( preg_replace('[^a-zA-Z_:]', '', $tag_name) ); 
    17291766        return apply_filters('tag_escape', $safe_tag, $tag_name); 
    17301767} 
    17311768 
    17321769/** 
    1733  * Escapes text for SQL LIKE special characters % and _ 
     1770 * Escapes text for SQL LIKE special characters % and _. 
    17341771 * 
    1735  * @param string text the text to be escaped 
    1736  * @return string text, safe for inclusion in LIKE query 
     1772 * @since unknown 
     1773 * 
     1774 * @param string $text The text to be escaped. 
     1775 * @return string text, safe for inclusion in LIKE query. 
    17371776 */ 
    17381777function like_escape($text) { 
    17391778        return str_replace(array("%", "_"), array("\\%", "\\_"), $text); 
    17401779} 
    17411780 
     1781/** 
     1782 * {@internal Missing Short Description}} 
     1783 * 
     1784 * @since unknown 
     1785 * 
     1786 * @param string $link 
     1787 * @return string 
     1788 */ 
    17421789function wp_make_link_relative( $link ) { 
    17431790        return preg_replace('|https?://[^/]+(/.*)|i', '$1', $link ); 
    17441791} 
    17451792 
     1793/** 
     1794 * Sanitises various option values based on the nature of the option. 
     1795 * 
     1796 * This is basically a switch statement which will pass $value through 
     1797 * a number of functions depending on the $option.  
     1798 * 
     1799 * @since 2.0.5 
     1800 * 
     1801 * @param string $option The name of the option. 
     1802 * @param string $value The unsanitised value. 
     1803 * @return string Sanitized value. 
     1804 */ 
    17461805function sanitize_option($option, $value) { // Remember to call stripslashes! 
    17471806 
    17481807        switch ($option) { 
     
    18181877} 
    18191878 
    18201879/** 
    1821  * wp_parse_str() - {@internal Missing Short Description}} 
     1880 * Parses a string into variables to be stored in an array. 
    18221881 * 
    1823  * {@internal Missing Long Description}} 
     1882 * Uses {@link http://www.php.net/parse_str parse_str()} and stripslashes 
     1883 * if {@link http://www.php.net/magic_quotes magic_quotes_gpc} is on. 
    18241884 * 
    18251885 * @since 2.2.1 
    1826  * @uses apply_filters()  
     1886 * @uses apply_filters() for the 'wp_parse_str' filter. 
    18271887 * 
    1828  * @param string $string 
    1829  * @param array $array 
     1888 * @param string $string The string to be parsed. 
     1889 * @param array $array Variables will be stored in this array. 
    18301890 */ 
    18311891function wp_parse_str( $string, &$array ) { 
    18321892        parse_str( $string, $array ); 
    18331893        if ( get_magic_quotes_gpc() ) 
    1834                 $array = stripslashes_deep( $array ); // parse_str() adds slashes if magicquotes is on.  See: http://php.net/parse_str 
     1894                $array = stripslashes_deep( $array ); 
    18351895        $array = apply_filters( 'wp_parse_str', $array ); 
    18361896} 
    18371897 
    1838 // Convert lone less than signs.  KSES already converts lone greater than signs. 
     1898/** 
     1899 * Convert lone less than signs. 
     1900 * 
     1901 * KSES already converts lone greater than signs.  
     1902 * 
     1903 * @uses wp_pre_kses_less_than_callback in the callback function. 
     1904 * @since unknown 
     1905 * 
     1906 * @param string $text Text to be converted. 
     1907 * @return string Converted text. 
     1908 */ 
    18391909function wp_pre_kses_less_than( $text ) { 
    18401910        return preg_replace_callback('%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text); 
    18411911} 
    18421912 
     1913/** 
     1914 * Callback function used by preg_replace. 
     1915 * 
     1916 * @since unknown 
     1917 * @uses wp_specialchars to format the $matches text. 
     1918 * 
     1919 * @param array $matches Populated by matches to preg_replace. 
     1920 * @return string The text returned after wp_specialchars if needed. 
     1921 */ 
    18431922function wp_pre_kses_less_than_callback( $matches ) { 
    18441923        if ( false === strpos($matches[0], '>') ) 
    18451924                return wp_specialchars($matches[0]); 
     
    18471926} 
    18481927 
    18491928/** 
    1850  * wp_sprintf() - sprintf() with filters 
     1929 * WordPress implementation of PHP sprintf() with filters. 
     1930 * 
     1931 * @since unknown 
     1932 * @link http://www.php.net/sprintf 
     1933 * 
     1934 * @param string $pattern The string which formatted args are inserted. 
     1935 * @param mixed $args,... Arguments to be formatted into the $pattern string. 
     1936 * @return string The formatted string. 
    18511937 */ 
    18521938function wp_sprintf( $pattern ) { 
    18531939        $args = func_get_args( ); 
     
    19021988} 
    19031989 
    19041990/** 
    1905  * wp_sprintf_l - List specifier %l for wp_sprintf 
     1991 * List specifier %l for wp_sprintf. 
    19061992 * 
     1993 * @since unknown 
     1994 * 
    19071995 * @param unknown_type $pattern 
    19081996 * @param unknown_type $args 
    19091997 * @return unknown 
     
    19402028} 
    19412029 
    19422030/** 
    1943  * Safely extracts not more than the first $count characters from html string 
     2031 * Safely extracts not more than the first $count characters from html string. 
    19442032 * 
    1945  * UTF-8, tags and entities safe prefix extraction. Entities inside will *NOT* be 
    1946  * counted as one character. For example &amp; will be counted as 4, &lt; as 3, etc. 
     2033 * UTF-8, tags and entities safe prefix extraction. Entities inside will *NOT* 
     2034 * be counted as one character. For example &amp; will be counted as 4, &lt; as 
     2035 * 3, etc. 
    19472036 * 
    1948  * @param integer $str String to get the excerpt from 
    1949  * @param integer $count Maximum number of characters to take 
    1950  * @return string the excerpt 
     2037 * @param integer $str String to get the excerpt from. 
     2038 * @param integer $count Maximum number of characters to take. 
     2039 * @return string The excerpt. 
    19512040 */ 
    19522041function wp_html_excerpt( $str, $count ) { 
    19532042        $str = strip_tags( $str ); 
     
    19662055 * @package WordPress 
    19672056 * @since 2.7 
    19682057 * 
    1969  * @param string $content String to search for links in 
    1970  * @param string $base The base URL to prefix to links 
     2058 * @param string $content String to search for links in. 
     2059 * @param string $base The base URL to prefix to links. 
    19712060 * @param array $attrs The attributes which should be processed. 
    1972  * @eaturn string The processed content. 
     2061 * @return string The processed content. 
    19732062 */ 
    19742063function links_add_base_url( $content, $base, $attrs = array('src', 'href') ) { 
    19752064        $attrs = implode('|', (array)$attrs); 
     
    19852074 * @package WordPress 
    19862075 * @since 2.7 
    19872076 * 
    1988  * @internal 
    1989  * @param string $m The matched link 
    1990  * @param string $base The base URL to prefix to links 
    1991  * @eaturn string The processed link 
     2077 * @param string $m The matched link. 
     2078 * @param string $base The base URL to prefix to links. 
     2079 * @return string The processed link. 
    19922080 */ 
    19932081function _links_add_base($m, $base) { 
    19942082        //1 = attribute name  2 = quotation mark  3 = URL 
     
    20092097 * @package WordPress 
    20102098 * @since 2.7 
    20112099 * 
    2012  * @param string $content String to search for links in 
    2013  * @param string $target The Target to add to the links 
     2100 * @param string $content String to search for links in. 
     2101 * @param string $target The Target to add to the links. 
    20142102 * @param array $tags An array of tags to apply to. 
    2015  * @eaturn string The processed content. 
     2103 * @return string The processed content. 
    20162104 */ 
    20172105function links_add_target( $content, $target = '_blank', $tags = array('a') ) { 
    20182106        $tags = implode('|', (array)$tags); 
     
    20212109                        $content); 
    20222110} 
    20232111/** 
    2024  * Callback to add a target attribute to all links in passed content 
     2112 * Callback to add a target attribute to all links in passed content. 
    20252113 * 
    20262114 * 
    20272115 * @package WordPress 
    20282116 * @since 2.7 
    20292117 * 
    2030  * @internal 
    2031  * @param string $m The matched link 
    2032  * @param string $target The Target to add to the links 
    2033  * @eaturn string The processed link. 
     2118 * @param string $m The matched link. 
     2119 * @param string $target The Target to add to the links. 
     2120 * @return string The processed link. 
    20342121 */ 
    20352122function _links_add_target( $m, $target ) { 
    20362123        $tag = $m[1];