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
This commit is contained in:
Pascal Birchler 2024-01-16 12:12:17 +00:00
parent 2590eeb14c
commit 365a82ffeb
2 changed files with 5 additions and 5 deletions

View File

@ -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;
}
}

View File

@ -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.