HEX
Server: Apache/2
System: Linux vpslll9m.sdns.vn 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
User: thuexe247c (1044)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/thuexe247c/public_html/wp-content/themes/flatsome/inc/classes/class-flatsome-theme-json.php
<?php
/**
 * Flatsome_Theme_JSON class.
 *
 * @author  UX Themes
 * @package Flatsome
 * @since   3.18.0
 */

defined( 'ABSPATH' ) || exit;

/**
 * Class Flatsome_Theme_JSON
 *
 * @package Flatsome
 */
final class Flatsome_Theme_JSON {

	/**
	 * Initialize.
	 */
	public function init() {
		add_filter( 'wp_theme_json_data_user', [ $this, 'update_data' ] );
	}

	/**
	 * Modifies the `theme.json` values.
	 *
	 * @param WP_Theme_JSON_Data $theme_json Theme JSON data instance.
	 */
	public function update_data( $theme_json ) {
		return $theme_json->update_with(
			array(
				'version'  => 2,
				'settings' => array(
					'color' => array(
						'palette' => array(
							'theme' => $this->get_color_palette(),
						),
					),
				),
			)
		);
	}

	/**
	 * Get color values.
	 */
	private function get_color_palette() {
		return array(
			array(
				'slug'  => 'primary',
				'color' => get_theme_mod( 'color_primary', Flatsome_Default::COLOR_PRIMARY ),
			),
			array(
				'slug'  => 'secondary',
				'color' => get_theme_mod( 'color_secondary', Flatsome_Default::COLOR_SECONDARY ),
			),
			array(
				'slug'  => 'success',
				'color' => get_theme_mod( 'color_success', Flatsome_Default::COLOR_SUCCESS ),
			),
			array(
				'slug'  => 'alert',
				'color' => get_theme_mod( 'color_alert', Flatsome_Default::COLOR_ALERT ),
			),
		);
	}
}