WordPress.org

Make WordPress Core

Changeset 37562


Ignore:
Timestamp:
05/25/2016 04:53:38 PM (3 years ago)
Author:
ocean90
Message:

Plugins: In get_plugin_data() use the plugin slug for the text domain when no text domain is defined in the header.

Fixes #36706.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/plugin.php

    r37537 r37562  
    9292    $plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) );
    9393    unset( $plugin_data['_sitewide'] );
     94
     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    }
    94102
    95103    if ( $markup || $translate ) {
Note: See TracChangeset for help on using the changeset viewer.