Changeset 53874 for trunk/src/wp-includes/deprecated.php
- Timestamp:
- 08/11/2022 12:37:05 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/deprecated.php
r53715 r53874 4361 4361 return false; 4362 4362 } 4363 4364 /** 4365 * Gets the path to a translation file for loading a textdomain just in time. 4366 * 4367 * Caches the retrieved results internally. 4368 * 4369 * @since 4.7.0 4370 * @deprecated 6.1.0 4371 * @access private 4372 * 4373 * @see _load_textdomain_just_in_time() 4374 * 4375 * @param string $domain Text domain. Unique identifier for retrieving translated strings. 4376 * @param bool $reset Whether to reset the internal cache. Used by the switch to locale functionality. 4377 * @return string|false The path to the translation file or false if no translation file was found. 4378 */ 4379 function _get_path_to_translation( $domain, $reset = false ) { 4380 _deprecated_function( __FUNCTION__, '6.1.0', 'WP_Textdomain_Registry' ); 4381 4382 static $available_translations = array(); 4383 4384 if ( true === $reset ) { 4385 $available_translations = array(); 4386 } 4387 4388 if ( ! isset( $available_translations[ $domain ] ) ) { 4389 $available_translations[ $domain ] = _get_path_to_translation_from_lang_dir( $domain ); 4390 } 4391 4392 return $available_translations[ $domain ]; 4393 } 4394 4395 /** 4396 * Gets the path to a translation file in the languages directory for the current locale. 4397 * 4398 * Holds a cached list of available .mo files to improve performance. 4399 * 4400 * @since 4.7.0 4401 * @deprecated 6.1.0 4402 * @access private 4403 * 4404 * @see _get_path_to_translation() 4405 * 4406 * @param string $domain Text domain. Unique identifier for retrieving translated strings. 4407 * @return string|false The path to the translation file or false if no translation file was found. 4408 */ 4409 function _get_path_to_translation_from_lang_dir( $domain ) { 4410 _deprecated_function( __FUNCTION__, '6.1.0', 'WP_Textdomain_Registry' ); 4411 4412 static $cached_mofiles = null; 4413 4414 if ( null === $cached_mofiles ) { 4415 $cached_mofiles = array(); 4416 4417 $locations = array( 4418 WP_LANG_DIR . '/plugins', 4419 WP_LANG_DIR . '/themes', 4420 ); 4421 4422 foreach ( $locations as $location ) { 4423 $mofiles = glob( $location . '/*.mo' ); 4424 if ( $mofiles ) { 4425 $cached_mofiles = array_merge( $cached_mofiles, $mofiles ); 4426 } 4427 } 4428 } 4429 4430 $locale = determine_locale(); 4431 $mofile = "{$domain}-{$locale}.mo"; 4432 4433 $path = WP_LANG_DIR . '/plugins/' . $mofile; 4434 if ( in_array( $path, $cached_mofiles, true ) ) { 4435 return $path; 4436 } 4437 4438 $path = WP_LANG_DIR . '/themes/' . $mofile; 4439 if ( in_array( $path, $cached_mofiles, true ) ) { 4440 return $path; 4441 } 4442 4443 return false; 4444 }
Note: See TracChangeset
for help on using the changeset viewer.