From 3e26469375ba59167a3f3964c7bb851026b53a5c Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 8 Jan 2007 00:11:06 +0000 Subject: [PATCH] Load locale specific php code in global context. fixes #3488 git-svn-id: http://svn.automattic.com/wordpress/trunk@4699 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/locale.php | 16 ++++------------ wp-settings.php | 5 +++++ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/wp-includes/locale.php b/wp-includes/locale.php index 0d20e5b09..8487ad23f 100644 --- a/wp-includes/locale.php +++ b/wp-includes/locale.php @@ -87,20 +87,12 @@ class WP_Locale { $this->meridiem['AM'] = __('AM'); $this->meridiem['PM'] = __('PM'); - $this->_load_locale_data(); - } - - function _load_locale_data() { - $locale = get_locale(); - $locale_file = ABSPATH . "wp-includes/languages/$locale.php"; - if ( !file_exists($locale_file) ) - return; - - include($locale_file); - + // Import global locale vars set during inclusion of $locale.php. foreach ( $this->locale_vars as $var ) { - $this->$var = $$var; + if ( isset($GLOBALS[$var]) ) + $this->$var = $GLOBALS[$var]; } + } function get_weekday($weekday_number) { diff --git a/wp-settings.php b/wp-settings.php index f86ae86e7..4048ae673 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -242,6 +242,11 @@ define('STYLESHEETPATH', get_stylesheet_directory()); // Load the default text localization domain. load_default_textdomain(); +$locale = get_locale(); +$locale_file = ABSPATH . LANGDIR . "/$locale.php"; +if ( is_readable($locale_file) ) + require_once($locale_file); + // Pull in locale data after loading text domain. require_once(ABSPATH . WPINC . '/locale.php');