Cleaned up option handling for multisite
Multisite detection has been executed multiple times while the status is present in class variable after initialization.
This commit is contained in:
@ -73,12 +73,12 @@ class StatifyBlacklist {
|
||||
return;
|
||||
}
|
||||
|
||||
// Plugin options.
|
||||
self::update_options();
|
||||
|
||||
// Get multisite status.
|
||||
self::$multisite = ( is_multisite() && array_key_exists( STATIFYBLACKLIST_BASE, (array) get_site_option( 'active_sitewide_plugins' ) ) );
|
||||
|
||||
// Plugin options.
|
||||
self::update_options();
|
||||
|
||||
// Add Filter to statify hook if enabled.
|
||||
if ( 0 !== self::$_options['referer']['active'] || 0 !== self::$_options['target']['active'] || 0 !== self::$_options['ip']['active'] ) {
|
||||
add_filter( 'statify__skip_tracking', array( 'StatifyBlacklist', 'apply_blacklist_filter' ) );
|
||||
@ -127,10 +127,12 @@ class StatifyBlacklist {
|
||||
* @param array $options Optional. New options to save.
|
||||
*/
|
||||
public static function update_options( $options = null ) {
|
||||
self::$_options = wp_parse_args(
|
||||
get_option( 'statify-blacklist' ),
|
||||
self::default_options()
|
||||
);
|
||||
if ( self::$multisite ) {
|
||||
$o = get_site_option( 'statify-blacklist' );
|
||||
} else {
|
||||
$o = get_option( 'statify-blacklist' );
|
||||
}
|
||||
self::$_options = wp_parse_args( $o, self::default_options() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user