本文整理汇总了PHP中Kurogo类的典型用法代码示例。如果您正苦于以下问题:PHP Kurogo类的具体用法?PHP Kurogo怎么用?PHP Kurogo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Kurogo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: retrieveResponse
protected function retrieveResponse()
{
if (!class_exists('ZipArchive')) {
throw new KurogoException("class ZipArchive (php-zip) not available");
}
$tmpFile = Kurogo::tempFile();
// this is the same as parent
if (!($this->requestURL = $this->url())) {
throw new KurogoDataException("URL could not be determined");
}
$this->requestParameters = $this->parameters();
// the following are private functions in URLDataRetriever
//$this->requestMethod = $this->setContextMethod();
//$this->requestHeaders = $this->setContextHeaders();
//$this->requestData = $this->setContextData();
Kurogo::log(LOG_INFO, "Retrieving {$this->requestURL}", 'url_retriever');
// the creation of $data is different from parent
copy($this->requestURL, $tmpFile);
$zip = new ZipArchive();
$zip->open($tmpFile);
$data = $zip->getFromIndex(0);
unlink($tmpFile);
// this is the same as parent
$http_response_header = isset($http_response_header) ? $http_response_header : array();
$response = $this->initResponse();
$response->setRequest($this->requestMethod, $this->requestURL, $this->requestParameters, $this->requestHeaders, null);
$response->setResponse($data);
$response->setResponseHeaders($http_response_header);
Kurogo::log(LOG_DEBUG, sprintf("Returned status %d and %d bytes", $response->getCode(), strlen($data)), 'url_retriever');
return $response;
}
开发者ID:nncsang,项目名称:Kurogo,代码行数:31,代码来源:KMZDataRetriever.php
示例2: formatDate
public static function formatDate($date, $dateStyle, $timeStyle)
{
$dateStyleConstant = self::getDateConstant($dateStyle);
$timeStyleConstant = self::getTimeConstant($timeStyle);
if ($date instanceof DateTime) {
$date = $date->format('U');
}
$string = '';
if ($dateStyleConstant) {
$string .= strftime(Kurogo::getLocalizedString($dateStyleConstant), $date);
if ($timeStyleConstant) {
$string .= " ";
}
}
if ($timeStyleConstant) {
// Work around lack of %P support in Mac OS X
$format = Kurogo::getLocalizedString($timeStyleConstant);
$lowercase = false;
if (strpos($format, '%P') !== false) {
$format = str_replace('%P', '%p', $format);
$lowercase = true;
}
$formatted = strftime($format, $date);
if ($lowercase) {
$formatted = strtolower($formatted);
}
// Work around leading spaces that come from use of %l (but don't exist in date())
if (strpos($format, '%l') !== false) {
$formatted = trim($formatted);
}
$string .= $formatted;
}
return $string;
}
开发者ID:narenv,项目名称:Kurogo-Mobile-Web,代码行数:34,代码来源:DateTimeUtils.php
示例3: url
public function url()
{
if (empty($this->startDate) || empty($this->endDate)) {
throw new KurogoConfigurationException('Start or end date cannot be blank');
}
$diff = $this->endTimestamp() - $this->startTimestamp();
if ($diff < 86400 || $diff == 89999) {
// fix for DST
if (count($this->trumbaFilters) > 0) {
$this->setRequiresDateFilter(false);
$this->addFilter('startdate', $this->startDate->format('Ymd'));
$this->addFilter('days', 1);
} else {
$this->setRequiresDateFilter(true);
$this->addFilter('startdate', $this->startDate->format('Ym') . '01');
$this->addFilter('months', 1);
}
} elseif ($diff % 86400 == 0) {
$this->setRequiresDateFilter(false);
$this->addFilter('startdate', $this->startDate->format('Ymd'));
$this->addFilter('days', $diff / 86400);
} else {
Kurogo::log(LOG_WARNING, "Non day integral duration specified {$diff}", 'calendar');
}
return parent::url();
}
开发者ID:hxfnd,项目名称:Kurogo-Mobile-Web,代码行数:26,代码来源:TrumbaCalendarDataController.php
示例4: parseEntry
protected function parseEntry($entry)
{
switch ($this->response->getContext('retriever')) {
case 'feed':
$photo = new FlickrFeedPhotoObject();
$photo->setID($entry['guid']);
$photo->setAuthor($entry['author_name']);
$photo->setMimeType($entry['photo_mime']);
$photo->setURL($entry['photo_url']);
$photo->setHeight($entry['height']);
$photo->setWidth($entry['width']);
$photo->setThumbnailURL($entry['thumb_url']);
$published = new DateTime($entry['date_taken']);
$photo->setPublished($published);
$photo->setDescription($entry['description']);
break;
case 'api':
$photo = new FlickrAPIPhotoObject();
$photo->setUserID(Kurogo::arrayVal($entry, 'owner'));
$photo->setID($entry['id']);
$photo->setFarm($entry['farm']);
$photo->setServer($entry['server']);
$photo->setSecret($entry['secret']);
$photo->setDescription($entry['description']['_content']);
$photo->setAuthor($entry['ownername']);
$published = new DateTime($entry['datetaken']);
$photo->setPublished($published);
$photo->setThumbnailURL($photo->getFlickrUrl('s'));
$photo->setURL($photo->getFlickrUrl('z'));
break;
}
$photo->setTitle($entry['title']);
$photo->setTags($entry['tags']);
return $photo;
}
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:35,代码来源:FlickrDataParser.php
示例5: init
public function init($args)
{
$args['ID'] = $this->id;
$this->title = Kurogo::arrayVal($args, 'TITLE', $this->id);
$this->description = Kurogo::arrayVal($args, 'DESCRIPTION');
$this->rule = UserContextRule::factory($args);
}
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:7,代码来源:UserContext.php
示例6: 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);
}
开发者ID:nncsang,项目名称:Kurogo,代码行数:35,代码来源:CustomizeWebModule.php
示例7: auth
public function auth($options, &$userArray)
{
if (isset($options['startOver']) && $options['startOver']) {
$this->reset();
}
if (isset($_REQUEST['openid_mode'])) {
if (isset($_REQUEST['openid_identity'])) {
if ($ns = $this->getOpenIDNamespace('http://specs.openid.net/extensions/oauth/1.0', $_REQUEST)) {
if ($request_token = $this->getOpenIDValue('request_token', $ns, $_REQUEST)) {
$this->setToken(OAuthProvider::TOKEN_TYPE_REQUEST, $request_token);
if (!$this->getAccessToken($options)) {
throw new KurogoDataServerException("Error getting OAuth Access token");
}
}
}
$userArray = $_REQUEST;
return AUTH_OK;
} else {
Kurogo::log(LOG_WARNING, "openid_identity not found", 'auth');
return AUTH_FAILED;
}
} else {
//redirect to auth page
$url = $this->getAuthURL($options);
header("Location: " . $url);
exit;
}
}
开发者ID:hxfnd,项目名称:Kurogo-Mobile-Web,代码行数:28,代码来源:GoogleOAuthProvider.php
示例8: initializeForPage
protected function initializeForPage()
{
$this->assign('deviceName', Kurogo::getOptionalSiteVar($this->platform, null, 'deviceNames'));
$this->assign('introduction', $this->getOptionalModuleVar('introduction', null, $this->platform, 'apps'));
$this->assign('instructions', $this->getOptionalModuleVar('instructions', null, $this->platform, 'apps'));
$this->assign('downloadUrl', $this->getOptionalModuleVar('url', null, $this->platform, 'apps'));
}
开发者ID:nncsang,项目名称:Kurogo,代码行数:7,代码来源:DownloadWebModule.php
示例9: _outputTypeFile
function _outputTypeFile($matches) {
$file = $matches[3];
$platform = Kurogo::deviceClassifier()->getPlatform();
$pagetype = Kurogo::deviceClassifier()->getPagetype();
$testDirs = array(
THEME_DIR.'/'.$matches[1].$matches[2],
SITE_DIR.'/'.$matches[1].$matches[2],
APP_DIR.'/'.$matches[1].$matches[2],
);
$testFiles = array(
"$pagetype-$platform/$file",
"$pagetype/$file",
"$file",
);
foreach ($testDirs as $dir) {
foreach ($testFiles as $file) {
if ($file = realpath_exists("$dir/$file")) {
_outputFile($file);
}
}
}
_404();
}
开发者ID:neoroman,项目名称:Kurogo-Mobile-Web,代码行数:28,代码来源:index.php
示例10: 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;
}
}
开发者ID:nyetrogen,项目名称:UIndy-Mobile,代码行数:28,代码来源:MapAPIModule.php
示例11: 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);
}
}
开发者ID:nncsang,项目名称:Kurogo,代码行数:33,代码来源:WMSStaticMap.php
示例12: 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'));
}
开发者ID:hxfnd,项目名称:Kurogo-Mobile-Web,代码行数:7,代码来源:DataParser.php
示例13: 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);
}
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:27,代码来源:KurogoLog.php
示例14: cacheFilename
/**
* Returns a base filename for the cache file that will be used. The default implementation uses
* a hash of the value returned from the url
* @return string
*/
protected function cacheFilename($url = null)
{
$url = $url ? $url : $this->url();
// Add the user's id to the cache-key for a per-user cache.
$session = Kurogo::getSession();
$user = $session->getUser();
return md5($url . $user->getUserID());
}
开发者ID:nncsang,项目名称:Kurogo,代码行数:13,代码来源:CASProxyAuthenticatedDataController.php
示例15: 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;
}
开发者ID:neoroman,项目名称:Kurogo-Mobile-Web,代码行数:9,代码来源:KurogoError.php
示例16: 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;
}
}
开发者ID:nncsang,项目名称:Kurogo,代码行数:57,代码来源:LoginAPIModule.php
示例17: display
public function display()
{
$json = $this->getJSONOutput();
$size = strlen($json);
header("Content-Type: application/json; charset=" . Kurogo::getCharset());
header("Content-Length: " . $size);
echo $json;
return $json;
}
开发者ID:nncsang,项目名称:Kurogo,代码行数:9,代码来源:APIResponse.php
示例18: initializeForCommand
public function initializeForCommand()
{
switch ($this->command) {
case 'notice':
$response = null;
$responseVersion = 1;
if ($this->getOptionalModuleVar('BANNER_ALERT', false, 'notice')) {
$noticeData = $this->getOptionalModuleSection('notice');
if ($noticeData) {
$response = array('notice' => '', 'moduleID' => null, 'link' => $this->getOptionalModuleVar('BANNER_ALERT_MODULE_LINK', false, 'notice'));
// notice can either take a module or data model class or retriever class. The section is passed on. It must implement the HomeAlertInterface interface
if (isset($noticeData['BANNER_ALERT_MODULE'])) {
$moduleID = $noticeData['BANNER_ALERT_MODULE'];
$controller = WebModule::factory($moduleID);
$response['moduleID'] = $moduleID;
$string = "Module {$moduleID}";
} elseif (isset($noticeData['BANNER_ALERT_MODEL_CLASS'])) {
$controller = DataModel::factory($noticeData['BANNER_ALERT_MODEL_CLASS'], $noticeData);
$string = $noticeData['BANNER_ALERT_MODEL_CLASS'];
} elseif (isset($noticeData['BANNER_ALERT_RETRIEVER_CLASS'])) {
$controller = DataRetriever::factory($noticeData['BANNER_ALERT_RETRIEVER_CLASS'], $noticeData);
$string = $noticeData['BANNER_ALERT_RETRIEVER_CLASS'];
} else {
throw new KurogoConfigurationException("Banner alert not properly configured");
}
if (!$controller instanceof HomeAlertInterface) {
throw new KurogoConfigurationException("{$string} does not implement HomeAlertModule interface");
}
$response['notice'] = $controller->getHomeScreenAlert();
}
}
$this->setResponse($response);
$this->setResponseVersion($responseVersion);
break;
case 'modules':
if ($setcontext = $this->getArg('setcontext')) {
Kurogo::sharedInstance()->setUserContext($setcontext);
}
$responseVersion = 2;
$response = array('primary' => array(), 'secondary' => array(), 'customize' => $this->getOptionalModuleVar('ALLOW_CUSTOMIZE', true), 'displayType' => $this->getOptionalModuleVar('display_type', 'springboard'));
$allmodules = $this->getAllModules();
$navModules = Kurogo::getSiteSections('navigation', Config::APPLY_CONTEXTS_NAVIGATION);
foreach ($navModules as $moduleID => $moduleData) {
if ($module = Kurogo::arrayVal($allmodules, $moduleID)) {
$title = Kurogo::arrayVal($moduleData, 'title', $module->getModuleVar('title'));
$type = Kurogo::arrayVal($moduleData, 'type', 'primary');
$visible = Kurogo::arrayVal($moduleData, 'visible', 1);
$response[$type][] = array('tag' => $moduleID, 'title' => $title, 'visible' => (bool) $visible);
}
}
$this->setResponse($response);
$this->setResponseVersion($responseVersion);
break;
default:
$this->invalidCommand();
}
}
开发者ID:sponto,项目名称:msbm-mobile,代码行数:57,代码来源:HomeAPIModule.php
示例19: initializeForPage
protected function initializeForPage()
{
if ($url = $this->getModuleVar('url')) {
$this->logView();
Kurogo::redirectToURL($url);
} else {
throw new KurogoConfigurationException("URL not specified");
}
}
开发者ID:nncsang,项目名称:Kurogo,代码行数:9,代码来源:UrlWebModule.php
示例20: initializeForCommand
public function initializeForCommand()
{
switch ($this->command) {
case 'version':
$this->out(KUROGO_VERSION);
return 0;
break;
case 'clearCaches':
$result = Kurogo::sharedInstance()->clearCaches();
return 0;
break;
case 'fetchAllData':
$allModules = $this->getAllModules();
$time = 0;
$this->out("Fetching data for site: " . SITE_NAME);
$start = microtime(true);
foreach ($allModules as $moduleID => $module) {
if ($module->isEnabled() && $module->getOptionalModuleVar('PREFETCH_DATA')) {
$module->setDispatcher($this->Dispatcher());
try {
$module->init('fetchAllData');
$module->executeCommand();
} catch (KurogoException $e) {
$this->out("Error: " . $e->getMessage());
}
}
}
$end = microtime(true);
$diff = $end - $start;
$time += $diff;
$this->out("Total: " . sprintf("%.2f", $end - $start) . " seconds.");
return 0;
break;
case 'deployPostFlight':
$this->verbose = $this->getArg('v');
$this->out('Running KurogoShell kurogo deployPostFlight');
$postFlightFilePath = SITE_SCRIPTS_DIR . DIRECTORY_SEPARATOR . 'deployPostFlight.sh';
if (!file_exists($postFlightFilePath)) {
$this->out("{$postFlightFilePath} does not exist, skipping execution");
return 0;
} elseif (!is_executable($postFlightFilePath)) {
$this->out("{$postFlightFilePath} exists, but is not executable. This must be fixed");
return 126;
}
$outputLines = array();
exec(sprintf("%s %s %s", escapeshellcmd($postFlightFilePath), escapeshellarg(ROOT_DIR), escapeshellarg(SITE_DIR)), $outputLines, $returnValue);
foreach ($outputLines as $lineNumber => $line) {
$this->out($line);
}
return $returnValue;
break;
default:
$this->invalidCommand();
break;
}
}
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:56,代码来源:KurogoShellModule.php
注:本文中的Kurogo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论