3 * These functions are needed to load WordPress.
5 * @internal This file must be parsable by PHP4.
11 * Turn register globals off.
16 function wp_unregister_GLOBALS() {
17 if ( !ini_get( 'register_globals' ) )
20 if ( isset( $_REQUEST['GLOBALS'] ) )
21 die( 'GLOBALS overwrite attempt detected' );
23 // Variables that shouldn't be unset
24 $no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );
26 $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );
27 foreach ( $input as $k => $v )
28 if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) {
29 unset( $GLOBALS[$k] );
34 * Fix `$_SERVER` variables for various setups.
39 * @global string $PHP_SELF The filename of the currently executing script,
40 * relative to the document root.
42 function wp_fix_server_vars() {
45 $default_server_values = array(
46 'SERVER_SOFTWARE' => '',
50 $_SERVER = array_merge( $default_server_values, $_SERVER );
52 // Fix for IIS when running with PHP ISAPI
53 if ( empty( $_SERVER['REQUEST_URI'] ) || ( PHP_SAPI != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
56 if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) {
57 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
60 elseif ( isset( $_SERVER['HTTP_X_REWRITE_URL'] ) ) {
61 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
63 // Use ORIG_PATH_INFO if there is no PATH_INFO
64 if ( !isset( $_SERVER['PATH_INFO'] ) && isset( $_SERVER['ORIG_PATH_INFO'] ) )
65 $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
67 // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
68 if ( isset( $_SERVER['PATH_INFO'] ) ) {
69 if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
70 $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
72 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
75 // Append the query string if it exists and isn't null
76 if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
77 $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
82 // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
83 if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) )
84 $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
86 // Fix for Dreamhost and other PHP as CGI hosts
87 if ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false )
88 unset( $_SERVER['PATH_INFO'] );
91 $PHP_SELF = $_SERVER['PHP_SELF'];
92 if ( empty( $PHP_SELF ) )
93 $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace( '/(\?.*)?$/', '', $_SERVER["REQUEST_URI"] );
97 * Check for the required PHP version, and the MySQL extension or
100 * Dies if requirements are not met.
105 * @global string $required_php_version The required PHP version string.
106 * @global string $wp_version The WordPress version string.
108 function wp_check_php_mysql_versions() {
109 global $required_php_version, $wp_version;
110 $php_version = phpversion();
112 if ( version_compare( $required_php_version, $php_version, '>' ) ) {
113 wp_load_translations_early();
114 header( 'Content-Type: text/html; charset=utf-8' );
115 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 ) );
118 if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
119 wp_load_translations_early();
120 header( 'Content-Type: text/html; charset=utf-8' );
121 die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
126 * Don't load all of WordPress when handling a favicon.ico request.
128 * Instead, send the headers for a zero-length favicon and bail.
132 function wp_favicon_request() {
133 if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) {
134 header('Content-Type: image/vnd.microsoft.icon');
135 header('Content-Length: 0');
141 * Die with a maintenance message when conditions are met.
143 * Checks for a file in the WordPress root directory named ".maintenance".
144 * This file will contain the variable $upgrading, set to the time the file
145 * was created. If the file was created less than 10 minutes ago, WordPress
146 * enters maintenance mode and displays a message.
148 * The default message can be replaced by using a drop-in (maintenance.php in
149 * the wp-content directory).
154 * @global int $upgrading the unix timestamp marking when upgrading WordPress began.
156 function wp_maintenance() {
157 if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) )
162 include( ABSPATH . '.maintenance' );
163 // If the $upgrading timestamp is older than 10 minutes, don't die.
164 if ( ( time() - $upgrading ) >= 600 )
167 if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
168 require_once( WP_CONTENT_DIR . '/maintenance.php' );
172 wp_load_translations_early();
174 $protocol = $_SERVER["SERVER_PROTOCOL"];
175 if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
176 $protocol = 'HTTP/1.0';
177 header( "$protocol 503 Service Unavailable", true, 503 );
178 header( 'Content-Type: text/html; charset=utf-8' );
179 header( 'Retry-After: 600' );
182 <html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
184 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
185 <title><?php _e( 'Maintenance' ); ?></title>
189 <h1><?php _e( 'Briefly unavailable for scheduled maintenance. Check back in a minute.' ); ?></h1>
197 * Start the WordPress micro-timer.
202 * @global float $timestart Unix timestamp set at the beginning of the page load.
205 * @return bool Always returns true.
207 function timer_start() {
209 $timestart = microtime( true );
214 * Retrieve or display the time from the page start to when function is called.
218 * @global float $timestart Seconds from when timer_start() is called.
219 * @global float $timeend Seconds from when function is called.
221 * @param int|bool $display Whether to echo or return the results. Accepts 0|false for return,
222 * 1|true for echo. Default 0|false.
223 * @param int $precision The number of digits from the right of the decimal to display.
225 * @return string The "second.microsecond" finished time calculation. The number is formatted
226 * for human consumption, both localized and rounded.
228 function timer_stop( $display = 0, $precision = 3 ) {
229 global $timestart, $timeend;
230 $timeend = microtime( true );
231 $timetotal = $timeend - $timestart;
232 $r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision );
239 * Set PHP error reporting based on WordPress debug settings.
241 * Uses three constants: `WP_DEBUG`, `WP_DEBUG_DISPLAY`, and `WP_DEBUG_LOG`.
242 * All three can be defined in wp-config.php, and by default are set to false.
244 * When `WP_DEBUG` is true, all PHP notices are reported. WordPress will also
245 * display internal notices: when a deprecated WordPress function, function
246 * argument, or file is used. Deprecated code may be removed from a later
249 * It is strongly recommended that plugin and theme developers use `WP_DEBUG`
250 * in their development environments.
252 * `WP_DEBUG_DISPLAY` and `WP_DEBUG_LOG` perform no function unless `WP_DEBUG`
255 * When `WP_DEBUG_DISPLAY` is true, WordPress will force errors to be displayed.
256 * `WP_DEBUG_DISPLAY` defaults to true. Defining it as null prevents WordPress
257 * from changing the global configuration setting. Defining `WP_DEBUG_DISPLAY`
258 * as false will force errors to be hidden.
260 * When `WP_DEBUG_LOG` is true, errors will be logged to debug.log in the content
263 * Errors are never displayed for XML-RPC requests.
268 function wp_debug_mode() {
270 error_reporting( E_ALL );
272 if ( WP_DEBUG_DISPLAY )
273 ini_set( 'display_errors', 1 );
274 elseif ( null !== WP_DEBUG_DISPLAY )
275 ini_set( 'display_errors', 0 );
277 if ( WP_DEBUG_LOG ) {
278 ini_set( 'log_errors', 1 );
279 ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
282 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 );
284 if ( defined( 'XMLRPC_REQUEST' ) )
285 ini_set( 'display_errors', 0 );
289 * Set the location of the language directory.
291 * To set directory manually, define the `WP_LANG_DIR` constant
294 * If the language directory exists within `WP_CONTENT_DIR`, it
295 * is used. Otherwise the language directory is assumed to live
301 function wp_set_lang_dir() {
302 if ( !defined( 'WP_LANG_DIR' ) ) {
303 if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || !@is_dir(ABSPATH . WPINC . '/languages') ) {
305 * Server path of the language directory.
307 * No leading slash, no trailing slash, full path, not relative to ABSPATH
311 define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' );
312 if ( !defined( 'LANGDIR' ) ) {
313 // Old static relative path maintained for limited backwards compatibility - won't work in some cases
314 define( 'LANGDIR', 'wp-content/languages' );
318 * Server path of the language directory.
320 * No leading slash, no trailing slash, full path, not relative to `ABSPATH`.
324 define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' );
325 if ( !defined( 'LANGDIR' ) ) {
326 // Old relative path maintained for backwards compatibility
327 define( 'LANGDIR', WPINC . '/languages' );
334 * Load the database class file and instantiate the `$wpdb` global.
338 * @global wpdb $wpdb The WordPress database class.
340 function require_wp_db() {
343 require_once( ABSPATH . WPINC . '/wp-db.php' );
344 if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
345 require_once( WP_CONTENT_DIR . '/db.php' );
347 if ( isset( $wpdb ) )
350 $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
354 * Set the database table prefix and the format specifiers for database
357 * Columns not listed here default to `%s`.
362 * @global wpdb $wpdb The WordPress database class.
363 * @global string $table_prefix The database table prefix.
365 function wp_set_wpdb_vars() {
366 global $wpdb, $table_prefix;
367 if ( !empty( $wpdb->error ) )
370 $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d',
371 'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'comment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d',
372 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d',
373 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d',
375 'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d',
378 $prefix = $wpdb->set_prefix( $table_prefix );
380 if ( is_wp_error( $prefix ) ) {
381 wp_load_translations_early();
382 wp_die( __( '<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.' ) );
387 * Toggle `$_wp_using_ext_object_cache` on and off without directly
392 * @global bool $_wp_using_ext_object_cache
394 * @param bool $using Whether external object cache is being used.
395 * @return bool The current 'using' setting.
397 function wp_using_ext_object_cache( $using = null ) {
398 global $_wp_using_ext_object_cache;
399 $current_using = $_wp_using_ext_object_cache;
400 if ( null !== $using )
401 $_wp_using_ext_object_cache = $using;
402 return $current_using;
406 * Start the WordPress object cache.
408 * If an object-cache.php file exists in the wp-content directory,
409 * it uses that drop-in as an external object cache.
414 * @global int $blog_id Blog ID.
416 function wp_start_object_cache() {
420 if ( ! function_exists( 'wp_cache_init' ) ) {
421 if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
422 require_once ( WP_CONTENT_DIR . '/object-cache.php' );
423 if ( function_exists( 'wp_cache_init' ) )
424 wp_using_ext_object_cache( true );
428 } elseif ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
430 * Sometimes advanced-cache.php can load object-cache.php before
431 * it is loaded here. This breaks the function_exists check above
432 * and can result in `$_wp_using_ext_object_cache` being set
433 * incorrectly. Double check if an external cache exists.
435 wp_using_ext_object_cache( true );
438 if ( ! wp_using_ext_object_cache() )
439 require_once ( ABSPATH . WPINC . '/cache.php' );
442 * If cache supports reset, reset instead of init if already
443 * initialized. Reset signals to the cache that global IDs
444 * have changed and it may need to update keys and cleanup caches.
446 if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) )
447 wp_cache_switch_to_blog( $blog_id );
448 elseif ( function_exists( 'wp_cache_init' ) )
451 if ( function_exists( 'wp_cache_add_global_groups' ) ) {
452 wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache' ) );
453 wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) );
458 * Redirect to the installer if WordPress is not installed.
460 * Dies with an error message when Multisite is enabled.
465 function wp_not_installed() {
466 if ( is_multisite() ) {
467 if ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) {
470 wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) );
472 } elseif ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) {
475 require( ABSPATH . WPINC . '/kses.php' );
476 require( ABSPATH . WPINC . '/pluggable.php' );
477 require( ABSPATH . WPINC . '/formatting.php' );
479 $link = wp_guess_url() . '/wp-admin/install.php';
481 wp_redirect( $link );
487 * Retrieve an array of must-use plugin files.
489 * The default directory is wp-content/mu-plugins. To change the default
490 * directory manually, define `WPMU_PLUGIN_DIR` and `WPMU_PLUGIN_URL`
496 * @return array Files to include.
498 function wp_get_mu_plugins() {
499 $mu_plugins = array();
500 if ( !is_dir( WPMU_PLUGIN_DIR ) )
502 if ( ! $dh = opendir( WPMU_PLUGIN_DIR ) )
504 while ( ( $plugin = readdir( $dh ) ) !== false ) {
505 if ( substr( $plugin, -4 ) == '.php' )
506 $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
515 * Retrieve an array of active and valid plugin files.
517 * While upgrading or installing WordPress, no plugins are returned.
519 * The default directory is wp-content/plugins. To change the default
520 * directory manually, define `WP_PLUGIN_DIR` and `WP_PLUGIN_URL`
526 * @return array Files.
528 function wp_get_active_and_valid_plugins() {
530 $active_plugins = (array) get_option( 'active_plugins', array() );
532 // Check for hacks file if the option is enabled
533 if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
534 _deprecated_file( 'my-hacks.php', '1.5' );
535 array_unshift( $plugins, ABSPATH . 'my-hacks.php' );
538 if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) )
541 $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
543 foreach ( $active_plugins as $plugin ) {
544 if ( ! validate_file( $plugin ) // $plugin must validate as file
545 && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
546 && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
547 // not already included as a network plugin
548 && ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins ) )
550 $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
556 * Set internal encoding.
558 * In most cases the default internal encoding is latin1, which is
559 * of no use, since we want to use the `mb_` functions for `utf-8` strings.
564 function wp_set_internal_encoding() {
565 if ( function_exists( 'mb_internal_encoding' ) ) {
566 $charset = get_option( 'blog_charset' );
567 if ( ! $charset || ! @mb_internal_encoding( $charset ) )
568 mb_internal_encoding( 'UTF-8' );
573 * Add magic quotes to `$_GET`, `$_POST`, `$_COOKIE`, and `$_SERVER`.
575 * Also forces `$_REQUEST` to be `$_GET + $_POST`. If `$_SERVER`,
576 * `$_COOKIE`, or `$_ENV` are needed, use those superglobals directly.
581 function wp_magic_quotes() {
582 // If already slashed, strip.
583 if ( get_magic_quotes_gpc() ) {
584 $_GET = stripslashes_deep( $_GET );
585 $_POST = stripslashes_deep( $_POST );
586 $_COOKIE = stripslashes_deep( $_COOKIE );
590 $_GET = add_magic_quotes( $_GET );
591 $_POST = add_magic_quotes( $_POST );
592 $_COOKIE = add_magic_quotes( $_COOKIE );
593 $_SERVER = add_magic_quotes( $_SERVER );
595 // Force REQUEST to be GET + POST.
596 $_REQUEST = array_merge( $_GET, $_POST );
600 * Runs just before PHP shuts down execution.
605 function shutdown_action_hook() {
607 * Fires just before PHP shuts down execution.
611 do_action( 'shutdown' );
622 * @param object $object The object to clone.
623 * @return object The cloned object.
625 function wp_clone( $object ) {
626 // Use parens for clone to accommodate PHP 4. See #17880
627 return clone( $object );
631 * Whether the current request is for an administrative interface page.
633 * Does not check if the user is an administrator; {@see current_user_can()}
634 * for checking roles and capabilities.
638 * @global WP_Screen $current_screen
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 * @global WP_Screen $current_screen
663 * @return bool True if inside WordPress blog administration pages.
665 function is_blog_admin() {
666 if ( isset( $GLOBALS['current_screen'] ) )
667 return $GLOBALS['current_screen']->in_admin( 'site' );
668 elseif ( defined( 'WP_BLOG_ADMIN' ) )
669 return WP_BLOG_ADMIN;
675 * Whether the current request is for the network administrative interface.
677 * e.g. `/wp-admin/network/`
679 * Does not check if the user is an administrator; {@see current_user_can()}
680 * for checking roles and capabilities.
684 * @global WP_Screen $current_screen
686 * @return bool True if inside WordPress network administration pages.
688 function is_network_admin() {
689 if ( isset( $GLOBALS['current_screen'] ) )
690 return $GLOBALS['current_screen']->in_admin( 'network' );
691 elseif ( defined( 'WP_NETWORK_ADMIN' ) )
692 return WP_NETWORK_ADMIN;
698 * Whether the current request is for a user admin screen.
700 * e.g. `/wp-admin/user/`
702 * Does not inform on whether the user is an admin! Use capability
703 * checks to tell if the user should be accessing a section or not
704 * {@see current_user_can()}.
708 * @global WP_Screen $current_screen
710 * @return bool True if inside WordPress user administration pages.
712 function is_user_admin() {
713 if ( isset( $GLOBALS['current_screen'] ) )
714 return $GLOBALS['current_screen']->in_admin( 'user' );
715 elseif ( defined( 'WP_USER_ADMIN' ) )
716 return WP_USER_ADMIN;
722 * If Multisite is enabled.
726 * @return bool True if Multisite is enabled, false otherwise.
728 function is_multisite() {
729 if ( defined( 'MULTISITE' ) )
732 if ( defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) )
739 * Retrieve the current blog ID.
743 * @global int $blog_id
745 * @return int Blog id
747 function get_current_blog_id() {
749 return absint($blog_id);
753 * Attempt an early load of translations.
755 * Used for errors encountered during the initial loading process, before
756 * the locale has been properly detected and loaded.
758 * Designed for unusual load sequences (like setup-config.php) or for when
759 * the script will then terminate with an error, otherwise there is a risk
760 * that a file can be double-included.
765 * @global string $text_direction
766 * @global WP_Locale $wp_locale The WordPress date and time locale object.
768 * @staticvar bool $loaded
770 function wp_load_translations_early() {
771 global $text_direction, $wp_locale;
773 static $loaded = false;
778 if ( function_exists( 'did_action' ) && did_action( 'init' ) )
781 // We need $wp_local_package
782 require ABSPATH . WPINC . '/version.php';
784 // Translation and localization
785 require_once ABSPATH . WPINC . '/pomo/mo.php';
786 require_once ABSPATH . WPINC . '/l10n.php';
787 require_once ABSPATH . WPINC . '/locale.php';
790 require_once ABSPATH . WPINC . '/plugin.php';
792 $locales = $locations = array();
795 if ( defined( 'WPLANG' ) ) {
801 if ( isset( $wp_local_package ) )
802 $locales[] = $wp_local_package;
807 if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) )
808 $locations[] = WP_LANG_DIR;
810 if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) )
811 $locations[] = WP_CONTENT_DIR . '/languages';
813 if ( @is_dir( ABSPATH . 'wp-content/languages' ) )
814 $locations[] = ABSPATH . 'wp-content/languages';
816 if ( @is_dir( ABSPATH . WPINC . '/languages' ) )
817 $locations[] = ABSPATH . WPINC . '/languages';
822 $locations = array_unique( $locations );
824 foreach ( $locales as $locale ) {
825 foreach ( $locations as $location ) {
826 if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
827 load_textdomain( 'default', $location . '/' . $locale . '.mo' );
828 if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) )
829 load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
838 $wp_locale = new WP_Locale();