[ Index ]

WordPress Source Cross Reference

title

Body

[close]

/wp-includes/ -> locale.php (source)

   1  <?php
   2  
   3  // Date and Time
   4  
   5  class WP_Locale {
   6      var $weekday;
   7      var $weekday_initial;
   8      var $weekday_abbrev;
   9  
  10      var $month;
  11      var $month_abbrev;
  12  
  13      var $meridiem;
  14  
  15  	function init() {
  16          // The Weekdays
  17          $this->weekday[0] = __('Sunday');
  18          $this->weekday[1] = __('Monday');
  19          $this->weekday[2] = __('Tuesday');
  20          $this->weekday[3] = __('Wednesday');
  21          $this->weekday[4] = __('Thursday');
  22          $this->weekday[5] = __('Friday');
  23          $this->weekday[6] = __('Saturday');
  24  
  25          // The first letter of each day.  The _%day%_initial suffix is a hack to make
  26          // sure the day initials are unique.
  27          $this->weekday_initial[__('Sunday')]    = __('S_Sunday_initial');
  28          $this->weekday_initial[__('Monday')]    = __('M_Monday_initial');
  29          $this->weekday_initial[__('Tuesday')]   = __('T_Tuesday_initial');
  30          $this->weekday_initial[__('Wednesday')] = __('W_Wednesday_initial');
  31          $this->weekday_initial[__('Thursday')]  = __('T_Thursday_initial');
  32          $this->weekday_initial[__('Friday')]    = __('F_Friday_initial');
  33          $this->weekday_initial[__('Saturday')]  = __('S_Saturday_initial');
  34  
  35          foreach ($this->weekday_initial as $weekday_ => $weekday_initial_) {
  36              $this->weekday_initial[$weekday_] = preg_replace('/_.+_initial$/', '', $weekday_initial_);
  37          }
  38  
  39          // Abbreviations for each day.
  40          $this->weekday_abbrev[__('Sunday')]    = __('Sun');
  41          $this->weekday_abbrev[__('Monday')]    = __('Mon');
  42          $this->weekday_abbrev[__('Tuesday')]   = __('Tue');
  43          $this->weekday_abbrev[__('Wednesday')] = __('Wed');
  44          $this->weekday_abbrev[__('Thursday')]  = __('Thu');
  45          $this->weekday_abbrev[__('Friday')]    = __('Fri');
  46          $this->weekday_abbrev[__('Saturday')]  = __('Sat');
  47  
  48          // The Months
  49          $this->month['01'] = __('January');
  50          $this->month['02'] = __('February');
  51          $this->month['03'] = __('March');
  52          $this->month['04'] = __('April');
  53          $this->month['05'] = __('May');
  54          $this->month['06'] = __('June');
  55          $this->month['07'] = __('July');
  56          $this->month['08'] = __('August');
  57          $this->month['09'] = __('September');
  58          $this->month['10'] = __('October');
  59          $this->month['11'] = __('November');
  60          $this->month['12'] = __('December');
  61  
  62          // Abbreviations for each month. Uses the same hack as above to get around the
  63          // 'May' duplication.
  64          $this->month_abbrev[__('January')] = __('Jan_January_abbreviation');
  65          $this->month_abbrev[__('February')] = __('Feb_February_abbreviation');
  66          $this->month_abbrev[__('March')] = __('Mar_March_abbreviation');
  67          $this->month_abbrev[__('April')] = __('Apr_April_abbreviation');
  68          $this->month_abbrev[__('May')] = __('May_May_abbreviation');
  69          $this->month_abbrev[__('June')] = __('Jun_June_abbreviation');
  70          $this->month_abbrev[__('July')] = __('Jul_July_abbreviation');
  71          $this->month_abbrev[__('August')] = __('Aug_August_abbreviation');
  72          $this->month_abbrev[__('September')] = __('Sep_September_abbreviation');
  73          $this->month_abbrev[__('October')] = __('Oct_October_abbreviation');
  74          $this->month_abbrev[__('November')] = __('Nov_November_abbreviation');
  75          $this->month_abbrev[__('December')] = __('Dec_December_abbreviation');
  76  
  77          foreach ($this->month_abbrev as $month_ => $month_abbrev_) {
  78              $this->month_abbrev[$month_] = preg_replace('/_.+_abbreviation$/', '', $month_abbrev_);
  79          }
  80  
  81          // The Meridiems
  82          $this->meridiem['am'] = __('am');
  83          $this->meridiem['pm'] = __('pm');
  84          $this->meridiem['AM'] = __('AM');
  85          $this->meridiem['PM'] = __('PM');
  86      }
  87  
  88  	function get_weekday($weekday_number) {
  89          return $this->weekday[$weekday_number];
  90      }
  91  
  92  	function get_weekday_initial($weekday_name) {
  93          return $this->weekday_initial[$weekday_name];
  94      }
  95  
  96  	function get_weekday_abbrev($weekday_name) {
  97          return $this->weekday_abbrev[$weekday_name];
  98      }
  99  
 100  	function get_month($month_number) {
 101          return $this->month[zeroise($month_number, 2)];
 102      }
 103  
 104  	function get_month_initial($month_name) {
 105          return $this->month_initial[$month_name];
 106      }
 107  
 108  	function get_month_abbrev($month_name) {
 109          return $this->month_abbrev[$month_name];
 110      }
 111  
 112  	function get_meridiem($meridiem) {
 113          return $this->meridiem[$meridiem];
 114      }
 115  
 116      // Global variables are deprecated. For backwards compatibility only.
 117  	function register_globals() {
 118          $GLOBALS['weekday']         = $this->weekday;
 119          $GLOBALS['weekday_initial'] = $this->weekday_initial;
 120          $GLOBALS['weekday_abbrev']  = $this->weekday_abbrev;
 121          $GLOBALS['month']           = $this->month;
 122          $GLOBALS['month_abbrev']    = $this->month_abbrev;
 123      }
 124  
 125  	function WP_Locale() {
 126          $this->init();
 127          $this->register_globals();
 128      }
 129  }
 130  
 131  ?>

Your comment here...

Name: Location:
Comments:


List: Classes | Functions | Variables | Constants | Tables

Generated: Sat Jul 15 11:57:04 2006 Courtesy of Taragana