diff options
| -rw-r--r-- | admin_trees_config.php | 15 | ||||
| -rw-r--r-- | app/Date.php | 17 | ||||
| -rw-r--r-- | app/Date/CalendarDate.php | 9 | ||||
| -rw-r--r-- | app/Date/FrenchDate.php | 5 | ||||
| -rw-r--r-- | app/Date/GregorianDate.php | 6 | ||||
| -rw-r--r-- | app/Date/HijriDate.php | 6 | ||||
| -rw-r--r-- | app/Date/JalaliDate.php | 6 | ||||
| -rw-r--r-- | app/Date/JewishDate.php | 6 | ||||
| -rw-r--r-- | app/Date/JulianDate.php | 6 | ||||
| -rw-r--r-- | app/Module/YahrzeitModule.php | 4 | ||||
| -rw-r--r-- | calendar.php | 9 |
11 files changed, 23 insertions, 66 deletions
diff --git a/admin_trees_config.php b/admin_trees_config.php index 8d4d6ff9a7..62e31f26e2 100644 --- a/admin_trees_config.php +++ b/admin_trees_config.php @@ -30,19 +30,10 @@ require './includes/session.php'; $controller = new PageController; $controller->restrictAccess(Auth::isManager($WT_TREE)); +$calendars = array('none' => I18N::translate('No calendar conversion')) + Date::calendarNames(); -$calendars = array( - 'none' => I18N::translate('No calendar conversion'), - 'gregorian' => GregorianDate::calendarName(), - 'julian' => JulianDate::calendarName(), - 'french' => FrenchDate::calendarName(), - 'jewish' => JewishDate::calendarName(), - 'hijri' => HijriDate::calendarName(), - 'jalali' => JalaliDate::calendarName(), -); - -$french_calendar_start = new Date('22 SEP 1792'); -$french_calendar_end = new Date('31 DEC 1805'); +$french_calendar_start = new Date('22 SEP 1792'); +$french_calendar_end = new Date('31 DEC 1805'); $gregorian_calendar_start = new Date('15 OCT 1582'); $hide_show = array( diff --git a/app/Date.php b/app/Date.php index af93905dca..fb7f2a19f2 100644 --- a/app/Date.php +++ b/app/Date.php @@ -199,6 +199,23 @@ class Date { } } + + /** + * A list of supported calendars and their names. + * + * @return string[] + */ + public static function calendarNames() { + return array( + 'gregorian' => /* I18N: The gregorian calendar */ I18N::translate('Gregorian'), + 'julian' => /* I18N: The julian calendar */ I18N::translate('Julian'), + 'french' => /* I18N: The French calendar */ I18N::translate('French'), + 'jewish' => /* I18N: The Hebrew/Jewish calendar */ I18N::translate('Jewish'), + 'hijri' => /* I18N: The Arabic/Hijri calendar */ I18N::translate('Hijri'), + 'jalali' => /* I18N: The Persian/Jalali calendar */ I18N::translate('Jalali'), + ); + } + /** * Convert a date to the preferred format and calendar(s) display. * diff --git a/app/Date/CalendarDate.php b/app/Date/CalendarDate.php index 479ce76656..8ed5d31a89 100644 --- a/app/Date/CalendarDate.php +++ b/app/Date/CalendarDate.php @@ -136,15 +136,6 @@ class CalendarDate { } /** - * What is this calendar called? - * - * @return string - */ - public static function calendarName() { - return /* I18N: The French calendar */ I18N::translate('French'); - } - - /** * Is the current year a leap year? * * @return boolean diff --git a/app/Date/FrenchDate.php b/app/Date/FrenchDate.php index 79e765d8e9..ab6650a29b 100644 --- a/app/Date/FrenchDate.php +++ b/app/Date/FrenchDate.php @@ -38,11 +38,6 @@ class FrenchDate extends CalendarDate { } /** {@inheritdoc} */ - public static function calendarName() { - return /* I18N: The French calendar */ I18N::translate('French'); - } - - /** {@inheritdoc} */ public static function monthNameNominativeCase($month_number, $leap_year) { static $translated_month_names; diff --git a/app/Date/GregorianDate.php b/app/Date/GregorianDate.php index 8105dade2d..7f04c121a8 100644 --- a/app/Date/GregorianDate.php +++ b/app/Date/GregorianDate.php @@ -30,10 +30,4 @@ class GregorianDate extends CalendarDate { $this->calendar = new GregorianCalendar; parent::__construct($date); } - - /** {@inheritdoc} */ - public static function calendarName() { - return /* I18N: The gregorian calendar */ - I18N::translate('Gregorian'); - } } diff --git a/app/Date/HijriDate.php b/app/Date/HijriDate.php index a4693e0332..0a5d24afd3 100644 --- a/app/Date/HijriDate.php +++ b/app/Date/HijriDate.php @@ -38,12 +38,6 @@ class HijriDate extends CalendarDate { } /** {@inheritdoc} */ - public static function calendarName() { - return /* I18N: The Arabic/Hijri calendar */ - I18N::translate('Hijri'); - } - - /** {@inheritdoc} */ public static function monthNameNominativeCase($month_number, $leap_year) { static $translated_month_names; diff --git a/app/Date/JalaliDate.php b/app/Date/JalaliDate.php index 78e02381f4..88c7df638a 100644 --- a/app/Date/JalaliDate.php +++ b/app/Date/JalaliDate.php @@ -35,12 +35,6 @@ class JalaliDate extends CalendarDate { } /** {@inheritdoc} */ - public static function calendarName() { - return /* I18N: The Persian/Jalali calendar */ - I18N::translate('Jalali'); - } - - /** {@inheritdoc} */ public static function monthNameNominativeCase($month_number, $leap_year) { static $translated_month_names; diff --git a/app/Date/JewishDate.php b/app/Date/JewishDate.php index 5ddceb6887..c97b5944fe 100644 --- a/app/Date/JewishDate.php +++ b/app/Date/JewishDate.php @@ -39,12 +39,6 @@ class JewishDate extends CalendarDate { } /** {@inheritdoc} */ - public static function calendarName() { - return /* I18N: The Hebrew/Jewish calendar */ - I18N::translate('Jewish'); - } - - /** {@inheritdoc} */ function formatDayZeros() { if (WT_LOCALE == 'he') { return $this->numberToHebrewNumerals($this->d); diff --git a/app/Date/JulianDate.php b/app/Date/JulianDate.php index 45b3e1b9b9..995623afcc 100644 --- a/app/Date/JulianDate.php +++ b/app/Date/JulianDate.php @@ -35,12 +35,6 @@ class JulianDate extends CalendarDate { } /** {@inheritdoc} */ - public static function calendarName() { - return /* I18N: The julian calendar */ - I18N::translate('Julian'); - } - - /** {@inheritdoc} */ protected static function nextYear($year) { if ($year == -1) { return 1; diff --git a/app/Module/YahrzeitModule.php b/app/Module/YahrzeitModule.php index 00a4820daf..d7e444acc1 100644 --- a/app/Module/YahrzeitModule.php +++ b/app/Module/YahrzeitModule.php @@ -260,8 +260,8 @@ class YahrzeitModule extends AbstractModule implements ModuleBlockInterface { echo I18N::translate('Calendar'); echo '</td><td class="optionbox">'; echo select_edit_control('calendar', array( - 'jewish' => JewishDate::calendarName(), - 'gregorian'=> GregorianDate::calendarName(), + 'jewish' => /* I18N: The Hebrew/Jewish calendar */ I18N::translate('Jewish'), + 'gregorian'=> /* I18N: The gregorian calendar */ I18N::translate('Gregorian'), ), null, $calendar, ''); echo '</td></tr>'; diff --git a/calendar.php b/calendar.php index f6d42ae0dc..b49e57fb3e 100644 --- a/calendar.php +++ b/calendar.php @@ -350,14 +350,7 @@ if ($view === 'year') { } echo '</td><td class="topbottombar width50">'; $n = 0; -foreach (array( - 'gregorian' => GregorianDate::calendarName(), - 'julian' => JulianDate::calendarName(), - 'jewish' => JewishDate::calendarName(), - 'french' => FrenchDate::calendarName(), - 'hijri' => HijriDate::calendarName(), - 'jalali' => JalaliDate::calendarName(), -) as $newcal => $cal_name) { +foreach (Date::calendarNames() as $newcal => $cal_name) { $tmp = $cal_date->convertToCalendar($newcal); if ($tmp->inValidRange()) { if ($n++) { |
