_get_plugin_data_markup_translate

The timeline below displays how wordpress function _get_plugin_data_markup_translate has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Sanitizes plugin data, optionally adds markup, optionally translates.
 *
 * @since 2.7.0
 *
 * @see get_plugin_data()
 *
 * @access private
 *
 * @param string $plugin_file Path to the main plugin file.
 * @param array  $plugin_data An array of plugin data. See get_plugin_data().
 * @param bool   $markup      Optional. If the returned data should have HTML markup applied.
 *                            Default true.
 * @param bool   $translate   Optional. If the returned data should be translated. Default true.
 * @return array Plugin data. Values will be empty if not supplied by the plugin.
 *               See get_plugin_data() for the list of possible values.
 */
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true)
{
    // Sanitize the plugin filename to a WP_PLUGIN_DIR relative path.
    $plugin_file = plugin_basename($plugin_file);
    // Translate fields.
    if ($translate) {
        $textdomain = $plugin_data['TextDomain'];
        if ($textdomain) {
            if (!is_textdomain_loaded($textdomain)) {
                if ($plugin_data['DomainPath']) {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file) . $plugin_data['DomainPath']);
                } else {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file));
                }
            }
        } elseif ('hello.php' === basename($plugin_file)) {
            $textdomain = 'default';
        }
        if ($textdomain) {
            foreach (array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field) {
                if (!empty($plugin_data[$field])) {
                    // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
                    $plugin_data[$field] = translate($plugin_data[$field], $textdomain);
                }
            }
        }
    }
    // Sanitize fields.
    $allowed_tags_in_links = array('abbr' => array('title' => true), 'acronym' => array('title' => true), 'code' => true, 'em' => true, 'strong' => true);
    $allowed_tags = $allowed_tags_in_links;
    $allowed_tags['a'] = array('href' => true, 'title' => true);
    /*
     * Name is marked up inside <a> tags. Don't allow these.
     * Author is too, but some plugins have used <a> here (omitting Author URI).
     */
    $plugin_data['Name'] = wp_kses($plugin_data['Name'], $allowed_tags_in_links);
    $plugin_data['Author'] = wp_kses($plugin_data['Author'], $allowed_tags);
    $plugin_data['Description'] = wp_kses($plugin_data['Description'], $allowed_tags);
    $plugin_data['Version'] = wp_kses($plugin_data['Version'], $allowed_tags);
    $plugin_data['PluginURI'] = esc_url($plugin_data['PluginURI']);
    $plugin_data['AuthorURI'] = esc_url($plugin_data['AuthorURI']);
    $plugin_data['Title'] = $plugin_data['Name'];
    $plugin_data['AuthorName'] = $plugin_data['Author'];
    // Apply markup.
    if ($markup) {
        if ($plugin_data['PluginURI'] && $plugin_data['Name']) {
            $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Name'] . '</a>';
        }
        if ($plugin_data['AuthorURI'] && $plugin_data['Author']) {
            $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
        }
        $plugin_data['Description'] = wptexturize($plugin_data['Description']);
        if ($plugin_data['Author']) {
            $plugin_data['Description'] .= sprintf(
                /* translators: %s: Plugin author. */
                ' <cite>' . __('By %s.') . '</cite>',
                $plugin_data['Author']
            );
        }
    }
    return $plugin_data;
}

WordPress Version: 6.1

