PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /home/trave494/live2news.com/wp-content/plugins/w3-total-cache/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : /home/trave494/live2news.com/wp-content/plugins/w3-total-cache/Cdnfsd_LimeLight_Api.php |
<?php namespace W3TC; class Cdnfsd_LimeLight_Api { private $url_base; public function __construct( $short_name, $username, $api_key ) { $this->url_base = 'https://purge.llnw.com/purge/v1/account/' . $short_name . '/requests'; $this->username = $username; $this->api_key = $api_key; } public function purge( $items ) { $body = json_encode( array( 'patterns' => $items ) ); return $this->_wp_remote_post( '', $body ); } public function get( $uri ) { return $this->_wp_remote_get( $uri ); } private function _wp_remote_get( $uri, $body = '', $headers = array() ) { $url = $this->url_base . $uri; $headers = $this->_add_headers( $headers, $url, 'GET', $body ); $result = wp_remote_get( $url, array( 'headers' => $headers, 'body' => $body ) ); return $this->_decode_response( $result ); } private function _wp_remote_post( $uri, $body, $headers = array() ) { $url = $this->url_base . $uri; $headers = $this->_add_headers( $headers, $url, 'POST', $body ); $result = wp_remote_post( $url, array( 'headers' => $headers, 'body' => $body ) ); return $this->_decode_response( $result ); } private function _add_headers( $headers, $url, $method, $body ) { $timestamp = '' . ( time() * 1000 ); $headers['Content-Type'] = 'application/json'; $headers['X-LLNW-Security-Principal'] = $this->username; $headers['X-LLNW-Security-Timestamp'] = $timestamp; $headers['X-LLNW-Security-Token'] = hash_hmac( 'sha256', $method . $url . $timestamp . $body, pack( 'H*', $this->api_key ) ); return $headers; } private function _decode_response( $result ) { if ( is_wp_error( $result ) ) throw new \Exception( 'Failed to reach API endpoint' ); $response_json = @json_decode( $result['body'], true ); if ( is_null( $response_json ) ) { throw new \Exception( 'Failed to reach API endpoint, got unexpected response ' . $result['body'] ); } if ( $result['response']['code'] != '200' && $result['response']['code'] != '201' && $result['response']['code'] != '202' && $result['response']['code'] != '204' ) { if ( isset( $response_json['errors'] ) && isset( $response_json['errors'][0]['description'] ) ) { throw new \Exception( $response_json['errors'][0]['description'] ); } throw new \Exception( $result['body'] ); } return $response_json; } }