1 | <?php |
||
9 | final class Extensions { |
||
10 | |||
11 | /** |
||
12 | * Contains the instantiated Extensions instance. |
||
13 | * |
||
14 | * @var Extensions $this->instance |
||
15 | */ |
||
16 | private static $instance; |
||
17 | |||
18 | /** |
||
19 | * Holds the root URL of the API. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $root_url = ''; |
||
24 | |||
25 | /** |
||
26 | * Extensions constructor. |
||
27 | * |
||
28 | */ |
||
29 | private function __construct() { |
||
34 | |||
35 | private function __wakeup() {} |
||
36 | |||
37 | private function __clone() {} |
||
38 | |||
39 | /** |
||
40 | * Returns the *Singleton* instance of this class. |
||
41 | * |
||
42 | * @staticvar Extensions $instance The *Singleton* instances of this class. |
||
43 | * |
||
44 | * @return Extensions The *Singleton* instance. |
||
45 | */ |
||
46 | public static function get_instance() { |
||
57 | |||
58 | /** |
||
59 | * Parses the body of the API response and returns it. |
||
60 | * |
||
61 | * @return array|bool|mixed|object |
||
62 | */ |
||
63 | public function get_edd_data() { |
||
74 | |||
75 | /** |
||
76 | * Makes a request to the JSON API or retrieves the cached response. Caches the response for one day. |
||
77 | * |
||
78 | * @param $endpoint |
||
79 | * @param int $ttl |
||
80 | * |
||
81 | * @return array|mixed|\WP_Error |
||
82 | */ |
||
83 | protected function fetch( $endpoint, $ttl = DAY_IN_SECONDS ) { |
||
106 | |||
107 | } |
||
108 |