Make WordPress Core


Ignore:
Timestamp:
05/03/2009 11:20:26 PM (17 years ago)
Author:
azaozz
Message:

Make is_active_widget() optionally look in 'wp_inactive_widgets' for use in the admin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/widgets.php

    r11160 r11164  
    817817 * @param int $widget_id Optional, but needed for checking. Widget ID.
    818818 * @param string $id_base Optional, the base ID of a widget created by extending WP_Widget.
     819 * @param bool $skip_inactive Optional, whether to check in 'wp_inactive_widgets'.
    819820 * @return mixed false if widget is not active or id of sidebar in which the widget is active.
    820821 */
    821 function is_active_widget($callback = false, $widget_id = false, $id_base = false) {
     822function is_active_widget($callback = false, $widget_id = false, $id_base = false, $skip_inactive = true) {
    822823    global $wp_registered_widgets;
    823824
     
    826827    if ( is_array($sidebars_widgets) ) {
    827828        foreach ( $sidebars_widgets as $sidebar => $widgets ) {
     829            if ( $skip_inactive && 'wp_inactive_widgets' == $sidebar )
     830                continue;
     831           
    828832            if ( is_array($widgets) ) {
    829833                foreach ( $widgets as $widget ) {
Note: See TracChangeset for help on using the changeset viewer.