web/wp-admin/widgets.php
changeset 194 32102edaa81b
parent 136 bde1974c263b
child 204 09a1c134465b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
     5  * @package WordPress
     5  * @package WordPress
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  */
     7  */
     8 
     8 
     9 /** WordPress Administration Bootstrap */
     9 /** WordPress Administration Bootstrap */
    10 require_once( 'admin.php' );
    10 require_once( './admin.php' );
    11 
    11 
    12 /** WordPress Administration Widgets API */
    12 /** WordPress Administration Widgets API */
    13 require_once(ABSPATH . 'wp-admin/includes/widgets.php');
    13 require_once(ABSPATH . 'wp-admin/includes/widgets.php');
    14 
    14 
    15 if ( ! current_user_can('switch_themes') )
    15 if ( ! current_user_can('edit_theme_options') )
    16 	wp_die( __( 'Cheatin’ uh?' ));
    16 	wp_die( __( 'Cheatin’ uh?' ));
    17 
       
    18 wp_admin_css( 'widgets' );
       
    19 
    17 
    20 $widgets_access = get_user_setting( 'widgets_access' );
    18 $widgets_access = get_user_setting( 'widgets_access' );
    21 if ( isset($_GET['widgets-access']) ) {
    19 if ( isset($_GET['widgets-access']) ) {
    22 	$widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off';
    20 	$widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off';
    23 	set_user_setting( 'widgets_access', $widgets_access );
    21 	set_user_setting( 'widgets_access', $widgets_access );
    24 }
    22 }
    25 
    23 
    26 if ( 'on' == $widgets_access )
    24 function wp_widgets_access_body_class($classes) {
    27 	add_filter( 'admin_body_class', create_function('', '{return " widgets_access ";}') );
    25 	return "$classes widgets_access ";
    28 else
    26 }
       
    27 
       
    28 if ( 'on' == $widgets_access ) {
       
    29 	add_filter( 'admin_body_class', 'wp_widgets_access_body_class' );
       
    30 } else {
    29 	wp_enqueue_script('admin-widgets');
    31 	wp_enqueue_script('admin-widgets');
       
    32 
       
    33 	if ( wp_is_mobile() )
       
    34 		wp_enqueue_script( 'jquery-touch-punch' );
       
    35 }
    30 
    36 
    31 do_action( 'sidebar_admin_setup' );
    37 do_action( 'sidebar_admin_setup' );
    32 
    38 
    33 $title = __( 'Widgets' );
    39 $title = __( 'Widgets' );
    34 $parent_file = 'themes.php';
    40 $parent_file = 'themes.php';
    35 
    41 
    36 // register the inactive_widgets area as sidebar
    42 get_current_screen()->add_help_tab( array(
    37 register_sidebar(array(
    43 'id'		=> 'overview',
    38 	'name' => __('Inactive Widgets'),
    44 'title'		=> __('Overview'),
    39 	'id' => 'wp_inactive_widgets',
    45 'content'	=>
    40 	'description' => '',
    46 	'<p>' . __('Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.') . '</p>
    41 	'before_widget' => '',
    47 	<p>' . __('The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.') . '</p>'
    42 	'after_widget' => '',
    48 ) );
    43 	'before_title' => '',
    49 get_current_screen()->add_help_tab( array(
    44 	'after_title' => '',
    50 'id'		=> 'removing-reusing',
    45 ));
    51 'title'		=> __('Removing and Reusing'),
    46 
    52 'content'	=>
    47 // These are the widgets grouped by sidebar
    53 	'<p>' . __('If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.') . '</p>
    48 $sidebars_widgets = wp_get_sidebars_widgets();
    54 	<p>' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it&#8217;s not required.') . '</p>
    49 if ( empty( $sidebars_widgets ) )
    55 	<p>' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.') . '</p>'
    50 	$sidebars_widgets = wp_get_widget_defaults();
    56 ) );
    51 
    57 get_current_screen()->add_help_tab( array(
    52 // look for "lost" widgets, this has to run at least on each theme change
    58 'id'		=> 'missing-widgets',
    53 function retrieve_widgets() {
    59 'title'		=> __('Missing Widgets'),
    54 	global $wp_registered_widget_updates, $wp_registered_sidebars, $sidebars_widgets, $wp_registered_widgets;
    60 'content'	=>
    55 
    61 	'<p>' . __('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.') . '</p>' .
    56 	$_sidebars_widgets = array();
    62 		'<p>' . __('When changing themes, there is often some variation in the number and setup of widget areas/sidebars and sometimes these conflicts make the transition a bit less smooth. If you changed themes and seem to be missing widgets, scroll down on this screen to the Inactive area, where all your widgets and their settings will have been saved.') . '</p>'
    57 	$sidebars = array_keys($wp_registered_sidebars);
    63 ) );
    58 
    64 
    59 	unset( $sidebars_widgets['array_version'] );
    65 get_current_screen()->set_help_sidebar(
    60 
    66 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    61 	$old = array_keys($sidebars_widgets);
    67 	'<p>' . __('<a href="http://codex.wordpress.org/Appearance_Widgets_Screen" target="_blank">Documentation on Widgets</a>') . '</p>' .
    62 	sort($old);
    68 	'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    63 	sort($sidebars);
    69 );
    64 
    70 
    65 	if ( $old == $sidebars )
    71 if ( empty($wp_registered_sidebars) ) {
    66 		return;
    72 	// the theme has no sidebars, die.
    67 
    73 	require_once( './admin-header.php' );
    68 	// Move the known-good ones first
       
    69 	foreach ( $sidebars as $id ) {
       
    70 		if ( array_key_exists( $id, $sidebars_widgets ) ) {
       
    71 			$_sidebars_widgets[$id] = $sidebars_widgets[$id];
       
    72 			unset($sidebars_widgets[$id], $sidebars[$id]);
       
    73 		}
       
    74 	}
       
    75 
       
    76 	// if new theme has less sidebars than the old theme
       
    77 	if ( !empty($sidebars_widgets) ) {
       
    78 		foreach ( $sidebars_widgets as $lost => $val ) {
       
    79 			if ( is_array($val) )
       
    80 				$_sidebars_widgets['wp_inactive_widgets'] = array_merge( (array) $_sidebars_widgets['wp_inactive_widgets'], $val );
       
    81 		}
       
    82 	}
       
    83 
       
    84 	// discard invalid, theme-specific widgets from sidebars
       
    85 	$shown_widgets = array();
       
    86 	foreach ( $_sidebars_widgets as $sidebar => $widgets ) {
       
    87 		if ( !is_array($widgets) )
       
    88 			continue;
       
    89 
       
    90 		$_widgets = array();
       
    91 		foreach ( $widgets as $widget ) {
       
    92 			if ( isset($wp_registered_widgets[$widget]) )
       
    93 				$_widgets[] = $widget;
       
    94 		}
       
    95 		$_sidebars_widgets[$sidebar] = $_widgets;
       
    96 		$shown_widgets = array_merge($shown_widgets, $_widgets);
       
    97 	}
       
    98 
       
    99 	$sidebars_widgets = $_sidebars_widgets;
       
   100 	unset($_sidebars_widgets, $_widgets);
       
   101 
       
   102 	// find hidden/lost multi-widget instances
       
   103 	$lost_widgets = array();
       
   104 	foreach ( $wp_registered_widgets as $key => $val ) {
       
   105 		if ( in_array($key, $shown_widgets, true) )
       
   106 			continue;
       
   107 
       
   108 		$number = preg_replace('/.+?-([0-9]+)$/', '$1', $key);
       
   109 
       
   110 		if ( 2 > (int) $number )
       
   111 			continue;
       
   112 
       
   113 		$lost_widgets[] = $key;
       
   114 	}
       
   115 
       
   116 	$sidebars_widgets['wp_inactive_widgets'] = array_merge($lost_widgets, (array) $sidebars_widgets['wp_inactive_widgets']);
       
   117 	wp_set_sidebars_widgets($sidebars_widgets);
       
   118 }
       
   119 retrieve_widgets();
       
   120 
       
   121 if ( count($wp_registered_sidebars) == 1 ) {
       
   122 	// If only "wp_inactive_widgets" is defined the theme has no sidebars, die.
       
   123 	require_once( 'admin-header.php' );
       
   124 ?>
    74 ?>
   125 
    75 
   126 	<div class="wrap">
    76 	<div class="wrap">
   127 	<?php screen_icon(); ?>
    77 	<?php screen_icon(); ?>
   128 	<h2><?php echo esc_html( $title ); ?></h2>
    78 	<h2><?php echo esc_html( $title ); ?></h2>
   131 		</div>
    81 		</div>
   132 		<p><?php _e( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="http://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.' ); ?></p>
    82 		<p><?php _e( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="http://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.' ); ?></p>
   133 	</div>
    83 	</div>
   134 
    84 
   135 <?php
    85 <?php
   136 	require_once( 'admin-footer.php' );
    86 	require_once( './admin-footer.php' );
   137 	exit;
    87 	exit;
   138 }
    88 }
       
    89 
       
    90 // These are the widgets grouped by sidebar
       
    91 $sidebars_widgets = wp_get_sidebars_widgets();
       
    92 
       
    93 if ( empty( $sidebars_widgets ) )
       
    94 	$sidebars_widgets = wp_get_widget_defaults();
       
    95 
       
    96 foreach ( $sidebars_widgets as $sidebar_id => $widgets ) {
       
    97 	if ( 'wp_inactive_widgets' == $sidebar_id )
       
    98 		continue;
       
    99 
       
   100 	if ( !isset( $wp_registered_sidebars[ $sidebar_id ] ) ) {
       
   101 		if ( ! empty( $widgets ) ) { // register the inactive_widgets area as sidebar
       
   102 			register_sidebar(array(
       
   103 				'name' => __( 'Inactive Sidebar (not used)' ),
       
   104 				'id' => $sidebar_id,
       
   105 				'class' => 'inactive-sidebar orphan-sidebar',
       
   106 				'description' => __( 'This sidebar is no longer available and does not show anywhere on your site. Remove each of the widgets below to fully remove this inactive sidebar.' ),
       
   107 				'before_widget' => '',
       
   108 				'after_widget' => '',
       
   109 				'before_title' => '',
       
   110 				'after_title' => '',
       
   111 			));
       
   112 		} else {
       
   113 			unset( $sidebars_widgets[ $sidebar_id ] );
       
   114 		}
       
   115 	}
       
   116 }
       
   117 
       
   118 // register the inactive_widgets area as sidebar
       
   119 register_sidebar(array(
       
   120 	'name' => __('Inactive Widgets'),
       
   121 	'id' => 'wp_inactive_widgets',
       
   122 	'class' => 'inactive-sidebar',
       
   123 	'description' => __( 'Drag widgets here to remove them from the sidebar but keep their settings.' ),
       
   124 	'before_widget' => '',
       
   125 	'after_widget' => '',
       
   126 	'before_title' => '',
       
   127 	'after_title' => '',
       
   128 ));
       
   129 
       
   130 retrieve_widgets();
   139 
   131 
   140 // We're saving a widget without js
   132 // We're saving a widget without js
   141 if ( isset($_POST['savewidget']) || isset($_POST['removewidget']) ) {
   133 if ( isset($_POST['savewidget']) || isset($_POST['removewidget']) ) {
   142 	$widget_id = $_POST['widget-id'];
   134 	$widget_id = $_POST['widget-id'];
   143 	check_admin_referer("save-delete-widget-$widget_id");
   135 	check_admin_referer("save-delete-widget-$widget_id");
   160 
   152 
   161 	// delete
   153 	// delete
   162 	if ( isset($_POST['removewidget']) && $_POST['removewidget'] ) {
   154 	if ( isset($_POST['removewidget']) && $_POST['removewidget'] ) {
   163 
   155 
   164 		if ( !in_array($widget_id, $sidebar, true) ) {
   156 		if ( !in_array($widget_id, $sidebar, true) ) {
   165 			wp_redirect('widgets.php?error=0');
   157 			wp_redirect( admin_url('widgets.php?error=0') );
   166 			exit;
   158 			exit;
   167 		}
   159 		}
   168 
   160 
   169 		$sidebar = array_diff( $sidebar, array($widget_id) );
   161 		$sidebar = array_diff( $sidebar, array($widget_id) );
   170 		$_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1');
   162 		$_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1');
   193 		}
   185 		}
   194 		array_splice( $sidebars_widgets[$sidebar_id], $position, 0, $widget_id );
   186 		array_splice( $sidebars_widgets[$sidebar_id], $position, 0, $widget_id );
   195 	}
   187 	}
   196 
   188 
   197 	wp_set_sidebars_widgets($sidebars_widgets);
   189 	wp_set_sidebars_widgets($sidebars_widgets);
   198 	wp_redirect('widgets.php?message=0');
   190 	wp_redirect( admin_url('widgets.php?message=0') );
   199 	exit;
   191 	exit;
   200 }
   192 }
   201 
   193 
   202 // Output the widget form without js
   194 // Output the widget form without js
   203 if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) {
   195 if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) {
   242 
   234 
   243 	// show the widget form
   235 	// show the widget form
   244 	$width = ' style="width:' . max($control['width'], 350) . 'px"';
   236 	$width = ' style="width:' . max($control['width'], 350) . 'px"';
   245 	$key = isset($_GET['key']) ? (int) $_GET['key'] : 0;
   237 	$key = isset($_GET['key']) ? (int) $_GET['key'] : 0;
   246 
   238 
   247 	require_once( 'admin-header.php' ); ?>
   239 	require_once( './admin-header.php' ); ?>
   248 	<div class="wrap">
   240 	<div class="wrap">
   249 	<?php screen_icon(); ?>
   241 	<?php screen_icon(); ?>
   250 	<h2><?php echo esc_html( $title ); ?></h2>
   242 	<h2><?php echo esc_html( $title ); ?></h2>
   251 	<div class="editwidget"<?php echo $width; ?>>
   243 	<div class="editwidget"<?php echo $width; ?>>
   252 	<h3><?php printf( __( 'Widget %s' ), $name ); ?></h3>
   244 	<h3><?php printf( __( 'Widget %s' ), $name ); ?></h3>
   264 	<div class="widget-position">
   256 	<div class="widget-position">
   265 	<table class="widefat"><thead><tr><th><?php _e('Sidebar'); ?></th><th><?php _e('Position'); ?></th></tr></thead><tbody>
   257 	<table class="widefat"><thead><tr><th><?php _e('Sidebar'); ?></th><th><?php _e('Position'); ?></th></tr></thead><tbody>
   266 <?php
   258 <?php
   267 	foreach ( $wp_registered_sidebars as $sbname => $sbvalue ) {
   259 	foreach ( $wp_registered_sidebars as $sbname => $sbvalue ) {
   268 		echo "\t\t<tr><td><label><input type='radio' name='sidebar' value='" . esc_attr($sbname) . "'" . checked( $sbname, $sidebar, false ) . " /> $sbvalue[name]</label></td><td>";
   260 		echo "\t\t<tr><td><label><input type='radio' name='sidebar' value='" . esc_attr($sbname) . "'" . checked( $sbname, $sidebar, false ) . " /> $sbvalue[name]</label></td><td>";
   269 		if ( 'wp_inactive_widgets' == $sbname ) {
   261 		if ( 'wp_inactive_widgets' == $sbname || 'orphaned_widgets' == substr( $sbname, 0, 16 ) ) {
   270 			echo '&nbsp;';
   262 			echo '&nbsp;';
   271 		} else {
   263 		} else {
   272 			if ( !isset($sidebars_widgets[$sbname]) || !is_array($sidebars_widgets[$sbname]) ) {
   264 			if ( !isset($sidebars_widgets[$sbname]) || !is_array($sidebars_widgets[$sbname]) ) {
   273 				$j = 1;
   265 				$j = 1;
   274 				$sidebars_widgets[$sbname] = array();
   266 				$sidebars_widgets[$sbname] = array();
   277 				if ( isset($_GET['addnew']) || !in_array($widget_id, $sidebars_widgets[$sbname], true) )
   269 				if ( isset($_GET['addnew']) || !in_array($widget_id, $sidebars_widgets[$sbname], true) )
   278 					$j++;
   270 					$j++;
   279 			}
   271 			}
   280 			$selected = '';
   272 			$selected = '';
   281 			echo "\t\t<select name='{$sbname}_position'>\n";
   273 			echo "\t\t<select name='{$sbname}_position'>\n";
   282 			echo "\t\t<option value=''>" . __('-- select --') . "</option>\n";
   274 			echo "\t\t<option value=''>" . __('&mdash; Select &mdash;') . "</option>\n";
   283 			for ( $i = 1; $i <= $j; $i++ ) {
   275 			for ( $i = 1; $i <= $j; $i++ ) {
   284 				if ( in_array($widget_id, $sidebars_widgets[$sbname], true) )
   276 				if ( in_array($widget_id, $sidebars_widgets[$sbname], true) )
   285 					$selected = selected( $i, $key + 1, false );
   277 					$selected = selected( $i, $key + 1, false );
   286 				echo "\t\t<option value='$i'$selected> $i </option>\n";
   278 				echo "\t\t<option value='$i'$selected> $i </option>\n";
   287 			}
   279 			}
   291 	} ?>
   283 	} ?>
   292 	</tbody></table>
   284 	</tbody></table>
   293 	</div>
   285 	</div>
   294 
   286 
   295 	<div class="widget-control-actions">
   287 	<div class="widget-control-actions">
   296 <?php	if ( isset($_GET['addnew']) ) { ?>
   288 <?php
       
   289 	if ( isset($_GET['addnew']) ) { ?>
   297 	<a href="widgets.php" class="button alignleft"><?php _e('Cancel'); ?></a>
   290 	<a href="widgets.php" class="button alignleft"><?php _e('Cancel'); ?></a>
   298 <?php	} else { ?>
   291 <?php
   299 	<input type="submit" name="removewidget" class="button alignleft" value="<?php esc_attr_e('Delete'); ?>" />
   292 	} else {
   300 <?php	} ?>
   293 		submit_button( __( 'Delete' ), 'button alignleft', 'removewidget', false );
   301 	<input type="submit" name="savewidget" class="button-primary alignright" value="<?php esc_attr_e('Save Widget'); ?>" />
   294 	}
       
   295 	submit_button( __( 'Save Widget' ), 'button-primary alignright', 'savewidget', false ); ?>
   302 	<input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($widget_id); ?>" />
   296 	<input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($widget_id); ?>" />
   303 	<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" />
   297 	<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" />
   304 	<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" />
   298 	<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" />
   305 <?php	wp_nonce_field("save-delete-widget-$widget_id"); ?>
   299 <?php	wp_nonce_field("save-delete-widget-$widget_id"); ?>
   306 	<br class="clear" />
   300 	<br class="clear" />
   307 	</div>
   301 	</div>
   308 	</form>
   302 	</form>
   309 	</div>
   303 	</div>
   310 	</div>
   304 	</div>
   311 <?php
   305 <?php
   312 	require_once( 'admin-footer.php' );
   306 	require_once( './admin-footer.php' );
   313 	exit;
   307 	exit;
   314 }
   308 }
   315 
   309 
   316 $messages = array(
   310 $messages = array(
   317 	__('Changes saved.')
   311 	__('Changes saved.')
   320 $errors = array(
   314 $errors = array(
   321 	__('Error while saving.'),
   315 	__('Error while saving.'),
   322 	__('Error in displaying the widget settings form.')
   316 	__('Error in displaying the widget settings form.')
   323 );
   317 );
   324 
   318 
   325 require_once( 'admin-header.php' ); ?>
   319 require_once( './admin-header.php' ); ?>
   326 
   320 
   327 <div class="wrap">
   321 <div class="wrap">
   328 <?php screen_icon(); ?>
   322 <?php screen_icon(); ?>
   329 <h2><?php echo esc_html( $title ); ?></h2>
   323 <h2><?php echo esc_html( $title ); ?></h2>
   330 
   324 
   331 <?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) { ?>
   325 <?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) { ?>
   332 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
   326 <div id="message" class="updated"><p><?php echo $messages[$_GET['message']]; ?></p></div>
   333 <?php } ?>
   327 <?php } ?>
   334 <?php if ( isset($_GET['error']) && isset($errors[$_GET['error']]) ) { ?>
   328 <?php if ( isset($_GET['error']) && isset($errors[$_GET['error']]) ) { ?>
   335 <div id="message" class="error"><p><?php echo $errors[$_GET['error']]; ?></p></div>
   329 <div id="message" class="error"><p><?php echo $errors[$_GET['error']]; ?></p></div>
   336 <?php } ?>
   330 <?php } ?>
       
   331 
       
   332 <?php do_action( 'widgets_admin_page' ); ?>
   337 
   333 
   338 <div class="widget-liquid-left">
   334 <div class="widget-liquid-left">
   339 <div id="widgets-left">
   335 <div id="widgets-left">
   340 	<div id="available-widgets" class="widgets-holder-wrap">
   336 	<div id="available-widgets" class="widgets-holder-wrap">
   341 		<div class="sidebar-name">
   337 		<div class="sidebar-name">
   342 		<div class="sidebar-name-arrow"><br /></div>
   338 		<div class="sidebar-name-arrow"><br /></div>
   343 		<h3><?php _e('Available Widgets'); ?> <span id="removing-widget"><?php _e('Deactivate'); ?> <span></span></span></h3></div>
   339 		<h3><?php _e('Available Widgets'); ?> <span id="removing-widget"><?php _ex('Deactivate', 'removing-widget'); ?> <span></span></span></h3></div>
   344 		<div class="widget-holder">
   340 		<div class="widget-holder">
   345 		<p class="description"><?php _e('Drag widgets from here to a sidebar on the right to activate them. Drag widgets back here to deactivate them and delete their settings.'); ?></p>
   341 		<p class="description"><?php _e('Drag widgets from here to a sidebar on the right to activate them. Drag widgets back here to deactivate them and delete their settings.'); ?></p>
   346 		<div id="widget-list">
   342 		<div id="widget-list">
   347 		<?php wp_list_widgets(); ?>
   343 		<?php wp_list_widgets(); ?>
   348 		</div>
   344 		</div>
   349 		<br class='clear' />
   345 		<br class='clear' />
   350 		</div>
   346 		</div>
   351 		<br class="clear" />
   347 		<br class="clear" />
   352 	</div>
   348 	</div>
   353 
   349 
   354 	<div class="widgets-holder-wrap">
   350 <?php
   355 		<div class="sidebar-name">
   351 foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
   356 		<div class="sidebar-name-arrow"><br /></div>
   352 	if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) {
   357 		<h3><?php _e('Inactive Widgets'); ?>
   353 		$wrap_class = 'widgets-holder-wrap';
   358 		<span><img src="images/wpspin_light.gif" class="ajax-feedback" title="" alt="" /></span></h3></div>
   354 		if ( !empty( $registered_sidebar['class'] ) )
   359 		<div class="widget-holder inactive">
   355 			$wrap_class .= ' ' . $registered_sidebar['class'];
   360 		<p class="description"><?php _e('Drag widgets here to remove them from the sidebar but keep their settings.'); ?></p>
   356 
   361 		<?php wp_list_widget_controls('wp_inactive_widgets'); ?>
   357 ?>
   362 		<br class="clear" />
   358 
       
   359 		<div class="<?php echo esc_attr( $wrap_class ); ?>">
       
   360 			<div class="sidebar-name">
       
   361 				<div class="sidebar-name-arrow"><br /></div>
       
   362 				<h3><?php echo esc_html( $registered_sidebar['name'] ); ?>
       
   363 					<span><img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /></span>
       
   364 				</h3>
       
   365 			</div>
       
   366 			<div class="widget-holder inactive">
       
   367 				<?php wp_list_widget_controls( $registered_sidebar['id'] ); ?>
       
   368 				<br class="clear" />
       
   369 			</div>
   363 		</div>
   370 		</div>
   364 	</div>
   371 <?php
       
   372 	}
       
   373 }
       
   374 ?>
       
   375 
   365 </div>
   376 </div>
   366 </div>
   377 </div>
   367 
   378 
   368 <div class="widget-liquid-right">
   379 <div class="widget-liquid-right">
   369 <div id="widgets-right">
   380 <div id="widgets-right">
   370 <?php
   381 <?php
   371 $i = 0;
   382 $i = 0;
   372 foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
   383 foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
   373 	if ( 'wp_inactive_widgets' == $sidebar )
   384 	if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) )
   374 		continue;
   385 		continue;
   375 	$closed = $i ? ' closed' : ''; ?>
   386 
   376 	<div class="widgets-holder-wrap<?php echo $closed; ?>">
   387 	$wrap_class = 'widgets-holder-wrap';
       
   388 	if ( !empty( $registered_sidebar['class'] ) )
       
   389 		$wrap_class .= ' sidebar-' . $registered_sidebar['class'];
       
   390 
       
   391 	if ( $i )
       
   392 		$wrap_class .= ' closed'; ?>
       
   393 
       
   394 	<div class="<?php echo esc_attr( $wrap_class ); ?>">
   377 	<div class="sidebar-name">
   395 	<div class="sidebar-name">
   378 	<div class="sidebar-name-arrow"><br /></div>
   396 	<div class="sidebar-name-arrow"><br /></div>
   379 	<h3><?php echo esc_html( $registered_sidebar['name'] ); ?>
   397 	<h3><?php echo esc_html( $registered_sidebar['name'] ); ?>
   380 	<span><img src="images/wpspin_dark.gif" class="ajax-feedback" title="" alt="" /></span></h3></div>
   398 	<span><img src="<?php echo esc_url( admin_url( 'images/wpspin_dark.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /></span></h3></div>
   381 	<?php wp_list_widget_controls( $sidebar ); // Show the control forms for each of the widgets in this sidebar ?>
   399 	<?php wp_list_widget_controls( $sidebar ); // Show the control forms for each of the widgets in this sidebar ?>
   382 	</div>
   400 	</div>
   383 <?php
   401 <?php
   384 	$i++;
   402 	$i++;
   385 } ?>
   403 } ?>
   391 <br class="clear" />
   409 <br class="clear" />
   392 </div>
   410 </div>
   393 
   411 
   394 <?php
   412 <?php
   395 do_action( 'sidebar_admin_page' );
   413 do_action( 'sidebar_admin_page' );
   396 require_once( 'admin-footer.php' );
   414 require_once( './admin-footer.php' );