Ticket #26185: 26185.1.diff
File 26185.1.diff, 33.2 KB (added by , 11 years ago) |
---|
-
wp-includes/functions.php
69 69 70 70 /** 71 71 * Retrieve the date in localized format, based on timestamp. 72 *73 72 * If the locale specifies the locale month and weekday, then the locale will 74 73 * take over the format for the date. If it isn't, then the date format string 75 74 * will be used instead. … … 76 75 * 77 76 * @since 0.71 78 77 * 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 * 82 82 * @return string The date, translated if locale specifies it. 83 83 */ 84 84 function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) { … … 159 159 /** 160 160 * Convert number of bytes largest unit bytes will fit into. 161 161 * 162 * It is easier to read 1 kB than 1024 bytes and 1MB than 1048576 bytes. Converts162 * It is easier to read 1KB than 1024 bytes and 1MB than 1048576 bytes. Converts 163 163 * number of bytes to human readable number by taking the number of that unit 164 164 * that the bytes will go into it. Supports TB value. 165 165 * … … 198 198 * 199 199 * @since 0.71 200 200 * 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 * 203 204 * @return array Keys are 'start' and 'end'. 204 205 */ 205 206 function get_weekstartend( $mysqlstring, $start_of_week = '' ) { … … 355 356 * 356 357 * @global string $post_default_title Default XMLRPC post title. 357 358 * 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. 360 361 */ 361 362 function xmlrpc_getposttitle( $content ) { 362 363 global $post_default_title; … … 381 382 * 382 383 * @global string $post_default_category Default XMLRPC post category. 383 384 * 384 * @param string $content XMLRPC XML Request content 385 * @param string $content XMLRPC XML Request content. 385 386 * @return string|array List of categories or category name. 386 387 */ 387 388 function xmlrpc_getpostcategory( $content ) { … … 402 403 * @subpackage XMLRPC 403 404 * @since 0.71 404 405 * 405 * @param string $content XMLRPC XML Request content 406 * @param string $content XMLRPC XML Request content. 406 407 * @return string XMLRPC XML Request content without title and category elements. 407 408 */ 408 409 function xmlrpc_removepostdata( $content ) { … … 413 414 } 414 415 415 416 /** 416 * Use RegEx to extract URLs from arbitrary content 417 * Use RegEx to extract URLs from arbitrary content. 417 418 * 418 419 * @since 3.7.0 419 420 * 420 421 * @param string $content 421 * @return array URLs found in passed string 422 * @return array URLs found in passed string. 422 423 */ 423 424 function wp_extract_urls( $content ) { 424 425 preg_match_all( … … 444 445 * 445 446 * @uses $wpdb 446 447 * 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. 449 450 */ 450 451 function do_enclose( $content, $post_ID ) { 451 452 global $wpdb; … … 591 592 * 592 593 * @since 0.71 593 594 * @uses $day Today 594 * @uses $previousday Previous day 595 * @uses $previousday Previous day. 595 596 * 596 597 * @return int 1 when new day, 0 if not a new day. 597 598 */ … … 616 617 * @since 2.3.0 617 618 * 618 619 * @param array $data URL-encode key/value pairs. 619 * @return string URL encoded string620 * @return string URL-encoded string. 620 621 */ 621 622 function build_query( $data ) { 622 623 return _http_build_query( $data, null, '&', '', false ); 623 624 } 624 625 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 */ 626 640 function _http_build_query($data, $prefix=null, $sep=null, $key='', $urlencode=true) { 627 641 $ret = array(); 628 642 … … 801 815 * 802 816 * @since 2.0.0 803 817 * 818 * @global $wp 819 * @global $wp_query 820 * @global $wp_the_query 821 * 804 822 * @param string $query_vars Default WP_Query arguments. 805 823 */ 806 824 function wp( $query_vars = '' ) { … … 816 834 * 817 835 * @since 2.3.0 818 836 * 837 * @global $wp_header_to_desc 838 * 819 839 * @param int $code HTTP status code. 820 840 * @return string Empty string if not found, or description if found. 821 841 */ … … 918 938 * Gets the header information to prevent caching. 919 939 * 920 940 * The several different headers cover the different ways cache prevention is handled 921 * by different browsers 941 * by different browsers. 922 942 * 923 943 * @since 2.8.0 924 944 * … … 987 1007 * 988 1008 * @since 2.0.0 989 1009 * 990 * @return int Number of database queries 1010 * @global $wpdb 1011 * 1012 * @return int Number of database queries. 991 1013 */ 992 1014 function get_num_queries() { 993 1015 global $wpdb; … … 999 1021 * 1000 1022 * @since 1.0.0 1001 1023 * 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. 1004 1026 */ 1005 1027 function bool_from_yn( $yn ) { 1006 1028 return ( strtolower( $yn ) == 'y' ); … … 1015 1037 * It is better to only have one hook for each feed. 1016 1038 * 1017 1039 * @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. 1019 1042 * @uses do_action() Calls 'do_feed_$feed' hook, if a hook exists for the feed. 1020 1043 */ 1021 1044 function do_feed() { … … 1120 1143 * Checks for the option siteurl for whether WordPress is installed. 1121 1144 * 1122 1145 * @since 2.1.0 1123 * @uses $wpdb1124 1146 * 1147 * @global $wpdb 1148 * 1125 1149 * @return bool Whether blog is already installed. 1126 1150 */ 1127 1151 function is_blog_installed() { … … 1274 1298 * @subpackage Security 1275 1299 * @since 2.0.4 1276 1300 * 1277 * @param bool $echo Whether to echo the original http referer 1301 * @param bool $echo Whether to echo the original http referer. 1278 1302 * @param string $jump_back_to Optional, default is 'current'. Can be 'previous' or page you want to jump back to. 1279 1303 * @return string Original referer field. 1280 1304 */ … … 1396 1420 * 1397 1421 * @since 2.5.0 1398 1422 * 1399 * @param string $path File path 1423 * @param string $path File path to check. 1400 1424 * @return bool True if path is absolute, false is not absolute. 1401 1425 */ 1402 1426 function path_is_absolute( $path ) { … … 1454 1478 * Determines a writable directory for temporary files. 1455 1479 * Function's preference is the return value of <code>sys_get_temp_dir()</code>, 1456 1480 * followed by your PHP temporary upload directory, followed by WP_CONTENT_DIR, 1457 * before finally defaulting to /tmp/ 1481 * before finally defaulting to /tmp/. 1458 1482 * 1459 1483 * In the event that this function does not find a writable location, 1460 1484 * It may be overridden by the <code>WP_TEMP_DIR</code> constant in … … 1462 1486 * 1463 1487 * @since 2.5.0 1464 1488 * 1465 * @return string Writable temporary directory 1489 * @return string Writable temporary directory. 1466 1490 */ 1467 1491 function get_temp_dir() { 1468 1492 static $temp; … … 1500 1524 * 1501 1525 * @since 3.6.0 1502 1526 * 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. 1505 1529 */ 1506 1530 function wp_is_writable( $path ) { 1507 1531 if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) … … 1511 1535 } 1512 1536 1513 1537 /** 1514 * Workaround for Windows bug in is_writable() function 1538 * Workaround for Windows bug in is_writable() function. 1515 1539 * 1516 1540 * PHP has issues with Windows ACL's for determine if a 1517 1541 * directory is writable or not, this works around them by … … 1523 1547 * 1524 1548 * @since 2.8.0 1525 1549 * 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. 1528 1552 */ 1529 1553 function win_is_writable( $path ) { 1530 1554 … … 1762 1786 * 1763 1787 * @since 2.0.0 1764 1788 * 1765 * @param string $name 1789 * @param string $name Name of the file to create. 1766 1790 * @param null $deprecated Never used. Set to null. 1767 * @param mixed $bits File content 1791 * @param mixed $bits File content. 1768 1792 * @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. 1770 1794 */ 1771 1795 function wp_upload_bits( $name, $deprecated, $bits, $time = null ) { 1772 1796 if ( !empty( $deprecated ) ) … … 1896 1920 * @since 3.0.0 1897 1921 * 1898 1922 * @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). 1900 1924 * @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. 1902 1926 */ 1903 1927 function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) { 1904 1928 … … 1957 1981 * 1958 1982 * @since 3.5.0 1959 1983 * 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. 1962 1987 * 1963 1988 * @return array Array of mime types keyed by the file extension regex corresponding to those types. 1964 1989 */ … … 2063 2088 * 2064 2089 * @since 2.8.6 2065 2090 * 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. 2068 2093 * 2069 2094 * @param int|WP_User $user Optional. User to check. Defaults to current user. 2070 2095 * @return array Array of mime types keyed by the file extension regex corresponding to those types. … … 2138 2163 * Kill WordPress execution and display HTML message with error message. 2139 2164 * 2140 2165 * 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. 2142 2167 * 2143 2168 * @since 3.0.0 2144 2169 * @access private … … 2321 2346 * @since 3.2.0 2322 2347 * @access private 2323 2348 * 2349 * @global $wp_xmlrpc_server 2350 * 2324 2351 * @param string $message Error message. 2325 2352 * @param string $title Error title. 2326 2353 * @param string|array $args Optional arguments to control behavior. … … 2429 2456 * @package WordPress 2430 2457 * @since 2.2.0 2431 2458 * 2432 * @param string $url URL for the home location 2459 * @param string $url URL for the home location. 2433 2460 * @return string Homepage location. 2434 2461 */ 2435 2462 function _config_wp_home( $url = '' ) { … … 2450 2477 * @since 2.2.0 2451 2478 * 2452 2479 * @param string $url URL to set the WordPress site location. 2453 * @return string The WordPress Site URL 2480 * @return string The WordPress Site URL. 2454 2481 */ 2455 2482 function _config_wp_siteurl( $url = '' ) { 2456 2483 if ( defined( 'WP_SITEURL' ) ) … … 2601 2628 2602 2629 /** 2603 2630 * Merge user defined arguments into defaults array. 2604 *2605 2631 * This function is used throughout WordPress to allow for both string or array 2606 2632 * to be merged into another array. 2607 2633 * 2608 2634 * @since 2.2.0 2609 2635 * 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 * 2612 2639 * @return array Merged user defined values with defaults. 2613 2640 */ 2614 2641 function wp_parse_args( $args, $defaults = '' ) { … … 2629 2656 * 2630 2657 * @since 3.0.0 2631 2658 * 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. 2634 2661 */ 2635 2662 function wp_parse_id_list( $list ) { 2636 2663 if ( !is_array($list) ) … … 2644 2671 * 2645 2672 * @since 3.1.0 2646 2673 * 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. 2650 2677 */ 2651 2678 function wp_array_slice_assoc( $array, $keys ) { 2652 2679 $slice = array(); … … 2662 2689 * 2663 2690 * @since 3.0.0 2664 2691 * 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. 2671 2700 */ 2672 2701 function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) { 2673 2702 if ( ! is_array( $list ) ) … … 2686 2715 * 2687 2716 * @since 3.1.0 2688 2717 * 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. 2691 2720 * @param string $operator The logical operation to perform: 2692 2721 * 'AND' means all elements from the array must match; 2693 2722 * 'OR' means only one element needs to match; 2694 2723 * 'NOT' means no elements may match. 2695 2724 * The default is 'AND'. 2696 * @return array 2725 * @return array The filtered object list. 2697 2726 */ 2698 2727 function wp_list_filter( $list, $args = array(), $operator = 'AND' ) { 2699 2728 if ( ! is_array( $list ) ) … … 2730 2759 * 2731 2760 * @since 3.1.0 2732 2761 * 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. 2736 2765 */ 2737 2766 function wp_list_pluck( $list, $field ) { 2738 2767 foreach ( $list as $key => $value ) { … … 2805 2834 * in WordPress 2.5.0. 2806 2835 * 2807 2836 * @since 2.3.2 2808 * @ uses$wpdb2837 * @global $wpdb 2809 2838 */ 2810 2839 function dead_db() { 2811 2840 global $wpdb; … … 2843 2872 } 2844 2873 2845 2874 /** 2846 * Converts value to non negative integer.2875 * Converts value to non-negative integer. 2847 2876 * 2848 2877 * @since 2.5.0 2849 2878 * 2850 * @param mixed $maybeint Data you wish to have converted to a non negative integer2851 * @return int An non negative integer2879 * @param mixed $maybeint Data you wish to have converted to a non-negative integer. 2880 * @return int An non-negative integer. 2852 2881 */ 2853 2882 function absint( $maybeint ) { 2854 2883 return abs( intval( $maybeint ) ); … … 2862 2891 * 2863 2892 * @since 2.5.0 2864 2893 * 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. 2867 2896 */ 2868 2897 function url_is_accessable_via_ssl($url) 2869 2898 { … … 2910 2939 * @uses apply_filters() Calls 'deprecated_function_trigger_error' and expects boolean value of true to do 2911 2940 * trigger or false to not trigger error. 2912 2941 * 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. 2916 2945 */ 2917 2946 function _deprecated_function( $function, $version, $replacement = null ) { 2918 2947 … … 2955 2984 * @uses apply_filters() Calls 'deprecated_file_trigger_error' and expects boolean value of true to do 2956 2985 * trigger or false to not trigger error. 2957 2986 * 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. 2962 2991 */ 2963 2992 function _deprecated_file( $file, $version, $replacement = null, $message = '' ) { 2964 2993 … … 2988 3017 * used by comparing it to its default value or evaluating whether it is empty. 2989 3018 * For example: 2990 3019 * <code> 2991 * if ( ! empty($deprecated) )3020 * if ( ! empty( $deprecated ) ) 2992 3021 * _deprecated_argument( __FUNCTION__, '3.0' ); 2993 3022 * </code> 2994 3023 * … … 3008 3037 * @uses apply_filters() Calls 'deprecated_argument_trigger_error' and expects boolean value of true to do 3009 3038 * trigger or false to not trigger error. 3010 3039 * 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. 3013 3042 * @param string $message Optional. A message regarding the change. 3014 3043 */ 3015 3044 function _deprecated_argument( $function, $version, $message = null ) { … … 3090 3119 * 3091 3120 * @since 2.5.0 3092 3121 * 3093 * @param string $mod e.g. mod_rewrite3094 * @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. 3096 3125 */ 3097 3126 function apache_mod_loaded($mod, $default = false) { 3098 3127 global $is_apache; … … 3119 3148 * 3120 3149 * @since 2.8.0 3121 3150 * 3122 * @return bool 3151 * @return bool True if permalinks are supported, false if not supported. 3123 3152 */ 3124 3153 function iis7_supports_permalinks() { 3125 3154 global $is_iis7; … … 3143 3172 3144 3173 /** 3145 3174 * File validates against allowed set of defined rules. 3146 *3147 3175 * A return value of '1' means that the $file contains either '..' or './'. A 3148 3176 * return value of '2' means that the $file contains ':' after the first 3149 3177 * character. A return value of '3' means that the file is not in the allowed … … 3151 3179 * 3152 3180 * @since 1.2.0 3153 3181 * 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 * 3156 3185 * @return int 0 means nothing is wrong, greater than 0 means something was wrong. 3157 3186 */ 3158 3187 function validate_file( $file, $allowed_files = '' ) { … … 3238 3267 * 3239 3268 * @since 2.6.0 3240 3269 * 3241 * @return string 3270 * @return string The best-guess URL of the site. 3242 3271 */ 3243 3272 function wp_guess_url() { 3244 3273 if ( defined('WP_SITEURL') && '' != WP_SITEURL ) { … … 3292 3321 * @since 3.3.0 3293 3322 * 3294 3323 * @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. 3296 3325 */ 3297 3326 function wp_suspend_cache_addition( $suspend = null ) { 3298 3327 static $_suspend = false; … … 3312 3341 * 3313 3342 * @since 2.7.0 3314 3343 * 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. 3317 3346 */ 3318 3347 function wp_suspend_cache_invalidation($suspend = true) { 3319 3348 global $_wp_suspend_cache_invalidation; … … 3349 3378 * 3350 3379 * @since 3.7.0 3351 3380 * 3381 * @global $wpdb 3382 * 3352 3383 * @param int $network_id Optional. Network ID to test. Defaults to current network. 3353 3384 * @return bool True if $network_id is the main network, or if not running multisite. 3354 3385 */ … … 3388 3419 * @since 3.0.0 3389 3420 * @package WordPress 3390 3421 * 3391 * @return bool True if multisite and global terms enabled 3422 * @return bool True if multisite and global terms enabled. 3392 3423 */ 3393 3424 function global_terms_enabled() { 3394 3425 if ( ! is_multisite() ) … … 3412 3443 * 3413 3444 * @since 2.8.0 3414 3445 * 3415 * @return float|bool 3446 * @return float|bool Timezone offset; false if not set or if any errors. 3416 3447 */ 3417 3448 function wp_timezone_override_offset() { 3418 3449 if ( !$timezone_string = get_option( 'timezone_string' ) ) { … … 3434 3465 * 3435 3466 * @param array $a 3436 3467 * @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. 3438 3469 */ 3439 3470 function _wp_timezone_choice_usort_callback( $a, $b ) { 3440 3471 // Don't use translated versions of Etc … … 3479 3510 * 3480 3511 * @since 2.9.0 3481 3512 * 3482 * @param string $selected_zone Selected Zone 3483 * @return string 3513 * @param string $selected_zone Selected Zone. 3514 * @return string Formatted timezones. 3484 3515 */ 3485 3516 function wp_timezone_choice( $selected_zone ) { 3486 3517 static $mo_loaded = false; … … 3605 3636 3606 3637 /** 3607 3638 * Strip close comment and close php tags from file headers used by WP. 3608 * See http://core.trac.wordpress.org/ticket/84973609 3639 * 3610 3640 * @since 2.8.0 3641 * @link http://core.trac.wordpress.org/ticket/8497 3611 3642 * 3612 * @param string $str 3613 * @return string 3643 * @param string $str String to clean. 3644 * @return string The cleaned-up string. 3614 3645 */ 3615 3646 function _cleanup_header_comment($str) { 3616 3647 return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str)); … … 3620 3651 * Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS. 3621 3652 * 3622 3653 * @since 2.9.0 3654 * 3655 * @global $wpdb 3623 3656 */ 3624 3657 function wp_scheduled_delete() { 3625 3658 global $wpdb; … … 3664 3697 /** 3665 3698 * Retrieve metadata from a file. 3666 3699 * 3667 * Searches for metadata in the first 8 kiB 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. 3668 3701 * Each piece of metadata must be on its own line. Fields can not span multiple 3669 3702 * lines, the value will get cut at the end of the first line. 3670 3703 * 3671 * If the file data is not within that first 8 kiB, then the author should correct3704 * If the file data is not within that first 8KiB, then the author should correct 3672 3705 * their plugin file and move the data headers to the top. 3673 3706 * 3674 * @ seehttp://codex.wordpress.org/File_Header3707 * @link http://codex.wordpress.org/File_Header 3675 3708 * 3676 3709 * @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 3680 3719 */ 3681 3720 function get_file_data( $file, $default_headers, $context = '' ) { 3682 3721 // We don't need to write to the file, so just open for reading. 3683 3722 $fp = fopen( $file, 'r' ); 3684 3723 3685 // Pull only the first 8 kiB of the file in.3724 // Pull only the first 8KiB of the file in. 3686 3725 $file_data = fread( $fp, 8192 ); 3687 3726 3688 3727 // PHP will close file handle, but we are good citizens. … … 3715 3754 * 3716 3755 * @since 3.0.0 3717 3756 * @see __return_false() 3757 * 3718 3758 * @return bool true 3719 3759 */ 3720 3760 function __return_true() { … … 3728 3768 * 3729 3769 * @since 3.0.0 3730 3770 * @see __return_true() 3771 * 3731 3772 * @return bool false 3732 3773 */ 3733 3774 function __return_false() { … … 3740 3781 * Useful for returning 0 to filters easily. 3741 3782 * 3742 3783 * @since 3.0.0 3784 * 3743 3785 * @return int 0 3744 3786 */ 3745 3787 function __return_zero() { … … 3752 3794 * Useful for returning an empty array to filters easily. 3753 3795 * 3754 3796 * @since 3.0.0 3755 * @return array Empty array 3797 * 3798 * @return array Empty array. 3756 3799 */ 3757 3800 function __return_empty_array() { 3758 3801 return array(); … … 3764 3807 * Useful for returning null to filters easily. 3765 3808 * 3766 3809 * @since 3.4.0 3810 * 3767 3811 * @return null 3768 3812 */ 3769 3813 function __return_null() { … … 3777 3821 * 3778 3822 * @since 3.7.0 3779 3823 * @see __return_null() 3824 * 3780 3825 * @return string Empty string 3781 3826 */ 3782 3827 function __return_empty_string() { … … 3790 3835 * @link http://src.chromium.org/viewvc/chrome?view=rev&revision=6985 3791 3836 * 3792 3837 * @since 3.0.0 3793 * @return none3794 3838 */ 3795 3839 function send_nosniff_header() { 3796 3840 @header( 'X-Content-Type-Options: nosniff' ); … … 3801 3845 * 3802 3846 * @internal 3803 3847 * @since 3.0.0 3848 * 3804 3849 * @param string $column 3805 3850 * @return string 3806 3851 */ … … 3823 3868 /** 3824 3869 * Finds hierarchy loops using a callback function that maps object IDs to parent IDs. 3825 3870 * 3871 * @access private 3826 3872 * @since 3.1.0 3827 * @access private3828 3873 * 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. 3834 3880 */ 3835 3881 function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) { 3836 3882 $override = is_null( $start_parent ) ? array() : array( $start => $start_parent ); … … 3847 3893 * For every step of the algorithm, the hare takes two steps and the tortoise one. 3848 3894 * If the hare ever laps the tortoise, there must be a loop. 3849 3895 * 3896 * @access private 3850 3897 * @since 3.1.0 3851 * @access private3852 3898 * 3853 * @param callback $callback function that accepts ( ID, callback_arg, ... ) and outputs parent_ID3854 * @param int $start The ID to start the loop check at3855 * @param array $override an array of ( ID => parent_ID, ... ) to use instead of $callback3856 * @param array $callback_args optional additional arguments to send to $callback3899 * @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. 3857 3903 * @param bool $_return_loop Return loop members or just detect presence of loop? 3858 3904 * 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_loop3905 * (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. 3861 3907 */ 3862 3908 function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) { 3863 3909 $tortoise = $hare = $evanescent_hare = $start; … … 3892 3938 * @link https://developer.mozilla.org/en/the_x-frame-options_response_header 3893 3939 * 3894 3940 * @since 3.1.3 3895 * @return none3896 3941 */ 3897 3942 function send_frame_options_header() { 3898 3943 @header( 'X-Frame-Options: SAMEORIGIN' ); … … 3924 3969 * @link http://core.trac.wordpress.org/ticket/19589 3925 3970 * @since 3.4.0 3926 3971 * 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. 3930 3976 * @return string|array Either a string containing a reversed comma separated trace or an array of individual calls. 3931 3977 */ 3932 3978 function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) { … … 3964 4010 } 3965 4011 3966 4012 /** 3967 * Retrieve ids that are not already present in the cache4013 * Retrieve IDs that are not already present in the cache. 3968 4014 * 3969 4015 * @since 3.4.0 3970 4016 * 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. 3973 4019 * 3974 * @return array 4020 * @return array Cleaned up array of IDs. 3975 4021 */ 3976 4022 function _get_non_cached_ids( $object_ids, $cache_key ) { 3977 4023 $clean = array(); … … 3988 4034 /** 3989 4035 * Test if the current device has the capability to upload files. 3990 4036 * 4037 * @access private 3991 4038 * @since 3.4.0 3992 * @access private3993 4039 * 3994 * @return bool true|false4040 * @return bool True if the device allows uploads; false if not. 3995 4041 */ 3996 4042 function _device_can_upload() { 3997 4043 if ( ! wp_is_mobile() ) … … 4009 4055 } 4010 4056 4011 4057 /** 4012 * Test if a given path is a stream URL 4058 * Test if a given path is a stream URL. 4013 4059 * 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. 4016 4062 */ 4017 4063 function wp_is_stream( $path ) { 4018 4064 $wrappers = stream_get_wrappers(); … … 4022 4068 } 4023 4069 4024 4070 /** 4025 * Test if the supplied date is valid for the Gregorian calendar 4071 * Test if the supplied date is valid for the Gregorian calendar. 4026 4072 * 4027 4073 * @since 3.5.0 4074 * @see checkdate() 4028 4075 * 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. 4030 4082 */ 4031 4083 function wp_checkdate( $month, $day, $year, $source_date ) { 4032 4084 return apply_filters( 'wp_checkdate', checkdate( $month, $day, $year ), $source_date ); … … 4035 4087 /** 4036 4088 * Load the auth check for monitoring whether the user is still logged in. 4037 4089 * 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' );`. 4039 4091 * 4040 4092 * This is disabled for certain screens where a login screen could cause an 4041 4093 * inconvenient interruption. A filter called wp_auth_check_load can be used … … 4106 4158 4107 4159 /** 4108 4160 * Check whether a user is still logged in, for the heartbeat. 4109 *4110 4161 * Send a result that shows a log-in box if the user is no longer logged in, 4111 4162 * or if their cookie is within the grace period. 4112 4163 * 4113 4164 * @since 3.6.0 4165 * 4166 * @param array $response 4167 * @param $data 4168 * 4169 * @return array 4114 4170 */ 4115 4171 function wp_auth_check( $response ) { 4116 4172 $response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] ); … … 4123 4179 * 2. Has no body but has a closing tag of the same name or 4124 4180 * 3. Contains a body and a closing tag of the same name 4125 4181 * 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. 4127 4183 * 4128 4184 * @since 3.6.0 4129 4185 * 4130 * @param string $tag An HTML tag name. Example: 'video' 4186 * @param string $tag An HTML tag name. Example: 'video'. 4131 4187 * @return string 4132 4188 */ 4133 4189 function get_tag_regex( $tag ) { … … 4143 4199 * @link http://core.trac.wordpress.org/ticket/23688 4144 4200 * @since 3.6.0 4145 4201 * 4146 * @param string A charset name4147 * @return string The canonical form of the charset 4202 * @param string $charset A charset name. 4203 * @return string The canonical form of the charset. 4148 4204 */ 4149 4205 function _canonical_charset( $charset ) { 4150 4206 if ( 'UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||