WordPress.org

Make WordPress Core

Changeset 25580


Ignore:
Timestamp:
09/23/2013 08:13:58 PM (5 years ago)
Author:
nacin
Message:

Temporary hooks for the widgets feature team in dynamic_sidebar() and is_active_sidebar().

props westonruter.
fixes #25368.

File:
1 edited

Legend:

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

    r24988 r25580  
    859859
    860860    $sidebars_widgets = wp_get_sidebars_widgets();
    861     if ( empty( $sidebars_widgets ) )
    862         return false;
    863 
    864     if ( empty($wp_registered_sidebars[$index]) || !array_key_exists($index, $sidebars_widgets) || !is_array($sidebars_widgets[$index]) || empty($sidebars_widgets[$index]) )
    865         return false;
    866 
     861    if ( empty( $wp_registered_sidebars[ $index ] ) || empty( $sidebars_widgets[ $index ] ) || ! is_array( $sidebars_widgets[ $index ] ) ) {
     862        //temporary_hook #25368
     863        do_action( 'temp_dynamic_sidebar_before', $index, false );
     864        //temporary_hook #25368
     865        do_action( 'temp_dynamic_sidebar_after',  $index, false );
     866        //temporary_hook #25368
     867        return apply_filters( 'temp_dynamic_sidebar_has_widgets', false, $index );
     868    }
     869
     870    //temporary_hook #25368
     871    do_action( 'temp_dynamic_sidebar_before', $index, true );
    867872    $sidebar = $wp_registered_sidebars[$index];
    868873
     
    900905    }
    901906
     907    //temporary_hook #25368
     908    do_action( 'temp_dynamic_sidebar_after', $index, true );
     909    //temporary_hook #25368
     910    $did_one = apply_filters( 'temp_dynamic_sidebar_has_widgets', $did_one, $index );
    902911    return $did_one;
    903912}
     
    978987    $index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index);
    979988    $sidebars_widgets = wp_get_sidebars_widgets();
    980     if ( !empty($sidebars_widgets[$index]) )
    981         return true;
    982 
    983     return false;
     989    $is_active_sidebar = ! empty( $sidebars_widgets[$index] );
     990    //temporary_hook #25368
     991    $is_active_sidebar = apply_filters( 'temp_is_active_sidebar', $is_active_sidebar, $index );
     992    return $is_active_sidebar;
    984993}
    985994
Note: See TracChangeset for help on using the changeset viewer.