MediaWiki REL1_30
|
Date formatter, recognises dates in plain text and formats them according to user preferences. More...
Public Member Functions | |
__construct (Language $lang) | |
reformat ( $preference, $text, $options=[ 'linked']) | |
Static Public Member Functions | |
static | getInstance ( $lang=null) |
Get a DateFormatter object. | |
Public Attributes | |
const | ALL = -1 |
const | DM = 7 |
const | DMY = 2 |
const | ISO1 = 4 |
const | ISO2 = 5 |
const | LAST = 8 |
const | LASTPREF = 4 |
const | MD = 8 |
const | MDY = 1 |
const | NONE = 0 |
const | YDM = 6 |
const | YMD = 3 |
Private Member Functions | |
formatDate ( $bits, $orig, $link=true) | |
getMonthRegex () | |
Return a regex that can be used to find month names in string. | |
makeIsoMonth ( $monthName) | |
Makes an ISO month, e.g. | |
makeIsoYear ( $year) | |
Make an ISO year from a year name, for instance: '-1199' from '1200 BC'. | |
makeNormalYear ( $iso) | |
Make a year one from an ISO year, for instance: '400 BC' from '-0399'. | |
replace ( $matches) | |
Regexp replacement callback. | |
Private Attributes | |
string[] | $keys |
$lang | |
$mLinked | |
$monthNames = '' | |
$mSource | |
$mTarget | |
$preferences | |
$regexes | |
$rules | |
string[] | $targets |
$xMonths | |
Date formatter, recognises dates in plain text and formats them according to user preferences.
Definition at line 29 of file DateFormatter.php.
DateFormatter::__construct | ( | Language | $lang | ) |
|
private |
array | $bits | |
string | $orig | Original input string, to be returned on formatting failure. |
bool | $link |
Definition at line 238 of file DateFormatter.php.
References $link, $mTarget, makeIsoMonth(), makeIsoYear(), and makeNormalYear().
Referenced by replace().
|
static |
Get a DateFormatter object.
Language | string | null | $lang | In which language to format the date Defaults to the site content language |
Definition at line 133 of file DateFormatter.php.
References $cache, $lang, $wgContLang, function, and wfGetLangObj().
Referenced by CoreParserFunctions\formatDate().
|
private |
Return a regex that can be used to find month names in string.
Definition at line 337 of file DateFormatter.php.
Referenced by __construct().
|
private |
Makes an ISO month, e.g.
02, from a month name
string | $monthName | Month name |
Definition at line 351 of file DateFormatter.php.
Referenced by formatDate().
|
private |
Make an ISO year from a year name, for instance: '-1199' from '1200 BC'.
string | $year | Year name |
Definition at line 361 of file DateFormatter.php.
Referenced by formatDate().
|
private |
Make a year one from an ISO year, for instance: '400 BC' from '-0399'.
string | $iso | ISO year |
Definition at line 380 of file DateFormatter.php.
Referenced by formatDate().
DateFormatter::reformat | ( | $preference, | |
$text, | |||
$options = [ 'linked' ] ) |
|
private |
Regexp replacement callback.
array | $matches |
Definition at line 212 of file DateFormatter.php.
References $matches, $mLinked, $mSource, and formatDate().
|
private |
Definition at line 39 of file DateFormatter.php.
|
private |
Definition at line 36 of file DateFormatter.php.
Referenced by __construct(), and getInstance().
|
private |
Definition at line 36 of file DateFormatter.php.
Referenced by replace().
|
private |
Definition at line 31 of file DateFormatter.php.
|
private |
Definition at line 30 of file DateFormatter.php.
Referenced by replace().
|
private |
Definition at line 30 of file DateFormatter.php.
Referenced by formatDate().
|
private |
Definition at line 34 of file DateFormatter.php.
|
private |
Definition at line 33 of file DateFormatter.php.
|
private |
Definition at line 34 of file DateFormatter.php.
|
private |
Definition at line 42 of file DateFormatter.php.
|
private |
Definition at line 34 of file DateFormatter.php.
const DateFormatter::ALL = -1 |
Definition at line 44 of file DateFormatter.php.
Referenced by __construct(), and reformat().
const DateFormatter::DM = 7 |
Definition at line 53 of file DateFormatter.php.
Referenced by __construct().
const DateFormatter::DMY = 2 |
Definition at line 47 of file DateFormatter.php.
Referenced by __construct().
const DateFormatter::ISO1 = 4 |
Definition at line 49 of file DateFormatter.php.
Referenced by __construct().
const DateFormatter::ISO2 = 5 |
Definition at line 51 of file DateFormatter.php.
Referenced by __construct().
const DateFormatter::LAST = 8 |
Definition at line 55 of file DateFormatter.php.
Referenced by reformat().
const DateFormatter::LASTPREF = 4 |
Definition at line 50 of file DateFormatter.php.
const DateFormatter::MD = 8 |
Definition at line 54 of file DateFormatter.php.
Referenced by __construct().
const DateFormatter::MDY = 1 |
Definition at line 46 of file DateFormatter.php.
Referenced by __construct().
const DateFormatter::NONE = 0 |
Definition at line 45 of file DateFormatter.php.
Referenced by __construct(), and reformat().
const DateFormatter::YDM = 6 |
Definition at line 52 of file DateFormatter.php.
Referenced by __construct().
const DateFormatter::YMD = 3 |
Definition at line 48 of file DateFormatter.php.
Referenced by __construct().