From a34e38513f541586597402463bdaa29002350036 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Wed, 25 May 2016 16:53:38 +0000 Subject: [PATCH] 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 --- src/wp-admin/includes/plugin.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index 0d19997a39..74345c41d6 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -92,6 +92,14 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) { $plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) ); unset( $plugin_data['_sitewide'] ); + // If no text domain is defined fall back to the plugin slug. + if ( ! $plugin_data['TextDomain'] ) { + $plugin_slug = dirname( plugin_basename( $plugin_file ) ); + if ( '.' !== $plugin_slug && false === strpos( '/', $plugin_slug ) ) { + $plugin_data['TextDomain'] = $plugin_slug; + } + } + if ( $markup || $translate ) { $plugin_data = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup, $translate ); } else {