<?php
/**
* The Third Party integration with the Elementor plugin.
*
* Detects Elementor editor/preview actions and safely disables LiteSpeed Cache features
* that could interfere with live editing. Also hooks cache purge when Elementor regenerates
* its CSS & data.
*
* @since 2.9.8.8
* @package LiteSpeed
* @subpackage LiteSpeed_Cache/thirdparty
*/
namespace LiteSpeed\Thirdparty;
defined('WPINC') || exit();
/**
* Handles Elementor compatibility.
*/
class Elementor {
/**
* Preload hooks and disable caching features during Elementor edit/preview flows.
*
* This method only inspects query/server values to detect editor context.
* No privileged actions are performed here, so nonce verification is not required.
*
* @since 2.9.8.8
* @return void
*/
public static function preload() {
if ( ! defined( 'ELEMENTOR_VERSION' ) ) {
return;
}
// If user explicitly opened the Elementor editor, disable all LSCWP features.
$action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( 'elementor' === $action ) {
do_action( 'litespeed_disable_all', 'elementor edit mode' );
}
// If the referrer indicates an Elementor editor context, inspect possible save actions.
$http_referer = isset( $_SERVER['HTTP_REFERER'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( '' !== $http_referer && false !== strpos( $http_referer, 'action=elementor' ) ) {
// Elementor posts JSON in the 'actions' request field when saving from editor.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$actions_raw = isset( $_REQUEST['actions'] ) ? wp_unslash( $_REQUEST['actions'] ) : '';
if ( '' !== $actions_raw ) {
// Use a forgiving sanitizer for JSON strings, then decode.
$json = json_decode( sanitize_textarea_field( $actions_raw ), true );
// Debug2::debug( '3rd Elementor', $json );
if (
! empty( $json['save_builder']['action'] ) &&
'save_builder' === $json['save_builder']['action'] &&
! empty( $json['save_builder']['data']['status'] ) &&
'publish' === $json['save_builder']['data']['status']
) {
// Publishing from editor — allow normal flow so crawler/purge can run.
return;
}
}
// In all other editor-referrer cases, disable LSCWP features during edit.
do_action( 'litespeed_disable_all', 'elementor edit mode in HTTP_REFERER' );
}
// Clear LSC cache when Elementor regenerates CSS & Data.
add_action( 'elementor/core/files/clear_cache', __CLASS__ . '::regenerate_litespeed_cache' );
}
/**
* Disable LiteSpeed ESI explicitly (kept for backward compatibility if re-enabled).
*
* @since 2.9.8.8
* @return void
*/
public static function disable_litespeed_esi() {
if ( ! defined( 'LITESPEED_ESI_OFF' ) ) {
define( 'LITESPEED_ESI_OFF', true );
}
}
/**
* Purge LiteSpeed Cache when Elementor regenerates its CSS & Data.
*
* @since 2.9.8.8
* @return void
*/
public static function regenerate_litespeed_cache() {
do_action( 'litespeed_purge_all', 'Elementor - Regenerate CSS & Data' );
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| aelia-currencyswitcher.cls.php | 2026-06-06 16:18 | 2.67 KB | 76129f60960:kunden | -xw-x----- | |
| amp.cls.php | 2026-06-06 16:18 | 2.44 KB | 76129f60960:kunden | -xw-x----- | |
| autoptimize.cls.php | 2026-06-06 16:18 | 910 B | 76129f60960:kunden | -xw-x----- | |
| avada.cls.php | 2026-06-06 16:18 | 813 B | 76129f60960:kunden | -xw-x----- | |
| bbpress.cls.php | 2026-06-06 16:18 | 2.58 KB | 76129f60960:kunden | -xw-x----- | |
| beaver-builder.cls.php | 2026-06-06 16:18 | 1.12 KB | 76129f60960:kunden | -xw-x----- | |
| caldera-forms.cls.php | 2026-06-06 16:18 | 806 B | 76129f60960:kunden | -xw-x----- | |
| divi-theme-builder.cls.php | 2026-06-06 16:18 | 3.57 KB | 76129f60960:kunden | -xw-x----- | |
| elementor.cls.php | 2026-06-06 16:18 | 3.25 KB | 76129f60960:kunden | -xw-x----- | |
| entry.inc.php | 2026-06-06 16:18 | 1.51 KB | 76129f60960:kunden | -xw-x----- | |
| facetwp.cls.php | 2026-06-06 16:18 | 1.44 KB | 76129f60960:kunden | -xw-x----- | |
| gravity-forms.cls.php | 2026-06-06 16:18 | 1.14 KB | 76129f60960:kunden | -xw-x----- | |
| litespeed-check.cls.php | 2026-06-06 16:18 | 5.41 KB | 76129f60960:kunden | -xw-x----- | |
| nextgengallery.cls.php | 2026-06-06 16:18 | 6.51 KB | 76129f60960:kunden | -xw-x----- | |
| perfmatters.cls.php | 2026-06-06 16:18 | 996 B | 76129f60960:kunden | -xw-x----- | |
| theme-my-login.cls.php | 2026-06-06 16:18 | 1.01 KB | 76129f60960:kunden | -xw-x----- | |
| user-switching.cls.php | 2026-06-06 16:18 | 793 B | 76129f60960:kunden | -xw-x----- | |
| wc-pdf-product-vouchers.cls.php | 2026-06-06 16:18 | 992 B | 76129f60960:kunden | -xw-x----- | |
| wcml.cls.php | 2026-06-06 16:18 | 1.74 KB | 76129f60960:kunden | -xw-x----- | |
| woo-paypal.cls.php | 2026-06-06 16:18 | 869 B | 76129f60960:kunden | -xw-x----- | |
| woocommerce.cls.php | 2026-06-06 16:18 | 30.15 KB | 76129f60960:kunden | -xw-x----- | |
| woocommerce.content.tpl.php | 2026-06-06 16:18 | 3.91 KB | 76129f60960:kunden | -xw-x----- | |
| woocommerce.tab.tpl.php | 2026-06-06 16:18 | 230 B | 76129f60960:kunden | -xw-x----- | |
| wp-polls.cls.php | 2026-06-06 16:18 | 807 B | 76129f60960:kunden | -xw-x----- | |
| wp-postratings.cls.php | 2026-06-06 16:18 | 900 B | 76129f60960:kunden | -xw-x----- | |
| wpdiscuz.cls.php | 2026-06-06 16:18 | 1.18 KB | 76129f60960:kunden | -xw-x----- | |
| wplister.cls.php | 2026-06-06 16:18 | 870 B | 76129f60960:kunden | -xw-x----- | |
| wpml.cls.php | 2026-06-06 16:18 | 1.02 KB | 76129f60960:kunden | -xw-x----- | |
| wptouch.cls.php | 2026-06-06 16:18 | 879 B | 76129f60960:kunden | -xw-x----- | |
| yith-wishlist.cls.php | 2026-06-06 16:18 | 5.23 KB | 76129f60960:kunden | -xw-x----- | |