Index: wp-includes/widgets.php
===================================================================
--- wp-includes/widgets.php	(revision 12196)
+++ wp-includes/widgets.php	(working copy)
@@ -448,6 +448,72 @@
 }
 
 /**
+ * Return the ID of a sidebar given it's name or ID.
+ *
+ * Since register_sidebar() supports it, this function will look for sidebars
+ * named as integers or as a default id (like 2 or 'sidebar-13') first and check
+ * those as IDs if the name fails (and those IDs exist).
+ * ie: $id = get_sidebar_id(1);
+ *     $id = get_sidebar_id('Sidebar Top');
+ *
+ * get_sidebar_id() will also take an array of arguments. The array can contain a
+ * sidebar ID, a sidebar name or both. key/values pairs are ignored.
+ * $id = get_sidebar_id( array('id' => 'sidebar-1') );
+ *
+ * @since 2.9.0
+ *
+ * @param int|string|array $args The name or id of the wigdet specified by
+ * register_sidebar(s) functions. As an array use the register_sidebar() syntax
+ * identifying sidebar by name or id or both.
+ * @return mixed returns false if id not found or returns sidebar id.
+ */
+function get_sidebar_id($args) {
+    global $wp_registered_sidebars;
+
+    if ( is_int($args) || is_string($args) ) {
+
+        // $args is a name or an id
+        $name_or_id = $args;
+
+        // for backward compatibility
+        if ( is_int($name_or_id) ) {
+            return "sidebar-{$name_or_id}";
+
+        } else {
+            $name_or_id = sanitize_title($name_or_id);
+            foreach ( (array) $wp_registered_sidebars as $id => $value ) {
+                if ( sanitize_title($value['name']) == $name_or_id ) {
+                    return $id;
+                }
+            }
+        }
+
+        return $name_or_id;
+
+    } elseif ( is_array($args) ) {
+
+        if ( !array_key_exists('id', $args) and !array_key_exists('name', $args) )
+            return false;
+
+        // $args is an array holding a name, an id or both.
+        if ( array_key_exists('id', $args) && array_key_exists($args['id'], $wp_registered_sidebars) )
+            return $args['id'];
+
+        if ( array_key_exists('name', $args) ) {
+            $name = sanitize_title($args['name']);
+            foreach ( (array) $wp_registered_sidebars as $id => $value ) {
+                if ( sanitize_title($value['name']) == $name ) {
+                    return $id;
+                }
+            }
+        }
+    }
+
+    return false;
+}
+
+
+/**
  * Creates multiple sidebars.
  *
  * If you wanted to quickly create multiple sidebars for a theme or internally.
@@ -564,11 +630,15 @@
  *
  * @uses $wp_registered_sidebars Stores the new sidebar in this array by sidebar ID.
  *
- * @param string $name The ID of the sidebar when it was added.
+ * @param int|string|array $args The name or id of the wigdet specified by
+ * register_sidebar(s) functions. As an array use the register_sidebar() syntax
+ * identifying sidebar by name or id or both.
  */
-function unregister_sidebar( $name ) {
+function unregister_sidebar($name) {
 	global $wp_registered_sidebars;
 
+	$name = get_sidebar_id($name);
+
 	if ( isset( $wp_registered_sidebars[$name] ) )
 		unset( $wp_registered_sidebars[$name] );
 }
@@ -802,23 +872,15 @@
  *
  * @since 2.2.0
  *
- * @param int|string $index Optional, default is 1. Name or ID of dynamic sidebar.
+ * @param int|string|array $args Optional, default is 1. The name or id of the wigdet
+ * specified by register_sidebar(s) functions. As an array use the register_sidebar()
+ * syntax identifying sidebar by name or id or both.
  * @return bool True, if widget sidebar was found and called. False if not found or not called.
  */
 function dynamic_sidebar($index = 1) {
 	global $wp_registered_sidebars, $wp_registered_widgets;
 
-	if ( is_int($index) ) {
-		$index = "sidebar-$index";
-	} else {
-		$index = sanitize_title($index);
-		foreach ( (array) $wp_registered_sidebars as $key => $value ) {
-			if ( sanitize_title($value['name']) == $index ) {
-				$index = $key;
-				break;
-			}
-		}
-	}
+	$index = get_sidebar_id($index);
 
 	$sidebars_widgets = wp_get_sidebars_widgets();
 
@@ -930,11 +992,15 @@
  *
  * @since 2.8
  *
- * @param mixed $index, sidebar name, id or number to check.
+ * @param int|string|array $args The name or id of the wigdet specified by
+ * register_sidebar(s) functions. As an array use the register_sidebar() syntax
+ * identifying sidebar by name or id or both.
  * @return bool true if the sidebar is in use, false otherwise.
  */
 function is_active_sidebar( $index ) {
-	$index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index);
+
+	$index = get_sidebar_id($index);
+
 	$sidebars_widgets = wp_get_sidebars_widgets();
 	if ( isset($sidebars_widgets[$index]) && !empty($sidebars_widgets[$index]) )
 		return true;
