Index: plugin.php
===================================================================
--- plugin.php	(revision 26820)
+++ plugin.php	(working copy)
@@ -82,8 +82,8 @@
 function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
 	global $wp_filter, $merged_filters;
 
-	$idx = _wp_filter_build_unique_id($tag, $function_to_add, $priority);
-	$wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);
+	$idx = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );
+	$wp_filter[ $tag ][ $priority ][ $idx ] = array( 'function' => $function_to_add, 'accepted_args' => $accepted_args );
 	unset( $merged_filters[ $tag ] );
 	return true;
 }
@@ -103,18 +103,18 @@
  * 	When using the $function_to_check argument, this function may return a non-boolean value that evaluates to false
  * 	(e.g.) 0, so use the === operator for testing the return value.
  */
-function has_filter($tag, $function_to_check = false) {
+function has_filter( $tag, $function_to_check = false ) {
 	global $wp_filter;
 
-	$has = !empty($wp_filter[$tag]);
+	$has = !empty( $wp_filter[ $tag ] );
 	if ( false === $function_to_check || false == $has )
 		return $has;
 
-	if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false) )
+	if ( ! $idx = _wp_filter_build_unique_id( $tag, $function_to_check, false ) )
 		return false;
 
-	foreach ( (array) array_keys($wp_filter[$tag]) as $priority ) {
-		if ( isset($wp_filter[$tag][$priority][$idx]) )
+	foreach ( (array) array_keys( $wp_filter[ $tag ] ) as $priority ) {
+		if ( isset( $wp_filter[ $tag ][ $priority ][ $idx ] ) )
 			return $priority;
 	}
 
@@ -166,40 +166,40 @@
 	$args = array();
 
 	// Do 'all' actions first
-	if ( isset($wp_filter['all']) ) {
+	if ( isset( $wp_filter['all'] ) ) {
 		$wp_current_filter[] = $tag;
 		$args = func_get_args();
-		_wp_call_all_hook($args);
+		_wp_call_all_hook( $args );
 	}
 
-	if ( !isset($wp_filter[$tag]) ) {
-		if ( isset($wp_filter['all']) )
-			array_pop($wp_current_filter);
+	if ( ! isset( $wp_filter[ $tag ] ) ) {
+		if ( isset( $wp_filter['all'] ) )
+			array_pop( $wp_current_filter );
 		return $value;
 	}
 
-	if ( !isset($wp_filter['all']) )
+	if ( ! isset( $wp_filter['all'] ) )
 		$wp_current_filter[] = $tag;
 
 	// Sort
-	if ( !isset( $merged_filters[ $tag ] ) ) {
-		ksort($wp_filter[$tag]);
+	if ( ! isset( $merged_filters[ $tag ] ) ) {
+		ksort( $wp_filter[ $tag ] );
 		$merged_filters[ $tag ] = true;
 	}
 
 	reset( $wp_filter[ $tag ] );
 
-	if ( empty($args) )
+	if ( empty( $args ) )
 		$args = func_get_args();
 
 	do {
-		foreach( (array) current($wp_filter[$tag]) as $the_ )
-			if ( !is_null($the_['function']) ){
+		foreach ( (array) current( $wp_filter[ $tag ] ) as $the_ )
+			if ( ! is_null( $the_['function'] ) ){
 				$args[1] = $value;
-				$value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
+				$value = call_user_func_array( $the_['function'], array_slice( $args, 1, (int) $the_['accepted_args'] ) );
 			}
 
-	} while ( next($wp_filter[$tag]) !== false );
+	} while ( next( $wp_filter[$tag] ) !== false );
 
 	array_pop( $wp_current_filter );
 
@@ -223,28 +223,28 @@
  * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt>
  * @return mixed The filtered value after all hooked functions are applied to it.
  */
-function apply_filters_ref_array($tag, $args) {
+function apply_filters_ref_array( $tag, $args ) {
 	global $wp_filter, $merged_filters, $wp_current_filter;
 
 	// Do 'all' actions first
-	if ( isset($wp_filter['all']) ) {
+	if ( isset( $wp_filter['all'] ) ) {
 		$wp_current_filter[] = $tag;
 		$all_args = func_get_args();
-		_wp_call_all_hook($all_args);
+		_wp_call_all_hook( $all_args );
 	}
 
-	if ( !isset($wp_filter[$tag]) ) {
-		if ( isset($wp_filter['all']) )
-			array_pop($wp_current_filter);
+	if ( ! isset( $wp_filter[ $tag ] ) ) {
+		if ( isset( $wp_filter['all'] ) )
+			array_pop( $wp_current_filter );
 		return $args[0];
 	}
 
-	if ( !isset($wp_filter['all']) )
+	if ( ! isset( $wp_filter['all'] ) )
 		$wp_current_filter[] = $tag;
 
 	// Sort
-	if ( !isset( $merged_filters[ $tag ] ) ) {
-		ksort($wp_filter[$tag]);
+	if ( ! isset( $merged_filters[ $tag ] ) ) {
+		ksort( $wp_filter[ $tag ] );
 		$merged_filters[ $tag ] = true;
 	}
 
@@ -251,11 +251,11 @@
 	reset( $wp_filter[ $tag ] );
 
 	do {
-		foreach( (array) current($wp_filter[$tag]) as $the_ )
-			if ( !is_null($the_['function']) )
-				$args[0] = call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
+		foreach ( (array) current( $wp_filter[ $tag ] ) as $the_ )
+			if ( ! is_null( $the_['function'] ) )
+				$args[0] = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
 
-	} while ( next($wp_filter[$tag]) !== false );
+	} while ( next( $wp_filter[ $tag ] ) !== false );
 
 	array_pop( $wp_current_filter );
 
@@ -284,15 +284,15 @@
  * @return boolean Whether the function existed before it was removed.
  */
 function remove_filter( $tag, $function_to_remove, $priority = 10 ) {
-	$function_to_remove = _wp_filter_build_unique_id($tag, $function_to_remove, $priority);
+	$function_to_remove = _wp_filter_build_unique_id( $tag, $function_to_remove, $priority );
 
-	$r = isset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]);
+	$r = isset( $GLOBALS['wp_filter'][ $tag ][ $priority ][ $function_to_remove ] );
 
 	if ( true === $r) {
-		unset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]);
-		if ( empty($GLOBALS['wp_filter'][$tag][$priority]) )
-			unset($GLOBALS['wp_filter'][$tag][$priority]);
-		unset($GLOBALS['merged_filters'][$tag]);
+		unset( $GLOBALS['wp_filter'][ $tag ][ $priority ][ $function_to_remove ] );
+		if ( empty( $GLOBALS['wp_filter'][ $tag ][ $priority ] ) )
+			unset( $GLOBALS['wp_filter'][ $tag ][ $priority ] );
+		unset( $GLOBALS['merged_filters'][ $tag ] );
 	}
 
 	return $r;
@@ -307,18 +307,18 @@
  * @param int $priority The priority number to remove.
  * @return bool True when finished.
  */
-function remove_all_filters($tag, $priority = false) {
+function remove_all_filters( $tag, $priority = false ) {
 	global $wp_filter, $merged_filters;
 
-	if( isset($wp_filter[$tag]) ) {
-		if( false !== $priority && isset($wp_filter[$tag][$priority]) )
-			unset($wp_filter[$tag][$priority]);
+	if( isset( $wp_filter[ $tag ] ) ) {
+		if( false !== $priority && isset( $wp_filter[ $tag ][ $priority ] ) )
+			unset( $wp_filter[ $tag ][ $priority ] );
 		else
-			unset($wp_filter[$tag]);
+			unset( $wp_filter[ $tag ] );
 	}
 
-	if( isset($merged_filters[$tag]) )
-		unset($merged_filters[$tag]);
+	if( isset( $merged_filters[ $tag ] ) )
+		unset( $merged_filters[ $tag ] );
 
 	return true;
 }
@@ -356,8 +356,8 @@
  * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
  * @param int $accepted_args optional. The number of arguments the function accept (default 1).
  */
-function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
-	return add_filter($tag, $function_to_add, $priority, $accepted_args);
+function add_action( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
+	return add_filter( $tag, $function_to_add, $priority, $accepted_args );
 }
 
 /**
@@ -383,41 +383,41 @@
  * @param mixed $arg,... Optional additional arguments which are passed on to the functions hooked to the action.
  * @return null Will return null if $tag does not exist in $wp_filter array
  */
-function do_action($tag, $arg = '') {
+function do_action( $tag, $arg = '' ) {
 	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
 
-	if ( ! isset($wp_actions[$tag]) )
-		$wp_actions[$tag] = 1;
+	if ( ! isset( $wp_actions[ $tag ] ) )
+		$wp_actions[ $tag ] = 1;
 	else
-		++$wp_actions[$tag];
+		++$wp_actions[ $tag ];
 
 	// Do 'all' actions first
-	if ( isset($wp_filter['all']) ) {
+	if ( isset( $wp_filter['all'] ) ) {
 		$wp_current_filter[] = $tag;
 		$all_args = func_get_args();
-		_wp_call_all_hook($all_args);
+		_wp_call_all_hook( $all_args );
 	}
 
-	if ( !isset($wp_filter[$tag]) ) {
-		if ( isset($wp_filter['all']) )
-			array_pop($wp_current_filter);
+	if ( ! isset( $wp_filter[ $tag ] ) ) {
+		if ( isset( $wp_filter['all'] ) )
+			array_pop( $wp_current_filter );
 		return;
 	}
 
-	if ( !isset($wp_filter['all']) )
+	if ( ! isset( $wp_filter['all'] ) )
 		$wp_current_filter[] = $tag;
 
 	$args = array();
-	if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) // array(&$this)
+	if ( is_array( $arg ) && 1 == count( $arg ) && isset( $arg[0] ) && is_object( $arg[0] ) ) // array(&$this)
 		$args[] =& $arg[0];
 	else
 		$args[] = $arg;
 	for ( $a = 2; $a < func_num_args(); $a++ )
-		$args[] = func_get_arg($a);
+		$args[] = func_get_arg( $a );
 
 	// Sort
 	if ( !isset( $merged_filters[ $tag ] ) ) {
-		ksort($wp_filter[$tag]);
+		ksort( $wp_filter[ $tag ] );
 		$merged_filters[ $tag ] = true;
 	}
 
@@ -424,13 +424,13 @@
 	reset( $wp_filter[ $tag ] );
 
 	do {
-		foreach ( (array) current($wp_filter[$tag]) as $the_ )
-			if ( !is_null($the_['function']) )
-				call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
+		foreach ( (array) current( $wp_filter[ $tag ] ) as $the_ )
+			if ( ! is_null( $the_['function'] ) )
+				call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
 
-	} while ( next($wp_filter[$tag]) !== false );
+	} while ( next( $wp_filter[ $tag ] ) !== false );
 
-	array_pop($wp_current_filter);
+	array_pop( $wp_current_filter );
 }
 
 /**
@@ -444,13 +444,13 @@
  * @param string $tag The name of the action hook.
  * @return int The number of times action hook <tt>$tag</tt> is fired
  */
-function did_action($tag) {
+function did_action( $tag ) {
 	global $wp_actions;
 
 	if ( ! isset( $wp_actions[ $tag ] ) )
 		return 0;
 
-	return $wp_actions[$tag];
+	return $wp_actions[ $tag ];
 }
 
 /**
@@ -469,33 +469,33 @@
  * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt>
  * @return null Will return null if $tag does not exist in $wp_filter array
  */
-function do_action_ref_array($tag, $args) {
+function do_action_ref_array( $tag, $args ) {
 	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
 
-	if ( ! isset($wp_actions[$tag]) )
+	if ( ! isset( $wp_actions[ $tag ] ) )
 		$wp_actions[$tag] = 1;
 	else
 		++$wp_actions[$tag];
 
 	// Do 'all' actions first
-	if ( isset($wp_filter['all']) ) {
+	if ( isset( $wp_filter['all'] ) ) {
 		$wp_current_filter[] = $tag;
 		$all_args = func_get_args();
-		_wp_call_all_hook($all_args);
+		_wp_call_all_hook( $all_args );
 	}
 
-	if ( !isset($wp_filter[$tag]) ) {
-		if ( isset($wp_filter['all']) )
-			array_pop($wp_current_filter);
+	if ( ! isset( $wp_filter[ $tag ] ) ) {
+		if ( isset( $wp_filter['all'] ) )
+			array_pop( $wp_current_filter );
 		return;
 	}
 
-	if ( !isset($wp_filter['all']) )
+	if ( ! isset( $wp_filter['all'] ) )
 		$wp_current_filter[] = $tag;
 
 	// Sort
-	if ( !isset( $merged_filters[ $tag ] ) ) {
-		ksort($wp_filter[$tag]);
+	if ( ! isset( $merged_filters[ $tag ] ) ) {
+		ksort( $wp_filter[ $tag ] );
 		$merged_filters[ $tag ] = true;
 	}
 
@@ -502,13 +502,13 @@
 	reset( $wp_filter[ $tag ] );
 
 	do {
-		foreach( (array) current($wp_filter[$tag]) as $the_ )
-			if ( !is_null($the_['function']) )
-				call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
+		foreach( (array) current( $wp_filter[ $tag ] ) as $the_ )
+			if ( ! is_null( $the_['function'] ) )
+				call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
 
-	} while ( next($wp_filter[$tag]) !== false );
+	} while ( next( $wp_filter[ $tag ] ) !== false );
 
-	array_pop($wp_current_filter);
+	array_pop( $wp_current_filter );
 }
 
 /**
@@ -526,8 +526,8 @@
  * 	When using the $function_to_check argument, this function may return a non-boolean value that evaluates to false
  * 	(e.g.) 0, so use the === operator for testing the return value.
  */
-function has_action($tag, $function_to_check = false) {
-	return has_filter($tag, $function_to_check);
+function has_action( $tag, $function_to_check = false ) {
+	return has_filter( $tag, $function_to_check );
 }
 
 /**
@@ -559,8 +559,8 @@
  * @param int $priority The priority number to remove them from.
  * @return bool True when finished.
  */
-function remove_all_actions($tag, $priority = false) {
-	return remove_all_filters($tag, $priority);
+function remove_all_actions( $tag, $priority = false ) {
+	return remove_all_filters( $tag, $priority );
 }
 
 //
@@ -582,15 +582,15 @@
  * @return string The name of a plugin.
  * @uses WP_PLUGIN_DIR
  */
-function plugin_basename($file) {
-	$file = str_replace('\\','/',$file); // sanitize for Win32 installs
-	$file = preg_replace('|/+|','/', $file); // remove any duplicate slash
-	$plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
-	$plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash
-	$mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs
-	$mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash
-	$file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
-	$file = trim($file, '/');
+function plugin_basename( $file ) {
+	$file = str_replace( '\\', '/', $file ); // sanitize for Win32 installs
+	$file = preg_replace( '|/+|', '/', $file ); // remove any duplicate slash
+	$plugin_dir = str_replace( '\\', '/', WP_PLUGIN_DIR ); // sanitize for Win32 installs
+	$plugin_dir = preg_replace( '|/+|', '/', $plugin_dir ); // remove any duplicate slash
+	$mu_plugin_dir = str_replace( '\\', '/', WPMU_PLUGIN_DIR ); // sanitize for Win32 installs
+	$mu_plugin_dir = preg_replace( '|/+|', '/', $mu_plugin_dir ); // remove any duplicate slash
+	$file = preg_replace( '#^' . preg_quote( $plugin_dir, '#' ) . '/|^' . preg_quote( $mu_plugin_dir, '#' ) . '/#', '', $file); // get relative path from plugins dir
+	$file = trim( $file, '/' );
 	return $file;
 }
 
@@ -640,9 +640,9 @@
  * @param string $file The filename of the plugin including the path.
  * @param callback $function the function hooked to the 'activate_PLUGIN' action.
  */
-function register_activation_hook($file, $function) {
-	$file = plugin_basename($file);
-	add_action('activate_' . $file, $function);
+function register_activation_hook( $file, $function ) {
+	$file = plugin_basename( $file );
+	add_action( 'activate_' . $file, $function );
 }
 
 /**
@@ -665,9 +665,9 @@
  * @param string $file The filename of the plugin including the path.
  * @param callback $function the function hooked to the 'deactivate_PLUGIN' action.
  */
-function register_deactivation_hook($file, $function) {
-	$file = plugin_basename($file);
-	add_action('deactivate_' . $file, $function);
+function register_deactivation_hook( $file, $function ) {
+	$file = plugin_basename( $file );
+	add_action( 'deactivate_' . $file, $function );
 }
 
 /**
@@ -704,9 +704,9 @@
 	// The option should not be autoloaded, because it is not needed in most
 	// cases. Emphasis should be put on using the 'uninstall.php' way of
 	// uninstalling the plugin.
-	$uninstallable_plugins = (array) get_option('uninstall_plugins');
-	$uninstallable_plugins[plugin_basename($file)] = $callback;
-	update_option('uninstall_plugins', $uninstallable_plugins);
+	$uninstallable_plugins = (array) get_option( 'uninstall_plugins' );
+	$uninstallable_plugins[ plugin_basename( $file ) ] = $callback;
+	update_option( 'uninstall_plugins', $uninstallable_plugins );
 }
 
 /**
@@ -729,16 +729,16 @@
  *
  * @param array $args The collected parameters from the hook that was called.
  */
-function _wp_call_all_hook($args) {
+function _wp_call_all_hook( $args ) {
 	global $wp_filter;
 
 	reset( $wp_filter['all'] );
 	do {
-		foreach( (array) current($wp_filter['all']) as $the_ )
-			if ( !is_null($the_['function']) )
-				call_user_func_array($the_['function'], $args);
+		foreach( (array) current( $wp_filter['all'] ) as $the_ )
+			if ( ! is_null( $the_['function'] ) )
+				call_user_func_array( $the_['function'], $args );
 
-	} while ( next($wp_filter['all']) !== false );
+	} while ( next( $wp_filter['all'] ) !== false );
 }
 
 /**
@@ -770,14 +770,14 @@
  * @param int|bool $priority Used in counting how many hooks were applied. If === false and $function is an object reference, we return the unique id only if it already has one, false otherwise.
  * @return string|bool Unique ID for usage as array key or false if $priority === false and $function is an object reference, and it does not already have a unique id.
  */
-function _wp_filter_build_unique_id($tag, $function, $priority) {
+function _wp_filter_build_unique_id( $tag, $function, $priority ) {
 	global $wp_filter;
 	static $filter_id_count = 0;
 
-	if ( is_string($function) )
+	if ( is_string( $function ) )
 		return $function;
 
-	if ( is_object($function) ) {
+	if ( is_object( $function ) ) {
 		// Closures are currently implemented as objects
 		$function = array( $function, '' );
 	} else {
@@ -784,16 +784,16 @@
 		$function = (array) $function;
 	}
 
-	if (is_object($function[0]) ) {
+	if ( is_object( $function[0] ) ) {
 		// Object Class Calling
-		if ( function_exists('spl_object_hash') ) {
-			return spl_object_hash($function[0]) . $function[1];
+		if ( function_exists( 'spl_object_hash' ) ) {
+			return spl_object_hash( $function[0] ) . $function[1];
 		} else {
-			$obj_idx = get_class($function[0]).$function[1];
-			if ( !isset($function[0]->wp_filter_id) ) {
+			$obj_idx = get_class( $function[0] ) . $function[1];
+			if ( ! isset( $function[0]->wp_filter_id ) ) {
 				if ( false === $priority )
 					return false;
-				$obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : $filter_id_count;
+				$obj_idx .= isset( $wp_filter[ $tag ][ $priority ] ) ? count( (array) $wp_filter[ $tag ][ $priority ] ) : $filter_id_count;
 				$function[0]->wp_filter_id = $filter_id_count;
 				++$filter_id_count;
 			} else {
@@ -802,7 +802,7 @@
 
 			return $obj_idx;
 		}
-	} else if ( is_string($function[0]) ) {
+	} else if ( is_string( $function[0] ) ) {
 		// Static Calling
 		return $function[0] . '::' . $function[1];
 	}
