本文整理汇总了PHP中ConfigManager::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::get方法的具体用法?PHP ConfigManager::get怎么用?PHP ConfigManager::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
/**
* 引导启动服务
* @param Application $app
* @throws Exception\BootstrapException
*/
public static function start(Application $app)
{
self::$_app = $app;
//设置时区
$timeZone = ConfigManager::get('timezone');
date_default_timezone_set($timeZone);
self::$_app->run();
}
示例2: smarty_block_box
/**
* Smarty {box}{/box} block plugin
*
* Type: block function<br>
* Name: box<br>
* Purpose: Generate the HTML structure needed for boxes<br>
*
* @param array
* <pre>
* Params: id: string
* tag: string (div)
* class: string
* </pre>
* @param string contents of the block
* @param Smarty clever simulation of a method
* @return string string $content re-formatted
*/
function smarty_block_box($params, $content, &$smarty)
{
$null = NULL;
$placement = any($params["placement"], "default");
$type = any($params["type"], ConfigManager::get("page.box.placements.{$placement}.type"), "default");
$typecfg = any(ConfigManager::get("page.box.types.{$type}"), array());
$placementcfg = any(ConfigManager::get("page.box.placements.{$placement}"), array());
$typecfg["template"] = any($params["template"], $typecfg["template"], "box_default.tpl");
$params = array_merge(any($params, array()), any($typecfg["params"], array()), any($placementcfg["params"], array()));
$vars["box"] = $box = new stdClass();
$vars["box"]->content = !empty($content) ? $content : "";
$vars["box"]->tag = !empty($params["tag"]) ? $params["tag"] : "div";
$vars["box"]->id = !empty($params["id"]) ? $params["id"] : NULL;
$vars["box"]->class = !empty($params["class"]) ? $params["class"] : NULL;
$vars["box"]->onmouseover = !empty($params["onmouseover"]) ? $params["onmouseover"] : NULL;
$vars["box"]->onmouseout = !empty($params["onmouseout"]) ? $params["onmouseout"] : NULL;
$vars["box"]->onclick = !empty($params["onclick"]) ? $params["onclick"] : NULL;
if ($smarty->template_exists("boxes/{$typecfg["template"]}")) {
return $smarty->GetTemplate("boxes/{$typecfg["template"]}", $null, $vars);
} else {
return '<' . $box->tag . (!empty($box->id) ? ' id="' . $box->id . '"' : '') . (!empty($box->class) ? ' class="' . $box->class . '"' : '') . (!empty($box->onmouseover) ? ' onmouseover="' . $box->onmouseover . '"' : '') . (!empty($box->onmouseout) ? ' onmouseout="' . $box->onmouseout . '"' : '') . (!empty($box->onclick) ? ' onclick="' . $box->onclick . '"' : '') . '>' . $box->content . '</' . $box->tag . '>';
}
}
示例3: smarty_function_getcfg
/**
* Smarty {printpre} plugin
*
* Type: function<br>
* Name: printpre<br>
* Purpose: Print a dump of the requested variable
*
* @author James Baicoianu
* @param array
* @param Smarty
* @return string|null if the assign parameter is passed, Smarty assigns the
* result to a template variable
*/
function smarty_function_getcfg($args, &$smarty)
{
$ret = ConfigManager::get($args["config"]);
return $ret;
}
示例4: ApplyConfigOverrides
function ApplyConfigOverrides()
{
if (!empty($this->request["args"]["sitecfg"])) {
$tmpcfg = array();
array_set_multi($tmpcfg, $this->request["args"]["sitecfg"]);
// FIXME - can't we just array_set_multi() on $this->sitecfg directly?
ConfigManager::merge($tmpcfg);
}
if (!empty($this->request["args"]["cobrandoverride"])) {
$included_config =& $this->cfg->GetConfig($this->request["args"]["cobrandoverride"], false, $this->cfg->role);
if (!empty($included_config)) {
ConfigManager::merge($included_config);
}
}
$rolename = any($this->request["args"]["_role"], $this->cfg->role);
$rolecfg = ConfigManager::get("roles.{$rolename}.options");
if (!empty($rolecfg)) {
Logger::Info("Using overridden role cfg 'roles.{$rolename}'");
ConfigManager::merge($rolecfg);
}
if ($this->request["ssl"]) {
$included_config = $this->cfg->GetConfig("classes.secure", false, $this->cfg->role);
if (!empty($included_config)) {
ConfigManager::merge($included_config);
}
}
$browseroverride = any($this->request["args"]["sess"]["browser.override"], $_SESSION["temporary"]["user"]["preferences"]["browser"]["override"], NULL);
if ($browseroverride !== NULL) {
$this->request["browser"] = $browseroverride;
}
if (!empty($this->request["browser"])) {
$included_config =& ConfigManager::get("browsers.{$this->request['browser']}.options");
if (!empty($included_config["include"])) {
// These includes sure do get hairy. This allows for browsers.*.options.include to call in different classes
$includes = explode(",", $included_config["include"]);
foreach ($includes as $include) {
$subincluded_config =& $this->cfg->GetConfig($include, false, $this->cfg->role);
if (!empty($subincluded_config)) {
ConfigManager::merge($subincluded_config);
}
}
unset($included_config["include"]);
}
if (!empty($included_config)) {
ConfigManager::merge($included_config);
}
}
if ($this->debug) {
$subincluded_config =& $this->cfg->GetConfig("classes.debug", false, $this->cfg->role);
if (!empty($subincluded_config)) {
ConfigManager::merge($subincluded_config);
}
}
}
示例5: controller_404
public function controller_404($args, $output = "inline")
{
if ($output == "inline") {
$componentname = any(ConfigManager::get("page.missing"), NULL);
} else {
$componentname = any(ConfigManager::get("page.404"), NULL);
}
if (!empty($componentname)) {
return ComponentManager::fetch($componentname, $args, $output);
}
return $this->GetComponentResponse("./404.tpl", $args);
}
示例6: controller_index
function controller_index($args, $output = "inline")
{
$vars["args"] = $args;
$vars["contentcomponent"] = any(ConfigManager::get("page.default"), "elation");
return $this->GetComponentResponse("./index.tpl", $vars);
}
示例7: getOutput
function getOutput($type)
{
$ret = array("text/html", NULL);
$tplmgr = TemplateManager::singleton();
switch ($type) {
case 'ajax':
$ret = array("application/xml", $tplmgr->GenerateXML($this->data));
break;
case 'json':
case 'jsonp':
$jsonp = any($_REQUEST["jsonp"], "elation.ajax.processResponse");
//$ret = array("application/javascript", $jsonp . "(" . json_encode($this->data) . ");");
$ret = array("application/javascript", $tplmgr->GenerateJavascript($this->data, $jsonp));
break;
case 'js':
$ret = array("application/javascript", @json_encode($this) . "\n");
break;
case 'jsi':
$ret = array("application/javascript", json_indent(@json_encode($this)) . "\n");
break;
case 'txt':
$ret = array("text/plain", $tplmgr->GenerateHTML($tplmgr->GetTemplate($this->template, NULL, $this->data)));
break;
case 'xml':
$ret = array("application/xml", object_to_xml($this, "response"));
break;
case 'data':
$ret = array("", $this->data);
break;
case 'componentresponse':
$ret = array("", $this);
break;
case 'popup':
// Popup is same as HTML, but we only use the bare-minimum html.page frame
$vars["content"] = $this;
$ret = array("text/html", ComponentManager::fetch("html.page", $vars, "inline"));
break;
case 'snip':
case 'inline':
case 'commandline':
$ret = array("text/html", $tplmgr->GetTemplate($this->template, NULL, $this->data));
break;
case 'html':
case 'fhtml':
default:
$cfg = ConfigManager::singleton();
$framecomponent = any(ConfigManager::get("page.frame"), array_get($cfg->servers, "page.frame"), "html.page");
// If framecomponent is false/0, just return the raw content
$ret = array("text/html", empty($framecomponent) ? $this->data["content"] : ComponentManager::fetch($framecomponent, array("content" => $this), "inline"));
//$ret = array("text/html", $tplmgr->GetTemplate($this->template, NULL, $this->data));
break;
}
if (!empty($this->prefix)) {
$ret[1] = $this->prefix . $ret[1];
}
return $ret;
}
示例8: controller_paneledit
function controller_paneledit($args)
{
if (!empty($args["panel"])) {
$vars["panel"] = $args["panel"];
$vars["panelcfg"] = ConfigManager::get("panels.types.{$args["panel"]}");
}
return $this->GetTemplate("./paneledit.tpl", $vars);
}
示例9: hook_launch_plugin_render_tools
/**
* Add plugin settings to the tool page.
*
* @param array $data data passed to the plugin.
* @param ConfigManager $conf instance.
*
* @return array updated data.
*/
function hook_launch_plugin_render_tools($data, $conf)
{
$menu = $conf->get('plugins.LAUNCH_CUSTOM_MENU');
$tplVar = array('SUBTITLE' => $conf->get('plugins.LAUNCH_SUBTITLE', ''), 'HORIZONTAL_CHECKED' => $conf->get('plugins.LAUNCH_HORIZONTAL_MENU', false) ? 'checked="checked"' : '', 'OVERRIDE_VERTICAL' => $conf->get('plugins.LAUNCH_OVERRIDE_VERTICAL', false) ? 'checked="checked"' : '', 'CUSTOM_MENU' => !empty($menu) ? json_encode($menu, JSON_PRETTY_PRINT) : '');
$tpl = file_get_contents(PluginManager::$PLUGINS_PATH . '/launch_plugin/tools.html');
$tpl = replace_tpl_var($tpl, $tplVar);
$data['tools_plugin'][] = $tpl;
return $data;
}
示例10: conf
function conf($key)
{
return ConfigManager::get($key);
}
示例11: controller_footer
public function controller_footer($args)
{
// Assemble page-level args for Google Analytics --
global $webapp;
$analytics = Analytics::singleton();
$componentmgr = ComponentManager::singleton();
$args['cobrand'] = $webapp->cobrand;
$args['store_name'] = $this->sanitizeStrForGA($analytics->store_name);
if ($webapp->request['referer']['host'] && !stristr($webapp->request['referer']['host'], $webapp->request['host'])) {
$args['query'] = $this->getQueryFromURL($webapp->request['referrer'], $args['store_name']);
} else {
$args['query'] = $this->sanitizeStrForGA(any($analytics->search["input"]["query"], $analytics->qpmreq->query, 'none'));
}
$args['bs'] = $componentmgr->pagecfg;
//testing
$args['pagegroup'] = $componentmgr->pagecfg['pagegroup'];
$args['pagetype'] = $componentmgr->pagecfg['pagename'];
$args['status'] = any($analytics->status, $webapp->response['http_status']);
$args['total'] = $analytics->total;
$args['GAenabled'] = $args['pagegroup'] ? any(ConfigManager::get("tracking.googleanalytics.enabled"), $webapp->cfg->servers['tracking']['googleanalytics']['enabled']) : 0;
$args['GAalerts'] = $webapp->GAalerts;
$args['trackingcode'] = any(ConfigManager::get("tracking.googleanalytics.trackingcode"), $webapp->cfg->servers['tracking']['googleanalytics']['trackingcode']);
$args['enable_native_tracking'] = ConfigManager::get("tracking.enable_native_tracking", NULL);
$args['category'] = any($analytics->category, $analytics->pandora_result['top_category'], $analytics->item->category, $analytics->qpmquery['protocolheaders']['category'], 'none');
$args['subcategory'] = preg_replace("#\\s#", "_", any($analytics->subcategory, $analytics->pandora_result['top_subcategory'], 'none'));
$args['city'] = "Mountain View";
$args['state'] = "CA";
$args['country'] = "USA";
if ($analytics->city && $analytics->state) {
$args['city'] = ucWords($analytics->city);
$args['state'] = $analytics->state;
$args['country'] = "USA";
}
if (in_array($args['cobrand'], array('paypaluk', 'thefinduk', 'paypalcanada'))) {
$args['city'] = 'unknown';
$args['state'] = 'unknown';
$args['country'] = $args['cobrand'] == 'paypalcanada' ? "Canada" : "UK";
}
$args['pagenum'] = any($analytics->pandora_result['page_num'], 1);
$args['version'] = any(ABTestManager::getVersion(), "unknown");
$args['filters'] = $analytics->qpmreq->filter['brand'] ? '1' : '0';
$args['filters'] .= $analytics->qpmreq->filter['color'] ? '1' : '0';
$args['filters'] .= $analytics->qpmreq->filter['storeswithdeals'] ? '1' : '0';
//(coupons)
$args['filters'] .= $analytics->qpmquery['headers']['localshopping'] ? '1' : '0';
//(local)
$args['filters'] .= $analytics->qpmquery['headers']['market'] == 'green' ? '1' : '0';
//(green)
$args['filters'] .= $analytics->qpmreq->filter['minimall'] ? '1' : '0';
//(marketplaces)
$args['filters'] .= $analytics->qpmreq->filter['filter']['price'] ? '1' : '0';
$args['filters'] .= $analytics->qpmreq->filter['sale'] ? '1' : '0';
$args['filters'] .= $analytics->qpmreq->filter['store'] ? '1' : '0';
$args['filters'] .= $analytics->qpmreq->filter['freeshipping'] ? '1' : '0';
$args['alpha'] = $analytics->alpha;
$args['browse'] = $analytics->browse;
$session = SessionManager::singleton();
$args['is_new_user'] = $session->is_new_user;
$args['is_new_session'] = $session->is_new_session;
$user = User::singleton();
$args['is_logged_in'] = $user->isLoggedIn();
$args['usertype'] = $user->usertype;
$args['userid'] = $user->userid;
$args['useremail'] = $user->email;
$estimated_birth_year = $user->getUserSetting('estimated_birth_year');
$gender = $user->gender;
$user_gender = $gender == 'F' ? 'female' : 'male';
//if($user->getUserSetting("tracking.user.demographics_dimension") != 1) {
$args['birth_year'] = $estimated_birth_year;
$args['user_gender'] = $user_gender;
$location = $user->GetLocation();
if ($location['city'] && $location['state']) {
$args['demo_location'] = $location['city'] . ',' . $location['state'];
}
//$user->setUserSetting("tracking.user.demographics_dimension", "1");
//}
$args['cfg_cobrand'] = $webapp->cfg->servers["cobrand"];
$args['request_cobrand'] = $webapp->request["args"]["cobrand"];
//$args['GAenabled'] = 1; //testing only
if (empty($this->shown["footer"])) {
// Only allow footer once per page
$this->shown["footer"] = true;
return $this->GetComponentResponse("./footer.tpl", $args);
}
return "";
}
示例12: controller_header
public function controller_header($args)
{
$cfg = ConfigManager::singleton();
$header = ConfigManager::get("page.header", array_get($cfg->servers, "page.header"), null);
if (!empty($header)) {
return ComponentManager::fetch($header);
} else {
if ($header !== null) {
return "";
}
}
return $this->GetComponentResponse("./header.tpl", $vars);
}