Skip to content

Instantly share code, notes, and snippets.

@Fi1osof
Created December 23, 2014 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fi1osof/74eeb88cf3f3b996ec47 to your computer and use it in GitHub Desktop.
Save Fi1osof/74eeb88cf3f3b996ec47 to your computer and use it in GitHub Desktop.
<?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