Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/litespee.../thirdpar...
File: elementor.cls.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* The Third Party integration with the Elementor plugin.
[2] Fix | Delete
*
[3] Fix | Delete
* Detects Elementor editor/preview actions and safely disables LiteSpeed Cache features
[4] Fix | Delete
* that could interfere with live editing. Also hooks cache purge when Elementor regenerates
[5] Fix | Delete
* its CSS & data.
[6] Fix | Delete
*
[7] Fix | Delete
* @since 2.9.8.8
[8] Fix | Delete
* @package LiteSpeed
[9] Fix | Delete
* @subpackage LiteSpeed_Cache/thirdparty
[10] Fix | Delete
*/
[11] Fix | Delete
[12] Fix | Delete
namespace LiteSpeed\Thirdparty;
[13] Fix | Delete
[14] Fix | Delete
defined('WPINC') || exit();
[15] Fix | Delete
[16] Fix | Delete
/**
[17] Fix | Delete
* Handles Elementor compatibility.
[18] Fix | Delete
*/
[19] Fix | Delete
class Elementor {
[20] Fix | Delete
[21] Fix | Delete
/**
[22] Fix | Delete
* Preload hooks and disable caching features during Elementor edit/preview flows.
[23] Fix | Delete
*
[24] Fix | Delete
* This method only inspects query/server values to detect editor context.
[25] Fix | Delete
* No privileged actions are performed here, so nonce verification is not required.
[26] Fix | Delete
*
[27] Fix | Delete
* @since 2.9.8.8
[28] Fix | Delete
* @return void
[29] Fix | Delete
*/
[30] Fix | Delete
public static function preload() {
[31] Fix | Delete
if ( ! defined( 'ELEMENTOR_VERSION' ) ) {
[32] Fix | Delete
return;
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
// If user explicitly opened the Elementor editor, disable all LSCWP features.
[36] Fix | Delete
$action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
[37] Fix | Delete
if ( 'elementor' === $action ) {
[38] Fix | Delete
do_action( 'litespeed_disable_all', 'elementor edit mode' );
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
// If the referrer indicates an Elementor editor context, inspect possible save actions.
[42] Fix | Delete
$http_referer = isset( $_SERVER['HTTP_REFERER'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
[43] Fix | Delete
if ( '' !== $http_referer && false !== strpos( $http_referer, 'action=elementor' ) ) {
[44] Fix | Delete
// Elementor posts JSON in the 'actions' request field when saving from editor.
[45] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
[46] Fix | Delete
$actions_raw = isset( $_REQUEST['actions'] ) ? wp_unslash( $_REQUEST['actions'] ) : '';
[47] Fix | Delete
if ( '' !== $actions_raw ) {
[48] Fix | Delete
// Use a forgiving sanitizer for JSON strings, then decode.
[49] Fix | Delete
$json = json_decode( sanitize_textarea_field( $actions_raw ), true );
[50] Fix | Delete
// Debug2::debug( '3rd Elementor', $json );
[51] Fix | Delete
[52] Fix | Delete
if (
[53] Fix | Delete
! empty( $json['save_builder']['action'] ) &&
[54] Fix | Delete
'save_builder' === $json['save_builder']['action'] &&
[55] Fix | Delete
! empty( $json['save_builder']['data']['status'] ) &&
[56] Fix | Delete
'publish' === $json['save_builder']['data']['status']
[57] Fix | Delete
) {
[58] Fix | Delete
// Publishing from editor — allow normal flow so crawler/purge can run.
[59] Fix | Delete
return;
[60] Fix | Delete
}
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
// In all other editor-referrer cases, disable LSCWP features during edit.
[64] Fix | Delete
do_action( 'litespeed_disable_all', 'elementor edit mode in HTTP_REFERER' );
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
// Clear LSC cache when Elementor regenerates CSS & Data.
[68] Fix | Delete
add_action( 'elementor/core/files/clear_cache', __CLASS__ . '::regenerate_litespeed_cache' );
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
/**
[72] Fix | Delete
* Disable LiteSpeed ESI explicitly (kept for backward compatibility if re-enabled).
[73] Fix | Delete
*
[74] Fix | Delete
* @since 2.9.8.8
[75] Fix | Delete
* @return void
[76] Fix | Delete
*/
[77] Fix | Delete
public static function disable_litespeed_esi() {
[78] Fix | Delete
if ( ! defined( 'LITESPEED_ESI_OFF' ) ) {
[79] Fix | Delete
define( 'LITESPEED_ESI_OFF', true );
[80] Fix | Delete
}
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
/**
[84] Fix | Delete
* Purge LiteSpeed Cache when Elementor regenerates its CSS & Data.
[85] Fix | Delete
*
[86] Fix | Delete
* @since 2.9.8.8
[87] Fix | Delete
* @return void
[88] Fix | Delete
*/
[89] Fix | Delete
public static function regenerate_litespeed_cache() {
[90] Fix | Delete
do_action( 'litespeed_purge_all', 'Elementor - Regenerate CSS & Data' );
[91] Fix | Delete
}
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function