/usr/share/php/Horde/Date/Parser/Locale/De.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 | <?php
/**
*/
class Horde_Date_Parser_Locale_De extends Horde_Date_Parser_Locale_Base
{
/**
* Clean up the specified input text by stripping unwanted characters,
* converting idioms to their canonical form, converting number words
* to numbers (three => 3), and converting ordinal words to numeric
* ordinals (third => 3rd)
*/
public function preNormalize($text)
{
$text = strtolower($text);
$text = $this->numericizeNumbers($text);
$text = preg_replace('/[\'"\.]/', '', $text);
$text = preg_replace('/([\/\-\,\@])/', ' \1 ', $text);
$text = preg_replace('/\bheute\b/', 'dieser tag', $text);
$text = preg_replace('/\bmorgen\b/', 'nächster tag', $text);
$text = preg_replace('/\bgestern\b/', 'letzter tag', $text);
$text = preg_replace('/\bmittags?\b/', '12:00', $text);
$text = preg_replace('/\bmitternachts?\b/', '24:00', $text);
$text = preg_replace('/\bjetzt\b/', 'diese sekunde', $text);
$text = preg_replace('/\b(vor|früher)\b/', 'past', $text);
$text = preg_replace('/\b(?:in|during) the (morning)\b/', '\1', $text);
$text = preg_replace('/\bam (morgen|nachmittag|abend)\b/', '\1', $text);
$text = preg_replace('/\in der nacht\b/', 'nachts', $text);
$text = $this->numericizeOrdinals($text);
return $text;
}
/**
* Remove tokens that don't fit our definitions and re-orders tokens when
* necessary.
*
* @param array $tokens Array of tagged tokens.
*
* @return array Filtered tagged tokens.
*/
public function postTokenize($tokens)
{
$tokens = parent::postTokenize($tokens);
// Catch ambiguous constructs like "heute morgen/morgen früh".
foreach ($tokens as $num => $token) {
if ($num >= 2 &&
($repeater = $token->getTag('repeater')) &&
$repeater instanceof Horde_Date_Repeater_Day &&
($grabber = $tokens[$num - 1]->getTag('grabber')) &&
$grabber == 'next') {
$token = new Horde_Date_Parser_Token('');
$token->tag('repeater_day_portion',
new Horde_Date_Repeater_DayPortion('morning'));
array_splice(
$tokens,
$num - 1,
2,
array($token));
return $tokens;
}
}
return $tokens;
}
}
|