WordPress.org

Make WordPress Core

Ticket #16953: 16953.2.diff

File 16953.2.diff, 891 bytes (added by nacin, 7 years ago)
  • wp-includes/plugin.php

     
    563563 * @uses WP_PLUGIN_DIR
    564564 */
    565565function plugin_basename($file) {
     566        $arg = $file;
    566567        $file = str_replace('\\','/',$file); // sanitize for Win32 installs
    567568        $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
    568569        $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
     
    571572        $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash
    572573        $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
    573574        $file = trim($file, '/');
    574         return $file;
     575        return apply_filters( 'plugin_basename', $file, $arg );
    575576}
    576577
    577578/**