HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpicare/wp-content/plugins/wp-events-manager/inc/class-wpems-settings.php
<?php
/**
 * WP Events Manager Settings class
 *
 * @author        ThimPress, leehld
 * @package       WP-Events-Manager/Class
 * @version       2.1.7
 */

/**
 * Prevent loading this file directly
 */
defined( 'ABSPATH' ) || exit;

class WPEMS_Settings {

	/**
	 * $_options
	 * @var null
	 */
	public $_options = null;

	/**
	 * prefix option name
	 * @var string
	 */
	public $_prefix = 'thimpress_events';

	/**
	 * _instance
	 * @var null
	 */
	static $_instance = null;

	public function __construct( $prefix = null ) {
		if ( $prefix ) {
			$this->_prefix = $prefix;
		}

		// load options
		if ( ! $this->_options ) {
			$this->_options = $this->options();
		}
	}

	public function __get( $id = null ) {
		$settings = apply_filters( 'tp_event_settings_field', array() );

		if ( isset( $settings[ $id ] ) ) {
			return $settings[ $id ];
		}
	}

	/**
	 * options load options
	 * @return array || null
	 */
	protected function options() {
		$options = get_option( $this->_prefix, [] );

		return $options;
	}

	/**
	 * get_name_field
	 *
	 * @param  $name of field option
	 *
	 * @return string name field
	 */
	public function get_field_name( $name = null ) {
		if ( ! $this->_prefix || ! $name ) {
			return;
		}

		return $this->_prefix . '[' . $name . ']';
	}

	/**
	 * get_name_field
	 *
	 * @param  $name of field option
	 *
	 * @return string name field
	 */
	public function get_field_id( $name = null, $default = null ) {
		if ( ! $this->_prefix || ! $name ) {
			return;
		}

		return $this->_prefix . '_' . $name;
	}

	/**
	 * get option value
	 *
	 * @param  $name
	 *
	 * @return option value. array, string, boolean
	 */
	public function get( $name = null, $default = null ) {
		if ( ! $this->_options ) {
			$this->_options = $this->options();
		}

		if ( $name && isset( $this->_options[ $name ] ) ) {
			return $this->_options[ $name ];
		}

		return $default;
	}

	/**
	 * get option value
	 *
	 * @param  $name
	 *
	 * @return option value. array, string, boolean
	 */
	public function set( $name = null, $default = null ) {
		if ( ! $this->_options ) {
			$this->_options = $this->options();
		}

		if ( $name && isset( $this->_options[ $name ] ) ) {
			return $this->_options[ $name ];
		}

		return $default;
	}

	/**
	 * instance
	 *
	 * @param  $prefix
	 *
	 * @return object class
	 */
	public static function instance( $prefix = null ) {

		if ( ! empty( self::$_instance[ $prefix ] ) ) {

			return $GLOBALS['event_auth_settings'] = self::$_instance[ $prefix ];
		}

		return $GLOBALS['event_auth_settings'] = self::$_instance[ $prefix ] = new self( $prefix );
	}

}