: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace NetworkPosts\Components\Settings;
class NetsPostsNetworkSettings {
const DENY_EXCERPT_TAGS_OPTION = 'netsposts_deny_excerpt_tags';
public static function is_excerpt_tags_denied( int $blog_id ): bool {
$blogs = self::get_restricted_excerpt_tag_blogs();
return is_array( $blogs ) && in_array( $blog_id, $blogs );
public static function get_restricted_excerpt_tag_blogs(): array {
$blogs_option = get_site_option( self::DENY_EXCERPT_TAGS_OPTION, null );
$blogs = get_sites( array( 'fields' => 'ids', 'public' => 1 ) );
self::set_denied_excerpt_tag_blogs( $blogs );
if( is_serialized( $blogs_option ) ) {
return unserialize( $blogs_option );
public static function set_denied_excerpt_tag_blogs( array $blogs ): void {
delete_site_option( self::DENY_EXCERPT_TAGS_OPTION );
update_site_option( self::DENY_EXCERPT_TAGS_OPTION, serialize( $blogs ) );
public static function allow_excerpt_tags_for_blog( int $blog_id ): void {
$blogs = self::get_restricted_excerpt_tag_blogs();
$index = array_search( $blog_id , $blogs);
$blogs = array_values( $blogs );
self::set_denied_excerpt_tag_blogs( $blogs );
public static function deny_excerpt_tags_for_blog( $blog_id ): void {
$blogs = self::get_restricted_excerpt_tag_blogs();
if( !in_array( $blog_id, $blogs ) ){
self::set_denied_excerpt_tag_blogs( $blogs );