Ticket #20542: 20542.2.diff
File 20542.2.diff, 1.1 KB (added by , 11 years ago) |
---|
-
src/wp-includes/widgets.php
409 409 add_action( 'widgets_init', array( $this, '_register_widgets' ), 100 ); 410 410 } 411 411 412 function register($widget_class) { 413 $this->widgets[$widget_class] = new $widget_class(); 412 function register( $widget_class, $args = null ) { 413 $widget_key = $widget_class; 414 415 if ( ! empty( $args ) ) { 416 $widget_key .= '_' . md5( maybe_serialize( $args ) ); 417 } 418 419 $this->widgets[ $widget_key ] = new $widget_class( $args ); 414 420 } 415 421 416 422 function unregister($widget_class) { … … 513 519 * @uses WP_Widget_Factory 514 520 * 515 521 * @param string $widget_class The name of a class that extends WP_Widget 522 * @param mixed $args Args to pass to the widget constructor 516 523 */ 517 function register_widget( $widget_class) {524 function register_widget( $widget_class, $args = null ) { 518 525 global $wp_widget_factory; 519 526 520 $wp_widget_factory->register( $widget_class);527 $wp_widget_factory->register( $widget_class, $args ); 521 528 } 522 529 523 530 /**