+ $this->addRow( wfMsg( 'localtime' ), $nowlocal )
+ );
+ $opt = Xml::openElement( 'select', array(
+ 'name' => 'wpTimeZone',
+ 'id' => 'wpTimeZone',
+ 'onchange' => 'javascript:updateTimezoneSelection(false)' ) );
+ $opt .= Xml::option( wfMsg( 'timezoneuseserverdefault' ), "System|$wgLocalTZoffset", $this->mTimeZone === "System|$wgLocalTZoffset" );
+ $opt .= Xml::option( wfMsg( 'timezoneuseoffset' ), 'Offset', $this->mTimeZone === 'Offset' );
+ if ( function_exists( 'timezone_identifiers_list' ) ) {
+ $optgroup = '';
+ $tzs = timezone_identifiers_list();
+ sort( $tzs );
+ $selZone = explode( '|', $this->mTimeZone, 3);
+ $selZone = ( $selZone[0] == 'ZoneInfo' ) ? $selZone[2] : null;
+ $now = date_create( 'now' );
+ foreach ( $tzs as $tz ) {
+ $z = explode( '/', $tz, 2 );
+ # timezone_identifiers_list() returns a number of
+ # backwards-compatibility entries. This filters them out of the
+ # list presented to the user.
+ if ( count( $z ) != 2 || !in_array( $z[0], array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific' ) ) ) continue;
+ if ( $optgroup != $z[0] ) {
+ if ( $optgroup !== '' ) $opt .= Xml::closeElement( 'optgroup' );
+ $optgroup = $z[0];
+ $opt .= Xml::openElement( 'optgroup', array( 'label' => $z[0] ) );
+ }
+ $minDiff = floor( timezone_offset_get( timezone_open( $tz ), $now ) / 60 );
+ $opt .= Xml::option( str_replace( '_', ' ', $tz ), "ZoneInfo|$minDiff|$tz", $selZone === $tz, array( 'label' => $z[1] ) );
+ }
+ if ( $optgroup !== '' ) $opt .= Xml::closeElement( 'optgroup' );
+ }
+ $opt .= Xml::closeElement( 'select' );
+ $wgOut->addHTML(
+ $this->addRow(
+ Xml::label( wfMsg( 'timezoneselect' ), 'wpTimeZone' ),
+ $opt )
+ );
+ $wgOut->addHTML(