HEX
Server: Apache
System: Linux sg241.singhost.net 2.6.32-896.16.1.lve1.4.51.el6.x86_64 #1 SMP Wed Jan 17 13:19:23 EST 2018 x86_64
User: honghock (909)
PHP: 8.0.30
Disabled: passthru,system,shell_exec,show_source,exec,popen,proc_open
Upload Files
File: /home/honghock/public_html/wp-content/plugins/easyjobs/admin/includes/Notice/Utils/Storage.php
<?php

namespace PriyoMukul\WPNotice\Utils;

use function property_exists;

#[\AllowDynamicProperties]
class Storage extends Base {
	private $id          = 'wpnotice';
	private $type        = 'options';
	private $version     = '1.1.0';
	private $storage_key = 'notices';

	public function __construct( $args ) {
		$this->id          = ! empty( $args['id'] ) ? $args['id'] : $this->id;
		$this->type        = ! empty( $args['store'] ) ? $args['store'] : $this->type;
		$this->storage_key = ! empty( $args['storage_key'] ) ? $this->id . '_' . $args['storage_key'] : "{$this->id}_{$this->storage_key}";
	}

	public function __get( $name ) {
		return property_exists( $this, $name ) ? $this->$name : null;
	}

	public function save( $value, $key = '' ) {
		if ( empty( $key ) ) {
			$key              = $this->storage_key;
			$value['version'] = $this->version;
		}

		if ( $this->type === 'options' ) {
			return update_site_option( $key, $value );
		}

		return false;
	}

	public function get( $key = '', $default = false ) {
		$key = empty( $key ) ? $this->storage_key : $key;

		if ( $this->type === 'options' ) {
			return get_site_option( $key, $default );
		}

		return $default;
	}

	public function save_meta( $id, $value = true ) {
		return update_user_meta( get_current_user_id(), "{$this->id}_{$id}_notice_dismissed", $value );
	}

	public function get_meta( $id ) {
		return boolval( get_user_meta( get_current_user_id(), "{$this->id}_{$id}_notice_dismissed", true ) );
	}

	public function remove_meta( $id ) {
		return delete_user_meta( get_current_user_id(), "{$this->id}_{$id}_notice_dismissed" );
	}
}