Make WordPress Core

Ticket #42270: 42270.patch

File 42270.patch, 1.6 KB (added by behzod, 6 years ago)
  • wp-includes/widgets.php

     
    100100 * Registers a WP_Widget widget
    101101 *
    102102 * @since 2.8.0
     103 * @since 4.6.0 The `$widget` parameter also accepts a WP_Widget instance object
     104 *              instead of simply a `WP_Widget` subclass name.
    103105 *
    104106 * @see WP_Widget
    105107 *
    106108 * @global WP_Widget_Factory $wp_widget_factory
    107109 *
    108  * @param string $widget_class The name of a class that extends WP_Widget
     110 * @param string|WP_Widget $widget Either the name of a `WP_Widget` subclass or an instance of a `WP_Widget` subclass.
    109111 */
    110 function register_widget($widget_class) {
     112function register_widget( $widget ) {
    111113        global $wp_widget_factory;
    112114
    113         $wp_widget_factory->register($widget_class);
     115        $wp_widget_factory->register( $widget );
    114116}
    115117
    116118/**
     
    120122 * Run within a function hooked to the {@see 'widgets_init'} action.
    121123 *
    122124 * @since 2.8.0
     125 * @since 4.6.0 The `$widget` parameter also accepts a WP_Widget instance object
     126 *              instead of simply a `WP_Widget` subclass name.
    123127 *
    124128 * @see WP_Widget
    125129 *
    126130 * @global WP_Widget_Factory $wp_widget_factory
    127131 *
    128  * @param string $widget_class The name of a class that extends WP_Widget.
     132 * @param string|WP_Widget $widget Either the name of a `WP_Widget` subclass or an instance of a `WP_Widget` subclass.
    129133 */
    130 function unregister_widget($widget_class) {
     134function unregister_widget( $widget ) {
    131135        global $wp_widget_factory;
    132136
    133         $wp_widget_factory->unregister($widget_class);
     137        $wp_widget_factory->unregister( $widget );
    134138}
    135139
    136140/**