本文整理汇总了PHP中Context::getLangType方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getLangType方法的具体用法?PHP Context::getLangType怎么用?PHP Context::getLangType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context::getLangType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printBtn
/**
* @brief Button to output
**/
function printBtn()
{
if ($this->nextUrl) {
$url = $this->nextUrl;
printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n");
}
if ($this->prevUrl) {
$url = $this->prevUrl;
printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n");
}
// Select Language
if (!parent::isLangChange()) {
$url = getUrl('', 'lcm', '1', 'sel_lang', Context::getLangType(), 'return_uri', Context::get('current_url'));
printf('<a href="%s">%s</a><br>%s', $url, 'Language : ' . Context::getLang('select_lang'), "\n");
} else {
printf('<a href="%s">%s</a><br>%s', Context::get('return_uri'), Context::getLang('lang_return'), "\n");
}
if ($this->upperUrl) {
$url = $this->upperUrl;
printf('<btn href="%s" name="%s">%s', $url->url, $url->text, "\n");
}
if ($this->homeUrl) {
$url = $this->homeUrl;
printf('<a btn="%s" href="%s">%s</a><br>%s', $url->text, $url->url, $url->text, "\n");
}
}
示例2: dispInstallIntroduce
/**
* @brief Display license messages
*/
function dispInstallIntroduce()
{
$install_config_file = FileHandler::getRealPath('./config/install.config.php');
if (file_exists($install_config_file)) {
include $install_config_file;
if (is_array($install_config)) {
foreach ($install_config as $k => $v) {
$v = $k == 'db_table_prefix' ? $v . '_' : $v;
Context::set($k, $v, true);
}
unset($GLOBALS['__DB__']);
Context::set('install_config', true, true);
$oInstallController = getController('install');
$output = $oInstallController->procInstall();
if (!$output->toBool()) {
return $output;
}
header("location: ./");
Context::close();
exit;
}
}
Context::set('l', Context::getLangType());
$this->setTemplateFile('introduce');
}
示例3: _getWidgetContent
function _getWidgetContent()
{
// Arrange a widget ryeolro
if ($this->module_info->mcontent) {
$cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$interval = (int) $this->module_info->page_caching_interval;
if ($interval > 0) {
if (!file_exists($cache_file) || filesize($cache_file) < 1) {
$mtime = 0;
} else {
$mtime = filemtime($cache_file);
}
if ($mtime + $interval * 60 > $_SERVER['REQUEST_TIME']) {
$page_content = FileHandler::readFile($cache_file);
$page_content = preg_replace('@<\\!--#Meta:@', '<!--Meta:', $page_content);
} else {
$oWidgetController = getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if (file_exists($cache_file)) {
FileHandler::removeFile($cache_file);
}
$page_content = $this->module_info->mcontent;
}
} else {
$page_content = $this->module_info->content;
}
return $page_content;
}
示例4: _getWidgetContent
function _getWidgetContent()
{
// Arrange a widget ryeolro
if ($this->module_info->mcontent) {
$cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$interval = (int) $this->module_info->page_caching_interval;
if ($interval > 0) {
if (!file_exists($cache_file) || filesize($cache_file) < 1) {
$mtime = 0;
} else {
$mtime = filemtime($cache_file);
}
if ($mtime + $interval * 60 > time()) {
$page_content = FileHandler::readFile($cache_file);
$page_content = preg_replace('@<\\!--#Meta:@', '<!--Meta:', $page_content);
} else {
$oWidgetController =& getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if (file_exists($cache_file)) {
FileHandler::removeFile($cache_file);
}
$page_content = $this->module_info->mcontent;
}
} else {
preg_match_all('!(<img)([^\\>]*)(widget=)([^\\>]*?)(\\>)!is', $this->module_info->content, $matches);
$page_content = '';
for ($i = 0, $c = count($matches[0]); $i < $c; $i++) {
$page_content .= preg_replace('/ style\\=\\"([^\\"]+)\\" /i', ' style="overflow:hidden;clear:both;margin:0 0 20px 0; _margin-right:10px;" ', $matches[0][$i]) . "\n\n";
}
}
return $page_content;
}
示例5: printBtn
/**
* @brief 버튼을 출력함
**/
function printBtn()
{
if ($this->nextUrl) {
$url = $this->nextUrl;
printf('<do type="vnd.next" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
}
if ($this->prevUrl) {
$url = $this->prevUrl;
printf('<do type="vnd.prev" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
}
// 기타 해당사항 없는 버튼 출력 담당 (array로 전달) type??
if ($this->etcBtn) {
if (is_array($this->etcBtn)) {
foreach ($this->etcBtn as $key => $val) {
printf('<do type="vnd.btn%s" label="%s"><go href="%s"/></do>%s', $key, $val['text'], $val['url'], "\n");
}
}
}
// 언어선택
if (!parent::isLangChange()) {
$url = getUrl('', 'lcm', '1', 'sel_lang', Context::getLangType(), 'return_uri', Context::get('current_url'));
printf('<do type="vnd.lang" label="%s"><go href="%s"/></do>%s', 'Language : ' . Context::getLang('select_lang'), $url, "\n");
} else {
printf('<do type="vnd.lang" label="%s"><go href="%s"/></do>%s', Context::getLang('lang_return'), Context::get('return_uri'), "\n");
}
if ($this->homeUrl) {
$url = $this->homeUrl;
printf('<do type="access" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
}
if ($this->upperUrl) {
$url = $this->upperUrl;
printf('<do type="vnd.up" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
}
}
示例6: dispPageIndex
/**
* @brief 일반 요청시 출력
**/
function dispPageIndex()
{
// 템플릿에서 사용할 변수를 Context::set()
if ($this->module_srl) {
Context::set('module_srl', $this->module_srl);
}
// 캐시 파일 지정
$cache_file = sprintf("%sfiles/cache/page/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$interval = (int) $this->module_info->page_caching_interval;
if ($interval > 0) {
if (!file_exists($cache_file)) {
$mtime = 0;
} else {
$mtime = filemtime($cache_file);
}
if ($mtime + $interval * 60 > time()) {
$page_content = FileHandler::readFile($cache_file);
} else {
$oWidgetController =& getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->content);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if (file_exists($cache_file)) {
FileHandler::removeFile($cache_file);
}
$page_content = $this->module_info->content;
}
Context::set('module_info', $this->module_info);
Context::set('page_content', $page_content);
$this->setTemplateFile('content');
}
示例7: printBtn
/**
* @brief Button to output
*/
function printBtn()
{
if ($this->nextUrl) {
$url = $this->nextUrl;
printf('<do type="vnd.next" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
}
if ($this->prevUrl) {
$url = $this->prevUrl;
printf('<do type="vnd.prev" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
}
// Others are not applicable in charge of the button output (array passed) type??
if ($this->etcBtn) {
if (is_array($this->etcBtn)) {
foreach ($this->etcBtn as $key => $val) {
printf('<do type="vnd.btn%s" label="%s"><go href="%s"/></do>%s', $key, $val['text'], $val['url'], "\n");
}
}
}
// Select Language
if (!parent::isLangChange()) {
$url = getUrl('', 'lcm', '1', 'sel_lang', Context::getLangType(), 'return_uri', Context::get('current_url'));
printf('<do type="vnd.lang" label="%s"><go href="%s"/></do>%s', 'Language : ' . lang('select_lang'), $url, "\n");
} else {
printf('<do type="vnd.lang" label="%s"><go href="%s"/></do>%s', lang('lang_return'), Context::get('return_uri'), "\n");
}
if ($this->homeUrl) {
$url = $this->homeUrl;
printf('<do type="access" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
}
if ($this->upperUrl) {
$url = $this->upperUrl;
printf('<do type="vnd.up" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
}
}
示例8: transHTML
/**
* @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method
*
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
**/
function transHTML($xml_obj)
{
// 지정된 옵션을 구함
$ccl_title = $xml_obj->attrs->ccl_title;
$ccl_use_mark = $xml_obj->attrs->ccl_use_mark;
$ccl_allow_commercial = $xml_obj->attrs->ccl_allow_commercial;
$ccl_allow_modification = $xml_obj->attrs->ccl_allow_modification;
// 가로/ 세로 크기를 구함
preg_match_all('/(width|height)([^[:digit:]]+)([^;^"^\']*)/i', $xml_obj->attrs->style, $matches);
$width = trim($matches[3][0]);
if (!$width) {
$width = "90%";
}
$height = trim($matches[3][1]);
if (!$height) {
$height = "50";
}
// 언어파일을 읽음
Context::loadLang($this->component_path . '/lang');
$default_title = Context::getLang('ccl_default_title');
if (!$ccl_title) {
$ccl_title = $default_title;
}
$default_message = Context::getLang('ccl_default_message');
$option = Context::getLang('ccl_options');
// 영리 이용 체크
if ($ccl_allow_commercial == 'N') {
$opt1 = '-nc';
} else {
$opt1 = '';
}
// 수정 표시 체크
if ($ccl_allow_modification == 'N') {
$opt2 = '-nd';
} elseif ($ccl_allow_modification == 'SA') {
$opt2 = '-sa';
} else {
$opt2 = '';
}
// 버전
$version = '/3.0';
// 언어에 따른 설정
$lang_type = Context::getLangType();
if ($lang_type != 'en') {
$lang_file = 'deed.' . strtolower($lang_file);
}
// 마크 이용시
$ccl_image = '';
if ($ccl_use_mark == "Y") {
$ccl_image = sprintf('
<a rel="license" href="http://creativecommons.org/licenses/by%s%s%s" onclick="window.open(this.href); return false;"><img src="http://i.creativecommons.org/l/by%s%s%s/88x31.png" alt="Creative Commons License" style="margin-bottom:5px;border:0;" /></a><br />', $opt1, $opt2, $version, $opt1, $opt2, $version);
}
// 결과물 생성
$text = $ccl_image . sprintf($default_message, $opt1, $opt2, $version, '', $ccl_title, $option['ccl_allow_commercial'][$ccl_allow_commercial], $option['ccl_allow_modification'][$ccl_allow_modification], $version);
$style = sprintf('<style type="text/css">.cc_license { clear:both; margin:20px auto 20px auto; padding:8px; width:%s;border:1px solid #c0c0c0; color:#808080; text-align:center; } .cc_license legend { font-weight:bold; } .cc_license a { color:#404040; text-decoration:none; } .cc_license a:hover { text-decoration:underline; </style>', $width);
$output = sprintf('%s<fieldset class="cc_license"><legend>%s</legend>%s</fieldset>', $style, $ccl_title, $text);
return $output;
}
示例9: lang
/**
* Get or set lang variable.
*
* @param string $code Lang variable name
* @param string $value `$code`s value
* @return mixed
*/
function lang($code, $value = null)
{
if (!$GLOBALS['lang'] instanceof Rhymix\Framework\Lang) {
$GLOBALS['lang'] = Rhymix\Framework\Lang::getInstance(Context::getLangType() ?: config('locale.default_lang') ?: 'ko');
$GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common');
}
if ($value === null) {
return $GLOBALS['lang']->get($code);
} else {
$GLOBALS['lang']->set($code, $value);
}
}
示例10: init
/**
* @brief Initialization
*/
function init()
{
// Get a template path (page in the administrative template tpl putting together)
$this->setTemplatePath($this->module_path . 'tpl');
switch ($this->module_info->page_type) {
case 'WIDGET':
$this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus());
$this->interval = (int) $this->module_info->page_caching_interval;
break;
case 'OUTSIDE':
$this->cache_file = sprintf("%sfiles/cache/opage/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getSslStatus());
$this->interval = (int) $this->module_info->page_caching_interval;
$this->path = $this->module_info->path;
break;
}
}
示例11: dispInstallIntroduce
/**
* @brief Display license messages
*/
function dispInstallIntroduce()
{
$install_config_file = FileHandler::getRealPath('./config/install.config.php');
if (file_exists($install_config_file)) {
/**
* If './config/install.config.php' file created and write array shown in the example below, XE installed using config file.
* ex )
$install_config = array(
'db_type' =>'mysqli_innodb',
'db_port' =>'3306',
'db_hostname' =>'localhost',
'db_userid' =>'root',
'db_password' =>'root',
'db_database' =>'xe_database',
'db_table_prefix' =>'xe',
'user_rewrite' =>'N',
'time_zone' =>'0000',
'email_address' =>'admin@xe.com',
'password' =>'pass',
'password2' =>'pass',
'nick_name' =>'admin',
'user_id' =>'admin',
'lang_type' =>'ko', // en, jp, ...
);
*/
include $install_config_file;
if (is_array($install_config)) {
foreach ($install_config as $k => $v) {
$v = $k == 'db_table_prefix' ? $v . '_' : $v;
Context::set($k, $v, true);
}
unset($GLOBALS['__DB__']);
Context::set('install_config', true, true);
$oInstallController = getController('install');
$output = $oInstallController->procInstall();
if (!$output->toBool()) {
return $output;
}
header("location: ./");
Context::close();
exit;
}
}
Context::set('l', Context::getLangType());
$this->setTemplateFile('introduce');
}
示例12: procInstall
/**
* @brief 입력받은 정보로 설치를 함
**/
function procInstall()
{
// 설치가 되어 있는지에 대한 체크
if (Context::isInstalled()) {
return new Object(-1, 'msg_already_installed');
}
// 설치시 임시로 최고관리자로 지정
$logged_info->is_admin = 'Y';
$_SESSION['logged_info'] = $logged_info;
Context::set('logged_info', $logged_info);
// DB와 관련된 변수를 받음
$db_info = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix', 'time_zone', 'use_rewrite');
if ($db_info->use_rewrite != 'Y') {
$db_info->use_rewrite = 'N';
}
if (!$db_info->default_url) {
$db_info->default_url = Context::getRequestUri();
}
$db_info->lang_type = Context::getLangType();
// DB의 타입과 정보를 등록
Context::setDBInfo($db_info);
// DB Instance 생성
$oDB =& DB::getInstance();
// DB접속이 가능한지 체크
$output = $oDB->getError();
if (!$oDB->isConnected()) {
return $oDB->getError();
}
// firebird는 설치시에 트랜젝션을 사용하지 않음
if ($db_info->db_type != "firebird") {
$oDB->begin();
}
// 모든 모듈의 설치
$this->installDownloadedModule();
if ($db_info->db_type != "firebird") {
$oDB->commit();
}
// config 파일 생성
if (!$this->makeConfigFile()) {
return new Object(-1, 'msg_install_failed');
}
// 설치 완료 메세지 출력
$this->setMessage('msg_install_completed');
}
示例13: parse
/**
* Parse xml data to extract values from it and construct data object
* @param string $input a data buffer containing xml data
* @param mixed $arg1 ???
* @param mixed $arg2 ???
* @return array Returns a resultant data object or NULL in case of error
*/
function parse($input = '', $arg1 = NULL, $arg2 = NULL)
{
// Save the compile starting time for debugging
if (__DEBUG__ == 3) {
$start = getMicroTime();
}
$this->lang = Context::getLangType();
$this->input = $input ? $input : $GLOBALS['HTTP_RAW_POST_DATA'];
$this->input = str_replace(array('', ''), array('', ''), $this->input);
// extracts a supported language
preg_match_all("/xml:lang=\"([^\"].+)\"/i", $this->input, $matches);
// extracts the supported lanuage when xml:lang is used
if (count($matches[1]) && ($supported_lang = array_unique($matches[1]))) {
$tmpLangList = array_flip($supported_lang);
// if lang of the first log-in user doesn't exist, apply en by default if exists. Otherwise apply the first lang.
if (!isset($tmpLangList[$this->lang])) {
if (isset($tmpLangList['en'])) {
$this->lang = 'en';
} else {
$this->lang = array_shift($supported_lang);
}
}
// uncheck the language if no specific language is set.
} else {
$this->lang = '';
}
$this->oParser = xml_parser_create('UTF-8');
xml_set_object($this->oParser, $this);
xml_set_element_handler($this->oParser, "_tagOpen", "_tagClosed");
xml_set_character_data_handler($this->oParser, "_tagBody");
xml_parse($this->oParser, $this->input);
xml_parser_free($this->oParser);
if (!count($this->output)) {
return;
}
$output = array_shift($this->output);
// Save compile starting time for debugging
if (__DEBUG__ == 3) {
$GLOBALS['__xmlparse_elapsed__'] += getMicroTime() - $start;
}
return $output;
}
示例14: procMagiccontentSetup
function procMagiccontentSetup()
{
$req = Context::getRequestVars();
$widget_sequence = $req->widget_sequence;
$is_complete = $req->is_complete;
unset($req->is_complete);
unset($req->widget_sequence);
unset($req->act);
foreach ($req as $key => $value) {
if ($value == '') {
unset($req->{$key});
}
}
$serialize_data = serialize($req);
$args = new stdClass();
$args->data = $serialize_data;
$args->widget_sequence = $widget_sequence;
$args->is_complete = $is_complete;
if ($is_complete == 1) {
$dargs = new stdClass();
$dargs->widget_sequence = $widget_sequence;
$dargs->is_complete = 0;
$output = executeQuery('magiccontent.deleteMagicContentData', $dargs);
}
$oMagiccontentModel =& getModel('magiccontent');
if ($oMagiccontentModel->getSetupData($widget_sequence, $is_complete) === false) {
$args->data_srl = getNextSequence();
$output = executeQuery('magiccontent.insertMagicContentData', $args);
} else {
$output = executeQuery('magiccontent.updateMagicContentData', $args);
}
$oCacheHandler = CacheHandler::getInstance('template');
if ($oCacheHandler->isSupport()) {
$key = 'widget_cache:' . $widget_sequence;
$oCacheHandler->delete($key);
}
$lang_type = Context::getLangType();
$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $widget_sequence, $lang_type);
FileHandler::removeFile($cache_file);
return new Object(0, 'success');
}
示例15: getLang
function getLang($key, $site_srl)
{
if (!$this->langs[$site_srl]) {
$this->langs[$site_srl] = array();
$args = new stdClass();
$args->site_srl = $site_srl;
$args->lang_code = Context::getLangType();
$output = executeQueryArray("syndication.getLang", $args);
if (!$output->toBool() || !$output->data) {
return $key;
}
foreach ($output->data as $value) {
$this->langs[$site_srl][$value->name] = $value->value;
}
}
if ($this->langs[$site_srl][$key]) {
return $this->langs[$site_srl][$key];
} else {
return $key;
}
}