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.../httpdocs/wp-conte.../plugins/embedpre.../vendor/priyomuk.../wp-notic.../src/Utils
File: Storage.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace PriyoMukul\WPNotice\Utils;
[2] Fix | Delete
[3] Fix | Delete
use function property_exists;
[4] Fix | Delete
[5] Fix | Delete
#[\AllowDynamicProperties]
[6] Fix | Delete
class Storage extends Base {
[7] Fix | Delete
private $id = 'wpnotice';
[8] Fix | Delete
private $type = 'options';
[9] Fix | Delete
private $version = '1.1.0';
[10] Fix | Delete
private $storage_key = 'notices';
[11] Fix | Delete
[12] Fix | Delete
public function __construct( $args ) {
[13] Fix | Delete
$this->id = ! empty( $args['id'] ) ? $args['id'] : $this->id;
[14] Fix | Delete
$this->type = ! empty( $args['store'] ) ? $args['store'] : $this->type;
[15] Fix | Delete
$this->storage_key = ! empty( $args['storage_key'] ) ? $this->id . '_' . $args['storage_key'] : "{$this->id}_{$this->storage_key}";
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
public function __get( $name ) {
[19] Fix | Delete
return property_exists( $this, $name ) ? $this->$name : null;
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
public function save( $value, $key = '' ) {
[23] Fix | Delete
if ( empty( $key ) ) {
[24] Fix | Delete
$key = $this->storage_key;
[25] Fix | Delete
$value['version'] = $this->version;
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
if ( $this->type === 'options' ) {
[29] Fix | Delete
return update_site_option( $key, $value );
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
return false;
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
public function get( $key = '', $default = false ) {
[36] Fix | Delete
$key = empty( $key ) ? $this->storage_key : $key;
[37] Fix | Delete
[38] Fix | Delete
if ( $this->type === 'options' ) {
[39] Fix | Delete
return get_site_option( $key, $default );
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
return $default;
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
public function save_meta( $id, $value = true ) {
[46] Fix | Delete
return update_user_meta( get_current_user_id(), "{$this->id}_{$id}_notice_dismissed", $value );
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
public function get_meta( $id ) {
[50] Fix | Delete
return boolval( get_user_meta( get_current_user_id(), "{$this->id}_{$id}_notice_dismissed", true ) );
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
public function remove_meta( $id ) {
[54] Fix | Delete
return delete_user_meta( get_current_user_id(), "{$this->id}_{$id}_notice_dismissed" );
[55] Fix | Delete
}
[56] Fix | Delete
}
[57] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function