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