本文整理汇总了PHP中request::readConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP request::readConfig方法的具体用法?PHP request::readConfig怎么用?PHP request::readConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类request
的用法示例。
在下文中一共展示了request::readConfig方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public static function get($object, $method, $params = array())
{
$log = $object . ' ' . (is_array($method) ? implode(' , ', $method) : $method) . "\n\t" . json_encode($params) . "\n";
$res = false;
$class = request::readConfig('data_object_dir') . '/' . $object . '.class.php';
if (file_exists($class)) {
require_once $class;
$object = 'do' . $object;
if (class_exists($object)) {
$object = new $object();
if (is_callable(array($object, $method), false, $callable)) {
$ret = $object->{$method}($params);
} else {
$log .= "\t invalid data object class action\n";
$ret = self::error('invalid data object class action');
}
} else {
$log .= "\t invalid data object class\n";
$ret = self::error('invalid data object class');
}
} else {
$log .= "\t unknown data object class\n";
$ret = self::error('unknown data object class');
}
self::$dataLog .= $log;
return $ret;
}
示例2: __construct
public function __construct($filePath, $data = array())
{
$controller_path = request::readConfig('view_controller_path');
$view_path = request::readConfig('view_html_path');
if (!$controller_path) {
$controller_path = self::$controller_path;
}
if (!$view_path) {
$view_path = self::$view_path;
}
$this->data = $data;
$this->controller = SITE_ROOT . '/' . $controller_path . '/' . $filePath . '.php';
$this->filePath = SITE_ROOT . '/' . $view_path . '/' . $filePath . '.php';
$this->controllerClass = trim(str_replace('/', '_', $filePath), '_') . '_controller';
$this->load = $this;
$this->logInstantiate();
}
示例3: sprintf
require 'php/http/solumView.class.php';
require 'php/http/cms.class.php';
require 'php/http/lib_compat.php';
$coreTime = sprintf('%0.5f', (microtime(true) - $coreTime) * 1000);
$appTime = microtime(true);
sessionCookie::init();
/**init the page**/
request::addConfig($config);
$user = sessionCookie::getUser();
$default_vars = array('authenticated' => sessionCookie::$session['logged_in'], 'user' => $user);
$view = new solumView('master', $default_vars);
$view->view();
/** done **/
if (request::readConfig('tracking_enabled')) {
/*
$users_id = $user?$user['users_id']:0;
DB::write("INSERT INTO `metrics`.`requests`(time,day_time,users_id,session_key,ip,user_agent,uri,referer) values(".time().",".day_time().",".$users_id.",'".sessionCookie::$session['key']."','".$_SERVER['REMOTE_ADDR']."','".DB::sqlEsc($_SERVER['HTTP_USER_AGENT'])."','".DB::sqlEsc($_SERVER['REQUEST_URI'])."','".(isset($_SERVER['HTTP_REFERER'])?DB::sqlEsc($_SERVER['HTTP_REFERER']):'')."') ");
*/
}
if (!request::readConfig('debug')) {
exit;
}
if (request::get(0) == 'ajax') {
exit;
}
$appTime = sprintf('%0.5f', (microtime(true) - $appTime) * 1000);
$sessionData = '';
foreach (sessionCookie::$session as $k => $v) {
$sessionData .= "<div>{$k}: {$v}</div>";
}
echo "<div style='clear:both;border:1px solid blue;margin:5px;background:#d4d4d4;padding:3px;margin-left:10px;mergin-right:10px;color:#000;'>\n\t\t<div style='background:white;padding:3px;'>\n\t\t\t<div>\n\t\t\t\t<b>benchmarks:</b>\n\t\t\t\t<div style='margin:5px;background:#D9FFCE;'>\n\t\t\t\t\t<div>core time: {$coreTime} ms</div>\n\t\t\t\t\t<div>app time: {$appTime} ms</div>\n\t\t\t\t\t<div>peak memory: " . (int) (memory_get_peak_usage() / 1024) . " kb</div>\n\t\t\t\t\t<div>database reads: " . db::$query_count . " </div>\n\t\t\t\t\t<div>database writes: " . db::$query_count_w . " </div>\n\t\t\t\t\t<div>database read time: " . sprintf('%0.5f', db::$query_time * 1000) . " ms</div>\n\t\t\t\t\t<div>database write time: " . sprintf('%0.5f', db::$query_time_w * 1000) . " ms</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<b>database queries:</b>\n\t\t\t\t<div style='margin:5px;background:#D9FFCE;'>\n\t\t\t\t\t<pre>" . db::$query_list . "</pre>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<b>session data:</b>\n\t\t\t\t<div style='margin:5px;background:#D9FFCE;'>\n\t\t\t\t\t{$sessionData}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<b>data log:</b>\n\t\t\t\t<div style='margin:5px;background:#D9FFCE;'>\n\t\t\t\t\t<pre>" . Data::getDataLog() . "</pre>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<b>view log:</b>\n\t\t\t\t<div style='margin:5px;background:#D9FFCE;'>\n\t\t\t\t\t<pre>" . solumView::getViewLog() . "</pre>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</div>";
示例4: result
public function result($view)
{
$this->view = $view;
//default request to page routing
$mode = self::MODE_INTERNAL_PAGE;
$first = Request::get(0);
if (!$first) {
$first = 'home';
}
//handle non existant pages
switch ($mode) {
case self::MODE_INTERNAL_PAGE:
if ($page = $this->getPage($first)) {
$view->page = $page;
break;
}
default:
$view->page = $this->pages_path . "/404";
$view->missing = $first;
break;
}
//set site name for page titles
$site_name = request::readConfig('site_name');
if (!$site_name) {
$url = parse_url(SITE_ROOT_URL);
$site_name = $url['host'];
$parts = explode('.', $site_name);
if (count($parts) > 2) {
unset($parts[0]);
$site_name = implode('.', $parts);
}
}
$view->site_name = $site_name;
$view->js_includes = array();
$view->css_includes = array();
includeJS($view, '/js/jquery-1.4.2.min.js');
includeJS($view, '/js/jquery.extensions.js');
includeJS($view, '/js/swfobject.js');
includeCSS($view, '/css/reset.css');
includeCSS($view, '/css/base.css');
$view->page = $this->loadViewHTML($view->page);
$view->header = $this->panels_path . '/header';
$view->footer = $this->panels_path . '/footer';
$view->popups = $this->panels_path . '/popups';
//---------------
//---------------
$ua = get($_SERVER, 'HTTP_USER_AGENT');
$ie6 = strpos($ua, 'MSIE 6.0') !== false;
$ie7 = strpos($ua, 'MSIE 7.0') !== false;
$ie8 = strpos($ua, 'MSIE 8.0') !== false;
$ie9 = strpos($ua, 'MSIE 9.0') !== false;
$opera = false;
if (strpos($ua, 'Opera') !== false) {
$parts = explode($ua, 'Presto/2.');
//presto 2.3 and later are rumored to have border-radius
$opera = true;
if (isset($parts[1]) && intval($parts[1][0]) > 2) {
$opera = false;
}
}
$konqueror = false;
if (strpos($ua, 'Konqueror') !== false) {
$parts = explode($ua, 'KHTML/4.');
$konqueror = true;
if (isset($parts[1]) && intval($parts[1][0]) > 2) {
$konqueror = false;
}
}
$ie = $ie6 || $ie7 || $ie8;
//---------------
//---------------
if ($ie6) {
//includeJS($view,'/js/ie.js');
//includeCSS($view,'/css/ie6.css');
}
if ($ie || $opera || $konqueror) {
//includeCSS($view,'/css/corners.css');
}
//---------------
$this->cssIncludes();
$this->jsIncludes();
}
示例5: getPrefix
private static function getPrefix()
{
return request::readConfig('session_cookie_prefix');
}
示例6: array
<?php
$db = array('USER', 'HOST', 'PASS', 'NAME', 'READ_HOSTS');
extract(request::readConfig('db'));
foreach ($db as $suf) {
$var = "DB_{$suf}";
if (!defined($var)) {
$val = strtolower($var);
if (!isset(${$val})) {
exit("cannot find config var {$var}");
}
define($var, ${$val});
}
}
if (!defined('DEBUG')) {
define('DEBUG', request::readConfig('debug'));
}
if (!defined('QUERY_LIST')) {
define('QUERY_LIST', false);
}