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


PHP Piwik_Common::initTrackerMode方法代码示例

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


在下文中一共展示了Piwik_Common::initTrackerMode方法的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: initCorePiwikInTrackerMode

 protected static function initCorePiwikInTrackerMode()
 {
     if (!empty($GLOBALS['PIWIK_TRACKER_MODE']) && self::$initTrackerMode === false) {
         self::$initTrackerMode = true;
         require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
         require_once PIWIK_INCLUDE_PATH . '/core/Option.php';
         try {
             $access = Zend_Registry::get('access');
         } catch (Exception $e) {
             Piwik::createAccessObject();
         }
         try {
             $config = Piwik_Config::getInstance();
         } catch (Exception $e) {
             Piwik::createConfigObject();
         }
         try {
             $db = Zend_Registry::get('db');
         } catch (Exception $e) {
             Piwik::createDatabaseObject();
         }
         $pluginsManager = Piwik_PluginsManager::getInstance();
         $pluginsToLoad = Piwik_Config::getInstance()->Plugins['Plugins'];
         $pluginsForcedNotToLoad = Piwik_Tracker::getPluginsNotToLoad();
         $pluginsToLoad = array_diff($pluginsToLoad, $pluginsForcedNotToLoad);
         $pluginsManager->loadPlugins($pluginsToLoad);
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:28,代码来源:Common.php


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