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/jeg-elementor-kit/lib/jeg-framework/util/class-setting.php
<?php
/**
 * Retrieve Setting for Header Builder
 *
 * @author Jegtheme
 * @since 1.0.0
 * @package header-builder
 */

namespace Jeg\Util;

use Jeg\Customizer\Customizer;

/**
 * Class Setting
 *
 * @package Jeg\Util
 */
class Setting {

	/**
	 * Get value of option
	 *
	 * @param string $id name of setting.
	 * @param mixed  $default default option.
	 *
	 * @return mixed
	 */
	protected static function get_option( $id, $default ) {
		$data = explode( '[', rtrim( $id, ']' ) );

		if ( 1 === count( $data ) ) {
			return get_option( $id, $default );
		} else {
			$option = get_option( $data[0] );
			$key    = $data[1];

			if ( isset( $option[ $key ] ) ) {
				return $option[ $key ];
			} else {
				return $default;
			}
		}
	}

	/**
	 * Get value of theme option (get theme mod)
	 *
	 * @param string $id name of setting.
	 * @param mixed  $default default option.
	 *
	 * @return mixed
	 */
	protected static function get_theme_mod( $id, $default ) {
		return get_theme_mod( $id, $default );
	}

	/**
	 * Get Value of setting (either use option or option)
	 *
	 * @param string $id name of setting.
	 * @param mixed  $default default option.
	 *
	 * @return mixed
	 */
	public static function get( $id, $default = null ) {
		$value  = null;
		$fields = Customizer::get_instance()->get_all_fields();

		if ( isset( $fields[ $id ] ) ) {
			$field = $fields[ $id ];
			$type  = isset( $field['option_type'] ) ? $field['option_type'] : 'theme_mod';

			if ( 'option' === $type ) {
				$value = self::get_option( $id, $default );
			} else {
				$value = self::get_theme_mod( $id, $default );
			}
		}

		return apply_filters( 'jeg_setting_value', $value, $id );
	}

}