1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: 12: 13: 14: 15: 16:
17: class Horde_Support_Numerizer
18: {
19: public static function numerize($string, $args = array())
20: {
21: return self::factory($args)->numerize($string);
22: }
23:
24: public static function factory($args = array())
25: {
26: $locale = isset($args['locale']) ? $args['locale'] : null;
27: if ($locale && strtolower($locale) != 'base') {
28: $locale = str_replace(' ', '_', ucwords(str_replace('_', ' ', strtolower($locale))));
29: $class = 'Horde_Support_Numerizer_Locale_' . $locale;
30: if (class_exists($class)) {
31: return new $class($args);
32: }
33:
34: list($language,) = explode('_', $locale);
35: if ($language != $locale) {
36: $class = 'Horde_Support_Numerizer_Locale_' . $language;
37: if (class_exists($class)) {
38: return new $class($args);
39: }
40: }
41: }
42:
43: return new Horde_Support_Numerizer_Locale_Base($args);
44: }
45:
46: }
47: