PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/oligap/public_html/wp-content/themes/woodmart/inc/classes/
Server: Linux cloud.virginhosting.lk 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
IP: 128.140.68.198
Choose File :

Url:
Dir : //home/oligap/public_html/wp-content/themes/woodmart/inc/classes/Api.php

<?php if ( ! defined( 'WOODMART_THEME_DIR' ) ) exit( 'No direct script access allowed' );

/**
 * Communicate with server API (activate, update)
 */

class WOODMART_Api {

    public $token = '';

    public $base_url;

    public $url = '';

    public function __construct() {
        $this->base_url = WOODMART_API_URL;
    }

    public function call($method, $data = array() ) {

        $response = wp_remote_get( $this->get_url($method, $data), array(
            'headers'     => $this->get_headers(),
        ) );

        return $response;

    }

    public function get_headers() {
        if( empty( $this->token ) ) return array();
        return array(
            'Authorization' => 'Bearer ' . $this->token
        );
    }

    public function get_url( $method, $args = array() ) {
        $this->url = $this->base_url;

        $this->url .= $method;

        if( ! empty( $args ) ) {
            foreach ($args as $key => $value) {
                $this->add_url_param($key, $value);
            }
        }


        return $this->url;
    }

    public function add_url_param( $key, $value ) {
        $this->url = add_query_arg( $key, $value, $this->url );

    }
}