| Server IP : 172.67.152.66 / Your IP : 104.23.197.97 Web Server : nginx/1.26.1 System : Linux HE9229 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 User : www ( 1000) PHP Version : 8.0.26 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/11ph_ph_com/wp-content/plugins/litespeed-cache/src/ |
Upload File : |
<?php
/**
* The tools
*
* @since 3.0
* @package LiteSpeed
* @subpackage LiteSpeed/inc
* @author LiteSpeed Technologies <[email protected]>
*/
namespace LiteSpeed;
defined('WPINC') || exit();
class Tool extends Root {
const LOG_TAG = '[Tool]';
/**
* Get public IP
*
* @since 3.0
* @access public
*/
public function check_ip() {
self::debug('✅ check_ip');
$response = wp_safe_remote_get('https://cyberpanel.sh/?ip', array(
'headers' => array(
'User-Agent' => 'curl/8.7.1',
),
));
if (is_wp_error($response)) {
return __('Failed to detect IP', 'litespeed-cache');
}
$ip = trim($response['body']);
self::debug('result [ip] ' . $ip);
if (Utility::valid_ipv4($ip)) {
return $ip;
}
return __('Failed to detect IP', 'litespeed-cache');
}
/**
* Heartbeat Control
*
* NOTE: since WP4.9, there could be a core bug that sometimes the hook is not working.
*
* @since 3.0
* @access public
*/
public function heartbeat() {
add_action('wp_enqueue_scripts', array( $this, 'heartbeat_frontend' ));
add_action('admin_enqueue_scripts', array( $this, 'heartbeat_backend' ));
add_filter('heartbeat_settings', array( $this, 'heartbeat_settings' ));
}
/**
* Heartbeat Control frontend control
*
* @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
*
* @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
*
* @since 3.0
* @access public
*/
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;
}
/**
* If is in editor
*
* @since 3.0
* @access public
*/
private function _is_editor() {
$res = is_admin() && Utility::str_hit_array($_SERVER['REQUEST_URI'], array( 'post.php', 'post-new.php' ));
return apply_filters('litespeed_is_editor', $res);
}
}