\n";
$params[0]['after_widget'] = "";
$params[0]['before_title'] = "%BEG_OF_TITLE%";
$params[0]['after_title'] = "%END_OF_TITLE%";
if ( is_callable( $wp_registered_widgets[$widget_id]['callback'] ) ) {
$wp_registered_widgets[$widget_id]['_callback'] = $wp_registered_widgets[$widget_id]['callback'];
$wp_registered_widgets[$widget_id]['callback'] = 'wp_widget_control';
}
return $params;
}
/**
* Meta widget used to display the control form for a widget.
*
* Called from dynamic_sidebar().
*
* @since unknown
*
* @param array $sidebar_args
* @return array
*/
function wp_widget_control( $sidebar_args ) {
global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets, $edit_widget;
$widget_id = $sidebar_args['widget_id'];
$sidebar_id = isset($sidebar_args['id']) ? $sidebar_args['id'] : false;
$control = isset($wp_registered_widget_controls[$widget_id]) ? $wp_registered_widget_controls[$widget_id] : 0;
$widget = $wp_registered_widgets[$widget_id];
$key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[$sidebar_id] ) : 'no-key'; // position of widget in sidebar
$edit = -1 < $edit_widget && is_numeric($key) && $edit_widget === $key; // (bool) are we currently editing this widget
$id_format = $widget['id'];
if ( ! isset( $sidebar_args['_show'] ) )
$sidebar_args['_show'] = '';
if ( ! isset( $sidebar_args['_display'] ) )
$sidebar_args['_display'] = '';
// We aren't showing a widget control, we're outputing a template for a mult-widget control
if ( 'all' == $sidebar_args['_show'] && 'template' == $sidebar_args['_display'] && isset($control['params'][0]['number']) ) {
// number == -1 implies a template where id numbers are replaced by a generic '%i%'
$control['params'][0]['number'] = -1;
// if given, id_base means widget id's should be constructed like {$id_base}-{$id_number}
if ( isset($control['id_base']) )
$id_format = $control['id_base'] . '-%i%';
}
$widget_title = '';
// We grab the normal widget output to find the widget's title
if ( ( 'all' != $sidebar_args['_show'] || 'template' != $sidebar_args['_display'] ) && is_callable( $widget['_callback'] ) ) {
ob_start();
$args = func_get_args();
call_user_func_array( $widget['_callback'], $args );
$widget_title = ob_get_clean();
$widget_title = wp_widget_control_ob_filter( $widget_title );
}
$wp_registered_widgets[$widget_id]['callback'] = $wp_registered_widgets[$widget_id]['_callback'];
unset($wp_registered_widgets[$widget_id]['_callback']);
if ( $widget_title && $widget_title != $sidebar_args['widget_name'] )
$widget_title = sprintf( _c('%1$s: %2$s|1: widget name, 2: widget title' ), $sidebar_args['widget_name'], $widget_title );
else
$widget_title = wp_specialchars( strip_tags( $sidebar_args['widget_name'] ) );
$sidebar_args['_widget_title'] = $widget_title;
if ( empty($sidebar_args['_display']) || 'template' != $sidebar_args['_display'] )
echo $sidebar_args['before_widget'];
?>