Make WordPress Core

Ticket #26185: 26185.1.diff

File 26185.1.diff, 33.2 KB (added by morganestes, 11 years ago)

Refresh

  • wp-includes/functions.php

     
    6969
    7070/**
    7171 * Retrieve the date in localized format, based on timestamp.
    72  *
    7372 * If the locale specifies the locale month and weekday, then the locale will
    7473 * take over the format for the date. If it isn't, then the date format string
    7574 * will be used instead.
     
    7675 *
    7776 * @since 0.71
    7877 *
    79  * @param string $dateformatstring Format to display the date.
    80  * @param int $unixtimestamp Optional. Unix timestamp.
    81  * @param bool $gmt Optional, default is false. Whether to convert to GMT for time.
     78 * @param string   $dateformatstring Format to display the date.
     79 * @param bool|int $unixtimestamp    Optional. Unix timestamp.
     80 * @param bool     $gmt              Optional, default is false. Whether to convert to GMT for time.
     81 *
    8282 * @return string The date, translated if locale specifies it.
    8383 */
    8484function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
     
    159159/**
    160160 * Convert number of bytes largest unit bytes will fit into.
    161161 *
    162  * It is easier to read 1kB than 1024 bytes and 1MB than 1048576 bytes. Converts
     162 * It is easier to read 1KB than 1024 bytes and 1MB than 1048576 bytes. Converts
    163163 * number of bytes to human readable number by taking the number of that unit
    164164 * that the bytes will go into it. Supports TB value.
    165165 *
     
    198198 *
    199199 * @since 0.71
    200200 *
    201  * @param string $mysqlstring Date or datetime field type from mysql.
    202  * @param int $start_of_week Optional. Start of the week as an integer.
     201 * @param string     $mysqlstring   Date or datetime field type from mysql.
     202 * @param int|string $start_of_week Optional. Start of the week as an integer.
     203 *
    203204 * @return array Keys are 'start' and 'end'.
    204205 */
    205206function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
     
    355356 *
    356357 * @global string $post_default_title Default XMLRPC post title.
    357358 *
    358  * @param string $content XMLRPC XML Request content
    359  * @return string Post title
     359 * @param string $content XMLRPC XML Request content.
     360 * @return string Post title.
    360361 */
    361362function xmlrpc_getposttitle( $content ) {
    362363        global $post_default_title;
     
    381382 *
    382383 * @global string $post_default_category Default XMLRPC post category.
    383384 *
    384  * @param string $content XMLRPC XML Request content
     385 * @param string $content XMLRPC XML Request content.
    385386 * @return string|array List of categories or category name.
    386387 */
    387388function xmlrpc_getpostcategory( $content ) {
     
    402403 * @subpackage XMLRPC
    403404 * @since 0.71
    404405 *
    405  * @param string $content XMLRPC XML Request content
     406 * @param string $content XMLRPC XML Request content.
    406407 * @return string XMLRPC XML Request content without title and category elements.
    407408 */
    408409function xmlrpc_removepostdata( $content ) {
     
    413414}
    414415
    415416/**
    416  * Use RegEx to extract URLs from arbitrary content
     417 * Use RegEx to extract URLs from arbitrary content.
    417418 *
    418419 * @since 3.7.0
    419420 *
    420421 * @param string $content
    421  * @return array URLs found in passed string
     422 * @return array URLs found in passed string.
    422423 */
    423424function wp_extract_urls( $content ) {
    424425        preg_match_all(
     
    444445 *
    445446 * @uses $wpdb
    446447 *
    447  * @param string $content Post Content
    448  * @param int $post_ID Post ID
     448 * @param string $content Post Content.
     449 * @param int $post_ID Post ID.
    449450 */
    450451function do_enclose( $content, $post_ID ) {
    451452        global $wpdb;
     
    591592 *
    592593 * @since 0.71
    593594 * @uses $day Today
    594  * @uses $previousday Previous day
     595 * @uses $previousday Previous day.
    595596 *
    596597 * @return int 1 when new day, 0 if not a new day.
    597598 */
     
    616617 * @since 2.3.0
    617618 *
    618619 * @param array $data URL-encode key/value pairs.
    619  * @return string URL encoded string
     620 * @return string URL-encoded string.
    620621 */
    621622function build_query( $data ) {
    622623        return _http_build_query( $data, null, '&', '', false );
    623624}
    624625
    625 // from php.net (modified by Mark Jaquith to behave like the native PHP5 function)
     626/**
     627 * From php.net (modified by Mark Jaquith to behave like the native PHP5 function).
     628 *
     629 * @since 3.2.0
     630 * @link  http://us1.php.net/manual/en/function.http-build-query.php
     631 *
     632 * @param array|object $data      An array or object of data. Converted to array.
     633 * @param string       $prefix    Optional. Numeric index. If set, start parameter numbering with it.
     634 * @param string       $sep       Optional. Argument separator; defaults to 'arg_separator.output'.
     635 * @param string       $key       Optional. Used to prefix key name.
     636 * @param bool         $urlencode Optional. Whether to use {@link urlencode()} in the result.
     637 *
     638 * @return string The query string.
     639 */
    626640function _http_build_query($data, $prefix=null, $sep=null, $key='', $urlencode=true) {
    627641        $ret = array();
    628642
     
    801815 *
    802816 * @since 2.0.0
    803817 *
     818 * @global $wp
     819 * @global $wp_query
     820 * @global $wp_the_query
     821 *
    804822 * @param string $query_vars Default WP_Query arguments.
    805823 */
    806824function wp( $query_vars = '' ) {
     
    816834 *
    817835 * @since 2.3.0
    818836 *
     837 * @global $wp_header_to_desc
     838 *
    819839 * @param int $code HTTP status code.
    820840 * @return string Empty string if not found, or description if found.
    821841 */
     
    918938 * Gets the header information to prevent caching.
    919939 *
    920940 * The several different headers cover the different ways cache prevention is handled
    921  * by different browsers
     941 * by different browsers.
    922942 *
    923943 * @since 2.8.0
    924944 *
     
    9871007 *
    9881008 * @since 2.0.0
    9891009 *
    990  * @return int Number of database queries
     1010 * @global $wpdb
     1011 *
     1012 * @return int Number of database queries.
    9911013 */
    9921014function get_num_queries() {
    9931015        global $wpdb;
     
    9991021 *
    10001022 * @since 1.0.0
    10011023 *
    1002  * @param string $yn Character string containing either 'y' or 'n'
    1003  * @return bool True if yes, false on anything else
     1024 * @param string $yn Character string containing either 'y' or 'n'.
     1025 * @return bool True if yes, false on anything else.
    10041026 */
    10051027function bool_from_yn( $yn ) {
    10061028        return ( strtolower( $yn ) == 'y' );
     
    10151037 * It is better to only have one hook for each feed.
    10161038 *
    10171039 * @since 2.1.0
    1018  * @uses $wp_query Used to tell if the use a comment feed.
     1040 *
     1041 * @global $wp_query Used to tell if the use a comment feed.
    10191042 * @uses do_action() Calls 'do_feed_$feed' hook, if a hook exists for the feed.
    10201043 */
    10211044function do_feed() {
     
    11201143 * Checks for the option siteurl for whether WordPress is installed.
    11211144 *
    11221145 * @since 2.1.0
    1123  * @uses $wpdb
    11241146 *
     1147 * @global $wpdb
     1148 *
    11251149 * @return bool Whether blog is already installed.
    11261150 */
    11271151function is_blog_installed() {
     
    12741298 * @subpackage Security
    12751299 * @since 2.0.4
    12761300 *
    1277  * @param bool $echo Whether to echo the original http referer
     1301 * @param bool $echo Whether to echo the original http referer.
    12781302 * @param string $jump_back_to Optional, default is 'current'. Can be 'previous' or page you want to jump back to.
    12791303 * @return string Original referer field.
    12801304 */
     
    13961420 *
    13971421 * @since 2.5.0
    13981422 *
    1399  * @param string $path File path
     1423 * @param string $path File path to check.
    14001424 * @return bool True if path is absolute, false is not absolute.
    14011425 */
    14021426function path_is_absolute( $path ) {
     
    14541478 * Determines a writable directory for temporary files.
    14551479 * Function's preference is the return value of <code>sys_get_temp_dir()</code>,
    14561480 * followed by your PHP temporary upload directory, followed by WP_CONTENT_DIR,
    1457  * before finally defaulting to /tmp/
     1481 * before finally defaulting to /tmp/.
    14581482 *
    14591483 * In the event that this function does not find a writable location,
    14601484 * It may be overridden by the <code>WP_TEMP_DIR</code> constant in
     
    14621486 *
    14631487 * @since 2.5.0
    14641488 *
    1465  * @return string Writable temporary directory
     1489 * @return string Writable temporary directory.
    14661490 */
    14671491function get_temp_dir() {
    14681492        static $temp;
     
    15001524 *
    15011525 * @since 3.6.0
    15021526 *
    1503  * @param string $path
    1504  * @return bool
     1527 * @param string $path Path to directory to check.
     1528 * @return bool True if writable, false if not writable.
    15051529 */
    15061530function wp_is_writable( $path ) {
    15071531        if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) )
     
    15111535}
    15121536
    15131537/**
    1514  * Workaround for Windows bug in is_writable() function
     1538 * Workaround for Windows bug in is_writable() function.
    15151539 *
    15161540 * PHP has issues with Windows ACL's for determine if a
    15171541 * directory is writable or not, this works around them by
     
    15231547 *
    15241548 * @since 2.8.0
    15251549 *
    1526  * @param string $path
    1527  * @return bool
     1550 * @param string $path Path to directory to check.
     1551 * @return bool True if writable, false if not writable.
    15281552 */
    15291553function win_is_writable( $path ) {
    15301554
     
    17621786 *
    17631787 * @since 2.0.0
    17641788 *
    1765  * @param string $name
     1789 * @param string $name Name of the file to create.
    17661790 * @param null $deprecated Never used. Set to null.
    1767  * @param mixed $bits File content
     1791 * @param mixed $bits File content.
    17681792 * @param string $time Optional. Time formatted in 'yyyy/mm'.
    1769  * @return array
     1793 * @return array On success: file path and url; on error: error details.
    17701794 */
    17711795function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
    17721796        if ( !empty( $deprecated ) )
     
    18961920 * @since 3.0.0
    18971921 *
    18981922 * @param string $file Full path to the file.
    1899  * @param string $filename The name of the file (may differ from $file due to $file being in a tmp directory)
     1923 * @param string $filename The name of the file (may differ from $file due to $file being in a tmp directory).
    19001924 * @param array $mimes Optional. Key is the file extension with value as the mime type.
    1901  * @return array Values for the extension, MIME, and either a corrected filename or false if original $filename is valid
     1925 * @return array Values for the extension, MIME, and either a corrected filename or false if original $filename is valid.
    19021926 */
    19031927function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
    19041928
     
    19571981 *
    19581982 * @since 3.5.0
    19591983 *
    1960  * @uses apply_filters() Calls 'mime_types' on returned array. This filter should
    1961  * be used to add types, not remove them. To remove types use the upload_mimes filter.
     1984 * @uses apply_filters() Calls 'mime_types' on returned array.
     1985 *                                                                                       This filter should be used to add types, not remove them.
     1986 *                                                                                       To remove types use the upload_mimes filter.
    19621987 *
    19631988 * @return array Array of mime types keyed by the file extension regex corresponding to those types.
    19641989 */
     
    20632088 *
    20642089 * @since 2.8.6
    20652090 *
    2066  * @uses apply_filters() Calls 'upload_mimes' on returned array
    2067  * @uses wp_get_upload_mime_types() to fetch the list of mime types
     2091 * @uses apply_filters() Calls 'upload_mimes' on returned array.
     2092 * @uses wp_get_upload_mime_types() to fetch the list of mime types.
    20682093 *
    20692094 * @param int|WP_User $user Optional. User to check. Defaults to current user.
    20702095 * @return array Array of mime types keyed by the file extension regex corresponding to those types.
     
    21382163 * Kill WordPress execution and display HTML message with error message.
    21392164 *
    21402165 * This is the default handler for wp_die if you want a custom one for your
    2141  * site then you can overload using the wp_die_handler filter in wp_die
     2166 * site then you can overload using the wp_die_handler filter in wp_die.
    21422167 *
    21432168 * @since 3.0.0
    21442169 * @access private
     
    23212346 * @since 3.2.0
    23222347 * @access private
    23232348 *
     2349 * @global $wp_xmlrpc_server
     2350 *
    23242351 * @param string $message Error message.
    23252352 * @param string $title Error title.
    23262353 * @param string|array $args Optional arguments to control behavior.
     
    24292456 * @package WordPress
    24302457 * @since 2.2.0
    24312458 *
    2432  * @param string $url URL for the home location
     2459 * @param string $url URL for the home location.
    24332460 * @return string Homepage location.
    24342461 */
    24352462function _config_wp_home( $url = '' ) {
     
    24502477 * @since 2.2.0
    24512478 *
    24522479 * @param string $url URL to set the WordPress site location.
    2453  * @return string The WordPress Site URL
     2480 * @return string The WordPress Site URL.
    24542481 */
    24552482function _config_wp_siteurl( $url = '' ) {
    24562483        if ( defined( 'WP_SITEURL' ) )
     
    26012628
    26022629/**
    26032630 * Merge user defined arguments into defaults array.
    2604  *
    26052631 * This function is used throughout WordPress to allow for both string or array
    26062632 * to be merged into another array.
    26072633 *
    26082634 * @since 2.2.0
    26092635 *
    2610  * @param string|array $args Value to merge with $defaults
    2611  * @param array $defaults Array that serves as the defaults.
     2636 * @param string|array $args     Value to merge with $defaults.
     2637 * @param array|string $defaults Optional. Array that serves as the defaults.
     2638 *
    26122639 * @return array Merged user defined values with defaults.
    26132640 */
    26142641function wp_parse_args( $args, $defaults = '' ) {
     
    26292656 *
    26302657 * @since 3.0.0
    26312658 *
    2632  * @param array|string $list
    2633  * @return array Sanitized array of IDs
     2659 * @param array|string $list List of IDs.
     2660 * @return array Sanitized array of IDs.
    26342661 */
    26352662function wp_parse_id_list( $list ) {
    26362663        if ( !is_array($list) )
     
    26442671 *
    26452672 * @since 3.1.0
    26462673 *
    2647  * @param array $array The original array
    2648  * @param array $keys The list of keys
    2649  * @return array The array slice
     2674 * @param array $array The original array.
     2675 * @param array $keys The list of keys.
     2676 * @return array The array slice.
    26502677 */
    26512678function wp_array_slice_assoc( $array, $keys ) {
    26522679        $slice = array();
     
    26622689 *
    26632690 * @since 3.0.0
    26642691 *
    2665  * @param array $list An array of objects to filter
    2666  * @param array $args An array of key => value arguments to match against each object
    2667  * @param string $operator The logical operation to perform. 'or' means only one element
    2668  *      from the array needs to match; 'and' means all elements must match. The default is 'and'.
    2669  * @param bool|string $field A field from the object to place instead of the entire object
    2670  * @return array A list of objects or object fields
     2692 * @param array $list An array of objects to filter.
     2693 * @param array $args An array of key => value arguments to match against each object.
     2694 * @param string $operator  The logical operation to perform. 'or' means only one element
     2695 *                          from the array needs to match; 'and' means all elements must match.
     2696 *                          The default is 'and'.
     2697 * @param bool|string $field  A field from the object to place instead of the entire object.
     2698 *
     2699 * @return array A list of objects or object fields.
    26712700 */
    26722701function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
    26732702        if ( ! is_array( $list ) )
     
    26862715 *
    26872716 * @since 3.1.0
    26882717 *
    2689  * @param array $list An array of objects to filter
    2690  * @param array $args An array of key => value arguments to match against each object
     2718 * @param array $list An array of objects to filter.
     2719 * @param array $args An array of key => value arguments to match against each object.
    26912720 * @param string $operator The logical operation to perform:
    26922721 *    'AND' means all elements from the array must match;
    26932722 *    'OR' means only one element needs to match;
    26942723 *    'NOT' means no elements may match.
    26952724 *   The default is 'AND'.
    2696  * @return array
     2725 * @return array The filtered object list.
    26972726 */
    26982727function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
    26992728        if ( ! is_array( $list ) )
     
    27302759 *
    27312760 * @since 3.1.0
    27322761 *
    2733  * @param array $list A list of objects or arrays
    2734  * @param int|string $field A field from the object to place instead of the entire object
    2735  * @return array
     2762 * @param array $list A list of objects or arrays.
     2763 * @param int|string $field A field from the object to place instead of the entire object.
     2764 * @return array The filtered $list.
    27362765 */
    27372766function wp_list_pluck( $list, $field ) {
    27382767        foreach ( $list as $key => $value ) {
     
    28052834 * in WordPress 2.5.0.
    28062835 *
    28072836 * @since 2.3.2
    2808  * @uses $wpdb
     2837 * @global $wpdb
    28092838 */
    28102839function dead_db() {
    28112840        global $wpdb;
     
    28432872}
    28442873
    28452874/**
    2846  * Converts value to nonnegative integer.
     2875 * Converts value to non-negative integer.
    28472876 *
    28482877 * @since 2.5.0
    28492878 *
    2850  * @param mixed $maybeint Data you wish to have converted to a nonnegative integer
    2851  * @return int An nonnegative integer
     2879 * @param mixed $maybeint Data you wish to have converted to a non-negative integer.
     2880 * @return int An non-negative integer.
    28522881 */
    28532882function absint( $maybeint ) {
    28542883        return abs( intval( $maybeint ) );
     
    28622891 *
    28632892 * @since 2.5.0
    28642893 *
    2865  * @param string $url
    2866  * @return bool Whether SSL access is available
     2894 * @param string $url The URL of the blog to check.
     2895 * @return bool Whether SSL access is available.
    28672896 */
    28682897function url_is_accessable_via_ssl($url)
    28692898{
     
    29102939 * @uses apply_filters() Calls 'deprecated_function_trigger_error' and expects boolean value of true to do
    29112940 *   trigger or false to not trigger error.
    29122941 *
    2913  * @param string $function The function that was called
    2914  * @param string $version The version of WordPress that deprecated the function
    2915  * @param string $replacement Optional. The function that should have been called
     2942 * @param string $function The function that was called.
     2943 * @param string $version The version of WordPress that deprecated the function.
     2944 * @param string $replacement Optional. The function that should have been called.
    29162945 */
    29172946function _deprecated_function( $function, $version, $replacement = null ) {
    29182947
     
    29552984 * @uses apply_filters() Calls 'deprecated_file_trigger_error' and expects boolean value of true to do
    29562985 *   trigger or false to not trigger error.
    29572986 *
    2958  * @param string $file The file that was included
    2959  * @param string $version The version of WordPress that deprecated the file
    2960  * @param string $replacement Optional. The file that should have been included based on ABSPATH
    2961  * @param string $message Optional. A message regarding the change
     2987 * @param string $file The file that was included.
     2988 * @param string $version The version of WordPress that deprecated the file.
     2989 * @param string $replacement Optional. The file that should have been included based on ABSPATH.
     2990 * @param string $message Optional. A message regarding the change.
    29622991 */
    29632992function _deprecated_file( $file, $version, $replacement = null, $message = '' ) {
    29642993
     
    29883017 * used by comparing it to its default value or evaluating whether it is empty.
    29893018 * For example:
    29903019 * <code>
    2991  * if ( !empty($deprecated) )
     3020 * if ( ! empty( $deprecated ) )
    29923021 *      _deprecated_argument( __FUNCTION__, '3.0' );
    29933022 * </code>
    29943023 *
     
    30083037 * @uses apply_filters() Calls 'deprecated_argument_trigger_error' and expects boolean value of true to do
    30093038 *   trigger or false to not trigger error.
    30103039 *
    3011  * @param string $function The function that was called
    3012  * @param string $version The version of WordPress that deprecated the argument used
     3040 * @param string $function The function that was called.
     3041 * @param string $version The version of WordPress that deprecated the argument used.
    30133042 * @param string $message Optional. A message regarding the change.
    30143043 */
    30153044function _deprecated_argument( $function, $version, $message = null ) {
     
    30903119 *
    30913120 * @since 2.5.0
    30923121 *
    3093  * @param string $mod e.g. mod_rewrite
    3094  * @param bool $default The default return value if the module is not found
    3095  * @return bool
     3122 * @param string $mod Module to check, e.g. mod_rewrite.
     3123 * @param bool $default The default return value if the module is not found.
     3124 * @return bool True if module loaded, false if not loaded.
    30963125 */
    30973126function apache_mod_loaded($mod, $default = false) {
    30983127        global $is_apache;
     
    31193148 *
    31203149 * @since 2.8.0
    31213150 *
    3122  * @return bool
     3151 * @return bool True if permalinks are supported, false if not supported.
    31233152 */
    31243153function iis7_supports_permalinks() {
    31253154        global $is_iis7;
     
    31433172
    31443173/**
    31453174 * File validates against allowed set of defined rules.
    3146  *
    31473175 * A return value of '1' means that the $file contains either '..' or './'. A
    31483176 * return value of '2' means that the $file contains ':' after the first
    31493177 * character. A return value of '3' means that the file is not in the allowed
     
    31513179 *
    31523180 * @since 1.2.0
    31533181 *
    3154  * @param string $file File path.
    3155  * @param array $allowed_files List of allowed files.
     3182 * @param string       $file          File path.
     3183 * @param array|string $allowed_files Optional. List of allowed files.
     3184 *
    31563185 * @return int 0 means nothing is wrong, greater than 0 means something was wrong.
    31573186 */
    31583187function validate_file( $file, $allowed_files = '' ) {
     
    32383267 *
    32393268 * @since 2.6.0
    32403269 *
    3241  * @return string
     3270 * @return string The best-guess URL of the site.
    32423271 */
    32433272function wp_guess_url() {
    32443273        if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
     
    32923321 * @since 3.3.0
    32933322 *
    32943323 * @param bool $suspend Optional. Suspends additions if true, re-enables them if false.
    3295  * @return bool The current suspend setting
     3324 * @return bool The current suspend setting.
    32963325 */
    32973326function wp_suspend_cache_addition( $suspend = null ) {
    32983327        static $_suspend = false;
     
    33123341 *
    33133342 * @since 2.7.0
    33143343 *
    3315  * @param bool $suspend Whether to suspend or enable cache invalidation
    3316  * @return bool The current suspend setting
     3344 * @param bool $suspend Whether to suspend or enable cache invalidation.
     3345 * @return bool The current suspend setting.
    33173346 */
    33183347function wp_suspend_cache_invalidation($suspend = true) {
    33193348        global $_wp_suspend_cache_invalidation;
     
    33493378 *
    33503379 * @since 3.7.0
    33513380 *
     3381 * @global $wpdb
     3382 *
    33523383 * @param int $network_id Optional. Network ID to test. Defaults to current network.
    33533384 * @return bool True if $network_id is the main network, or if not running multisite.
    33543385 */
     
    33883419 * @since 3.0.0
    33893420 * @package WordPress
    33903421 *
    3391  * @return bool True if multisite and global terms enabled
     3422 * @return bool True if multisite and global terms enabled.
    33923423 */
    33933424function global_terms_enabled() {
    33943425        if ( ! is_multisite() )
     
    34123443 *
    34133444 * @since 2.8.0
    34143445 *
    3415  * @return float|bool
     3446 * @return float|bool Timezone offset; false if not set or if any errors.
    34163447 */
    34173448function wp_timezone_override_offset() {
    34183449        if ( !$timezone_string = get_option( 'timezone_string' ) ) {
     
    34343465 *
    34353466 * @param array $a
    34363467 * @param array $b
    3437  * @return int
     3468 * @return int Less than 0 if $ is greater, 0 if equal, greater than 0 if $b is greater.
    34383469 */
    34393470function _wp_timezone_choice_usort_callback( $a, $b ) {
    34403471        // Don't use translated versions of Etc
     
    34793510 *
    34803511 * @since 2.9.0
    34813512 *
    3482  * @param string $selected_zone Selected Zone
    3483  * @return string
     3513 * @param string $selected_zone Selected Zone.
     3514 * @return string Formatted timezones.
    34843515 */
    34853516function wp_timezone_choice( $selected_zone ) {
    34863517        static $mo_loaded = false;
     
    36053636
    36063637/**
    36073638 * Strip close comment and close php tags from file headers used by WP.
    3608  * See http://core.trac.wordpress.org/ticket/8497
    36093639 *
    36103640 * @since 2.8.0
     3641 * @link http://core.trac.wordpress.org/ticket/8497
    36113642 *
    3612  * @param string $str
    3613  * @return string
     3643 * @param string $str String to clean.
     3644 * @return string The cleaned-up string.
    36143645 */
    36153646function _cleanup_header_comment($str) {
    36163647        return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str));
     
    36203651 * Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS.
    36213652 *
    36223653 * @since 2.9.0
     3654 *
     3655 * @global $wpdb
    36233656 */
    36243657function wp_scheduled_delete() {
    36253658        global $wpdb;
     
    36643697/**
    36653698 * Retrieve metadata from a file.
    36663699 *
    3667  * Searches for metadata in the first 8kiB of a file, such as a plugin or theme.
     3700 * Searches for metadata in the first 8KiB of a file, such as a plugin or theme.
    36683701 * Each piece of metadata must be on its own line. Fields can not span multiple
    36693702 * lines, the value will get cut at the end of the first line.
    36703703 *
    3671  * If the file data is not within that first 8kiB, then the author should correct
     3704 * If the file data is not within that first 8KiB, then the author should correct
    36723705 * their plugin file and move the data headers to the top.
    36733706 *
    3674  * @see http://codex.wordpress.org/File_Header
     3707 * @link http://codex.wordpress.org/File_Header
    36753708 *
    36763709 * @since 2.9.0
    3677  * @param string $file Path to the file
    3678  * @param array $default_headers List of headers, in the format array('HeaderKey' => 'Header Name')
    3679  * @param string $context If specified adds filter hook "extra_{$context}_headers"
     3710 *
     3711 * @param string $file Path to the file.
     3712 * @param array $default_headers {
     3713 *              An array of header values in themes and plugins.
     3714 *
     3715 *              @type string $key HeaderKey. Accepts string 'Header Name'.
     3716 * }
     3717 * @param string $context If specified adds filter hook "extra_{$context}_headers".
     3718 * @return array
    36803719 */
    36813720function get_file_data( $file, $default_headers, $context = '' ) {
    36823721        // We don't need to write to the file, so just open for reading.
    36833722        $fp = fopen( $file, 'r' );
    36843723
    3685         // Pull only the first 8kiB of the file in.
     3724        // Pull only the first 8KiB of the file in.
    36863725        $file_data = fread( $fp, 8192 );
    36873726
    36883727        // PHP will close file handle, but we are good citizens.
     
    37153754 *
    37163755 * @since 3.0.0
    37173756 * @see __return_false()
     3757 *
    37183758 * @return bool true
    37193759 */
    37203760function __return_true() {
     
    37283768 *
    37293769 * @since 3.0.0
    37303770 * @see __return_true()
     3771 *
    37313772 * @return bool false
    37323773 */
    37333774function __return_false() {
     
    37403781 * Useful for returning 0 to filters easily.
    37413782 *
    37423783 * @since 3.0.0
     3784 *
    37433785 * @return int 0
    37443786 */
    37453787function __return_zero() {
     
    37523794 * Useful for returning an empty array to filters easily.
    37533795 *
    37543796 * @since 3.0.0
    3755  * @return array Empty array
     3797 *
     3798 * @return array Empty array.
    37563799 */
    37573800function __return_empty_array() {
    37583801        return array();
     
    37643807 * Useful for returning null to filters easily.
    37653808 *
    37663809 * @since 3.4.0
     3810 *
    37673811 * @return null
    37683812 */
    37693813function __return_null() {
     
    37773821 *
    37783822 * @since 3.7.0
    37793823 * @see __return_null()
     3824 *
    37803825 * @return string Empty string
    37813826 */
    37823827function __return_empty_string() {
     
    37903835 * @link http://src.chromium.org/viewvc/chrome?view=rev&revision=6985
    37913836 *
    37923837 * @since 3.0.0
    3793  * @return none
    37943838 */
    37953839function send_nosniff_header() {
    37963840        @header( 'X-Content-Type-Options: nosniff' );
     
    38013845 *
    38023846 * @internal
    38033847 * @since 3.0.0
     3848 *
    38043849 * @param string $column
    38053850 * @return string
    38063851 */
     
    38233868/**
    38243869 * Finds hierarchy loops using a callback function that maps object IDs to parent IDs.
    38253870 *
     3871 * @access private
    38263872 * @since 3.1.0
    3827  * @access private
    38283873 *
    3829  * @param callback $callback function that accepts ( ID, $callback_args ) and outputs parent_ID
    3830  * @param int $start The ID to start the loop check at
    3831  * @param int $start_parent the parent_ID of $start to use instead of calling $callback( $start ). Use null to always use $callback
    3832  * @param array $callback_args optional additional arguments to send to $callback
    3833  * @return array IDs of all members of loop
     3874 * @param callback $callback function that accepts ( ID, $callback_args ) and outputs parent_ID.
     3875 * @param int $start The ID to start the loop check.
     3876 * @param int $start_parent the parent_ID of $start to use instead of calling $callback( $start ).
     3877 *              Use null to always use $callback.
     3878 * @param array $callback_args optional additional arguments to send to $callback.
     3879 * @return array IDs of all members of loop.
    38343880 */
    38353881function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
    38363882        $override = is_null( $start_parent ) ? array() : array( $start => $start_parent );
     
    38473893 * For every step of the algorithm, the hare takes two steps and the tortoise one.
    38483894 * If the hare ever laps the tortoise, there must be a loop.
    38493895 *
     3896 * @access private
    38503897 * @since 3.1.0
    3851  * @access private
    38523898 *
    3853  * @param callback $callback function that accepts ( ID, callback_arg, ... ) and outputs parent_ID
    3854  * @param int $start The ID to start the loop check at
    3855  * @param array $override an array of ( ID => parent_ID, ... ) to use instead of $callback
    3856  * @param array $callback_args optional additional arguments to send to $callback
     3899 * @param callback $callback Function that accepts ( ID, callback_arg, ... ) and outputs parent_ID.
     3900 * @param int $start The ID to start the loop check.
     3901 * @param array $override An array of ( ID => parent_ID, ... ) to use instead of $callback.
     3902 * @param array $callback_args Optional. Additional arguments to send to $callback.
    38573903 * @param bool $_return_loop Return loop members or just detect presence of loop?
    38583904 *             Only set to true if you already know the given $start is part of a loop
    3859  *             (otherwise the returned array might include branches)
    3860  * @return mixed scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if $_return_loop
     3905 *             (otherwise the returned array might include branches).
     3906 * @return mixed Scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if $_return_loop.
    38613907 */
    38623908function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) {
    38633909        $tortoise = $hare = $evanescent_hare = $start;
     
    38923938 * @link https://developer.mozilla.org/en/the_x-frame-options_response_header
    38933939 *
    38943940 * @since 3.1.3
    3895  * @return none
    38963941 */
    38973942function send_frame_options_header() {
    38983943        @header( 'X-Frame-Options: SAMEORIGIN' );
     
    39243969 * @link http://core.trac.wordpress.org/ticket/19589
    39253970 * @since 3.4.0
    39263971 *
    3927  * @param string $ignore_class A class to ignore all function calls within - useful when you want to just give info about the callee
    3928  * @param int $skip_frames A number of stack frames to skip - useful for unwinding back to the source of the issue
    3929  * @param bool $pretty Whether or not you want a comma separated string or raw array returned
     3972 * @param string $ignore_class A class to ignore all function calls within -
     3973 *              useful when you want to just give info about the callee.
     3974 * @param int $skip_frames A number of stack frames to skip - useful for unwinding back to the source of the issue.
     3975 * @param bool $pretty Whether or not you want a comma separated string or raw array returned.
    39303976 * @return string|array Either a string containing a reversed comma separated trace or an array of individual calls.
    39313977 */
    39323978function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
     
    39644010}
    39654011
    39664012/**
    3967  * Retrieve ids that are not already present in the cache
     4013 * Retrieve IDs that are not already present in the cache.
    39684014 *
    39694015 * @since 3.4.0
    39704016 *
    3971  * @param array $object_ids ID list
    3972  * @param string $cache_key The cache bucket to check against
     4017 * @param array $object_ids ID list.
     4018 * @param string $cache_key The cache bucket to check against.
    39734019 *
    3974  * @return array
     4020 * @return array Cleaned up array of IDs.
    39754021 */
    39764022function _get_non_cached_ids( $object_ids, $cache_key ) {
    39774023        $clean = array();
     
    39884034/**
    39894035 * Test if the current device has the capability to upload files.
    39904036 *
     4037 * @access private
    39914038 * @since 3.4.0
    3992  * @access private
    39934039 *
    3994  * @return bool true|false
     4040 * @return bool True if the device allows uploads; false if not.
    39954041 */
    39964042function _device_can_upload() {
    39974043        if ( ! wp_is_mobile() )
     
    40094055}
    40104056
    40114057/**
    4012  * Test if a given path is a stream URL
     4058 * Test if a given path is a stream URL.
    40134059 *
    4014  * @param string $path The resource path or URL
    4015  * @return bool True if the path is a stream URL
     4060 * @param string $path The resource path or URL.
     4061 * @return bool True if the path is a stream URL.
    40164062 */
    40174063function wp_is_stream( $path ) {
    40184064        $wrappers = stream_get_wrappers();
     
    40224068}
    40234069
    40244070/**
    4025  * Test if the supplied date is valid for the Gregorian calendar
     4071 * Test if the supplied date is valid for the Gregorian calendar.
    40264072 *
    40274073 * @since 3.5.0
     4074 * @see checkdate()
    40284075 *
    4029  * @return bool true|false
     4076 * @param int $month
     4077 * @param int $day
     4078 * @param int $year
     4079 * @param $source_date
     4080 *
     4081 * @return bool True if valid date, false if not valid date.
    40304082 */
    40314083function wp_checkdate( $month, $day, $year, $source_date ) {
    40324084        return apply_filters( 'wp_checkdate', checkdate( $month, $day, $year ), $source_date );
     
    40354087/**
    40364088 * Load the auth check for monitoring whether the user is still logged in.
    40374089 *
    4038  * Can be disabled with remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
     4090 * Can be disabled with `remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );`.
    40394091 *
    40404092 * This is disabled for certain screens where a login screen could cause an
    40414093 * inconvenient interruption. A filter called wp_auth_check_load can be used
     
    41064158
    41074159/**
    41084160 * Check whether a user is still logged in, for the heartbeat.
    4109  *
    41104161 * Send a result that shows a log-in box if the user is no longer logged in,
    41114162 * or if their cookie is within the grace period.
    41124163 *
    41134164 * @since 3.6.0
     4165 *
     4166 * @param array $response
     4167 * @param       $data
     4168 *
     4169 * @return array
    41144170 */
    41154171function wp_auth_check( $response ) {
    41164172        $response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] );
     
    41234179 * 2. Has no body but has a closing tag of the same name or
    41244180 * 3. Contains a body and a closing tag of the same name
    41254181 *
    4126  * Note: this RegEx does not balance inner tags and does not attempt to produce valid HTML
     4182 * Note: this RegEx does not balance inner tags and does not attempt to produce valid HTML.
    41274183 *
    41284184 * @since 3.6.0
    41294185 *
    4130  * @param string $tag An HTML tag name. Example: 'video'
     4186 * @param string $tag An HTML tag name. Example: 'video'.
    41314187 * @return string
    41324188 */
    41334189function get_tag_regex( $tag ) {
     
    41434199 * @link http://core.trac.wordpress.org/ticket/23688
    41444200 * @since 3.6.0
    41454201 *
    4146  * @param string A charset name
    4147  * @return string The canonical form of the charset
     4202 * @param string $charset A charset name.
     4203 * @return string The canonical form of the charset.
    41484204 */
    41494205function _canonical_charset( $charset ) {
    41504206        if ( 'UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||