Make WordPress Core

Ticket #28310: 28310.4.diff

File 28310.4.diff, 3.9 KB (added by tollmanz, 10 years ago)

Refreshed patch to apply cleanly

  • src/wp-includes/functions.php

     
    2121 * @param string $format    Format of the date to return.
    2222 * @param string $date      Date string to convert.
    2323 * @param bool   $translate Whether the return date should be translated. Default true.
    24  * @return string|int Formatted date string, or Unix timestamp.
     24 * @return string|int|bool Formatted date string or Unix timestamp. False if $date is empty.
    2525 */
    2626function mysql2date( $format, $date, $translate = true ) {
    2727        if ( empty( $date ) )
  • src/wp-includes/general-template.php

     
    17251725 *
    17261726 * @param  string      $d    Optional. PHP date format defaults to the date_format option if not specified.
    17271727 * @param  int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
    1728  * @return string Date the current post was written.
     1728 * @return string|bool Date the current post was written. False on failure.
    17291729 */
    17301730function get_the_date( $d = '', $post = null ) {
    17311731        $post = get_post( $post );
    17321732
     1733        if ( ! $post ) {
     1734                return false;
     1735        }
     1736
    17331737        if ( '' == $d ) {
    17341738                $the_date = mysql2date( get_option( 'date_format' ), $post->post_date );
    17351739        } else {
     
    18391843 *                          was written. Either 'G', 'U', or php date format defaults
    18401844 *                          to the value specified in the time_format option. Default empty.
    18411845 * @param int|WP_Post $post WP_Post object or ID. Default is global $post object.
    1842  * @return string|int Formatted date string, or Unix timestamp.
     1846 * @return string|int|bool Formatted date string or Unix timestamp. False on failure.
    18431847 */
    18441848function get_the_time( $d = '', $post = null ) {
    18451849        $post = get_post($post);
    18461850
     1851        if ( ! $post ) {
     1852                return false;
     1853        }
     1854
    18471855        if ( '' == $d )
    18481856                $the_time = get_post_time(get_option('time_format'), false, $post, true);
    18491857        else
     
    18731881 * @param bool        $gmt       Optional. Whether to retrieve the GMT time. Default false.
    18741882 * @param int|WP_Post $post      WP_Post object or ID. Default is global $post object.
    18751883 * @param bool        $translate Whether to translate the time string. Default false.
    1876  * @return string|int Formatted date string, or Unix timestamp.
     1884 * @return string|int|bool Formatted date string or Unix timestamp. False on failure.
    18771885 */
    18781886function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
    18791887        $post = get_post($post);
    18801888
     1889        if ( ! $post ) {
     1890                return false;
     1891        }
     1892
    18811893        if ( $gmt )
    18821894                $time = $post->post_date_gmt;
    18831895        else
     
    19511963 *
    19521964 * @since 2.0.0
    19531965 *
    1954  * @param string $d Optional, default is 'U'. Either 'G', 'U', or php date format.
    1955  * @param bool $gmt Optional, default is false. Whether to return the gmt time.
    1956  * @param int|object $post Optional, default is global post object. A post_id or post object
    1957  * @param bool $translate Optional, default is false. Whether to translate the result
    1958  * @return string Returns timestamp
     1966 * @param string      $d         Optional. Format to use for retrieving the time the post
     1967 *                               was modified. Either 'G', 'U', or php date format. Default 'U'.
     1968 * @param bool        $gmt       Optional. Whether to retrieve the GMT time. Default false.
     1969 * @param int|WP_Post $post      WP_Post object or ID. Default is global $post object.
     1970 * @param bool        $translate Whether to translate the time string. Default false.
     1971 * @return string|int|bool Formatted date string or Unix timestamp. False on failure.
    19591972 */
    19601973function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
    19611974        $post = get_post($post);
    19621975
     1976        if ( ! $post ) {
     1977                return false;
     1978        }
     1979
    19631980        if ( $gmt )
    19641981                $time = $post->post_modified_gmt;
    19651982        else