39a40,49 > > /* private */ $wgDateFormatsEt = array( > 'Eelistus puudub', > '15.01.2001, kell 16.12', > '15. jaanuar 2001, kell 16.12', > '15. I 2005, kell 16.12', > 'ISO 8601' => '2001-01-15 16:12:34' > ); > > 227c237 < "lastmodified" => "Viimati muudetud $1.", --- > "lastmodified" => "Viimane muutmine: $1", 499c509 < "revisionasof" => "Redaktsioon $1", --- > "revisionasof" => "Redaktsioon: $1", 561a572 > "dateformat" => "KuupƤeva formaat", 991a1003,1007 > function getDateFormats() { > global $wgDateFormatsEt; > return $wgDateFormatsEt; > } > 1034a1051,1165 > > > > /** > * @access public > * @param mixed $ts the time format which needs to be turned into a > * date('YmdHis') format with wfTimestamp(TS_MW,$ts) > * @param bool $adj whether to adjust the time output according to the > * user configured offset ($timecorrection) > * @param mixed $format what format to return, if it's false output the > * default one. > * @param string $timecorrection the time offset as returned by > * validateTimeZone() in Special:Preferences > * @return string > */ > function date( $ts, $adj = false, $format = true, $timecorrection = false ) { > global $wgAmericanDates, $wgUser; > > if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); } > > $datePreference = $this->dateFormat($format); > > if ($datePreference == '0' > || $datePreference == '' ) {$datePreference = $wgAmericanDates ? '0' : '2';} > > $month = $this->getMonthName( substr( $ts, 4, 2 ) ); > $day = $this->formatNum( 0 + substr( $ts, 6, 2 ) ); > $year = $this->formatNum( substr( $ts, 0, 4 ), true ); > $lat_month = $this->monthByLatinNumber( substr ($ts, 4, 2)); > > switch( $datePreference ) { > case '2': return "$day. $month $year"; > case '3': return "$day. $lat_month $year"; > case 'ISO 8601': return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2); > default: return substr($ts, 6, 2). '.' . substr($ts, 4, 2). '.' .substr($ts, 0, 4); > } > } > > > > /** > * @access public > * @param mixed $ts the time format which needs to be turned into a > * date('YmdHis') format with wfTimestamp(TS_MW,$ts) > * @param bool $adj whether to adjust the time output according to the > * user configured offset ($timecorrection) > * @param mixed $format what format to return, if it's false output the > * default one (default true) > * @param string $timecorrection the time offset as returned by > * validateTimeZone() in Special:Preferences > * @return string > */ > function time( $ts, $adj = false, $format = true, $timecorrection = false ) { > global $wgUser, $wgAmericanDates; > > if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); } > $datePreference = $this->dateFormat($format); > > if ($datePreference == '0') {$datePreference = $wgAmericanDates ? '0' : '2';} > > if ( $datePreference === 'ISO 8601' ) { > $t = substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 ); > $t .= ':' . substr( $ts, 12, 2 ); > } else { > $t = substr( $ts, 8, 2 ) . '.' . substr( $ts, 10, 2 ); > } > return $this->formatNum( $t ); > } > > > > > /** > * @access public > * @param mixed $ts the time format which needs to be turned into a > * date('YmdHis') format with wfTimestamp(TS_MW,$ts) > * @param bool $adj whether to adjust the time output according to the > * user configured offset ($timecorrection) > * @param mixed $format what format to return, if it's false output the > * default one (default true) > * @param string $timecorrection the time offset as returned by > * validateTimeZone() in Special:Preferences > * @return string > */ > function timeanddate( $ts, $adj = false, $format = true, $timecorrection = false) { > global $wgUser, $wgAmericanDates; > > $datePreference = $this->dateFormat($format); > switch ( $datePreference ) { > case 'ISO 8601': return $this->date( $ts, $adj, $datePreference, $timecorrection ) . ' ' . > $this->time( $ts, $adj, $datePreference, $timecorrection ); > default: return $this->date( $ts, $adj, $datePreference, $timecorrection ) . ', kell ' . > $this->time( $ts, $adj, $datePreference, $timecorrection ); > > } > > } > > > /** > * retuns latin number corresponding to given month number > * @access public > * @param number > * @return string > */ > function monthByLatinNumber( $key ) { > $latinNumbers= array( > 'I', 'II', 'III', 'IV', 'V', 'VI', > 'VII','VIII','IX','X','XI','XII' > ); > > return $latinNumbers[$key-1]; > } > >