/**
 * Sanitizes plugin data, optionally adds markup, optionally translates.
 *
 * @since 2.7.0
 *
 * @see get_plugin_data()
 *
 * @access private
 *
 * @param string $plugin_file Path to the main plugin file.
 * @param array  $plugin_data An array of plugin data. See get_plugin_data().
 * @param bool   $markup      Optional. If the returned data should have HTML markup applied.
 *                            Default true.
 * @param bool   $translate   Optional. If the returned data should be translated. Default true.
 * @return array Plugin data. Values will be empty if not supplied by the plugin.
 *               See get_plugin_data() for the list of possible values.
 */
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true)
{
    // Sanitize the plugin filename to a WP_PLUGIN_DIR relative path.
    $plugin_file = plugin_basename($plugin_file);
    // Translate fields.
    if ($translate) {
        $textdomain = $plugin_data['TextDomain'];
        if ($textdomain) {
            if (!is_textdomain_loaded($textdomain)) {
                if ($plugin_data['DomainPath']) {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file) . $plugin_data['DomainPath']);
                } else {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file));
                }
            }
        } elseif ('hello.php' === basename($plugin_file)) {
            $textdomain = 'default';
        }
        if ($textdomain) {
            foreach (array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field) {
                if (!empty($plugin_data[$field])) {
                    // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
                    $plugin_data[$field] = translate($plugin_data[$field], $textdomain);
                }
            }
        }
    }
    // Sanitize fields.
    $allowed_tags_in_links = array('abbr' => array('title' => true), 'acronym' => array('title' => true), 'code' => true, 'em' => true, 'strong' => true);
    $allowed_tags = $allowed_tags_in_links;
    $allowed_tags['a'] = array('href' => true, 'title' => true);
    // Name is marked up inside <a> tags. Don't allow these.
    // Author is too, but some plugins have used <a> here (omitting Author URI).
    $plugin_data['Name'] = wp_kses($plugin_data['Name'], $allowed_tags_in_links);
    $plugin_data['Author'] = wp_kses($plugin_data['Author'], $allowed_tags);
    $plugin_data['Description'] = wp_kses($plugin_data['Description'], $allowed_tags);
    $plugin_data['Version'] = wp_kses($plugin_data['Version'], $allowed_tags);
    $plugin_data['PluginURI'] = esc_url($plugin_data['PluginURI']);
    $plugin_data['AuthorURI'] = esc_url($plugin_data['AuthorURI']);
    $plugin_data['Title'] = $plugin_data['Name'];
    $plugin_data['AuthorName'] = $plugin_data['Author'];
    // Apply markup.
    if ($markup) {
        if ($plugin_data['PluginURI'] && $plugin_data['Name']) {
            $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Name'] . '</a>';
        }
        if ($plugin_data['AuthorURI'] && $plugin_data['Author']) {
            $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
        }
        $plugin_data['Description'] = wptexturize($plugin_data['Description']);
        if ($plugin_data['Author']) {
            $plugin_data['Description'] .= sprintf(
                /* translators: %s: Plugin author. */
                ' <cite>' . __('By %s.') . '</cite>',
                $plugin_data['Author']
            );
        }
    }
    return $plugin_data;
}

WordPress Version: 5.9

/**
 * Sanitizes plugin data, optionally adds markup, optionally translates.
 *
 * @since 2.7.0
 *
 * @see get_plugin_data()
 *
 * @access private
 *
 * @param string $plugin_file Path to the main plugin file.
 * @param array  $plugin_data An array of plugin data. See `get_plugin_data()`.
 * @param bool   $markup      Optional. If the returned data should have HTML markup applied.
 *                            Default true.
 * @param bool   $translate   Optional. If the returned data should be translated. Default true.
 * @return array Plugin data. Values will be empty if not supplied by the plugin.
 *               See get_plugin_data() for the list of possible values.
 */
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true)
{
    // Sanitize the plugin filename to a WP_PLUGIN_DIR relative path.
    $plugin_file = plugin_basename($plugin_file);
    // Translate fields.
    if ($translate) {
        $textdomain = $plugin_data['TextDomain'];
        if ($textdomain) {
            if (!is_textdomain_loaded($textdomain)) {
                if ($plugin_data['DomainPath']) {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file) . $plugin_data['DomainPath']);
                } else {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file));
                }
            }
        } elseif ('hello.php' === basename($plugin_file)) {
            $textdomain = 'default';
        }
        if ($textdomain) {
            foreach (array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field) {
                // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
                $plugin_data[$field] = translate($plugin_data[$field], $textdomain);
            }
        }
    }
    // Sanitize fields.
    $allowed_tags_in_links = array('abbr' => array('title' => true), 'acronym' => array('title' => true), 'code' => true, 'em' => true, 'strong' => true);
    $allowed_tags = $allowed_tags_in_links;
    $allowed_tags['a'] = array('href' => true, 'title' => true);
    // Name is marked up inside <a> tags. Don't allow these.
    // Author is too, but some plugins have used <a> here (omitting Author URI).
    $plugin_data['Name'] = wp_kses($plugin_data['Name'], $allowed_tags_in_links);
    $plugin_data['Author'] = wp_kses($plugin_data['Author'], $allowed_tags);
    $plugin_data['Description'] = wp_kses($plugin_data['Description'], $allowed_tags);
    $plugin_data['Version'] = wp_kses($plugin_data['Version'], $allowed_tags);
    $plugin_data['PluginURI'] = esc_url($plugin_data['PluginURI']);
    $plugin_data['AuthorURI'] = esc_url($plugin_data['AuthorURI']);
    $plugin_data['Title'] = $plugin_data['Name'];
    $plugin_data['AuthorName'] = $plugin_data['Author'];
    // Apply markup.
    if ($markup) {
        if ($plugin_data['PluginURI'] && $plugin_data['Name']) {
            $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Name'] . '</a>';
        }
        if ($plugin_data['AuthorURI'] && $plugin_data['Author']) {
            $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
        }
        $plugin_data['Description'] = wptexturize($plugin_data['Description']);
        if ($plugin_data['Author']) {
            $plugin_data['Description'] .= sprintf(
                /* translators: %s: Plugin author. */
                ' <cite>' . __('By %s.') . '</cite>',
                $plugin_data['Author']
            );
        }
    }
    return $plugin_data;
}

