AnonSec Shell
Server IP : 172.67.157.199  /  Your IP : 3.137.190.150   [ Reverse IP ]
Web Server : Apache
System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64
User : root ( 0)
PHP Version : 8.0.30.2
Disable Function : NONE
Domains : 0 Domains
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/wp-content/mu-plugins/vendor/wptool/wp-admin-dash/src/adminDash/services/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/wp-content/mu-plugins/vendor/wptool/wp-admin-dash/src/adminDash/services/MinificationService.php
<?php

namespace Wptool\adminDash\services;

use Wptool\adminDash\constants\MinificationConstants;
use Wptool\adminDash\controllers\MinificationController;
use Wptool\adminDash\utils\Configuration;
use WPaaS\Plugin;
use Wptool\adminDash\utils\PlansMapping;

class MinificationService {

	private $api_url;

	public function __construct() {
		$this->api_url = Configuration::get( 'public_api_url' );
	}

	/**
	 * This function returns minified flag values.
	 *
	 * @return array
	 */
	public function get_minified_flags() {

		$account_uid = defined( 'GD_ACCOUNT_UID' ) ? GD_ACCOUNT_UID : null;
		$response    = wp_remote_get(
			$this->api_url . '/cdn/' . $account_uid . '/minification',
			array( 'headers' => Plugin::sign_http_request( wp_json_encode( array() ) ) )
		);

		if ( is_wp_error( $response ) ) {
			return array(
				'status' => MinificationConstants::ERROR,
				'data'   => null,
			);
		}

		if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
			return array(
				'status' => MinificationConstants::ERROR,
				'data'   => null,
			);
		}

		return array(
			'status' => MinificationConstants::SUCCESS,
			'data'   => json_decode( wp_remote_retrieve_body( $response ) ),
		);
	}

	/**
	 * This function returns minified flag values.
	 * If Account does not have any minified flags set, response is:
	 * [
	 *  'status' => 'success',
	 *  'data' => [
	 *    'js' => false,
	 *    'css' => false,
	 *    'html' => false
	 *   ]
	 * ]
	 *
	 * @return array
	 */
	public function set_minified_flags( $type ) {

		$account_uid = defined( 'GD_ACCOUNT_UID' ) ? GD_ACCOUNT_UID : null;

		$response = wp_remote_request(
			$this->api_url . '/cdn/' . $account_uid . '/minification',
			array(
				'headers' => array_merge( array( 'Content-Type' => 'application/json' ), Plugin::sign_http_request( wp_json_encode( array() ) ) ),
				'method'  => 'PUT',
				'timeout' => 30,
				'body'    => json_encode(
					array(
						'type' => $type,
					)
				),
			)
		);

		if ( is_wp_error( $response ) ) {
			return array(
				'status' => MinificationConstants::ERROR,
				'data'   => null,
			);
		}

		if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
			return array(
				'status' => MinificationConstants::ERROR,
				'data'   => null,
			);
		}

		return array(
			'status' => MinificationConstants::SUCCESS,
			'data'   => json_decode( wp_remote_retrieve_body( $response ) ),
		);
	}

	/**
	 * This function returns account plan.
	 *
	 * @return string|null
	 */
	public function get_account_plan() {

		if ( defined( 'GD_PLAN_NAME' ) ) {
			return PlansMapping::get_plan_type( GD_PLAN_NAME );
		}

		return null;
	}
}

Anon7 - 2022
AnonSec Team