follow these instructions.' ); ?>

$control ) { if ( in_array( $control['callback'], $already_done ) ) continue; if ( is_callable( $control['callback'] ) ) { call_user_func_array( $control['callback'], $control['params'] ); $control_output = ob_get_contents(); if ( false !== strpos( $control_output, '%i%' ) ) // if it's a multi-widget, only call control function once. $already_done[] = $control['callback']; } ob_clean(); } ob_end_clean(); // Prophylactic. Take out empty ids. if ( isset($_POST['widget-id']) ) { foreach ( (array) $_POST['widget-id'] as $key => $val ) { if ( !$val ) unset($_POST['widget-id'][$key]); } } // Reset the key numbering and store $new_sidebar = isset( $_POST['widget-id'] ) && is_array( $_POST['widget-id'] ) ? array_values( $_POST['widget-id'] ) : array(); $sidebars_widgets[$_POST['sidebar']] = $new_sidebar; wp_set_sidebars_widgets( $sidebars_widgets ); wp_redirect( add_query_arg( 'message', 'updated' ) ); exit; } // What widget (if any) are we editing $edit_widget = -1; $query_args = array('add', 'remove', 'key', 'edit', '_wpnonce', 'message', 'base' ); if ( isset($_GET['add']) && $_GET['add'] ) { // Add to the end of the sidebar $control_callback; if ( isset($wp_registered_widgets[$_GET['add']]) ) { check_admin_referer( "add-widget_$_GET[add]" ); $sidebars_widgets[$sidebar][] = $_GET['add']; wp_set_sidebars_widgets( $sidebars_widgets ); } elseif ( isset($_GET['base']) && isset($_GET['key']) ) { // It's a multi-widget check_admin_referer( "add-widget_$_GET[add]" ); // Copy minimal info from an existing instance of this widget to a new instance foreach ( $wp_registered_widget_controls as $control ) { if ( $_GET['base'] === $control['id_base'] ) { $control_callback = $control['callback']; $num = (int) $_GET['key']; $control['params'][0]['number'] = $num; $control['id'] = $control['id_base'] . '-' . $num; $wp_registered_widget_controls[$control['id']] = $control; $sidebars_widgets[$sidebar][] = $control['id']; break; } } } // it's a multi-widget. The only way to add multi-widgets without JS is to actually submit POST content... // so here we go if ( is_callable( $control_callback ) ) { require_once( 'admin-header.php' ); ?>


$sidebar_widget_count", $wp_registered_sidebars[$sidebar]['name'] ); $page = isset($_GET['apage']) ? abs( (int) $_GET['apage'] ) : 1; /* TODO: Paginate widgets list $page_links = paginate_links( array( 'base' => add_query_arg( 'apage', '%#%' ), 'format' => '', 'total' => ceil(($total = 105 )/ 10), 'current' => $page )); */ $page_links = ' '; // Unsanitized! $widget_search = isset($_GET['s']) ? $_GET['s'] : false; // Not entirely sure what all should be here $show_values = array( '' => $widget_search ? __( 'Show any widgets' ) : __( 'Show all widgets' ), 'unused' => __( 'Show unused widgets' ), 'used' => __( 'Show used widgets' ) ); $show = isset($_GET['show']) && isset($show_values[$_GET['show']]) ? attribute_escape( $_GET['show'] ) : false; $messages = array( 'updated' => __('Changes saved.') ); require_once( 'admin-header.php' ); ?>