WordPress Version: 5.5

/**
 * Sanitizes plugin data, optionally adds markup, optionally translates.
 *
 * @since 2.7.0
 *
 * @see get_plugin_data()
 *
 * @access private
 *
 * @param string $plugin_file Path to the main plugin file.
 * @param array  $plugin_data An array of plugin data. See `get_plugin_data()`.
 * @param bool   $markup      Optional. If the returned data should have HTML markup applied.
 *                            Default true.
 * @param bool   $translate   Optional. If the returned data should be translated. Default true.
 * @return array {
 *     Plugin data. Values will be empty if not supplied by the plugin.
 *
 *     @type string $Name        Name of the plugin. Should be unique.
 *     @type string $Title       Title of the plugin and link to the plugin's site (if set).
 *     @type string $Description Plugin description.
 *     @type string $Author      Author's name.
 *     @type string $AuthorURI   Author's website address (if set).
 *     @type string $Version     Plugin version.
 *     @type string $TextDomain  Plugin textdomain.
 *     @type string $DomainPath  Plugins relative directory path to .mo files.
 *     @type bool   $Network     Whether the plugin can only be activated network-wide.
 * }
 */
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true)
{
    // Sanitize the plugin filename to a WP_PLUGIN_DIR relative path.
    $plugin_file = plugin_basename($plugin_file);
    // Translate fields.
    if ($translate) {
        $textdomain = $plugin_data['TextDomain'];
        if ($textdomain) {
            if (!is_textdomain_loaded($textdomain)) {
                if ($plugin_data['DomainPath']) {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file) . $plugin_data['DomainPath']);
                } else {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file));
                }
            }
        } elseif ('hello.php' === basename($plugin_file)) {
            $textdomain = 'default';
        }
        if ($textdomain) {
            foreach (array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field) {
                // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
                $plugin_data[$field] = translate($plugin_data[$field], $textdomain);
            }
        }
    }
    // Sanitize fields.
    $allowed_tags_in_links = array('abbr' => array('title' => true), 'acronym' => array('title' => true), 'code' => true, 'em' => true, 'strong' => true);
    $allowed_tags = $allowed_tags_in_links;
    $allowed_tags['a'] = array('href' => true, 'title' => true);
    // Name is marked up inside <a> tags. Don't allow these.
    // Author is too, but some plugins have used <a> here (omitting Author URI).
    $plugin_data['Name'] = wp_kses($plugin_data['Name'], $allowed_tags_in_links);
    $plugin_data['Author'] = wp_kses($plugin_data['Author'], $allowed_tags);
    $plugin_data['Description'] = wp_kses($plugin_data['Description'], $allowed_tags);
    $plugin_data['Version'] = wp_kses($plugin_data['Version'], $allowed_tags);
    $plugin_data['PluginURI'] = esc_url($plugin_data['PluginURI']);
    $plugin_data['AuthorURI'] = esc_url($plugin_data['AuthorURI']);
    $plugin_data['Title'] = $plugin_data['Name'];
    $plugin_data['AuthorName'] = $plugin_data['Author'];
    // Apply markup.
    if ($markup) {
        if ($plugin_data['PluginURI'] && $plugin_data['Name']) {
            $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Name'] . '</a>';
        }
        if ($plugin_data['AuthorURI'] && $plugin_data['Author']) {
            $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
        }
        $plugin_data['Description'] = wptexturize($plugin_data['Description']);
        if ($plugin_data['Author']) {
            $plugin_data['Description'] .= sprintf(
                /* translators: %s: Plugin author. */
                ' <cite>' . __('By %s.') . '</cite>',
                $plugin_data['Author']
            );
        }
    }
    return $plugin_data;
}

