|
525 | 525 | foreach ( wp_get_active_and_valid_plugins() as $plugin ) { |
526 | 526 | wp_register_plugin_realpath( $plugin ); |
527 | 527 |
|
| 528 | + $plugin_data = get_plugin_data( $plugin, false, false ); |
| 529 | + |
| 530 | + $textdomain = $plugin_data['TextDomain']; |
| 531 | + if ( $textdomain ) { |
| 532 | + if ( $plugin_data['DomainPath'] ) { |
| 533 | + $GLOBALS['wp_textdomain_registry']->set_custom_path( $textdomain, dirname( $plugin ) . $plugin_data['DomainPath'] ); |
| 534 | + } else { |
| 535 | + $GLOBALS['wp_textdomain_registry']->set_custom_path( $textdomain, dirname( $plugin ) ); |
| 536 | + } |
| 537 | + } |
| 538 | + |
528 | 539 | $_wp_plugin_file = $plugin; |
529 | 540 | include_once $plugin; |
530 | 541 | $plugin = $_wp_plugin_file; // Avoid stomping of the $plugin variable in a plugin. |
|
537 | 548 | * @param string $plugin Full path to the plugin's main file. |
538 | 549 | */ |
539 | 550 | do_action( 'plugin_loaded', $plugin ); |
540 | | - |
541 | | - $plugin_data = get_plugin_data( $plugin, false, false ); |
542 | | - |
543 | | - $textdomain = $plugin_data['TextDomain']; |
544 | | - if ( $textdomain ) { |
545 | | - if ( $plugin_data['DomainPath'] ) { |
546 | | - $GLOBALS['wp_textdomain_registry']->set_custom_path( $textdomain, dirname( $plugin ) . $plugin_data['DomainPath'] ); |
547 | | - } else { |
548 | | - $GLOBALS['wp_textdomain_registry']->set_custom_path( $textdomain, dirname( $plugin ) ); |
549 | | - } |
550 | | - } |
551 | 551 | } |
552 | 552 | unset( $plugin, $_wp_plugin_file, $plugin_data, $textdomain ); |
553 | 553 |
|
|
684 | 684 | foreach ( wp_get_active_and_valid_themes() as $theme ) { |
685 | 685 | $wp_theme = wp_get_theme( basename( $theme ) ); |
686 | 686 |
|
| 687 | + $wp_theme->load_textdomain(); |
| 688 | + |
687 | 689 | if ( file_exists( $theme . '/functions.php' ) ) { |
688 | 690 | include $theme . '/functions.php'; |
689 | 691 | } |
690 | | - |
691 | | - $wp_theme->load_textdomain(); |
692 | 692 | } |
693 | 693 | unset( $theme, $wp_theme ); |
694 | 694 |
|
|
0 commit comments