: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace NetworkPosts\Components\Resizer;
class NetsPostsThumbnailBlogSettings {
const ALLOWED_BLOGS_OPTION = 'netsposts_resizer_blogs';
const GLOBAL_SITES_OPTIONS = 'netsposts_global_blogs_thumbnail_sizes';
protected function __construct() {
public static function is_allowed_for_blog($blog_id){
$blogs = self::get_allowed_blogs();
return is_array( $blogs ) && in_array( $blog_id, $blogs );
public static function get_allowed_blogs(){
$blogs_option = get_site_option( self::ALLOWED_BLOGS_OPTION, null );
if( is_serialized( $blogs_option ) ) {
return unserialize( $blogs_option );
public static function set_allowed_blogs( $blogs ){
delete_site_option( self::ALLOWED_BLOGS_OPTION );
update_site_option( self::ALLOWED_BLOGS_OPTION, serialize( $blogs ) );
public static function restrict_for_blog( $blog_id ){
$blogs = self::get_allowed_blogs();
$index = array_search( $blog_id , $blogs);
self::set_allowed_blogs( array_values( $blogs ) );
public static function allow_for_blog( $blog_id ){
$blogs = self::get_allowed_blogs();
if( !in_array( $blog_id, $blogs ) ){
self::set_allowed_blogs( $blogs );
public static function get_globals(){
$blogs_option = get_site_option( self::GLOBAL_SITES_OPTIONS, null );
if(is_serialized( $blogs_option )){
return unserialize( $blogs_option );
public static function is_global( $blog_id ){
$globals = self::get_globals();
return is_array( $globals ) && in_array( $blog_id, $globals );
public static function set_globals( $blogs ){
update_site_option( self::GLOBAL_SITES_OPTIONS, serialize( $blogs ) );
delete_site_option( self::GLOBAL_SITES_OPTIONS );
public static function make_global( $blog_id ){
$blogs = self::get_globals();
if(!in_array( $blog_id, $blogs )) {
update_site_option( self::GLOBAL_SITES_OPTIONS, serialize($blogs) );
public static function delete_from_global( $blog_id ){
$blogs = self::get_globals();
$index = array_search( $blog_id , $blogs);
self::set_globals( array_values( $blogs ) );