WordPress Version: 5.3

/**
 * Sanitizes plugin data, optionally adds markup, optionally translates.
 *
 * @since 2.7.0
 *
 * @see get_plugin_data()
 *
 * @access private
 *
 * @param string $plugin_file Path to the main plugin file.
 * @param array  $plugin_data An array of plugin data. See `get_plugin_data()`.
 * @param bool   $markup      Optional. If the returned data should have HTML markup applied.
 *                            Default true.
 * @param bool   $translate   Optional. If the returned data should be translated. Default true.
 * @return array {
 *     Plugin data. Values will be empty if not supplied by the plugin.
 *
 *     @type string $Name        Name of the plugin. Should be unique.
 *     @type string $Title       Title of the plugin and link to the plugin's site (if set).
 *     @type string $Description Plugin description.
 *     @type string $Author      Author's name.
 *     @type string $AuthorURI   Author's website address (if set).
 *     @type string $Version     Plugin version.
 *     @type string $TextDomain  Plugin textdomain.
 *     @type string $DomainPath  Plugins relative directory path to .mo files.
 *     @type bool   $Network     Whether the plugin can only be activated network-wide.
 * }
 */
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true)
{
    // Sanitize the plugin filename to a WP_PLUGIN_DIR relative path.
    $plugin_file = plugin_basename($plugin_file);
    // Translate fields.
    if ($translate) {
        $textdomain = $plugin_data['TextDomain'];
        if ($textdomain) {
            if (!is_textdomain_loaded($textdomain)) {
                if ($plugin_data['DomainPath']) {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file) . $plugin_data['DomainPath']);
                } else {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file));
                }
            }
        } elseif ('hello.php' == basename($plugin_file)) {
            $textdomain = 'default';
        }
        if ($textdomain) {
            foreach (array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field) {
                // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
                $plugin_data[$field] = translate($plugin_data[$field], $textdomain);
            }
        }
    }
    // Sanitize fields.
    $allowed_tags_in_links = array('abbr' => array('title' => true), 'acronym' => array('title' => true), 'code' => true, 'em' => true, 'strong' => true);
    $allowed_tags = $allowed_tags_in_links;
    $allowed_tags['a'] = array('href' => true, 'title' => true);
    // Name is marked up inside <a> tags. Don't allow these.
    // Author is too, but some plugins have used <a> here (omitting Author URI).
    $plugin_data['Name'] = wp_kses($plugin_data['Name'], $allowed_tags_in_links);
    $plugin_data['Author'] = wp_kses($plugin_data['Author'], $allowed_tags);
    $plugin_data['Description'] = wp_kses($plugin_data['Description'], $allowed_tags);
    $plugin_data['Version'] = wp_kses($plugin_data['Version'], $allowed_tags);
    $plugin_data['PluginURI'] = esc_url($plugin_data['PluginURI']);
    $plugin_data['AuthorURI'] = esc_url($plugin_data['AuthorURI']);
    $plugin_data['Title'] = $plugin_data['Name'];
    $plugin_data['AuthorName'] = $plugin_data['Author'];
    // Apply markup.
    if ($markup) {
        if ($plugin_data['PluginURI'] && $plugin_data['Name']) {
            $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Name'] . '</a>';
        }
        if ($plugin_data['AuthorURI'] && $plugin_data['Author']) {
            $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
        }
        $plugin_data['Description'] = wptexturize($plugin_data['Description']);
        if ($plugin_data['Author']) {
            $plugin_data['Description'] .= sprintf(
                /* translators: %s: Plugin author. */
                ' <cite>' . __('By %s.') . '</cite>',
                $plugin_data['Author']
            );
        }
    }
    return $plugin_data;
}

