Download all files FTP
This commit is contained in:
83
wp-content/plugins/litespeed-cache/thirdparty/aelia-currencyswitcher.cls.php
vendored
Normal file
83
wp-content/plugins/litespeed-cache/thirdparty/aelia-currencyswitcher.cls.php
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the Aelia CurrencySwitcher plugin.
|
||||
*
|
||||
* @since 1.0.13
|
||||
* @since 2.6 Removed hook_vary as OLS supports vary header already
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache/thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit();
|
||||
|
||||
/**
|
||||
* Integration layer for Aelia Currency Switcher.
|
||||
*
|
||||
* Registers the plugin cookies as Vary drivers so cached pages can differ by
|
||||
* selected currency / location. Hooks both the runtime vary list (headers)
|
||||
* and the rewrite-rules vary list (always needed).
|
||||
*/
|
||||
class Aelia_CurrencySwitcher {
|
||||
|
||||
/**
|
||||
* Cookie names used by Aelia Currency Switcher to determine currency & geo.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private static $_cookies = array( 'aelia_cs_selected_currency', 'aelia_customer_country', 'aelia_customer_state', 'aelia_tax_exempt' );
|
||||
|
||||
/**
|
||||
* Detects if WooCommerce + Aelia Currency Switcher are present and registers hooks.
|
||||
*
|
||||
* @since 1.0.13
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if ( defined( 'WOOCOMMERCE_VERSION' ) && isset( $GLOBALS['woocommerce-aelia-currencyswitcher'] ) && is_object( $GLOBALS['woocommerce-aelia-currencyswitcher'] ) ) {
|
||||
// Not all pages need to add vary, so allow sites to restrict via filter.
|
||||
self::$_cookies = apply_filters( 'litespeed_3rd_aelia_cookies', self::$_cookies );
|
||||
|
||||
// Add cookies to the active vary header list (conditionally used at runtime).
|
||||
add_filter( 'litespeed_vary_curr_cookies', __CLASS__ . '::check_cookies' );
|
||||
|
||||
// Ensure rewrite rules are aware of these cookies (always include).
|
||||
add_filter( 'litespeed_vary_cookies', __CLASS__ . '::register_cookies' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure Aelia cookies are part of the global vary cookie registry.
|
||||
*
|
||||
* @since 1.0.13
|
||||
*
|
||||
* @param string[] $cookies Current list of vary cookies.
|
||||
* @return string[] Updated list including Aelia cookies.
|
||||
*/
|
||||
public static function register_cookies( $cookies ) {
|
||||
return array_merge( $cookies, self::$_cookies );
|
||||
}
|
||||
|
||||
/**
|
||||
* Conditionally append Aelia cookies to the vary header set for WooCommerce pages.
|
||||
*
|
||||
* If the page is not a WooCommerce page, leave the list unchanged.
|
||||
* Otherwise, append Aelia's cookies so responses vary correctly.
|
||||
*
|
||||
* @since 1.0.13
|
||||
* @access public
|
||||
*
|
||||
* @param string[] $cookies Current list of vary cookies for the response.
|
||||
* @return string[] Potentially augmented list of vary cookies.
|
||||
*/
|
||||
public static function check_cookies( $cookies ) {
|
||||
// NOTE: is_cart and is_checkout are handled by WooCommerce itself.
|
||||
if ( ! function_exists( 'is_woocommerce' ) || ! is_woocommerce() ) {
|
||||
return $cookies;
|
||||
}
|
||||
|
||||
return array_merge( $cookies, self::$_cookies );
|
||||
}
|
||||
}
|
||||
88
wp-content/plugins/litespeed-cache/thirdparty/amp.cls.php
vendored
Normal file
88
wp-content/plugins/litespeed-cache/thirdparty/amp.cls.php
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with AMP plugin.
|
||||
*
|
||||
* @since 2.9.8.6
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache/thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
/**
|
||||
* Integration helpers for AMP-compatible behaviour.
|
||||
*
|
||||
* Disables optimization features on AMP endpoints provided by popular AMP
|
||||
* plugins to ensure valid AMP output (no injected JS/lazy/CSS async, etc).
|
||||
*/
|
||||
class AMP {
|
||||
|
||||
/**
|
||||
* Maybe mark current request as AMP and disable conflicting optimizations.
|
||||
*
|
||||
* @since 4.2
|
||||
*
|
||||
* @param string $amp_function Callback/function name that returns whether current request is AMP.
|
||||
* @return void
|
||||
*/
|
||||
private static function _maybe_amp( $amp_function ) {
|
||||
if ( is_admin() ) {
|
||||
return;
|
||||
}
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( ! isset( $_GET['amp'] ) && ( ! function_exists( $amp_function ) || ! $amp_function() ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
do_action( 'litespeed_debug', '[3rd] ❌ AMP disabled page optm/lazy' );
|
||||
|
||||
defined( 'LITESPEED_NO_PAGEOPTM' ) || define( 'LITESPEED_NO_PAGEOPTM', true );
|
||||
defined( 'LITESPEED_NO_LAZY' ) || define( 'LITESPEED_NO_LAZY', true );
|
||||
defined( 'LITESPEED_NO_OPTM' ) || define( 'LITESPEED_NO_OPTM', true );
|
||||
// defined( 'LITESPEED_GUEST' ) || define( 'LITESPEED_GUEST', false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ampforwp_is_amp_endpoint() from Accelerated Mobile Pages.
|
||||
*
|
||||
* @since 4.2
|
||||
* @return void
|
||||
*/
|
||||
public static function maybe_acc_mob_pages() {
|
||||
self::_maybe_amp( 'ampforwp_is_amp_endpoint' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Google AMP fix.
|
||||
*
|
||||
* @since 4.2.0.1
|
||||
* @return void
|
||||
*/
|
||||
public static function maybe_google_amp() {
|
||||
self::_maybe_amp( 'amp_is_request' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Preload hooks to detect AMP requests and turn off conflicting features.
|
||||
*
|
||||
* CSS async will affect AMP result and Lazyload injects JS libraries which
|
||||
* AMP does not allow. Ensure those are disabled early on AMP endpoints.
|
||||
*
|
||||
* @since 2.9.8.6
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function preload() {
|
||||
add_action( 'wp', __CLASS__ . '::maybe_acc_mob_pages' );
|
||||
add_action( 'wp', __CLASS__ . '::maybe_google_amp' );
|
||||
|
||||
// amp_is_request() from AMP.
|
||||
// self::maybe_amp( 'amp_is_request' );
|
||||
// add_filter( 'litespeed_can_optm', '__return_false' );
|
||||
// do_action( 'litespeed_conf_force', API::O_OPTM_CSS_ASYNC, false );
|
||||
// do_action( 'litespeed_conf_force', API::O_MEDIA_LAZY, false );
|
||||
// do_action( 'litespeed_conf_force', API::O_MEDIA_IFRAME_LAZY, false );
|
||||
}
|
||||
}
|
||||
44
wp-content/plugins/litespeed-cache/thirdparty/autoptimize.cls.php
vendored
Normal file
44
wp-content/plugins/litespeed-cache/thirdparty/autoptimize.cls.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the Autoptimize plugin.
|
||||
*
|
||||
* @since 1.0.12
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache/thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
/**
|
||||
* Integration for Autoptimize cache events.
|
||||
*/
|
||||
class Autoptimize {
|
||||
|
||||
/**
|
||||
* Detects if Autoptimize is active.
|
||||
*
|
||||
* @since 1.0.12
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if ( defined( 'AUTOPTIMIZE_PLUGIN_DIR' ) ) {
|
||||
add_action( 'litespeed_purge_finalize', __CLASS__ . '::purge' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purges LiteSpeed cache when Autoptimize's cache is purged.
|
||||
*
|
||||
* @since 1.0.12
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function purge() {
|
||||
if ( defined( 'AUTOPTIMIZE_PURGE' ) || has_action( 'shutdown', 'autoptimize_do_cachepurged_action', 11 ) ) {
|
||||
do_action( 'litespeed_purge_all', '3rd Autoptimize' );
|
||||
}
|
||||
}
|
||||
}
|
||||
45
wp-content/plugins/litespeed-cache/thirdparty/avada.cls.php
vendored
Normal file
45
wp-content/plugins/litespeed-cache/thirdparty/avada.cls.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the Avada plugin.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache/thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
/**
|
||||
* Integration for Avada cache flushing.
|
||||
*/
|
||||
class Avada {
|
||||
|
||||
/**
|
||||
* Detects if Avada is installed.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if ( ! defined( 'AVADA_VERSION' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action( 'update_option_avada_dynamic_css_posts', __CLASS__ . '::flush' );
|
||||
add_action( 'update_option_fusion_options', __CLASS__ . '::flush' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Purges the cache.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function flush() {
|
||||
do_action( 'litespeed_purge_all', '3rd avada' );
|
||||
}
|
||||
}
|
||||
97
wp-content/plugins/litespeed-cache/thirdparty/bbpress.cls.php
vendored
Normal file
97
wp-content/plugins/litespeed-cache/thirdparty/bbpress.cls.php
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the bbPress plugin.
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache/thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
use LiteSpeed\Router;
|
||||
|
||||
/**
|
||||
* Integration for bbPress cache handling and purging.
|
||||
*/
|
||||
class BBPress {
|
||||
|
||||
/**
|
||||
* Detect if bbPress is installed and if the page is a bbPress page.
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if ( function_exists( 'is_bbpress' ) ) {
|
||||
add_action( 'litespeed_api_purge_post', __CLASS__ . '::on_purge' ); // todo
|
||||
if ( apply_filters( 'litespeed_esi_status', false ) ) {
|
||||
// Don't consider private cache yet (will do if any feedback)
|
||||
add_action( 'litespeed_control_finalize', __CLASS__ . '::set_control' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This filter is used to let the cache know if a page is cacheable.
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function set_control() {
|
||||
if ( ! apply_filters( 'litespeed_control_cacheable', false ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set non ESI public
|
||||
if ( is_bbpress() && Router::is_logged_in() ) {
|
||||
do_action( 'litespeed_control_set_nocache', 'bbpress nocache due to loggedin' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* When a bbPress page is purged, need to purge the forums list and
|
||||
* any/all ancestor pages.
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @access public
|
||||
* @param int $post_id The post id of the page being purged.
|
||||
* @return void
|
||||
*/
|
||||
public static function on_purge( $post_id ) {
|
||||
if ( ! is_bbpress() ) {
|
||||
if ( ! function_exists( 'bbp_is_forum' ) || ! function_exists( 'bbp_is_topic' ) || ! function_exists( 'bbp_is_reply' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( ! bbp_is_forum( $post_id ) && ! bbp_is_topic( $post_id ) && ! bbp_is_reply( $post_id ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Need to purge base forums page, bbPress page was updated.
|
||||
do_action( 'litespeed_purge_posttype', bbp_get_forum_post_type() );
|
||||
$ancestors = get_post_ancestors( $post_id );
|
||||
|
||||
// If there are ancestors, need to purge them as well.
|
||||
if ( ! empty( $ancestors ) ) {
|
||||
foreach ( $ancestors as $ancestor ) {
|
||||
do_action( 'litespeed_purge_post', $ancestor );
|
||||
}
|
||||
}
|
||||
|
||||
global $wp_widget_factory;
|
||||
$replies_widget = $wp_widget_factory->get_widget_object( 'BBP_Replies_Widget' );
|
||||
if ( bbp_is_reply( $post_id ) && $replies_widget ) {
|
||||
do_action( 'litespeed_purge_widget', $replies_widget->id );
|
||||
}
|
||||
|
||||
$topic_widget = $wp_widget_factory->get_widget_object( 'BBP_Topics_Widget' );
|
||||
if ( bbp_is_topic( $post_id ) && $topic_widget ) {
|
||||
do_action( 'litespeed_purge_widget', $topic_widget->id );
|
||||
}
|
||||
}
|
||||
}
|
||||
58
wp-content/plugins/litespeed-cache/thirdparty/beaver-builder.cls.php
vendored
Normal file
58
wp-content/plugins/litespeed-cache/thirdparty/beaver-builder.cls.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the Beaver Builder plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache/thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
/**
|
||||
* Integration for Beaver Builder cache handling and purging.
|
||||
*/
|
||||
class Beaver_Builder {
|
||||
|
||||
/**
|
||||
* Detects if Beaver_Builder is active.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if ( ! defined( 'FL_BUILDER_VERSION' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge All hooks.
|
||||
*
|
||||
* @see beaver-builder/extensions/fi-builder-cache-helper/classes/class-fi-builder-cache-helper.php
|
||||
*/
|
||||
$actions = array(
|
||||
'fl_builder_cache_cleared',
|
||||
'fl_builder_after_save_layout',
|
||||
'fl_builder_after_save_user_template',
|
||||
'upgrader_process_complete',
|
||||
);
|
||||
|
||||
foreach ( $actions as $val ) {
|
||||
add_action( $val, __CLASS__ . '::purge' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purges the cache when Beaver_Builder's cache is purged.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function purge() {
|
||||
do_action( 'litespeed_purge_all', '3rd Beaver_Builder' );
|
||||
}
|
||||
}
|
||||
36
wp-content/plugins/litespeed-cache/thirdparty/caldera-forms.cls.php
vendored
Normal file
36
wp-content/plugins/litespeed-cache/thirdparty/caldera-forms.cls.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with Caldera Forms.
|
||||
*
|
||||
* @since 3.2.2
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache/thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
/**
|
||||
* Integration with Caldera Forms to ensure proper nonce handling for cached pages.
|
||||
*/
|
||||
class Caldera_Forms {
|
||||
|
||||
/**
|
||||
* Detects if Caldera Forms is active and registers nonces accordingly.
|
||||
*
|
||||
* Hooks the plugin's frontend nonce pattern into LiteSpeed so cached pages
|
||||
* still validate form submissions.
|
||||
*
|
||||
* @since 3.2.2
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if (!defined('CFCORE_VER')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// plugins/caldera-forms/classes/render/nonce.php -> class Caldera_Forms_Render_Nonce
|
||||
do_action('litespeed_nonce', 'caldera_forms_front_*');
|
||||
}
|
||||
}
|
||||
113
wp-content/plugins/litespeed-cache/thirdparty/divi-theme-builder.cls.php
vendored
Normal file
113
wp-content/plugins/litespeed-cache/thirdparty/divi-theme-builder.cls.php
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with DIVI Theme.
|
||||
*
|
||||
* Ensures Divi Builder edit/preview modes don't conflict with LiteSpeed Cache features,
|
||||
* and registers required nonces for Divi modules.
|
||||
*
|
||||
* @since 2.9.0
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache/thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
/**
|
||||
* Handles Divi Theme Builder compatibility.
|
||||
*/
|
||||
class Divi_Theme_Builder {
|
||||
|
||||
// private static $js_comment_box = false;
|
||||
|
||||
/**
|
||||
* If Divi front-end edit/preview mode is active, disable LSCWP features to avoid conflicts.
|
||||
*
|
||||
* Note: This reads query vars only to detect Divi edit states. Nonce verification
|
||||
* is not applicable here because no privileged action is performed.
|
||||
*
|
||||
* @since 2.9.7.2 #435538 #581740 #977284
|
||||
* @since 2.9.9.1 Added 'et_pb_preview' for loading image from library in Divi page edit
|
||||
* @return void
|
||||
*/
|
||||
public static function preload() {
|
||||
if (!function_exists('et_setup_theme')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sanitize incoming query params before use.
|
||||
$et_fb = isset($_GET['et_fb']) ? sanitize_text_field(wp_unslash($_GET['et_fb'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$et_pb_preview = isset($_GET['et_pb_preview']) ? sanitize_text_field(wp_unslash($_GET['et_pb_preview'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$p = isset($_GET['p']) ? absint(wp_unslash($_GET['p'])) : 0; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$preview = isset($_GET['preview']) ? sanitize_text_field(wp_unslash($_GET['preview'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
|
||||
if ( '' !== $et_fb || '' !== $et_pb_preview || ( $p && 'true' === $preview ) ) {
|
||||
do_action( 'litespeed_disable_all', 'divi edit mode' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Divi and register required integrations.
|
||||
*
|
||||
* - Allows the crawler to ignore Divi's first-visit "no-cache" for CCSS generation.
|
||||
* - Adds nonces used by Divi modules so cached pages still validate requests.
|
||||
*
|
||||
* @since 2.9.0
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if (!defined('ET_CORE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// As DIVI may set first visit to non-cacheable to generate CCSS,
|
||||
// instruct the crawler to ignore that flag.
|
||||
if (!defined('LITESPEED_CRAWLER_IGNORE_NONCACHEABLE')) {
|
||||
define('LITESPEED_CRAWLER_IGNORE_NONCACHEABLE', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add contact form to nonce.
|
||||
*
|
||||
* @since 2.9.7.1 #475461
|
||||
*/
|
||||
do_action('litespeed_nonce', 'et-pb-contact-form-submit');
|
||||
|
||||
/**
|
||||
* Subscribe module and A/B logging.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
do_action('litespeed_nonce', 'et_frontend_nonce');
|
||||
do_action('litespeed_nonce', 'et_ab_log_nonce');
|
||||
|
||||
/*
|
||||
// the comment box fix is for user using theme builder, ESI will load the wrong json string
|
||||
// As we disabled all for edit mode, this is no more needed
|
||||
add_action( 'et_fb_before_comments_template', 'Divi_Theme_Builder::js_comment_box_on' );
|
||||
add_action( 'et_fb_after_comments_template', 'Divi_Theme_Builder::js_comment_box_off' );
|
||||
add_filter( 'litespeed_esi_params-comment-form', 'Divi_Theme_Builder::esi_comment_add_slash' );// Note: this is changed in v2.9.8.1
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable comment box JS mode (legacy code - currently disabled).
|
||||
*
|
||||
public static function js_comment_box_on() {
|
||||
self::$js_comment_box = true;
|
||||
}
|
||||
|
||||
public static function js_comment_box_off() {
|
||||
self::$js_comment_box = false;
|
||||
}
|
||||
|
||||
public static function esi_comment_add_slash( $params ) {
|
||||
if ( self::$js_comment_box ) {
|
||||
$params['is_json'] = 1;
|
||||
$params['_ls_silence'] = 1;
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
*/
|
||||
}
|
||||
94
wp-content/plugins/litespeed-cache/thirdparty/elementor.cls.php
vendored
Normal file
94
wp-content/plugins/litespeed-cache/thirdparty/elementor.cls.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?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' );
|
||||
}
|
||||
}
|
||||
54
wp-content/plugins/litespeed-cache/thirdparty/entry.inc.php
vendored
Normal file
54
wp-content/plugins/litespeed-cache/thirdparty/entry.inc.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* The registry for Third Party Plugins Integration files.
|
||||
*
|
||||
* This file is only used to include the integration files/classes.
|
||||
* This works as an entry point for the initial add_action for the
|
||||
* detect function.
|
||||
*
|
||||
* It is not required to add all integration files here, this just provides
|
||||
* a common place for plugin authors to append their file to.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache/thirdparty
|
||||
*/
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
$third_cls = array(
|
||||
'Aelia_CurrencySwitcher',
|
||||
'Autoptimize',
|
||||
'Avada',
|
||||
'BBPress',
|
||||
'Beaver_Builder',
|
||||
'Caldera_Forms',
|
||||
'Divi_Theme_Builder',
|
||||
'Facetwp',
|
||||
'LiteSpeed_Check',
|
||||
'Theme_My_Login',
|
||||
'User_Switching',
|
||||
'WCML',
|
||||
'WooCommerce',
|
||||
'WC_PDF_Product_Vouchers',
|
||||
'Woo_Paypal',
|
||||
'Wp_Polls',
|
||||
'WP_PostRatings',
|
||||
'Wpdiscuz',
|
||||
'WPLister',
|
||||
'WPML',
|
||||
'WpTouch',
|
||||
'Yith_Wishlist',
|
||||
);
|
||||
|
||||
foreach ($third_cls as $cls) {
|
||||
add_action('litespeed_load_thirdparty', 'LiteSpeed\Thirdparty\\' . $cls . '::detect');
|
||||
}
|
||||
|
||||
// Preload needed for certain thirdparty
|
||||
add_action('litespeed_init', 'LiteSpeed\Thirdparty\Divi_Theme_Builder::preload');
|
||||
add_action('litespeed_init', 'LiteSpeed\Thirdparty\WooCommerce::preload');
|
||||
add_action('litespeed_init', 'LiteSpeed\Thirdparty\NextGenGallery::preload');
|
||||
add_action('litespeed_init', 'LiteSpeed\Thirdparty\AMP::preload');
|
||||
add_action('litespeed_init', 'LiteSpeed\Thirdparty\Elementor::preload');
|
||||
add_action('litespeed_init', 'LiteSpeed\Thirdparty\Gravity_Forms::preload');
|
||||
add_action('litespeed_init', 'LiteSpeed\Thirdparty\Perfmatters::preload');
|
||||
53
wp-content/plugins/litespeed-cache/thirdparty/facetwp.cls.php
vendored
Normal file
53
wp-content/plugins/litespeed-cache/thirdparty/facetwp.cls.php
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with FacetWP.
|
||||
*
|
||||
* @since 2.9.9
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache\Thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
/**
|
||||
* FacetWP compatibility hooks for LiteSpeed Cache.
|
||||
*/
|
||||
class Facetwp {
|
||||
|
||||
/**
|
||||
* Detect FacetWP context and adjust ESI params when FacetWP returns buffered HTML via the "wp" template.
|
||||
*
|
||||
* Note: We only *read* POST data here to detect an AJAX context; no privileged action is performed.
|
||||
* Data is unslashed and sanitized before comparison.
|
||||
*
|
||||
* @since 2.9.9
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if ( ! defined( 'FACETWP_VERSION' ) ) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* For Facetwp, if the template is "wp", return the buffered HTML
|
||||
* So marked as rest call to put is_json to ESI
|
||||
*/
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reading POST to detect FacetWP AJAX; no state change or sensitive action performed.
|
||||
if ( ! empty( $_POST['action'] ) && ! empty( $_POST['data'] ) && ! empty( $_POST['data']['template'] ) && 'wp' === $_POST['data']['template'] ) {
|
||||
add_filter( 'litespeed_esi_params', __CLASS__ . '::set_is_json' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark ESI response as JSON for FacetWP's "wp" template refreshes.
|
||||
*
|
||||
* @since 2.9.9
|
||||
* @param array $params Existing ESI params.
|
||||
* @return array Modified ESI params.
|
||||
*/
|
||||
public static function set_is_json( $params ) {
|
||||
$params['is_json'] = 1;
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
38
wp-content/plugins/litespeed-cache/thirdparty/gravity-forms.cls.php
vendored
Normal file
38
wp-content/plugins/litespeed-cache/thirdparty/gravity-forms.cls.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with Gravity Forms.
|
||||
*
|
||||
* @since 4.1.0
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache\Thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
/**
|
||||
* Gravity Forms compatibility hooks for LiteSpeed Cache.
|
||||
*/
|
||||
class Gravity_Forms {
|
||||
|
||||
/**
|
||||
* Check if GF is enabled and disable LSCWP on gf-download and gf-signature URI.
|
||||
*
|
||||
* Note: Query params are only read to detect special Gravity Forms endpoints.
|
||||
* Nonce verification is not applicable here as no privileged action is performed.
|
||||
*
|
||||
* @since 4.1.0 #900899 #827184
|
||||
* @return void
|
||||
*/
|
||||
public static function preload() {
|
||||
if (class_exists('GFCommon')) {
|
||||
$gf_download = isset($_GET['gf-download']) ? sanitize_text_field(wp_unslash($_GET['gf-download'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$gf_signature = isset($_GET['gf-signature']) ? sanitize_text_field(wp_unslash($_GET['gf-signature'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
|
||||
if ('' !== $gf_download || '' !== $gf_signature) {
|
||||
do_action('litespeed_disable_all', 'Stopped for Gravity Form');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
196
wp-content/plugins/litespeed-cache/thirdparty/litespeed-check.cls.php
vendored
Normal file
196
wp-content/plugins/litespeed-cache/thirdparty/litespeed-check.cls.php
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/**
|
||||
* Check if any plugins that could conflict with LiteSpeed Cache are active.
|
||||
*
|
||||
* @since 4.7
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache\Thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
/**
|
||||
* Detects incompatible plugins and displays admin notices if needed.
|
||||
*/
|
||||
class LiteSpeed_Check {
|
||||
|
||||
/**
|
||||
* Incompatible plugins list.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $_incompatible_plugins = array(
|
||||
// 'autoptimize/autoptimize.php',
|
||||
'breeze/breeze.php',
|
||||
'cache-enabler/cache-enabler.php',
|
||||
'cachify/cachify.php',
|
||||
'cloudflare/cloudflare.php',
|
||||
'comet-cache/comet-cache.php',
|
||||
'docket-cache/docket-cache.php',
|
||||
'fast-velocity-minify/fvm.php',
|
||||
'hummingbird-performance/wp-hummingbird.php',
|
||||
'nginx-cache/nginx-cache.php',
|
||||
'nitropack/main.php',
|
||||
'pantheon-advanced-page-cache/pantheon-advanced-page-cache.php',
|
||||
'powered-cache/powered-cache.php',
|
||||
'psn-pagespeed-ninja/pagespeedninja.php',
|
||||
'sg-cachepress/sg-cachepress.php',
|
||||
'simple-cache/simple-cache.php',
|
||||
// 'redis-cache/redis-cache.php',
|
||||
'w3-total-cache/w3-total-cache.php',
|
||||
'wp-cloudflare-page-cache/wp-cloudflare-page-cache.php',
|
||||
'wp-fastest-cache/wpFastestCache.php',
|
||||
'wp-meteor/wp-meteor.php',
|
||||
'wp-optimize/wp-optimize.php',
|
||||
'wp-performance-score-booster/wp-performance-score-booster.php',
|
||||
'wp-rocket/wp-rocket.php',
|
||||
'wp-super-cache/wp-cache.php',
|
||||
);
|
||||
|
||||
/**
|
||||
* Option key for storing notice state.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_option = 'thirdparty_litespeed_check';
|
||||
|
||||
/**
|
||||
* Admin notice HTML ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_msg_id = 'id="lscwp-incompatible-plugin-notice"';
|
||||
|
||||
/**
|
||||
* Detect incompatible plugins and hook into plugin lifecycle.
|
||||
*
|
||||
* @since 4.7
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if (!is_admin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for incompatible plugins when `litespeed-cache` is first activated.
|
||||
*/
|
||||
$plugin = basename(LSCWP_DIR) . '/litespeed-cache.php';
|
||||
register_deactivation_hook($plugin, function ( $network_wide ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
|
||||
\LiteSpeed\Admin_Display::delete_option(self::$_option);
|
||||
});
|
||||
if (!\LiteSpeed\Admin_Display::get_option(self::$_option)) {
|
||||
self::activated_plugin($plugin, null);
|
||||
\LiteSpeed\Admin_Display::add_option(self::$_option, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for incompatible plugins when any plugin is (de)activated.
|
||||
*/
|
||||
add_action('activated_plugin', __CLASS__ . '::activated_plugin', 10, 2);
|
||||
add_action('deactivated_plugin', __CLASS__ . '::deactivated_plugin', 10, 2);
|
||||
|
||||
if (class_exists('PagespeedNinja')) {
|
||||
\LiteSpeed\Admin_Display::error(
|
||||
'<div ' .
|
||||
self::$_msg_id .
|
||||
'>' .
|
||||
__('Please consider disabling the following detected plugins, as they may conflict with LiteSpeed Cache:', 'litespeed-cache') .
|
||||
'<p style="color: red; font-weight: 700;">' .
|
||||
'PageSpeed Ninja' .
|
||||
'</p>' .
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle plugin activation.
|
||||
*
|
||||
* @since 4.7
|
||||
* @param string $plugin Plugin path.
|
||||
* @param bool $network_wide Whether activated network-wide.
|
||||
* @return void
|
||||
*/
|
||||
public static function activated_plugin( $plugin, $network_wide ) {
|
||||
self::incompatible_plugin_notice($plugin, $network_wide, 'activated');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle plugin deactivation.
|
||||
*
|
||||
* @since 4.7
|
||||
* @param string $plugin Plugin path.
|
||||
* @param bool $network_wide Whether deactivated network-wide.
|
||||
* @return void
|
||||
*/
|
||||
public static function deactivated_plugin( $plugin, $network_wide ) {
|
||||
self::incompatible_plugin_notice($plugin, $network_wide, 'deactivated');
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect any incompatible plugins that are currently `active` and `valid`.
|
||||
* Show a notification if there are any.
|
||||
*
|
||||
* @since 4.7
|
||||
* @param string $plugin Plugin path.
|
||||
* @param bool $_network_wide Whether action is network-wide.
|
||||
* @param string $action Action type (activated|deactivated).
|
||||
* @return void
|
||||
*/
|
||||
public static function incompatible_plugin_notice( $plugin, $_network_wide, $action ) {
|
||||
self::update_messages();
|
||||
|
||||
$deactivated = 'deactivated' === $action ? array( $plugin ) : array();
|
||||
|
||||
$incompatible_plugins = array_map(function ( $plugin ) {
|
||||
return WP_PLUGIN_DIR . '/' . $plugin;
|
||||
}, array_diff(self::$_incompatible_plugins, $deactivated));
|
||||
|
||||
$active_incompatible_plugins = array_map(function ( $plugin ) {
|
||||
$plugin = get_plugin_data($plugin, false, true);
|
||||
return $plugin['Name'];
|
||||
}, array_intersect($incompatible_plugins, wp_get_active_and_valid_plugins()));
|
||||
|
||||
if (empty($active_incompatible_plugins)) {
|
||||
return;
|
||||
}
|
||||
|
||||
\LiteSpeed\Admin_Display::error(
|
||||
'<div ' .
|
||||
self::$_msg_id .
|
||||
'>' .
|
||||
__('Please consider disabling the following detected plugins, as they may conflict with LiteSpeed Cache:', 'litespeed-cache') .
|
||||
'<p style="color: red; font-weight: 700;">' .
|
||||
implode(', ', $active_incompatible_plugins) .
|
||||
'</p>' .
|
||||
'</div>',
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent multiple incompatible plugin notices.
|
||||
*
|
||||
* @since 4.7
|
||||
* @return void
|
||||
*/
|
||||
private static function update_messages() {
|
||||
$messages = \LiteSpeed\Admin_Display::get_option(\LiteSpeed\Admin_Display::DB_MSG_PIN, array());
|
||||
if (is_array($messages)) {
|
||||
foreach ($messages as $index => $message) {
|
||||
if (strpos($message, self::$_msg_id) !== false) {
|
||||
unset($messages[$index]);
|
||||
if (!$messages) {
|
||||
$messages = -1;
|
||||
}
|
||||
\LiteSpeed\Admin_Display::update_option(\LiteSpeed\Admin_Display::DB_MSG_PIN, $messages);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
225
wp-content/plugins/litespeed-cache/thirdparty/nextgengallery.cls.php
vendored
Normal file
225
wp-content/plugins/litespeed-cache/thirdparty/nextgengallery.cls.php
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the NextGen Gallery plugin.
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache\Thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
/**
|
||||
* Provides LiteSpeed Cache compatibility for NextGen Gallery.
|
||||
*/
|
||||
class NextGenGallery {
|
||||
|
||||
const CACHETAG_ALBUMS = 'NGG_A.';
|
||||
const CACHETAG_GALLERIES = 'NGG_G.';
|
||||
const CACHETAG_TAGS = 'NGG_T.';
|
||||
|
||||
/**
|
||||
* Hook NextGen Gallery events for purging cache.
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @return void
|
||||
*/
|
||||
public static function preload() {
|
||||
add_action('ngg_added_new_image', __CLASS__ . '::add_image');
|
||||
add_action('ngg_ajax_image_save', __CLASS__ . '::update_image');
|
||||
add_action('ngg_delete_picture', __CLASS__ . '::delete_image');
|
||||
add_action('ngg_moved_images', __CLASS__ . '::move_image', 10, 3);
|
||||
add_action('ngg_copied_images', __CLASS__ . '::copy_image', 10, 3);
|
||||
add_action('ngg_generated_image', __CLASS__ . '::gen_image');
|
||||
add_action('ngg_recovered_image', __CLASS__ . '::gen_image');
|
||||
|
||||
add_action('ngg_gallery_sort', __CLASS__ . '::update_gallery');
|
||||
add_action('ngg_delete_gallery', __CLASS__ . '::update_gallery');
|
||||
|
||||
add_action('ngg_update_album', __CLASS__ . '::update_album');
|
||||
add_action('ngg_delete_album', __CLASS__ . '::update_album');
|
||||
|
||||
add_filter('ngg_displayed_gallery_cache_params', __CLASS__ . '::add_container');
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge cache when an image is added.
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @param object $image The image object added.
|
||||
* @return void
|
||||
*/
|
||||
public static function add_image( $image ) {
|
||||
if (!$image || !method_exists($image, 'get_gallery')) {
|
||||
return;
|
||||
}
|
||||
$gallery = $image->get_gallery();
|
||||
if ($gallery && $gallery->pageid) {
|
||||
do_action('litespeed_purge', self::CACHETAG_GALLERIES . $gallery->pageid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge cache when an image is updated.
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @return void
|
||||
*/
|
||||
public static function update_image() {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( isset( $_REQUEST['gallery_id'] ) ) {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
do_action( 'litespeed_purge', self::CACHETAG_GALLERIES . sanitize_key( wp_unslash( $_REQUEST['gallery_id'] ) ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
||||
if ( isset( $_POST['task_list'] ) ) {
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
|
||||
$task_list = str_replace( '\\', '', wp_unslash( $_POST['task_list'] ) );
|
||||
$task_list = json_decode( $task_list, true );
|
||||
|
||||
if ( ! empty( $task_list[0]['query']['id'] ) ) {
|
||||
do_action( 'litespeed_purge', self::CACHETAG_GALLERIES . sanitize_key( $task_list[0]['query']['id'] ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
||||
if ( isset( $_POST['id'] ) ) {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
||||
$id = (int) $_POST['id'];
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
||||
} elseif ( isset( $_POST['image'] ) ) {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
||||
$id = (int) $_POST['image'];
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
} elseif ( isset( $_GET['pid'] ) ) {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$id = (int) $_GET['pid'];
|
||||
} else {
|
||||
error_log( 'LiteSpeed_Cache hit ngg_ajax_image_save with no post image id.' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
|
||||
return;
|
||||
}
|
||||
$image = \C_Image_Mapper::get_instance()->find($id);
|
||||
if ($image) {
|
||||
do_action('litespeed_purge', self::CACHETAG_GALLERIES . $image->galleryid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge cache when an image is deleted.
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @return void
|
||||
*/
|
||||
public static function delete_image() {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( isset( $_GET['gid'] ) ) {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
do_action( 'litespeed_purge', self::CACHETAG_GALLERIES . sanitize_key( wp_unslash( $_GET['gid'] ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge cache when an image is moved.
|
||||
*
|
||||
* @since 1.0.8
|
||||
* @param array $images Unused.
|
||||
* @param array $old_gallery_ids Source gallery IDs.
|
||||
* @param int $new_gallery_id Destination gallery ID.
|
||||
* @return void
|
||||
*/
|
||||
public static function move_image( $images, $old_gallery_ids, $new_gallery_id ) {
|
||||
foreach ($old_gallery_ids as $gid) {
|
||||
do_action('litespeed_purge', self::CACHETAG_GALLERIES . $gid);
|
||||
}
|
||||
do_action('litespeed_purge', self::CACHETAG_GALLERIES . $new_gallery_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge cache when an image is copied.
|
||||
*
|
||||
* @since 1.0.8
|
||||
* @param array $image_pid_map Unused.
|
||||
* @param array $old_gallery_ids Unused.
|
||||
* @param int $new_gallery_id Destination gallery ID.
|
||||
* @return void
|
||||
*/
|
||||
public static function copy_image( $image_pid_map, $old_gallery_ids, $new_gallery_id ) {
|
||||
do_action('litespeed_purge', self::CACHETAG_GALLERIES . $new_gallery_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge cache when an image is regenerated or recovered.
|
||||
*
|
||||
* @since 1.0.8
|
||||
* @param object $image The regenerated image object.
|
||||
* @return void
|
||||
*/
|
||||
public static function gen_image( $image ) {
|
||||
do_action('litespeed_purge', self::CACHETAG_GALLERIES . $image->galleryid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge cache when a gallery is updated.
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @param int|object $gid Gallery ID or object with gid.
|
||||
* @return void
|
||||
*/
|
||||
public static function update_gallery( $gid ) {
|
||||
if (is_object($gid) && !empty($gid->gid)) {
|
||||
$gid = $gid->gid;
|
||||
}
|
||||
do_action('litespeed_purge', self::CACHETAG_GALLERIES . $gid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge cache when an album is updated.
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @param int $aid Album ID.
|
||||
* @return void
|
||||
*/
|
||||
public static function update_album( $aid ) {
|
||||
do_action('litespeed_purge', self::CACHETAG_ALBUMS . $aid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag gallery/album/tag content during rendering.
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @param object $render_parms Render parameters.
|
||||
* @return mixed Null if $render_parms is null, otherwise same input.
|
||||
*/
|
||||
public static function add_container( $render_parms ) {
|
||||
if (is_null($render_parms)) {
|
||||
return null;
|
||||
}
|
||||
$src = $render_parms[0]->source;
|
||||
$container_ids = $render_parms[0]->container_ids;
|
||||
|
||||
switch ($src) {
|
||||
case 'albums':
|
||||
$tag = self::CACHETAG_ALBUMS;
|
||||
break;
|
||||
case 'galleries':
|
||||
$tag = self::CACHETAG_GALLERIES;
|
||||
break;
|
||||
case 'tags':
|
||||
$tag = self::CACHETAG_TAGS;
|
||||
break;
|
||||
default:
|
||||
return $render_parms;
|
||||
}
|
||||
|
||||
foreach ($container_ids as $id) {
|
||||
do_action('litespeed_tag_add', $tag . $id);
|
||||
}
|
||||
|
||||
return $render_parms;
|
||||
}
|
||||
}
|
||||
51
wp-content/plugins/litespeed-cache/thirdparty/perfmatters.cls.php
vendored
Normal file
51
wp-content/plugins/litespeed-cache/thirdparty/perfmatters.cls.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the Perfmatters plugin.
|
||||
*
|
||||
* @since 4.4.5
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache\Thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
/**
|
||||
* Provides compatibility for the Perfmatters plugin.
|
||||
*/
|
||||
class Perfmatters {
|
||||
|
||||
/**
|
||||
* Preload Perfmatters integration.
|
||||
*
|
||||
* @since 4.4.5
|
||||
* @return void
|
||||
*/
|
||||
public static function preload() {
|
||||
if (!defined('PERFMATTERS_VERSION')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_admin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (has_action('shutdown', 'perfmatters_script_manager') !== false) {
|
||||
add_action('init', __CLASS__ . '::disable_litespeed_esi', 4);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable LiteSpeed ESI when Perfmatters Script Manager is active.
|
||||
*
|
||||
* @since 4.4.5
|
||||
* @return void
|
||||
*/
|
||||
public static function disable_litespeed_esi() {
|
||||
if (!defined('LITESPEED_ESI_OFF')) {
|
||||
define('LITESPEED_ESI_OFF', true);
|
||||
}
|
||||
do_action('litespeed_debug', 'Disable ESI due to Perfmatters script manager');
|
||||
}
|
||||
}
|
||||
49
wp-content/plugins/litespeed-cache/thirdparty/theme-my-login.cls.php
vendored
Normal file
49
wp-content/plugins/litespeed-cache/thirdparty/theme-my-login.cls.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the Theme My Login plugin.
|
||||
*
|
||||
* @since 1.0.15
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache\Thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
/**
|
||||
* Provides compatibility for the Theme My Login plugin.
|
||||
*/
|
||||
class Theme_My_Login {
|
||||
|
||||
/**
|
||||
* Detects if Better Theme My Login is active.
|
||||
*
|
||||
* @since 1.0.15
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if (defined('THEME_MY_LOGIN_PATH')) {
|
||||
add_action('litespeed_control_finalize', __CLASS__ . '::set_control');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This filter is used to let the cache know if a page is cacheable.
|
||||
*
|
||||
* @since 1.0.15
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function set_control() {
|
||||
if (!apply_filters('litespeed_control_cacheable', false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if this page is TML page or not.
|
||||
if (class_exists('Theme_My_Login') && \Theme_My_Login::is_tml_page()) {
|
||||
do_action('litespeed_control_set_nocache', 'Theme My Login');
|
||||
}
|
||||
}
|
||||
}
|
||||
43
wp-content/plugins/litespeed-cache/thirdparty/user-switching.cls.php
vendored
Normal file
43
wp-content/plugins/litespeed-cache/thirdparty/user-switching.cls.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with User Switching.
|
||||
*
|
||||
* @since 3.0
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache\Thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
/**
|
||||
* Provides compatibility for the User Switching plugin.
|
||||
*/
|
||||
class User_Switching {
|
||||
|
||||
/**
|
||||
* Detects if User Switching is active and registers required nonces.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if (!class_exists('user_switching')) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register switch back URL nonce.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
if (function_exists('current_user_switched')) {
|
||||
$old_user = current_user_switched();
|
||||
if ($old_user) {
|
||||
do_action('litespeed_nonce', 'switch_to_olduser_' . $old_user->ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
40
wp-content/plugins/litespeed-cache/thirdparty/wc-pdf-product-vouchers.cls.php
vendored
Normal file
40
wp-content/plugins/litespeed-cache/thirdparty/wc-pdf-product-vouchers.cls.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with WooCommerce PDF Product Vouchers.
|
||||
*
|
||||
* @since 5.1.0
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache\Thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
/**
|
||||
* Provides compatibility for WooCommerce PDF Product Vouchers.
|
||||
*/
|
||||
class WC_PDF_Product_Vouchers {
|
||||
|
||||
/**
|
||||
* Disable caching for generated vouchers.
|
||||
*
|
||||
* @since 5.1.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if (!class_exists('\WC_PDF_Product_Vouchers_Loader')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$is_voucher = !empty($_GET['post_type']) && 'wc_voucher' === sanitize_text_field(wp_unslash($_GET['post_type']));
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$has_key = !empty($_GET['voucher_key']) || !empty($_GET['key']);
|
||||
|
||||
if ($is_voucher && $has_key) {
|
||||
do_action('litespeed_control_set_nocache', '3rd WC PDF Product Voucher');
|
||||
}
|
||||
}
|
||||
}
|
||||
83
wp-content/plugins/litespeed-cache/thirdparty/wcml.cls.php
vendored
Normal file
83
wp-content/plugins/litespeed-cache/thirdparty/wcml.cls.php
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with WCML.
|
||||
*
|
||||
* @since 3.0
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache\Thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
/**
|
||||
* Provides compatibility with WCML for currency handling.
|
||||
*/
|
||||
class WCML {
|
||||
|
||||
/**
|
||||
* Holds the current WCML currency.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_currency = '';
|
||||
|
||||
/**
|
||||
* Detect if WCML is active and register hooks.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if (!defined('WCML_VERSION')) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter('wcml_client_currency', __CLASS__ . '::apply_client_currency');
|
||||
add_action('wcml_set_client_currency', __CLASS__ . '::set_client_currency');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the client currency and triggers vary updates.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access public
|
||||
* @param string $currency The currency code to set.
|
||||
* @return void
|
||||
*/
|
||||
public static function set_client_currency( $currency ) {
|
||||
self::apply_client_currency($currency);
|
||||
do_action('litespeed_vary_ajax_force');
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the client currency and adjusts vary accordingly.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access public
|
||||
* @param string $currency The currency code to apply.
|
||||
* @return string The applied currency.
|
||||
*/
|
||||
public static function apply_client_currency( $currency ) {
|
||||
self::$_currency = $currency;
|
||||
add_filter('litespeed_vary', __CLASS__ . '::apply_vary');
|
||||
|
||||
return $currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends WCML currency to vary list.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access public
|
||||
* @param array $vary_list The existing vary list.
|
||||
* @return array The updated vary list including WCML currency.
|
||||
*/
|
||||
public static function apply_vary( $vary_list ) {
|
||||
$vary_list['wcml_currency'] = self::$_currency;
|
||||
|
||||
return $vary_list;
|
||||
}
|
||||
}
|
||||
37
wp-content/plugins/litespeed-cache/thirdparty/woo-paypal.cls.php
vendored
Normal file
37
wp-content/plugins/litespeed-cache/thirdparty/woo-paypal.cls.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with WooCommerce PayPal Checkout Gateway.
|
||||
*
|
||||
* @ref https://wordpress.org/plugins/woocommerce-gateway-paypal-express-checkout/
|
||||
*
|
||||
* @since 3.0
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache\Thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
/**
|
||||
* Provides compatibility with WooCommerce PayPal Checkout.
|
||||
*/
|
||||
class Woo_Paypal {
|
||||
|
||||
/**
|
||||
* Detect if WooCommerce PayPal Checkout is active and register nonces.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if (!defined('WC_GATEWAY_PPEC_VERSION')) {
|
||||
return;
|
||||
}
|
||||
|
||||
do_action('litespeed_nonce', '_wc_ppec_update_shipping_costs_nonce private');
|
||||
do_action('litespeed_nonce', '_wc_ppec_start_checkout_nonce private');
|
||||
do_action('litespeed_nonce', '_wc_ppec_generate_cart_nonce private');
|
||||
}
|
||||
}
|
||||
1017
wp-content/plugins/litespeed-cache/thirdparty/woocommerce.cls.php
vendored
Normal file
1017
wp-content/plugins/litespeed-cache/thirdparty/woocommerce.cls.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
97
wp-content/plugins/litespeed-cache/thirdparty/woocommerce.content.tpl.php
vendored
Normal file
97
wp-content/plugins/litespeed-cache/thirdparty/woocommerce.content.tpl.php
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache – WooCommerce settings template.
|
||||
*
|
||||
* Renders the WooCommerce integration settings within the LiteSpeed Cache admin.
|
||||
*
|
||||
* @package LiteSpeed\Thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
use LiteSpeed\Doc;
|
||||
?>
|
||||
<div data-litespeed-layout="woocommerce">
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'WooCommerce Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#woocommerce-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<h4><?php esc_html_e( 'NOTICE:', 'litespeed-cache' ); ?></h4>
|
||||
<p><?php esc_html_e( 'After verifying that the cache works in general, please test the cart.', 'litespeed-cache' ); ?></p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: link attributes */
|
||||
esc_html__( 'To test the cart, visit the %sFAQ%s.', 'litespeed-cache' ),
|
||||
'<a href="https://docs.litespeedtech.com/lscache/lscwp/installation/#non-cacheable-pages" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p><?php esc_html_e( 'By default, the My Account, Checkout, and Cart pages are automatically excluded from caching. Misconfiguration of page associations in WooCommerce settings may cause some pages to be erroneously excluded.', 'litespeed-cache' ); ?></p>
|
||||
</div>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<?php $setting_id = self::O_UPDATE_INTERVAL; ?>
|
||||
<?php esc_html_e( 'Product Update Interval', 'litespeed-cache' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
$options = [
|
||||
self::O_PQS_CS => esc_html__( 'Purge product on changes to the quantity or stock status.', 'litespeed-cache' ) . ' ' . esc_html__( 'Purge categories only when stock status changes.', 'litespeed-cache' ),
|
||||
self::O_PS_CS => esc_html__( 'Purge product and categories only when the stock status changes.', 'litespeed-cache' ),
|
||||
self::O_PS_CN => esc_html__( 'Purge product only when the stock status changes.', 'litespeed-cache' ) . ' ' . esc_html__( 'Do not purge categories on changes to the quantity or stock status.', 'litespeed-cache' ),
|
||||
self::O_PQS_CQS => esc_html__( 'Always purge both product and categories on changes to the quantity or stock status.', 'litespeed-cache' ),
|
||||
];
|
||||
$conf = (int) apply_filters( 'litespeed_conf', $setting_id );
|
||||
do_action( 'litespeed_setting_enroll', $setting_id );
|
||||
foreach ( $options as $k => $v ) :
|
||||
$input_id = 'conf_' . $setting_id . '_' . $k;
|
||||
?>
|
||||
<div class="litespeed-radio-row">
|
||||
<input
|
||||
type="radio"
|
||||
autocomplete="off"
|
||||
name="<?php echo esc_attr( (string) $setting_id ); ?>"
|
||||
id="<?php echo esc_attr( $input_id ); ?>"
|
||||
value="<?php echo esc_attr( (string) $k ); ?>"
|
||||
<?php echo checked( $conf, (int) $k, false ); ?>
|
||||
/>
|
||||
<label for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $v ); ?></label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Determines how changes in product quantity and product stock status affect product pages and their associated category pages.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $setting_id = self::O_CART_VARY; ?>
|
||||
<?php esc_html_e( 'Vary for Mini Cart', 'litespeed-cache' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
$conf = (int) apply_filters( 'litespeed_conf', $setting_id );
|
||||
$this->cls( 'Admin_Display' )->build_switch( $setting_id );
|
||||
?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Generate a separate vary cache copy for the mini cart when the cart is not empty.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'If your theme does not use JS to update the mini cart, you must enable this option to display the correct cart contents.', 'litespeed-cache' ); ?>
|
||||
<br /><?php Doc::notice_htaccess(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
11
wp-content/plugins/litespeed-cache/thirdparty/woocommerce.tab.tpl.php
vendored
Normal file
11
wp-content/plugins/litespeed-cache/thirdparty/woocommerce.tab.tpl.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* WooCommerce tab template for LiteSpeed Cache plugin.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
*/
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<a class='litespeed-tab nav-tab' href='#woocommerce' data-litespeed-tab='woocommerce'>WooCommerce</a>
|
||||
40
wp-content/plugins/litespeed-cache/thirdparty/wp-polls.cls.php
vendored
Normal file
40
wp-content/plugins/litespeed-cache/thirdparty/wp-polls.cls.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the WP-Polls plugin.
|
||||
*
|
||||
* Ensures WP-Polls pages are marked as non-cacheable in LiteSpeed Cache.
|
||||
*
|
||||
* @since 1.0.7
|
||||
* @package LiteSpeed
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
/**
|
||||
* WP-Polls integration.
|
||||
*/
|
||||
class Wp_Polls {
|
||||
|
||||
/**
|
||||
* Register WP-Polls display filters to mark output as non-cacheable.
|
||||
*
|
||||
* @since 1.0.7
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
add_filter( 'wp_polls_display_pollvote', __CLASS__ . '::set_control' );
|
||||
add_filter( 'wp_polls_display_pollresult', __CLASS__ . '::set_control' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark WP-Polls output as non-cacheable.
|
||||
*
|
||||
* @since 1.0.7
|
||||
* @return void
|
||||
*/
|
||||
public static function set_control() {
|
||||
do_action( 'litespeed_control_set_nocache', 'wp polls' );
|
||||
}
|
||||
}
|
||||
44
wp-content/plugins/litespeed-cache/thirdparty/wp-postratings.cls.php
vendored
Normal file
44
wp-content/plugins/litespeed-cache/thirdparty/wp-postratings.cls.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the WP-PostRatings plugin.
|
||||
*
|
||||
* Hooks into rating events to purge related caches.
|
||||
*
|
||||
* @since 1.1.1
|
||||
* @package LiteSpeed
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit();
|
||||
|
||||
/**
|
||||
* WP-PostRatings integration for LiteSpeed Cache.
|
||||
*/
|
||||
class WP_PostRatings {
|
||||
|
||||
/**
|
||||
* Detects if the WP-PostRatings plugin is active and registers hooks.
|
||||
*
|
||||
* @since 1.1.1
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if ( defined( 'WP_POSTRATINGS_VERSION' ) ) {
|
||||
add_action( 'rate_post', __CLASS__ . '::flush', 10, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge the cache for a rated post.
|
||||
*
|
||||
* @since 1.1.1
|
||||
*
|
||||
* @param int $uid User ID who rated.
|
||||
* @param int $post_id The rated post ID.
|
||||
* @return void
|
||||
*/
|
||||
public static function flush( $uid, $post_id ) {
|
||||
do_action( 'litespeed_purge_post', (int) $post_id );
|
||||
}
|
||||
}
|
||||
61
wp-content/plugins/litespeed-cache/thirdparty/wpdiscuz.cls.php
vendored
Normal file
61
wp-content/plugins/litespeed-cache/thirdparty/wpdiscuz.cls.php
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with Wpdiscuz.
|
||||
*
|
||||
* @since 2.9.5
|
||||
* @package LiteSpeed
|
||||
* @subpackage LiteSpeed_Cache/thirdparty
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit();
|
||||
|
||||
use LiteSpeed\API;
|
||||
|
||||
/**
|
||||
* Wpdiscuz integration for LiteSpeed Cache.
|
||||
*
|
||||
* Appends commenter vary and disables pending-check when a commenter is detected.
|
||||
*/
|
||||
class Wpdiscuz {
|
||||
|
||||
/**
|
||||
* Registers hooks when Wpdiscuz is active.
|
||||
*
|
||||
* @since 2.9.5
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if ( ! defined( 'WPDISCUZ_DS' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::check_commenter();
|
||||
add_action( 'wpdiscuz_add_comment', __CLASS__ . '::add_comment' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the commenter vary on new Wpdiscuz comments.
|
||||
*
|
||||
* @since 2.9.5
|
||||
* @return void
|
||||
*/
|
||||
public static function add_comment() {
|
||||
API::vary_append_commenter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks current commenter and disables pending vary check if a name exists.
|
||||
*
|
||||
* @since 2.9.5
|
||||
* @return void
|
||||
*/
|
||||
public static function check_commenter() {
|
||||
$commentor = wp_get_current_commenter();
|
||||
|
||||
if (strlen($commentor['comment_author']) > 0) {
|
||||
add_filter( 'litespeed_vary_check_commenter_pending', '__return_false' );
|
||||
}
|
||||
}
|
||||
}
|
||||
34
wp-content/plugins/litespeed-cache/thirdparty/wplister.cls.php
vendored
Normal file
34
wp-content/plugins/litespeed-cache/thirdparty/wplister.cls.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the WPLister plugin.
|
||||
*
|
||||
* Hooks WPLister inventory status updates to LiteSpeed WooCommerce backend purging.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* @package LiteSpeed
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit();
|
||||
|
||||
/**
|
||||
* WPLister integration for LiteSpeed Cache.
|
||||
*/
|
||||
class WPLister {
|
||||
|
||||
/**
|
||||
* Detects if WooCommerce and WPLister are installed and registers hooks.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if ( defined( 'WOOCOMMERCE_VERSION' ) && defined( 'WPLISTER_VERSION' ) ) {
|
||||
// User reported this will sync correctly.
|
||||
add_action( 'wplister_revise_inventory_status', [ WooCommerce::cls(), 'backend_purge' ] );
|
||||
// Added as a safety measure for WPLister Pro only.
|
||||
add_action( 'wplister_inventory_status_changed', [ WooCommerce::cls(), 'backend_purge' ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
50
wp-content/plugins/litespeed-cache/thirdparty/wpml.cls.php
vendored
Normal file
50
wp-content/plugins/litespeed-cache/thirdparty/wpml.cls.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with WPML.
|
||||
*
|
||||
* Adds WPML language domains to LiteSpeed's list of internal domains.
|
||||
*
|
||||
* @since 2.9.4
|
||||
* @package LiteSpeed
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit();
|
||||
|
||||
/**
|
||||
* WPML integration for LiteSpeed Cache.
|
||||
*/
|
||||
class WPML {
|
||||
|
||||
/**
|
||||
* Registers filters when WPML is active.
|
||||
*
|
||||
* @since 2.9.4
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if ( ! defined( 'WPML_PLUGIN_BASENAME' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter( 'litespeed_internal_domains', __CLASS__ . '::append_domains' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Take language domains as internal domains.
|
||||
*
|
||||
* @since 2.9.4
|
||||
*
|
||||
* @param array $domains Existing internal domains.
|
||||
* @return array Modified list of internal domains including WPML language domains.
|
||||
*/
|
||||
public static function append_domains( $domains ) {
|
||||
$wpml_domains = apply_filters( 'wpml_setting', false, 'language_domains' );
|
||||
if ( $wpml_domains ) {
|
||||
$domains = array_merge( $domains, array_values( $wpml_domains ) );
|
||||
}
|
||||
|
||||
return $domains;
|
||||
}
|
||||
}
|
||||
45
wp-content/plugins/litespeed-cache/thirdparty/wptouch.cls.php
vendored
Normal file
45
wp-content/plugins/litespeed-cache/thirdparty/wptouch.cls.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the WPTouch Mobile plugin.
|
||||
*
|
||||
* Marks requests from mobile devices via WPTouch as mobile in LiteSpeed Cache.
|
||||
*
|
||||
* @since 1.0.7
|
||||
* @package LiteSpeed
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit();
|
||||
|
||||
/**
|
||||
* WPTouch integration for LiteSpeed Cache.
|
||||
*/
|
||||
class WpTouch {
|
||||
|
||||
/**
|
||||
* Detects if WPTouch is installed.
|
||||
*
|
||||
* @since 1.0.7
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
global $wptouch_pro;
|
||||
if ( isset( $wptouch_pro ) ) {
|
||||
add_action( 'litespeed_control_finalize', __CLASS__ . '::set_control' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the device is mobile. If so, set mobile.
|
||||
*
|
||||
* @since 1.0.7
|
||||
* @return void
|
||||
*/
|
||||
public static function set_control() {
|
||||
global $wptouch_pro;
|
||||
if ( ! empty( $wptouch_pro->is_mobile_device ) ) {
|
||||
add_filter( 'litespeed_is_mobile', '__return_true' );
|
||||
}
|
||||
}
|
||||
}
|
||||
185
wp-content/plugins/litespeed-cache/thirdparty/yith-wishlist.cls.php
vendored
Normal file
185
wp-content/plugins/litespeed-cache/thirdparty/yith-wishlist.cls.php
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
/**
|
||||
* The Third Party integration with the YITH WooCommerce Wishlist plugin.
|
||||
*
|
||||
* Hooks YITH Wishlist UI into LiteSpeed ESI and purges appropriately.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* @package LiteSpeed
|
||||
*/
|
||||
|
||||
namespace LiteSpeed\Thirdparty;
|
||||
|
||||
defined( 'WPINC' ) || exit();
|
||||
|
||||
use LiteSpeed\Tag;
|
||||
use LiteSpeed\Conf;
|
||||
use LiteSpeed\Base;
|
||||
|
||||
/**
|
||||
* YITH WooCommerce Wishlist integration for LiteSpeed Cache.
|
||||
*/
|
||||
class Yith_Wishlist {
|
||||
|
||||
const ESI_PARAM_POSTID = 'yith_pid';
|
||||
|
||||
/**
|
||||
* Current product ID captured for ESI rendering.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private static $_post_id;
|
||||
|
||||
/**
|
||||
* Detects if YITH WooCommerce Wishlist and WooCommerce are installed.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* @return void
|
||||
*/
|
||||
public static function detect() {
|
||||
if ( ! defined( 'WOOCOMMERCE_VERSION' ) || ! defined( 'YITH_WCWL' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( apply_filters( 'litespeed_esi_status', false ) ) {
|
||||
add_action( 'litespeed_tpl_normal', __CLASS__ . '::is_not_esi' );
|
||||
add_action( 'litespeed_esi_load-yith_wcwl_add', __CLASS__ . '::load_add_to_wishlist' );
|
||||
add_filter( 'litespeed_esi_inline-yith_wcwl_add', __CLASS__ . '::inline_add_to_wishlist', 20, 2 );
|
||||
|
||||
// Hook to add/delete wishlist.
|
||||
add_action( 'yith_wcwl_added_to_wishlist', __CLASS__ . '::purge' );
|
||||
add_action( 'yith_wcwl_removed_from_wishlist', __CLASS__ . '::purge' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge ESI YITH cache when add/remove items.
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @return void
|
||||
*/
|
||||
public static function purge() {
|
||||
do_action( 'litespeed_purge_esi', 'yith_wcwl_add' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Hooked to the litespeed_is_not_esi_template action.
|
||||
*
|
||||
* If the request is not an ESI request, hook to the add to wishlist button
|
||||
* filter to replace it as an ESI block.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* @return void
|
||||
*/
|
||||
public static function is_not_esi() {
|
||||
add_filter( 'yith_wcwl_add_to_wishlist_params', __CLASS__ . '::add_to_wishlist_params', 999, 2 );
|
||||
add_filter( 'yith_wcwl_add_to_wishlisth_button_html', __CLASS__ . '::sub_add_to_wishlist', 999 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the post id for later shortcode usage.
|
||||
*
|
||||
* @since 3.4.1
|
||||
*
|
||||
* @param array $defaults Default parameters provided by YITH.
|
||||
* @param array $atts Shortcode attributes for add-to-wishlist.
|
||||
* @return array Unmodified defaults.
|
||||
*/
|
||||
public static function add_to_wishlist_params( $defaults, $atts ) {
|
||||
self::$_post_id = ! empty( $atts['product_id'] ) ? (int) $atts['product_id'] : (int) $defaults['product_id'];
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the native button HTML with an ESI block.
|
||||
*
|
||||
* The add to wishlist button displays a different output when the item is already
|
||||
* in the wishlist/cart. For this reason, the button must be an ESI block.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*
|
||||
* @param string $template Original button HTML.
|
||||
* @return string ESI URL placeholder for rendering.
|
||||
*/
|
||||
public static function sub_add_to_wishlist( $template ) {
|
||||
$params = [
|
||||
self::ESI_PARAM_POSTID => self::$_post_id,
|
||||
];
|
||||
|
||||
$inline_tags = [ '', rtrim( Tag::TYPE_ESI, '.' ), Tag::TYPE_ESI . 'yith_wcwl_add' ];
|
||||
$inline_tags = implode(
|
||||
',',
|
||||
array_map(
|
||||
function ( $val ) {
|
||||
return 'public:' . LSWCP_TAG_PREFIX . '_' . $val;
|
||||
},
|
||||
$inline_tags
|
||||
)
|
||||
);
|
||||
$inline_tags .= ',' . LSWCP_TAG_PREFIX . '_tag_priv';
|
||||
|
||||
do_action( 'litespeed_esi_combine', 'yith_wcwl_add' );
|
||||
|
||||
$inline_params = [
|
||||
'val' => $template,
|
||||
'tag' => $inline_tags,
|
||||
'control' => 'private,no-vary,max-age=' . Conf::cls()->conf( Base::O_CACHE_TTL_PRIV ),
|
||||
];
|
||||
|
||||
return apply_filters( 'litespeed_esi_url', 'yith_wcwl_add', 'YITH ADD TO WISHLIST', $params, 'private,no-vary', false, false, false, $inline_params );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the add to wishlist button HTML for ESI output.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*
|
||||
* @param array $params ESI parameters, expects product id under ESI_PARAM_POSTID.
|
||||
* @return void
|
||||
*/
|
||||
public static function load_add_to_wishlist( $params ) {
|
||||
$pid = isset( $params[ self::ESI_PARAM_POSTID ] ) ? (int) $params[ self::ESI_PARAM_POSTID ] : 0;
|
||||
|
||||
// Output the rendered shortcode safely.
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- wp_kses_post handles allowed HTML.
|
||||
echo wp_kses_post( \YITH_WCWL_Shortcode::add_to_wishlist( [ 'product_id' => $pid ] ) );
|
||||
|
||||
do_action( 'litespeed_control_set_private', 'yith wishlist' );
|
||||
do_action( 'litespeed_vary_no' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate ESI inline value.
|
||||
*
|
||||
* @since 3.4.2
|
||||
*
|
||||
* @param mixed $res Current response (array or anything); will be normalized to array.
|
||||
* @param array $params ESI parameters that include product id.
|
||||
* @return array Inline ESI payload with value, control and tags.
|
||||
*/
|
||||
public static function inline_add_to_wishlist( $res, $params ) {
|
||||
if ( ! is_array( $res ) ) {
|
||||
$res = [];
|
||||
}
|
||||
|
||||
$pid = isset( $params[ self::ESI_PARAM_POSTID ] ) ? (int) $params[ self::ESI_PARAM_POSTID ] : 0;
|
||||
|
||||
$res['val'] = \YITH_WCWL_Shortcode::add_to_wishlist( [ 'product_id' => $pid ] );
|
||||
$res['control'] = 'private,no-vary,max-age=' . Conf::cls()->conf( Base::O_CACHE_TTL_PRIV );
|
||||
|
||||
$inline_tags = [ '', rtrim( Tag::TYPE_ESI, '.' ), Tag::TYPE_ESI . 'yith_wcwl_add' ];
|
||||
$inline_tags = implode(
|
||||
',',
|
||||
array_map(
|
||||
function ( $val ) {
|
||||
return 'public:' . LSWCP_TAG_PREFIX . '_' . $val;
|
||||
},
|
||||
$inline_tags
|
||||
)
|
||||
);
|
||||
$inline_tags .= ',' . LSWCP_TAG_PREFIX . '_tag_priv';
|
||||
|
||||
$res['tag'] = $inline_tags;
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user