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 { |
34 | 34 | ); |
35 | 35 | |
36 | 36 | /** |
| 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 | /** |
37 | 45 | * Constructor. |
38 | 46 | * |
39 | 47 | * @since 4.8.0 |
… |
… |
abstract class WP_Widget_Media extends WP_Widget { |
86 | 94 | * |
87 | 95 | * @since 4.8.0 |
88 | 96 | * @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. |
89 | 100 | */ |
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; |
91 | 107 | |
92 | 108 | // Note that the widgets component in the customizer will also do the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts(). |
93 | 109 | add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) ); |
… |
… |
abstract class WP_Widget_Media extends WP_Widget { |
100 | 116 | add_action( 'admin_footer-widgets.php', array( $this, 'render_control_template_scripts' ) ); |
101 | 117 | |
102 | 118 | add_filter( 'display_media_states', array( $this, 'display_media_state' ), 10, 2 ); |
103 | | |
104 | | parent::_register(); |
105 | 119 | } |
106 | 120 | |
107 | 121 | /** |
diff --git src/wp-includes/widgets/class-wp-widget-text.php src/wp-includes/widgets/class-wp-widget-text.php
index 7d149c0a0f..faa79674f6 100644
|
|
|
17 | 17 | class WP_Widget_Text extends WP_Widget { |
18 | 18 | |
19 | 19 | /** |
| 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 | /** |
20 | 28 | * Sets up a new Text widget instance. |
21 | 29 | * |
22 | 30 | * @since 2.8.0 |
… |
… |
class WP_Widget_Text extends WP_Widget { |
38 | 46 | /** |
39 | 47 | * Add hooks for enqueueing assets when registering all widget instances of this widget class. |
40 | 48 | * |
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. |
43 | 51 | */ |
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; |
45 | 58 | |
46 | 59 | // Note that the widgets component in the customizer will also do the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts(). |
47 | 60 | add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) ); |
48 | 61 | |
49 | 62 | // Note that the widgets component in the customizer will also do the 'admin_footer-widgets.php' action in WP_Customize_Widgets::print_footer_scripts(). |
50 | 63 | add_action( 'admin_footer-widgets.php', array( $this, 'render_control_template_scripts' ) ); |
51 | | |
52 | | parent::_register(); |
53 | 64 | } |
54 | 65 | |
55 | 66 | /** |