From 6d87157eb95e144f3905caebf4bc93fc0fa1ad16 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 26 Aug 2016 10:20:29 +0000 Subject: [PATCH] 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 --- wp-admin/includes/update-core.php | 2 ++ wp-includes/l10n.php | 14 ++++++++++++++ wp-includes/locale.php | 25 ------------------------- wp-includes/version.php | 2 +- wp-settings.php | 4 +--- 5 files changed, 18 insertions(+), 29 deletions(-) delete mode 100644 wp-includes/locale.php diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index a378d3ce95..50ce6ddb93 100644 --- a/wp-admin/includes/update-core.php +++ b/wp-admin/includes/update-core.php @@ -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', ); /** diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index 8ac67e421f..7bc1c6abdf 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -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(); +} \ No newline at end of file diff --git a/wp-includes/locale.php b/wp-includes/locale.php deleted file mode 100644 index b8ad463721..0000000000 --- a/wp-includes/locale.php +++ /dev/null @@ -1,25 +0,0 @@ -is_rtl(); -} diff --git a/wp-includes/version.php b/wp-includes/version.php index 89ca71661b..e7263a0b57 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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. diff --git a/wp-settings.php b/wp-settings.php index bdf251c27b..2fa73c83af 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -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