C:\xampp\htdocs\landing\wp-content\plugins\wp-smushit\core\api\class-api.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/**
 * Smush API class that handles communications with WPMU DEV API: API class
 *
 * @since 3.0
 * @package Smush\Core\Api
 */

namespace Smush\Core\Api;

use 
Exception;
use 
WP_Error;

if ( ! 
defined'WPINC' ) ) {
    die;
}

/**
 * Class API.
 */
class API {

    
/**
     * Endpoint name.
     *
     * @since 3.0
     *
     * @var string
     */
    
public $name 'smush';

    
/**
     * Endpoint version.
     *
     * @since 3.0
     *
     * @var string
     */
    
public $version 'v1';

    
/**
     * API key.
     *
     * @since 3.0
     *
     * @var string
     */
    
public $api_key '';

    
/**
     * API request instance.
     *
     * @since 3.0
     *
     * @var Request
     */
    
private $request;

    
/**
     * API constructor.
     *
     * @since 3.0
     *
     * @param string $key  API key.
     *
     * @throws Exception  API Request exception.
     */
    
public function __construct$key ) {
        
$this->api_key $key;
        
$this->request = new Request$this );
    }

    
/**
     * Check CDN status (same as verify the is_pro status).
     *
     * @since 3.0
     *
     * @param bool $manual  If it's a manual check. Only manual on button click.
     *
     * @return mixed|WP_Error
     */
    
public function check$manual false ) {
        return 
$this->request->get(
            
"check/{$this->api_key}",
            array(
                
'api_key' => $this->api_key,
                
'domain'  => $this->request->get_this_site(),
            ),
            
$manual
        
);
    }

    
/**
     * Enable CDN for site.
     *
     * @since 3.0
     *
     * @param bool $manual  If it's a manual check. Overwrites the exponential back off.
     *
     * @return mixed|WP_Error
     */
    
public function enable$manual false ) {
        return 
$this->request->post(
            
'cdn',
            array(
                
'api_key' => $this->api_key,
                
'domain'  => $this->request->get_this_site(),
            ),
            
$manual
        
);
    }

}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586