Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 4104)
+++ wp-includes/functions.php	(working copy)
@@ -1173,4 +1173,74 @@
 	die();
 }
 
+/**
+ * Get information about a plugin
+ *
+ * Function called by plugins to get information about themselves.  Currently
+ * plugins can get the following information:
+ * 'base' To get the base directory the plugin is in, releative to the /plugins directory
+ * 'path' To get the absolute path to the plugins base directory
+ * 'url' To get the full URL to the plugin's base directory
+ * 'version' To get the version number for the plugin
+ * Returns FALSE if the information isn't set for the plugin.
+ *
+ * @param	string	$info	The information to get
+ * @return	mixed
+ */
+function get_plugininfo($info) {
+	global $pluginInfos;
+	$backtrace = debug_backtrace();
+	if (empty($backtrace[0])) {
+		return false;
+	}
+
+	$ds = DIRECTORY_SEPARATOR;
+	if ('\\' == $ds) {
+		$ds = '\\\\';
+	}
+	
+	// If there is no sub directory, use the plugin's filename instead
+	if (!preg_match('@wp-content' . $ds . 'plugins' . $ds . '(.*)' . $ds . '@U', $backtrace[0]['file'], $matches)) {
+		$plugin = basename($backtrace[0]['file']);
+	} else {
+		$plugin = $matches[1];
+	}
+
+	if (!isset($pluginInfos[$plugin][$info])) {
+		return false;
+	}
+	return $pluginInfos[$plugin][$info];
+}
+
+/**
+ * Adds information about a plugin to the $pluginsInfos global variable
+ *
+ * Function that is called prior to including the plugin, which fills up the
+ * $pluginInfos global variable with information about the plugin to be
+ * retrieved with the get_plugininfo() function.  Always returns TRUE.
+ *
+ * @param	string	$plugin	The base name of the plugin file
+ * @return	bool
+ */
+function add_plugininfo($plugin) {
+	global $pluginInfos;
+	$dir_name = dirname($plugin);
+	
+	// If the plugin is in it's own sub directory, we'll use that directory
+	// name as the index for the $pluginInfos array.  Otherwise use the
+	// plugin file name.
+	if ($dir_name == '.') {
+		$dir_name = '';
+		$plugin_base = basename($plugin);
+	} else {
+		$plugin_base = $dir_name;
+	}
+	
+	$pluginInfos[$plugin_base]['base'] = $dir_name;
+	$pluginInfos[$plugin_base]['path'] = ABSPATH . 'wp-content/plugins/' . $dir_name;
+	$pluginInfos[$plugin_base]['url'] = get_bloginfo('wpurl') . '/wp-content/plugins/' . $dir_name;
+	preg_match('/version\s?:(.*)/i', file_get_contents(ABSPATH . 'wp-content/plugins/' . $plugin), $matches);
+	$pluginInfos[$plugin_base]['version'] = trim($matches[1]);
+	return true;
+}
 ?>
Index: wp-settings.php
===================================================================
--- wp-settings.php	(revision 4104)
+++ wp-settings.php	(working copy)
@@ -169,6 +169,7 @@
 	if ( is_array($current_plugins) ) {
 		foreach ($current_plugins as $plugin) {
 			if ('' != $plugin && file_exists(ABSPATH . 'wp-content/plugins/' . $plugin))
+				add_plugininfo($plugin);
 				include_once(ABSPATH . 'wp-content/plugins/' . $plugin);
 		}
 	}
