MediaWiki  1.29.2
LanguageWa.php
Go to the documentation of this file.
1 <?php
32 class LanguageWa extends Language {
33 
45  public function date( $ts, $adj = false, $format = true, $tc = false ) {
46  $ts = wfTimestamp( TS_MW, $ts );
47  if ( $adj ) {
48  $ts = $this->userAdjust( $ts, $tc );
49  }
50  $datePreference = $this->dateFormat( $format );
51 
52  # ISO (YYYY-mm-dd) format
53  # we also output this format for YMD (eg: 2001 January 15)
54  if ( $datePreference == 'ISO 8601' ) {
55  $d = substr( $ts, 0, 4 ) . '-' . substr( $ts, 4, 2 ) . '-' . substr( $ts, 6, 2 );
56  return $d;
57  }
58 
59  # dd/mm/YYYY format
60  if ( $datePreference == 'walloon short' ) {
61  $d = substr( $ts, 6, 2 ) . '/' . substr( $ts, 4, 2 ) . '/' . substr( $ts, 0, 4 );
62  return $d;
63  }
64 
65  # Walloon format
66  # we output this in all other cases
67  $m = substr( $ts, 4, 2 );
68  $n = substr( $ts, 6, 2 );
69  if ( $n == 1 ) {
70  $d = "1î d' " . $this->getMonthName( $m ) .
71  " " . substr( $ts, 0, 4 );
72  } elseif ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) {
73  $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
74  " " . substr( $ts, 0, 4 );
75  } elseif ( $m == 4 || $m == 8 || $m == 10 ) {
76  $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
77  " " . substr( $ts, 0, 4 );
78  } else {
79  $d = ( 0 + $n ) . " di " . $this->getMonthName( $m ) .
80  " " . substr( $ts, 0, 4 );
81  }
82  return $d;
83  }
84 
92  public function timeanddate( $ts, $adj = false, $format = true, $tc = false ) {
93  if ( $adj ) {
94  $ts = $this->userAdjust( $ts, $tc );
95  }
96  $datePreference = $this->dateFormat( $format );
97  if ( $datePreference == 'ISO 8601' ) {
98  return parent::timeanddate( $ts, $adj, $format, $tc );
99  } else {
100  return $this->date( $ts, $adj, $format, $tc ) . ' a ' .
101  $this->time( $ts, $adj, $format, $tc );
102  }
103  }
104 }
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1994
LanguageWa
Walloon (Walon)
Definition: LanguageWa.php:32
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
LanguageWa\timeanddate
timeanddate( $ts, $adj=false, $format=true, $tc=false)
Definition: LanguageWa.php:92
Language\getMonthName
getMonthName( $key)
Definition: Language.php:921
LanguageWa\date
date( $ts, $adj=false, $format=true, $tc=false)
Dates in Walloon are "1î d' <monthname>" for 1st of the month, "<day> di <monthname>" for months star...
Definition: LanguageWa.php:45
Language\dateFormat
dateFormat( $usePrefs=true)
This is meant to be used by time(), date(), and timeanddate() to get the date preference they're supp...
Definition: Language.php:2171
Language\userAdjust
userAdjust( $ts, $tz=false)
Used by date() and time() to adjust the time output.
Definition: Language.php:2093
Language\time
time( $ts, $adj=false, $format=true, $timecorrection=false)
Definition: Language.php:2255
Language
Internationalisation code.
Definition: Language.php:35