1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-11 17:24:46 +02:00

Add a WireHttp::setUserAgent() method to accompany existing getUserAgent() method

This commit is contained in:
Ryan Cramer
2021-07-28 10:42:23 -04:00
parent 9e318c9688
commit 003c7f91b0
3 changed files with 17 additions and 3 deletions

View File

@@ -168,7 +168,7 @@
* @property array $statusFiles File inclusions for ProcessWires runtime statuses/states. #pw-group-system @since 3.0.142 * @property array $statusFiles File inclusions for ProcessWires 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 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 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 PHPs 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 PHPs 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 $rootPageID Page ID of homepage (usually 1) #pw-group-system-IDs
* @property int $adminRootPageID Page ID of admin root page #pw-group-system-IDs * @property int $adminRootPageID Page ID of admin root page #pw-group-system-IDs

View File

@@ -1783,6 +1783,7 @@ class WireHttp extends Wire {
* Get the current user-agent header * 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 * #pw-group-request-headers
* *
@@ -1799,6 +1800,19 @@ class WireHttp extends Wire {
return $userAgent; 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 * Set the number of seconds till connection times out
* *

View File

@@ -14,7 +14,7 @@ if(!defined("PROCESSWIRE")) die();
/** @var Paths $urls */ /** @var Paths $urls */
/** @var string $layout */ /** @var string $layout */
$version = $adminTheme->version . 'f'; $version = $adminTheme->version . 'g';
$rootUrl = $config->urls->root; $rootUrl = $config->urls->root;
$themeUrl = $adminTheme->url(); $themeUrl = $adminTheme->url();
$styles = $config->styles; $styles = $config->styles;