Changeset 55928
- Timestamp:
- 06/16/2023 12:56:03 PM (17 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/l10n.php
r55865 r55928 717 717 718 718 $l10n_unloaded = (array) $l10n_unloaded; 719 720 /** 721 * Filters whether to short-circuit loading .mo file. 722 * 723 * Returning a non-null value from the filter will effectively short-circuit 724 * the loading, returning the passed value instead. 725 * 726 * @since 6.3.0 727 * 728 * @param bool|null $loaded The result of loading a .mo file. Default null. 729 * @param string $domain Text domain. Unique identifier for retrieving translated strings. 730 * @param string $mofile Path to the MO file. 731 * @param string|null $locale Locale. 732 */ 733 $loaded = apply_filters( 'pre_load_textdomain', null, $domain, $mofile, $locale ); 734 if ( null !== $loaded ) { 735 if ( true === $loaded ) { 736 unset( $l10n_unloaded[ $domain ] ); 737 } 738 739 return $loaded; 740 } 719 741 720 742 /** -
trunk/tests/phpunit/tests/l10n/loadTextdomain.php
r54669 r55928 301 301 $this->assertSame( get_user_locale(), $this->locale ); 302 302 } 303 304 /** 305 * @ticket 58035 306 * 307 * @covers ::load_theme_textdomain 308 */ 309 public function test_pre_load_textdomain_filter() { 310 $override_load_textdomain_callback = new MockAction(); 311 add_filter( 'override_load_textdomain', array( $override_load_textdomain_callback, 'action' ) ); 312 313 add_filter( 'pre_load_textdomain', '__return_true' ); 314 load_plugin_textdomain( 'wp-tests-domain' ); 315 remove_filter( 'pre_load_textdomain', '__return_true' ); 316 317 $this->assertSame( 0, $override_load_textdomain_callback->get_call_count(), 'Expected override_load_textdomain not to be called.' ); 318 } 303 319 }
Note: See TracChangeset
for help on using the changeset viewer.