Make WordPress Core

Ticket #9704: 9704.2.patch

File 9704.2.patch, 1.2 KB (added by hakre, 15 years ago)

Defaults to nice default-id or id if no name present.

  • wp-includes/widgets.php

     
    7373        /**
    7474         * PHP4 constructor
    7575         */
    76         function WP_Widget( $id_base = false, $name, $widget_options = array(), $control_options = array() ) {
     76        function WP_Widget( $id_base = false, $name = null, $widget_options = array(), $control_options = array() ) {
    7777                $this->__construct( $id_base, $name, $widget_options, $control_options );
    7878        }
    7979
     
    8686         *       - width
    8787         *       - height
    8888         */
    89         function __construct( $id_base = false, $name, $widget_options = array(), $control_options = array() ) {
     89        function __construct( $id_base = false, $name = null, $widget_options = array(), $control_options = array() ) {
    9090                $this->id_base = empty($id_base) ? preg_replace( '/(wp_)?widget_/', '', strtolower(get_class($this)) ) : $id_base;
    91                 $this->name = $name;
     91                $this->name = is_null($name) ? $this->id_base : $name;
    9292                $this->option_name = 'widget_' . $this->id_base;
    9393                $this->widget_options = wp_parse_args( $widget_options, array('classname' => $this->option_name) );
    9494                $this->control_options = wp_parse_args( $control_options, array('id_base' => $this->id_base) );