3
* These functions are needed to load WordPress.
5
* @internal This file must be parsable by PHP4.
11
* Turn register globals off.
16
* @return null Will return null if register_globals PHP directive was disabled.
18
function wp_unregister_GLOBALS() {
19
if ( !ini_get( 'register_globals' ) )
22
if ( isset( $_REQUEST['GLOBALS'] ) )
23
die( 'GLOBALS overwrite attempt detected' );
25
// Variables that shouldn't be unset
26
$no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );
28
$input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );
29
foreach ( $input as $k => $v )
30
if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) {
31
unset( $GLOBALS[$k] );
36
* Fix `$_SERVER` variables for various setups.
41
* @global string $PHP_SELF The filename of the currently executing script,
42
* relative to the document root.
44
function wp_fix_server_vars() {
47
$default_server_values = array(
48
'SERVER_SOFTWARE' => '',
52
$_SERVER = array_merge( $default_server_values, $_SERVER );
54
// Fix for IIS when running with PHP ISAPI
55
if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
58
if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) {
59
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
62
else if ( isset( $_SERVER['HTTP_X_REWRITE_URL'] ) ) {
63
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
65
// Use ORIG_PATH_INFO if there is no PATH_INFO
66
if ( !isset( $_SERVER['PATH_INFO'] ) && isset( $_SERVER['ORIG_PATH_INFO'] ) )
67
$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
69
// Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
70
if ( isset( $_SERVER['PATH_INFO'] ) ) {
71
if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
72
$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
74
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
77
// Append the query string if it exists and isn't null
78
if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
79
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
84
// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
85
if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) )
86
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
88
// Fix for Dreamhost and other PHP as CGI hosts
89
if ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false )
90
unset( $_SERVER['PATH_INFO'] );
93
$PHP_SELF = $_SERVER['PHP_SELF'];
94
if ( empty( $PHP_SELF ) )
95
$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace( '/(\?.*)?$/', '', $_SERVER["REQUEST_URI"] );
99
* Check for the required PHP version, and the MySQL extension or
100
* a database drop-in.
102
* Dies if requirements are not met.
107
* @global string $required_php_version The required PHP version string.
108
* @global string $wp_version The WordPress version string.
110
function wp_check_php_mysql_versions() {
111
global $required_php_version, $wp_version;
112
$php_version = phpversion();
114
if ( version_compare( $required_php_version, $php_version, '>' ) ) {
115
wp_load_translations_early();
116
header( 'Content-Type: text/html; charset=utf-8' );
117
die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) );
120
if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
121
wp_load_translations_early();
122
header( 'Content-Type: text/html; charset=utf-8' );
123
die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
128
* Don't load all of WordPress when handling a favicon.ico request.
130
* Instead, send the headers for a zero-length favicon and bail.
134
function wp_favicon_request() {
135
if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) {
136
header('Content-Type: image/vnd.microsoft.icon');
137
header('Content-Length: 0');
143
* Die with a maintenance message when conditions are met.
145
* Checks for a file in the WordPress root directory named ".maintenance".
146
* This file will contain the variable $upgrading, set to the time the file
147
* was created. If the file was created less than 10 minutes ago, WordPress
148
* enters maintenance mode and displays a message.
150
* The default message can be replaced by using a drop-in (maintenance.php in
151
* the wp-content directory).
156
* @global int $upgrading the unix timestamp marking when upgrading WordPress began.
158
function wp_maintenance() {
159
if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) )
164
include( ABSPATH . '.maintenance' );
165
// If the $upgrading timestamp is older than 10 minutes, don't die.
166
if ( ( time() - $upgrading ) >= 600 )
169
if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
170
require_once( WP_CONTENT_DIR . '/maintenance.php' );
174
wp_load_translations_early();
176
$protocol = $_SERVER["SERVER_PROTOCOL"];
177
if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
178
$protocol = 'HTTP/1.0';
179
header( "$protocol 503 Service Unavailable", true, 503 );
180
header( 'Content-Type: text/html; charset=utf-8' );
181
header( 'Retry-After: 600' );
184
<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
186
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
187
<title><?php _e( 'Maintenance' ); ?></title>
191
<h1><?php _e( 'Briefly unavailable for scheduled maintenance. Check back in a minute.' ); ?></h1>
199
* Start the WordPress micro-timer.
204
* @global float $timestart Unix timestamp set at the beginning of the page load.
207
* @return bool Always returns true.
209
function timer_start() {
211
$timestart = microtime( true );
216
* Retrieve or display the time from the page start to when function is called.
220
* @global float $timestart Seconds from when timer_start() is called.
221
* @global float $timeend Seconds from when function is called.
223
* @param int $display Whether to echo or return the results. Accepts 0|false for return,
224
* 1|true for echo. Default 0|false.
225
* @param int $precision The number of digits from the right of the decimal to display.
227
* @return string The "second.microsecond" finished time calculation. The number is formatted
228
* for human consumption, both localized and rounded.
230
function timer_stop( $display = 0, $precision = 3 ) {
231
global $timestart, $timeend;
232
$timeend = microtime( true );
233
$timetotal = $timeend - $timestart;
234
$r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision );
241
* Set PHP error reporting based on WordPress debug settings.
243
* Uses three constants: `WP_DEBUG`, `WP_DEBUG_DISPLAY`, and `WP_DEBUG_LOG`.
244
* All three can be defined in wp-config.php, and by default are set to false.
246
* When `WP_DEBUG` is true, all PHP notices are reported. WordPress will also
247
* display internal notices: when a deprecated WordPress function, function
248
* argument, or file is used. Deprecated code may be removed from a later
251
* It is strongly recommended that plugin and theme developers use `WP_DEBUG`
252
* in their development environments.
254
* `WP_DEBUG_DISPLAY` and `WP_DEBUG_LOG` perform no function unless `WP_DEBUG`
257
* When `WP_DEBUG_DISPLAY` is true, WordPress will force errors to be displayed.
258
* `WP_DEBUG_DISPLAY` defaults to true. Defining it as null prevents WordPress
259
* from changing the global configuration setting. Defining `WP_DEBUG_DISPLAY`
260
* as false will force errors to be hidden.
262
* When `WP_DEBUG_LOG` is true, errors will be logged to debug.log in the content
265
* Errors are never displayed for XML-RPC requests.
270
function wp_debug_mode() {
272
error_reporting( E_ALL );
274
if ( WP_DEBUG_DISPLAY )
275
ini_set( 'display_errors', 1 );
276
elseif ( null !== WP_DEBUG_DISPLAY )
277
ini_set( 'display_errors', 0 );
279
if ( WP_DEBUG_LOG ) {
280
ini_set( 'log_errors', 1 );
281
ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
284
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
286
if ( defined( 'XMLRPC_REQUEST' ) )
287
ini_set( 'display_errors', 0 );
291
* Set the location of the language directory.
293
* To set directory manually, define the `WP_LANG_DIR` constant
296
* If the language directory exists within `WP_CONTENT_DIR`, it
297
* is used. Otherwise the language directory is assumed to live
303
function wp_set_lang_dir() {
304
if ( !defined( 'WP_LANG_DIR' ) ) {
305
if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || !@is_dir(ABSPATH . WPINC . '/languages') ) {
307
* Server path of the language directory.
309
* No leading slash, no trailing slash, full path, not relative to ABSPATH
313
define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' );
314
if ( !defined( 'LANGDIR' ) ) {
315
// Old static relative path maintained for limited backwards compatibility - won't work in some cases
316
define( 'LANGDIR', 'wp-content/languages' );
320
* Server path of the language directory.
322
* No leading slash, no trailing slash, full path, not relative to `ABSPATH`.
326
define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' );
327
if ( !defined( 'LANGDIR' ) ) {
328
// Old relative path maintained for backwards compatibility
329
define( 'LANGDIR', WPINC . '/languages' );
336
* Load the database class file and instantiate the `$wpdb` global.
340
* @global wpdb $wpdb The WordPress database class.
342
function require_wp_db() {
345
require_once( ABSPATH . WPINC . '/wp-db.php' );
346
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
347
require_once( WP_CONTENT_DIR . '/db.php' );
349
if ( isset( $wpdb ) )
352
$wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
356
* Set the database table prefix and the format specifiers for database
359
* Columns not listed here default to `%s`.
364
* @global wpdb $wpdb The WordPress database class.
365
* @global string $table_prefix The database table prefix.
367
function wp_set_wpdb_vars() {
368
global $wpdb, $table_prefix;
369
if ( !empty( $wpdb->error ) )
372
$wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d',
373
'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'comment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d',
374
'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d',
375
'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d',
377
'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d',
380
$prefix = $wpdb->set_prefix( $table_prefix );
382
if ( is_wp_error( $prefix ) ) {
383
wp_load_translations_early();
384
wp_die( __( '<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.' ) );
389
* Access/Modify private global variable `$_wp_using_ext_object_cache`.
391
* Toggle `$_wp_using_ext_object_cache` on and off without directly
396
* @param bool $using Whether external object cache is being used.
397
* @return bool The current 'using' setting.
399
function wp_using_ext_object_cache( $using = null ) {
400
global $_wp_using_ext_object_cache;
401
$current_using = $_wp_using_ext_object_cache;
402
if ( null !== $using )
403
$_wp_using_ext_object_cache = $using;
404
return $current_using;
408
* Start the WordPress object cache.
410
* If an object-cache.php file exists in the wp-content directory,
411
* it uses that drop-in as an external object cache.
416
* @global int $blog_id Blog ID.
418
function wp_start_object_cache() {
422
if ( ! function_exists( 'wp_cache_init' ) ) {
423
if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
424
require_once ( WP_CONTENT_DIR . '/object-cache.php' );
425
if ( function_exists( 'wp_cache_init' ) )
426
wp_using_ext_object_cache( true );
430
} else if ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
432
* Sometimes advanced-cache.php can load object-cache.php before
433
* it is loaded here. This breaks the function_exists check above
434
* and can result in `$_wp_using_ext_object_cache` being set
435
* incorrectly. Double check if an external cache exists.
437
wp_using_ext_object_cache( true );
440
if ( ! wp_using_ext_object_cache() )
441
require_once ( ABSPATH . WPINC . '/cache.php' );
444
* If cache supports reset, reset instead of init if already
445
* initialized. Reset signals to the cache that global IDs
446
* have changed and it may need to update keys and cleanup caches.
448
if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) )
449
wp_cache_switch_to_blog( $blog_id );
450
elseif ( function_exists( 'wp_cache_init' ) )
453
if ( function_exists( 'wp_cache_add_global_groups' ) ) {
454
wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache' ) );
455
wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) );
460
* Redirect to the installer if WordPress is not installed.
462
* Dies with an error message when Multisite is enabled.
467
function wp_not_installed() {
468
if ( is_multisite() ) {
469
if ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) {
472
wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) );
474
} elseif ( ! is_blog_installed() && false === strpos( $_SERVER['PHP_SELF'], 'install.php' ) && !defined( 'WP_INSTALLING' ) ) {
477
require( ABSPATH . WPINC . '/kses.php' );
478
require( ABSPATH . WPINC . '/pluggable.php' );
479
require( ABSPATH . WPINC . '/formatting.php' );
481
$link = wp_guess_url() . '/wp-admin/install.php';
483
wp_redirect( $link );
489
* Retrieve an array of must-use plugin files.
491
* The default directory is wp-content/mu-plugins. To change the default
492
* directory manually, define `WPMU_PLUGIN_DIR` and `WPMU_PLUGIN_URL`
498
* @return array Files to include.
500
function wp_get_mu_plugins() {
501
$mu_plugins = array();
502
if ( !is_dir( WPMU_PLUGIN_DIR ) )
504
if ( ! $dh = opendir( WPMU_PLUGIN_DIR ) )
506
while ( ( $plugin = readdir( $dh ) ) !== false ) {
507
if ( substr( $plugin, -4 ) == '.php' )
508
$mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
517
* Retrieve an array of active and valid plugin files.
519
* While upgrading or installing WordPress, no plugins are returned.
521
* The default directory is wp-content/plugins. To change the default
522
* directory manually, define `WP_PLUGIN_DIR` and `WP_PLUGIN_URL`
528
* @return array Files.
530
function wp_get_active_and_valid_plugins() {
532
$active_plugins = (array) get_option( 'active_plugins', array() );
534
// Check for hacks file if the option is enabled
535
if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
536
_deprecated_file( 'my-hacks.php', '1.5' );
537
array_unshift( $plugins, ABSPATH . 'my-hacks.php' );
540
if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) )
543
$network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
545
foreach ( $active_plugins as $plugin ) {
546
if ( ! validate_file( $plugin ) // $plugin must validate as file
547
&& '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
548
&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
549
// not already included as a network plugin
550
&& ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins ) )
552
$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
558
* Set internal encoding.
560
* In most cases the default internal encoding is latin1, which is
561
* of no use, since we want to use the `mb_` functions for `utf-8` strings.
566
function wp_set_internal_encoding() {
567
if ( function_exists( 'mb_internal_encoding' ) ) {
568
$charset = get_option( 'blog_charset' );
569
if ( ! $charset || ! @mb_internal_encoding( $charset ) )
570
mb_internal_encoding( 'UTF-8' );
575
* Add magic quotes to `$_GET`, `$_POST`, `$_COOKIE`, and `$_SERVER`.
577
* Also forces `$_REQUEST` to be `$_GET + $_POST`. If `$_SERVER`,
578
* `$_COOKIE`, or `$_ENV` are needed, use those superglobals directly.
583
function wp_magic_quotes() {
584
// If already slashed, strip.
585
if ( get_magic_quotes_gpc() ) {
586
$_GET = stripslashes_deep( $_GET );
587
$_POST = stripslashes_deep( $_POST );
588
$_COOKIE = stripslashes_deep( $_COOKIE );
592
$_GET = add_magic_quotes( $_GET );
593
$_POST = add_magic_quotes( $_POST );
594
$_COOKIE = add_magic_quotes( $_COOKIE );
595
$_SERVER = add_magic_quotes( $_SERVER );
597
// Force REQUEST to be GET + POST.
598
$_REQUEST = array_merge( $_GET, $_POST );
602
* Runs just before PHP shuts down execution.
607
function shutdown_action_hook() {
609
* Fires just before PHP shuts down execution.
613
do_action( 'shutdown' );
624
* @param object $object The object to clone.
625
* @return object The cloned object.
627
function wp_clone( $object ) {
628
// Use parens for clone to accommodate PHP 4. See #17880
629
return clone( $object );
633
* Whether the current request is for an administrative interface page.
635
* Does not check if the user is an administrator; {@see current_user_can()}
636
* for checking roles and capabilities.
640
* @return bool True if inside WordPress administration interface, false otherwise.
642
function is_admin() {
643
if ( isset( $GLOBALS['current_screen'] ) )
644
return $GLOBALS['current_screen']->in_admin();
645
elseif ( defined( 'WP_ADMIN' ) )
652
* Whether the current request is for a site's admininstrative interface.
656
* Does not check if the user is an administrator; {@see current_user_can()}
657
* for checking roles and capabilities.
661
* @return bool True if inside WordPress blog administration pages.
663
function is_blog_admin() {
664
if ( isset( $GLOBALS['current_screen'] ) )
665
return $GLOBALS['current_screen']->in_admin( 'site' );
666
elseif ( defined( 'WP_BLOG_ADMIN' ) )
667
return WP_BLOG_ADMIN;
673
* Whether the current request is for the network administrative interface.
675
* e.g. `/wp-admin/network/`
677
* Does not check if the user is an administrator; {@see current_user_can()}
678
* for checking roles and capabilities.
682
* @return bool True if inside WordPress network administration pages.
684
function is_network_admin() {
685
if ( isset( $GLOBALS['current_screen'] ) )
686
return $GLOBALS['current_screen']->in_admin( 'network' );
687
elseif ( defined( 'WP_NETWORK_ADMIN' ) )
688
return WP_NETWORK_ADMIN;
694
* Whether the current request is for a user admin screen.
696
* e.g. `/wp-admin/user/`
698
* Does not inform on whether the user is an admin! Use capability
699
* checks to tell if the user should be accessing a section or not
700
* {@see current_user_can()}.
704
* @return bool True if inside WordPress user administration pages.
706
function is_user_admin() {
707
if ( isset( $GLOBALS['current_screen'] ) )
708
return $GLOBALS['current_screen']->in_admin( 'user' );
709
elseif ( defined( 'WP_USER_ADMIN' ) )
710
return WP_USER_ADMIN;
716
* If Multisite is enabled.
720
* @return bool True if Multisite is enabled, false otherwise.
722
function is_multisite() {
723
if ( defined( 'MULTISITE' ) )
726
if ( defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) )
733
* Retrieve the current blog ID.
737
* @return int Blog id
739
function get_current_blog_id() {
741
return absint($blog_id);
745
* Attempt an early load of translations.
747
* Used for errors encountered during the initial loading process, before
748
* the locale has been properly detected and loaded.
750
* Designed for unusual load sequences (like setup-config.php) or for when
751
* the script will then terminate with an error, otherwise there is a risk
752
* that a file can be double-included.
757
* @global $wp_locale The WordPress date and time locale object.
759
function wp_load_translations_early() {
760
global $text_direction, $wp_locale;
762
static $loaded = false;
767
if ( function_exists( 'did_action' ) && did_action( 'init' ) )
770
// We need $wp_local_package
771
require ABSPATH . WPINC . '/version.php';
773
// Translation and localization
774
require_once ABSPATH . WPINC . '/pomo/mo.php';
775
require_once ABSPATH . WPINC . '/l10n.php';
776
require_once ABSPATH . WPINC . '/locale.php';
779
require_once ABSPATH . WPINC . '/plugin.php';
781
$locales = $locations = array();
784
if ( defined( 'WPLANG' ) ) {
790
if ( isset( $wp_local_package ) )
791
$locales[] = $wp_local_package;
796
if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) )
797
$locations[] = WP_LANG_DIR;
799
if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) )
800
$locations[] = WP_CONTENT_DIR . '/languages';
802
if ( @is_dir( ABSPATH . 'wp-content/languages' ) )
803
$locations[] = ABSPATH . 'wp-content/languages';
805
if ( @is_dir( ABSPATH . WPINC . '/languages' ) )
806
$locations[] = ABSPATH . WPINC . '/languages';
811
$locations = array_unique( $locations );
813
foreach ( $locales as $locale ) {
814
foreach ( $locations as $location ) {
815
if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
816
load_textdomain( 'default', $location . '/' . $locale . '.mo' );
817
if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) )
818
load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
827
$wp_locale = new WP_Locale();