Ticket #25368: widgets.php.2.patch
File widgets.php.2.patch, 4.2 KB (added by , 11 years ago) |
---|
-
src/wp-includes/widgets.php
859 859 860 860 $sidebars_widgets = wp_get_sidebars_widgets(); 861 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 ); 862 /** 863 * See other instances of these hooks below. These first instances are 864 * only invoked if the sidebar is empty. 865 */ 866 do_action( 'dynamic_sidebar_before', $index, false ); 867 do_action( 'dynamic_sidebar_after', $index, false ); 868 return apply_filters( 'dynamic_sidebar_has_widgets', false, $index ); 868 869 } 869 870 870 //temporary_hook #25368 871 do_action( 'temp_dynamic_sidebar_before', $index, true ); 871 /** 872 * Invoke before dynamic_sidebar() renders any widgets 873 * 874 * @since 3.9.0 875 * 876 * @param string $index sidebar ID 877 * @param boolean whether the sidebar was populated with widgets 878 */ 879 do_action( 'dynamic_sidebar_before', $index, true ); 872 880 $sidebar = $wp_registered_sidebars[$index]; 873 881 874 882 $did_one = false; … … 892 900 $classname_ = ltrim($classname_, '_'); 893 901 $params[0]['before_widget'] = sprintf($params[0]['before_widget'], $id, $classname_); 894 902 903 /** 904 * Parameters to pass into the widget display_callback 905 * 906 * @since 2.5.0 907 * 908 * @param array $params { 909 * @type array $args first param passed to widget display_callback { 910 * @type string $name for sidebar 911 * @type string $id for sidebar 912 * @type string $description for sidebar 913 * @type string $class for sidebar 914 * @type string $widget_id 915 * @type string $widget_name 916 * @type string $before_widget 917 * @type string $after_widget 918 * @type string $before_title 919 * @type string $after_title 920 * } 921 * @type array $widget_args second param passed to widget display_callback { 922 * @type int $number for multi widget 923 * } 924 * } 925 */ 895 926 $params = apply_filters( 'dynamic_sidebar_params', $params ); 896 927 897 928 $callback = $wp_registered_widgets[$id]['callback']; 898 929 930 /** 931 * Invoke before dynamic_sidebar() is about to render a widget 932 * 933 * @since 3.0.0 934 * 935 * @param array registered widget 936 */ 899 937 do_action( 'dynamic_sidebar', $wp_registered_widgets[$id] ); 900 938 901 939 if ( is_callable($callback) ) { … … 904 942 } 905 943 } 906 944 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 ); 945 /** 946 * Invoke after dynamic_sidebar() renders any widgets 947 * 948 * @since 3.9.0 949 * 950 * @param string $index sidebar ID 951 * @param boolean whether the sidebar was populated with widgets 952 */ 953 do_action( 'dynamic_sidebar_after', $index, true ); 954 955 /** 956 * Allow a plugin to override the return value for dynamic_sidebar(), 957 * indicating whether or not widgets were rendered 958 * 959 * @since 3.9.0 960 * 961 * @param boolean $did_one whether a widget was rendered in the sidebar 962 * @param string $index sidebar ID 963 */ 964 $did_one = apply_filters( 'dynamic_sidebar_has_widgets', $did_one, $index ); 965 911 966 return $did_one; 912 967 } 913 968 … … 987 1042 $index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index); 988 1043 $sidebars_widgets = wp_get_sidebars_widgets(); 989 1044 $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 ); 1045 1046 /** 1047 * Return value for is_active_sidebar() 1048 * 1049 * @since 3.9 1050 * 1051 * @param boolean $is_active_sidebar whether or not the sidebar is populated with widgets 1052 * @param string $index sidebar ID 1053 */ 1054 $is_active_sidebar = apply_filters( 'is_active_sidebar', $is_active_sidebar, $index ); 1055 992 1056 return $is_active_sidebar; 993 1057 } 994 1058