/usr/share/php/Horde/Date/Parser/Locale/Pt/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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | <?php
class Horde_Date_Parser_Locale_Pt_Repeater extends Horde_Date_Parser_Locale_Base_Repeater
{
public $monthNameScanner = array(
'/^jan(eiro)?$/' => 'january',
'/^fev(ereiro)?$/' => 'february',
'/^mar(co)?$/' => 'march',
'/^abr(il)?$/' => 'april',
'/^mai(o)?$/' => 'may',
'/^jun(ho)?$/' => 'june',
'/^jul(ho)?$/' => 'july',
'/^ago(sto)?$/' => 'august',
'/^set(embro)?$/' => 'september',
'/^out(ubro)?$/' => 'october',
'/^nov(embro)?$/' => 'november',
'/^dez(embro)?$/' => 'december',
);
/*
public $monthNameScanner = array(
'/^jan(\.|eiro)?$/' => 'january',
'/^fev(\.|ereiro)?$/' => 'february',
'/^mar(\.|(co))?$/' => 'march',
'/^abr(\.|(il))?$/' => 'april',
'/^mai(\.|o)?$/' => 'may',
'/^jun(\.|ho)?$/' => 'june',
'/^jul(\.|ho)?$/' => 'july',
'/^ago(\.|sto)?$/' => 'august',
'/^set(\.|embro)?$/' => 'september',
'/^out(\.|ubro)?$/' => 'october',
'/^nov(\.|embro)?$/' => 'november',
'/^dez(\.|embro)?$/' => 'december',
);
*/
public $dayNameScanner = array(
'/^seg$/' => 'monday',
'/^ter$/' => 'tuesday',
'/^qua$/' => 'wednesday',
'/^qui$/' => 'thursday',
'/^sex$/' => 'friday',
'/^sab$/' => 'saturday',
'/^dom$/' => 'sunday',
'/^segunda$/' => 'monday',
'/^terca$/' => 'tuesday',
'/^quarta$/' => 'wednesday',
'/^quinta$/' => 'thursday',
'/^sexta$/' => 'friday',
'/^sab(ado)?$/' => 'saturday',
'/^dom(ingo)?$/' => 'sunday',
);
/*
'/^seg((unda)?(\s|\-)feira)?$/' => 'monday',
'/^ter(([cç]a)?(\s|\-)feira)?$/' => 'tuesday',
'/^qua((rta)?(\s|\-)feira)?$/' => 'wednesday',
'/^qui((nta)?([ \-]feira)?)?$/' => 'thursday',
'/^quinta-feira$/' => 'thursday',
'/^sex((ta)?(\s|\-)feira)?$/' => 'friday',
*/
// scalar timeSignifiers?
public $dayPortionScanner = array(
'/^(\d*)\s?ams?$/' => 'am',
'/^(\d*)\s?pms?$/' => 'pm',
'/^(?:de|na|a|durante\s+a) (manh[aã]|madrugada)$/' => 'morning',
'/^(?:de|na|a|durante\s+a) tarde$/' => 'afternoon',
'/^((fim\s(d[ea]\s)tarde)|anoitecer)$/' => 'evening',
'/^noite$/' => 'night',
'/^ams?$/' => 'am',
'/^pms?$/' => 'pm',
'/^mornings?$/' => 'morning',
'/^afternoons?$/' => 'afternoon',
'/^evenings?$/' => 'evening',
'/^(night|nite)s?$/' => 'night',
//'/^horas?$/' => 'hour', // hour: add Repeater dayPortion (JPC)
);
public $unitScanner = array(
'/^anos?$/' => 'year',
'/^(estacao|epoca)$/' => 'season',
'/^mes$/' => 'month',
'/^quinzena$/' => 'fortnight',
'/^semanas?$/' => 'week',
'/^(fds|fim( |( |\-)de( |\-))semana)?$/' => 'weekend',
'/^dias?$/' => 'day',
'/^horas?$/' => 'hour',
'/^minutos?$/' => 'minute',
'/^segundos?$/' => 'second',
'/^years?$/' => 'year',
'/^seasons?$/' => 'season',
'/^months?$/' => 'month',
'/^fortnights?$/' => 'fortnight',
'/^weeks?$/' => 'week',
'/^weekends?$/' => 'weekend',
'/^days?$/' => 'day',
'/^hours?$/' => 'hour',
'/^minutes?$/' => 'minute',
'/^seconds?$/' => 'second',
);
public $timeRegex = '/^\d{1,2}(:?\d{2})?([\.:]?\d{2})?$/';
// 24h format
//public $timeRegex = '/^([01]?[0-9]|2[0-3])(:?([0-5][0-9]))?([\.:]?([0-5][0-9]))?$/';
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);
}
}
}
}
|