当前位置: 首页>>代码示例>>PHP>>正文


PHP Kurogo::getElapsed方法代码示例

本文整理汇总了PHP中Kurogo::getElapsed方法的典型用法代码示例。如果您正苦于以下问题:PHP Kurogo::getElapsed方法的具体用法?PHP Kurogo::getElapsed怎么用?PHP Kurogo::getElapsed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kurogo的用法示例。


在下文中一共展示了Kurogo::getElapsed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:35,代码来源:KurogoStats.php

示例2: 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;
     }
     $statsLogFilename = Kurogo::getOptionalSiteVar('KUROGO_STATS_LOG_FILENAME', "kurogo_stats_log_v1");
     $statsLogFile = LOG_DIR . DIRECTORY_SEPARATOR . $statsLogFilename;
     $current = time();
     $logData = array('timestamp' => time(), 'date' => date('Y-m-d H:i:s', $current), 'service' => $service, 'site' => SITE_KEY, '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());
     $fields = array_fill(0, count($logData), '%s');
     $data = array_merge(array(implode("\t", $fields)), array_values($logData));
     $content = call_user_func_array('sprintf', $data) . PHP_EOL;
     self::fileAppend($statsLogFile, $content);
     return true;
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:32,代码来源:KurogoStats.php


注:本文中的Kurogo::getElapsed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。