Changeset 28918
- Timestamp:
- 06/30/2014 03:55:03 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r28917 r28918 9 9 10 10 /** 11 * Convert sgiven date string into a different format.11 * Convert given date string into a different format. 12 12 * 13 13 * $format should be either a PHP date format string, e.g. 'U' for a Unix … … 19 19 * @since 0.71 20 20 * 21 * @param string $format Format of the date to return.22 * @param string $date Date string to convert.23 * @param bool $translate Whether the return date should be translated. Default istrue.21 * @param string $format Format of the date to return. 22 * @param string $date Date string to convert. 23 * @param bool $translate Whether the return date should be translated. Default true. 24 24 * @return string|int Formatted date string, or Unix timestamp. 25 25 */ … … 54 54 * @since 1.0.0 55 55 * 56 * @param string $type 'mysql', 'timestamp', or PHP date format string (e.g. 'Y-m-d'). 57 * @param int|bool $gmt Optional. Whether to use GMT timezone. Default is false. 56 * @param string $type Type of time to retrieve. Accepts 'mysql', 'timestamp', or PHP date 57 * format string (e.g. 'Y-m-d'). 58 * @param int|bool $gmt Optional. Whether to use GMT timezone. Default false. 58 59 * @return int|string Integer if $type is 'timestamp', string otherwise. 59 60 */ … … 98 99 } 99 100 100 // store original value for language with untypical grammars 101 // see http://core.trac.wordpress.org/ticket/9396 101 /* 102 * Store original value for language with untypical grammars. 103 * See http://core.trac.wordpress.org/ticket/9396 104 */ 102 105 $req_format = $dateformatstring; 103 106 … … 159 162 * @since 2.3.0 160 163 * 161 * @param int $number The number to convert based on locale.162 * @param int $decimals Precision of the number of decimal places.164 * @param int $number The number to convert based on locale. 165 * @param int $decimals Optional. Precision of the number of decimal places. Default 0. 163 166 * @return string Converted number in string format. 164 167 */ … … 190 193 * 191 194 * Technically the correct unit names for powers of 1024 are KiB, MiB etc. 192 * @link http://en.wikipedia.org/wiki/Byte193 195 * 194 196 * @since 2.3.0 195 197 * 196 * @param int|string $bytes Number of bytes. Note max integer size for integers.197 * @param int $decimals Precision of number of decimal places. Deprecated.198 * @param int|string $bytes Number of bytes. Note max integer size for integers. 199 * @param int $decimals Optional. Precision of number of decimal places. Default 0. 198 200 * @return bool|string False on failure. Number string on success. 199 201 */ … … 224 226 */ 225 227 function get_weekstartend( $mysqlstring, $start_of_week = '' ) { 226 $my = substr( $mysqlstring, 0, 4 ); // Mysql string Year 227 $mm = substr( $mysqlstring, 8, 2 ); // Mysql string Month 228 $md = substr( $mysqlstring, 5, 2 ); // Mysql string day 229 $day = mktime( 0, 0, 0, $md, $mm, $my ); // The timestamp for mysqlstring day. 230 $weekday = date( 'w', $day ); // The day of the week from the timestamp 228 // Mysql string year. 229 $my = substr( $mysqlstring, 0, 4 ); 230 231 // Mysql string month. 232 $mm = substr( $mysqlstring, 8, 2 ); 233 234 // Mysql string day. 235 $md = substr( $mysqlstring, 5, 2 ); 236 237 // The timestamp for mysqlstring day. 238 $day = mktime( 0, 0, 0, $md, $mm, $my ); 239 240 // The day of the week from the timestamp. 241 $weekday = date( 'w', $day ); 242 231 243 if ( !is_numeric($start_of_week) ) 232 244 $start_of_week = get_option( 'start_of_week' ); … … 235 247 $weekday += 7; 236 248 237 $start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week ); // The most recent week start day on or before $day 238 $end = $start + 7 * DAY_IN_SECONDS - 1; // $start + 7 days - 1 second 249 // The most recent week start day on or before $day. 250 $start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week ); 251 252 // $start + 7 days - 1 second. 253 $end = $start + 7 * DAY_IN_SECONDS - 1; 239 254 return compact( 'start', 'end' ); 240 255 } … … 262 277 * @since 2.0.5 263 278 * 264 * @param mixed $dataValue to check to see if was serialized.265 * @param bool $strict Optional. Whether to be strict about the end of the string. Defaultstrue.279 * @param string $data Value to check to see if was serialized. 280 * @param bool $strict Optional. Whether to be strict about the end of the string. Default true. 266 281 * @return bool False if not serialized and true if it was. 267 282 */ 268 283 function is_serialized( $data, $strict = true ) { 269 // if it isn't a string, it isn't serialized 284 // if it isn't a string, it isn't serialized. 270 285 if ( ! is_string( $data ) ) { 271 286 return false; … … 326 341 * @since 2.0.5 327 342 * 328 * @param mixed $data Serialized data343 * @param string $data Serialized data. 329 344 * @return bool False if not a serialized string, true if it is. 330 345 */ 331 346 function is_serialized_string( $data ) { 332 // if it isn't a string, it isn't a serialized string 347 // if it isn't a string, it isn't a serialized string. 333 348 if ( ! is_string( $data ) ) { 334 349 return false; … … 355 370 * @since 2.0.5 356 371 * 357 * @param mixed$data Data that might be serialized.372 * @param string|array|object $data Data that might be serialized. 358 373 * @return mixed A scalar data 359 374 */ … … 378 393 * @since 0.71 379 394 * 380 * @global string $post_default_title Default XML RPC post title.395 * @global string $post_default_title Default XML-RPC post title. 381 396 * 382 397 * @param string $content XMLRPC XML Request content … … 402 417 * @since 0.71 403 418 * 404 * @global string $post_default_category Default XML RPC post category.419 * @global string $post_default_category Default XML-RPC post category. 405 420 * 406 421 * @param string $content XMLRPC XML Request content … … 423 438 * @since 0.71 424 439 * 425 * @param string $content XML RPC XML Request content440 * @param string $content XML-RPC XML Request content. 426 441 * @return string XMLRPC XML Request content without title and category elements. 427 442 */ … … 434 449 435 450 /** 436 * Use RegEx to extract URLs from arbitrary content 451 * Use RegEx to extract URLs from arbitrary content. 437 452 * 438 453 * @since 3.7.0 439 454 * 440 * @param string $content 441 * @return array URLs found in passed string 455 * @param string $content Content to extract URLs from. 456 * @return array URLs found in passed string. 442 457 */ 443 458 function wp_extract_urls( $content ) { … … 473 488 * @since 1.5.0 474 489 * 475 * @ uses$wpdb476 * 477 * @param string $content Post Content 478 * @param int $post_ID Post ID 490 * @see $wpdb 491 * 492 * @param string $content Post Content. 493 * @param int $post_ID Post ID. 479 494 */ 480 495 function do_enclose( $content, $post_ID ) { … … 549 564 * @since 2.5.0 550 565 * 551 * @param string $url URL to fetch. 552 * @param string|bool $file_path Optional. File path to write request to. 553 * @param int $red (private) The number of Redirects followed, Upon 5 being hit, returns false. 566 * @param string $url URL to fetch. 567 * @param string|bool $file_path Optional. File path to write request to. Default false. 568 * @param int $red Optional. The number of Redirects followed, Upon 5 being hit, 569 * returns false. Default 1. 554 570 * @return bool|string False on failure and string of headers if HEAD request. 555 571 */ … … 601 617 * @since 1.5.1 602 618 * 603 * @param string $url 604 * @param bool $deprecated Not Used.619 * @param string $url URL to retrieve HTTP headers from. 620 * @param bool $deprecated Not Used. 605 621 * @return bool|string False on failure, headers on success. 606 622 */ … … 622 638 * 623 639 * @since 0.71 640 * 624 641 * @global string $currentday The day of the current post in the loop. 625 642 * @global string $previousday The day of the previous post in the loop.
Note: See TracChangeset
for help on using the changeset viewer.