array() ); } public static function getHTML( $datetime, $input_name, $is_mandatory, $is_disabled, $other_args ) { global $wgPageFormsTabIndex, $wgPageForms24HourTime; $include_timezone = array_key_exists( 'include timezone', $other_args ); if ( $datetime ) { // Can show up here either as an array or a string, // depending on whether it came from user input or a // wiki page. if ( is_array( $datetime ) ) { if ( isset( $datetime['hour'] ) ) { $hour = $datetime['hour']; } if ( isset( $datetime['minute'] ) ) { $minute = $datetime['minute']; } if ( isset( $datetime['second'] ) ) { $second = $datetime['second']; } if ( !$wgPageForms24HourTime ) { if ( isset( $datetime['ampm24h'] ) ) { $ampm24h = $datetime['ampm24h']; } } if ( isset( $datetime['timezone'] ) ) { $timezone = $datetime['timezone']; } } else { // Parse the date. // We get only the time data here - the main // date data is handled by the call to // parent::getMainHTML(). // Handle 'default=now'. if ( $datetime == 'now' ) { global $wgLocaltimezone; if ( $wgLocaltimezone == null ) { $dateTimeObject = new DateTime( 'now' ); } else { $dateTimeObject = new DateTime( 'now', new DateTimeZone( $wgLocaltimezone ) ); } } else { $dateTimeObject = new DateTime( $datetime ); } if ( $wgPageForms24HourTime ) { $hour = $dateTimeObject->format( 'G' ); } else { $hour = $dateTimeObject->format( 'g' ); } $minute = $dateTimeObject->format( 'i' ); $second = $dateTimeObject->format( 's' ); if ( !$wgPageForms24HourTime ) { $ampm24h = $dateTimeObject->format( 'A' ); } $timezone = $dateTimeObject->format( 'T' ); } } else { $hour = null; $minute = null; $second = '00'; // default at least this value $ampm24h = ''; $timezone = ''; } $text = parent::getMainHTML( $datetime, $input_name, $is_mandatory, $is_disabled, $other_args ); $disabled_text = ( $is_disabled ) ? 'disabled' : ''; $text .= '  '; $wgPageFormsTabIndex++; $text .= ' :'; $wgPageFormsTabIndex++; $text .= ':' . "\n"; if ( !$wgPageForms24HourTime ) { $wgPageFormsTabIndex++; $text .= '