From e534d003a268167f4a228f08d5f41dc6486bc220 Mon Sep 17 00:00:00 2001 From: azaozz Date: Wed, 22 Apr 2009 04:01:20 +0000 Subject: [PATCH] Optionally use the class name as id_base, see #9511 git-svn-id: http://svn.automattic.com/wordpress/trunk@11045 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/widgets.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 11461fa406..2acc2121b7 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -73,7 +73,7 @@ class WP_Widget { /** * PHP4 constructor */ - function WP_Widget( $id_base, $name, $widget_options = array(), $control_options = array() ) { + function WP_Widget( $id_base = false, $name, $widget_options = array(), $control_options = array() ) { $this->__construct( $id_base, $name, $widget_options, $control_options ); } @@ -86,9 +86,8 @@ class WP_Widget { * - width * - height */ - function __construct( $id_base, $name, $widget_options = array(), $control_options = array() ) { - $this->id_base = $id_base; - // $this->id_base = str_replace( 'wp_widget_', '', strtolower(get_class($this)) ); + function __construct( $id_base = false, $name, $widget_options = array(), $control_options = array() ) { + $this->id_base = $id_base === false ? str_replace( 'wp_widget_', '', strtolower(get_class($this)) ) : $id_base; $this->name = $name; $this->option_name = 'widget_' . $id_base; $this->widget_options = wp_parse_args( $widget_options, array('classname' => $this->option_name) );