Fix plugin basename for Windows servers. Fixes #3002 props Ozh

git-svn-id: https://develop.svn.wordpress.org/trunk@5924 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2007-08-23 16:07:21 +00:00
parent 61578a7d73
commit de6855386a
1 changed files with 3 additions and 2 deletions

View File

@ -237,8 +237,9 @@ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args
* @return string The name of a plugin.
*/
function plugin_basename($file) {
$file = preg_replace('|\\\\+|', '\\\\', $file);
$file = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', $file);
$file = str_replace('\\','/',$file); // sanitize for Win32 installs
$file = preg_replace('|/+|','/', $file); // remove any duplicate slash
$file = preg_replace('|^.*/wp-content/plugins/|','',$file); // get relative path from plugins dir
return $file;
}