diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 6e7747e9ba..fdc91e8937 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -1775,14 +1775,19 @@ function content_url($path = '') { */ function plugins_url($path = '', $plugin = '') { $scheme = ( is_ssl() ? 'https' : 'http' ); - $url = WP_PLUGIN_URL; + + if ( $plugin !== '' && preg_match('#^' . preg_quote(WPMU_PLUGIN_DIR . DIRECTORY_SEPARATOR, '#') . '#', $plugin) ) { + $url = WPMU_PLUGIN_URL; + } else { + $url = WP_PLUGIN_URL; + } + if ( 0 === strpos($url, 'http') ) { if ( is_ssl() ) $url = str_replace( 'http://', "{$scheme}://", $url ); } - if ( !empty($plugin) && is_string($plugin) ) - { + if ( !empty($plugin) && is_string($plugin) ) { $folder = dirname(plugin_basename($plugin)); if ('.' != $folder) $url .= '/' . ltrim($folder, '/'); diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php index 7b3ae86fbe..99169861c9 100644 --- a/wp-includes/plugin.php +++ b/wp-includes/plugin.php @@ -492,7 +492,9 @@ function plugin_basename($file) { $file = preg_replace('|/+|','/', $file); // remove any duplicate slash $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash - $file = preg_replace('|^' . preg_quote($plugin_dir, '|') . '/|','',$file); // get relative path from plugins dir + $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs + $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash + $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir return $file; }