/usr/share/php/Horde/Date/Parser/Locale/Base/Ordinal.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 | <?php
class Horde_Date_Parser_Locale_Base_Ordinal
{
public $ordinalRegex = '/^(\d*)(st|nd|rd|th)$/';
public $ordinalDayRegex = '/^(\d*)(st|nd|rd|th)$/';
public function scan($tokens)
{
foreach ($tokens as &$token) {
if (!is_null($t = $this->scanForOrdinals($token))) {
$token->tag('ordinal', $t);
}
if (!is_null($t = $this->scanForDays($token))) {
$token->tag('ordinal_day', $t);
}
}
return $tokens;
}
public function scanForOrdinals($token)
{
if (preg_match($this->ordinalRegex, $token->word, $matches)) {
return (int)$matches[1];
}
}
public function scanForDays($token)
{
if (preg_match($this->ordinalDayRegex, $token->word, $matches)) {
if ($matches[1] <= 31) {
return (int)$matches[1];
}
}
}
}
|