本文整理汇总了PHP中Kurogo::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Kurogo::log方法的具体用法?PHP Kurogo::log怎么用?PHP Kurogo::log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kurogo
的用法示例。
在下文中一共展示了Kurogo::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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;
}
示例3: 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;
}
}
示例4: setBoundingBox
public function setBoundingBox($xmin, $ymin, $xmax, $ymax)
{
if ($xmax - $xmin > 0 && $ymax - $ymin > 0) {
$this->bbox = array('xmin' => $xmin, 'ymin' => $ymin, 'xmax' => $xmax, 'ymax' => $ymax);
$this->center = array('lat' => ($ymin + $ymax) / 2, 'lon' => ($xmin + $xmax) / 2);
$this->zoomLevel = log(360 / ($xmax - $xmin), 2);
} else {
Kurogo::log(LOG_WARNING, "invalid bounding box {xmin={$xmin}, ymin={$ymin}, xmax={$xmax}, ymax={$ymax}}", "maps");
}
}
示例5: factory
public static function factory($parserClass, $args)
{
Kurogo::log(LOG_DEBUG, "Initializing DataParser {$parserClass}", "data");
if (!class_exists($parserClass)) {
throw new KurogoConfigurationException("Parser class {$parserClass} not defined");
}
$parser = new $parserClass();
if (!$parser instanceof DataParser) {
throw new KurogoConfigurationException("{$parserClass} is not a subclass of DataParser");
}
$parser->init($args);
return $parser;
}
示例6: _404
/**
* Outputs a 404 error message
*/
function _404()
{
header("HTTP/1.1 404 Not Found");
$url = $_SERVER['REQUEST_URI'];
Kurogo::log(LOG_WARNING, "URL {$url} not found", 'kurogo');
echo <<<html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL {$url} was not found on this server.</p>
</body></html>
html;
exit;
}
示例7: searchCampusMap
public function searchCampusMap($query)
{
$this->searchResults = array();
foreach ($this->feeds as $id => $feedData) {
$controller = MapDataController::factory($feedData['CONTROLLER_CLASS'], $feedData);
if ($controller->canSearch()) {
try {
$results = $controller->search($query);
$this->resultCount += count($results);
$this->searchResults = array_merge($this->searchResults, $results);
} catch (KurogoDataServerException $e) {
Kurogo::log(LOG_WARNING, 'encountered KurogoDataServerException for feed config: ' . print_r($feedData, true) . $e->getMessage(), 'maps');
}
}
}
return $this->searchResults;
}
示例8: setContext
public function setContext($bool)
{
if ($this->value == UserContext::CONTEXT_DEFAULT) {
if ($bool && isset($_COOKIE[$this->cookie])) {
$this->clearCookie();
}
return true;
}
if ($bool) {
Kurogo::log(LOG_DEBUG, "Setting CookieContext {$this->cookie} to {$this->value}", 'context');
$this->setCookie();
} elseif (Kurogo::arrayVal($_COOKIE, $this->cookie) == $this->value) {
Kurogo::log(LOG_DEBUG, "Clearing CookieContext {$this->cookie} by {$this->value}", 'context');
$this->clearCookie();
}
return true;
}
示例9: errorHandler
private function errorHandler($sql, $errorInfo, $ignoreErrors, $catchErrorCodes)
{
$e = new KurogoDataException(sprintf("Error with %s: %s", $sql, $errorInfo['message']), $errorInfo['code']);
if ($ignoreErrors) {
$this->lastError = KurogoError::errorFromException($e);
return;
}
// prevent the default error handling mechanism
// from triggerring in the rare case of expected
// errors such as unique field violations
if (in_array($errorInfo[0], $catchErrorCodes)) {
return $errorInfo;
}
Kurogo::log(LOG_WARNING, sprintf("%s error with %s: %s", $this->dbType, $sql, $errorInfo['message']), 'db');
if (Kurogo::getSiteVar('DB_DEBUG')) {
throw $e;
}
}
示例10: __construct
public function __construct($html, $encoding, $pageNumber, $paragraphsPerPage = HTMLPager::PARAGRAPH_LIMIT)
{
$dom = new DOMDocument();
libxml_use_internal_errors(true);
libxml_clear_errors();
// clean up any errors belonging to other operations
$dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', $encoding));
foreach (libxml_get_errors() as $error) {
Kurogo::log(LOG_WARNING, "HTMLPager got loadHTML warning (line {$error->line}; column {$error->column}) {$error->message}", 'data');
}
libxml_clear_errors();
// free up memory associated with the errors
libxml_use_internal_errors(false);
$body = $dom->getElementsByTagName("body")->item(0);
$currentPage = NULL;
$pages = array();
$currentParagraphCount = 0;
foreach ($body->childNodes as $node) {
if ($currentPage == NULL) {
// need to start a new page
if ($node->nodeName == "#text" && trim($node->nodeValue) == "") {
continue;
// this node is blank so do not start a new page yet
}
$currentPage = new HTMLPage();
$pages[] = $currentPage;
}
$currentPage->addNode($node);
if ($node->nodeName == "p") {
$currentParagraphCount++;
}
if ($currentParagraphCount == $paragraphsPerPage) {
$currentPage = NULL;
$currentParagraphCount = 0;
}
}
$this->pages = $pages;
$this->pageCount = count($pages);
if ($pageNumber >= 0 && $pageNumber < $this->pageCount) {
$this->pageNumber = $pageNumber;
}
}
示例11: parseData
public function parseData($contents)
{
$data = json_decode($contents, true);
if (!$data) {
Kurogo::log(LOG_WARNING, "Failed to get JSON response from ArcGIS server at {$this->baseURL}", 'maps');
throw new KurogoDataServerException("The map server for this category is temporarily down. Please try again later.");
}
if (isset($data['error'])) {
$error = $data['error'];
$code = $error['code'];
$message = $error['message'];
$details = isset($error['details']) ? json_encode($error['details']) : '';
Kurogo::log(LOG_WARNING, "Error response from ArcGIS server at {$this->baseURL}:\n" . "Code: {$code}\n" . "Message: {$message}\n" . "Details: {$details}\n", 'maps');
throw new KurogoDataServerException("The map server for this category is temporarily down. Please try again later.");
}
$this->serviceDescription = $data['serviceDescription'];
//if (isset($data['supportedImageFormatTypes'])) {
// $this->supportedImageFormats = explode(',', $data['supportedImageFormatTypes']);
//}
$this->units = $data['units'];
$this->mapName = $data['mapName'];
$this->spatialRef = $data['spatialReference']['wkid'];
$this->initialExtent = $data['initialExtent'];
$this->fullExtent = $data['fullExtent'];
// assume these are always the same as the overall spatial ref
unset($this->initialExtent['spatialReference']);
unset($this->fullExtent['spatialReference']);
//$this->singleFusedMapCache = $data['singleFusedMapCache'];
foreach ($data['layers'] as $layerData) {
$id = $layerData['id'];
$name = $layerData['name'];
$this->subLayers[$id] = new ArcGISLayer($id, $name, $this);
}
if (count($this->subLayers) == 1) {
$this->defaultLayerId = current(array_keys($this->subLayers));
}
if (isset($this->defaultLayerId)) {
$this->selectDefaultLayer();
}
$this->isPopulated = true;
return $this->getListItems();
}
示例12: handleRequest
private function handleRequest($args)
{
if (isset($args['action'])) {
$currentModules = $this->getModuleCustomizeList();
switch ($args['action']) {
case 'swap':
$currentIDs = array_keys($currentModules);
if (isset($args['module1'], $args['module2']) && in_array($args['module1'], $currentIDs) && in_array($args['module2'], $currentIDs)) {
foreach ($currentIDs as $index => &$id) {
if ($id == $args['module1']) {
$id = $args['module2'];
} else {
if ($id == $args['module2']) {
$id = $args['module1'];
}
}
}
$this->setNavigationModuleOrder($currentIDs);
}
break;
case 'on':
case 'off':
if (isset($args['module'])) {
$disabledModuleIDs = array();
foreach ($currentModules as $id => &$info) {
if ($id == $args['module']) {
$info['disabled'] = $args['action'] != 'on';
}
if ($info['disabled']) {
$disabledModuleIDs[] = $id;
}
}
$this->setNavigationHiddenModules($disabledModuleIDs);
}
break;
default:
Kurogo::log(LOG_WARNING, __FUNCTION__ . "(): Unknown action '{$_REQUEST['action']}'", 'module');
break;
}
}
}
示例13: generateURL
protected static function generateURL($file, $contents, $subdirectory = null)
{
$path = AUTOLOAD_FILE_DIR;
if (!realpath_exists($path)) {
if (!mkdir($path, 0755, true)) {
Kurogo::log(LOG_WARNING, "could not create {$path}", 'data');
return;
}
}
$subPath = $path . "/{$subdirectory}";
if (!realpath_exists($subPath)) {
if (!mkdir($subPath, 0755, true)) {
Kurogo::log(LOG_WARNING, "could not create {$subPath}", 'data');
return;
}
}
if (file_put_contents(self::filePath($file, $subdirectory), $contents)) {
return self::fullURL($file, $subdirectory);
} else {
return false;
}
}
示例14: 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");
}
Kurogo::log(LOG_INFO, "Retrieving {$this->requestURL}", 'url_retriever');
// get data from parent request and save to temp file which we will
// unzip and return
$response = parent::retrieveResponse();
file_put_contents($tmpFile, $response->getResponse());
$zip = new ZipArchive();
if (!$zip->open($tmpFile)) {
throw new KurogoDataException("Could not open zip file");
}
$targetFile = $this->targetFile();
if ($targetFile) {
$index = $zip->locateName($targetFile);
} else {
$index = 0;
}
if ($index === false) {
// $zip->locateName failed
throw new KurogoDataException("Could not locate {$this->targetFile} in zip archive");
}
$data = $zip->getFromIndex($index);
unlink($tmpFile);
$zip->close();
$response->setResponse($data);
Kurogo::log(LOG_DEBUG, sprintf("Returned status %d and %d bytes", $response->getCode(), strlen($data)), 'url_retriever');
return $response;
}
示例15: retrieveResponse
protected function retrieveResponse()
{
$this->initRequestIfNeeded();
$method = $this->method();
$parameters = $this->parameters();
$soapClient = $this->getSOAPClient();
$options = array();
if ($this->location) {
$options['location'] = $this->location;
}
if ($this->uri) {
$options['uri'] = $this->uri;
}
if ($this->action) {
$options['soapaction'] = $this->action;
}
$headers = $this->soapHeaders;
Kurogo::log(LOG_DEBUG, sprintf("Calling SOAP Method %s", $method), 'soap');
$response = $this->initResponse();
$response->setStartTime(microtime(true));
try {
$data = $soapClient->__soapCall($method, $parameters, $options, $headers, $outputHeaders);
} catch (SoapFault $fault) {
throw new KurogoDataException($fault->getMessage(), $fault->getCode());
}
$response->setEndTime(microtime(true));
if (!($lastResponseHeaders = $soapClient->__getLastResponseHeaders())) {
$lastResponseHeaders = array();
}
$response = $this->initResponse();
if ($file = $this->saveToFile()) {
$filePath = $this->cache->getFullPath($file);
file_put_contents($filePath, $data);
$data = $filePath;
}
if ($this->authority) {
$response->setContext('authority', $this->authority);
}
$response->setRequest($this->location, $method, $parameters, $this->soapHeaders, $this->soapOptions);
$response->setResponse($data);
return $response;
}