Make WordPress Core

Changeset 16203


Ignore:
Timestamp:
11/05/2010 11:19:06 AM (16 years ago)
Author:
westi
Message:

Restore the functionality of some of the other timezone format modifiers in date_i18n props nbachiyski.

File:
1 edited

Legend:

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

    r16093 r16203  
    119119                $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
    120120        }
     121        $timezone_formats = array( 'P', 'I', 'O', 'T', 'Z', 'e' );
     122        $timezone_formats_re = implode( '|', $timezone_formats );       
     123        if ( preg_match( "/$timezone_formats_re/", $dateformatstring ) && wp_timezone_supported() ) {
     124                $timezone_string = get_option( 'timezone_string' );
     125                if ( $timezone_string ) {
     126                        $timezone_object = timezone_open( $timezone_string );
     127                        $date_object = date_create( null, $timezone_object );
     128                        foreach( $timezone_formats as $timezone_format ) {
     129                                if ( false !== strpos( $dateformatstring, $timezone_format ) ) {
     130                                        $formatted = date_format( $date_object, $timezone_format );
     131                                        $dateformatstring = ' '.$dateformatstring;
     132                                        $dateformatstring = preg_replace( "/([^\\\])$timezone_format/", "\\1" . backslashit( $formatted ), $dateformatstring );
     133                                        $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
     134                                }
     135                        }                       
     136                }
     137        }
    121138        $j = @$datefunc( $dateformatstring, $i );
    122139        // allow plugins to redo this entirely for languages with untypical grammars
Note: See TracChangeset for help on using the changeset viewer.