--- wiki/includes/DateFormatter.php 2008-09-03 10:28:06.818826600 -0700 +++ wiki2/includes/DateFormatter.php 2008-09-03 12:19:48.971095100 -0700 @@ -24,7 +24,14 @@ const YDM = 6; const DM = 7; const MD = 8; - const LAST = 8; + const PMDY = 9; + const PDMY = 10; + const PYMD = 11; + const PYDM = 12; + const PDM = 13; + const PMD = 14; + const PISO = 15; + const LAST = 15; /** * @todo document @@ -46,6 +53,10 @@ $this->prxY = '\[\[(\d{1,4}([ _]BC|))]]'; $this->prxISO1 = '\[\[(-?\d{4})]]-\[\[(\d{2})-(\d{2})]]'; $this->prxISO2 = '\[\[(-?\d{4})-(\d{2})-(\d{2})]]'; + $this->prxPDM = '\s(\d{1,2}) (' . $this->monthNames . ')'; + $this->prxPMD = '\s(' . $this->monthNames . ') (\d{1,2})'; + $this->prxPY = '\s(\d{1,4}( BC|))'; + $this->prxPISO = '\s(-?\d{4})-(\d{2})-(\d{2})'; # Real regular expressions $this->regexes[self::DMY] = "/{$this->prxDM} *,? *{$this->prxY}{$this->regexTrail}"; @@ -56,6 +67,13 @@ $this->regexes[self::MD] = "/{$this->prxMD}{$this->regexTrail}"; $this->regexes[self::ISO1] = "/{$this->prxISO1}{$this->regexTrail}"; $this->regexes[self::ISO2] = "/{$this->prxISO2}{$this->regexTrail}"; + $this->regexes[self::PDMY] = "/{$this->prxPDM} *,? *{$this->prxPY}{$this->regexTrail}"; + $this->regexes[self::PYDM] = "/{$this->prxPY} *,? *{$this->prxPDM}{$this->regexTrail}"; + $this->regexes[self::PMDY] = "/{$this->prxPMD} *,? *{$this->prxPY}{$this->regexTrail}"; + $this->regexes[self::PYMD] = "/{$this->prxPY} *,? *{$this->prxPMD}{$this->regexTrail}"; + $this->regexes[self::PDM] = "/{$this->prxPDM}{$this->regexTrail}"; + $this->regexes[self::PMD] = "/{$this->prxPMD}{$this->regexTrail}"; + $this->regexes[self::PISO] = "/{$this->prxPISO}{$this->regexTrail}"; # Extraction keys # See the comments in replace() for the meaning of the letters @@ -67,6 +85,13 @@ $this->keys[self::MD] = 'Fj'; $this->keys[self::ISO1] = 'ymd'; # y means ISO year $this->keys[self::ISO2] = 'ymd'; + $this->keys[self::PDMY] = 'jFY'; + $this->keys[self::PYDM] = 'Y jF'; + $this->keys[self::PMDY] = 'FjY'; + $this->keys[self::PYMD] = 'Y Fj'; + $this->keys[self::PDM] = 'jF'; + $this->keys[self::PMD] = 'Fj'; + $this->keys[self::PISO] = 'ymd'; # Target date formats $this->targets[self::DMY] = '[[F j|j F]] [[Y]]'; @@ -77,6 +102,13 @@ $this->targets[self::MD] = '[[F j]]'; $this->targets[self::ISO1] = '[[Y|y]]-[[F j|m-d]]'; $this->targets[self::ISO2] = '[[y-m-d]]'; + $this->targets[self::PDMY] = 'j F Y'; + $this->targets[self::PYDM] = 'Y, j F'; + $this->targets[self::PMDY] = 'F j, Y'; + $this->targets[self::PYMD] = 'Y F j'; + $this->targets[self::PDM] = ' j F'; + $this->targets[self::PMD] = ' F j'; + $this->targets[self::PISO] = 'y-m-d'; # Rules # pref source target @@ -85,6 +117,27 @@ $this->rules[self::MDY][self::DM] = self::MD; $this->rules[self::ALL][self::DM] = self::DM; $this->rules[self::NONE][self::ISO2] = self::ISO1; + $this->rules[self::DMY][self::PMDY] = self::PDMY; + $this->rules[self::DMY][self::PDMY] = self::PDMY; + $this->rules[self::DMY][self::PYMD] = self::PDMY; + $this->rules[self::DMY][self::PYDM] = self::PDMY; + $this->rules[self::DMY][self::PISO] = self::PDMY; + $this->rules[self::MDY][self::PMDY] = self::PMDY; + $this->rules[self::MDY][self::PDMY] = self::PMDY; + $this->rules[self::MDY][self::PYMD] = self::PMDY; + $this->rules[self::MDY][self::PYDM] = self::PMDY; + $this->rules[self::MDY][self::PISO] = self::PMDY; + $this->rules[self::YMD][self::PMDY] = self::PYMD; + $this->rules[self::YMD][self::PDMY] = self::PYMD; + $this->rules[self::YMD][self::PYMD] = self::PYMD; + $this->rules[self::YMD][self::PYDM] = self::PYMD; + $this->rules[self::YMD][self::PISO] = self::PYMD; + $this->rules[self::ISO1][self::PMDY] = self::PISO; + $this->rules[self::ISO1][self::PDMY] = self::PISO; + $this->rules[self::ISO1][self::PYMD] = self::PISO; + $this->rules[self::ISO1][self::PYDM] = self::PISO; + $this->rules[self::ISO1][self::PISO] = self::PISO; + $this->rules[self::ALL][self::PDM] = self::PDM; $this->preferences = array( 'default' => self::NONE,