Ticket #11007: plugin.php.diff
File plugin.php.diff, 1.0 KB (added by , 14 years ago) |
---|
-
plugin.php
old new 484 484 * @access private 485 485 * 486 486 * @param string $file The filename of plugin. 487 * @param bool $strip_ext Set to true to strip file extension. Default false. 487 488 * @return string The name of a plugin. 488 489 * @uses WP_PLUGIN_DIR 489 490 */ 490 function plugin_basename( $file) {491 function plugin_basename( $file, $strip_ext = false ) { 491 492 $file = str_replace('\\','/',$file); // sanitize for Win32 installs 492 493 $file = preg_replace('|/+|','/', $file); // remove any duplicate slash 493 494 $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs … … 496 497 $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash 497 498 $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir 498 499 $file = trim($file, '/'); 500 if ( $strip_ext ) { 501 $file = substr( $file, 0, strrpos( $file, '.' ) ); 502 } 499 503 return $file; 500 504 } 501 505