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

git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2007-08-23 18:11:44 +00:00
parent f80a41e447
commit 5db0caf904
1 changed files with 3 additions and 2 deletions

View File

@ -235,8 +235,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;
}