$29 GRAYBYTE WORDPRESS FILE MANAGER $97

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/home/bqrcodec/contact.groupg.com.sg/wp-content/plugins/jet-theme-core/includes/

HOME
Current File : /home/bqrcodec/contact.groupg.com.sg/wp-content/plugins/jet-theme-core/includes//api.php
<?php
namespace Jet_Theme_Core;

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
	die;
}

class Api {

	private $config         = array();
	private $enabled       = null;
	private $error_message = '';

	/**
	 * Constructor for the class
	 */
	function __construct() {
		$this->config  = jet_theme_core()->config->get( 'api' );
	}

	/**
	 * Check if remote API is enabled
	 *
	 * @return boolean [description]
	 */
	public function is_enabled() {

		if ( null !== $this->enabled ) {
			return $this->enabled;
		}

		if ( empty( $this->config['enabled'] ) || true !== $this->config['enabled'] ) {
			$this->enabled = false;
			return $this->enabled;
		}

		if ( empty( $this->config['base'] ) || empty( $this->config['path'] ) || empty( $this->config['endpoints'] ) ) {
			$this->enabled = false;
			return $this->enabled;
		}

		$this->enabled = true;

		return $this->enabled;
	}

	/**
	 * Retrieve URL to spescific endpoint.
	 *
	 * @param  [type] $for [description]
	 * @return [type]      [description]
	 */
	public function api_url( $for ) {

		if ( ! $this->is_enabled() ) {
			return false;
		}

		if ( empty( $this->config['endpoints'][ $for ] ) ) {
			return false;
		}

		return $this->config['base'] . $this->config['path'] . $this->config['endpoints'][ $for ];
	}

	/**
	 * Returns API base URL
	 *
	 * @return string
	 */
	public function api_base() {

		if ( ! $this->is_enabled() ) {
			return apply_filters( 'jet-theme-core/api/base-url', false );
		}

		$base_url = $this->config['base'];

		return apply_filters( 'jet-theme-core/api/base-url', $base_url );
	}

	/**
	 * Retrieve request arguments for API request
	 *
	 * @return array
	 */
	public function request_args() {
		return array(
			'timeout'   => 60,
			'sslverify' => false
		);
	}

	/**
	 * Get remote system info by key.
	 *
	 * @param  string|array $key [description]
	 * @return [type]      [description]
	 */
	public function get_info( $key = '' ) {

		$api_url = $this->api_url( 'info' );

		if ( ! $api_url ) {
			return false;
		}

		$response = wp_remote_get( $api_url, $this->request_args() );
		$body = wp_remote_retrieve_body( $response );
		$body = json_decode( $body, true );

		if ( ! $body || ! isset( $body['success'] ) || true !== $body['success'] ) {
			return false;
		}

		if ( ! $key ) {
			unset( $body['success'] );
			return $body;
		}

		if ( is_string( $key ) ) {
			return isset( $body[ $key ] ) ? $body[ $key ] : false;
		}

		if ( is_array( $key ) ) {

			$result = array();

			foreach ( $key as $_key ) {
				$result[ $_key ] = isset( $body[ $_key ] ) ? $body[ $_key ] : false;
			}

			return $result;

		}

	}

	/**
	 * Retrirve error message by error code
	 *
	 * @return string
	 */
	public function get_error_by_code( $code ) {

		$messages = array(
			'missing' => __( 'Your license is missing. Please check your key again.', 'jet-theme-core' ),
			'no_activations_left' => sprintf( __( '<strong>You have no more activations left.</strong> <a href="%s" target="_blank">Please upgrade to a more advanced license</a> (you\'ll only need to cover the difference).', 'jet-theme-core' ), $this->upgrade_url() ),
			'expired' => sprintf( __( '<strong>Your License Has Expired.</strong> <a href="%s" target="_blank">Renew your license today</a> to keep getting feature updates, premium support and unlimited access to the template library.', 'jet-theme-core' ), $this->renew_url() ),
			'revoked' => __( '<strong>Your license key has been cancelled</strong> (most likely due to a refund request). Please consider acquiring a new license.', 'jet-theme-core' ),
			'disabled' => __( '<strong>Your license key has been cancelled</strong> (most likely due to a refund request). Please consider acquiring a new license.', 'jet-theme-core' ),
			'invalid' => __( '<strong>Your license key doesn\'t match your current domain</strong>. This is most likely due to a change in the domain URL of your site (including HTTPS/SSL migration). Please deactivate the license and then reactivate it again.', 'jet-theme-core' ),
			'site_inactive' => __( '<strong>Your license key doesn\'t match your current domain</strong>. This is most likely due to a change in the domain URL. Please deactivate the license and then reactivate it again.', 'jet-theme-core' ),
			'inactive' => __( '<strong>Your license key doesn\'t match your current domain</strong>. This is most likely due to a change in the domain URL of your site (including HTTPS/SSL migration). Please deactivate the license and then reactivate it again.', 'jet-theme-core' ),
		);

		$default = __( 'An error occurred. Please check your internet connection and try again. If the problem persists, contact our support.', 'jet-theme-core' );

		return isset( $messages[ $code ] ) ? $messages[ $code ] : $default;

	}

	/**
	 * Returns upgrade URL
	 *
	 * @return string
	 */
	public function upgrade_url() {
		return $this->config['base'];
	}

	/**
	 * Returns upgrade URL
	 *
	 * @return string
	 */
	public function renew_url() {
		return $this->config['base'];
	}

	/**
	 * Set error message and return false.
	 *
	 * @param [type] $message [description]
	 */
	public function set_error( $message, $code = null ) {

		if ( ! $code ) {
			$this->error_message = $message;
		} else {
			$this->error_message = $this->get_error_by_code( $code );
		}

		return false;
	}

	/**
	 * Returns error message
	 *
	 * @return [type] [description]
	 */
	public function get_activation_error() {
		return $this->error_message;
	}

}

Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
compatibility
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
elementor
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
lib
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
locations
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
modules
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
rest-api
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
settings
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
template-conditions
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
template-structures
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
templates
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
theme-builder
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
ajax-handlers.php
3.632 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
api.php
5.368 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
backups.php
10.333 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
config.php
5.134 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
frontend.php
0.966 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
plugin.php
8.962 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
utils.php
11.244 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF