當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Piwik_Common::trackerCache方法代碼示例

本文整理匯總了PHP中Piwik_Common::trackerCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP Piwik_Common::trackerCache方法的具體用法?PHP Piwik_Common::trackerCache怎麽用?PHP Piwik_Common::trackerCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik_Common的用法示例。


在下文中一共展示了Piwik_Common::trackerCache方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sendRequest

 protected function sendRequest($url, $method = 'GET', $data = null, $force = false)
 {
     // if doing a bulk request, store the url
     if ($this->doBulkRequests && !$force) {
         $this->storedTrackingActions[] = $url;
         return true;
     }
     if ($method == 'POST') {
         $requests = array();
         foreach ($this->storedTrackingActions as $action) {
             $requests[] = $this->parseUrl($action);
         }
         $testEnvironmentArgs = array();
     } else {
         $testEnvironmentArgs = $this->parseUrl($url);
         $requests = array($testEnvironmentArgs);
     }
     // unset cached values
     Piwik_Common::$trackerCache = null;
     Piwik_Tracker::setForceIp(null);
     Piwik_Tracker::setForceDateTime(null);
     Piwik_Tracker::setForceVisitorId(null);
     // save some values
     $plugins = Piwik_Config::getInstance()->Plugins['Plugins'];
     $pluginsTracker = Piwik_Config::getInstance()->Plugins_Tracker['Plugins_Tracker'];
     $oldTrackerConfig = Piwik_Config::getInstance()->Tracker;
     Piwik_PluginsManager::getInstance()->unloadPlugins();
     // modify config
     $GLOBALS['PIWIK_TRACKER_MODE'] = true;
     $GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING'] = true;
     Piwik_Common::$initTrackerMode = false;
     Piwik_Tracker::setTestEnvironment($testEnvironmentArgs, $method);
     // set language
     $oldLang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
     $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $this->acceptLanguage;
     // set user agent
     $oldUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
     $_SERVER['HTTP_USER_AGENT'] = $this->userAgent;
     // set cookie
     $oldCookie = $_COOKIE;
     parse_str(parse_url($this->requestCookie, PHP_URL_QUERY), $_COOKIE);
     // do tracking and capture output
     ob_start();
     $localTracker = new Piwik_Tracker();
     $localTracker->main($requests);
     $output = ob_get_contents();
     ob_end_clean();
     // restore vars
     Piwik_Config::getInstance()->Plugins_Tracker['Plugins_Tracker'] = $pluginsTracker;
     Piwik_Config::getInstance()->Tracker = $oldTrackerConfig;
     $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $oldLang;
     $_SERVER['HTTP_USER_AGENT'] = $oldUserAgent;
     $_COOKIE = $oldCookie;
     $GLOBALS['PIWIK_TRACKER_LOCAL_TRACKING'] = false;
     $GLOBALS['PIWIK_TRACKER_MODE'] = false;
     unset($_GET['bots']);
     // reload plugins
     Piwik_PluginsManager::getInstance()->loadPlugins($plugins);
     return $output;
 }
開發者ID:nomoto-ubicast,項目名稱:piwik,代碼行數:60,代碼來源:LocalTracker.php

示例2: getTrackerCache

 protected static function getTrackerCache()
 {
     if (is_null(self::$trackerCache)) {
         self::$trackerCache = new Piwik_CacheFile('tracker');
     }
     return self::$trackerCache;
 }
開發者ID:nomoto-ubicast,項目名稱:piwik,代碼行數:7,代碼來源:Common.php


注:本文中的Piwik_Common::trackerCache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。