-
-
Save Fi1osof/74eeb88cf3f3b996ec47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if($modx->context->key == "mgr"){return;} | |
if(!empty($_REQUEST['cultureKey']) AND in_array($_REQUEST['cultureKey'], array('ru', 'en'))){ | |
$_SESSION['cultureKey'] = $_REQUEST['cultureKey']; | |
if($_REQUEST['cultureKey'] != 'ru'){ | |
// Обязательно сменить кеш-ключ, чтобы не перемешивался кеш для разных локализаций | |
$cache_prefix = $modx->getOption('cache_prefix'); | |
$modx->setOption('cache_prefix', "{$cache_prefix}_{$modx->cultureKey}"); | |
} | |
// exit; | |
} | |
$modx->setOption('cultureKey', $modx->cultureKey); | |
$modx->setPlaceholder('+cultureKey', $modx->cultureKey); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment