PHP 8.2.31
Preview: heartbeat.php Size: 2.57 KB
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/elementor/includes/heartbeat.php

<?php
namespace Elementor;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Elementor heartbeat.
 *
 * Elementor heartbeat handler class is responsible for initializing Elementor
 * heartbeat. The class communicates with WordPress Heartbeat API while working
 * with Elementor.
 *
 * @since 1.0.0
 */
class Heartbeat {

	/**
	 * Heartbeat received.
	 *
	 * Locks the Heartbeat response received when editing with Elementor.
	 *
	 * Fired by `heartbeat_received` filter.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @param array $response The Heartbeat response.
	 * @param array $data     The `$_POST` data sent.
	 *
	 * @return array Heartbeat response received.
	 */
	public function heartbeat_received( $response, $data ) {
		if ( isset( $data['elementor_post_lock']['post_ID'] ) ) {
			$post_id = $data['elementor_post_lock']['post_ID'];
			$locked_user = Plugin::$instance->editor->get_locked_user( $post_id );

			if ( ! $locked_user || ! empty( $data['elementor_force_post_lock'] ) ) {
				Plugin::$instance->editor->lock_post( $post_id );
			} else {
				$response['locked_user'] = $locked_user->display_name;
			}

			/** @var Core\Common\Modules\Ajax\Module $ajax */
			$ajax = Plugin::$instance->common->get_component( 'ajax' );

			$response['elementorNonce'] = $ajax->create_nonce();
		}
		return $response;
	}

	/**
	 * Refresh nonces.
	 *
	 * Filter the nonces to send to the editor when editing with Elementor. Used
	 * to refresh the nonce when the nonce expires while editing. This way the
	 * user doesn't need to log-in again as Elementor fetches the new nonce from
	 * the server using ajax.
	 *
	 * Fired by `wp_refresh_nonces` filter.
	 *
	 * @since 1.8.0
	 * @access public
	 *
	 * @param array $response The no-priv Heartbeat response object or array.
	 * @param array $data     The `$_POST` data sent.
	 *
	 * @return array Refreshed nonces.
	 */
	public function refresh_nonces( $response, $data ) {
		if ( isset( $data['elementor_post_lock']['post_ID'] ) ) {
			/** @var Core\Common\Modules\Ajax\Module $ajax */
			$ajax = Plugin::$instance->common->get_component( 'ajax' );

			$response['elementor-refresh-nonces'] = [
				'elementorNonce' => $ajax->create_nonce(),
				'heartbeatNonce' => wp_create_nonce( 'heartbeat-nonce' ),
			];
		}

		return $response;
	}

	/**
	 * Heartbeat constructor.
	 *
	 * Initializing Elementor heartbeat.
	 *
	 * @since 1.0.0
	 * @access public
	 */
	public function __construct() {
		add_filter( 'heartbeat_received', [ $this, 'heartbeat_received' ], 10, 2 );
		add_filter( 'wp_refresh_nonces', [ $this, 'refresh_nonces' ], 30, 2 );
	}
}

Directory Contents

Dirs: 11 × Files: 22

Name Size Perms Modified Actions
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
base DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
controls DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
elements DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
libraries DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
managers DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
settings DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
widgets DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
8.67 KB lrw-r--r-- 2026-05-20 16:19:28
Edit Download
9.79 KB lrw-r--r-- 2025-10-21 16:51:06
Edit Download
2.99 KB lrw-r--r-- 2023-04-23 15:22:46
Edit Download
10.96 KB lrw-r--r-- 2025-03-17 17:28:54
Edit Download
2.70 KB lrw-r--r-- 2023-04-23 15:22:46
Edit Download
15.89 KB lrw-r--r-- 2026-02-02 14:52:12
Edit Download
4.11 KB lrw-r--r-- 2026-06-08 16:48:02
Edit Download
8.48 KB lrw-r--r-- 2025-03-17 17:28:54
Edit Download
62.53 KB lrw-r--r-- 2025-03-17 17:28:54
Edit Download
40.03 KB lrw-r--r-- 2026-04-20 15:03:48
Edit Download
2.57 KB lrw-r--r-- 2023-04-23 15:22:46
Edit Download
11.16 KB lrw-r--r-- 2025-10-21 16:51:06
Edit Download
2.81 KB lrw-r--r-- 2025-03-17 17:28:54
Edit Download
16.68 KB lrw-r--r-- 2026-05-26 12:54:34
Edit Download
7.93 KB lrw-r--r-- 2026-05-20 16:19:28
Edit Download
4.16 KB lrw-r--r-- 2026-01-20 13:22:36
Edit Download
7.81 KB lrw-r--r-- 2025-08-05 18:00:00
Edit Download
8.91 KB lrw-r--r-- 2025-09-15 14:10:16
Edit Download
17.00 KB lrw-r--r-- 2025-11-10 16:25:22
Edit Download
3.44 KB lrw-r--r-- 2025-10-21 16:51:06
Edit Download
9.99 KB lrw-r--r-- 2025-12-04 22:09:04
Edit Download
24.88 KB lrw-r--r-- 2026-06-08 16:48:02
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).