| 1 |
<?php |
| 2 |
|
| 3 |
namespace ThemeAtelier\Darkify\Includes; |
| 4 |
|
| 5 |
|
| 6 |
class DarkifyAssets |
| 7 |
{ |
| 8 |
/** |
| 9 |
* Requested switcher variants for the current request. |
| 10 |
* |
| 11 |
* @var array<string,bool> |
| 12 |
*/ |
| 13 |
private static $requested_variants = array(); |
| 14 |
|
| 15 |
/** |
| 16 |
* Whether we've detected at least one [darkify] shortcode on the page. |
| 17 |
* |
| 18 |
* @var bool |
| 19 |
*/ |
| 20 |
private static $has_shortcode = false; |
| 21 |
|
| 22 |
public static function request_variant($variant) |
| 23 |
{ |
| 24 |
$variant = sanitize_key((string) $variant); |
| 25 |
if (!$variant) { |
| 26 |
return; |
| 27 |
} |
| 28 |
self::$requested_variants[$variant] = true; |
| 29 |
} |
| 30 |
|
| 31 |
public static function get_requested_variants() |
| 32 |
{ |
| 33 |
return array_keys(self::$requested_variants); |
| 34 |
} |
| 35 |
|
| 36 |
public static function set_has_shortcode($has_shortcode) |
| 37 |
{ |
| 38 |
self::$has_shortcode = (bool) $has_shortcode; |
| 39 |
} |
| 40 |
|
| 41 |
public static function has_shortcode() |
| 42 |
{ |
| 43 |
return self::$has_shortcode; |
| 44 |
} |
| 45 |
} |