* @copyright Copyright (c) 2022 Samuel Marshall / JCH Optimize * @license GNU/GPLv3, or later. See LICENSE file * * If LICENSE file missing, see . */ namespace JchOptimize\Core\Platform; use JchOptimize\Core\Registry; use stdClass; use function defined; defined('_JCH_EXEC') or die('Restricted access'); interface UtilityInterface { /** * * @param string $text */ public function translate(string $text): string; /** * Returns true if current user is not logged in * * @return bool */ public function isGuest(): bool; public function sendHeaders(array $headers): void; /** * Returns array of response headers that are set or already sent */ public function getHeaders(): array; /** * * @param string $userAgent */ public function userAgent(string $userAgent): stdClass; /** * Indicates if current client is mobile * * @return bool */ public function isMobile(): bool; /** * Returns a regular expression fragment that web-server rules can use to identify mobile user agents. */ public function getMobileUserAgentPattern(): string; /** * Indicates whether Sec-CH-UA-Mobile takes precedence over user-agent detection on this platform. */ public function usesMobileClientHint(): bool; /** * Indicates if page cache is enabled. If nativeCache is true then we're specifically checking the * jchoptimize page cache * * @param Registry $params * @param bool $nativeCache * * @return bool * @deprecated Use Cache::isPageCacheEnabled() instead */ public function isPageCacheEnabled(Registry $params, bool $nativeCache = false): bool; /** * Should return one of the following based on the current configuration * filesystem, memcached, apcu, redis * * @param Registry $params * * @return string * @deprecated Use Cache::getCacheStorage() instead */ public function getCacheStorage(Registry $params): string; /** * Should return the attribute used to store content values for popover that the version of Bootstrap * is using * * @return string */ public function bsTooltipContentAttribute(): string; /** * @param string $message * @param string $messageType */ public function publishAdminMessages(string $message, string $messageType); /** * Determines if the site is currently configured to compress the HTML using gzip * * @return bool */ public function isSiteGzipEnabled(): bool; /** * Determines if request is on the admin site * * @return bool */ public function isAdmin(): bool; public function getNonce(string $id): string; }