Make WordPress Core

Ticket #41021: 40951.1.diff

File 40951.1.diff, 3.1 KB (added by westonruter, 7 years ago)

Add missing $number param

  • src/wp-includes/widgets/class-wp-widget-media.php

    diff --git src/wp-includes/widgets/class-wp-widget-media.php src/wp-includes/widgets/class-wp-widget-media.php
    index c76989c873..10f92abcea 100644
    abstract class WP_Widget_Media extends WP_Widget { 
    3434        );
    3535
    3636        /**
     37         * Whether or not the widget has been registered yet.
     38         *
     39         * @since 4.8.1
     40         * @var bool
     41         */
     42        protected $registered = false;
     43
     44        /**
    3745         * Constructor.
    3846         *
    3947         * @since 4.8.0
    abstract class WP_Widget_Media extends WP_Widget { 
    8694         *
    8795         * @since 4.8.0
    8896         * @access public
     97         *
     98         * @param integer $number Optional. The unique order number of this widget instance
     99         *                        compared to other instances of the same class. Default -1.
    89100         */
    90         public function _register() {
     101        public function _register_one( $number = -1 ) {
     102                parent::_register_one( $number );
     103                if ( $this->registered ) {
     104                        return;
     105                }
     106                $this->registered = true;
    91107
    92108                // Note that the widgets component in the customizer will also do the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts().
    93109                add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) );
    abstract class WP_Widget_Media extends WP_Widget { 
    100116                add_action( 'admin_footer-widgets.php', array( $this, 'render_control_template_scripts' ) );
    101117
    102118                add_filter( 'display_media_states', array( $this, 'display_media_state' ), 10, 2 );
    103 
    104                 parent::_register();
    105119        }
    106120
    107121        /**
  • src/wp-includes/widgets/class-wp-widget-text.php

    diff --git src/wp-includes/widgets/class-wp-widget-text.php src/wp-includes/widgets/class-wp-widget-text.php
    index 7d149c0a0f..faa79674f6 100644
     
    1717class WP_Widget_Text extends WP_Widget {
    1818
    1919        /**
     20         * Whether or not the widget has been registered yet.
     21         *
     22         * @since 4.8.1
     23         * @var bool
     24         */
     25        protected $registered = false;
     26
     27        /**
    2028         * Sets up a new Text widget instance.
    2129         *
    2230         * @since 2.8.0
    class WP_Widget_Text extends WP_Widget { 
    3846        /**
    3947         * Add hooks for enqueueing assets when registering all widget instances of this widget class.
    4048         *
    41          * @since 4.8.0
    42          * @access public
     49         * @param integer $number Optional. The unique order number of this widget instance
     50         *                        compared to other instances of the same class. Default -1.
    4351         */
    44         public function _register() {
     52        public function _register_one( $number = -1 ) {
     53                parent::_register_one( $number );
     54                if ( $this->registered ) {
     55                        return;
     56                }
     57                $this->registered = true;
    4558
    4659                // Note that the widgets component in the customizer will also do the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts().
    4760                add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) );
    4861
    4962                // Note that the widgets component in the customizer will also do the 'admin_footer-widgets.php' action in WP_Customize_Widgets::print_footer_scripts().
    5063                add_action( 'admin_footer-widgets.php', array( $this, 'render_control_template_scripts' ) );
    51 
    52                 parent::_register();
    5364        }
    5465
    5566        /**