Skip to content

Commit 527efae

Browse files
author
ocean90
committed
Plugins: In get_plugin_data() use the plugin slug for the text domain when no text domain is defined in the header.
Fixes #36706. git-svn-id: https://develop.svn.wordpress.org/trunk@37562 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 92e93ba commit 527efae

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/wp-admin/includes/plugin.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
9292
$plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) );
9393
unset( $plugin_data['_sitewide'] );
9494

95+
// If no text domain is defined fall back to the plugin slug.
96+
if ( ! $plugin_data['TextDomain'] ) {
97+
$plugin_slug = dirname( plugin_basename( $plugin_file ) );
98+
if ( '.' !== $plugin_slug && false === strpos( '/', $plugin_slug ) ) {
99+
$plugin_data['TextDomain'] = $plugin_slug;
100+
}
101+
}
102+
95103
if ( $markup || $translate ) {
96104
$plugin_data = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup, $translate );
97105
} else {

0 commit comments

Comments
 (0)