Introducing plugin_dir_path(__FILE__) and plugin_dir_url(__FILE__) ... simple API functions for determining the directory path/url of the current plugin file
git-svn-id: https://develop.svn.wordpress.org/trunk@10765 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
bcb764b964
commit
842a28e67c
@ -496,6 +496,32 @@ function plugin_basename($file) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in
|
||||
* @package WordPress
|
||||
* @subpackage Plugin
|
||||
* @since 2.8
|
||||
*
|
||||
* @param string $file The filename of the plugin (__FILE__)
|
||||
* @return string the filesystem path of the directory that contains the plugin
|
||||
*/
|
||||
function plugin_dir_path( $file ) {
|
||||
return trailingslashit( dirname( $file ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL directory path (with trailing slash) for the plugin __FILE__ passed in
|
||||
* @package WordPress
|
||||
* @subpackage Plugin
|
||||
* @since 2.8
|
||||
*
|
||||
* @param string $file The filename of the plugin (__FILE__)
|
||||
* @return string the URL path of the directory that contains the plugin
|
||||
*/
|
||||
function plugin_dir_url( $file ) {
|
||||
return trailingslashit( plugins_url( '', $file ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the activation hook for a plugin.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user