You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.9 KiB
42 lines
1.9 KiB
<?php
|
|
/* Start | Работа с проверкой мультисайтовости и стендов */
|
|
global $site_env;
|
|
$site_env = new SiteEnvironment();
|
|
class SiteEnvironment {
|
|
public string $site_mode;
|
|
public string $site_region;
|
|
public bool $is_gp_test_mode;
|
|
|
|
public function __construct(string $host = null) {
|
|
$map = [
|
|
'cosmopet.ru' => ['mode' => 'production', 'region' => 'ru'],
|
|
'cosmopet.ae' => ['mode' => 'production', 'region' => 'ae'],
|
|
'cosmopet-test-dumb.cp.good-production.xyz' => ['mode' => 'develope', 'region' => 'ru'],
|
|
'cosmopet-test-ru.cp.good-production.xyz' => ['mode' => 'develope', 'region' => 'ru'],
|
|
'cosmopet-test-ae.cp.good-production.xyz' => ['mode' => 'develope', 'region' => 'ae'],
|
|
];
|
|
$host = strtolower($host ?: $_SERVER['SERVER_NAME']);
|
|
$config = $map[$host] ?? ['mode' => 'develope', 'region' => 'unknown'];
|
|
$this->site_mode = $config['mode'];
|
|
$this->site_region = $config['region'];
|
|
$this->is_gp_test_mode = (isset($_GET['gp-test']) && $_GET['gp-test'] == '1') || (is_user_logged_in() && current_user_can('administrator'));
|
|
}
|
|
}
|
|
|
|
add_filter('timber/twig', function (\Twig\Environment $twig) {
|
|
global $site_env;
|
|
$twig->addGlobal('site_region', $site_env->site_region);
|
|
$twig->addGlobal('site_env', $site_env);
|
|
$twig->addGlobal('site_mode', $site_env->site_mode);
|
|
$twig->addGlobal('header_scripts', get_field('header_scripts', 'option'));
|
|
return $twig;
|
|
});
|
|
/* End | Работа с проверкой мультисайтовости и стендов */
|
|
|
|
add_filter('woocommerce_currency_symbol', function($currency_symbol, $currency) {
|
|
return $currency === 'AED' ? 'AED' : $currency_symbol;
|
|
<<<<<<< HEAD
|
|
})
|
|
=======
|
|
}, 10, 2);
|
|
>>>>>>> 598bddea (Andrei | добавил попап для отображения всех характеристик товара)
|
|
|