Make WordPress Core

Changeset 28918


Ignore:
Timestamp:
06/30/2014 03:55:03 AM (11 years ago)
Author:
DrewAPicture
Message:

General inline documentation improvements in wp-includes/functions.php.

First run. See #26185.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r28917 r28918  
    99
    1010/**
    11  * Converts given date string into a different format.
     11 * Convert given date string into a different format.
    1212 *
    1313 * $format should be either a PHP date format string, e.g. 'U' for a Unix
     
    1919 * @since 0.71
    2020 *
    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 is true.
     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.
    2424 * @return string|int Formatted date string, or Unix timestamp.
    2525 */
     
    5454 * @since 1.0.0
    5555 *
    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.
    5859 * @return int|string Integer if $type is 'timestamp', string otherwise.
    5960 */
     
    9899    }
    99100
    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     */
    102105    $req_format = $dateformatstring;
    103106
     
    159162 * @since 2.3.0
    160163 *
    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.
    163166 * @return string Converted number in string format.
    164167 */
     
    190193 *
    191194 * Technically the correct unit names for powers of 1024 are KiB, MiB etc.
    192  * @link http://en.wikipedia.org/wiki/Byte
    193195 *
    194196 * @since 2.3.0
    195197 *
    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.
    198200 * @return bool|string False on failure. Number string on success.
    199201 */
     
    224226 */
    225227function 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
    231243    if ( !is_numeric($start_of_week) )
    232244        $start_of_week = get_option( 'start_of_week' );
     
    235247        $weekday += 7;
    236248
    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;
    239254    return compact( 'start', 'end' );
    240255}
     
    262277 * @since 2.0.5
    263278 *
    264  * @param mixed $data Value to check to see if was serialized.
    265  * @param bool $strict Optional. Whether to be strict about the end of the string. Defaults true.
     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.
    266281 * @return bool False if not serialized and true if it was.
    267282 */
    268283function 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.
    270285    if ( ! is_string( $data ) ) {
    271286        return false;
     
    326341 * @since 2.0.5
    327342 *
    328  * @param mixed $data Serialized data
     343 * @param string $data Serialized data.
    329344 * @return bool False if not a serialized string, true if it is.
    330345 */
    331346function 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.
    333348    if ( ! is_string( $data ) ) {
    334349        return false;
     
    355370 * @since 2.0.5
    356371 *
    357  * @param mixed $data Data that might be serialized.
     372 * @param string|array|object $data Data that might be serialized.
    358373 * @return mixed A scalar data
    359374 */
     
    378393 * @since 0.71
    379394 *
    380  * @global string $post_default_title Default XMLRPC post title.
     395 * @global string $post_default_title Default XML-RPC post title.
    381396 *
    382397 * @param string $content XMLRPC XML Request content
     
    402417 * @since 0.71
    403418 *
    404  * @global string $post_default_category Default XMLRPC post category.
     419 * @global string $post_default_category Default XML-RPC post category.
    405420 *
    406421 * @param string $content XMLRPC XML Request content
     
    423438 * @since 0.71
    424439 *
    425  * @param string $content XMLRPC XML Request content
     440 * @param string $content XML-RPC XML Request content.
    426441 * @return string XMLRPC XML Request content without title and category elements.
    427442 */
     
    434449
    435450/**
    436  * Use RegEx to extract URLs from arbitrary content
     451 * Use RegEx to extract URLs from arbitrary content.
    437452 *
    438453 * @since 3.7.0
    439454 *
    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.
    442457 */
    443458function wp_extract_urls( $content ) {
     
    473488 * @since 1.5.0
    474489 *
    475  * @uses $wpdb
    476  *
    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.
    479494 */
    480495function do_enclose( $content, $post_ID ) {
     
    549564 * @since 2.5.0
    550565 *
    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.
    554570 * @return bool|string False on failure and string of headers if HEAD request.
    555571 */
     
    601617 * @since 1.5.1
    602618 *
    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.
    605621 * @return bool|string False on failure, headers on success.
    606622 */
     
    622638 *
    623639 * @since 0.71
     640 *
    624641 * @global string $currentday The day of the current post in the loop.
    625642 * @global string $previousday The day of the previous post in the loop.
Note: See TracChangeset for help on using the changeset viewer.