WordPress Version: 5.1

/**
 * Sanitizes plugin data, optionally adds markup, optionally translates.
 *
 * @since 2.7.0
 *
 * @see get_plugin_data()
 *
 * @access private
 *
 * @param string $plugin_file Path to the main plugin file.
 * @param array  $plugin_data An array of plugin data. See `get_plugin_data()`.
 * @param bool   $markup      Optional. If the returned data should have HTML markup applied.
 *                            Default true.
 * @param bool   $translate   Optional. If the returned data should be translated. Default true.
 * @return array {
 *     Plugin data. Values will be empty if not supplied by the plugin.
 *
 *     @type string $Name        Name of the plugin. Should be unique.
 *     @type string $Title       Title of the plugin and link to the plugin's site (if set).
 *     @type string $Description Plugin description.
 *     @type string $Author      Author's name.
 *     @type string $AuthorURI   Author's website address (if set).
 *     @type string $Version     Plugin version.
 *     @type string $TextDomain  Plugin textdomain.
 *     @type string $DomainPath  Plugins relative directory path to .mo files.
 *     @type bool   $Network     Whether the plugin can only be activated network-wide.
 * }
 */
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true)
{
    // Sanitize the plugin filename to a WP_PLUGIN_DIR relative path
    $plugin_file = plugin_basename($plugin_file);
    // Translate fields
    if ($translate) {
        if ($textdomain = $plugin_data['TextDomain']) {
            if (!is_textdomain_loaded($textdomain)) {
                if ($plugin_data['DomainPath']) {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file) . $plugin_data['DomainPath']);
                } else {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file));
                }
            }
        } elseif ('hello.php' == basename($plugin_file)) {
            $textdomain = 'default';
        }
        if ($textdomain) {
            foreach (array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field) {
                // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
                $plugin_data[$field] = translate($plugin_data[$field], $textdomain);
            }
        }
    }
    // Sanitize fields
    $allowed_tags_in_links = array('abbr' => array('title' => true), 'acronym' => array('title' => true), 'code' => true, 'em' => true, 'strong' => true);
    $allowed_tags = $allowed_tags_in_links;
    $allowed_tags['a'] = array('href' => true, 'title' => true);
    // Name is marked up inside <a> tags. Don't allow these.
    // Author is too, but some plugins have used <a> here (omitting Author URI).
    $plugin_data['Name'] = wp_kses($plugin_data['Name'], $allowed_tags_in_links);
    $plugin_data['Author'] = wp_kses($plugin_data['Author'], $allowed_tags);
    $plugin_data['Description'] = wp_kses($plugin_data['Description'], $allowed_tags);
    $plugin_data['Version'] = wp_kses($plugin_data['Version'], $allowed_tags);
    $plugin_data['PluginURI'] = esc_url($plugin_data['PluginURI']);
    $plugin_data['AuthorURI'] = esc_url($plugin_data['AuthorURI']);
    $plugin_data['Title'] = $plugin_data['Name'];
    $plugin_data['AuthorName'] = $plugin_data['Author'];
    // Apply markup
    if ($markup) {
        if ($plugin_data['PluginURI'] && $plugin_data['Name']) {
            $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Name'] . '</a>';
        }
        if ($plugin_data['AuthorURI'] && $plugin_data['Author']) {
            $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
        }
        $plugin_data['Description'] = wptexturize($plugin_data['Description']);
        if ($plugin_data['Author']) {
            $plugin_data['Description'] .= ' <cite>' . sprintf(__('By %s.'), $plugin_data['Author']) . '</cite>';
        }
    }
    return $plugin_data;
}

