HEX
Server: nginx/1.18.0
System: Linux iZj6c1ieg2jrpk1z5tzi19Z 6.3.9-1.el7.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 21 22:18:40 EDT 2023 x86_64
User: www (1001)
PHP: 8.2.4
Disabled: 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
Upload Files
File: /www/wwwroot/www.cytocare.cn/wp-content/plugins/hummingbird-performance/admin/ajax/class-gzip.php
<?php
/**
 * Gzip AJAX actions.
 *
 * @since 2.2.0
 * @package Hummingbird\Admin\Ajax
 */

namespace Hummingbird\Admin\Ajax;

use Hummingbird\Core\Module_Server;
use Hummingbird\Core\Utils;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class Gzip.
 */
class Gzip {

	/**
	 * Gzip constructor.
	 */
	public function __construct() {
		add_action( 'wp_ajax_wphb_react_gzip_status', array( $this, 'status' ) );
		add_action( 'wp_ajax_wphb_react_gzip_rules', array( $this, 'apply_rules' ) );
	}

	/**
	 * Fetch/refresh gzip status.
	 *
	 * @since 2.2.0
	 */
	public function status() {
		check_ajax_referer( 'wphb-fetch' );

		// Check permission.
		if ( ! current_user_can( Utils::get_admin_capability() ) ) {
			die();
		}

		$params = filter_input( INPUT_POST, 'data', FILTER_UNSAFE_RAW );
		$params = json_decode( html_entity_decode( $params ), true );

		if ( 'refresh' === $params ) {
			wp_send_json_success( array( 'status' => Utils::get_module( 'gzip' )->get_analysis_data( true, true ) ) );
		}

		wp_send_json_success( array( 'status' => Utils::get_module( 'gzip' )->get_analysis_data() ) );
	}

	/**
	 * Add/remove Gzip .htaccess rules.
	 *
	 * @since 2.2.0
	 */
	public function apply_rules() {
		check_ajax_referer( 'wphb-fetch' );

		// Check permission.
		if ( ! current_user_can( Utils::get_admin_capability() ) ) {
			die();
		}

		$params = filter_input( INPUT_POST, 'data', FILTER_UNSAFE_RAW );
		$params = json_decode( html_entity_decode( $params ), true );

		if ( 'add' === $params ) {
			Module_Server::save_htaccess( 'gzip' );
			wp_send_json_success(
				array(
					'status'           => Utils::get_module( 'gzip' )->get_analysis_data( true, true ),
					'htaccess_written' => Module_Server::is_htaccess_written( 'gzip' ),
				)
			);
		}

		if ( 'remove' === $params ) {
			Module_Server::unsave_htaccess( 'gzip' );
			wp_send_json_success(
				array(
					'status'           => Utils::get_module( 'gzip' )->get_analysis_data( true, true ),
					'htaccess_written' => Module_Server::is_htaccess_written( 'gzip' ),
				)
			);
		}

		wp_send_json_error( __( 'Error updating .htaccess file', 'wphb' ), 500 );
	}

}