function datex_factory in Datex 7.2
Same name and namespace in other branches
- 8 datex.module \datex_factory()
- 7.3 datex.module \datex_factory()
Factory for datex object.
3 calls to datex_factory()
- _datex_factory in ./
datex.module - Factory of datex object.
- _datex_factory_with_defaults in ./
datex.module - Factory of datex object with some default values.
- _datex_field_calendar in ./
datex_date.inc - Find suitable calendar for field.
File
- datex_api/
datex_api.class.inc, line 869 - Provides an API to work with dates.
Code
function datex_factory($locale, $dt = NULL, $tz = NULL, $fmt = NULL, $intl = NULL) {
switch (strtolower($locale)) {
case 'fa':
case 'farsi':
case 'parsi':
case 'persian':
case 'jalali':
case 'shamsi':
case 'iran':
case 'iranian':
$locale = 'Jalali';
break;
default:
throw new Exception('Datex: Unknown calendar.');
}
$datex = 'Datex' . $locale;
return new $datex($dt, $tz, $fmt, $intl);
}