WordPress Version: 4.5

/**
 * Sanitizes plugin data, optionally adds markup, optionally translates.
 *
 * @since 2.7.0
 * @access private
 * @see get_plugin_data()
 */
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true)
{
    // Sanitize the plugin filename to a WP_PLUGIN_DIR relative path
    $plugin_file = plugin_basename($plugin_file);
    // Translate fields
    if ($translate) {
        if ($textdomain = $plugin_data['TextDomain']) {
            if (!is_textdomain_loaded($textdomain)) {
                if ($plugin_data['DomainPath']) {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file) . $plugin_data['DomainPath']);
                } else {
                    load_plugin_textdomain($textdomain, false, dirname($plugin_file));
                }
            }
        } elseif ('hello.php' == basename($plugin_file)) {
            $textdomain = 'default';
        }
        if ($textdomain) {
            foreach (array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field) {
                $plugin_data[$field] = translate($plugin_data[$field], $textdomain);
            }
        }
    }
    // Sanitize fields
    $allowed_tags = $allowed_tags_in_links = array('abbr' => array('title' => true), 'acronym' => array('title' => true), 'code' => true, 'em' => true, 'strong' => true);
    $allowed_tags['a'] = array('href' => true, 'title' => true);
    // Name is marked up inside <a> tags. Don't allow these.
    // Author is too, but some plugins have used <a> here (omitting Author URI).
    $plugin_data['Name'] = wp_kses($plugin_data['Name'], $allowed_tags_in_links);
    $plugin_data['Author'] = wp_kses($plugin_data['Author'], $allowed_tags);
    $plugin_data['Description'] = wp_kses($plugin_data['Description'], $allowed_tags);
    $plugin_data['Version'] = wp_kses($plugin_data['Version'], $allowed_tags);
    $plugin_data['PluginURI'] = esc_url($plugin_data['PluginURI']);
    $plugin_data['AuthorURI'] = esc_url($plugin_data['AuthorURI']);
    $plugin_data['Title'] = $plugin_data['Name'];
    $plugin_data['AuthorName'] = $plugin_data['Author'];
    // Apply markup
    if ($markup) {
        if ($plugin_data['PluginURI'] && $plugin_data['Name']) {
            $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Name'] . '</a>';
        }
        if ($plugin_data['AuthorURI'] && $plugin_data['Author']) {
            $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
        }
        $plugin_data['Description'] = wptexturize($plugin_data['Description']);
        if ($plugin_data['Author']) {
            $plugin_data['Description'] .= ' <cite>' . sprintf(__('By %s.'), $plugin_data['Author']) . '</cite>';
        }
    }
    return $plugin_data;
}

WordPress Version: 4.0

/**
 * Sanitizes plugin data, optionally adds markup, optionally translates.
 *
 * @since 2.7.0
 * @access private
 * @see get_plugin_data()
 */
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true)
{
    // Sanitize the plugin filename to a WP_PLUGIN_DIR relative path
    $plugin_file = plugin_basename($plugin_file);
    // Translate fields
    if ($translate) {
        if ($textdomain = $plugin_data['TextDomain']) {
            if ($plugin_data['DomainPath']) {
                load_plugin_textdomain($textdomain, false, dirname($plugin_file) . $plugin_data['DomainPath']);
            } else {
                load_plugin_textdomain($textdomain, false, dirname($plugin_file));
            }
        } elseif (in_array(basename($plugin_file), array('hello.php', 'akismet.php'))) {
            $textdomain = 'default';
        }
        if ($textdomain) {
            foreach (array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field) {
                $plugin_data[$field] = translate($plugin_data[$field], $textdomain);
            }
        }
    }
    // Sanitize fields
    $allowed_tags = $allowed_tags_in_links = array('abbr' => array('title' => true), 'acronym' => array('title' => true), 'code' => true, 'em' => true, 'strong' => true);
    $allowed_tags['a'] = array('href' => true, 'title' => true);
    // Name is marked up inside <a> tags. Don't allow these.
    // Author is too, but some plugins have used <a> here (omitting Author URI).
    $plugin_data['Name'] = wp_kses($plugin_data['Name'], $allowed_tags_in_links);
    $plugin_data['Author'] = wp_kses($plugin_data['Author'], $allowed_tags);
    $plugin_data['Description'] = wp_kses($plugin_data['Description'], $allowed_tags);
    $plugin_data['Version'] = wp_kses($plugin_data['Version'], $allowed_tags);
    $plugin_data['PluginURI'] = esc_url($plugin_data['PluginURI']);
    $plugin_data['AuthorURI'] = esc_url($plugin_data['AuthorURI']);
    $plugin_data['Title'] = $plugin_data['Name'];
    $plugin_data['AuthorName'] = $plugin_data['Author'];
    // Apply markup
    if ($markup) {
        if ($plugin_data['PluginURI'] && $plugin_data['Name']) {
            $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Name'] . '</a>';
        }
        if ($plugin_data['AuthorURI'] && $plugin_data['Author']) {
            $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
        }
        $plugin_data['Description'] = wptexturize($plugin_data['Description']);
        if ($plugin_data['Author']) {
            $plugin_data['Description'] .= ' <cite>' . sprintf(__('By %s.'), $plugin_data['Author']) . '</cite>';
        }
    }
    return $plugin_data;
}

