make user agent dynamic with changes to plugin's Text Domainand Version
This commit is contained in:
@@ -57,9 +57,15 @@ function dsi_get_status() : bool {
|
|||||||
return (bool) $cached;
|
return (bool) $cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get plugin data for dynamic user agent
|
||||||
|
$plugin_data = get_file_data( __FILE__, array(
|
||||||
|
'Version' => 'Version',
|
||||||
|
'TextDomain' => 'Text Domain'
|
||||||
|
), 'plugin' );
|
||||||
|
|
||||||
$response = wp_remote_get( DSI_API_URL, [
|
$response = wp_remote_get( DSI_API_URL, [
|
||||||
'timeout' => 3,
|
'timeout' => 3,
|
||||||
'user-agent' => 'DoorStatusIndicator/1.1.1 (+https://wordpress.org/)',
|
'user-agent' => $plugin_data['TextDomain'] . '/' . $plugin_data['Version'] . ' (+https://wordpress.org/)',
|
||||||
] );
|
] );
|
||||||
|
|
||||||
if ( is_wp_error( $response ) ) {
|
if ( is_wp_error( $response ) ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user