/usr/share/php/Horde/Date/Parser.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 | <?php
/**
*
*/
class Horde_Date_Parser
{
public static function parse($text, $args = array())
{
$factoryArgs = $args;
unset($args['locale']);
return self::factory($factoryArgs)->parse($text, $args);
}
public static function factory($args = array())
{
$locale = isset($args['locale']) ? $args['locale'] : null;
if ($locale && Horde_String::lower($locale) != 'base') {
$locale = str_replace(' ', '_', Horde_String::ucwords(str_replace('_', ' ', Horde_String::lower($locale))));
$class = 'Horde_Date_Parser_Locale_' . $locale;
if (class_exists($class)) {
return new $class($args);
}
$language = array_shift(explode('_', $locale));
if ($language != $locale) {
$class = 'Horde_Date_Parser_Locale_' . $language;
if (class_exists($class)) {
return new $class($args);
}
}
}
return new Horde_Date_Parser_Locale_Base($args);
}
/**
* Return a list of available locales
*/
public static function getLocales()
{
$dir = __DIR__ . '/Parser/Locale';
$locales = array();
foreach (new DirectoryIterator($dir) as $f) {
if ($f->isFile()) {
$locale = str_replace('.php', '', $f->getFilename());
$locale = preg_replace_callback('/([A-Z][a-z]*)([A-Z].*)?/', create_function('$m', 'if (!isset($m[2])) { return Horde_String::lower($m[1]); } else { return Horde_String::lower($m[1]) . "_" . Horde_String::upper($m[2]); }'), $locale);
$locales[] = $locale;
}
}
return $locales;
}
}
|