Index: wordpress/wp-includes/plugin.php
===================================================================
--- wordpress/wp-includes/plugin.php	(revision 6317)
+++ wordpress/wp-includes/plugin.php	(working copy)
@@ -107,8 +107,10 @@
  * @return string The text in <tt>$string</tt> after all hooked functions are applied to it.
  */
 function apply_filters($tag, $value) {
-	global $wp_filter, $merged_filters;
+	global $wp_filter, $merged_filters, $wp_current_filter;
 
+	@$wp_current_filter[] = $tag;
+
 	// Do 'all' actions first
 	if ( isset($wp_filter['all']) ) {
 		reset( $wp_filter['all'] );
@@ -120,8 +122,10 @@
 		} while ( next($wp_filter['all']) !== false );
 	}
 
-	if ( !isset($wp_filter[$tag]) )
+	if ( !isset($wp_filter[$tag]) ) {
+		array_pop($wp_current_filter);
 		return $value;
+	}
 
 	// Sort
 	if ( !isset( $merged_filters[ $tag ] ) ) {
@@ -142,6 +146,8 @@
 			}
 
 	} while ( next($wp_filter[$tag]) !== false );
+	
+	array_pop( $wp_current_filter );
 
 	return $value;
 }
@@ -182,6 +188,15 @@
 
 
 /**
+ * Return the name of the current filter or action.
+ */
+function current_filter() {
+	global $wp_current_filter;
+	return end( $wp_current_filter );
+}
+
+
+/**
  * Hooks a function on to a specific action.
  *
  * Actions are the hooks that the WordPress core launches at specific points
@@ -233,7 +248,7 @@
  * @return null Will return null if $tag does not exist in $wp_filter array
  */
 function do_action($tag, $arg = '') {
-	global $wp_action, $wp_actions;
+	global $wp_action, $wp_actions, $wp_current_filter;
 
 	if ( is_array($wp_actions) )
 		$wp_actions[] = $tag;
@@ -248,6 +263,8 @@
 	for ( $a = 2; $a < func_num_args(); $a++ )
 		$args[] = func_get_arg($a);
 
+	@$wp_current_filter[] = $tag;
+
 	// Do 'all' actions first
 	if ( isset($wp_action['all']) ) {
 		do {
@@ -258,9 +275,11 @@
 		} while ( next($wp_action['all']) !== false );
 	}
 
-	if ( !isset($wp_action[$tag]) )
+	if ( !isset($wp_action[$tag]) ) {
+		array_pop($wp_current_filter);
 		return;
-
+	}
+		
 	// Sort
 	if ( !isset( $merged_actions[ $tag ] ) ) {
 		reset($wp_action[$tag]);
@@ -277,6 +296,7 @@
 
 	} while ( next($wp_action[$tag]) !== false );
 
+		array_pop($wp_current_filter);
 }
 
 /**
@@ -524,4 +544,4 @@
 		return $function[0].$function[1];
 }
 
-?>
\ No newline at end of file
+?>

