From 003c7f91b0cf7664509998a1d4b7fe4cae336144 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Wed, 28 Jul 2021 10:42:23 -0400 Subject: [PATCH] Add a WireHttp::setUserAgent() method to accompany existing getUserAgent() method --- wire/core/Config.php | 2 +- wire/core/WireHttp.php | 16 +++++++++++++++- .../modules/AdminTheme/AdminThemeUikit/_head.php | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/wire/core/Config.php b/wire/core/Config.php index 24dfa364..9ac88aa6 100644 --- a/wire/core/Config.php +++ b/wire/core/Config.php @@ -168,7 +168,7 @@ * @property array $statusFiles File inclusions for ProcessWire’s runtime statuses/states. #pw-group-system @since 3.0.142 * @property int $status Value of current system status/state corresponding to ProcessWire::status* constants. #pw-internal * @property null|bool $disableUnknownMethodException Disable the “Method does not exist or is not callable in this context” exception. (default=null) #pw-internal - * @property string|null $phpMailAdditionalParams Additional params to pass to PHP’s mail() function (when used), see $additional_params argument at https://www.php.net/manual/en/function.mail.php #pw-group-system + * @property string|null $phpMailAdditionalParameters Additional params to pass to PHP’s mail() function (when used), see $additional_params argument at https://www.php.net/manual/en/function.mail.php #pw-group-system * * @property int $rootPageID Page ID of homepage (usually 1) #pw-group-system-IDs * @property int $adminRootPageID Page ID of admin root page #pw-group-system-IDs diff --git a/wire/core/WireHttp.php b/wire/core/WireHttp.php index f9a23b4c..1a6ed4bd 100644 --- a/wire/core/WireHttp.php +++ b/wire/core/WireHttp.php @@ -1782,7 +1782,8 @@ class WireHttp extends Wire { /** * Get the current user-agent header * - * To set the user agent header, use `$http->setHeader('user-agent', '...');` + * To set the user agent header, use `$http->setHeader('user-agent', '...');` + * or in 3.0.183+ there is also `$http->setUserAgent('...');` * * #pw-group-request-headers * @@ -1799,6 +1800,19 @@ class WireHttp extends Wire { return $userAgent; } + /** + * Set the current user-agent header + * + * #pw-group-request-headers + * + * @param string $userAgent + * @since 3.0.183 + * + */ + public function setUserAgent($userAgent) { + $this->setHeader('user-agent', $userAgent); + } + /** * Set the number of seconds till connection times out * diff --git a/wire/modules/AdminTheme/AdminThemeUikit/_head.php b/wire/modules/AdminTheme/AdminThemeUikit/_head.php index 97c4ffd8..79371cb7 100644 --- a/wire/modules/AdminTheme/AdminThemeUikit/_head.php +++ b/wire/modules/AdminTheme/AdminThemeUikit/_head.php @@ -14,7 +14,7 @@ if(!defined("PROCESSWIRE")) die(); /** @var Paths $urls */ /** @var string $layout */ -$version = $adminTheme->version . 'f'; +$version = $adminTheme->version . 'g'; $rootUrl = $config->urls->root; $themeUrl = $adminTheme->url(); $styles = $config->styles;