From: Tim Düsterhus Date: Mon, 8 Aug 2022 09:38:18 +0000 (+0200) Subject: Add `\wcf\http\Helper` X-Git-Tag: 6.0.0_Alpha_1~1059^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0633e4d467698698c8ece9b99ee2e6e0ff4e5297;p=GitHub%2FWoltLab%2FWCF.git Add `\wcf\http\Helper` --- diff --git a/wcfsetup/install/files/lib/http/Helper.class.php b/wcfsetup/install/files/lib/http/Helper.class.php new file mode 100644 index 0000000000..6dec16e390 --- /dev/null +++ b/wcfsetup/install/files/lib/http/Helper.class.php @@ -0,0 +1,34 @@ + + * @package WoltLabSuite\Core\Http + * @since 6.0 + */ +final class Helper +{ + /** + * Returns whether the request's 'x-requested-with' header is equal + * to 'XMLHttpRequest'. + */ + public static function isAjaxRequest(ServerRequestInterface $request): bool + { + return $request->getHeaderLine('x-requested-with') === 'XMLHttpRequest'; + } + + /** + * Forbid creation of Helper objects. + */ + private function __construct() + { + // does nothing + } +}