本文整理汇总了PHP中context::set方法的典型用法代码示例。如果您正苦于以下问题:PHP context::set方法的具体用法?PHP context::set怎么用?PHP context::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类context
的用法示例。
在下文中一共展示了context::set方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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.');
}
示例2: dispAdminConfigSecurity
/**
* Display Security Settings page
* @return void
*/
function dispAdminConfigSecurity()
{
// Load embed filter.
context::set('mediafilter_iframe', implode(PHP_EOL, Rhymix\Framework\Filters\MediaFilter::getIframeWhitelist()));
context::set('mediafilter_object', implode(PHP_EOL, Rhymix\Framework\Filters\MediaFilter::getObjectWhitelist()));
// Admin IP access control
$allowed_ip = Rhymix\Framework\Config::get('admin.allow');
Context::set('admin_allowed_ip', implode(PHP_EOL, $allowed_ip));
$denied_ip = Rhymix\Framework\Config::get('admin.deny');
Context::set('admin_denied_ip', implode(PHP_EOL, $denied_ip));
Context::set('remote_addr', RX_CLIENT_IP);
$this->setTemplateFile('config_security');
}
示例3: set
public static function set($key, $value, $to_context = false)
{
if ($to_context) {
context::set($key, $value);
} else {
self::$vars[$key] = html::escape($value);
}
}
示例4: dispIssuetrackerViewSource
/**
* @brief 소스 브라우징
**/
function dispIssuetrackerViewSource()
{
// 접근 권한 체크
if (!$this->grant->browser_source || !$this->module_info->svn_url) {
return $this->dispIssuetrackerMessage('msg_not_permitted');
}
require_once $this->module_path . 'classes/svn.class.php';
$path = urldecode(Context::get('path'));
if (!$path) {
$path = '/';
}
Context::set('path', $path);
$revs = Context::get('revs');
$erev = Context::get('erev');
$brev = Context::get('brev');
$oSvn = new Svn($this->module_info->svn_url, $this->module_info->svn_cmd);
$current = $oSvn->getStatus($path);
Context::set('current', $current);
$type = Context::get('type');
switch ($type) {
case 'diff':
case 'compare':
$comp = $oSvn->getComp($path, $brev, $erev);
Context::set('comp', $comp);
$path_tree = Svn::explodePath($path, true);
Context::set('path_tree', $path_tree);
$this->setTemplateFile('source_compare');
break;
case 'log':
if (!$erev) {
$erev = $current->revision;
}
$logs = $oSvn->getLog($path, $erev, $brev, false, 50);
Context::set('logs', $logs);
if (!$erev) {
$erev = $current->erev;
}
context::set('erev', $erev);
context::set('brev', $brev);
$path_tree = Svn::explodePath($path, true);
Context::set('path_tree', $path_tree);
$this->setTemplateFile('source_log');
break;
case 'file':
if ($revs) {
$erev = $revs;
}
if (!$erev) {
$erev = $current->revision;
}
$content = $oSvn->getFileContent($path, $erev);
Context::set('content', $content);
$logs = $oSvn->getLog($path, $erev, $brev, false, 2);
$erev = $logs[0]->revision;
$brev = $logs[1]->revision;
context::set('erev', $erev);
context::set('brev', $brev);
$path_tree = Svn::explodePath($path, true);
Context::set('path_tree', $path_tree);
$file_name = array_pop(array_keys($path_tree));
$file_ext = array_pop(explode(".", $file_name));
$extlist = array("document" => array("doc", "pdf", "hwp"), "image" => array("jpg", "jpeg", "jpe", "gif", "png", "bmp"), "sound" => array("mp3", "ogg", "wma", "wav"), "movie" => array("avi", "mpg", "mpeg", "mpe", "wmv", "asf", "asx", "mov", "flv", "swf"));
foreach ($extlist as $key => $exts) {
foreach ($exts as $s_key => $ext) {
if (!strcasecmp($file_ext, $ext)) {
$file_type = $key;
break 2;
}
}
}
if (!$file_type) {
$file_type = "code";
$extToLang = array("h" => "Cpp", "cpp" => "Cpp", "csharp" => "CSharp", "css" => "Css", "html" => "Xml", "sql" => "Sql", "java" => "Java", "py" => "Python", "rb" => "Ruby", "js" => "JScript", "c" => "Cpp", "vb" => "Vb", "xml" => "Xml", "php" => "Php");
$file_ext_tmp = strtolower($file_ext);
if ($extToLang[$file_ext_tmp]) {
$file_ext = $extToLang[$file_ext_tmp];
}
if (file_exists("./common/js/plugins/code_highlighter/script/shBrush" . $file_ext . ".js")) {
Context::loadJavascriptPlugin("code_highlighter");
Context::addJsFile('./common/js/plugins/code_highlighter/script/shBrush' . $file_ext . '.js', false);
$js_code = <<<dpScript
<script type="text/javascript">
SyntaxHighlighter.config.clipboardSwf = './modules/editor/components/code_highlighter/script/clipboard.swf';
SyntaxHighlighter.all();
</script>
dpScript;
Context::addHtmlFooter($js_code);
Context::set('file_ext', $file_ext_tmp);
}
}
Context::set('file_type', $file_type);
$this->setTemplateFile('source_file_view');
break;
default:
$path_tree = Svn::explodePath($path, false);
Context::set('path_tree', $path_tree);
$list = $oSvn->getList($path, $revs);
//.........这里部分代码省略.........
示例5: dispAdminConfigSecurity
/**
* Display Security Settings page
* @return void
*/
function dispAdminConfigSecurity()
{
// Load embed filter.
$oEmbedFilter = EmbedFilter::getInstance();
context::set('embedfilter_iframe', implode(PHP_EOL, $oEmbedFilter->whiteIframeUrlList));
context::set('embedfilter_object', implode(PHP_EOL, $oEmbedFilter->whiteUrlList));
// Admin IP access control
$allowed_ip = Rhymix\Framework\Config::get('admin.allow');
Context::set('admin_allowed_ip', implode(PHP_EOL, $allowed_ip));
$denied_ip = Rhymix\Framework\Config::get('admin.deny');
Context::set('admin_denied_ip', implode(PHP_EOL, $denied_ip));
Context::set('remote_addr', RX_CLIENT_IP);
$this->setTemplateFile('config_security');
}