WordPress.org

Plugin Directory

Changeset 403447


Ignore:
Timestamp:
07/01/11 19:33:34 (3 years ago)
Author:
Kawauso
Message:

committing 1.1.3

Location:
restrict-multisite-widgets/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • restrict-multisite-widgets/trunk/readme.txt

    r392827 r403447  
    44Requires at least: 3.0 
    55Tested up to: 3.2 
    6 Stable tag: 1.1.2 
     6Stable tag: 1.1.3 
    77 
    88Allows network admins to restrict which widgets are available on sites, similar to themes. 
     
    4040== Changelog == 
    4141 
     42= 1.1.3 = 
     43* Activation state check for menus to support single blog activation 
     44* Fixed single instance widget detection (PHP isset() quirk) 
     45* Moved to native single instance widget removal 
     46 
    4247= 1.1.2 = 
    4348* Changed class loading to admin-only to avoid unintentional frontend restrictions (thanks dwieeb) 
     
    5863== Upgrade Notice == 
    5964 
     65= 1.1.3 = 
     66Support for single blog activation (menu item under Site Admin for single blogs). Fixed single instance widget detection. 
     67 
    6068= 1.1.2 = 
    6169Stops restricted widgets from not appearing for non-super admins. 
  • restrict-multisite-widgets/trunk/restrict-multisite-widgets.php

    r402247 r403447  
    1919    add_action( 'wp_loaded', array(&$this,'filter_single') ); 
    2020    add_action( 'wp_register_sidebar_widget', array(&$this,'register') ); 
     21    add_action( 'wp_unregister_sidebar_widget', array(&$this,'unregister') ); 
    2122 
    2223    if ( ! function_exists( 'is_plugin_active_for_network' ) ) 
     
    5758        return $widgets; 
    5859 
    59     global $wp_registered_widgets; 
    60  
    6160    foreach( array_keys( $this->single_widgets ) as $widget_key ) { // Single widgets 
    6261        if ( !isset( $allowed_widgets[ $widget_key ] ) ) 
    63             unset( $wp_registered_widgets[ $widget_key ] ); 
     62            wp_register_sidebar_widget( $widget_key ); 
    6463    } 
    6564} 
     
    6766 
    6867function register( $widget ) { // Register single instance widgets internally since they don't use WP_Widget_Factory 
    69     if ( !isset( $widget['params'][0]['number'] ) ) 
     68    if ( isset( $widget['params'][0] ) && ! is_array( $widget['params'][0] ) ) 
    7069        $this->single_widgets[ $widget['id'] ] = $widget['name']; 
    7170    return $widget; 
     71} 
     72 
     73 
     74function unregister( $widget_id ) { // Unregister single instance widget 
     75    unset( $this->single_widgets[ $widget_id ] ); 
    7276} 
    7377 
Note: See TracChangeset for help on using the changeset viewer.