From 365a82ffeb1ab05eaa6a33bd6cddf706c8dbcd8b Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 16 Jan 2024 12:12:17 +0000 Subject: [PATCH] I18N: Do not use `trailingslashit` in `WP_Textdomain_Registry`. This usage of `trailingslashit()`, introduced in [57287], is not only redundant, but also discouraged in order to avoid `formatting.php` dependency (which might not always be loaded). Props SergeyBiryukov. See #58919. Built from https://develop.svn.wordpress.org/trunk@57290 git-svn-id: http://core.svn.wordpress.org/trunk@56796 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-textdomain-registry.php | 8 ++++---- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/class-wp-textdomain-registry.php b/wp-includes/class-wp-textdomain-registry.php index f0c8b8ded7..4121ecb091 100644 --- a/wp-includes/class-wp-textdomain-registry.php +++ b/wp-includes/class-wp-textdomain-registry.php @@ -161,7 +161,7 @@ class WP_Textdomain_Registry { * @return array Array of .mo file paths. */ public function get_language_files_from_path( $path ) { - $path = trailingslashit( $path ); + $path = rtrim( $path, '/' ) . '/'; /** * Filters the .mo files retrieved from a specified path before the actual lookup. @@ -237,13 +237,13 @@ class WP_Textdomain_Registry { foreach ( $translation_types as $type ) { switch ( $type ) { case 'plugin': - wp_cache_delete( 'cached_mo_files_' . md5( trailingslashit( WP_LANG_DIR ) . '/plugins/' ), 'translations' ); + wp_cache_delete( 'cached_mo_files_' . md5( WP_LANG_DIR . '/plugins' ), 'translations' ); break; case 'theme': - wp_cache_delete( 'cached_mo_files_' . md5( trailingslashit( WP_LANG_DIR ) . '/themes/' ), 'translations' ); + wp_cache_delete( 'cached_mo_files_' . md5( WP_LANG_DIR . '/themes' ), 'translations' ); break; default: - wp_cache_delete( 'cached_mo_files_' . md5( trailingslashit( WP_LANG_DIR ) ), 'translations' ); + wp_cache_delete( 'cached_mo_files_' . md5( WP_LANG_DIR ), 'translations' ); break; } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 5d29cba379..17aca06579 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-alpha-57289'; +$wp_version = '6.5-alpha-57290'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.