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


PHP Tracker\Request类代码示例

本文整理汇总了PHP中Piwik\Tracker\Request的典型用法代码示例。如果您正苦于以下问题:PHP Request类的具体用法?PHP Request怎么用?PHP Request使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: enrichVisitWithLocation

 public function enrichVisitWithLocation(&$visitorInfo, \Piwik\Tracker\Request $request)
 {
     require_once PIWIK_INCLUDE_PATH . "/plugins/UserCountry/LocationProvider.php";
     $ipAddress = IP::N2P(Config::getInstance()->Tracker['use_anonymized_ip_for_visit_enrichment'] == 1 ? $visitorInfo['location_ip'] : $request->getIp());
     $userInfo = array('lang' => $visitorInfo['location_browser_lang'], 'ip' => $ipAddress);
     $id = Common::getCurrentLocationProviderId();
     $provider = LocationProvider::getProviderById($id);
     if ($provider === false) {
         $id = DefaultProvider::ID;
         $provider = LocationProvider::getProviderById($id);
         Common::printDebug("GEO: no current location provider sent, falling back to default '{$id}' one.");
     }
     $location = $provider->getLocation($userInfo);
     // if we can't find a location, use default provider
     if ($location === false) {
         $defaultId = DefaultProvider::ID;
         $provider = LocationProvider::getProviderById($defaultId);
         $location = $provider->getLocation($userInfo);
         Common::printDebug("GEO: couldn't find a location with Geo Module '{$id}', using Default '{$defaultId}' provider as fallback...");
         $id = $defaultId;
     }
     Common::printDebug("GEO: Found IP {$ipAddress} location (provider '" . $id . "'): " . var_export($location, true));
     if (empty($location['country_code'])) {
         // sanity check
         $location['country_code'] = \Piwik\Tracker\Visit::UNKNOWN_CODE;
     }
     // add optional location components
     $this->updateVisitInfoWithLocation($visitorInfo, $location);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:29,代码来源:UserCountry.php

示例2: onExistingVisit

 public function onExistingVisit(&$valuesToUpdate, VisitProperties $visitProperties, Request $request)
 {
     $visitCustomVariables = $request->getMetadata('CustomVariables', 'visitCustomVariables');
     if (!empty($visitCustomVariables)) {
         $valuesToUpdate = array_merge($valuesToUpdate, $visitCustomVariables);
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:7,代码来源:CustomVariablesRequestProcessor.php

示例3: onExistingVisit

 /**
  * @param Request $request
  * @param Visitor $visitor
  * @param Action|null $action
  * @return mixed
  */
 public function onExistingVisit(Request $request, Visitor $visitor, $action)
 {
     $firstActionTime = $visitor->getVisitorColumn('visit_first_action_time');
     $totalTime = 1 + $request->getCurrentTimestamp() - $firstActionTime;
     $totalTime = $this->cleanupVisitTotalTime($totalTime);
     return $totalTime;
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:13,代码来源:VisitTotalTime.php

示例4: checkHeaderInTracker

 /**
  * Checks for DoNotTrack headers and if found, sets `$exclude` to `true`.
  */
 public function checkHeaderInTracker(&$exclude)
 {
     if ($exclude) {
         Common::printDebug("Visit is already excluded, no need to check DoNotTrack support.");
         return;
     }
     if (!$this->isActive()) {
         Common::printDebug("DoNotTrack support is not enabled, skip check");
         return;
     }
     if (isset($_SERVER['HTTP_X_DO_NOT_TRACK']) && $_SERVER['HTTP_X_DO_NOT_TRACK'] === '1' || isset($_SERVER['HTTP_DNT']) && substr($_SERVER['HTTP_DNT'], 0, 1) === '1') {
         $request = new Request($_REQUEST);
         $ua = $request->getUserAgent();
         if (strpos($ua, 'MSIE') !== false || strpos($ua, 'Trident') !== false) {
             Common::printDebug("INTERNET EXPLORER enable DoNotTrack by default; so Piwik ignores DNT IE browsers...");
             return;
         }
         Common::printDebug("DoNotTrack header found!");
         $exclude = true;
         $trackingCookie = IgnoreCookie::getTrackingCookie();
         $trackingCookie->delete();
         // this is an optional supplement to the site's tracking status resource at:
         //     /.well-known/dnt
         // per Tracking Preference Expression (draft)
         header('Tk: 1');
     } else {
         Common::printDebug("DoNotTrack header not found");
     }
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:32,代码来源:DoNotTrackHeaderChecker.php

示例5: onNewVisit

 /**
  * @param Request $request
  * @param Visitor $visitor
  * @param Action|null $action
  * @return mixed
  */
 public function onNewVisit(Request $request, Visitor $visitor, $action)
 {
     // Adding &dp=1 will disable the provider plugin, this is an "unofficial" parameter used to speed up log importer
     $disableProvider = $request->getParam('dp');
     if (!empty($disableProvider)) {
         return false;
     }
     // if provider info has already been set, abort
     $locationValue = $visitor->getVisitorColumn('location_provider');
     if (!empty($locationValue)) {
         return false;
     }
     $ip = $visitor->getVisitorColumn('location_ip');
     $privacyConfig = new PrivacyManagerConfig();
     if (!$privacyConfig->useAnonymizedIpForVisitEnrichment) {
         $ip = $request->getIp();
     }
     $ip = IPUtils::binaryToStringIP($ip);
     // In case the IP was anonymized, we should not continue since the DNS reverse lookup will fail and this will slow down tracking
     if (substr($ip, -2, 2) == '.0') {
         Common::printDebug("IP Was anonymized so we skip the Provider DNS reverse lookup...");
         return false;
     }
     $hostname = $this->getHost($ip);
     $hostnameExtension = ProviderPlugin::getCleanHostname($hostname);
     // add the provider value in the table log_visit
     $locationProvider = substr($hostnameExtension, 0, 100);
     return $locationProvider;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:35,代码来源:Provider.php

示例6: onExistingVisit

 /**
  * @param Request $request
  * @param Visitor $visitor
  * @param Action|null $action
  * @return mixed
  */
 public function onExistingVisit(Request $request, Visitor $visitor, $action)
 {
     if ($request->getParam('ping') == 1) {
         return false;
     }
     return $this->onNewVisit($request, $visitor, $action);
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:13,代码来源:VisitLastActionTime.php

示例7: enrichVisitWithProviderInfo

 /**
  * Logs the provider in the log_visit table
  */
 public function enrichVisitWithProviderInfo(&$visitorInfo, \Piwik\Tracker\Request $request)
 {
     // if provider info has already been set, abort
     if (!empty($visitorInfo['location_provider'])) {
         return;
     }
     $privacyConfig = new PrivacyManagerConfig();
     $ip = IP::N2P($privacyConfig->useAnonymizedIpForVisitEnrichment ? $visitorInfo['location_ip'] : $request->getIp());
     // In case the IP was anonymized, we should not continue since the DNS reverse lookup will fail and this will slow down tracking
     if (substr($ip, -2, 2) == '.0') {
         Common::printDebug("IP Was anonymized so we skip the Provider DNS reverse lookup...");
         return;
     }
     $hostname = $this->getHost($ip);
     $hostnameExtension = $this->getCleanHostname($hostname);
     // add the provider value in the table log_visit
     $visitorInfo['location_provider'] = $hostnameExtension;
     $visitorInfo['location_provider'] = substr($visitorInfo['location_provider'], 0, 100);
     // improve the country using the provider extension if valid
     $hostnameDomain = substr($hostnameExtension, 1 + strrpos($hostnameExtension, '.'));
     if ($hostnameDomain == 'uk') {
         $hostnameDomain = 'gb';
     }
     if (array_key_exists($hostnameDomain, Common::getCountriesList())) {
         $visitorInfo['location_country'] = $hostnameDomain;
     }
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:30,代码来源:Provider.php

示例8: onNewVisit

 /**
  * @param Request $request
  * @param Visitor $visitor
  * @param Action|null $action
  * @return mixed
  */
 public function onNewVisit(Request $request, Visitor $visitor, $action)
 {
     $referrerUrl = $request->getParam('urlref');
     $currentUrl = $request->getParam('url');
     $information = $this->getReferrerInformation($referrerUrl, $currentUrl, $request->getIdSite());
     return $information['referer_url'];
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:13,代码来源:ReferrerUrl.php

示例9: shouldHandle

 public static function shouldHandle(Request $request)
 {
     $name = $request->getParam('c_n');
     $interaction = $request->getParam('c_i');
     // if interaction is set we want it to be for instance an outlink, download, ...
     return !empty($name) && empty($interaction);
 }
开发者ID:adorableio,项目名称:piwik,代码行数:7,代码来源:ActionContent.php

示例10: onNewVisit

 /**
  * @param Request $request
  * @param Visitor $visitor
  * @param Action|null $action
  * @return mixed
  */
 public function onNewVisit(Request $request, Visitor $visitor, $action)
 {
     $language = $request->getBrowserLanguage();
     if (empty($language)) {
         return '';
     }
     return substr($language, 0, 20);
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:14,代码来源:Language.php

示例11: onNewVisit

 /**
  * @param Request $request
  * @param Visitor $visitor
  * @param Action|null $action
  * @return mixed
  */
 public function onNewVisit(Request $request, Visitor $visitor, $action)
 {
     $daysSinceLastOrder = $request->getDaysSinceLastOrder();
     if ($daysSinceLastOrder === false) {
         $daysSinceLastOrder = 0;
     }
     return $daysSinceLastOrder;
 }
开发者ID:piwik,项目名称:piwik,代码行数:14,代码来源:VisitorDaysSinceOrder.php

示例12: onNewVisit

 /**
  * @param Request $request
  * @param Visitor $visitor
  * @param Action|null $action
  * @return mixed
  */
 public function onNewVisit(Request $request, Visitor $visitor, $action)
 {
     $resolution = $request->getParam('res');
     if (!empty($resolution)) {
         return substr($resolution, 0, 9);
     }
     return $resolution;
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:14,代码来源:Resolution.php

示例13: onExistingVisit

 /**
  * @param Request $request
  * @param Visitor $visitor
  * @param Action|null $action
  *
  * @return mixed|false
  */
 public function onExistingVisit(Request $request, Visitor $visitor, $action)
 {
     $forcedUserId = $request->getForcedUserId();
     if ($forcedUserId) {
         return $forcedUserId;
     }
     return false;
 }
开发者ID:KingNoosh,项目名称:Teknik,代码行数:15,代码来源:UserId.php

示例14: trackRequest

 public function trackRequest(Request $request)
 {
     $allParams = $request->getRawParams();
     if (!empty($allParams['forceThrow'])) {
         throw new ForcedException("forced exception");
     }
     return parent::trackRequest($request);
 }
开发者ID:ruchitrami,项目名称:plugin-QueuedTracking,代码行数:8,代码来源:Tracker.php

示例15: onLookupAction

 public function onLookupAction(Request $request, Action $action)
 {
     $contentTarget = $request->getParam('c_t');
     $contentTarget = trim($contentTarget);
     if (strlen($contentTarget) > 0) {
         return $contentTarget;
     }
     return false;
 }
开发者ID:cemo,项目名称:piwik,代码行数:9,代码来源:ContentTarget.php


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