From 6b51ac4956ee5ea2ac0e42497543b722fbccbab0 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Wed, 25 May 2016 16:54:28 +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. Built from https://develop.svn.wordpress.org/trunk@37562 git-svn-id: http://core.svn.wordpress.org/trunk@37530 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/plugin.php | 8 ++++++++ wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 0d19997a39..74345c41d6 100644 --- a/wp-admin/includes/plugin.php +++ b/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 { diff --git a/wp-includes/version.php b/wp-includes/version.php index daa5b37ea4..08b2695c55 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37561'; +$wp_version = '4.6-alpha-37562'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.