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: http://svn.automattic.com/wordpress/trunk@10765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2009-03-10 19:50:55 +00:00
parent 8247b5df4f
commit df58ca2a41
1 changed files with 26 additions and 0 deletions

View File

@ -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.
*