Changeset 35102
- Timestamp:
- 10/13/2015 01:32:27 AM (9 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/widgets.php
r35015 r35102 90 90 continue; 91 91 92 if ( ! isset( $wp_registered_sidebars[ $sidebar_id ]) ) {92 if ( ! is_registered_sidebar( $sidebar_id ) ) { 93 93 if ( ! empty( $widgets ) ) { // register the inactive_widgets area as sidebar 94 94 register_sidebar(array( … … 156 156 /** 157 157 * Fires immediately after a widget has been marked for deletion. 158 * 158 * 159 159 * @since 4.4.0 160 160 * -
trunk/src/wp-includes/class-wp-customize-widgets.php
r34563 r35102 366 366 } 367 367 368 $is_registered_sidebar = is set( $wp_registered_sidebars[ $sidebar_id ]);368 $is_registered_sidebar = is_registered_sidebar( $sidebar_id ); 369 369 $is_inactive_widgets = ( 'wp_inactive_widgets' === $sidebar_id ); 370 370 $is_active_sidebar = ( $is_registered_sidebar && ! $is_inactive_widgets ); … … 1103 1103 * @access public 1104 1104 * 1105 * @global array $wp_registered_sidebars1106 *1107 1105 * @param bool $is_active Whether the sidebar is active. 1108 1106 * @param string $sidebar_id Sidebar ID. … … 1110 1108 */ 1111 1109 public function tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id ) { 1112 if ( is set( $GLOBALS['wp_registered_sidebars'][$sidebar_id]) ) {1110 if ( is_registered_sidebar( $sidebar_id ) ) { 1113 1111 $this->rendered_sidebars[] = $sidebar_id; 1114 1112 } … … 1131 1129 * @access public 1132 1130 * 1133 * @global array $wp_registered_sidebars1134 *1135 1131 * @param bool $has_widgets Whether the current sidebar has widgets. 1136 1132 * @param string $sidebar_id Sidebar ID. … … 1138 1134 */ 1139 1135 public function tally_sidebars_via_dynamic_sidebar_calls( $has_widgets, $sidebar_id ) { 1140 if ( is set( $GLOBALS['wp_registered_sidebars'][$sidebar_id]) ) {1136 if ( is_registered_sidebar( $sidebar_id ) ) { 1141 1137 $this->rendered_sidebars[] = $sidebar_id; 1142 1138 } -
trunk/src/wp-includes/widget-functions.php
r34566 r35102 97 97 $_args['id'] = $args['id']; 98 98 $n = 2; // Start at -2 for conflicting custom ID's 99 while ( is set($wp_registered_sidebars[$_args['id']]) )99 while ( is_registered_sidebar( $_args['id'] ) ) { 100 100 $_args['id'] = $args['id'] . '-' . $n++; 101 } 101 102 } else { 102 $n = count( $wp_registered_sidebars);103 $n = count( $wp_registered_sidebars ); 103 104 do { 104 105 $_args['id'] = 'sidebar-' . ++$n; 105 } while ( is set($wp_registered_sidebars[$_args['id']]) );106 } while ( is_registered_sidebar( $_args['id'] ) ); 106 107 } 107 108 register_sidebar($_args); … … 204 205 205 206 unset( $wp_registered_sidebars[ $name ] ); 207 } 208 209 /** 210 * Checks if a sidebar is registered. 211 * 212 * @since 4.4.0 213 * 214 * @global array $wp_registered_sidebars Registered sidebars. 215 * 216 * @param string $name The ID of the sidebar when it was added. 217 * 218 * @return bool True if the sidebar is registered, false otherwise. 219 */ 220 function is_registered_sidebar( $name ) { 221 global $wp_registered_sidebars; 222 return isset( $wp_registered_sidebars[ $name ] ); 206 223 } 207 224
Note: See TracChangeset
for help on using the changeset viewer.