/usr/share/php/Horde/Date/Parser/Locale/Base/Repeater.php is in php-horde-date-parser 2.0.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | <?php
class Horde_Date_Parser_Locale_Base_Repeater
{
public $monthNameScanner = array(
'/^jan\.?(uary)?$/i' => 'january',
'/^feb\.?(ruary)?$/i' => 'february',
'/^mar\.?(ch)?$/i' => 'march',
'/^apr\.?(il)?$/i' => 'april',
'/^may$/i' => 'may',
'/^jun\.?e?$/i' => 'june',
'/^jul\.?y?$/i' => 'july',
'/^aug\.?(ust)?$/i' => 'august',
'/^sep\.?(t\.?|tember)?$/i' => 'september',
'/^oct\.?(ober)?$/i' => 'october',
'/^nov\.?(ember)?$/i' => 'november',
'/^dec\.?(ember)?$/i' => 'december',
);
public $dayNameScanner = array(
'/^m[ou]n(day)?$/i' => 'monday',
'/^t(ue|eu|oo|u|)s(day)?$/i' => 'tuesday',
'/^tue$/i' => 'tuesday',
'/^we(dnes|nds|nns)day$/i' => 'wednesday',
'/^wed$/i' => 'wednesday',
'/^th(urs|ers)day$/i' => 'thursday',
'/^thu$/i' => 'thursday',
'/^fr[iy](day)?$/i' => 'friday',
'/^sat(t?[ue]rday)?$/i' => 'saturday',
'/^su[nm](day)?$/i' => 'sunday',
);
public $dayPortionScanner = array(
'/^ams?$/i' => 'am',
'/^pms?$/i' => 'pm',
'/^mornings?$/i' => 'morning',
'/^afternoons?$/i' => 'afternoon',
'/^evenings?$/i' => 'evening',
'/^(night|nite)s?$/i' => 'night',
);
public $unitScanner = array(
'/^years?$/i' => 'year',
'/^seasons?$/i' => 'season',
'/^months?$/i' => 'month',
'/^fortnights?$/i' => 'fortnight',
'/^weeks?$/i' => 'week',
'/^weekends?$/i' => 'weekend',
'/^days?$/i' => 'day',
'/^hours?$/i' => 'hour',
'/^minutes?$/i' => 'minute',
'/^seconds?$/i' => 'second',
);
public $timeRegex = '/^\d{1,2}(:?\d{2})?([\.:]?\d{2})?$/';
public function scan($tokens, $options)
{
foreach ($tokens as &$token) {
if ($t = $this->scanForMonthNames($token)) {
$token->tag('repeater_month_name', $t);
} elseif ($t = $this->scanForDayNames($token)) {
$token->tag('repeater_day_name', $t);
} elseif ($t = $this->scanForDayPortions($token)) {
$token->tag('repeater_day_portion', $t);
} elseif ($t = $this->scanForTimes($token, $options)) {
$token->tag('repeater_time', $t);
} elseif ($t = $this->scanForUnits($token)) {
$token->tag(Horde_String::lower(str_replace('Horde_Date_', '', get_class($t))), $t);
}
}
return $tokens;
}
public function scanForMonthNames($token)
{
foreach ($this->monthNameScanner as $scannerItem => $scannerTag) {
if (preg_match($scannerItem, $token->word)) {
return new Horde_Date_Repeater_MonthName($scannerTag);
}
}
}
public function scanForDayNames($token)
{
foreach ($this->dayNameScanner as $scannerItem => $scannerTag) {
if (preg_match($scannerItem, $token->word)) {
return new Horde_Date_Repeater_DayName($scannerTag);
}
}
}
public function scanForDayPortions($token)
{
foreach ($this->dayPortionScanner as $scannerItem => $scannerTag) {
if (preg_match($scannerItem, $token->word)) {
return new Horde_Date_Repeater_DayPortion($scannerTag);
}
}
}
public function scanForTimes($token, $options)
{
if (preg_match($this->timeRegex, $token->word)) {
return new Horde_Date_Repeater_Time($token->word, $options);
}
}
public function scanForUnits($token)
{
foreach ($this->unitScanner as $scannerItem => $scannerTag) {
if (preg_match($scannerItem, $token->word)) {
$class = 'Horde_Date_Repeater_' . Horde_String::ucfirst($scannerTag);
return new $class($scannerTag);
}
}
}
}
|