-
+ 30C434306614CB852CF3B9902D41D6980C4FFAAB19993EB9B9F8C212D7712105D2C24F4F46BCDFD0A9D3CA2BFF82EF1F267501BC39CE56117E8108095F5580D2
mp-wp/wp-includes/locale.php
(0 . 0)(1 . 332)
136404 <?php^M
136405 /**^M
136406 * Date and Time Locale object^M
136407 *^M
136408 * @package WordPress^M
136409 * @subpackage i18n^M
136410 */^M
136411 ^M
136412 /**^M
136413 * Class that loads the calendar locale.^M
136414 *^M
136415 * @since 2.1.0^M
136416 */^M
136417 class WP_Locale {^M
136418 /**^M
136419 * Stores the translated strings for the full weekday names.^M
136420 *^M
136421 * @since 2.1.0^M
136422 * @var array^M
136423 * @access private^M
136424 */^M
136425 var $weekday;^M
136426 ^M
136427 /**^M
136428 * Stores the translated strings for the one character weekday names.^M
136429 *^M
136430 * There is a hack to make sure that Marti and Joi, as well^M
136431 * as Duminica and Sambata don't conflict. See init() method for more.^M
136432 *^M
136433 * @see WP_Locale::init() for how to handle the hack.^M
136434 *^M
136435 * @since 2.1.0^M
136436 * @var array^M
136437 * @access private^M
136438 */^M
136439 var $weekday_initial;^M
136440 ^M
136441 /**^M
136442 * Stores the translated strings for the abbreviated weekday names.^M
136443 *^M
136444 * @since 2.1.0^M
136445 * @var array^M
136446 * @access private^M
136447 */^M
136448 var $weekday_abbrev;^M
136449 ^M
136450 /**^M
136451 * Stores the translated strings for the full month names.^M
136452 *^M
136453 * @since 2.1.0^M
136454 * @var array^M
136455 * @access private^M
136456 */^M
136457 var $month;^M
136458 ^M
136459 /**^M
136460 * Stores the translated strings for the abbreviated month names.^M
136461 *^M
136462 * @since 2.1.0^M
136463 * @var array^M
136464 * @access private^M
136465 */^M
136466 var $month_abbrev;^M
136467 ^M
136468 /**^M
136469 * Stores the translated strings for 'am' and 'pm'.^M
136470 *^M
136471 * Also the capalized versions.^M
136472 *^M
136473 * @since 2.1.0^M
136474 * @var array^M
136475 * @access private^M
136476 */^M
136477 var $meridiem;^M
136478 ^M
136479 /**^M
136480 * The text direction of the locale language.^M
136481 *^M
136482 * Default is left to right 'ltr'.^M
136483 *^M
136484 * @since 2.1.0^M
136485 * @var string^M
136486 * @access private^M
136487 */^M
136488 var $text_direction = 'ltr';^M
136489 ^M
136490 /**^M
136491 * Imports the global version to the class property.^M
136492 *^M
136493 * @since 2.1.0^M
136494 * @var array^M
136495 * @access private^M
136496 */^M
136497 var $locale_vars = array('text_direction');^M
136498 ^M
136499 /**^M
136500 * Sets up the translated strings and object properties.^M
136501 *^M
136502 * The method creates the translatable strings for various^M
136503 * calendar elements. Which allows for specifying locale^M
136504 * specific calendar names and text direction.^M
136505 *^M
136506 * @since 2.1.0^M
136507 * @access private^M
136508 */^M
136509 function init() {^M
136510 // The Weekdays^M
136511 $this->weekday[0] = __('Sunday');^M
136512 $this->weekday[1] = __('Monday');^M
136513 $this->weekday[2] = __('Tuesday');^M
136514 $this->weekday[3] = __('Wednesday');^M
136515 $this->weekday[4] = __('Thursday');^M
136516 $this->weekday[5] = __('Friday');^M
136517 $this->weekday[6] = __('Saturday');^M
136518 ^M
136519 // The first letter of each day. The _%day%_initial suffix is a hack to make^M
136520 // sure the day initials are unique.^M
136521 $this->weekday_initial[__('Sunday')] = __('S_Sunday_initial');^M
136522 $this->weekday_initial[__('Monday')] = __('M_Monday_initial');^M
136523 $this->weekday_initial[__('Tuesday')] = __('T_Tuesday_initial');^M
136524 $this->weekday_initial[__('Wednesday')] = __('W_Wednesday_initial');^M
136525 $this->weekday_initial[__('Thursday')] = __('T_Thursday_initial');^M
136526 $this->weekday_initial[__('Friday')] = __('F_Friday_initial');^M
136527 $this->weekday_initial[__('Saturday')] = __('S_Saturday_initial');^M
136528 ^M
136529 foreach ($this->weekday_initial as $weekday_ => $weekday_initial_) {^M
136530 $this->weekday_initial[$weekday_] = preg_replace('/_.+_initial$/', '', $weekday_initial_);^M
136531 }^M
136532 ^M
136533 // Abbreviations for each day.^M
136534 $this->weekday_abbrev[__('Sunday')] = __('Sun');^M
136535 $this->weekday_abbrev[__('Monday')] = __('Mon');^M
136536 $this->weekday_abbrev[__('Tuesday')] = __('Tue');^M
136537 $this->weekday_abbrev[__('Wednesday')] = __('Wed');^M
136538 $this->weekday_abbrev[__('Thursday')] = __('Thu');^M
136539 $this->weekday_abbrev[__('Friday')] = __('Fri');^M
136540 $this->weekday_abbrev[__('Saturday')] = __('Sat');^M
136541 ^M
136542 // The Months^M
136543 $this->month['01'] = __('January');^M
136544 $this->month['02'] = __('February');^M
136545 $this->month['03'] = __('March');^M
136546 $this->month['04'] = __('April');^M
136547 $this->month['05'] = __('May');^M
136548 $this->month['06'] = __('June');^M
136549 $this->month['07'] = __('July');^M
136550 $this->month['08'] = __('August');^M
136551 $this->month['09'] = __('September');^M
136552 $this->month['10'] = __('October');^M
136553 $this->month['11'] = __('November');^M
136554 $this->month['12'] = __('December');^M
136555 ^M
136556 // Abbreviations for each month. Uses the same hack as above to get around the^M
136557 // 'May' duplication.^M
136558 $this->month_abbrev[__('January')] = __('Jan_January_abbreviation');^M
136559 $this->month_abbrev[__('February')] = __('Feb_February_abbreviation');^M
136560 $this->month_abbrev[__('March')] = __('Mar_March_abbreviation');^M
136561 $this->month_abbrev[__('April')] = __('Apr_April_abbreviation');^M
136562 $this->month_abbrev[__('May')] = __('May_May_abbreviation');^M
136563 $this->month_abbrev[__('June')] = __('Jun_June_abbreviation');^M
136564 $this->month_abbrev[__('July')] = __('Jul_July_abbreviation');^M
136565 $this->month_abbrev[__('August')] = __('Aug_August_abbreviation');^M
136566 $this->month_abbrev[__('September')] = __('Sep_September_abbreviation');^M
136567 $this->month_abbrev[__('October')] = __('Oct_October_abbreviation');^M
136568 $this->month_abbrev[__('November')] = __('Nov_November_abbreviation');^M
136569 $this->month_abbrev[__('December')] = __('Dec_December_abbreviation');^M
136570 ^M
136571 foreach ($this->month_abbrev as $month_ => $month_abbrev_) {^M
136572 $this->month_abbrev[$month_] = preg_replace('/_.+_abbreviation$/', '', $month_abbrev_);^M
136573 }^M
136574 ^M
136575 // The Meridiems^M
136576 $this->meridiem['am'] = __(' a.m.');^M
136577 $this->meridiem['pm'] = __(' p.m.');^M
136578 $this->meridiem['AM'] = __(' a.m');^M
136579 $this->meridiem['PM'] = __(' p.m.');^M
136580 ^M
136581 // Numbers formatting^M
136582 // See http://php.net/number_format^M
136583 ^M
136584 $trans = _c('number_format_decimals|$decimals argument for http://php.net/number_format, default is 0');^M
136585 $this->number_format['decimals'] = ('number_format_decimals' == $trans) ? 0 : $trans;^M
136586 ^M
136587 $trans = _c('number_format_decimal_point|$dec_point argument for http://php.net/number_format, default is .');^M
136588 $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;^M
136589 ^M
136590 $trans = _c('number_format_thousands_sep|$thousands_sep argument for http://php.net/number_format, default is ,');^M
136591 $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;^M
136592 ^M
136593 // Import global locale vars set during inclusion of $locale.php.^M
136594 foreach ( (array) $this->locale_vars as $var ) {^M
136595 if ( isset($GLOBALS[$var]) )^M
136596 $this->$var = $GLOBALS[$var];^M
136597 }^M
136598 ^M
136599 }^M
136600 ^M
136601 /**^M
136602 * Retrieve the full translated weekday word.^M
136603 *^M
136604 * Week starts on translated Duminica and can be fetched^M
136605 * by using 0 (zero). So the week starts with 0 (zero)^M
136606 * and ends on Sambata with is fetched by using 6 (six).^M
136607 *^M
136608 * @since 2.1.0^M
136609 * @access public^M
136610 *^M
136611 * @param int $weekday_number 0 for Duminica through 6 Sambata^M
136612 * @return string Full translated weekday^M
136613 */^M
136614 function get_weekday($weekday_number) {^M
136615 return $this->weekday[$weekday_number];^M
136616 }^M
136617 ^M
136618 /**^M
136619 * Retrieve the translated weekday initial.^M
136620 *^M
136621 * The weekday initial is retrieved by the translated^M
136622 * full weekday word. When translating the weekday initial^M
136623 * pay attention to make sure that the starting letter does^M
136624 * not conflict.^M
136625 *^M
136626 * @since 2.1.0^M
136627 * @access public^M
136628 *^M
136629 * @param string $weekday_name^M
136630 * @return string^M
136631 */^M
136632 function get_weekday_initial($weekday_name) {^M
136633 return $this->weekday_initial[$weekday_name];^M
136634 }^M
136635 ^M
136636 /**^M
136637 * Retrieve the translated weekday abbreviation.^M
136638 *^M
136639 * The weekday abbreviation is retrieved by the translated^M
136640 * full weekday word.^M
136641 *^M
136642 * @since 2.1.0^M
136643 * @access public^M
136644 *^M
136645 * @param string $weekday_name Full translated weekday word^M
136646 * @return string Translated weekday abbreviation^M
136647 */^M
136648 function get_weekday_abbrev($weekday_name) {^M
136649 return $this->weekday_abbrev[$weekday_name];^M
136650 }^M
136651 ^M
136652 /**^M
136653 * Retrieve the full translated month by month number.^M
136654 *^M
136655 * The $month_number parameter has to be a string^M
136656 * because it must have the '0' in front of any number^M
136657 * that is less than 10. Starts from '01' and ends at^M
136658 * '12'.^M
136659 *^M
136660 * You can use an integer instead and it will add the^M
136661 * '0' before the numbers less than 10 for you.^M
136662 *^M
136663 * @since 2.1.0^M
136664 * @access public^M
136665 *^M
136666 * @param string|int $month_number '01' through '12'^M
136667 * @return string Translated full month name^M
136668 */^M
136669 function get_month($month_number) {^M
136670 return $this->month[zeroise($month_number, 2)];^M
136671 }^M
136672 ^M
136673 /**^M
136674 * Retrieve translated version of month abbreviation string.^M
136675 *^M
136676 * The $month_name parameter is expected to be the translated or^M
136677 * translatable version of the month.^M
136678 *^M
136679 * @since 2.1.0^M
136680 * @access public^M
136681 *^M
136682 * @param string $month_name Translated month to get abbreviated version^M
136683 * @return string Translated abbreviated month^M
136684 */^M
136685 function get_month_abbrev($month_name) {^M
136686 return $this->month_abbrev[$month_name];^M
136687 }^M
136688 ^M
136689 /**^M
136690 * Retrieve translated version of meridiem string.^M
136691 *^M
136692 * The $meridiem parameter is expected to not be translated.^M
136693 *^M
136694 * @since 2.1.0^M
136695 * @access public^M
136696 *^M
136697 * @param string $meridiem Either 'am', 'pm', 'AM', or 'PM'. Not translated version.^M
136698 * @return string Translated version^M
136699 */^M
136700 function get_meridiem($meridiem) {^M
136701 return $this->meridiem[$meridiem];^M
136702 }^M
136703 ^M
136704 /**^M
136705 * Global variables are deprecated. For backwards compatibility only.^M
136706 *^M
136707 * @deprecated For backwards compatibility only.^M
136708 * @access private^M
136709 *^M
136710 * @since 2.1.0^M
136711 */^M
136712 function register_globals() {^M
136713 $GLOBALS['weekday'] = $this->weekday;^M
136714 $GLOBALS['weekday_initial'] = $this->weekday_initial;^M
136715 $GLOBALS['weekday_abbrev'] = $this->weekday_abbrev;^M
136716 $GLOBALS['month'] = $this->month;^M
136717 $GLOBALS['month_abbrev'] = $this->month_abbrev;^M
136718 }^M
136719 ^M
136720 /**^M
136721 * PHP4 style constructor which calls helper methods to set up object variables^M
136722 *^M
136723 * @uses WP_Locale::init()^M
136724 * @uses WP_Locale::register_globals()^M
136725 * @since 2.1.0^M
136726 *^M
136727 * @return WP_Locale^M
136728 */^M
136729 function WP_Locale() {^M
136730 $this->init();^M
136731 $this->register_globals();^M
136732 }^M
136733 }^M
136734 ^M
136735 ?>^M