本文整理汇总了PHP中Context::loadLangSupported方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::loadLangSupported方法的具体用法?PHP Context::loadLangSupported怎么用?PHP Context::loadLangSupported使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context::loadLangSupported方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveLangSelected
/**
* @brief Supported languages (was procInstallAdminSaveLangSelected)
**/
function saveLangSelected($selected_lang)
{
$langs = $selected_lang;
$lang_supported = Context::loadLangSupported();
$buff = null;
for ($i = 0; $i < count($langs); $i++) {
$buff .= sprintf("%s,%s\n", $langs[$i], $lang_supported[$langs[$i]]);
}
FileHandler::writeFile(_XE_PATH_ . 'files/config/lang_selected.info', trim($buff));
//$this->setMessage('success_updated');
}
示例2: procInstallAdminSaveLangSelected
/**
* @brief 지원 언어 선택
**/
function procInstallAdminSaveLangSelected()
{
$selected_lang = trim(Context::get('selected_lang'));
if (!$selected_lang) {
return new Object(-1, 'msg_invalid_request');
}
$langs = explode('|@|', $selected_lang);
$lang_supported = Context::loadLangSupported();
$buff = null;
for ($i = 0; $i < count($langs); $i++) {
$buff .= sprintf("%s,%s\n", $langs[$i], $lang_supported[$langs[$i]]);
}
FileHandler::writeFile(_XE_PATH_ . 'files/config/lang_selected.info', trim($buff));
$this->setMessage('success_updated');
}
示例3: dispAdminConfigGeneral
/**
* Display Configuration(settings) page
* @return void
*/
function dispAdminConfigGeneral()
{
Context::loadLang('modules/install/lang');
$db_info = Context::getDBInfo();
Context::set('selected_lang', $db_info->lang_type);
if (strpos($db_info->default_url, 'xn--') !== FALSE) {
$db_info->default_url = Context::decodeIdna($db_info->default_url);
}
Context::set('default_url', $db_info->default_url);
Context::set('langs', Context::loadLangSupported());
// site lock
Context::set('IP', $_SERVER['REMOTE_ADDR']);
if (!$db_info->sitelock_title) {
$db_info->sitelock_title = 'Maintenance in progress...';
}
if (!in_array('127.0.0.1', $db_info->sitelock_whitelist)) {
$db_info->sitelock_whitelist[] = '127.0.0.1';
}
if (!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) {
$db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR'];
}
$db_info->sitelock_whitelist = array_unique($db_info->sitelock_whitelist);
Context::set('remote_addr', $_SERVER['REMOTE_ADDR']);
Context::set('use_sitelock', $db_info->use_sitelock);
Context::set('sitelock_title', $db_info->sitelock_title);
Context::set('sitelock_message', htmlspecialchars($db_info->sitelock_message, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
$whitelist = implode("\r\n", $db_info->sitelock_whitelist);
Context::set('sitelock_whitelist', $whitelist);
if ($db_info->admin_ip_list) {
$admin_ip_list = implode("\r\n", $db_info->admin_ip_list);
} else {
$admin_ip_list = '';
}
Context::set('admin_ip_list', $admin_ip_list);
Context::set('lang_selected', Context::loadLangSelected());
$oAdminModel = getAdminModel('admin');
$favicon_url = $oAdminModel->getFaviconUrl();
$mobicon_url = $oAdminModel->getMobileIconUrl();
Context::set('favicon_url', $favicon_url . '?' . $_SERVER['REQUEST_TIME']);
Context::set('mobicon_url', $mobicon_url . '?' . $_SERVER['REQUEST_TIME']);
$oDocumentModel = getModel('document');
$config = $oDocumentModel->getDocumentConfig();
Context::set('thumbnail_type', $config->thumbnail_type);
$oModuleModel = getModel('module');
$config = $oModuleModel->getModuleConfig('module');
Context::set('siteTitle', $config->siteTitle);
Context::set('htmlFooter', htmlspecialchars($config->htmlFooter));
// embed filter
require_once _XE_PATH_ . 'classes/security/EmbedFilter.class.php';
$oEmbedFilter = EmbedFilter::getInstance();
context::set('embed_white_object', implode(PHP_EOL, $oEmbedFilter->whiteUrlList));
context::set('embed_white_iframe', implode(PHP_EOL, $oEmbedFilter->whiteIframeUrlList));
$columnList = array('modules.mid', 'modules.browser_title', 'sites.index_module_srl');
$start_module = $oModuleModel->getSiteInfo(0, $columnList);
Context::set('start_module', $start_module);
Context::set('pwd', $pwd);
$this->setTemplateFile('config_general');
$security = new Security();
$security->encodeHTML('news..', 'released_version', 'download_link', 'selected_lang', 'module_list..', 'module_list..author..', 'addon_list..', 'addon_list..author..', 'start_module.');
}
示例4: loadLangSelected
/**
* Find selected languages to serve in the site
*
* @return array Selected languages
*/
function loadLangSelected()
{
static $lang_selected = null;
if (!$lang_selected) {
$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
if (!FileHandler::hasContent($selected_lang_file)) {
$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
}
if (!FileHandler::hasContent($selected_lang_file)) {
$buff = FileHandler::readFile($orig_lang_file);
FileHandler::writeFile($selected_lang_file, $buff);
$lang_selected = Context::loadLangSupported();
} else {
$langs = file($selected_lang_file);
foreach ($langs as $val) {
list($lang_prefix, $lang_text) = explode(',', $val);
$lang_text = trim($lang_text);
$lang_selected[$lang_prefix] = $lang_text;
}
}
}
return $lang_selected;
}
示例5: getLangCode
/**
* @brief Get values for a particular language code
* Return its corresponding value if lang_code is specified. Otherwise return $name.
*/
function getLangCode($site_srl, $name, $isFullLanguage = FALSE)
{
if ($isFullLanguage) {
$lang_supported = Context::loadLangSupported();
} else {
$lang_supported = Context::get('lang_supported');
}
if (substr($name, 0, 12) == '$user_lang->') {
$args = new stdClass();
$args->site_srl = (int) $site_srl;
$args->name = substr($name, 12);
$output = executeQueryArray('module.getLang', $args);
if ($output->data) {
foreach ($output->data as $key => $val) {
$selected_lang[$val->lang_code] = $val->value;
}
}
} else {
$tmp = unserialize($name);
if ($tmp) {
$selected_lang = array();
$rand_name = $tmp[Context::getLangType()];
if (!$rand_name) {
$rand_name = array_shift($tmp);
}
if (is_array($lang_supported)) {
foreach ($lang_supported as $key => $val) {
$selected_lang[$key] = $tmp[$key] ? $tmp[$key] : $rand_name;
}
}
}
}
$output = array();
if (is_array($lang_supported)) {
foreach ($lang_supported as $key => $val) {
$output[$key] = $selected_lang[$key] ? $selected_lang[$key] : $name;
}
}
return $output;
}
示例6: getFileAllContents
function getFileAllContents($translation_file_srl)
{
if (!$translation_file_srl) {
return;
}
$content_nodes = $this->getFileContentNodes($translation_file_srl);
// get supported language list
$lang_supported_list = Context::loadLangSupported();
$valueArr = array();
foreach ($content_nodes as $key => $val) {
$obj->content_node = $val->content_node;
$obj->translation_file_srl = $translation_file_srl;
foreach ($lang_supported_list as $lang_key => $lang_val) {
$obj->lang = $lang_key;
$value = $this->getRecommendValue($obj);
if ($value) {
$vArr['content_node'] = $obj->content_node;
$vArr['lang'] = $obj->lang;
$vArr['content'] = $value->content;
$vArr['is_new_lang'] = $value->is_new_lang;
array_push($valueArr, $vArr);
}
}
}
$file_info = $this->getFile($translation_file_srl);
$oXMLContext = new XMLContext($file_info->target_file, "en");
$xmlContents = $oXMLContext->getXmlFile($valueArr);
return $xmlContents;
}
示例7: dispAdminConfigGeneral
/**
* Display Configuration(settings) page
* @return void
*/
function dispAdminConfigGeneral()
{
Context::loadLang('modules/install/lang');
$db_info = Context::getDBInfo();
Context::set('selected_lang', $db_info->lang_type);
Context::set('default_url', $db_info->default_url);
Context::set('langs', Context::loadLangSupported());
Context::set('lang_selected', Context::loadLangSelected());
$admin_ip_list = preg_replace("/[,]+/", "\r\n", $db_info->admin_ip_list);
Context::set('admin_ip_list', $admin_ip_list);
$oAdminModel =& getAdminModel('admin');
$favicon_url = $oAdminModel->getFaviconUrl();
$mobicon_url = $oAdminModel->getMobileIconUrl();
Context::set('favicon_url', $favicon_url);
Context::set('mobicon_url', $mobicon_url);
$oDocumentModel =& getModel('document');
$config = $oDocumentModel->getDocumentConfig();
Context::set('thumbnail_type', $config->thumbnail_type);
Context::set('IP', $_SERVER['REMOTE_ADDR']);
$oModuleModel =& getModel('module');
$config = $oModuleModel->getModuleConfig('module');
Context::set('htmlFooter', $config->htmlFooter);
$columnList = array('modules.mid', 'modules.browser_title', 'sites.index_module_srl');
$start_module = $oModuleModel->getSiteInfo(0, $columnList);
Context::set('start_module', $start_module);
Context::set('pwd', $pwd);
$this->setTemplateFile('config_general');
$security = new Security();
$security->encodeHTML('news..', 'released_version', 'download_link', 'selected_lang', 'module_list..', 'module_list..author..', 'addon_list..', 'addon_list..author..', 'start_module.');
}
示例8: dispTranslationAdminInsertTranslation
/**
* @brief display insert translation admin page
**/
function dispTranslationAdminInsertTranslation()
{
if (!in_array($this->module_info->module, array('admin', 'translation'))) {
return $this->alertMessage('msg_invalid_request');
}
// get skin list
$oModuleModel =& getModel('module');
$skin_list = $oModuleModel->getSkins($this->module_path);
Context::set('skin_list', $skin_list);
// get layout list
$oLayoutModel =& getModel('layout');
$layout_list = $oLayoutModel->getLayoutList();
Context::set('layout_list', $layout_list);
// get supported language list
$lang_supported_list = Context::loadLangSupported();
Context::set('lang_supported_list', $lang_supported_list);
$this->setTemplateFile('translation_insert');
}
示例9: dispTransContent
function dispTransContent()
{
$fileSrl = Context::get('translation_file_srl') ? Context::get('translation_file_srl') : null;
$projSrl = Context::get('translation_project_srl') ? Context::get('translation_project_srl') : null;
$mid = Context::get('mid');
$oTransModel =& getModel('translation');
$sourceLang = Context::get('source_lang') ? Context::get('source_lang') : $this->module_info->default_lang;
$targetLang = Context::get('target_lang') ? Context::get('target_lang') : 'zh-CN';
Context::set('source_lang', $sourceLang);
Context::set('target_lang', $targetLang);
$listCount = Context::get('listCount') ? Context::get('listCount') : $this->listCount;
Context::set('listCount', $listCount);
$sortType = Context::get('listType') ? Context::get('listType') : 'translation_count';
Context::set('listType', $sortType);
//get the file Info
$fileInfo = $oTransModel->getFileInfo($fileSrl, $projSrl);
//get project info
if ($projSrl || $fileInfo) {
if ($projSrl) {
$projInfo = $oTransModel->getProjInfoBySrl(array($projSrl));
} else {
$f = current($fileInfo->data);
$projInfo = $oTransModel->getProjInfoBySrl(array($f->translation_project_srl));
}
if ($projInfo && $projInfo->data) {
Context::set('projInfo', $projInfo->data);
}
if (!$projSrl) {
Context::set('translation_project_srl', $projInfo->data->translation_project_srl);
}
}
//if has file_srl in the get params, need file_info to show in the page
if ($fileSrl) {
Context::set('fileInfo', current($fileInfo->data));
}
//get Source List
$page = Context::get('page');
if (!$page) {
Context::set('page', $page = 1);
}
$sourceList = $oTransModel->getSourceList($sourceLang, $targetLang, $fileSrl, $projSrl, $sortType, $listCount, $page, $this->pageCount);
Context::set('page_navigation', $sourceList->page_navigation);
if (empty($sourceList->data)) {
$sourceList->data = array();
}
//get other info :targetInfo, dictionary item
$contentNode = array();
foreach ($sourceList->data as $key => $dataObj) {
$contentNode[] = $dataObj->content_node;
$nodeContent[$dataObj->translation_content_srl] = $this->_removeSpecialTag($dataObj->content);
}
//get translation_content_srl
$targetList = $oTransModel->getTargetList($contentNode, $targetLang, $fileSrl, $projSrl);
//combine the target info,file info into the source
foreach ($sourceList->data as $key => &$obj) {
$obj->targetList = array();
$obj->content = $this->_removeSpecialTag($obj->content);
$obj->login_recommend = false;
if (!empty($targetList->data)) {
foreach ($targetList->data as $key2 => &$obj2) {
if ($obj2->content) {
$obj2->content = $this->_removeSpecialTag($obj2->content);
}
if ($obj->content_node == $obj2->content_node && $obj->translation_file_srl == $obj2->translation_file_srl) {
// check whether the target content has been recommended by login user
$obj2->login_recommend = false;
$recommended_member = explode(':', $obj2->recommended_member);
$logged_info = Context::get('logged_info');
if (in_array($logged_info->member_srl, $recommended_member)) {
$obj->login_recommend = true;
$obj2->login_recommend = true;
}
$obj->targetList[] = $obj2;
if ($obj2->is_original) {
$obj->targetListTop = $obj2;
}
}
}
}
if (!$obj->targetListTop && count($obj->targetList) > 0) {
$obj->targetListTop = $obj->targetList[0];
}
$obj->fileInfo = null;
if (!empty($fileInfo->data)) {
foreach ($fileInfo->data as $key3 => $obj3) {
if ($obj->translation_file_srl == $obj3->translation_file_srl) {
$obj->fileInfo = $obj3;
break;
}
}
}
$obj->content_node = preg_replace('/\\//', '>', $obj->content_node);
}
Context::set('sourceList', $sourceList->data);
$url = getUrl('', 'mid', $mid, 'act', Context::get('act'), 'translation_project_srl', $projSrl, 'translation_file_srl', $fileSrl, 'source_lang', $sourceLang, 'target_lang', $targetLang, 'listType', $sortType);
Context::set('listUrl', $url);
// get supported language list
$lang_supported_list = Context::loadLangSupported();
Context::set('lang_supported_list', $lang_supported_list);
$this->setTemplateFile('file_content');
//.........这里部分代码省略.........
示例10: dispAdminConfig
/**
* @brief 관리자 설정
**/
function dispAdminConfig()
{
$db_info = Context::getDBInfo();
Context::set('selected_lang', $db_info->lang_type);
Context::set('default_url', $db_info->default_url);
Context::set('langs', Context::loadLangSupported());
Context::set('lang_selected', Context::loadLangSelected());
Context::set('ftp_info', Context::getFTPInfo());
$site_args->site_srl = 0;
$output = executeQuery('module.getSiteInfo', $site_args);
Context::set('start_module', $output->data);
Context::set('layout', 'none');
$this->setTemplateFile('config');
}