public function PARSEMONTH::init in Bibliography Module 7
Same name and namespace in other branches
- 5 bibtexParse/PARSEMONTH.php \PARSEMONTH::init()
- 6.2 modules/bibtexParse/PARSEMONTH.php \PARSEMONTH::init()
- 6 bibtexParse/PARSEMONTH.php \PARSEMONTH::init()
- 7.3 plugins/biblio_style/bibtex/PARSEMONTH.php \PARSEMONTH::init()
- 7.2 modules/bibtexParse/PARSEMONTH.php \PARSEMONTH::init()
File
- modules/
bibtexParse/ PARSEMONTH.php, line 40
Class
- PARSEMONTH
- 17/June/2005 - Mark Grimshaw: month fields that have multiple dates (e.g. dec # " 5--9," or nov # " 29" # "--" # dec # " 2") are correctly parsed.
Code
public function init($monthField) {
$startMonth = $this->startDay = $endMonth = $this->endDay = FALSE;
$date = preg_split("#", $monthField);
foreach ($date as $field) {
$field = ucfirst(strtolower(trim($field)));
if ($month = array_search($field, $this
->monthToLongName())) {
if (!$startMonth) {
$startMonth = $month;
}
else {
$endMonth = $month;
}
continue;
}
elseif ($month = array_search($field, $this
->monthToShortName())) {
if (!$startMonth) {
$startMonth = $month;
}
else {
$endMonth = $month;
}
continue;
}
$this
->parseDay($field);
}
if ($this->endDay && !$endMonth) {
$endMonth = $startMonth;
}
return array(
$startMonth,
$this->startDay,
$endMonth,
$this->endDay,
);
}