WordPress Version: 3.7

/**
 * Sanitizes plugin data, optionally adds markup, optionally translates.
 *
 * @since 2.7.0
 * @access private
 * @see get_plugin_data()
 */
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true)
{
    // Sanitize the plugin filename to a WP_PLUGIN_DIR relative path
    $plugin_file = plugin_basename($plugin_file);
    // Translate fields
    if ($translate) {
        if ($textdomain = $plugin_data['TextDomain']) {
            if ($plugin_data['DomainPath']) {
                load_plugin_textdomain($textdomain, false, dirname($plugin_file) . $plugin_data['DomainPath']);
            } else {
                load_plugin_textdomain($textdomain, false, dirname($plugin_file));
            }
        } elseif (in_array(basename($plugin_file), array('hello.php', 'akismet.php'))) {
            $textdomain = 'default';
        }
        if ($textdomain) {
            foreach (array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field) {
                $plugin_data[$field] = translate($plugin_data[$field], $textdomain);
            }
        }
    }
    // Sanitize fields
    $allowed_tags = $allowed_tags_in_links = array('abbr' => array('title' => true), 'acronym' => array('title' => true), 'code' => true, 'em' => true, 'strong' => true);
    $allowed_tags['a'] = array('href' => true, 'title' => true);
    // Name is marked up inside <a> tags. Don't allow these.
    // Author is too, but some plugins have used <a> here (omitting Author URI).
    $plugin_data['Name'] = wp_kses($plugin_data['Name'], $allowed_tags_in_links);
    $plugin_data['Author'] = wp_kses($plugin_data['Author'], $allowed_tags);
    $plugin_data['Description'] = wp_kses($plugin_data['Description'], $allowed_tags);
    $plugin_data['Version'] = wp_kses($plugin_data['Version'], $allowed_tags);
    $plugin_data['PluginURI'] = esc_url($plugin_data['PluginURI']);
    $plugin_data['AuthorURI'] = esc_url($plugin_data['AuthorURI']);
    $plugin_data['Title'] = $plugin_data['Name'];
    $plugin_data['AuthorName'] = $plugin_data['Author'];
    // Apply markup
    if ($markup) {
        if ($plugin_data['PluginURI'] && $plugin_data['Name']) {
            $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . esc_attr__('Visit plugin homepage') . '">' . $plugin_data['Name'] . '</a>';
        }
        if ($plugin_data['AuthorURI'] && $plugin_data['Author']) {
            $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . esc_attr__('Visit author homepage') . '">' . $plugin_data['Author'] . '</a>';
        }
        $plugin_data['Description'] = wptexturize($plugin_data['Description']);
        if ($plugin_data['Author']) {
            $plugin_data['Description'] .= ' <cite>' . sprintf(__('By %s.'), $plugin_data['Author']) . '</cite>';
        }
    }
    return $plugin_data;
}