<?php

class Rover_IDX_Schedule
	{
	private Rover_IDX $rover_idx;

	public function __construct(Rover_IDX $rover_idx)
		{
		$this->rover_idx						= $rover_idx;
		}

	public function refresh_js_ver($force_refresh = false) {

		$this->rover_idx->COMMON->error_log(__FILE__, __FUNCTION__, __LINE__, ' ROVER_COMPONENT_GET_JS_VERSION');

		if (!is_array($theme_opts = get_option(roverOPTIONS::THEME)))
			$theme_opts				= array();

		$current_js_ver				= (isset($theme_opts['js_version']))
											? $theme_opts['js_version']
											: roverVERSIONS::JS;

		$rover_content				= $this->rover_idx->CONTENT->rover_content( 'ROVER_COMPONENT_GET_JS_VERSION' );
		$latest_js_ver				= $rover_content['the_html'];

		$this->rover_idx->COMMON->error_log(__FILE__, __FUNCTION__, __LINE__, ' latest_js_ver ['.$latest_js_ver.']');

		if ($force_refresh || (version_compare($latest_js_ver, $current_js_ver) !== 0))
			{
			if (!is_array($theme_opts = get_option(roverOPTIONS::THEME)))
				$theme_opts	= array();

			$theme_opts['js_version'] = $latest_js_ver;
			update_option(roverOPTIONS::THEME, $theme_opts);
			}

		return $latest_js_ver;
		}
	}



?>