Changeset 29011
- Timestamp:
- 07/07/2014 06:18:05 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r28937 r29011 675 675 * 676 676 * @since 3.2.0 677 * 678 * @link http://us1.php.net/manual/en/function.http-build-query.php 677 * @access private 678 * 679 * @see http://us1.php.net/manual/en/function.http-build-query.php 679 680 * 680 681 * @param array|object $data An array or object of data. Converted to array. … … 3146 3147 3147 3148 /** 3148 * Convert s value to nonnegative integer.3149 * Convert a value to non-negative integer. 3149 3150 * 3150 3151 * @since 2.5.0 3151 3152 * 3152 * @param mixed $maybeint Data you wish to have converted to a non negative integer3153 * @return int A n nonnegative integer3153 * @param mixed $maybeint Data you wish to have converted to a non-negative integer. 3154 * @return int A non-negative integer. 3154 3155 */ 3155 3156 function absint( $maybeint ) { … … 3158 3159 3159 3160 /** 3160 * Mark sa function as deprecated and informs when it has been used.3161 * Mark a function as deprecated and informs when it has been used. 3161 3162 * 3162 3163 * There is a hook deprecated_function_run that will be called that can be used … … 3171 3172 * @access private 3172 3173 * 3173 * @param string $function The function that was called3174 * @param string $version The version of WordPress that deprecated the function3175 * @param string $replacement Optional. The function that should have been called 3174 * @param string $function The function that was called. 3175 * @param string $version The version of WordPress that deprecated the function. 3176 * @param string $replacement Optional. The function that should have been called. Default null. 3176 3177 */ 3177 3178 function _deprecated_function( $function, $version, $replacement = null ) { … … 3211 3212 3212 3213 /** 3213 * Marks a file as deprecated and inform swhen it has been used.3214 * Marks a file as deprecated and inform when it has been used. 3214 3215 * 3215 3216 * There is a hook deprecated_file_included that will be called that can be used … … 3224 3225 * @access private 3225 3226 * 3226 * @param string $file The file that was included 3227 * @param string $version The version of WordPress that deprecated the file 3228 * @param string $replacement Optional. The file that should have been included based on ABSPATH 3229 * @param string $message Optional. A message regarding the change 3227 * @param string $file The file that was included. 3228 * @param string $version The version of WordPress that deprecated the file. 3229 * @param string $replacement Optional. The file that should have been included based on ABSPATH. 3230 * Default null. 3231 * @param string $message Optional. A message regarding the change. Default empty. 3230 3232 */ 3231 3233 function _deprecated_file( $file, $version, $replacement = null, $message = '' ) { … … 3266 3268 } 3267 3269 /** 3268 * Mark s a function argument as deprecated and informswhen it has been used.3270 * Mark a function argument as deprecated and inform when it has been used. 3269 3271 * 3270 3272 * This function is to be used whenever a deprecated function argument is used. … … 3286 3288 * @access private 3287 3289 * 3288 * @param string $function The function that was called 3289 * @param string $version The version of WordPress that deprecated the argument used3290 * @param string $message Optional. A message regarding the change.3290 * @param string $function The function that was called. 3291 * @param string $version The version of WordPress that deprecated the argument used. 3292 * @param string $message Optional. A message regarding the change. Default null. 3291 3293 */ 3292 3294 function _deprecated_argument( $function, $version, $message = null ) { … … 3326 3328 3327 3329 /** 3328 * Mark ssomething as being incorrectly called.3330 * Mark something as being incorrectly called. 3329 3331 * 3330 3332 * There is a hook doing_it_wrong_run that will be called that can be used … … 3338 3340 * 3339 3341 * @param string $function The function that was called. 3340 * @param string $message A message explaining what has been done incorrectly.3341 * @param string $version The version of WordPress where the message was added.3342 * @param string $message A message explaining what has been done incorrectly. 3343 * @param string $version The version of WordPress where the message was added. 3342 3344 */ 3343 3345 function _doing_it_wrong( $function, $message, $version ) { … … 3379 3381 * @since 2.5.0 3380 3382 * 3381 * @return bool Whether the server is running lighttpd < 1.5.0 3383 * @return bool Whether the server is running lighttpd < 1.5.0. 3382 3384 */ 3383 3385 function is_lighttpd_before_150() { … … 3392 3394 * @since 2.5.0 3393 3395 * 3394 * @param string $mod e.g. mod_rewrite3395 * @param bool $default The default return value if the module is not found3396 * @return bool 3396 * @param string $mod The module, e.g. mod_rewrite. 3397 * @param bool $default Optional. The default return value if the module is not found. Default false. 3398 * @return bool Whether the specified module is loaded. 3397 3399 */ 3398 3400 function apache_mod_loaded($mod, $default = false) { … … 3421 3423 * @since 2.8.0 3422 3424 * 3423 * @return bool 3425 * @return bool Whether IIS7 supports permalinks. 3424 3426 */ 3425 3427 function iis7_supports_permalinks() { … … 3505 3507 * 3506 3508 * @param string $url The URL 3507 * @return bool eanTrue if the given URL uses https, false if not (or if the URL is not valid).3509 * @return bool True if the given URL uses https, false if not (or if the URL is not valid). 3508 3510 */ 3509 3511 function is_https_url( $url ) { … … 3516 3518 * @since 2.6.0 3517 3519 * 3518 * @param string|bool $force Optional. 3520 * @see force_ssl_admin() 3521 * 3522 * @param string|bool $force Optional Whether to force SSL login. Default null. 3519 3523 * @return bool True if forced, false if not forced. 3520 3524 */ … … 3528 3532 * @since 2.6.0 3529 3533 * 3530 * @param string|bool $force 3534 * @param string|bool $force Optional. Whether to force SSL in admin screens. Default null. 3531 3535 * @return bool True if forced, false if not forced. 3532 3536 */ … … 3551 3555 * @since 2.6.0 3552 3556 * 3553 * @return string 3557 * @return string The guessed URL. 3554 3558 */ 3555 3559 function wp_guess_url() { … … 3619 3623 * Suspend cache invalidation. 3620 3624 * 3621 * Turns cache invalidation on and off. Useful during imports where you don't wont to do invalidations3622 * every time a post is inserted. Callers must be sure that what they are doing won't lead to an inconsistent3623 * cache when invalidation is suspended.3625 * Turns cache invalidation on and off. Useful during imports where you don't wont to do 3626 * invalidations every time a post is inserted. Callers must be sure that what they are 3627 * doing won't lead to an inconsistent cache when invalidation is suspended. 3624 3628 * 3625 3629 * @since 2.7.0 3626 3630 * 3627 * @param bool $suspend Whether to suspend or enable cache invalidation3628 * @return bool The current suspend setting 3629 */ 3630 function wp_suspend_cache_invalidation( $suspend = true) {3631 * @param bool $suspend Optional. Whether to suspend or enable cache invalidation. Default true. 3632 * @return bool The current suspend setting. 3633 */ 3634 function wp_suspend_cache_invalidation( $suspend = true ) { 3631 3635 global $_wp_suspend_cache_invalidation; 3632 3636 … … 3637 3641 3638 3642 /** 3639 * Whether a site is the main site of the current network.3643 * Determine whether a site is the main site of the current network. 3640 3644 * 3641 3645 * @since 3.0.0 3642 3646 * 3643 3647 * @param int $site_id Optional. Site ID to test. Defaults to current site. 3644 * @return bool True if $site_id is the main site of the network, or if not running multisite. 3648 * Defaults to current site. 3649 * @return bool True if $site_id is the main site of the network, or if not 3650 * running Multisite. 3645 3651 */ 3646 3652 function is_main_site( $site_id = null ) { … … 3658 3664 3659 3665 /** 3660 * Whether a network is the main network of the multisite install.3666 * Determine whether a network is the main network of the Multisite install. 3661 3667 * 3662 3668 * @since 3.7.0 3663 3669 * 3664 3670 * @param int $network_id Optional. Network ID to test. Defaults to current network. 3665 * @return bool True if $network_id is the main network, or if not running multisite.3671 * @return bool True if $network_id is the main network, or if not running Multisite. 3666 3672 */ 3667 3673 function is_main_network( $network_id = null ) { … … 3695 3701 3696 3702 /** 3697 * Whether global terms are enabled. 3698 * 3703 * Determine whether global terms are enabled. 3699 3704 * 3700 3705 * @since 3.0.0 3701 3706 * 3702 * @return bool True if multisite and global terms enabled 3707 * @return bool True if multisite and global terms enabled. 3703 3708 */ 3704 3709 function global_terms_enabled() { … … 3735 3740 * @since 2.8.0 3736 3741 * 3737 * @return float|bool 3742 * @return float|bool Timezone GMT offset, false otherwise. 3738 3743 */ 3739 3744 function wp_timezone_override_offset() { … … 3754 3759 * 3755 3760 * @since 2.9.0 3761 * @access private 3756 3762 * 3757 3763 * @param array $a … … 3798 3804 3799 3805 /** 3800 * Gives a nicely 3806 * Gives a nicely-formatted list of timezone strings. 3801 3807 * 3802 3808 * @since 2.9.0 3803 3809 * 3804 * @param string $selected_zone Selected Zone3810 * @param string $selected_zone Selected timezone. 3805 3811 * @return string 3806 3812 */ … … 3928 3934 /** 3929 3935 * Strip close comment and close php tags from file headers used by WP. 3930 * See http://core.trac.wordpress.org/ticket/84973931 3936 * 3932 3937 * @since 2.8.0 3933 * 3934 * @param string $str 3938 * @access private 3939 * 3940 * @see http://core.trac.wordpress.org/ticket/8497 3941 * 3942 * @param string $str Header comment to clean up. 3935 3943 * @return string 3936 3944 */ 3937 function _cleanup_header_comment( $str) {3945 function _cleanup_header_comment( $str ) { 3938 3946 return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str)); 3939 3947 } 3940 3948 3941 3949 /** 3942 * Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS. 3950 * Permanently delete posts, pages, attachments, and comments which have been 3951 * in the trash for EMPTY_TRASH_DAYS. 3943 3952 * 3944 3953 * @since 2.9.0 … … 3997 4006 * 3998 4007 * @since 2.9.0 3999 * @param string $file Path to the file 4000 * @param array $default_headers List of headers, in the format array('HeaderKey' => 'Header Name') 4001 * @param string $context If specified adds filter hook "extra_{$context}_headers" 4008 * @param string $file Path to the file. 4009 * @param array $default_headers List of headers, in the format array('HeaderKey' => 'Header Name'). 4010 * @param string $context Optional. If specified adds filter hook "extra_{$context}_headers". 4011 * Default empty. 4002 4012 */ 4003 4013 function get_file_data( $file, $default_headers, $context = '' ) { … … 4047 4057 * 4048 4058 * @since 3.0.0 4059 * 4049 4060 * @see __return_false() 4050 * @return bool true 4061 * 4062 * @return bool True. 4051 4063 */ 4052 4064 function __return_true() { … … 4060 4072 * 4061 4073 * @since 3.0.0 4074 * 4062 4075 * @see __return_true() 4063 * @return bool false 4076 * 4077 * @return bool False. 4064 4078 */ 4065 4079 function __return_false() { … … 4073 4087 * 4074 4088 * @since 3.0.0 4075 * @return int 0 4089 * 4090 * @return int 0. 4076 4091 */ 4077 4092 function __return_zero() { … … 4085 4100 * 4086 4101 * @since 3.0.0 4087 * @return array Empty array 4102 * 4103 * @return array Empty array. 4088 4104 */ 4089 4105 function __return_empty_array() { … … 4097 4113 * 4098 4114 * @since 3.4.0 4099 * @return null 4115 * 4116 * @return null Null value. 4100 4117 */ 4101 4118 function __return_null() { … … 4109 4126 * 4110 4127 * @since 3.7.0 4128 * 4111 4129 * @see __return_null() 4112 * @return string Empty string 4130 * 4131 * @return string Empty string. 4113 4132 */ 4114 4133 function __return_empty_string() { … … 4119 4138 * Send a HTTP header to disable content type sniffing in browsers which support it. 4120 4139 * 4121 * @link http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx4122 * @link http://src.chromium.org/viewvc/chrome?view=rev&revision=69854123 *4124 4140 * @since 3.0.0 4125 * @return none 4141 * 4142 * @see http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx 4143 * @see http://src.chromium.org/viewvc/chrome?view=rev&revision=6985 4126 4144 */ 4127 4145 function send_nosniff_header() { … … 4130 4148 4131 4149 /** 4132 * Return sa MySQL expression for selecting the week number based on the start_of_week option.4150 * Return a MySQL expression for selecting the week number based on the start_of_week option. 4133 4151 * 4134 4152 * @internal 4135 4153 * @since 3.0.0 4136 * @param string $column 4137 * @return string 4154 * 4155 * @param string $column Database column. 4156 * @return string SQL clause. 4138 4157 */ 4139 4158 function _wp_mysql_week( $column ) { … … 4154 4173 4155 4174 /** 4156 * Find shierarchy loops using a callback function that maps object IDs to parent IDs.4175 * Find hierarchy loops using a callback function that maps object IDs to parent IDs. 4157 4176 * 4158 4177 * @since 3.1.0 4159 4178 * @access private 4160 4179 * 4161 * @param callback $callback function that accepts ( ID, $callback_args ) and outputs parent_ID 4162 * @param int $start The ID to start the loop check at 4163 * @param int $start_parent the parent_ID of $start to use instead of calling $callback( $start ). Use null to always use $callback 4164 * @param array $callback_args optional additional arguments to send to $callback 4165 * @return array IDs of all members of loop 4180 * @param callback $callback Function that accepts ( ID, $callback_args ) and outputs parent_ID. 4181 * @param int $start The ID to start the loop check at. 4182 * @param int $start_parent The parent_ID of $start to use instead of calling $callback( $start ). 4183 * Use null to always use $callback 4184 * @param array $callback_args Optional. Additional arguments to send to $callback. 4185 * @return array IDs of all members of loop. 4166 4186 */ 4167 4187 function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) { … … 4175 4195 4176 4196 /** 4177 * Use sthe "The Tortoise and the Hare" algorithm to detect loops.4197 * Use the "The Tortoise and the Hare" algorithm to detect loops. 4178 4198 * 4179 4199 * For every step of the algorithm, the hare takes two steps and the tortoise one. … … 4183 4203 * @access private 4184 4204 * 4185 * @param callback $callback function that accepts ( ID, callback_arg, ... ) and outputs parent_ID 4186 * @param int $start The ID to start the loop check at 4187 * @param array $override an array of ( ID => parent_ID, ... ) to use instead of $callback 4188 * @param array $callback_args optional additional arguments to send to $callback 4189 * @param bool $_return_loop Return loop members or just detect presence of loop? 4190 * Only set to true if you already know the given $start is part of a loop 4191 * (otherwise the returned array might include branches) 4192 * @return mixed scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if $_return_loop 4205 * @param callback $callback Function that accepts ( ID, callback_arg, ... ) and outputs parent_ID. 4206 * @param int $start The ID to start the loop check at. 4207 * @param array $override Optional. An array of ( ID => parent_ID, ... ) to use instead of $callback. 4208 * Default empty array. 4209 * @param array $callback_args Optional. Additional arguments to send to $callback. Default empty array. 4210 * @param bool $_return_loop Optional. Return loop members or just detect presence of loop? Only set 4211 * to true if you already know the given $start is part of a loop (otherwise 4212 * the returned array might include branches). Default false. 4213 * @return mixed Scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if 4214 * $_return_loop 4193 4215 */ 4194 4216 function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) { … … 4222 4244 * Send a HTTP header to limit rendering of pages to same origin iframes. 4223 4245 * 4224 * @link https://developer.mozilla.org/en/the_x-frame-options_response_header4225 *4226 4246 * @since 3.1.3 4227 * @return none 4247 * 4248 * @see https://developer.mozilla.org/en/the_x-frame-options_response_header 4228 4249 */ 4229 4250 function send_frame_options_header() { … … 4235 4256 * 4236 4257 * @since 3.3.0 4258 * 4237 4259 * @see wp_kses() 4238 4260 * @see esc_url() 4239 4261 * 4240 * @return array Array of allowed protocols 4262 * @return array Array of allowed protocols. 4241 4263 */ 4242 4264 function wp_allowed_protocols() { … … 4260 4282 4261 4283 /** 4262 * Return a comma separated string of functions that have been called to get to the current point in code.4263 * 4264 * @link http://core.trac.wordpress.org/ticket/195894284 * Return a comma-separated string of functions that have been called to get 4285 * to the current point in code. 4286 * 4265 4287 * @since 3.4.0 4266 4288 * 4267 * @param string $ignore_class A class to ignore all function calls within - useful when you want to just give info about the callee 4268 * @param int $skip_frames A number of stack frames to skip - useful for unwinding back to the source of the issue 4269 * @param bool $pretty Whether or not you want a comma separated string or raw array returned 4270 * @return string|array Either a string containing a reversed comma separated trace or an array of individual calls. 4289 * @see http://core.trac.wordpress.org/ticket/19589 4290 * 4291 * @param string $ignore_class Optional. A class to ignore all function calls within - useful 4292 * when you want to just give info about the callee. Default null. 4293 * @param int $skip_frames Optional. A number of stack frames to skip - useful for unwinding 4294 * back to the source of the issue. Default 0. 4295 * @param bool $pretty Optional. Whether or not you want a comma separated string or raw 4296 * array returned. Default true. 4297 * @return string|array Either a string containing a reversed comma separated trace or an array 4298 * of individual calls. 4271 4299 */ 4272 4300 function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) { … … 4305 4333 4306 4334 /** 4307 * Retrieve ids that are not already present in the cache 4335 * Retrieve ids that are not already present in the cache. 4308 4336 * 4309 4337 * @since 3.4.0 4310 * 4311 * @param array $object_ids ID list 4312 * @param string $cache_key The cache bucket to check against 4313 * 4314 * @return array 4338 * @access private 4339 * 4340 * @param array $object_ids ID list. 4341 * @param string $cache_key The cache bucket to check against. 4342 * 4343 * @return array List of ids not present in the cache. 4315 4344 */ 4316 4345 function _get_non_cached_ids( $object_ids, $cache_key ) { … … 4332 4361 * @access private 4333 4362 * 4334 * @return bool true|false 4363 * @return bool true|false Whether the device is able to upload files. 4335 4364 */ 4336 4365 function _device_can_upload() { … … 4352 4381 * Test if a given path is a stream URL 4353 4382 * 4354 * @param string $path The resource path or URL 4355 * @return bool True if the path is a stream URL 4383 * @param string $path The resource path or URL. 4384 * @return bool True if the path is a stream URL. 4356 4385 */ 4357 4386 function wp_is_stream( $path ) { … … 4373 4402 * @param int $year Year number. 4374 4403 * @param string $source_date The date to filter. 4375 * @return bool 4404 * @return bool True if valid date, false if not valid date. 4376 4405 */ 4377 4406 function wp_checkdate( $month, $day, $year, $source_date ) { … … 4411 4440 /** 4412 4441 * Filter whether to load the authentication check. 4442 * 4443 * Passing a falsey value to the filter will effectively short-circuit 4444 * loading the authentication check. 4413 4445 * 4414 4446 * @since 3.6.0 … … 4488 4520 4489 4521 /** 4490 * Return RegEx body to liberally match an opening HTML tag that: 4522 * Return RegEx body to liberally match an opening HTML tag. 4523 * 4524 * Matches an opening HTML tag that: 4491 4525 * 1. Is self-closing or 4492 4526 * 2. Has no body but has a closing tag of the same name or 4493 4527 * 3. Contains a body and a closing tag of the same name 4494 4528 * 4495 * Note: this RegEx does not balance inner tags and does not attempt to produce valid HTML 4529 * Note: this RegEx does not balance inner tags and does not attempt 4530 * to produce valid HTML 4496 4531 * 4497 4532 * @since 3.6.0 4498 4533 * 4499 * @param string $tag An HTML tag name. Example: 'video' 4500 * @return string 4534 * @param string $tag An HTML tag name. Example: 'video'. 4535 * @return string Tag RegEx. 4501 4536 */ 4502 4537 function get_tag_regex( $tag ) { … … 4507 4542 4508 4543 /** 4509 * Ret urna canonical form of the provided charset appropriate for passing to PHP4544 * Retrieve a canonical form of the provided charset appropriate for passing to PHP 4510 4545 * functions such as htmlspecialchars() and charset html attributes. 4511 4546 * 4512 * @link http://core.trac.wordpress.org/ticket/236884513 4547 * @since 3.6.0 4514 * 4515 * @param string A charset name 4516 * @return string The canonical form of the charset 4548 * @access private 4549 * 4550 * @see http://core.trac.wordpress.org/ticket/23688 4551 * 4552 * @param string $charset A charset name. 4553 * @return string The canonical form of the charset. 4517 4554 */ 4518 4555 function _canonical_charset( $charset ) { … … 4529 4566 4530 4567 /** 4531 * Sets the mbstring internal encoding to a binary safe encoding when func_overload is enabled. 4532 * 4533 * When mbstring.func_overload is in use for multi-byte encodings, the results from strlen() and 4534 * similar functions respect the utf8 characters, causing binary data to return incorrect lengths. 4535 * 4536 * This function overrides the mbstring encoding to a binary-safe encoding, and resets it to the 4537 * users expected encoding afterwards through the `reset_mbstring_encoding` function. 4538 * 4539 * It is safe to recursively call this function, however each `mbstring_binary_safe_encoding()` 4540 * call must be followed up with an equal number of `reset_mbstring_encoding()` calls. 4568 * Set the mbstring internal encoding to a binary safe encoding when func_overload 4569 * is enabled. 4570 * 4571 * When mbstring.func_overload is in use for multi-byte encodings, the results from 4572 * strlen() and similar functions respect the utf8 characters, causing binary data 4573 * to return incorrect lengths. 4574 * 4575 * This function overrides the mbstring encoding to a binary-safe encoding, and 4576 * resets it to the users expected encoding afterwards through the 4577 * `reset_mbstring_encoding` function. 4578 * 4579 * It is safe to recursively call this function, however each 4580 * `mbstring_binary_safe_encoding()` call must be followed up with an equal number 4581 * of `reset_mbstring_encoding()` calls. 4582 * 4583 * @since 3.7.0 4541 4584 * 4542 4585 * @see reset_mbstring_encoding() 4543 4586 * 4544 * @since 3.7.0 4545 * 4546 * @param bool $reset Whether to reset the encoding back to a previously-set encoding. 4587 * @param bool $reset Optional. Whether to reset the encoding back to a previously-set encoding. 4588 * Default false. 4547 4589 */ 4548 4590 function mbstring_binary_safe_encoding( $reset = false ) { … … 4569 4611 4570 4612 /** 4571 * Reset sthe mbstring internal encoding to a users previously set encoding.4613 * Reset the mbstring internal encoding to a users previously set encoding. 4572 4614 * 4573 4615 * @see mbstring_binary_safe_encoding() … … 4580 4622 4581 4623 /** 4582 * Alternative to filter_var( $var, FILTER_VALIDATE_BOOLEAN ) 4624 * Alternative to filter_var( $var, FILTER_VALIDATE_BOOLEAN ). 4583 4625 * 4584 4626 * @since 4.0.0 4585 4627 * 4586 * @param mixed $var 4587 * @return bool ean4628 * @param mixed $var Boolean value to validate. 4629 * @return bool Whether the value is validated. 4588 4630 */ 4589 4631 function wp_validate_boolean( $var ) {
Note: See TracChangeset
for help on using the changeset viewer.