| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* JCH Optimize - Performs several front-end optimizations for fast downloads |
| 5 |
* |
| 6 |
* @package jchoptimize/core |
| 7 |
* @author Samuel Marshall <samuel@jch-optimize.net> |
| 8 |
* @copyright Copyright (c) 2022 Samuel Marshall / JCH Optimize |
| 9 |
* @license GNU/GPLv3, or later. See LICENSE file |
| 10 |
* |
| 11 |
* If LICENSE file missing, see <http://www.gnu.org/licenses/>. |
| 12 |
*/ |
| 13 |
|
| 14 |
namespace JchOptimize\Core\Platform; |
| 15 |
|
| 16 |
use JchOptimize\Core\Registry; |
| 17 |
use stdClass; |
| 18 |
|
| 19 |
use function defined; |
| 20 |
|
| 21 |
defined('_JCH_EXEC') or die('Restricted access'); |
| 22 |
|
| 23 |
interface UtilityInterface |
| 24 |
{ |
| 25 |
/** |
| 26 |
* |
| 27 |
* @param string $text |
| 28 |
*/ |
| 29 |
public function translate(string $text): string; |
| 30 |
|
| 31 |
/** |
| 32 |
* Returns true if current user is not logged in |
| 33 |
* |
| 34 |
* @return bool |
| 35 |
*/ |
| 36 |
public function isGuest(): bool; |
| 37 |
|
| 38 |
public function sendHeaders(array $headers): void; |
| 39 |
|
| 40 |
/** |
| 41 |
* Returns array of response headers that are set or already sent |
| 42 |
*/ |
| 43 |
public function getHeaders(): array; |
| 44 |
|
| 45 |
/** |
| 46 |
* |
| 47 |
* @param string $userAgent |
| 48 |
*/ |
| 49 |
public function userAgent(string $userAgent): stdClass; |
| 50 |
|
| 51 |
/** |
| 52 |
* Indicates if current client is mobile |
| 53 |
* |
| 54 |
* @return bool |
| 55 |
*/ |
| 56 |
public function isMobile(): bool; |
| 57 |
|
| 58 |
/** |
| 59 |
* Returns a regular expression fragment that web-server rules can use to identify mobile user agents. |
| 60 |
*/ |
| 61 |
public function getMobileUserAgentPattern(): string; |
| 62 |
|
| 63 |
/** |
| 64 |
* Indicates whether Sec-CH-UA-Mobile takes precedence over user-agent detection on this platform. |
| 65 |
*/ |
| 66 |
public function usesMobileClientHint(): bool; |
| 67 |
|
| 68 |
/** |
| 69 |
* Indicates if page cache is enabled. If nativeCache is true then we're specifically checking the |
| 70 |
* jchoptimize page cache |
| 71 |
* |
| 72 |
* @param Registry $params |
| 73 |
* @param bool $nativeCache |
| 74 |
* |
| 75 |
* @return bool |
| 76 |
* @deprecated Use Cache::isPageCacheEnabled() instead |
| 77 |
*/ |
| 78 |
public function isPageCacheEnabled(Registry $params, bool $nativeCache = false): bool; |
| 79 |
|
| 80 |
/** |
| 81 |
* Should return one of the following based on the current configuration |
| 82 |
* filesystem, memcached, apcu, redis |
| 83 |
* |
| 84 |
* @param Registry $params |
| 85 |
* |
| 86 |
* @return string |
| 87 |
* @deprecated Use Cache::getCacheStorage() instead |
| 88 |
*/ |
| 89 |
public function getCacheStorage(Registry $params): string; |
| 90 |
|
| 91 |
/** |
| 92 |
* Should return the attribute used to store content values for popover that the version of Bootstrap |
| 93 |
* is using |
| 94 |
* |
| 95 |
* @return string |
| 96 |
*/ |
| 97 |
public function bsTooltipContentAttribute(): string; |
| 98 |
|
| 99 |
/** |
| 100 |
* @param string $message |
| 101 |
* @param string $messageType |
| 102 |
*/ |
| 103 |
public function publishAdminMessages(string $message, string $messageType); |
| 104 |
|
| 105 |
/** |
| 106 |
* Determines if the site is currently configured to compress the HTML using gzip |
| 107 |
* |
| 108 |
* @return bool |
| 109 |
*/ |
| 110 |
public function isSiteGzipEnabled(): bool; |
| 111 |
|
| 112 |
/** |
| 113 |
* Determines if request is on the admin site |
| 114 |
* |
| 115 |
* @return bool |
| 116 |
*/ |
| 117 |
public function isAdmin(): bool; |
| 118 |
|
| 119 |
public function getNonce(string $id): string; |
| 120 |
} |
| 121 |
|