Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../public_h.../clone/wp-conte.../plugins/network-.../componen.../resizer
File: NetsPostsThumbnailBlogSettings.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Created by PhpStorm.
[2] Fix | Delete
* User: Andrew
[3] Fix | Delete
* Date: 29.05.2018
[4] Fix | Delete
* Time: 10:44
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
namespace NetworkPosts\Components\Resizer;
[8] Fix | Delete
[9] Fix | Delete
class NetsPostsThumbnailBlogSettings {
[10] Fix | Delete
[11] Fix | Delete
const ALLOWED_BLOGS_OPTION = 'netsposts_resizer_blogs';
[12] Fix | Delete
const GLOBAL_SITES_OPTIONS = 'netsposts_global_blogs_thumbnail_sizes';
[13] Fix | Delete
[14] Fix | Delete
protected function __construct() {
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
public static function is_allowed_for_blog($blog_id){
[18] Fix | Delete
$blogs = self::get_allowed_blogs();
[19] Fix | Delete
return is_array( $blogs ) && in_array( $blog_id, $blogs );
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
public static function get_allowed_blogs(){
[23] Fix | Delete
$blogs_option = get_site_option( self::ALLOWED_BLOGS_OPTION, null );
[24] Fix | Delete
if( !$blogs_option ){
[25] Fix | Delete
return [];
[26] Fix | Delete
}
[27] Fix | Delete
if( is_serialized( $blogs_option ) ) {
[28] Fix | Delete
return unserialize( $blogs_option );
[29] Fix | Delete
}
[30] Fix | Delete
return [];
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
public static function set_allowed_blogs( $blogs ){
[34] Fix | Delete
if( empty( $blogs ) ){
[35] Fix | Delete
delete_site_option( self::ALLOWED_BLOGS_OPTION );
[36] Fix | Delete
}
[37] Fix | Delete
else{
[38] Fix | Delete
update_site_option( self::ALLOWED_BLOGS_OPTION, serialize( $blogs ) );
[39] Fix | Delete
}
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
public static function restrict_for_blog( $blog_id ){
[43] Fix | Delete
$blogs = self::get_allowed_blogs();
[44] Fix | Delete
$index = array_search( $blog_id , $blogs);
[45] Fix | Delete
if($index !== false) {
[46] Fix | Delete
unset( $blogs[$index] );
[47] Fix | Delete
self::set_allowed_blogs( array_values( $blogs ) );
[48] Fix | Delete
}
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
public static function allow_for_blog( $blog_id ){
[52] Fix | Delete
$blogs = self::get_allowed_blogs();
[53] Fix | Delete
if( !in_array( $blog_id, $blogs ) ){
[54] Fix | Delete
$blogs[] = $blog_id;
[55] Fix | Delete
self::set_allowed_blogs( $blogs );
[56] Fix | Delete
}
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
public static function get_globals(){
[60] Fix | Delete
$blogs_option = get_site_option( self::GLOBAL_SITES_OPTIONS, null );
[61] Fix | Delete
if( !$blogs_option ){
[62] Fix | Delete
return [];
[63] Fix | Delete
}
[64] Fix | Delete
if(is_serialized( $blogs_option )){
[65] Fix | Delete
return unserialize( $blogs_option );
[66] Fix | Delete
}
[67] Fix | Delete
return [];
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
public static function is_global( $blog_id ){
[71] Fix | Delete
$globals = self::get_globals();
[72] Fix | Delete
return is_array( $globals ) && in_array( $blog_id, $globals );
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
public static function set_globals( $blogs ){
[76] Fix | Delete
if( !empty( $blogs ) ){
[77] Fix | Delete
update_site_option( self::GLOBAL_SITES_OPTIONS, serialize( $blogs ) );
[78] Fix | Delete
}
[79] Fix | Delete
else{
[80] Fix | Delete
delete_site_option( self::GLOBAL_SITES_OPTIONS );
[81] Fix | Delete
}
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
public static function make_global( $blog_id ){
[85] Fix | Delete
$blogs = self::get_globals();
[86] Fix | Delete
if(!in_array( $blog_id, $blogs )) {
[87] Fix | Delete
$blogs[] = $blog_id;
[88] Fix | Delete
}
[89] Fix | Delete
update_site_option( self::GLOBAL_SITES_OPTIONS, serialize($blogs) );
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
public static function delete_from_global( $blog_id ){
[93] Fix | Delete
$blogs = self::get_globals();
[94] Fix | Delete
$index = array_search( $blog_id , $blogs);
[95] Fix | Delete
if($index !== false) {
[96] Fix | Delete
unset( $blogs[$index] );
[97] Fix | Delete
self::set_globals( array_values( $blogs ) );
[98] Fix | Delete
}
[99] Fix | Delete
}
[100] Fix | Delete
}
[101] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function