sarkfultion
⌂
›
wp-content
›
plugins
›
litespeed-cache
›
src
sarkfultion
64 dreads
↑ redisq
📁
cdn/
dreads
sarkfultion
dreads
📁
data_structure/
dreads
sarkfultion
dreads
📄
activation.cls.php
17,723 B
sarkfultion
dreads
📄
admin-display.cls.php
49,632 B
sarkfultion
dreads
📄
admin-settings.cls.php
11,383 B
sarkfultion
dreads
📄
admin.cls.php
6,276 B
sarkfultion
dreads
📄
api.cls.php
10,612 B
sarkfultion
dreads
📄
avatar.cls.php
8,860 B
sarkfultion
dreads
📄
base.cls.php
38,560 B
sarkfultion
dreads
📄
cdn.cls.php
16,300 B
sarkfultion
dreads
📄
cloud-auth-callback.trait.php
10,683 B
sarkfultion
dreads
📄
cloud-auth-ip.trait.php
4,433 B
sarkfultion
dreads
📄
cloud-auth.trait.php
9,608 B
sarkfultion
dreads
📄
cloud-misc.trait.php
10,572 B
sarkfultion
dreads
📄
cloud-node.trait.php
6,090 B
sarkfultion
dreads
📄
cloud-request.trait.php
20,157 B
sarkfultion
dreads
📄
cloud.cls.php
7,500 B
sarkfultion
dreads
📄
conf.cls.php
20,000 B
sarkfultion
dreads
📄
control.cls.php
24,933 B
sarkfultion
dreads
📄
core.cls.php
21,474 B
sarkfultion
dreads
📄
crawler-map.cls.php
19,874 B
sarkfultion
dreads
📄
crawler.cls.php
45,795 B
sarkfultion
dreads
📄
css.cls.php
18,200 B
sarkfultion
dreads
📄
data.cls.php
22,738 B
sarkfultion
dreads
📄
data.upgrade.func.php
5,856 B
sarkfultion
dreads
📄
db-optm.cls.php
15,717 B
sarkfultion
dreads
📄
debug2.cls.php
18,842 B
sarkfultion
dreads
📄
doc.cls.php
5,577 B
sarkfultion
dreads
📄
error.cls.php
7,530 B
sarkfultion
dreads
📄
esi.cls.php
27,834 B
sarkfultion
dreads
📄
file.cls.php
10,823 B
sarkfultion
dreads
📄
guest.cls.php
2,821 B
sarkfultion
dreads
📄
gui.cls.php
37,451 B
sarkfultion
dreads
📄
health.cls.php
2,899 B
sarkfultion
dreads
📄
htaccess.cls.php
30,526 B
sarkfultion
dreads
📄
img-optm-manage.trait.php
31,586 B
sarkfultion
dreads
📄
img-optm-pull.trait.php
22,632 B
sarkfultion
dreads
📄
img-optm-send.trait.php
22,422 B
sarkfultion
dreads
📄
img-optm.cls.php
5,383 B
sarkfultion
dreads
📄
import.cls.php
4,395 B
sarkfultion
dreads
📄
import.preset.cls.php
5,633 B
sarkfultion
dreads
📄
lang.cls.php
17,430 B
sarkfultion
dreads
📄
localization.cls.php
4,123 B
sarkfultion
dreads
📄
media.cls.php
45,142 B
sarkfultion
dreads
📄
metabox.cls.php
5,419 B
sarkfultion
dreads
📄
object-cache-wp.cls.php
19,268 B
sarkfultion
dreads
📄
object-cache.cls.php
21,450 B
sarkfultion
dreads
📄
object.lib.php
14,504 B
sarkfultion
dreads
📄
optimize.cls.php
39,568 B
sarkfultion
dreads
📄
optimizer.cls.php
10,754 B
sarkfultion
dreads
📄
placeholder.cls.php
18,358 B
sarkfultion
dreads
📄
purge.cls.php
35,235 B
sarkfultion
dreads
📄
report.cls.php
6,266 B
sarkfultion
dreads
📄
rest.cls.php
9,301 B
sarkfultion
dreads
📄
root.cls.php
14,631 B
sarkfultion
dreads
📄
router.cls.php
21,256 B
sarkfultion
dreads
📄
str.cls.php
3,156 B
sarkfultion
dreads
📄
tag.cls.php
9,481 B
sarkfultion
dreads
📄
task.cls.php
7,219 B
sarkfultion
dreads
📄
tool.cls.php
4,268 B
sarkfultion
dreads
📄
ucss.cls.php
16,739 B
sarkfultion
dreads
📄
utility.cls.php
26,638 B
sarkfultion
dreads
📄
vary.cls.php
21,842 B
sarkfultion
dreads
📄
vpi.cls.php
9,600 B
sarkfultion
dreads
redisq: tool.cls.php
<?php /** * The tools * * @since 3.0 * @package LiteSpeed */ namespace LiteSpeed; defined( 'WPINC' ) || exit(); /** * Class Tool * * Provides utility functions for LiteSpeed Cache, including IP detection and heartbeat control. * * @since 3.0 */ class Tool extends Root { const LOG_TAG = '[Tool]'; /** * Get public IP * * Retrieves the public IP address of the server. * * @since 3.0 * @access public * @return string The public IP address or an error message. */ public function check_ip() { self::debug( '✅ check_ip' ); $response = wp_safe_remote_get( 'https://cyberpanel.sh/?ip', [ 'headers' => [ 'User-Agent' => 'curl/8.7.1', ], ] ); if ( is_wp_error( $response ) ) { return esc_html__( 'Failed to detect IP', 'litespeed-cache' ); } $ip = trim( $response['body'] ); self::debug( 'result [ip] ' . $ip ); if ( Utility::valid_ipv4( $ip ) ) { return $ip; } return esc_html__( 'Failed to detect IP', 'litespeed-cache' ); } /** * Heartbeat Control * * Configures WordPress heartbeat settings for frontend, backend, and editor. * * @since 3.0 * @access public */ public function heartbeat() { add_action( 'wp_enqueue_scripts', [ $this, 'heartbeat_frontend' ] ); add_action( 'admin_enqueue_scripts', [ $this, 'heartbeat_backend' ] ); add_filter( 'heartbeat_settings', [ $this, 'heartbeat_settings' ] ); } /** * Heartbeat Control frontend control * * Manages heartbeat settings for the frontend. * * @since 3.0 * @access public */ public function heartbeat_frontend() { if ( ! $this->conf( Base::O_MISC_HEARTBEAT_FRONT ) ) { return; } if ( ! $this->conf( Base::O_MISC_HEARTBEAT_FRONT_TTL ) ) { wp_deregister_script( 'heartbeat' ); Debug2::debug( '[Tool] Deregistered frontend heartbeat' ); } } /** * Heartbeat Control backend control * * Manages heartbeat settings for the backend and editor. * * @since 3.0 * @access public */ public function heartbeat_backend() { if ( $this->is_editor() ) { if ( ! $this->conf( Base::O_MISC_HEARTBEAT_EDITOR ) ) { return; } if ( ! $this->conf( Base::O_MISC_HEARTBEAT_EDITOR_TTL ) ) { wp_deregister_script( 'heartbeat' ); Debug2::debug( '[Tool] Deregistered editor heartbeat' ); } } else { if ( ! $this->conf( Base::O_MISC_HEARTBEAT_BACK ) ) { return; } if ( ! $this->conf( Base::O_MISC_HEARTBEAT_BACK_TTL ) ) { wp_deregister_script( 'heartbeat' ); Debug2::debug( '[Tool] Deregistered backend heartbeat' ); } } } /** * Heartbeat Control settings * * Adjusts heartbeat interval settings based on configuration. * * @since 3.0 * @access public * @param array $settings Existing heartbeat settings. * @return array Modified heartbeat settings. */ public function heartbeat_settings( $settings ) { // Check editor first to make frontend editor valid too if ( $this->is_editor() ) { if ( $this->conf( Base::O_MISC_HEARTBEAT_EDITOR ) ) { $settings['interval'] = $this->conf( Base::O_MISC_HEARTBEAT_EDITOR_TTL ); Debug2::debug( '[Tool] Heartbeat interval set to ' . $this->conf( Base::O_MISC_HEARTBEAT_EDITOR_TTL ) ); } } elseif ( ! is_admin() ) { if ( $this->conf( Base::O_MISC_HEARTBEAT_FRONT ) ) { $settings['interval'] = $this->conf( Base::O_MISC_HEARTBEAT_FRONT_TTL ); Debug2::debug( '[Tool] Heartbeat interval set to ' . $this->conf( Base::O_MISC_HEARTBEAT_FRONT_TTL ) ); } } elseif ( $this->conf( Base::O_MISC_HEARTBEAT_BACK ) ) { $settings['interval'] = $this->conf( Base::O_MISC_HEARTBEAT_BACK_TTL ); Debug2::debug( '[Tool] Heartbeat interval set to ' . $this->conf( Base::O_MISC_HEARTBEAT_BACK_TTL ) ); } return $settings; } /** * Check if in editor * * Determines if the current request is within the WordPress editor. * * @since 3.0 * @access public * @return bool True if in editor, false otherwise. */ public function is_editor() { $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; $res = is_admin() && Utility::str_hit_array( $request_uri, [ 'post.php', 'post-new.php' ] ); return apply_filters( 'litespeed_is_editor', $res ); } }
sarkfultion