本文整理汇总了PHP中Kurogo::getSiteVar方法的典型用法代码示例。如果您正苦于以下问题:PHP Kurogo::getSiteVar方法的具体用法?PHP Kurogo::getSiteVar怎么用?PHP Kurogo::getSiteVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kurogo
的用法示例。
在下文中一共展示了Kurogo::getSiteVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeForPage
protected function initializeForPage()
{
$this->handleRequest($this->args);
$modules = $this->getModuleCustomizeList();
$moduleIDs = array();
$disabledModuleIDs = array();
foreach ($modules as $id => $info) {
$moduleIDs[] = $id;
if ($info['disabled']) {
$disabledModuleIDs[] = $id;
}
}
switch ($this->pagetype) {
case 'compliant':
case 'tablet':
$this->addInlineJavascript('var modules = ' . json_encode($moduleIDs) . ';' . 'var disabledModules = ' . json_encode($disabledModuleIDs) . ';' . 'var MODULE_ORDER_COOKIE = "' . self::MODULE_ORDER_COOKIE . '";' . 'var DISABLED_MODULES_COOKIE = "' . self::DISABLED_MODULES_COOKIE . '";' . 'var MODULE_ORDER_COOKIE_LIFESPAN = ' . Kurogo::getSiteVar('MODULE_ORDER_COOKIE_LIFESPAN') . ';' . 'var COOKIE_PATH = "' . COOKIE_PATH . '";');
$this->addInlineJavascriptFooter('init();');
break;
case 'touch':
case 'basic':
foreach ($moduleIDs as $index => $id) {
$modules[$id]['toggleDisabledURL'] = $this->buildBreadcrumbURL('index', array('action' => $modules[$id]['disabled'] ? 'on' : 'off', 'module' => $id), false);
if ($index > 0) {
$modules[$id]['swapUpURL'] = $this->buildBreadcrumbURL('index', array('action' => 'swap', 'module1' => $id, 'module2' => $moduleIDs[$index - 1]), false);
}
if ($index < count($moduleIDs) - 1) {
$modules[$id]['swapDownURL'] = $this->buildBreadcrumbURL('index', array('action' => 'swap', 'module1' => $id, 'module2' => $moduleIDs[$index + 1]), false);
}
}
break;
default:
break;
}
$this->assignByRef('modules', $modules);
}
示例2: log
public function log($priority, $message, $area, $backTrace = null)
{
if (!self::isValidPriority($priority)) {
throw new Exception("Invalid logging priority {$priority}");
}
if (!preg_match("/^[a-z0-9_-]+\$/i", $area)) {
throw new Exception("Invalid area {$area}");
}
//don't log items above the current logging level
$loggingLevel = isset($this->areaLevel[$area]) ? $this->areaLevel[$area] : $this->defaultLevel;
if ($priority > $loggingLevel) {
return;
}
if (!$backTrace) {
$backTrace = debug_backtrace();
}
$compactTrace = self::compactTrace($backTrace);
if (isset($_SERVER['REQUEST_URI'])) {
$request = $_SERVER['REQUEST_URI'];
} elseif (defined('KUROGO_SHELL')) {
$request = json_encode(Kurogo::getArrayForRequest());
} else {
$request = null;
}
$content = sprintf("%s\t%s:%s\t%s\t%s\t%s", date(Kurogo::getSiteVar('LOG_DATE_FORMAT')), $area, self::priorityToString($priority), $compactTrace, $request, $message) . PHP_EOL;
self::fileAppend($this->logFile, $content);
}
示例3: init
public function init($args)
{
if (isset($args['HALT_ON_PARSE_ERRORS'])) {
$this->haltOnParseErrors($args['HALT_ON_PARSE_ERRORS']);
}
$this->setDebugMode(Kurogo::getSiteVar('DATA_DEBUG'));
}
示例4: getDataController
protected function getDataController($categoryPath, &$listItemPath) {
if (!$this->feeds)
$this->feeds = $this->loadFeedData();
if ($categoryPath === NULL) {
return MapDataController::factory('MapDataController', array(
'JS_MAP_CLASS' => 'GoogleJSMap',
'DEFAULT_ZOOM_LEVEL' => $this->getOptionalModuleVar('DEFAULT_ZOOM_LEVEL', 10)
));
} else {
$listItemPath = $categoryPath;
if ($this->numGroups > 0) {
if (count($categoryPath) < 2) {
$path = implode(MAP_CATEGORY_DELIMITER, $categoryPath);
throw new Exception("invalid category path $path for multiple feed groups");
}
$feedIndex = array_shift($listItemPath).MAP_CATEGORY_DELIMITER.array_shift($listItemPath);
} else {
$feedIndex = array_shift($listItemPath);
}
$feedData = $this->feeds[$feedIndex];
$controller = MapDataController::factory($feedData['CONTROLLER_CLASS'], $feedData);
$controller->setCategory($feedIndex);
$controller->setDebugMode(Kurogo::getSiteVar('DATA_DEBUG'));
return $controller;
}
}
示例5: logView
public static function logView($service, $id, $page, $data, $dataLabel, $size = 0)
{
switch ($service) {
case 'web':
case 'api':
break;
default:
throw new Exception("Invalid service {$service}");
break;
}
$deviceClassifier = Kurogo::deviceClassifier();
$ip = Kurogo::determineIP();
$requestURI = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
$visitID = self::getVisitID($service);
if (Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
$session = Kurogo::getSession();
$user = $session->getUser();
} else {
$user = false;
}
$logData = array('timestamp' => time(), 'date' => date('Y-m-d H:i:s'), 'site' => SITE_KEY, 'service' => $service, 'requestURI' => $requestURI, 'referrer' => $referrer, 'referredSite' => intval(self::isFromThisSite($referrer)), 'referredModule' => intval(self::isFromModule($referrer, $id)), 'userAgent' => $userAgent, 'ip' => $ip, 'user' => $user ? $user->getUserID() : '', 'authority' => $user ? $user->getAuthenticationAuthorityIndex() : '', 'visitID' => $visitID, 'pagetype' => $deviceClassifier->getPageType(), 'platform' => $deviceClassifier->getPlatform(), 'moduleID' => $id, 'page' => $page, 'data' => $data, 'dataLabel' => $dataLabel, 'size' => $size, 'elapsed' => Kurogo::getElapsed());
try {
$conn = self::connection();
} catch (KurogoDataServerException $e) {
throw new KurogoConfigurationException("Database not configured for statistics. To disable stats, set STATS_ENABLED=0 in site.ini");
}
$sql = sprintf("INSERT INTO %s (%s) VALUES (%s)", Kurogo::getOptionalSiteVar("KUROGO_STATS_TABLE", "kurogo_stats_v1"), implode(",", array_keys($logData)), implode(",", array_fill(0, count($logData), '?')));
if (!($result = $conn->query($sql, array_values($logData), db::IGNORE_ERRORS))) {
self::createStatsTables();
$result = $conn->query($sql, array_values($logData));
}
return $result;
}
示例6: init
public function init($args)
{
$this->baseURL = $args['BASE_URL'];
$this->diskCache = new DiskCache(Kurogo::getSiteVar('WMS_CACHE', 'maps'), 86400 * 7, true);
$this->diskCache->preserveFormat();
$filename = md5($this->baseURL);
$metafile = $filename . '-meta.txt';
if (!$this->diskCache->isFresh($filename)) {
$params = array('request' => 'GetCapabilities', 'service' => 'WMS');
$query = $this->baseURL . '?' . http_build_query($params);
file_put_contents($this->diskCache->getFullPath($metafile), $query);
$contents = file_get_contents($query);
$this->diskCache->write($contents, $filename);
} else {
$contents = $this->diskCache->read($filename);
}
$this->wmsParser = new WMSDataParser();
$this->wmsParser->parseData($contents);
$this->enableAllLayers();
// TODO make sure this projection is supported by the server
$projections = $this->wmsParser->getProjections();
if (count($projections)) {
// make sure this is a projection we can handle
foreach ($projections as $proj) {
$contents = MapProjector::getProjSpecs($proj);
if ($contents) {
$this->setMapProjection($proj);
}
}
} else {
$this->setMapProjection(GEOGRAPHIC_PROJECTION);
}
}
示例7: errorFromException
public static function errorFromException(Exception $exception) {
$error = new KurogoError($exception->getCode(), 'Exception', $exception->getMessage());
if(!Kurogo::getSiteVar('PRODUCTION_ERROR_HANDLER_ENABLED')) {
$error->file = $exception->getFile();
$error->line = $exception->getLine();
$error->trace = $exception->getTrace();
}
return $error;
}
示例8: initializeForCommand
public function initializeForCommand()
{
if (!Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
throw new KurogoConfigurationException("Authentication is not enabled on this site");
}
switch ($this->command) {
case 'logout':
if (!$this->isLoggedIn()) {
$this->redirectTo('session');
} else {
$session = $this->getSession();
$user = $this->getUser();
$hard = $this->getArg('hard', false);
$authorityIndex = $this->getArg('authority', false);
if ($authorityIndex) {
$authority = AuthenticationAuthority::getAuthenticationAuthority($authorityIndex);
} else {
$authority = $user->getAuthenticationAuthority();
}
$session->logout($authority, $hard);
$this->redirectTo('session');
}
$this->setResponse($response);
$this->setResponseVersion(1);
break;
case 'getuserdata':
$key = $this->getArg('key', null);
$user = $this->getUser();
$response = $user->getUserData($key);
$this->setResponse($response);
$this->setResponseVersion(1);
break;
case 'session':
$session = $this->getSession();
$response = array('session_id' => $session->getSessionID(), 'token' => $session->getLoginToken());
// version 2 implements multiple identities into the response
if ($this->requestedVersion == 2) {
$response['users'] = array();
$users = $session->getUsers();
foreach ($users as $user) {
$authority = $user->getAuthenticationAuthority();
$response['users'][$authority->getAuthorityIndex()] = array('authority' => $authority->getAuthorityIndex(), 'authorityTitle' => $authority->getAuthorityTitle(), 'userID' => $user->getUserID(), 'name' => $user->getFullName(), 'sessiondata' => $user->getSessionData());
}
$this->setResponseVersion(2);
} else {
// version 1 assumes only 1 user
$user = $this->getUser();
$response['user'] = array('authority' => $user->getAuthenticationAuthorityIndex(), 'userID' => $user->getUserID(), 'name' => $user->getFullName(), 'sessiondata' => $user->getSessionData());
$this->setResponseVersion(1);
}
$this->setResponse($response);
break;
default:
$this->invalidCommand();
break;
}
}
示例9: getPhoneURL
public static function getPhoneURL($value)
{
// add the local area code if missing
if (preg_match('/^\\d{3}-?\\d{4}/', $value)) {
$phone = Kurogo::getSiteVar('LOCAL_AREA_CODE') . $value;
}
// remove all non-word characters from the number
$phone = 'tel:' . preg_replace('/\\W/', '', $value);
return $phone;
}
示例10: addFilter
public function addFilter($var, $value)
{
switch ($var)
{
case 'category':
$this->addTrumbaFilter(Kurogo::getSiteVar('CALENDAR_CATEGORY_FILTER_FIELD'), $value);
break;
default:
return parent::addFilter($var, $value);
}
}
示例11: initializeForCommand
public function initializeForCommand() {
if (!Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
throw new Exception("Authentication is not enabled on this site");
}
switch ($this->command) {
case 'logout':
if (!$this->isLoggedIn()) {
$this->redirectTo('session');
} else {
$user = $this->getUser();
$authority = $user->getAuthenticationAuthority();
$authority->logout($this);
$this->redirectTo('session');
}
$this->setResponse($response);
$this->setResponseVersion(1);
break;
case 'getuserdata':
$key = $this->getArg('key', null);
$user = $this->getUser();
$response = $user->getUserData($key);
$this->setResponse($response);
$this->setResponseVersion(1);
break;
case 'session':
$session = $this->getSession();
$user = $this->getUser();
$response = array(
'session_id'=>$session->getSessionID(),
'token'=>$session->getLoginToken(),
'user'=>array(
'authority'=>$user->getAuthenticationAuthorityIndex(),
'userID'=>$user->getUserID(),
'name'=>$user->getFullName(),
'sessiondata'=>$user->getSessionData()
)
);
$this->setResponse($response);
$this->setResponseVersion(1);
break;
default:
$this->invalidCommand();
break;
}
}
示例12: factory
public static function factory($controllerClass, $args)
{
if (!class_exists($controllerClass)) {
throw new KurogoConfigurationException("Controller class {$controllerClass} not defined");
}
$controller = new $controllerClass();
$controller->setDebugMode(Kurogo::getSiteVar('DATA_DEBUG'));
if (!$controller instanceof PeopleController) {
throw new KurogoConfigurationException("{$controller} class is not a subclass of PeopleController");
}
$controller->init($args);
return $controller;
}
示例13: factory
public static function factory($sessionClass, $args = array())
{
$args = is_array($args) ? $args : array();
if (!class_exists($sessionClass)) {
throw new KurogoConfigurationException("Session class {$sessionClass} not defined");
}
Kurogo::log(LOG_DEBUG, "Initializing session class {$sessionClass}", 'session');
$session = new $sessionClass();
if (!$session instanceof Session) {
throw new KurogoConfigurationException("{$sessionClass} is not a subclass of Session");
}
$session->setDebugMode(Kurogo::getSiteVar('DATA_DEBUG'));
$session->initialize($args);
return $session;
}
示例14: getFeed
protected function getFeed($index)
{
if (isset($this->feeds[$index])) {
$feedData = $this->feeds[$index];
if (!isset($feedData['CONTROLLER_CLASS'])) {
$feedData['CONTROLLER_CLASS'] = 'LDAPPeopleController';
}
$controller = PeopleController::factory($feedData['CONTROLLER_CLASS'], $feedData);
//$controller->setAttributes($this->detailAttributes);
$controller->setDebugMode(Kurogo::getSiteVar('DATA_DEBUG'));
return $controller;
} else {
throw new Exception("Error getting people feed for index $index");
}
}
示例15: searchCampusMap
public function searchCampusMap($query) {
$this->searchResults = array();
foreach ($this->feeds as $id => $feedData) {
$controller = MapDataController::factory($feedData['CONTROLLER_CLASS'], $feedData);
$controller->setCategory($id);
$controller->setDebugMode(Kurogo::getSiteVar('DATA_DEBUG'));
if ($controller->canSearch()) {
$results = $controller->search($query);
$this->resultCount += count($results);
$this->searchResults = array_merge($this->searchResults, $results);
}
}
return $this->searchResults;
}