i18n: move `is_rtl()` to `l10n.php` (which loads way earlier). Load `WP_Locale` file in `wp-settings.php`. Retire `wp-includes/locale.php` - it only loaded the class and the one function, `is_rtl()`. If someone loaded this file for fun somewhere else, it would be a fatal error.

See #37827.

Built from https://develop.svn.wordpress.org/trunk@38364


git-svn-id: http://core.svn.wordpress.org/trunk@38305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2016-08-26 10:20:29 +00:00
parent 4d17b67eed
commit 6d87157eb9
5 changed files with 18 additions and 29 deletions

View File

@ -705,6 +705,8 @@ $_old_files = array(
'wp-includes/theme-compat/comments-popup.php',
// 4.6
'wp-admin/includes/class-wp-automatic-upgrader.php', // Wrong file name, see #37628.
// 4.7
'wp-includes/locale.php',
);
/**

View File

@ -1132,3 +1132,17 @@ function wp_dropdown_languages( $args = array() ) {
return $output;
}
/**
* Checks if current locale is RTL.
*
* @since 3.0.0
*
* @global WP_Locale $wp_locale
*
* @return bool Whether locale is RTL.
*/
function is_rtl() {
global $wp_locale;
return $wp_locale->is_rtl();
}

View File

@ -1,25 +0,0 @@
<?php
/**
* Locale API
*
* @package WordPress
* @subpackage i18n
* @since 1.2.0
*/
/** WP_Locale class */
require_once ABSPATH . WPINC . '/class-wp-locale.php';
/**
* Checks if current locale is RTL.
*
* @since 3.0.0
*
* @global WP_Locale $wp_locale
*
* @return bool Whether locale is RTL.
*/
function is_rtl() {
global $wp_locale;
return $wp_locale->is_rtl();
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-alpha-38363';
$wp_version = '4.7-alpha-38364';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -213,6 +213,7 @@ require( ABSPATH . WPINC . '/rest-api.php' );
require( ABSPATH . WPINC . '/rest-api/class-wp-rest-server.php' );
require( ABSPATH . WPINC . '/rest-api/class-wp-rest-response.php' );
require( ABSPATH . WPINC . '/rest-api/class-wp-rest-request.php' );
require( ABSPATH . WPINC . '/class-wp-locale.php' );
$GLOBALS['wp_embed'] = new WP_Embed();
@ -373,9 +374,6 @@ if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) )
require( $locale_file );
unset( $locale_file );
// Pull in locale data after loading text domain.
require_once( ABSPATH . WPINC . '/locale.php' );
/**
* WordPress Locale object for loading locale domain date and various strings.
* @global WP_Locale $wp_locale