git-svn-id: http://svn.automattic.com/wordpress/trunk@11095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e1dbca4f8a
commit
4e975cf400
|
@ -164,8 +164,13 @@ class WP_Widget {
|
|||
$this->_set( $widget_args['number'] );
|
||||
$settings = $this->get_settings();
|
||||
|
||||
if ( array_key_exists( $this->number, $settings ) )
|
||||
$this->widget($args, $settings[$this->number]);
|
||||
if ( array_key_exists( $this->number, $settings ) ) {
|
||||
$settings = $settings[$this->number];
|
||||
// filters the widget's settings, return false to stop displaying the widget
|
||||
$settings = apply_filters('widget_display_callback', $settings, &$this);
|
||||
if ( false !== $settings )
|
||||
$this->widget($args, $settings);
|
||||
}
|
||||
}
|
||||
|
||||
/** Deal with changed settings.
|
||||
|
@ -222,6 +227,8 @@ class WP_Widget {
|
|||
else
|
||||
$instance = $this->update($new_instance, array());
|
||||
|
||||
// filters the widget's settings before saving, return false to cancel saving (keep the old settings if updating)
|
||||
$instance = apply_filters('widget_update_callback', $instance, $new_instance, &$this);
|
||||
if ( false !== $instance )
|
||||
$all_instances[$number] = $instance;
|
||||
}
|
||||
|
@ -250,7 +257,10 @@ class WP_Widget {
|
|||
$instance = $all_instances[ $widget_args['number'] ];
|
||||
}
|
||||
|
||||
return $this->form($instance);
|
||||
// filters the widget admin form before displaying, return false to stop displaying it
|
||||
$instance = apply_filters('widget_form_callback', $instance, &$this);
|
||||
if ( false !== $instance )
|
||||
$this->form($instance);
|
||||
}
|
||||
|
||||
/** Helper function: Registers a single instance. */
|
||||
|
|
Loading…
Reference in New Issue